[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230731121821.22242-12-mmyangfl@gmail.com>
Date: Mon, 31 Jul 2023 20:18:11 +0800
From: David Yang <mmyangfl@...il.com>
To: linux-clk@...r.kernel.org
Cc: David Yang <mmyangfl@...il.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, linux-kernel@...r.kernel.org
Subject: [PATCH v6 11/13] clk: hisilicon: hip04: Convert into platform driver module
Use common helper functions and register clks with a single of_device_id
data.
Signed-off-by: David Yang <mmyangfl@...il.com>
---
drivers/clk/hisilicon/clk-hip04.c | 39 +++++++++++++++++++------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/clk/hisilicon/clk-hip04.c b/drivers/clk/hisilicon/clk-hip04.c
index 785b9faf3ea5..9aa2481781cb 100644
--- a/drivers/clk/hisilicon/clk-hip04.c
+++ b/drivers/clk/hisilicon/clk-hip04.c
@@ -10,11 +10,8 @@
#include <linux/kernel.h>
#include <linux/clk-provider.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
+#include <linux/module.h>
#include <linux/of_device.h>
-#include <linux/slab.h>
#include <dt-bindings/clock/hip04-clock.h>
@@ -27,16 +24,28 @@ static struct hisi_fixed_rate_clock hip04_fixed_rate_clks[] __initdata = {
{ HIP04_CLK_168M, "clk168m", NULL, 0, 168750000, },
};
-static void __init hip04_clk_init(struct device_node *np)
-{
- struct hisi_clock_data *clk_data;
+static const struct hisi_clocks hip04_clks = {
+ .fixed_rate_clks = hip04_fixed_rate_clks,
+ .fixed_factor_clks_num = ARRAY_SIZE(hip04_fixed_rate_clks),
+};
+
+static const struct of_device_id hip04_clk_match_table[] = {
+ { .compatible = "hisilicon,hip04-clock",
+ .data = &hip04_clks },
+ { }
+};
+MODULE_DEVICE_TABLE(of, hip04_clk_match_table);
+
+static struct platform_driver hip04_clk_driver = {
+ .probe = hisi_clk_probe,
+ .remove_new = hisi_clk_remove,
+ .driver = {
+ .name = "hip04-clock",
+ .of_match_table = hip04_clk_match_table,
+ },
+};
- clk_data = hisi_clk_init(np, HIP04_NR_CLKS);
- if (!clk_data)
- return;
+module_platform_driver(hip04_clk_driver);
- hisi_clk_register_fixed_rate(hip04_fixed_rate_clks,
- ARRAY_SIZE(hip04_fixed_rate_clks),
- clk_data);
-}
-CLK_OF_DECLARE(hip04_clk, "hisilicon,hip04-clock", hip04_clk_init);
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("HiSilicon HiP04 Clock Driver");
--
2.40.1
Powered by blists - more mailing lists