diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-05-29 17:04:37 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2021-06-08 17:00:08 +0200 |
commit | 4410c4236e6de337f35d4d88e503f414a8d5d10f (patch) | |
tree | 00c9c6dbb40b996c844a1ab18000270db4263cd4 /arch/mips/ar7/clock.c | |
parent | 6efb943b8616ec53a5e444193dccf1af9ad627b5 (diff) |
mips: ar7: convert to clkdev_lookup
ar7 is one of only two platforms that provide the clock interface but
implement a custom version of the clkdev_lookup code.
Change this to use the generic version instead.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/mips/ar7/clock.c')
-rw-r--r-- | arch/mips/ar7/clock.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c index 95def949c971..e8648e3eb27b 100644 --- a/arch/mips/ar7/clock.c +++ b/arch/mips/ar7/clock.c @@ -13,6 +13,7 @@ #include <linux/gcd.h> #include <linux/io.h> #include <linux/err.h> +#include <linux/clkdev.h> #include <linux/clk.h> #include <asm/addrspace.h> @@ -424,27 +425,15 @@ unsigned long clk_get_rate(struct clk *clk) } EXPORT_SYMBOL(clk_get_rate); -struct clk *clk_get(struct device *dev, const char *id) -{ - if (!strcmp(id, "bus")) - return &bus_clk; +static struct clk_lookup ar7_clkdev_table[] = { + CLKDEV_INIT(NULL, "bus", &bus_clk), /* cpmac and vbus share the same rate */ - if (!strcmp(id, "cpmac")) - return &vbus_clk; - if (!strcmp(id, "cpu")) - return &cpu_clk; - if (!strcmp(id, "dsp")) - return &dsp_clk; - if (!strcmp(id, "vbus")) - return &vbus_clk; - return ERR_PTR(-ENOENT); -} -EXPORT_SYMBOL(clk_get); - -void clk_put(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_put); + CLKDEV_INIT("cpmac.0", "cpmac", &vbus_clk), + CLKDEV_INIT("cpmac.1", "cpmac", &vbus_clk), + CLKDEV_INIT(NULL, "cpu", &cpu_clk), + CLKDEV_INIT(NULL, "dsp", &dsp_clk), + CLKDEV_INIT(NULL, "vbus", &vbus_clk), +}; void __init ar7_init_clocks(void) { @@ -462,6 +451,8 @@ void __init ar7_init_clocks(void) } /* adjust vbus clock rate */ vbus_clk.rate = bus_clk.rate / 2; + + clkdev_add_table(ar7_clkdev_table, ARRAY_SIZE(ar7_clkdev_table)); } /* dummy functions, should not be called */ |