[U-Boot] [PATCH v5 1/3] dm: implement a Timer uclass
Simon Glass
sjg at chromium.org
Thu Oct 8 19:14:46 CEST 2015
Hi Thomas,
On 8 October 2015 at 02:03, Thomas Chou <thomas at wytron.com.tw> wrote:
> Implement a Timer uclass to work with lib/time.c.
>
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> ---
> v2
> fix coding style.
> v3
> add description to Kconfig as Simon suggested.
> move timer.c code to lib/time.c.
> add dm_timer dev to global data.
> remove timer_init().
> change API name get_clock.
> v4
> add comment about timer hardware.
> v5
> revert to get_rate and use uclass priv to store the clock_rate.
> split gd->dm_timer renewal to anohter patch.
>
> drivers/Kconfig | 2 ++
> drivers/Makefile | 1 +
> drivers/timer/Kconfig | 12 +++++++++
> drivers/timer/Makefile | 7 ++++++
> drivers/timer/timer-uclass.c | 42 +++++++++++++++++++++++++++++++
> include/asm-generic/global_data.h | 3 +++
> include/dm/uclass-id.h | 1 +
> include/timer.h | 52 +++++++++++++++++++++++++++++++++++++++
> lib/time.c | 49 ++++++++++++++++++++++++++++++++++++
> 9 files changed, 169 insertions(+)
> create mode 100644 drivers/timer/Kconfig
> create mode 100644 drivers/timer/Makefile
> create mode 100644 drivers/timer/timer-uclass.c
> create mode 100644 include/timer.h
Acked-by: Simon Glass <sjg at chromium.org>
Please see one last thing below.
>
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 63c92c5..f9496f7 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -56,6 +56,8 @@ source "drivers/spi/Kconfig"
>
> source "drivers/thermal/Kconfig"
>
> +source "drivers/timer/Kconfig"
> +
> source "drivers/tpm/Kconfig"
>
> source "drivers/usb/Kconfig"
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 9d0a595..692da78 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -48,6 +48,7 @@ obj-y += pcmcia/
> obj-y += dfu/
> obj-y += rtc/
> obj-y += sound/
> +obj-y += timer/
> obj-y += tpm/
> obj-y += twserial/
> obj-y += video/
> diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
> new file mode 100644
> index 0000000..54a4c40
> --- /dev/null
> +++ b/drivers/timer/Kconfig
> @@ -0,0 +1,12 @@
> +menu "Timer Support"
> +
> +config DM_TIMER
One more little nit - this should be just 'TIMER'? All of the DM_...
options will eventually be removed. They indicate that driver model is
being used for a function. In your case, there is no legacy version so
you can just omit the DM_.
> + bool "Enable Driver Model for Timer drivers"
> + depends on DM
> + help
> + Enable driver model for Timer access. It uses the same API as
> + lib/time.c. But now implemented by the uclass. The first timer
> + will be used. The timer is usually a 32 bits free-running up
> + counter. There may be no real tick, and no timer interrupt.
> +
> +endmenu
Regards,
Simon
More information about the U-Boot
mailing list