Message ID | 20210531184749.2475868-2-arnd@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | clk: clean up legacy clock interfaces | expand |
On Mon, May 31, 2021 at 08:47:43PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > 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> > --- > arch/mips/Kconfig | 1 + > arch/mips/ar7/clock.c | 32 ++++++++++++-------------------- > 2 files changed, 13 insertions(+), 20 deletions(-) > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > index ed51970c08e7..1cc03a7652a9 100644 > --- a/arch/mips/Kconfig > +++ b/arch/mips/Kconfig > @@ -215,6 +215,7 @@ config AR7 > select SYS_SUPPORTS_ZBOOT_UART16550 > select GPIOLIB > select VLYNQ > + select CLKDEV_LOOKUP > select HAVE_LEGACY_CLK > help > Support for the Texas Instruments AR7 System-on-a-Chip > diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c > index 95def949c971..c614f254f370 100644 > --- a/arch/mips/ar7/clock.c > +++ b/arch/mips/ar7/clock.c > @@ -5,6 +5,7 @@ > * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org> > */ > > +#include <linux/clkdev.h> > #include <linux/kernel.h> > #include <linux/init.h> > #include <linux/types.h> > @@ -14,6 +15,7 @@ > #include <linux/io.h> > #include <linux/err.h> > #include <linux/clk.h> > +#include <linux/clkdev.h> Did you mean to include this twice?
On Tue, Jun 1, 2021 at 3:23 PM Russell King (Oracle) <linux@armlinux.org.uk> wrote: > > */ > > > > +#include <linux/clkdev.h> > > #include <linux/kernel.h> > > #include <linux/init.h> > > #include <linux/types.h> > > @@ -14,6 +15,7 @@ > > #include <linux/io.h> > > #include <linux/err.h> > > #include <linux/clk.h> > > +#include <linux/clkdev.h> > > Did you mean to include this twice? > I thought I had fixed that earlier, but apparently edited the wrong patch. Thanks for finding it, fixed now. Arnd
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ed51970c08e7..1cc03a7652a9 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -215,6 +215,7 @@ config AR7 select SYS_SUPPORTS_ZBOOT_UART16550 select GPIOLIB select VLYNQ + select CLKDEV_LOOKUP select HAVE_LEGACY_CLK help Support for the Texas Instruments AR7 System-on-a-Chip diff --git a/arch/mips/ar7/clock.c b/arch/mips/ar7/clock.c index 95def949c971..c614f254f370 100644 --- a/arch/mips/ar7/clock.c +++ b/arch/mips/ar7/clock.c @@ -5,6 +5,7 @@ * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org> */ +#include <linux/clkdev.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/types.h> @@ -14,6 +15,7 @@ #include <linux/io.h> #include <linux/err.h> #include <linux/clk.h> +#include <linux/clkdev.h> #include <asm/addrspace.h> #include <asm/mach-ar7/ar7.h> @@ -424,27 +426,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 +452,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 */