1 From b39d5caa499559be6c309b9fd8f8b2f992504e18 Mon Sep 17 00:00:00 2001
2 From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
3 Date: Wed, 12 Jun 2019 20:24:57 +0200
4 Subject: [PATCH] clk: raspberrypi: register platform device for
7 Commit e2bb18347c8e5c4187831f3700c380e3c759601a upstream.
9 As 'clk-raspberrypi' depends on RPi's firmware interface, which might be
10 configured as a module, the cpu clock might not be available for the
11 cpufreq driver during it's init process. So we register the
12 'raspberrypi-cpufreq' platform device after the probe sequence succeeds.
14 Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
15 Acked-by: Eric Anholt <eric@anholt.net>
16 Signed-off-by: Stephen Boyd <sboyd@kernel.org>
18 drivers/clk/bcm/clk-raspberrypi.c | 15 +++++++++++++++
19 1 file changed, 15 insertions(+)
21 --- a/drivers/clk/bcm/clk-raspberrypi.c
22 +++ b/drivers/clk/bcm/clk-raspberrypi.c
24 struct raspberrypi_clk {
26 struct rpi_firmware *firmware;
27 + struct platform_device *cpufreq;
29 unsigned long min_rate;
30 unsigned long max_rate;
31 @@ -272,6 +273,7 @@ static int raspberrypi_clk_probe(struct
34 rpi->firmware = firmware;
35 + platform_set_drvdata(pdev, rpi);
37 ret = raspberrypi_register_pllb(rpi);
39 @@ -283,6 +285,18 @@ static int raspberrypi_clk_probe(struct
43 + rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
49 +static int raspberrypi_clk_remove(struct platform_device *pdev)
51 + struct raspberrypi_clk *rpi = platform_get_drvdata(pdev);
53 + platform_device_unregister(rpi->cpufreq);
58 @@ -291,6 +305,7 @@ static struct platform_driver raspberryp
59 .name = "raspberrypi-clk",
61 .probe = raspberrypi_clk_probe,
62 + .remove = raspberrypi_clk_remove,
64 module_platform_driver(raspberrypi_clk_driver);