aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-04-23 11:46:27 -0400
committerOlof Johansson <olof@lixom.net>2013-04-28 15:16:54 -0400
commitf9bb48a2c25a96757d13795ba7cc52687f94446f (patch)
tree0667e8283b5007256701b3f8e95b2de6c9ebc159
parent09d718a78c79ddc270dccbfa1b1070b20b9a9ae1 (diff)
clocksource: samsung_pwm_timer: Add support for non-DT platforms
This patch extends the driver to support platforms that still use legacy ATAGS-based boot, without device tree, by providing an exported function that can be used from platform code to initialize the clocksource. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--drivers/clocksource/Kconfig1
-rw-r--r--drivers/clocksource/samsung_pwm_timer.c16
-rw-r--r--include/clocksource/samsung_pwm.h3
3 files changed, 17 insertions, 3 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index ff5b6d87d65a..6d6174978f95 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -70,7 +70,6 @@ config CLKSRC_METAG_GENERIC
70 70
71config CLKSRC_SAMSUNG_PWM 71config CLKSRC_SAMSUNG_PWM
72 bool 72 bool
73 depends on OF
74 select CLKSRC_MMIO 73 select CLKSRC_MMIO
75 help 74 help
76 This is a new clocksource driver for the PWM timer found in 75 This is a new clocksource driver for the PWM timer found in
diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c
index e3257fae04e6..9f4bd6aa2343 100644
--- a/drivers/clocksource/samsung_pwm_timer.c
+++ b/drivers/clocksource/samsung_pwm_timer.c
@@ -356,7 +356,7 @@ static void __init samsung_timer_resources(void)
356/* 356/*
357 * PWM master driver 357 * PWM master driver
358 */ 358 */
359static void __init samsung_pwm_clocksource_init(void) 359static void __init _samsung_pwm_clocksource_init(void)
360{ 360{
361 u8 mask; 361 u8 mask;
362 int channel; 362 int channel;
@@ -378,6 +378,17 @@ static void __init samsung_pwm_clocksource_init(void)
378 samsung_clocksource_init(); 378 samsung_clocksource_init();
379} 379}
380 380
381void __init samsung_pwm_clocksource_init(void __iomem *base,
382 unsigned int *irqs, struct samsung_pwm_variant *variant)
383{
384 pwm.base = base;
385 memcpy(&pwm.variant, variant, sizeof(pwm.variant));
386 memcpy(pwm.irq, irqs, SAMSUNG_PWM_NUM * sizeof(*irqs));
387
388 _samsung_pwm_clocksource_init();
389}
390
391#ifdef CONFIG_CLKSRC_OF
381static void __init samsung_pwm_alloc(struct device_node *np, 392static void __init samsung_pwm_alloc(struct device_node *np,
382 const struct samsung_pwm_variant *variant) 393 const struct samsung_pwm_variant *variant)
383{ 394{
@@ -414,7 +425,7 @@ static void __init samsung_pwm_alloc(struct device_node *np,
414 return; 425 return;
415 } 426 }
416 427
417 samsung_pwm_clocksource_init(); 428 _samsung_pwm_clocksource_init();
418} 429}
419 430
420static const struct samsung_pwm_variant s3c24xx_variant = { 431static const struct samsung_pwm_variant s3c24xx_variant = {
@@ -468,3 +479,4 @@ static void __init s5p_pwm_clocksource_init(struct device_node *np)
468 samsung_pwm_alloc(np, &s5p_variant); 479 samsung_pwm_alloc(np, &s5p_variant);
469} 480}
470CLOCKSOURCE_OF_DECLARE(s5pc100_pwm, "samsung,s5pc100-pwm", s5p_pwm_clocksource_init); 481CLOCKSOURCE_OF_DECLARE(s5pc100_pwm, "samsung,s5pc100-pwm", s5p_pwm_clocksource_init);
482#endif
diff --git a/include/clocksource/samsung_pwm.h b/include/clocksource/samsung_pwm.h
index b1d8fe706f1a..5c449c8199e9 100644
--- a/include/clocksource/samsung_pwm.h
+++ b/include/clocksource/samsung_pwm.h
@@ -30,4 +30,7 @@ struct samsung_pwm_variant {
30 bool has_tint_cstat; 30 bool has_tint_cstat;
31}; 31};
32 32
33void samsung_pwm_clocksource_init(void __iomem *base,
34 unsigned int *irqs, struct samsung_pwm_variant *variant);
35
33#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */ 36#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */