Skip to content

Commit f9bb48a

Browse files
Tomasz Figaolofj
authored andcommitted
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>
1 parent 09d718a commit f9bb48a

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎drivers/clocksource/Kconfig‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ config CLKSRC_METAG_GENERIC
7070

7171
config CLKSRC_SAMSUNG_PWM
7272
bool
73-
depends on OF
7473
select CLKSRC_MMIO
7574
help
7675
This is a new clocksource driver for the PWM timer found in

‎drivers/clocksource/samsung_pwm_timer.c‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static void __init samsung_timer_resources(void)
356356
/*
357357
* PWM master driver
358358
*/
359-
static void __init samsung_pwm_clocksource_init(void)
359+
static void __init _samsung_pwm_clocksource_init(void)
360360
{
361361
u8 mask;
362362
int channel;
@@ -378,6 +378,17 @@ static void __init samsung_pwm_clocksource_init(void)
378378
samsung_clocksource_init();
379379
}
380380

381+
void __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
381392
static void __init samsung_pwm_alloc(struct device_node *np,
382393
const struct samsung_pwm_variant *variant)
383394
{
@@ -414,7 +425,7 @@ static void __init samsung_pwm_alloc(struct device_node *np,
414425
return;
415426
}
416427

417-
samsung_pwm_clocksource_init();
428+
_samsung_pwm_clocksource_init();
418429
}
419430

420431
static const struct samsung_pwm_variant s3c24xx_variant = {
@@ -468,3 +479,4 @@ static void __init s5p_pwm_clocksource_init(struct device_node *np)
468479
samsung_pwm_alloc(np, &s5p_variant);
469480
}
470481
CLOCKSOURCE_OF_DECLARE(s5pc100_pwm, "samsung,s5pc100-pwm", s5p_pwm_clocksource_init);
482+
#endif

‎include/clocksource/samsung_pwm.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ struct samsung_pwm_variant {
3030
bool has_tint_cstat;
3131
};
3232

33+
void samsung_pwm_clocksource_init(void __iomem *base,
34+
unsigned int *irqs, struct samsung_pwm_variant *variant);
35+
3336
#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */

0 commit comments

Comments
 (0)