aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/common.c
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-05-24 17:27:29 -0400
committerKukjin Kim <kgene.kim@samsung.com>2013-05-24 17:27:38 -0400
commit68a433f18c0574b50c5952978ca95b0db7347174 (patch)
treeab80f5a0ab1a0a34c63f7d23ac2b6e1073052c6a /arch/arm/mach-exynos/common.c
parent7ec892ef5f1bd707e2d5ab128069cb6af75c7f07 (diff)
ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
This patch extends exynos_init_time() function to handle Exynos4210 rev0 SoC, which differs in availability of system timers and needs different clocksource initialization. This makes it possible to use exynos_init_time() function as init_time callback for all Exynos-based boards, including Universal_C210, which originally had to use samsung_timer_init(). Signed-off-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos/common.c')
-rw-r--r--arch/arm/mach-exynos/common.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 745e304ad0de..a2d20120e9fc 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -10,12 +10,14 @@
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/bitops.h>
13#include <linux/interrupt.h> 14#include <linux/interrupt.h>
14#include <linux/irq.h> 15#include <linux/irq.h>
15#include <linux/irqchip.h> 16#include <linux/irqchip.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <linux/device.h> 18#include <linux/device.h>
18#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <clocksource/samsung_pwm.h>
19#include <linux/sched.h> 21#include <linux/sched.h>
20#include <linux/serial_core.h> 22#include <linux/serial_core.h>
21#include <linux/of.h> 23#include <linux/of.h>
@@ -302,6 +304,13 @@ static struct map_desc exynos5440_iodesc0[] __initdata = {
302 }, 304 },
303}; 305};
304 306
307static struct samsung_pwm_variant exynos4_pwm_variant = {
308 .bits = 32,
309 .div_base = 0,
310 .has_tint_cstat = true,
311 .tclk_mask = 0,
312};
313
305void exynos4_restart(char mode, const char *cmd) 314void exynos4_restart(char mode, const char *cmd)
306{ 315{
307 __raw_writel(0x1, S5P_SWRESET); 316 __raw_writel(0x1, S5P_SWRESET);
@@ -442,8 +451,20 @@ static void __init exynos5440_map_io(void)
442 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); 451 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0));
443} 452}
444 453
454void __init exynos_set_timer_source(u8 channels)
455{
456 exynos4_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
457 exynos4_pwm_variant.output_mask &= ~channels;
458}
459
445void __init exynos_init_time(void) 460void __init exynos_init_time(void)
446{ 461{
462 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
463 EXYNOS4_IRQ_TIMER0_VIC, EXYNOS4_IRQ_TIMER1_VIC,
464 EXYNOS4_IRQ_TIMER2_VIC, EXYNOS4_IRQ_TIMER3_VIC,
465 EXYNOS4_IRQ_TIMER4_VIC,
466 };
467
447 if (of_have_populated_dt()) { 468 if (of_have_populated_dt()) {
448#ifdef CONFIG_OF 469#ifdef CONFIG_OF
449 of_clk_init(NULL); 470 of_clk_init(NULL);
@@ -455,7 +476,14 @@ void __init exynos_init_time(void)
455 exynos4_clk_init(NULL, !soc_is_exynos4210(), S5P_VA_CMU, readl(S5P_VA_CHIPID + 8) & 1); 476 exynos4_clk_init(NULL, !soc_is_exynos4210(), S5P_VA_CMU, readl(S5P_VA_CHIPID + 8) & 1);
456 exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f); 477 exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f);
457#endif 478#endif
458 mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0, EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1); 479#ifdef CONFIG_CLKSRC_SAMSUNG_PWM
480 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0)
481 samsung_pwm_clocksource_init(S3C_VA_TIMER,
482 timer_irqs, &exynos4_pwm_variant);
483 else
484#endif
485 mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0,
486 EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1);
459 } 487 }
460} 488}
461 489