Re: [PATCH v3 6/6] ARM: s5pv210: Migrate clock handling to Common Clock Framework
Hi Mateusz, On Wednesday 28 of August 2013 18:13:04 Mateusz Krawczuk wrote: > This patch migrates the s5pv210 platform to use new clock driver > using Common Clock Framework. > > Signed-off-by: Mateusz Krawczuk > --- > arch/arm/mach-s5pv210/Kconfig | 9 + > arch/arm/mach-s5pv210/Makefile| 4 ++-- > arch/arm/mach-s5pv210/common.c| 17 + > arch/arm/mach-s5pv210/common.h| 13 + > arch/arm/mach-s5pv210/mach-aquila.c | 1 + > arch/arm/mach-s5pv210/mach-goni.c | 3 ++- > arch/arm/mach-s5pv210/mach-smdkc110.c | 1 + > arch/arm/mach-s5pv210/mach-smdkv210.c | 1 + > arch/arm/mach-s5pv210/mach-torbreck.c | 1 + > arch/arm/plat-samsung/Kconfig | 2 +- > arch/arm/plat-samsung/init.c | 2 -- > 11 files changed, 48 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-s5pv210/Kconfig > b/arch/arm/mach-s5pv210/Kconfig index caaedaf..ad4546e 100644 > --- a/arch/arm/mach-s5pv210/Kconfig > +++ b/arch/arm/mach-s5pv210/Kconfig > @@ -15,6 +15,7 @@ config CPU_S5PV210 > select S5P_PM if PM > select S5P_SLEEP if PM > select SAMSUNG_DMADEV > + select S5P_CLOCK if !COMMON_CLK > help > Enable S5PV210 CPU support > > @@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY > help > Common setup code for USB PHY controller > > +config COMMON_CLK_S5PV210 > + bool "Common Clock Framework support" > + default y > + select COMMON_CLK > + help > + Enable this option to use new clock driver > + based on Common Clock Framework. > + > menu "S5PC110 Machines" > > config MACH_AQUILA > diff --git a/arch/arm/mach-s5pv210/Makefile > b/arch/arm/mach-s5pv210/Makefile index 1c4e419..0c67fe2 100644 > --- a/arch/arm/mach-s5pv210/Makefile > +++ b/arch/arm/mach-s5pv210/Makefile > @@ -12,8 +12,8 @@ obj-:= > > # Core > > -obj-y+= common.o clock.o > - > +obj-y+= common.o > +obj-$(CONFIG_S5P_CLOCK) += clock.o > obj-$(CONFIG_PM) += pm.o > > obj-y+= dma.o > diff --git a/arch/arm/mach-s5pv210/common.c > b/arch/arm/mach-s5pv210/common.c index 26027a2..a1d86a1 100644 > --- a/arch/arm/mach-s5pv210/common.c > +++ b/arch/arm/mach-s5pv210/common.c > @@ -34,7 +34,13 @@ > #include > > #include > + > +#ifdef CONFIG_S5P_CLOCK > #include > +#else > +#include > +#endif > + > #include > #include > #include > @@ -50,6 +56,14 @@ > > #include "common.h" > > +/* External clock frequency */ > +static unsigned long xusbxti_f, xxti_f; If the xxti_f variable is not being changed anywhere, it might be a good idea to drop it completely and pass a constant zero to s5pv210_clk_init(). > + > +void __init s5pv210_set_xusbxti_freq(unsigned long freq) > +{ > + xusbxti_f = freq; > +} > + > static const char name_s5pv210[] = "S5PV210/S5PC110"; > > static struct cpu_table cpu_ids[] __initdata = { > @@ -229,12 +243,14 @@ void __init s5pv210_map_io(void) > > void __init s5pv210_init_clocks(int xtal) > { > +#ifdef CONFIG_S5P_CLOCK > printk(KERN_DEBUG "%s: initializing clocks\n", __func__); > > s3c24xx_register_baseclocks(xtal); > s5p_register_clocks(xtal); > s5pv210_register_clocks(); > s5pv210_setup_clocks(); > +#endif > } > > void __init s5pv210_init_irq(void) > @@ -248,6 +264,7 @@ void __init s5pv210_init_irq(void) > vic[3] = ~0; > > s5p_init_irq(vic, ARRAY_SIZE(vic)); > + s5pv210_clk_init(NULL, xxti_f, xusbxti_f, S3C_VA_SYS); > } > > struct bus_type s5pv210_subsys = { > diff --git a/arch/arm/mach-s5pv210/common.h > b/arch/arm/mach-s5pv210/common.h index fe1beb5..2db2a15 100644 > --- a/arch/arm/mach-s5pv210/common.h > +++ b/arch/arm/mach-s5pv210/common.h > @@ -14,6 +14,19 @@ > > #include > > +void s5pv210_set_xxti_freq(unsigned long freq); This function is no longer present in common.c, so should be removed here as well. > +void s5pv210_set_xusbxti_freq(unsigned long freq); > + > +#ifdef CONFIG_COMMON_CLK_S5PV210 > +void s5pv210_clk_init(struct device_node *np, > + unsigned long xxti_f, unsigned long xusbxti_f, > + void __iomem *reg_base); > +#else > +static inline void s5pv210_clk_init(struct device_node *np, > + unsigned long xxti_f, unsigned long xusbxti_f, > + void __iomem *reg_base) {} > +#endif > + > void s5pv210_init_io(struct map_desc *mach_desc, int size); > void s5pv210_init_irq(void); > > diff --git a/arch/arm/mach-s5pv210/mach-aquila.c > b/arch/arm/mach-s5pv210/mach-aquila.c index ad40ab0..e37a311 100644 > --- a/arch/arm/mach-s5pv210/mach-aquila.c > +++ b/arch/arm/mach-s5pv210/mach-aquila.c > @@ -646,6 +646,7 @@ static void __init aquila_map_io(void) > { > s5pv210_init_io(NULL, 0); > s3c24xx_init_clocks(2400); > + s5pv2
[PATCH v3 6/6] ARM: s5pv210: Migrate clock handling to Common Clock Framework
This patch migrates the s5pv210 platform to use new clock driver using Common Clock Framework. Signed-off-by: Mateusz Krawczuk --- arch/arm/mach-s5pv210/Kconfig | 9 + arch/arm/mach-s5pv210/Makefile| 4 ++-- arch/arm/mach-s5pv210/common.c| 17 + arch/arm/mach-s5pv210/common.h| 13 + arch/arm/mach-s5pv210/mach-aquila.c | 1 + arch/arm/mach-s5pv210/mach-goni.c | 3 ++- arch/arm/mach-s5pv210/mach-smdkc110.c | 1 + arch/arm/mach-s5pv210/mach-smdkv210.c | 1 + arch/arm/mach-s5pv210/mach-torbreck.c | 1 + arch/arm/plat-samsung/Kconfig | 2 +- arch/arm/plat-samsung/init.c | 2 -- 11 files changed, 48 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index caaedaf..ad4546e 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig @@ -15,6 +15,7 @@ config CPU_S5PV210 select S5P_PM if PM select S5P_SLEEP if PM select SAMSUNG_DMADEV + select S5P_CLOCK if !COMMON_CLK help Enable S5PV210 CPU support @@ -69,6 +70,14 @@ config S5PV210_SETUP_USB_PHY help Common setup code for USB PHY controller +config COMMON_CLK_S5PV210 + bool "Common Clock Framework support" + default y + select COMMON_CLK + help + Enable this option to use new clock driver + based on Common Clock Framework. + menu "S5PC110 Machines" config MACH_AQUILA diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile index 1c4e419..0c67fe2 100644 --- a/arch/arm/mach-s5pv210/Makefile +++ b/arch/arm/mach-s5pv210/Makefile @@ -12,8 +12,8 @@ obj- := # Core -obj-y += common.o clock.o - +obj-y += common.o +obj-$(CONFIG_S5P_CLOCK)+= clock.o obj-$(CONFIG_PM) += pm.o obj-y += dma.o diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c index 26027a2..a1d86a1 100644 --- a/arch/arm/mach-s5pv210/common.c +++ b/arch/arm/mach-s5pv210/common.c @@ -34,7 +34,13 @@ #include #include + +#ifdef CONFIG_S5P_CLOCK #include +#else +#include +#endif + #include #include #include @@ -50,6 +56,14 @@ #include "common.h" +/* External clock frequency */ +static unsigned long xusbxti_f, xxti_f; + +void __init s5pv210_set_xusbxti_freq(unsigned long freq) +{ + xusbxti_f = freq; +} + static const char name_s5pv210[] = "S5PV210/S5PC110"; static struct cpu_table cpu_ids[] __initdata = { @@ -229,12 +243,14 @@ void __init s5pv210_map_io(void) void __init s5pv210_init_clocks(int xtal) { +#ifdef CONFIG_S5P_CLOCK printk(KERN_DEBUG "%s: initializing clocks\n", __func__); s3c24xx_register_baseclocks(xtal); s5p_register_clocks(xtal); s5pv210_register_clocks(); s5pv210_setup_clocks(); +#endif } void __init s5pv210_init_irq(void) @@ -248,6 +264,7 @@ void __init s5pv210_init_irq(void) vic[3] = ~0; s5p_init_irq(vic, ARRAY_SIZE(vic)); + s5pv210_clk_init(NULL, xxti_f, xusbxti_f, S3C_VA_SYS); } struct bus_type s5pv210_subsys = { diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h index fe1beb5..2db2a15 100644 --- a/arch/arm/mach-s5pv210/common.h +++ b/arch/arm/mach-s5pv210/common.h @@ -14,6 +14,19 @@ #include +void s5pv210_set_xxti_freq(unsigned long freq); +void s5pv210_set_xusbxti_freq(unsigned long freq); + +#ifdef CONFIG_COMMON_CLK_S5PV210 +void s5pv210_clk_init(struct device_node *np, + unsigned long xxti_f, unsigned long xusbxti_f, + void __iomem *reg_base); +#else +static inline void s5pv210_clk_init(struct device_node *np, + unsigned long xxti_f, unsigned long xusbxti_f, + void __iomem *reg_base) {} +#endif + void s5pv210_init_io(struct map_desc *mach_desc, int size); void s5pv210_init_irq(void); diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index ad40ab0..e37a311 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c @@ -646,6 +646,7 @@ static void __init aquila_map_io(void) { s5pv210_init_io(NULL, 0); s3c24xx_init_clocks(2400); + s5pv210_set_xusbxti_freq(2400); s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); } diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index 282d714..a1955e9 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c @@ -966,7 +966,8 @@ static void __init goni_sound_init(void) static void __init goni_map_io(void) { s5pv210_init_io(NULL, 0); - s3c24xx_init_clocks(clk_xusbxti.rate); +