public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/2] dm: implement a Timer uclass
Date: Sun, 4 Oct 2015 21:09:51 +0800	[thread overview]
Message-ID: <5611251F.2040500@wytron.com.tw> (raw)
In-Reply-To: <CAPnjgZ2956iZpAM67rHPtbMOWdyN2nWBzBd8zoGLUC8JLx+AsA@mail.gmail.com>

Hi Simon,

On 10/03/2015 10:29 PM, Simon Glass wrote:
>> +       return ops->get_count(dev, count);
>
> I'm not too keen on get_count(). Isn't this required to be in
> milliiseconds now? If so, how about get_ms()?
>
>> +}
>> +
>> +int timer_get_clock(struct udevice *dev, unsigned long *freq)
>> +{
>> +       const struct dm_timer_ops *ops = device_get_ops(dev);
>> +
>> +       if (!ops->get_clock)
>> +               return -ENOSYS;
>> +
>> +       return ops->get_clock(dev, freq);
>
> Isn't this always 1000?
>

I will add a more specific comment on the uclass.

Implement a Timer uclass to work with lib/time.c. The timer is usually a 
32 bits free-running up counter. The get_clock() method is used to get 
the input clock frequency of the timer. The get_count() method is used 
get the current 32 bits count value. If the hardware is counting down, 
the value should be inversed inside the method. There is no real tick, 
and no timer interrupt.

Ex, the altera timer of nois2 reference design runs at 125MHz and the 
down counter value is inversed inside the get_count() method.

Thanks again for your review.

Best regards,
Thomas Chou

  reply	other threads:[~2015-10-04 13:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 13:19 [U-Boot] [PATCH 1/2] dm: implement a Timer uclass Thomas Chou
2015-09-28 13:19 ` [U-Boot] [PATCH 2/2] nios2: convert altera timer to driver model Thomas Chou
2015-09-29  1:32 ` [U-Boot] [PATCH 1/2] dm: implement a Timer uclass Thomas Chou
2015-09-29 12:39 ` [U-Boot] [PATCH v2 " Thomas Chou
2015-09-29 12:39   ` [U-Boot] [PATCH v2 2/2] nios2: convert altera timer to driver model Thomas Chou
2015-09-30  0:27     ` Chin Liang See
2015-10-01  2:51       ` Thomas Chou
2015-10-01  9:12         ` Thomas Chou
2015-09-29 13:57   ` [U-Boot] [PATCH v2 1/2] dm: implement a Timer uclass Simon Glass
2015-10-01  7:22     ` Thomas Chou
2015-10-03  9:19 ` [U-Boot] [PATCH v3 " Thomas Chou
2015-10-03  9:19   ` [U-Boot] [PATCH v3 2/2] nios2: convert altera timer to driver model Thomas Chou
2015-10-03 14:29   ` [U-Boot] [PATCH v3 1/2] dm: implement a Timer uclass Simon Glass
2015-10-04 13:09     ` Thomas Chou [this message]
2015-10-04 13:56 ` [U-Boot] [PATCH v4 " Thomas Chou
2015-10-04 13:56   ` [U-Boot] [PATCH v4 2/2] nios2: convert altera timer to driver model Thomas Chou
2015-10-07  2:27     ` Chin Liang See
2015-10-06 14:14   ` [U-Boot] [PATCH v4 1/2] dm: implement a Timer uclass Simon Glass
2015-10-08  0:55     ` Thomas Chou
2015-10-08  1:03 ` [U-Boot] [PATCH v5 1/3] " Thomas Chou
2015-10-08  1:03   ` [U-Boot] [PATCH v5 2/3] timer: start a new dm_timer after relocation Thomas Chou
2015-10-08 16:09     ` Simon Glass
2015-10-08  1:03   ` [U-Boot] [PATCH v5 3/3] nios2: convert altera timer to driver model Thomas Chou
2015-10-08 17:14   ` [U-Boot] [PATCH v5 1/3] dm: implement a Timer uclass Simon Glass
2015-10-09  1:19     ` Thomas Chou
2015-10-09  1:17 ` [U-Boot] [PATCH v6 " Thomas Chou
2015-10-09  1:17   ` [U-Boot] [PATCH v6 2/3] timer: start a new TIMER after relocation Thomas Chou
2015-10-09  1:32     ` Bin Meng
2015-10-09  5:26       ` Thomas Chou
2015-10-09  1:17   ` [U-Boot] [PATCH v6 3/3] nios2: convert altera timer to driver model Thomas Chou
2015-10-09  9:36   ` [U-Boot] [PATCH v6 1/3] dm: implement a Timer uclass Simon Glass
2015-10-09 10:44     ` Thomas Chou
2015-10-09 10:46       ` Bin Meng
2015-10-09 13:18         ` Thomas Chou
2015-10-09  7:08 ` [U-Boot] [PATCH v7 " Thomas Chou
2015-10-09  7:08   ` [U-Boot] [PATCH v7 2/3] timer: start a new dm_timer after relocation Thomas Chou
2015-10-09  7:08   ` [U-Boot] [PATCH v7 3/3] nios2: convert altera timer to driver model Thomas Chou
2015-10-10  7:16 ` [U-Boot] [PATCH v8 1/3] dm: implement a Timer uclass Thomas Chou
2015-10-10  7:16   ` [U-Boot] [PATCH v8 2/3] timer: start a new timer after relocation Thomas Chou
2015-10-13 13:17     ` Thomas Chou
2015-10-10  7:16   ` [U-Boot] [PATCH v8 3/3] nios2: convert altera timer to driver model Thomas Chou
2015-10-13 13:17     ` Thomas Chou
2015-10-13 13:17   ` [U-Boot] [PATCH v8 1/3] dm: implement a Timer uclass Thomas Chou
2015-10-19  1:53     ` Simon Glass
2015-10-19 10:54       ` Thomas Chou

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=5611251F.2040500@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