[U-Boot] [PATCH v3 1/2] dm: implement a Timer uclass
Thomas Chou
thomas at wytron.com.tw
Sun Oct 4 15:09:51 CEST 2015
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
More information about the U-Boot
mailing list