Commit b061b4f3 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Ingo Molnar:
 "Three clocksource driver fixes"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource/drivers/mips-gic-timer: Make gic_clocksource_of_init() return int
  clocksource/drivers/kona: Fix get_counter() error handling
  clocksource/drivers/time-armada-370-xp: Fix the clock reference
parents ac78bc71 be5769e2
...@@ -66,10 +66,10 @@ static void kona_timer_disable_and_clear(void __iomem *base) ...@@ -66,10 +66,10 @@ static void kona_timer_disable_and_clear(void __iomem *base)
} }
static void static int
kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw) kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw)
{ {
int loop_limit = 4; int loop_limit = 3;
/* /*
* Read 64-bit free running counter * 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,18 +83,19 @@ kona_timer_get_counter(void __iomem *timer_base, uint32_t *msw, uint32_t *lsw)
* if new hi-word is equal to previously read hi-word then stop. * if new hi-word is equal to previously read hi-word then stop.
*/ */
while (--loop_limit) { do {
*msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET); *msw = readl(timer_base + KONA_GPTIMER_STCHI_OFFSET);
*lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET); *lsw = readl(timer_base + KONA_GPTIMER_STCLO_OFFSET);
if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET)) if (*msw == readl(timer_base + KONA_GPTIMER_STCHI_OFFSET))
break; break;
} } while (--loop_limit);
if (!loop_limit) { if (!loop_limit) {
pr_err("bcm_kona_timer: getting counter failed.\n"); pr_err("bcm_kona_timer: getting counter failed.\n");
pr_err(" Timer will be impacted\n"); pr_err(" Timer will be impacted\n");
return -ETIMEDOUT;
} }
return; return 0;
} }
static int kona_timer_set_next_event(unsigned long clc, static int kona_timer_set_next_event(unsigned long clc,
...@@ -112,8 +113,11 @@ static int kona_timer_set_next_event(unsigned long clc, ...@@ -112,8 +113,11 @@ static int kona_timer_set_next_event(unsigned long clc,
uint32_t lsw, msw; uint32_t lsw, msw;
uint32_t reg; uint32_t reg;
int ret;
kona_timer_get_counter(timers.tmr_regs, &msw, &lsw); ret = kona_timer_get_counter(timers.tmr_regs, &msw, &lsw);
if (ret)
return ret;
/* Load the "next" event tick value */ /* Load the "next" event tick value */
writel(lsw + clc, timers.tmr_regs + KONA_GPTIMER_STCM0_OFFSET); writel(lsw + clc, timers.tmr_regs + KONA_GPTIMER_STCM0_OFFSET);
......
...@@ -164,7 +164,7 @@ void __init gic_clocksource_init(unsigned int frequency) ...@@ -164,7 +164,7 @@ void __init gic_clocksource_init(unsigned int frequency)
gic_start_count(); gic_start_count();
} }
static void __init gic_clocksource_of_init(struct device_node *node) static int __init gic_clocksource_of_init(struct device_node *node)
{ {
struct clk *clk; struct clk *clk;
int ret; int ret;
......
...@@ -338,7 +338,6 @@ static int __init armada_xp_timer_init(struct device_node *np) ...@@ -338,7 +338,6 @@ static int __init armada_xp_timer_init(struct device_node *np)
struct clk *clk = of_clk_get_by_name(np, "fixed"); struct clk *clk = of_clk_get_by_name(np, "fixed");
int ret; int ret;
clk = of_clk_get(np, 0);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
pr_err("Failed to get clock"); pr_err("Failed to get clock");
return PTR_ERR(clk); return PTR_ERR(clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment