public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] msm: timer: compensate for timer shift in msm_read_timer_count
@ 2011-06-09  3:44 Jeff Ohlstein
  2011-06-09 13:41 ` Daniel Walker
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Ohlstein @ 2011-06-09  3:44 UTC (permalink / raw)
  To: Daniel Walker, Bryan Huntsman, David Brown
  Cc: linux-arm-msm, linux-arm-kernel, linux-kernel, Jeff Ohlstein,
	Russell King, stable

Some msm targets have timers whose lower bits are unreliable. So, we
present our timers as lower frequency than they actually are, and ignore
the bottom 5 bits on such targets. This compensation was erroneously
removed from the msm_read_timer_count function, so restore it.

This was broken by 94790ec25 "msm: timer: SMP timer support for msm".

Change-Id: I8c56bdf82629638748ccf352118ea664f967b87d
Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
---
 arch/arm/mach-msm/timer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 38b95e9..b3579fe 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -100,7 +100,7 @@ static cycle_t msm_read_timer_count(struct clocksource *cs)
 {
 	struct msm_clock *clk = container_of(cs, struct msm_clock, clocksource);
 
-	return readl(clk->global_counter);
+	return readl(clk->global_counter) >> clk->shift;
 }
 
 static struct msm_clock *clockevent_to_clock(struct clock_event_device *evt)
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] msm: timer: compensate for timer shift in msm_read_timer_count
  2011-06-09  3:44 [PATCH] msm: timer: compensate for timer shift in msm_read_timer_count Jeff Ohlstein
@ 2011-06-09 13:41 ` Daniel Walker
  2011-06-09 23:31   ` David Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Walker @ 2011-06-09 13:41 UTC (permalink / raw)
  To: Jeff Ohlstein
  Cc: Bryan Huntsman, David Brown, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Russell King, stable

On Wed, 2011-06-08 at 20:44 -0700, Jeff Ohlstein wrote:
> Some msm targets have timers whose lower bits are unreliable. So, we
> present our timers as lower frequency than they actually are, and ignore
> the bottom 5 bits on such targets. This compensation was erroneously
> removed from the msm_read_timer_count function, so restore it.
> 
> This was broken by 94790ec25 "msm: timer: SMP timer support for msm".
> 
> Change-Id: I8c56bdf82629638748ccf352118ea664f967b87d

Drop this Change-ID ..

> Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
> ---
>  arch/arm/mach-msm/timer.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
> index 38b95e9..b3579fe 100644
> --- a/arch/arm/mach-msm/timer.c
> +++ b/arch/arm/mach-msm/timer.c
> @@ -100,7 +100,7 @@ static cycle_t msm_read_timer_count(struct clocksource *cs)
>  {
>  	struct msm_clock *clk = container_of(cs, struct msm_clock, clocksource);
>  
> -	return readl(clk->global_counter);
> +	return readl(clk->global_counter) >> clk->shift;
>  }

Could you comment in the code with something explaining what the shift
is doing.

Daniel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] msm: timer: compensate for timer shift in msm_read_timer_count
  2011-06-09 13:41 ` Daniel Walker
@ 2011-06-09 23:31   ` David Brown
  0 siblings, 0 replies; 3+ messages in thread
From: David Brown @ 2011-06-09 23:31 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Jeff Ohlstein, Bryan Huntsman, linux-arm-msm, linux-arm-kernel,
	linux-kernel, Russell King, stable

On Thu, Jun 09 2011, Daniel Walker wrote:

>> diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
>> index 38b95e9..b3579fe 100644
>> --- a/arch/arm/mach-msm/timer.c
>> +++ b/arch/arm/mach-msm/timer.c
>> @@ -100,7 +100,7 @@ static cycle_t msm_read_timer_count(struct clocksource *cs)
>>  {
>>  	struct msm_clock *clk = container_of(cs, struct msm_clock, clocksource);
>>  
>> -	return readl(clk->global_counter);
>> +	return readl(clk->global_counter) >> clk->shift;
>>  }
>
> Could you comment in the code with something explaining what the shift
> is doing.

Probably best to describe this near msm_clock's definition (or
MSM_DGT_SHIFT), since it is a bit unclear what these values are.
A good (but short) description of how the shifts and even why.

The comment shouldn't be in the function body (CodingStyle, chapter 8).

David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-09 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-09  3:44 [PATCH] msm: timer: compensate for timer shift in msm_read_timer_count Jeff Ohlstein
2011-06-09 13:41 ` Daniel Walker
2011-06-09 23:31   ` David Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox