mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/4] clk: clk-gpio: Turn into driver
Date: Wed, 22 Mar 2023 09:32:42 +0100	[thread overview]
Message-ID: <20230322083245.251340-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20230322083245.251340-1-s.hauer@pengutronix.de>

A comment states OF_CLK_DECLARE can't be used for the clk-gpio driver
as it needs to be registered after the GPIO controllers. If that's the
case there is no point in calling of_clk_init() directly from an
initcall. We can better register it as a regular driver which also
makes deep probe work.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/clk/clk-gpio.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
index 6ac2e820fa..8cc0c5fc97 100644
--- a/drivers/clk/clk-gpio.c
+++ b/drivers/clk/clk-gpio.c
@@ -50,8 +50,9 @@ static struct clk_ops clk_gpio_ops = {
 	.is_enabled = clk_gpio_is_enabled,
 };
 
-static int of_gpio_clk_setup(struct device_node *node)
+static int of_gpio_clk_probe(struct device *dev)
 {
+	struct device_node *node = dev->device_node;
 	struct clk_gpio *clk_gpio;
 	enum of_gpio_flags of_flags;
 	unsigned long flags;
@@ -105,16 +106,15 @@ no_parent:
 	return ret;
 }
 
-/* Can't use OF_CLK_DECLARE due to need to run after GPIOcontrollers have
- * registrered */
-
 static const struct of_device_id clk_gpio_device_id[] = {
-	{ .compatible = "gpio-gate-clock", .data = of_gpio_clk_setup, },
+	{ .compatible = "gpio-gate-clock", },
 	{}
 };
 
-static int clk_gpio_init(void)
-{
-	return of_clk_init(NULL, clk_gpio_device_id);
-}
-coredevice_initcall(clk_gpio_init);
+static struct driver gpio_gate_clock_driver = {
+	.probe = of_gpio_clk_probe,
+	.name = "gpio-gate-clock",
+	.of_compatible = DRV_OF_COMPAT(clk_gpio_device_id),
+};
+
+core_platform_driver(gpio_gate_clock_driver);
-- 
2.30.2




  reply	other threads:[~2023-03-22  8:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22  8:32 [PATCH 0/4] Allow to probe clks added in overlays Sascha Hauer
2023-03-22  8:32 ` Sascha Hauer [this message]
2023-03-22  8:32 ` [PATCH 2/4] clk: of: drop arguments from of_clk_init() Sascha Hauer
2023-03-22  8:32 ` [PATCH 3/4] clk: of: make of_clk_init() safe for being called multiple times Sascha Hauer
2023-03-22  8:32 ` [PATCH 4/4] commands: of_overlay: Allow to register clocks from overlay Sascha Hauer
2023-03-22  9:25   ` Sascha Hauer

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=20230322083245.251340-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox