Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: S3C64XX: Migrate clock handling to Common Clock Framework

This patch migrates the s3c64xx platform to use the new clock driver
using Common Clock Framework.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>

authored by

Tomasz Figa and committed by
Kukjin Kim
b69f460d d0127f6f

+33 -42
+1 -1
arch/arm/Kconfig
··· 727 727 select ARM_VIC 728 728 select CLKDEV_LOOKUP 729 729 select CLKSRC_SAMSUNG_PWM 730 + select COMMON_CLK 730 731 select CPU_V6 731 732 select GENERIC_CLOCKEVENTS 732 733 select GPIO_SAMSUNG ··· 741 740 select S3C_DEV_NAND 742 741 select S3C_GPIO_TRACK 743 742 select SAMSUNG_ATAGS 744 - select SAMSUNG_CLKSRC 745 743 select SAMSUNG_GPIOLIB_4BIT 746 744 select SAMSUNG_WDT_RESET 747 745 select USB_ARCH_HAS_OHCI
+1 -1
arch/arm/mach-s3c64xx/Makefile
··· 12 12 13 13 # Core 14 14 15 - obj-y += common.o clock.o 15 + obj-y += common.o 16 16 17 17 # Core support 18 18
+17 -4
arch/arm/mach-s3c64xx/common.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/init.h> 19 19 #include <linux/module.h> 20 + #include <linux/clk-provider.h> 20 21 #include <linux/interrupt.h> 21 22 #include <linux/ioport.h> 22 23 #include <linux/serial_core.h> ··· 39 38 #include <mach/regs-gpio.h> 40 39 41 40 #include <plat/cpu.h> 42 - #include <plat/clock.h> 43 41 #include <plat/devs.h> 44 42 #include <plat/pm.h> 45 43 #include <plat/gpio-cfg.h> ··· 49 49 #include <plat/watchdog-reset.h> 50 50 51 51 #include "common.h" 52 + 53 + /* External clock frequency */ 54 + static unsigned long xtal_f = 12000000, xusbxti_f = 48000000; 55 + 56 + void __init s3c64xx_set_xtal_freq(unsigned long freq) 57 + { 58 + xtal_f = freq; 59 + } 60 + 61 + void __init s3c64xx_set_xusbxti_freq(unsigned long freq) 62 + { 63 + xusbxti_f = freq; 64 + } 52 65 53 66 /* uart registration process */ 54 67 ··· 80 67 .idcode = S3C6400_CPU_ID, 81 68 .idmask = S3C64XX_CPU_MASK, 82 69 .map_io = s3c6400_map_io, 83 - .init_clocks = s3c6400_init_clocks, 84 70 .init_uarts = s3c64xx_init_uarts, 85 71 .init = s3c6400_init, 86 72 .name = name_s3c6400, ··· 87 75 .idcode = S3C6410_CPU_ID, 88 76 .idmask = S3C64XX_CPU_MASK, 89 77 .map_io = s3c6410_map_io, 90 - .init_clocks = s3c6410_init_clocks, 91 78 .init_uarts = s3c64xx_init_uarts, 92 79 .init = s3c6410_init, 93 80 .name = name_s3c6410, ··· 224 213 { 225 214 /* 226 215 * FIXME: there is no better place to put this at the moment 227 - * (samsung_wdt_reset_init needs clocks) 216 + * (s3c64xx_clk_init needs ioremap and must happen before init_time 217 + * samsung_wdt_reset_init needs clocks) 228 218 */ 219 + s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS); 229 220 samsung_wdt_reset_init(S3C_VA_WATCHDOG); 230 221 231 222 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
+5 -5
arch/arm/mach-s3c64xx/common.h
··· 22 22 void s3c64xx_init_irq(u32 vic0, u32 vic1); 23 23 void s3c64xx_init_io(struct map_desc *mach_desc, int size); 24 24 25 - void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit); 26 - void s3c64xx_setup_clocks(void); 27 - 28 25 void s3c64xx_restart(enum reboot_mode mode, const char *cmd); 29 26 void s3c64xx_init_late(void); 27 + 28 + void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f, 29 + unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base); 30 + void s3c64xx_set_xtal_freq(unsigned long freq); 31 + void s3c64xx_set_xusbxti_freq(unsigned long freq); 30 32 31 33 #ifdef CONFIG_CPU_S3C6400 32 34 33 35 extern int s3c6400_init(void); 34 36 extern void s3c6400_init_irq(void); 35 37 extern void s3c6400_map_io(void); 36 - extern void s3c6400_init_clocks(int xtal); 37 38 38 39 #else 39 40 #define s3c6400_init_clocks NULL ··· 47 46 extern int s3c6410_init(void); 48 47 extern void s3c6410_init_irq(void); 49 48 extern void s3c6410_map_io(void); 50 - extern void s3c6410_init_clocks(int xtal); 51 49 52 50 #else 53 51 #define s3c6410_init_clocks NULL
+1 -1
arch/arm/mach-s3c64xx/mach-anw6410.c
··· 207 207 static void __init anw6410_map_io(void) 208 208 { 209 209 s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); 210 - s3c24xx_init_clocks(12000000); 210 + s3c64xx_set_xtal_freq(12000000); 211 211 s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); 212 212 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 213 213
+1 -1
arch/arm/mach-s3c64xx/mach-crag6410.c
··· 743 743 static void __init crag6410_map_io(void) 744 744 { 745 745 s3c64xx_init_io(NULL, 0); 746 - s3c24xx_init_clocks(12000000); 746 + s3c64xx_set_xtal_freq(12000000); 747 747 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); 748 748 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 749 749
+1 -1
arch/arm/mach-s3c64xx/mach-hmt.c
··· 247 247 static void __init hmt_map_io(void) 248 248 { 249 249 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); 250 - s3c24xx_init_clocks(12000000); 250 + s3c64xx_set_xtal_freq(12000000); 251 251 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); 252 252 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 253 253 }
+1 -1
arch/arm/mach-s3c64xx/mach-mini6410.c
··· 231 231 u32 tmp; 232 232 233 233 s3c64xx_init_io(NULL, 0); 234 - s3c24xx_init_clocks(12000000); 234 + s3c64xx_set_xtal_freq(12000000); 235 235 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); 236 236 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 237 237
+1 -1
arch/arm/mach-s3c64xx/mach-ncp.c
··· 86 86 static void __init ncp_map_io(void) 87 87 { 88 88 s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); 89 - s3c24xx_init_clocks(12000000); 89 + s3c64xx_set_xtal_freq(12000000); 90 90 s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); 91 91 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 92 92 }
+2 -9
arch/arm/mach-s3c64xx/mach-smartq.c
··· 337 337 return ret; 338 338 } 339 339 340 - static int __init smartq_usb_otg_init(void) 341 - { 342 - clk_xusbxti.rate = 12000000; 343 - 344 - return 0; 345 - } 346 - 347 340 static int __init smartq_wifi_init(void) 348 341 { 349 342 int ret; ··· 370 377 void __init smartq_map_io(void) 371 378 { 372 379 s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); 373 - s3c24xx_init_clocks(12000000); 380 + s3c64xx_set_xtal_freq(12000000); 381 + s3c64xx_set_xusbxti_freq(12000000); 374 382 s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); 375 383 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 376 384 ··· 393 399 WARN_ON(smartq_lcd_setup_gpio()); 394 400 WARN_ON(smartq_power_off_init()); 395 401 WARN_ON(smartq_usb_host_init()); 396 - WARN_ON(smartq_usb_otg_init()); 397 402 WARN_ON(smartq_wifi_init()); 398 403 399 404 platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
+1 -1
arch/arm/mach-s3c64xx/mach-smdk6400.c
··· 65 65 static void __init smdk6400_map_io(void) 66 66 { 67 67 s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); 68 - s3c24xx_init_clocks(12000000); 68 + s3c64xx_set_xtal_freq(12000000); 69 69 s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); 70 70 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 71 71 }
+1 -1
arch/arm/mach-s3c64xx/mach-smdk6410.c
··· 634 634 u32 tmp; 635 635 636 636 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); 637 - s3c24xx_init_clocks(12000000); 637 + s3c64xx_set_xtal_freq(12000000); 638 638 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); 639 639 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 640 640
-6
arch/arm/mach-s3c64xx/s3c6400.c
··· 58 58 s3c64xx_onenand1_setname("s3c6400-onenand"); 59 59 } 60 60 61 - void __init s3c6400_init_clocks(int xtal) 62 - { 63 - s3c64xx_register_clocks(xtal, S3C6400_CLKDIV0_ARM_MASK); 64 - s3c64xx_setup_clocks(); 65 - } 66 - 67 61 void __init s3c6400_init_irq(void) 68 62 { 69 63 /* VIC0 does not have IRQS 5..7,
-7
arch/arm/mach-s3c64xx/s3c6410.c
··· 62 62 s3c_cfcon_setname("s3c64xx-pata"); 63 63 } 64 64 65 - void __init s3c6410_init_clocks(int xtal) 66 - { 67 - printk(KERN_DEBUG "%s: initialising clocks\n", __func__); 68 - s3c64xx_register_clocks(xtal, S3C6410_CLKDIV0_ARM_MASK); 69 - s3c64xx_setup_clocks(); 70 - } 71 - 72 65 void __init s3c6410_init_irq(void) 73 66 { 74 67 /* VIC0 is missing IRQ7, VIC1 is fully populated. */
-2
drivers/clk/samsung/Makefile
··· 8 8 obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o 9 9 obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o 10 10 obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o 11 - ifdef CONFIG_COMMON_CLK 12 11 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o 13 - endif