Skip to contentSkip to conversation

clocksource: dw_apb_timer_of: Fix read_sched_clock

PATCH In review [email protected] 2 participants 4 messages Dec 10, 2013 Clocksource, clockevent drivers

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/2 clocksource: dw_apb_timer_of: Fix read_sched_clock

From: Dinh Nguyen <[email protected]>

The read_sched_clock should return the ~value because the clock is a countdown implementation. read_sched_clock() should be the same as
__apbt_read_clocksource().

---
v5: Split up into 2 patches
v4: Simplify the fix by simply returning ~__raw_readl(sched_io_base)
v3: Use APBTMR_N_CURRENT_VALUE define in read_sched_clock()
v2: Maintain backwards compatibility for "dw-apb-timer-sp" and

      "dw-apb-timer-osc".
---
 drivers/clocksource/dw_apb_timer_of.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/dw_apb_timer_of.c +1 -1
index 45ba8ae..b29d7cd 100644
@@ -108,7 +108,7 @@ static void __init add_clocksource(struct device_node *source_timer)
 
 static u64 read_sched_clock(void)
 {
-	return __raw_readl(sched_io_base);
+	return ~__raw_readl(sched_io_base);
 }
 
 static const struct of_device_id sptimer_ids[] __initconst = {
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v5 2/2 clocksource: dw_apb_timer_of: Fix support for dts binding "snps,dw-apb-timer"

From: Dinh Nguyen <[email protected]>

In commit 620f5e1cbf (dts: Rename DW APB timer compatible strings), both "snps,dw-apb-timer-sp" and "snps,dw-apb-timer-osc" were deprecated in place of "snps,dw-apb-timer". But the driver also needs to be udpated in order to support this new binding "snps,dw-apb-timer".

---
v5: Separate patch to fix bindings
v4: none
v3: none
v2: none

---
 drivers/clocksource/dw_apb_timer_of.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clocksource/dw_apb_timer_of.c +4 -2
index b29d7cd..8d6e5f6 100644
@@ -113,7 +113,6 @@ static u64 read_sched_clock(void)
 
 static const struct of_device_id sptimer_ids[] __initconst = {
 	{ .compatible = "picochip,pc3x2-rtc" },
-	{ .compatible = "snps,dw-apb-timer-sp" },
 	{ /* Sentinel */ },
 };
 
@@ -151,4 +150,7 @@ static void __init dw_apb_timer_init(struct device_node *timer)
 	num_called++;
 }
 CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
-CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init);
+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);
+
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to [email protected]
Quoted 22 lines · On 12/10/2013 05:07 PM, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

The read_sched_clock should return the ~value because the clock is a countdown implementation. read_sched_clock() should be the same as
__apbt_read_clocksource().

---
v5: Split up into 2 patches
v4: Simplify the fix by simply returning ~__raw_readl(sched_io_base)
v3: Use APBTMR_N_CURRENT_VALUE define in read_sched_clock()
v2: Maintain backwards compatibility for "dw-apb-timer-sp" and

       "dw-apb-timer-osc".
---
  drivers/clocksource/dw_apb_timer_of.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/dw_apb_timer_of.c +0 -0
index 45ba8ae..b29d7cd 100644

drivers/clocksource/dw_apb_timer_of.c static void __init add_clocksource(struct device_node *source_timer) · line 112

Quoted 6 lines
drivers/clocksource/dw_apb_timer_of.c +1 -1
@@ -108,7 +108,7 @@ static void __init add_clocksource(struct device_node *source_timer)
 
  static u64 read_sched_clock(void)
  {
-	return __raw_readl(sched_io_base);
+	return ~__raw_readl(sched_io_base);
  }

Dinh,

I dropped the patch moving the macro definitions as it is not applied for urgent and I assume it is not needed for the 3.14 as there are no more patches depending on it.

-- Daniel

Quoted 2 lines
drivers/clocksource/dw_apb_timer_of.c +0 -0
  static const struct of_device_id sptimer_ids[] __initconst = {
 
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw
Quoted 32 lines · Daniel Lezcano
Quoted 22 lines · On 12/10/2013 05:07 PM, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

The read_sched_clock should return the ~value because the clock is a countdown implementation. read_sched_clock() should be the same as
__apbt_read_clocksource().

---
v5: Split up into 2 patches
v4: Simplify the fix by simply returning ~__raw_readl(sched_io_base)
v3: Use APBTMR_N_CURRENT_VALUE define in read_sched_clock()
v2: Maintain backwards compatibility for "dw-apb-timer-sp" and

       "dw-apb-timer-osc".
---
  drivers/clocksource/dw_apb_timer_of.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/dw_apb_timer_of.c +0 -0
index 45ba8ae..b29d7cd 100644

drivers/clocksource/dw_apb_timer_of.c static void __init add_clocksource(struct device_node *source_timer) · line 112

Quoted 6 lines
drivers/clocksource/dw_apb_timer_of.c +1 -1
@@ -108,7 +108,7 @@ static void __init add_clocksource(struct device_node *source_timer)
 
  static u64 read_sched_clock(void)
  {
-	return __raw_readl(sched_io_base);
+	return ~__raw_readl(sched_io_base);
  }

Dinh,

Quoted 3 lines

I dropped the patch moving the macro definitions as it is not applied for urgent and I assume it is not needed for the 3.14 as there are no more patches depending on it.

That's fine. Thanks Daniel!

Dinh

Quoted 7 lines

-- Daniel

Quoted 2 lines
drivers/clocksource/dw_apb_timer_of.c +0 -0
  static const struct of_device_id sptimer_ids[] __initconst = {