Explorar o código

ARM: twd: data endian fix

Ensure the twd driver uses the correct calls to access the hardware
to ensure that we do not end up with data in the wrong endian format.

Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Ben Dooks %!s(int64=12) %!d(string=hai) anos
pai
achega
2e874ea342
Modificáronse 1 ficheiros con 12 adicións e 12 borrados
  1. 12 12
      arch/arm/kernel/smp_twd.c

+ 12 - 12
arch/arm/kernel/smp_twd.c

@@ -45,7 +45,7 @@ static void twd_set_mode(enum clock_event_mode mode,
 	case CLOCK_EVT_MODE_PERIODIC:
 	case CLOCK_EVT_MODE_PERIODIC:
 		ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
 		ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
 			| TWD_TIMER_CONTROL_PERIODIC;
 			| TWD_TIMER_CONTROL_PERIODIC;
-		__raw_writel(DIV_ROUND_CLOSEST(twd_timer_rate, HZ),
+		writel_relaxed(DIV_ROUND_CLOSEST(twd_timer_rate, HZ),
 			twd_base + TWD_TIMER_LOAD);
 			twd_base + TWD_TIMER_LOAD);
 		break;
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 	case CLOCK_EVT_MODE_ONESHOT:
@@ -58,18 +58,18 @@ static void twd_set_mode(enum clock_event_mode mode,
 		ctrl = 0;
 		ctrl = 0;
 	}
 	}
 
 
-	__raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL);
+	writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL);
 }
 }
 
 
 static int twd_set_next_event(unsigned long evt,
 static int twd_set_next_event(unsigned long evt,
 			struct clock_event_device *unused)
 			struct clock_event_device *unused)
 {
 {
-	unsigned long ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL);
+	unsigned long ctrl = readl_relaxed(twd_base + TWD_TIMER_CONTROL);
 
 
 	ctrl |= TWD_TIMER_CONTROL_ENABLE;
 	ctrl |= TWD_TIMER_CONTROL_ENABLE;
 
 
-	__raw_writel(evt, twd_base + TWD_TIMER_COUNTER);
-	__raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL);
+	writel_relaxed(evt, twd_base + TWD_TIMER_COUNTER);
+	writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -82,8 +82,8 @@ static int twd_set_next_event(unsigned long evt,
  */
  */
 static int twd_timer_ack(void)
 static int twd_timer_ack(void)
 {
 {
-	if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) {
-		__raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
+	if (readl_relaxed(twd_base + TWD_TIMER_INTSTAT)) {
+		writel_relaxed(1, twd_base + TWD_TIMER_INTSTAT);
 		return 1;
 		return 1;
 	}
 	}
 
 
@@ -211,15 +211,15 @@ static void twd_calibrate_rate(void)
 		waitjiffies += 5;
 		waitjiffies += 5;
 
 
 				 /* enable, no interrupt or reload */
 				 /* enable, no interrupt or reload */
-		__raw_writel(0x1, twd_base + TWD_TIMER_CONTROL);
+		writel_relaxed(0x1, twd_base + TWD_TIMER_CONTROL);
 
 
 				 /* maximum value */
 				 /* maximum value */
-		__raw_writel(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER);
+		writel_relaxed(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER);
 
 
 		while (get_jiffies_64() < waitjiffies)
 		while (get_jiffies_64() < waitjiffies)
 			udelay(10);
 			udelay(10);
 
 
-		count = __raw_readl(twd_base + TWD_TIMER_COUNTER);
+		count = readl_relaxed(twd_base + TWD_TIMER_COUNTER);
 
 
 		twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
 		twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
 
 
@@ -277,7 +277,7 @@ static void twd_timer_setup(void)
 	 * bother with the below.
 	 * bother with the below.
 	 */
 	 */
 	if (per_cpu(percpu_setup_called, cpu)) {
 	if (per_cpu(percpu_setup_called, cpu)) {
-		__raw_writel(0, twd_base + TWD_TIMER_CONTROL);
+		writel_relaxed(0, twd_base + TWD_TIMER_CONTROL);
 		clockevents_register_device(clk);
 		clockevents_register_device(clk);
 		enable_percpu_irq(clk->irq, 0);
 		enable_percpu_irq(clk->irq, 0);
 		return;
 		return;
@@ -290,7 +290,7 @@ static void twd_timer_setup(void)
 	 * The following is done once per CPU the first time .setup() is
 	 * The following is done once per CPU the first time .setup() is
 	 * called.
 	 * called.
 	 */
 	 */
-	__raw_writel(0, twd_base + TWD_TIMER_CONTROL);
+	writel_relaxed(0, twd_base + TWD_TIMER_CONTROL);
 
 
 	clk->name = "local_timer";
 	clk->name = "local_timer";
 	clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
 	clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |