lkml.org 
[lkml]   [2013]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 02/10] clocksource:arm_global_timer: Add ARM global timer support.
On 20/06/13 20:02, Arnd Bergmann wrote:
> On Thursday 20 June 2013, Srinivas KANDAGATLA wrote:
>> +static u64 gt_counter_read(void)
>> +{
>> + u64 counter;
>> + u32 lower;
>> + u32 upper, old_upper;
>> +
>> + upper = __raw_readl(gt_base + GT_COUNTER1);
>> + do {
>> + old_upper = upper;
>> + lower = __raw_readl(gt_base + GT_COUNTER0);
>> + upper = __raw_readl(gt_base + GT_COUNTER1);
>> + } while (upper != old_upper);
>> +
>> + counter = upper;
>> + counter <<= 32;
>> + counter |= lower;
>> + return counter;
>> +}
>
> Please replace __raw_readl etc with the non-__raw variants
> throughout the code.
>
> The __raw accessors are not endian safe and are not meant
> for device drivers. If you are worried about latency from
> extra barriers, use readl_relaxed().
Endian safe is good point. I will move to using readl/writel which does
both ordering and byteswapping.
And use relaxed versions in gt_counter_read to reduce the latency.

looks like smp_twd.c too needs this type of change.

Thanks,
srini

>
> Arnd
>



\
 
 \ /
  Last update: 2013-06-21 10:01    [W:0.061 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site