[U-Boot] [PATCH 04/10] dm: timer: Support 64-bit counter
Bin Meng
bmeng.cn at gmail.com
Tue Nov 10 03:46:38 CET 2015
Hi Thomas,
On Sat, Nov 7, 2015 at 6:40 AM, Thomas Chou <thomas at wytron.com.tw> wrote:
> Hi Bin,
>
>
> On 2015年11月06日 22:35, Bin Meng wrote:
>>
>> Hi Thomas,
>>
>> On Fri, Nov 6, 2015 at 3:14 PM, Thomas Chou <thomas at wytron.com.tw> wrote:
>>>
>>> Hi Bin,
>>>
>>> On 2015年11月05日 22:02, Bin Meng wrote:
>>>>
>>>>
>>>> There are timers with a 64-bit counter value but current timer
>>>> uclass driver assumes a 32-bit one. Introduce a device tree
>>>> property "counter-64bit", and modify timer_get_count() in the
>>>> timer uclass driver to handle the 32-bit/64-bit conversion
>>>> automatically.
>>>>
>>>> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>>>> ---
>>>
>>>
>>>
>>> Thanks a lot. I tested patches [1-4] on nios2 boards with "ut time" and
>>> "sleep". It works fine.
>>>
>>> I would suggest that we do not need the additional "counter-64bit"
>>> property
>>> by requiring the timer always return 64 bits count. We can provide an
>>> inline
>>> func to do the 32/64 conversion for all 32 bits timers.
>>>
>>
>> Do you mean we move the following codes:
>>
>> + /* increment tbh if tbl has rolled over */
>> + if (now < gd->timebase_l)
>> + gd->timebase_h++;
>> + gd->timebase_l = now;
>> + *count = ((u64)gd->timebase_h << 32) | gd->timebase_l;
>>
>> to an inline function, to have 32-bit timer driver to call this inline
>> function in their get_count() op?
>>
>> This looks duplicate to me.
>
>
> Yes. If we want to support 64 bits count, it should be the driver's
> responsibility to return 64 bits count. It would be more natural than adding
> a property to tell the uclass to to the conversion. The "duplicate" you
> mentioned could be an alternative to the "counter-64bit" addition. I believe
> 64 bits hardware counter will become more popular in the future.
>
OK, will do in v2 and rebase on top of sandbox timer patches.
Regards,
Bin
More information about the U-Boot
mailing list