From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> To: stefan.wahren@i2se.com, linux-kernel@vger.kernel.org Cc: mbrugger@suse.de, viresh.kumar@linaro.org, rjw@rjwysocki.net, sboyd@kernel.org, eric@anholt.net, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, ptesarik@suse.com, linux-rpi-kernel@lists.infradead.org, ssuloev@orpaltech.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mturquette@baylibre.com, linux-pm@vger.kernel.org, Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Subject: [PATCH v4 5/7] clk: raspberrypi: register platform device for raspberrypi-cpufreq Date: Wed, 12 Jun 2019 20:24:57 +0200 [thread overview] Message-ID: <20190612182500.4097-6-nsaenzjulienne@suse.de> (raw) In-Reply-To: <20190612182500.4097-1-nsaenzjulienne@suse.de> As 'clk-raspberrypi' depends on RPi's firmware interface, which might be configured as a module, the cpu clock might not be available for the cpufreq driver during it's init process. So we register the 'raspberrypi-cpufreq' platform device after the probe sequence succeeds. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Acked-by: Eric Anholt <eric@anholt.net> --- Changes since v2: - Use raspberrypi_clk struct to store cpufreq platform_device drivers/clk/bcm/clk-raspberrypi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c index fef1f7caee4f..1654fd0eedc9 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -34,6 +34,7 @@ struct raspberrypi_clk { struct device *dev; struct rpi_firmware *firmware; + struct platform_device *cpufreq; unsigned long min_rate; unsigned long max_rate; @@ -272,6 +273,7 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) rpi->dev = dev; rpi->firmware = firmware; + platform_set_drvdata(pdev, rpi); ret = raspberrypi_register_pllb(rpi); if (ret) { @@ -283,6 +285,18 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) if (ret) return ret; + rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq", + -1, NULL, 0); + + return 0; +} + +static int raspberrypi_clk_remove(struct platform_device *pdev) +{ + struct raspberrypi_clk *rpi = platform_get_drvdata(pdev); + + platform_device_unregister(rpi->cpufreq); + return 0; } @@ -291,6 +305,7 @@ static struct platform_driver raspberrypi_clk_driver = { .name = "raspberrypi-clk", }, .probe = raspberrypi_clk_probe, + .remove = raspberrypi_clk_remove, }; module_platform_driver(raspberrypi_clk_driver); -- 2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> To: stefan.wahren@i2se.com, linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, ptesarik@suse.com, sboyd@kernel.org, viresh.kumar@linaro.org, mturquette@baylibre.com, linux-pm@vger.kernel.org, rjw@rjwysocki.net, eric@anholt.net, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne <nsaenzjulienne@suse.de>, linux-clk@vger.kernel.org, mbrugger@suse.de, ssuloev@orpaltech.com Subject: [PATCH v4 5/7] clk: raspberrypi: register platform device for raspberrypi-cpufreq Date: Wed, 12 Jun 2019 20:24:57 +0200 [thread overview] Message-ID: <20190612182500.4097-6-nsaenzjulienne@suse.de> (raw) In-Reply-To: <20190612182500.4097-1-nsaenzjulienne@suse.de> As 'clk-raspberrypi' depends on RPi's firmware interface, which might be configured as a module, the cpu clock might not be available for the cpufreq driver during it's init process. So we register the 'raspberrypi-cpufreq' platform device after the probe sequence succeeds. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Acked-by: Eric Anholt <eric@anholt.net> --- Changes since v2: - Use raspberrypi_clk struct to store cpufreq platform_device drivers/clk/bcm/clk-raspberrypi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c index fef1f7caee4f..1654fd0eedc9 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -34,6 +34,7 @@ struct raspberrypi_clk { struct device *dev; struct rpi_firmware *firmware; + struct platform_device *cpufreq; unsigned long min_rate; unsigned long max_rate; @@ -272,6 +273,7 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) rpi->dev = dev; rpi->firmware = firmware; + platform_set_drvdata(pdev, rpi); ret = raspberrypi_register_pllb(rpi); if (ret) { @@ -283,6 +285,18 @@ static int raspberrypi_clk_probe(struct platform_device *pdev) if (ret) return ret; + rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq", + -1, NULL, 0); + + return 0; +} + +static int raspberrypi_clk_remove(struct platform_device *pdev) +{ + struct raspberrypi_clk *rpi = platform_get_drvdata(pdev); + + platform_device_unregister(rpi->cpufreq); + return 0; } @@ -291,6 +305,7 @@ static struct platform_driver raspberrypi_clk_driver = { .name = "raspberrypi-clk", }, .probe = raspberrypi_clk_probe, + .remove = raspberrypi_clk_remove, }; module_platform_driver(raspberrypi_clk_driver); -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-12 18:25 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-12 18:24 [PATCH v4 0/7] cpufreq support for Raspberry Pi Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-06-12 18:24 ` [PATCH v4 1/7] clk: bcm2835: remove pllb Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-06-25 23:04 ` Stephen Boyd 2019-06-25 23:04 ` Stephen Boyd 2019-06-12 18:24 ` [PATCH v4 2/7] clk: bcm283x: add driver interfacing with Raspberry Pi's firmware Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-06-25 23:04 ` Stephen Boyd 2019-06-25 23:04 ` Stephen Boyd 2019-06-12 18:24 ` [PATCH v4 3/7] firmware: raspberrypi: register clk device Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-06-25 23:04 ` Stephen Boyd 2019-06-25 23:04 ` Stephen Boyd 2019-06-12 18:24 ` [PATCH v4 4/7] cpufreq: add driver for Raspberry Pi Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-06-13 3:28 ` Viresh Kumar 2019-06-13 3:28 ` Viresh Kumar 2019-06-12 18:24 ` Nicolas Saenz Julienne [this message] 2019-06-12 18:24 ` [PATCH v4 5/7] clk: raspberrypi: register platform device for raspberrypi-cpufreq Nicolas Saenz Julienne 2019-06-25 23:05 ` Stephen Boyd 2019-06-25 23:05 ` Stephen Boyd 2019-06-12 18:24 ` [PATCH v4 6/7] ARM: defconfig: enable cpufreq driver for RPi Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-07-23 21:33 ` Stefan Wahren 2019-07-23 21:33 ` Stefan Wahren 2019-06-12 18:24 ` [PATCH v4 7/7] arm64: defconfig: enable cpufreq support for RPi3 Nicolas Saenz Julienne 2019-06-12 18:24 ` Nicolas Saenz Julienne 2019-07-23 21:34 ` Stefan Wahren 2019-07-23 21:34 ` Stefan Wahren 2019-06-12 20:17 ` [PATCH v4 0/7] cpufreq support for Raspberry Pi Stefan Wahren 2019-06-12 20:17 ` Stefan Wahren 2019-06-13 3:31 ` Florian Fainelli 2019-06-13 3:31 ` Florian Fainelli 2019-06-13 4:31 ` Stefan Wahren 2019-06-13 4:31 ` Stefan Wahren 2019-06-22 9:54 ` Stefan Wahren 2019-06-22 9:54 ` Stefan Wahren 2019-06-25 23:02 ` Stephen Boyd 2019-06-25 23:02 ` Stephen Boyd
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190612182500.4097-6-nsaenzjulienne@suse.de \ --to=nsaenzjulienne@suse.de \ --cc=bcm-kernel-feedback-list@broadcom.com \ --cc=eric@anholt.net \ --cc=f.fainelli@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=linux-rpi-kernel@lists.infradead.org \ --cc=mbrugger@suse.de \ --cc=mturquette@baylibre.com \ --cc=ptesarik@suse.com \ --cc=rjw@rjwysocki.net \ --cc=sboyd@kernel.org \ --cc=ssuloev@orpaltech.com \ --cc=stefan.wahren@i2se.com \ --cc=viresh.kumar@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.