Re: [PATCH v2 2/5] clk: bcm: rpi: Turn firmware clock on/off when preparing/unpreparing

Stefan Wahren
2025-10-02T14:52:30Z

Hi,

Am 01.10.25 um 22:50 schrieb Melissa Wen:
>
>
> On 26/09/2025 07:36, Stefan Wahren wrote:
>> Hi Marek,
>>
>> ....
>> AFAIK the offending clock change isn't in the downstream kernel, so I
>> like to see the opinion of María and the Raspberry Pi people first.
>
> Hi,
>
> I see in the downstream kernel the CLOCK_V3D was removed in favor of
> firmware clock:
> https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/clk/bcm/clk-bcm2835.c#L2076
>
>
> Also, v3d in RPi4 is set to use the firmware clock:
> https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/broadcom/bcm2711-rpi.dtsi#L97
>
>
> I think v3d clock is missed on boot, but I also think the issue should
> be solved by setting the v3d firmware clock for Pi3.
> WDYT? Can you check it on your side? Something like:
>
> diff --git a/arch/arm/boot/dts/broadcom/bcm2835-rpi-common.dtsi
> b/arch/arm/boot/dts/broadcom/bcm2835-rpi-common.dtsi
> index 8b3c21d9f333..3289cb5dfa8e 100644
> --- a/arch/arm/boot/dts/broadcom/bcm2835-rpi-common.dtsi
> +++ b/arch/arm/boot/dts/broadcom/bcm2835-rpi-common.dtsi
> @@ -14,6 +14,7 @@ &hdmi {
>  };
>
>  &v3d {
> +       clocks = <&firmware_clocks 5>;
>         power-domains = <&power RPI_POWER_DOMAIN_V3D>;
>  };
thanks for pointing out. Handling the same clock by clk-raspberrypi and
clk-bcm2835 is a very bad idea. But it looks like that's not the only
affected clock. I see at least ISP and VEC, which might be affected.

Does anyone know, if the clk-raspberrypi always use a matching clock
name in comparison to the clk-bcm2835?
clk-bcm2835 - clk-raspberrypi
BCM2835_CLOCK_V3D equals to RPI_FIRMWARE_V3D_CLK_ID
BCM2835_CLOCK_ISP equals to RPI_FIRMWARE_ISP_CLK_ID
...
Or are there any clocks, which have different names in both drivers but
describe the same hardware clock?

Best regards
>
> Best regards,
>
> Melissa
>
>>
>> Currently I know that in the error case the following clocks are
>> disabled during boot of Raspberry Pi 3B+:
>> fw-clk-vec
>> fw-clk-isp
>> fw-clk-v3d
>>
>> So it's very likely that the vc4 drivers tries to access the register
>> after the these clocks has been disabled and then the system freeze.
>> The workaround above was just a wild guess, so currently I don't know
>> why this change avoid the freeze.
>>
>> Best regards
>