summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2023-03-22 08:56:45 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-03-23 13:05:12 +0100
commit73f8fa438095a8792eb97dad01c4ef2b36f50cbe (patch)
tree0a8e78ecfe6a03deea0daf8047440ff7e6793e84 /drivers/clk
parent35f1db94036d22b5892c300e017ebc91f83ae88b (diff)
downloadbarebox-73f8fa438095a8792eb97dad01c4ef2b36f50cbe.tar.gz
barebox-73f8fa438095a8792eb97dad01c4ef2b36f50cbe.tar.xz
clk: clk-gpio: Turn into driver
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>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk-gpio.c20
1 files 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);