From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 05/11] dm: timer: Support 64-bit counter
Date: Sat, 21 Nov 2015 08:41:00 +0800 [thread overview]
Message-ID: <564FBD9C.8080203@wytron.com.tw> (raw)
In-Reply-To: <CAPnjgZ36aFUfBK=_h-HK_3R6wD9ZEfX9aawWKgsSKVQzuBmf8g@mail.gmail.com>
Hi Simon,
On 2015?11?21? 05:10, Simon Glass wrote:
>>>> @@ -35,10 +52,10 @@ struct timer_ops {
>>>> * Get the current timer count
>>>> *
>>>> * @dev: The timer device
>>>> - * @count: pointer that returns the current timer count
>>>> + * @count: pointer that returns the current 64-bit timer count
>>>> * @return: 0 if OK, -ve on error
>>>> */
>>>> - int (*get_count)(struct udevice *dev, unsigned long *count);
>>>> + int (*get_count)(struct udevice *dev, u64 *count);
>>>
>>> Why do we need to change the API to 64-bit?
>>
>> IMHO, this API should be created to be accept a 64-bit value in the
>> first place. As you see the U-Boot time APIs in lib/time.c like
>> get_ticks() has been using 64-bit value.
>
> Right, but the point of this timer is for time delays. Making everyone
> one of those 64-bit on a 32-bit machine does not seem like a win to
> me.
>
>>
>>>
>>> My only concern is that we are pretty happy with the 32-bit timer and
>>> I'm not sure it should change. At present unsigned long can be 32-bit
>>> on 32-bit machines.
>>
>> 32-bit timer has to be converted to 64-bit value as get_ticks()
>> requires 64-bit. As for 'unsigned long can be 32-bit on 32-bit
>> machines', I think we should explicitly declare its width as this is
>> hardware limitation (32-bit timer can only produce 32-bit value, even
>> if it is on a 64-bit machine, where long on 64-bit means 64-bit, which
>> is wrong for this 32-bit timer hardware).
>
> This is a bit messy, but for now I think we should follow what
> get_timer() does. It would be worth getting more input on the list I
> think.
>
I would agree with Bin that the API should have been created as 64 bits.
I considered this option before, because most part of lib/time.c uses 64
bits. It was only that I didn't have much confidence to change so many
global code (without buildman). I realized this mistake when I wrote the
sandbox timer. It is wasteful to truncate the 64 bits count to 32 bits,
and then reconstruct 32 bits to 64 bits. This is what Bin wanted to
resolve. There is no overhead for 32 bits timer, as the patch only shift
the 64 bits conversion from lib/time.c to driver. Yet for 64 bits timer,
this is a good saving.
Best regards,
Thomas
next prev parent reply other threads:[~2015-11-21 0:41 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 8:11 [U-Boot] [PATCH v3 00/11] dm: timer: x86: 64-bit counter support and tsc timer dm conversion Bin Meng
2015-11-13 8:11 ` [U-Boot] [PATCH v3 01/11] dm: timer: Fix several nits Bin Meng
2015-11-24 2:26 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 02/11] dm: timer: Implement pre_probe() Bin Meng
2015-11-24 2:26 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 03/11] timer: altera: Remove the codes to get clock frequency Bin Meng
2015-11-24 2:26 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 04/11] timer: sandbox: Use device tree to pass the " Bin Meng
2015-11-22 16:24 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 05/11] dm: timer: Support 64-bit counter Bin Meng
2015-11-14 2:04 ` Simon Glass
2015-11-16 2:19 ` Bin Meng
2015-11-20 21:10 ` Simon Glass
2015-11-21 0:41 ` Thomas Chou [this message]
2015-11-22 16:21 ` Simon Glass
2015-11-24 2:27 ` Simon Glass
2015-11-24 10:09 ` Simon Glass
2015-11-24 14:01 ` Thomas Chou
2015-11-24 18:23 ` Simon Glass
2015-11-24 20:32 ` Simon Glass
2015-11-25 3:20 ` Thomas Chou
2015-11-25 6:44 ` Bin Meng
2015-11-25 16:51 ` Simon Glass
2015-11-26 17:49 ` Simon Glass
2015-11-16 5:03 ` Bin Meng
2015-11-13 8:11 ` [U-Boot] [PATCH v3 06/11] x86: Reomve MIN_PORT80_KCLOCKS_DELAY Bin Meng
2015-11-24 2:27 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 07/11] x86: tsc: Use notrace from <linux/compiler.h> Bin Meng
2015-11-24 2:27 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 08/11] x86: tsc: Add driver model timer support Bin Meng
2015-11-24 2:27 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 09/11] x86: Convert to use driver model timer Bin Meng
2015-11-24 2:27 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 10/11] x86: tsc: Remove legacy timer codes Bin Meng
2015-11-24 2:27 ` Simon Glass
2015-11-13 8:11 ` [U-Boot] [PATCH v3 11/11] x86: tsc: Move tsc_timer.c to drivers/timer Bin Meng
2015-11-24 2:27 ` Simon Glass
2015-11-13 9:20 ` [U-Boot] [PATCH v3 00/11] dm: timer: x86: 64-bit counter support and tsc timer dm conversion Thomas Chou
-- strict thread matches above, loose matches on Subject: below --
2015-11-24 20:31 [U-Boot] [PATCH v3 05/11] dm: timer: Support 64-bit counter Simon Glass
2015-11-25 1:41 ` Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=564FBD9C.8080203@wytron.com.tw \
--to=thomas@wytron.com.tw \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox