diff options
Diffstat (limited to 'arch/arm/mach-ux500/timer.c')
-rw-r--r-- | arch/arm/mach-ux500/timer.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c index d37df98b5c32..741e71feca78 100644 --- a/arch/arm/mach-ux500/timer.c +++ b/arch/arm/mach-ux500/timer.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
9 | #include <linux/clksrc-dbx500-prcmu.h> | 9 | #include <linux/clksrc-dbx500-prcmu.h> |
10 | #include <linux/of.h> | 10 | #include <linux/of.h> |
11 | #include <linux/of_address.h> | ||
11 | 12 | ||
12 | #include <asm/smp_twd.h> | 13 | #include <asm/smp_twd.h> |
13 | 14 | ||
@@ -18,8 +19,6 @@ | |||
18 | #include <mach/irqs.h> | 19 | #include <mach/irqs.h> |
19 | 20 | ||
20 | #ifdef CONFIG_HAVE_ARM_TWD | 21 | #ifdef CONFIG_HAVE_ARM_TWD |
21 | static DEFINE_TWD_LOCAL_TIMER(u5500_twd_local_timer, | ||
22 | U5500_TWD_BASE, IRQ_LOCALTIMER); | ||
23 | static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer, | 22 | static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer, |
24 | U8500_TWD_BASE, IRQ_LOCALTIMER); | 23 | U8500_TWD_BASE, IRQ_LOCALTIMER); |
25 | 24 | ||
@@ -28,8 +27,8 @@ static void __init ux500_twd_init(void) | |||
28 | struct twd_local_timer *twd_local_timer; | 27 | struct twd_local_timer *twd_local_timer; |
29 | int err; | 28 | int err; |
30 | 29 | ||
31 | twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer : | 30 | /* Use this to switch local timer base if changed in new ASICs */ |
32 | &u8500_twd_local_timer; | 31 | twd_local_timer = &u8500_twd_local_timer; |
33 | 32 | ||
34 | if (of_have_populated_dt()) | 33 | if (of_have_populated_dt()) |
35 | twd_local_timer_of_register(); | 34 | twd_local_timer_of_register(); |
@@ -43,21 +42,41 @@ static void __init ux500_twd_init(void) | |||
43 | #define ux500_twd_init() do { } while(0) | 42 | #define ux500_twd_init() do { } while(0) |
44 | #endif | 43 | #endif |
45 | 44 | ||
45 | const static struct of_device_id prcmu_timer_of_match[] __initconst = { | ||
46 | { .compatible = "stericsson,db8500-prcmu-timer-4", }, | ||
47 | { }, | ||
48 | }; | ||
49 | |||
46 | static void __init ux500_timer_init(void) | 50 | static void __init ux500_timer_init(void) |
47 | { | 51 | { |
48 | void __iomem *mtu_timer_base; | 52 | void __iomem *mtu_timer_base; |
49 | void __iomem *prcmu_timer_base; | 53 | void __iomem *prcmu_timer_base; |
54 | void __iomem *tmp_base; | ||
55 | struct device_node *np; | ||
50 | 56 | ||
51 | if (cpu_is_u5500()) { | 57 | if (cpu_is_u8500_family()) { |
52 | mtu_timer_base = __io_address(U5500_MTU0_BASE); | ||
53 | prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); | ||
54 | } else if (cpu_is_u8500()) { | ||
55 | mtu_timer_base = __io_address(U8500_MTU0_BASE); | 58 | mtu_timer_base = __io_address(U8500_MTU0_BASE); |
56 | prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); | 59 | prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); |
57 | } else { | 60 | } else { |
58 | ux500_unknown_soc(); | 61 | ux500_unknown_soc(); |
59 | } | 62 | } |
60 | 63 | ||
64 | /* TODO: Once MTU has been DT:ed place code above into else. */ | ||
65 | if (of_have_populated_dt()) { | ||
66 | np = of_find_matching_node(NULL, prcmu_timer_of_match); | ||
67 | if (!np) | ||
68 | goto dt_fail; | ||
69 | |||
70 | tmp_base = of_iomap(np, 0); | ||
71 | if (!tmp_base) | ||
72 | goto dt_fail; | ||
73 | |||
74 | prcmu_timer_base = tmp_base; | ||
75 | } | ||
76 | |||
77 | dt_fail: | ||
78 | /* Doing it the old fashioned way. */ | ||
79 | |||
61 | /* | 80 | /* |
62 | * Here we register the timerblocks active in the system. | 81 | * Here we register the timerblocks active in the system. |
63 | * Localtimers (twd) is started when both cpu is up and running. | 82 | * Localtimers (twd) is started when both cpu is up and running. |
@@ -70,7 +89,7 @@ static void __init ux500_timer_init(void) | |||
70 | * depending on delay which is not yet calibrated. RTC-RTT is in the | 89 | * depending on delay which is not yet calibrated. RTC-RTT is in the |
71 | * always-on powerdomain and is used as clockevent instead of twd when | 90 | * always-on powerdomain and is used as clockevent instead of twd when |
72 | * sleeping. | 91 | * sleeping. |
73 | * The PRCMU timer 4(3 for DB5500) register a clocksource and | 92 | * The PRCMU timer 4 register a clocksource and |
74 | * sched_clock with higher rating then MTU since is always-on. | 93 | * sched_clock with higher rating then MTU since is always-on. |
75 | * | 94 | * |
76 | */ | 95 | */ |