[PATCH] clk: bcm: rpi: Don't register as OF provider if !dev->np

Marek Szyprowski m.szyprowski at samsung.com
Fri Mar 26 06:24:35 GMT 2021


On 25.03.2021 19:57, Nicolas Saenz Julienne wrote:
> There are two ways clk-raspberrypi might be registered: through
> device-tree or through an explicit platform device registration. The
> latter happens after firmware/raspberrypi's probe, and it's limited to
> RPi3s, which solely use the ARM clock to scale CPU's frequency. That
> clock is matched with cpu0's device thanks to the ARM clock being
> registered as a clkdev.
>
> In that scenario, don't register the device as an OF clock provider, as
> it makes no sense and will cause trouble.
>
> Fixes: d4b4f1b6b97e ("clk: bcm: rpi: Add DT provider for the clocks")
> Reported-by: Marek Szyprowski <m.szyprowski at samsung.com>
> Signed-off-by: Nicolas Saenz Julienne <nsaenz at kernel.org>
Tested-by: Marek Szyprowski <m.szyprowski at samsung.com>
> ---
>   drivers/clk/bcm/clk-raspberrypi.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
> index f89b9cfc4309..27e85687326f 100644
> --- a/drivers/clk/bcm/clk-raspberrypi.c
> +++ b/drivers/clk/bcm/clk-raspberrypi.c
> @@ -337,10 +337,12 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>   
> -	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
> -					  clk_data);
> -	if (ret)
> -		return ret;
> +	if (dev->of_node) {
> +		ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
> +						  clk_data);
> +		if (ret)
> +			return ret;
> +	}
>   
>   	rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
>   						     -1, NULL, 0);

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland




More information about the linux-rpi-kernel mailing list