Re: [PATCH 0/4] cpufreq support for the Raspberry Pi

From: Stefan Wahren
Date: Wed Jun 05 2019 - 05:50:40 EST

Hi Nicolas,

Am 04.06.19 um 19:32 schrieb Nicolas Saenz Julienne:
> Hi all,
> this series aims at adding cpufreq support to the Raspberry Pi family of
> boards.
> The previous revision can be found at:
> The series first factors out 'pllb' from clk-bcm2385 and creates a new
> clk driver that operates it over RPi's firmware interface[1]. We are
> forced to do so as the firmware 'owns' the pll and we're not allowed to
> change through the register interface directly as we might race with the
> over-temperature and under-voltage protections provided by the firmware.
it would be nice to preserve such design decision in the driver as a
comment, because the cover letter usually get lost.
> Next it creates a minimal cpufreq driver that populates the CPU's opp
> table, and registers cpufreq-dt. Which is needed as the firmware
> controls the max and min frequencies available.

I tested your series on top of Linux 5.2-rc1 with multi_v7_defconfig and
manually enable this drivers. During boot with Raspbian rootfs i'm
getting the following:

[ÂÂÂ 1.177009] cpu cpu0: failed to get clock: -2
[ÂÂÂ 1.183643] cpufreq-dt: probe of cpufreq-dt failed with error -2
[ÂÂÂ 1.192117] sdhci: Secure Digital Host Controller Interface driver
[ÂÂÂ 1.198725] sdhci: Copyright(c) Pierre Ossman
[ÂÂÂ 1.207005] Synopsys Designware Multimedia Card Interface Driver
[ÂÂÂ 1.319936] sdhost-bcm2835 3f202000.mmc: loaded - DMA enabled (>1)
[ÂÂÂ 1.326641] sdhci-pltfm: SDHCI platform and OF driver helper
[ÂÂÂ 1.336568] ledtrig-cpu: registered to indicate activity on CPUs
[ÂÂÂ 1.343713] usbcore: registered new interface driver usbhid
[ÂÂÂ 1.350275] usbhid: USB HID core driver
[ÂÂÂ 1.357639] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[ÂÂÂ 1.367490] NET: Registered protocol family 10
[ÂÂÂ 1.375013] Segment Routing with IPv6
[ÂÂÂ 1.381696] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ÂÂÂ 1.388980] NET: Registered protocol family 17
[ÂÂÂ 1.395624] can: controller area network core (rev 20170425 abi 9)
[ÂÂÂ 1.402358] NET: Registered protocol family 29
[ÂÂÂ 1.408997] can: raw protocol (rev 20170425)
[ÂÂÂ 1.415599] can: broadcast manager protocol (rev 20170425 t)
[ÂÂÂ 1.422219] can: netlink gateway (rev 20170425) max_hops=1
[ÂÂÂ 1.429369] Key type dns_resolver registered
[ÂÂÂ 1.437190] Registering SWP/SWPB emulation handler
[ÂÂÂ 1.444443] Loading compiled-in X.509 certificates
[ÂÂÂ 1.455693] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81,
base_baud = 0) is a PL011 rev2
[ÂÂÂ 1.462768] serial serial0: tty port ttyAMA0 registered
[ÂÂÂ 1.478755] mmc0: host does not support reading read-only switch,
assuming write-enable
[ÂÂÂ 1.488792] mmc0: new high speed SDHC card at address 0007
[ÂÂÂ 1.495766] raspberrypi-firmware soc:firmware: Attached to firmware
from 2019-03-27 15:45
[ÂÂÂ 1.496862] mmcblk0: mmc0:0007 SDCIT 14.6 GiB
[ÂÂÂ 1.512768] raspberrypi-clk raspberrypi-clk: CPU frequency range: min
600000000, max 1400000000
[ÂÂÂ 1.513012]Â mmcblk0: p1 p2
[ÂÂÂ 1.558085] dwc2 3f980000.usb: 3f980000.usb supply vusb_d not found,
using dummy regulator
[ÂÂÂ 1.565355] dwc2 3f980000.usb: 3f980000.usb supply vusb_a not found,
using dummy regulator
[ÂÂÂ 1.623246] dwc2 3f980000.usb: DWC OTG Controller
[ÂÂÂ 1.630318] dwc2 3f980000.usb: new USB bus registered, assigned bus
number 1
[ÂÂÂ 1.637439] dwc2 3f980000.usb: irq 33, io mem 0x3f980000
[ÂÂÂ 1.645268] hub 1-0:1.0: USB hub found
[ÂÂÂ 1.652317] hub 1-0:1.0: 1 port detected
[ÂÂÂ 1.665867] sdhci-iproc 3f300000.sdhci: allocated mmc-pwrseq
[ÂÂÂ 1.704788] mmc1: SDHCI controller on 3f300000.sdhci [3f300000.sdhci]
using PIO
[ÂÂÂ 1.717694] hctosys: unable to open rtc device (rtc0)
[ÂÂÂ 1.724967] sysfs: cannot create duplicate filename
[ÂÂÂ 1.732120] CPU: 1 PID: 1 Comm: swapper/0 Not tainted
5.2.0-rc1-00004-g5aa6d98-dirty #2
[ÂÂÂ 1.739288] Hardware name: BCM2835
[ÂÂÂ 1.746421] [<c0312304>] (unwind_backtrace) from [<c030cc08>]
[ÂÂÂ 1.753636] [<c030cc08>] (show_stack) from [<c0e7d358>]
[ÂÂÂ 1.760840] [<c0e7d358>] (dump_stack) from [<c0503b64>]
[ÂÂÂ 1.768105] [<c0503b64>] (sysfs_warn_dup) from [<c0503c8c>]
[ÂÂÂ 1.775481] [<c0503c8c>] (sysfs_create_dir_ns) from [<c0e82520>]
[ÂÂÂ 1.782958] [<c0e82520>] (kobject_add_internal) from [<c0e827c8>]
[ÂÂÂ 1.790534] [<c0e827c8>] (kobject_add) from [<c096b1cc>]
[ÂÂÂ 1.798180] [<c096b1cc>] (device_add) from [<c0971098>]
[ÂÂÂ 1.805945] [<c0971098>] (platform_device_add) from [<c0971ae4>]
[ÂÂÂ 1.813866] [<c0971ae4>] (platform_device_register_full) from
[<c15a7a30>] (raspberrypi_cpufreq_driver_init+0x128/0x178)
[ÂÂÂ 1.821916] [<c15a7a30>] (raspberrypi_cpufreq_driver_init) from
[<c0302eec>] (do_one_initcall+0x54/0x21c)
[ÂÂÂ 1.830099] [<c0302eec>] (do_one_initcall) from [<c15010f8>]
[ÂÂÂ 1.838312] [<c15010f8>] (kernel_init_freeable) from [<c0e949d4>]
[ÂÂÂ 1.846541] [<c0e949d4>] (kernel_init) from [<c03010e8>]
[ÂÂÂ 1.854783] Exception stack(0xea89dfb0 to 0xea89dff8)
00000000 00000000 00000000
[ÂÂÂ 1.871450] dfc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[ÂÂÂ 1.879860] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ÂÂÂ 1.888251] kobject_add_internal failed for cpufreq-dt with -EEXIST,
don't try to register things with the same name in the same directory.
[ÂÂÂ 1.896910] cpu cpu0: Failed to create platform device, -17

> This was tested on a RPi3b+ and RPI2b which are the boards I have access
> to. Until this is tested broadly the cpufreq driver takes care of
> filtering out the rest of boards.
Unfortunately this makes it harder to test on other boards. So i welcome
your decision to remove it.
> That's all,
> kind regards,
> Nicolas
> [1]
> ---
> Changes since RFC:
> - Addressed Viresh's comments in cpufreq driver
> - Addressed Stefan's comments in both cpufreq & clk drivers
Just a note for the future, this make it hard for other reviewers to
follow. I don't really consist of the credits, it is more important to
mention what has changed. But it's not necessary to mention every single