Commit 4659c534 authored by Heiko Stuebner's avatar Heiko Stuebner Committed by Kukjin Kim

ARM: S3C24XX: add platform code for conversion to the common clock framework

This adds the necessary init functions to init the clocks from the common
clock framework and necessary CONFIG_SAMSUNG_CLOCK ifdefs around the legacy
clock code.

This also includes empty stubs for the *_setup_clocks functions that are
called from the cpufreq driver on resume.
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Reviewed-by: default avatarTomasz Figa <t.figa@samsung.com>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent 3f7c01ad
...@@ -18,6 +18,11 @@ config PLAT_S3C24XX ...@@ -18,6 +18,11 @@ config PLAT_S3C24XX
help help
Base platform code for any Samsung S3C24XX device Base platform code for any Samsung S3C24XX device
config S3C2410_COMMON_CLK
bool
help
Build the s3c2410 clock driver based on the common clock framework.
config S3C2410_COMMON_DCLK config S3C2410_COMMON_DCLK
bool bool
select REGMAP_MMIO select REGMAP_MMIO
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <plat/cpu-freq.h> #include <plat/cpu-freq.h>
#include <plat/pll.h> #include <plat/pll.h>
#include <plat/pwm-core.h> #include <plat/pwm-core.h>
#include <plat/watchdog-reset.h>
#include "common.h" #include "common.h"
...@@ -533,6 +534,14 @@ struct platform_device s3c2443_device_dma = { ...@@ -533,6 +534,14 @@ struct platform_device s3c2443_device_dma = {
}; };
#endif #endif
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
void __init s3c2410_init_clocks(int xtal)
{
s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
}
#endif
#ifdef CONFIG_CPU_S3C2412 #ifdef CONFIG_CPU_S3C2412
void __init s3c2412_init_clocks(int xtal) void __init s3c2412_init_clocks(int xtal)
{ {
...@@ -547,6 +556,22 @@ void __init s3c2416_init_clocks(int xtal) ...@@ -547,6 +556,22 @@ void __init s3c2416_init_clocks(int xtal)
} }
#endif #endif
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
void __init s3c2440_init_clocks(int xtal)
{
s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
}
#endif
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
void __init s3c2442_init_clocks(int xtal)
{
s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
}
#endif
#ifdef CONFIG_CPU_S3C2443 #ifdef CONFIG_CPU_S3C2443
void __init s3c2443_init_clocks(int xtal) void __init s3c2443_init_clocks(int xtal)
{ {
......
...@@ -77,6 +77,7 @@ extern void s3c244x_restart(enum reboot_mode mode, const char *cmd); ...@@ -77,6 +77,7 @@ extern void s3c244x_restart(enum reboot_mode mode, const char *cmd);
#ifdef CONFIG_CPU_S3C2440 #ifdef CONFIG_CPU_S3C2440
extern int s3c2440_init(void); extern int s3c2440_init(void);
extern void s3c2440_map_io(void); extern void s3c2440_map_io(void);
extern void s3c2440_init_clocks(int xtal);
extern void s3c2440_init_irq(void); extern void s3c2440_init_irq(void);
#else #else
#define s3c2440_init NULL #define s3c2440_init NULL
...@@ -86,6 +87,7 @@ extern void s3c2440_init_irq(void); ...@@ -86,6 +87,7 @@ extern void s3c2440_init_irq(void);
#ifdef CONFIG_CPU_S3C2442 #ifdef CONFIG_CPU_S3C2442
extern int s3c2442_init(void); extern int s3c2442_init(void);
extern void s3c2442_map_io(void); extern void s3c2442_map_io(void);
extern void s3c2442_init_clocks(int xtal);
extern void s3c2442_init_irq(void); extern void s3c2442_init_irq(void);
#else #else
#define s3c2442_init NULL #define s3c2442_init NULL
...@@ -116,6 +118,11 @@ extern struct platform_device s3c2443_device_dma; ...@@ -116,6 +118,11 @@ extern struct platform_device s3c2443_device_dma;
extern struct platform_device s3c2410_device_dclk; extern struct platform_device s3c2410_device_dclk;
#ifdef CONFIG_S3C2410_COMMON_CLK
void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
int current_soc,
void __iomem *reg_base);
#endif
#ifdef CONFIG_S3C2412_COMMON_CLK #ifdef CONFIG_S3C2412_COMMON_CLK
void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f, void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
unsigned long ext_f, void __iomem *reg_base); unsigned long ext_f, void __iomem *reg_base);
......
...@@ -83,6 +83,7 @@ void __init s3c2410_map_io(void) ...@@ -83,6 +83,7 @@ void __init s3c2410_map_io(void)
iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc)); iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
} }
#ifdef CONFIG_SAMSUNG_CLOCK
void __init_or_cpufreq s3c2410_setup_clocks(void) void __init_or_cpufreq s3c2410_setup_clocks(void)
{ {
struct clk *xtal_clk; struct clk *xtal_clk;
...@@ -142,6 +143,11 @@ void __init s3c2410_init_clocks(int xtal) ...@@ -142,6 +143,11 @@ void __init s3c2410_init_clocks(int xtal)
clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup)); clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup));
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG); samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
} }
#else
void __init_or_cpufreq s3c2410_setup_clocks(void)
{
}
#endif
struct bus_type s3c2410_subsys = { struct bus_type s3c2410_subsys = {
.name = "s3c2410-core", .name = "s3c2410-core",
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "common.h" #include "common.h"
#ifdef CONFIG_SAMSUNG_CLOCK
/* S3C2442 extended clock support */ /* S3C2442 extended clock support */
static unsigned long s3c2442_camif_upll_round(struct clk *clk, static unsigned long s3c2442_camif_upll_round(struct clk *clk,
...@@ -162,7 +163,7 @@ static __init int s3c2442_clk_init(void) ...@@ -162,7 +163,7 @@ static __init int s3c2442_clk_init(void)
} }
arch_initcall(s3c2442_clk_init); arch_initcall(s3c2442_clk_init);
#endif
static struct device s3c2442_dev = { static struct device s3c2442_dev = {
.bus = &s3c2442_subsys, .bus = &s3c2442_subsys,
......
...@@ -78,6 +78,7 @@ void __init s3c244x_map_io(void) ...@@ -78,6 +78,7 @@ void __init s3c244x_map_io(void)
s3c2410_device_dclk.name = "s3c2440-dclk"; s3c2410_device_dclk.name = "s3c2440-dclk";
} }
#ifdef CONFIG_SAMSUNG_CLOCK
void __init_or_cpufreq s3c244x_setup_clocks(void) void __init_or_cpufreq s3c244x_setup_clocks(void)
{ {
struct clk *xtal_clk; struct clk *xtal_clk;
...@@ -138,6 +139,11 @@ void __init s3c244x_init_clocks(int xtal) ...@@ -138,6 +139,11 @@ void __init s3c244x_init_clocks(int xtal)
s3c2410_baseclk_add(); s3c2410_baseclk_add();
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG); samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
} }
#else
void __init_or_cpufreq s3c244x_setup_clocks(void)
{
}
#endif
/* Since the S3C2442 and S3C2440 share items, put both subsystems here */ /* Since the S3C2442 and S3C2440 share items, put both subsystems here */
......
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