提交 f9bb48a2 编写于 作者: T Tomasz Figa 提交者: Olof Johansson

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: NTomasz Figa <t.figa@samsung.com>
Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: NArnd Bergmann <arnd@arndb.de>
Acked-by: NKukjin Kim <kgene.kim@samsung.com>
Signed-off-by: NOlof Johansson <olof@lixom.net>
上级 09d718a7
...@@ -70,7 +70,6 @@ config CLKSRC_METAG_GENERIC ...@@ -70,7 +70,6 @@ config CLKSRC_METAG_GENERIC
config CLKSRC_SAMSUNG_PWM config CLKSRC_SAMSUNG_PWM
bool bool
depends on OF
select CLKSRC_MMIO select CLKSRC_MMIO
help help
This is a new clocksource driver for the PWM timer found in This is a new clocksource driver for the PWM timer found in
......
...@@ -356,7 +356,7 @@ static void __init samsung_timer_resources(void) ...@@ -356,7 +356,7 @@ static void __init samsung_timer_resources(void)
/* /*
* PWM master driver * PWM master driver
*/ */
static void __init samsung_pwm_clocksource_init(void) static void __init _samsung_pwm_clocksource_init(void)
{ {
u8 mask; u8 mask;
int channel; int channel;
...@@ -378,6 +378,17 @@ static void __init samsung_pwm_clocksource_init(void) ...@@ -378,6 +378,17 @@ static void __init samsung_pwm_clocksource_init(void)
samsung_clocksource_init(); samsung_clocksource_init();
} }
void __init samsung_pwm_clocksource_init(void __iomem *base,
unsigned int *irqs, struct samsung_pwm_variant *variant)
{
pwm.base = base;
memcpy(&pwm.variant, variant, sizeof(pwm.variant));
memcpy(pwm.irq, irqs, SAMSUNG_PWM_NUM * sizeof(*irqs));
_samsung_pwm_clocksource_init();
}
#ifdef CONFIG_CLKSRC_OF
static void __init samsung_pwm_alloc(struct device_node *np, static void __init samsung_pwm_alloc(struct device_node *np,
const struct samsung_pwm_variant *variant) const struct samsung_pwm_variant *variant)
{ {
...@@ -414,7 +425,7 @@ static void __init samsung_pwm_alloc(struct device_node *np, ...@@ -414,7 +425,7 @@ static void __init samsung_pwm_alloc(struct device_node *np,
return; return;
} }
samsung_pwm_clocksource_init(); _samsung_pwm_clocksource_init();
} }
static const struct samsung_pwm_variant s3c24xx_variant = { static const struct samsung_pwm_variant s3c24xx_variant = {
...@@ -468,3 +479,4 @@ static void __init s5p_pwm_clocksource_init(struct device_node *np) ...@@ -468,3 +479,4 @@ static void __init s5p_pwm_clocksource_init(struct device_node *np)
samsung_pwm_alloc(np, &s5p_variant); samsung_pwm_alloc(np, &s5p_variant);
} }
CLOCKSOURCE_OF_DECLARE(s5pc100_pwm, "samsung,s5pc100-pwm", s5p_pwm_clocksource_init); CLOCKSOURCE_OF_DECLARE(s5pc100_pwm, "samsung,s5pc100-pwm", s5p_pwm_clocksource_init);
#endif
...@@ -30,4 +30,7 @@ struct samsung_pwm_variant { ...@@ -30,4 +30,7 @@ struct samsung_pwm_variant {
bool has_tint_cstat; bool has_tint_cstat;
}; };
void samsung_pwm_clocksource_init(void __iomem *base,
unsigned int *irqs, struct samsung_pwm_variant *variant);
#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */ #endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册