aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/bcm_kona_timer.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
committerThomas Gleixner <tglx@linutronix.de>2016-09-01 12:33:46 -0400
commit0cb7bf61b1e9f05027de58c80f9b46a714d24e35 (patch)
tree41fb55cf62d07b425122f9a8b96412c0d8eb99c5 /drivers/clocksource/bcm_kona_timer.c
parentaa877175e7a9982233ed8f10cb4bfddd78d82741 (diff)
parent3eab887a55424fc2c27553b7bfe32330df83f7b8 (diff)
Merge branch 'linus' into smp/hotplug
Apply upstream changes to avoid conflicts with pending patches.
Diffstat (limited to 'drivers/clocksource/bcm_kona_timer.c')
-rw-r--r--drivers/clocksource/bcm_kona_timer.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
index 7e3fd375a627..92f6e4deee74 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -66,10 +66,10 @@ static void kona_timer_disable_and_clear(void __iomem *base)
66 66
67} 67}
68 68
69static void 69static int
70kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw) 70kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw)
71{ 71{
72 int loop_limit = 4; 72 int loop_limit = 3;
73 73
74 /* 74 /*
75 * Read 64-bit free running counter 75 * Read 64-bit free running counter
@@ -83,18 +83,19 @@ kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw)
83 * if new hi-word is equal to previously read hi-word then stop. 83 * if new hi-word is equal to previously read hi-word then stop.
84 */ 84 */
85 85
86 while (--loop_limit) { 86 do {
87 *msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET); 87 *msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET);
88 *lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET); 88 *lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET);
89 if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET)) 89 if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET))
90 break; 90 break;
91 } 91 } while (--loop_limit);
92 if (!loop_limit) { 92 if (!loop_limit) {
93 pr_err("bcm_kona_timer: getting counter failed.\n"); 93 pr_err("bcm_kona_timer: getting counter failed.\n");
94 pr_err(" Timer will be impacted\n"); 94 pr_err(" Timer will be impacted\n");
95 return -ETIMEDOUT;
95 } 96 }
96 97
97 return; 98 return 0;
98} 99}
99 100
100static int kona_timer_set_next_event(unsigned long clc, 101static int kona_timer_set_next_event(unsigned long clc,
@@ -112,8 +113,11 @@ static int kona_timer_set_next_event(unsigned long clc,
112 113
113 uint32_t lsw, msw; 114 uint32_t lsw, msw;
114 uint32_t reg; 115 uint32_t reg;
116 int ret;
115 117
116 kona_timer_get_counter(timers.tmr_regs, &msw, &lsw); 118 ret = kona_timer_get_counter(timers.tmr_regs, &msw, &lsw);
119 if (ret)
120 return ret;
117 121
118 /* Load the "next" event tick value */ 122 /* Load the "next" event tick value */
119 writel(lsw + clc, timers.tmr_regs + KONA_GPTIMER_STCM0_OFFSET); 123 writel(lsw + clc, timers.tmr_regs + KONA_GPTIMER_STCM0_OFFSET);