Commit b69f460d authored by Tomasz Figa's avatar Tomasz Figa Committed by Kukjin Kim

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: default avatarTomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent d0127f6f
...@@ -727,6 +727,7 @@ config ARCH_S3C64XX ...@@ -727,6 +727,7 @@ config ARCH_S3C64XX
select ARM_VIC select ARM_VIC
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select CLKSRC_SAMSUNG_PWM select CLKSRC_SAMSUNG_PWM
select COMMON_CLK
select CPU_V6 select CPU_V6
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select GPIO_SAMSUNG select GPIO_SAMSUNG
...@@ -740,7 +741,6 @@ config ARCH_S3C64XX ...@@ -740,7 +741,6 @@ config ARCH_S3C64XX
select S3C_DEV_NAND select S3C_DEV_NAND
select S3C_GPIO_TRACK select S3C_GPIO_TRACK
select SAMSUNG_ATAGS select SAMSUNG_ATAGS
select SAMSUNG_CLKSRC
select SAMSUNG_GPIOLIB_4BIT select SAMSUNG_GPIOLIB_4BIT
select SAMSUNG_WDT_RESET select SAMSUNG_WDT_RESET
select USB_ARCH_HAS_OHCI select USB_ARCH_HAS_OHCI
......
...@@ -12,7 +12,7 @@ obj- := ...@@ -12,7 +12,7 @@ obj- :=
# Core # Core
obj-y += common.o clock.o obj-y += common.o
# Core support # Core support
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
...@@ -38,7 +39,6 @@ ...@@ -38,7 +39,6 @@
#include <mach/regs-gpio.h> #include <mach/regs-gpio.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/clock.h>
#include <plat/devs.h> #include <plat/devs.h>
#include <plat/pm.h> #include <plat/pm.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
...@@ -50,6 +50,19 @@ ...@@ -50,6 +50,19 @@
#include "common.h" #include "common.h"
/* External clock frequency */
static unsigned long xtal_f = 12000000, xusbxti_f = 48000000;
void __init s3c64xx_set_xtal_freq(unsigned long freq)
{
xtal_f = freq;
}
void __init s3c64xx_set_xusbxti_freq(unsigned long freq)
{
xusbxti_f = freq;
}
/* uart registration process */ /* uart registration process */
static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
...@@ -67,7 +80,6 @@ static struct cpu_table cpu_ids[] __initdata = { ...@@ -67,7 +80,6 @@ static struct cpu_table cpu_ids[] __initdata = {
.idcode = S3C6400_CPU_ID, .idcode = S3C6400_CPU_ID,
.idmask = S3C64XX_CPU_MASK, .idmask = S3C64XX_CPU_MASK,
.map_io = s3c6400_map_io, .map_io = s3c6400_map_io,
.init_clocks = s3c6400_init_clocks,
.init_uarts = s3c64xx_init_uarts, .init_uarts = s3c64xx_init_uarts,
.init = s3c6400_init, .init = s3c6400_init,
.name = name_s3c6400, .name = name_s3c6400,
...@@ -75,7 +87,6 @@ static struct cpu_table cpu_ids[] __initdata = { ...@@ -75,7 +87,6 @@ static struct cpu_table cpu_ids[] __initdata = {
.idcode = S3C6410_CPU_ID, .idcode = S3C6410_CPU_ID,
.idmask = S3C64XX_CPU_MASK, .idmask = S3C64XX_CPU_MASK,
.map_io = s3c6410_map_io, .map_io = s3c6410_map_io,
.init_clocks = s3c6410_init_clocks,
.init_uarts = s3c64xx_init_uarts, .init_uarts = s3c64xx_init_uarts,
.init = s3c6410_init, .init = s3c6410_init,
.name = name_s3c6410, .name = name_s3c6410,
...@@ -213,8 +224,10 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid) ...@@ -213,8 +224,10 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
{ {
/* /*
* FIXME: there is no better place to put this at the moment * FIXME: there is no better place to put this at the moment
* (samsung_wdt_reset_init needs clocks) * (s3c64xx_clk_init needs ioremap and must happen before init_time
* samsung_wdt_reset_init needs clocks)
*/ */
s3c64xx_clk_init(NULL, xtal_f, xusbxti_f, soc_is_s3c6400(), S3C_VA_SYS);
samsung_wdt_reset_init(S3C_VA_WATCHDOG); samsung_wdt_reset_init(S3C_VA_WATCHDOG);
printk(KERN_DEBUG "%s: initialising interrupts\n", __func__); printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
......
...@@ -22,18 +22,19 @@ ...@@ -22,18 +22,19 @@
void s3c64xx_init_irq(u32 vic0, u32 vic1); void s3c64xx_init_irq(u32 vic0, u32 vic1);
void s3c64xx_init_io(struct map_desc *mach_desc, int size); void s3c64xx_init_io(struct map_desc *mach_desc, int size);
void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit);
void s3c64xx_setup_clocks(void);
void s3c64xx_restart(enum reboot_mode mode, const char *cmd); void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
void s3c64xx_init_late(void); void s3c64xx_init_late(void);
void s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
unsigned long xusbxti_f, bool is_s3c6400, void __iomem *reg_base);
void s3c64xx_set_xtal_freq(unsigned long freq);
void s3c64xx_set_xusbxti_freq(unsigned long freq);
#ifdef CONFIG_CPU_S3C6400 #ifdef CONFIG_CPU_S3C6400
extern int s3c6400_init(void); extern int s3c6400_init(void);
extern void s3c6400_init_irq(void); extern void s3c6400_init_irq(void);
extern void s3c6400_map_io(void); extern void s3c6400_map_io(void);
extern void s3c6400_init_clocks(int xtal);
#else #else
#define s3c6400_init_clocks NULL #define s3c6400_init_clocks NULL
...@@ -46,7 +47,6 @@ extern void s3c6400_init_clocks(int xtal); ...@@ -46,7 +47,6 @@ extern void s3c6400_init_clocks(int xtal);
extern int s3c6410_init(void); extern int s3c6410_init(void);
extern void s3c6410_init_irq(void); extern void s3c6410_init_irq(void);
extern void s3c6410_map_io(void); extern void s3c6410_map_io(void);
extern void s3c6410_init_clocks(int xtal);
#else #else
#define s3c6410_init_clocks NULL #define s3c6410_init_clocks NULL
......
...@@ -207,7 +207,7 @@ static struct platform_device *anw6410_devices[] __initdata = { ...@@ -207,7 +207,7 @@ static struct platform_device *anw6410_devices[] __initdata = {
static void __init anw6410_map_io(void) static void __init anw6410_map_io(void)
{ {
s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
......
...@@ -743,7 +743,7 @@ static struct s3c2410_platform_i2c i2c1_pdata = { ...@@ -743,7 +743,7 @@ static struct s3c2410_platform_i2c i2c1_pdata = {
static void __init crag6410_map_io(void) static void __init crag6410_map_io(void)
{ {
s3c64xx_init_io(NULL, 0); s3c64xx_init_io(NULL, 0);
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
......
...@@ -247,7 +247,7 @@ static struct platform_device *hmt_devices[] __initdata = { ...@@ -247,7 +247,7 @@ static struct platform_device *hmt_devices[] __initdata = {
static void __init hmt_map_io(void) static void __init hmt_map_io(void)
{ {
s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
} }
......
...@@ -231,7 +231,7 @@ static void __init mini6410_map_io(void) ...@@ -231,7 +231,7 @@ static void __init mini6410_map_io(void)
u32 tmp; u32 tmp;
s3c64xx_init_io(NULL, 0); s3c64xx_init_io(NULL, 0);
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
......
...@@ -86,7 +86,7 @@ static struct map_desc ncp_iodesc[] __initdata = {}; ...@@ -86,7 +86,7 @@ static struct map_desc ncp_iodesc[] __initdata = {};
static void __init ncp_map_io(void) static void __init ncp_map_io(void)
{ {
s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
} }
......
...@@ -337,13 +337,6 @@ static int __init smartq_usb_host_init(void) ...@@ -337,13 +337,6 @@ static int __init smartq_usb_host_init(void)
return ret; return ret;
} }
static int __init smartq_usb_otg_init(void)
{
clk_xusbxti.rate = 12000000;
return 0;
}
static int __init smartq_wifi_init(void) static int __init smartq_wifi_init(void)
{ {
int ret; int ret;
...@@ -377,7 +370,8 @@ static struct map_desc smartq_iodesc[] __initdata = {}; ...@@ -377,7 +370,8 @@ static struct map_desc smartq_iodesc[] __initdata = {};
void __init smartq_map_io(void) void __init smartq_map_io(void)
{ {
s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c64xx_set_xusbxti_freq(12000000);
s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
...@@ -399,7 +393,6 @@ void __init smartq_machine_init(void) ...@@ -399,7 +393,6 @@ void __init smartq_machine_init(void)
WARN_ON(smartq_lcd_setup_gpio()); WARN_ON(smartq_lcd_setup_gpio());
WARN_ON(smartq_power_off_init()); WARN_ON(smartq_power_off_init());
WARN_ON(smartq_usb_host_init()); WARN_ON(smartq_usb_host_init());
WARN_ON(smartq_usb_otg_init());
WARN_ON(smartq_wifi_init()); WARN_ON(smartq_wifi_init());
platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices)); platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
......
...@@ -65,7 +65,7 @@ static struct map_desc smdk6400_iodesc[] = {}; ...@@ -65,7 +65,7 @@ static struct map_desc smdk6400_iodesc[] = {};
static void __init smdk6400_map_io(void) static void __init smdk6400_map_io(void)
{ {
s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
} }
......
...@@ -634,7 +634,7 @@ static void __init smdk6410_map_io(void) ...@@ -634,7 +634,7 @@ static void __init smdk6410_map_io(void)
u32 tmp; u32 tmp;
s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
s3c24xx_init_clocks(12000000); s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
......
...@@ -58,12 +58,6 @@ void __init s3c6400_map_io(void) ...@@ -58,12 +58,6 @@ void __init s3c6400_map_io(void)
s3c64xx_onenand1_setname("s3c6400-onenand"); s3c64xx_onenand1_setname("s3c6400-onenand");
} }
void __init s3c6400_init_clocks(int xtal)
{
s3c64xx_register_clocks(xtal, S3C6400_CLKDIV0_ARM_MASK);
s3c64xx_setup_clocks();
}
void __init s3c6400_init_irq(void) void __init s3c6400_init_irq(void)
{ {
/* VIC0 does not have IRQS 5..7, /* VIC0 does not have IRQS 5..7,
......
...@@ -62,13 +62,6 @@ void __init s3c6410_map_io(void) ...@@ -62,13 +62,6 @@ void __init s3c6410_map_io(void)
s3c_cfcon_setname("s3c64xx-pata"); s3c_cfcon_setname("s3c64xx-pata");
} }
void __init s3c6410_init_clocks(int xtal)
{
printk(KERN_DEBUG "%s: initialising clocks\n", __func__);
s3c64xx_register_clocks(xtal, S3C6410_CLKDIV0_ARM_MASK);
s3c64xx_setup_clocks();
}
void __init s3c6410_init_irq(void) void __init s3c6410_init_irq(void)
{ {
/* VIC0 is missing IRQ7, VIC1 is fully populated. */ /* VIC0 is missing IRQ7, VIC1 is fully populated. */
......
...@@ -8,6 +8,4 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o ...@@ -8,6 +8,4 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
ifdef CONFIG_COMMON_CLK
obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment