Message ID | 20190604173223.4229-4-nsaenzjulienne@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | cpufreq support for the Raspberry Pi | expand |
Nicolas Saenz Julienne <nsaenzjulienne@suse.de> writes: > Registers clk-raspberrypi as a platform device as part of the driver's > probe sequence. Similar to how we have VCHI register platform devices for the services VCHI provides, shouldn't we have the firmware driver register the device for clk_raspberrypi? Or put the clk provider in the fw driver instead of a separate driver (no opinion on my part).
On Tue, 2019-06-04 at 17:00 -0700, Eric Anholt wrote: > Nicolas Saenz Julienne <nsaenzjulienne@suse.de> writes: > > > Registers clk-raspberrypi as a platform device as part of the driver's > > probe sequence. > > Similar to how we have VCHI register platform devices for the services > VCHI provides, shouldn't we have the firmware driver register the device > for clk_raspberrypi? Or put the clk provider in the fw driver instead > of a separate driver (no opinion on my part). Makes sense to me, I'll move the platform driver registration into the firmware driver.
Am 05.06.19 um 11:11 schrieb Nicolas Saenz Julienne: > On Tue, 2019-06-04 at 17:00 -0700, Eric Anholt wrote: >> Nicolas Saenz Julienne <nsaenzjulienne@suse.de> writes: >> >>> Registers clk-raspberrypi as a platform device as part of the driver's >>> probe sequence. >> Similar to how we have VCHI register platform devices for the services >> VCHI provides, shouldn't we have the firmware driver register the device >> for clk_raspberrypi? Or put the clk provider in the fw driver instead >> of a separate driver (no opinion on my part). > Makes sense to me, I'll move the platform driver registration into the firmware > driver. Fine. Please keep in mind that you might need to add a MODULE_ALIAS otherwise autoload won't work.
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index ccb0319fc2e9..6f370e6bafed 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -2098,6 +2098,7 @@ static int bcm2835_mark_sdc_parent_critical(struct clk *sdc) static int bcm2835_clk_probe(struct platform_device *pdev) { + struct platform_device *rpi_fw_clk; struct device *dev = &pdev->dev; struct clk_hw **hws; struct bcm2835_cprman *cprman; @@ -2150,8 +2151,18 @@ static int bcm2835_clk_probe(struct platform_device *pdev) if (ret) return ret; - return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, - &cprman->onecell); + ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, + &cprman->onecell); + if (ret) + return ret; + + rpi_fw_clk = platform_device_register_data(NULL, "raspberrypi-clk", -1, + NULL, 0); + ret = PTR_ERR_OR_ZERO(rpi_fw_clk); + if (ret) + dev_err(dev, "Failed to create platform device, %d\n", ret); + + return ret; } static const struct of_device_id bcm2835_clk_of_match[] = {
Registers clk-raspberrypi as a platform device as part of the driver's probe sequence. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- drivers/clk/bcm/clk-bcm2835.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)