* [PATCH] omap: timer: implement timer_get_boot_us
@ 2021-12-16 9:57 Christian Gmeiner
2022-01-11 6:50 ` Christian Gmeiner
2022-01-17 18:36 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Christian Gmeiner @ 2021-12-16 9:57 UTC (permalink / raw)
To: u-boot; +Cc: Christian Gmeiner
To make the OMAP DM timer driver useful for the timing of
bootstages, we need to implement timer_get_boot_us(..).
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
drivers/timer/omap-timer.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index 721e385fd1..25a6108fef 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -83,6 +83,27 @@ static int omap_timer_of_to_plat(struct udevice *dev)
return 0;
}
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
+ulong timer_get_boot_us(void)
+{
+ u64 ticks = 0;
+ u32 rate = 1;
+ u64 us;
+ int ret;
+
+ ret = dm_timer_init();
+ if (!ret) {
+ /* The timer is available */
+ rate = timer_get_rate(gd->timer);
+ timer_get_count(gd->timer, &ticks);
+ } else {
+ return 0;
+ }
+
+ us = (ticks * 1000) / rate;
+ return us;
+}
+#endif
static const struct timer_ops omap_timer_ops = {
.get_count = omap_timer_get_count,
--
2.33.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] omap: timer: implement timer_get_boot_us
2021-12-16 9:57 [PATCH] omap: timer: implement timer_get_boot_us Christian Gmeiner
@ 2022-01-11 6:50 ` Christian Gmeiner
2022-01-17 18:36 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Christian Gmeiner @ 2022-01-11 6:50 UTC (permalink / raw)
To: U-Boot Mailing List
Hi
Gentle ping.
>
> To make the OMAP DM timer driver useful for the timing of
> bootstages, we need to implement timer_get_boot_us(..).
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
> drivers/timer/omap-timer.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
> index 721e385fd1..25a6108fef 100644
> --- a/drivers/timer/omap-timer.c
> +++ b/drivers/timer/omap-timer.c
> @@ -83,6 +83,27 @@ static int omap_timer_of_to_plat(struct udevice *dev)
> return 0;
> }
>
> +#if CONFIG_IS_ENABLED(BOOTSTAGE)
> +ulong timer_get_boot_us(void)
> +{
> + u64 ticks = 0;
> + u32 rate = 1;
> + u64 us;
> + int ret;
> +
> + ret = dm_timer_init();
> + if (!ret) {
> + /* The timer is available */
> + rate = timer_get_rate(gd->timer);
> + timer_get_count(gd->timer, &ticks);
> + } else {
> + return 0;
> + }
> +
> + us = (ticks * 1000) / rate;
> + return us;
> +}
> +#endif
>
> static const struct timer_ops omap_timer_ops = {
> .get_count = omap_timer_get_count,
> --
> 2.33.1
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info/privacypolicy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] omap: timer: implement timer_get_boot_us
2021-12-16 9:57 [PATCH] omap: timer: implement timer_get_boot_us Christian Gmeiner
2022-01-11 6:50 ` Christian Gmeiner
@ 2022-01-17 18:36 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-01-17 18:36 UTC (permalink / raw)
To: Christian Gmeiner; +Cc: u-boot
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
On Thu, Dec 16, 2021 at 10:57:29AM +0100, Christian Gmeiner wrote:
> To make the OMAP DM timer driver useful for the timing of
> bootstages, we need to implement timer_get_boot_us(..).
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-17 18:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-16 9:57 [PATCH] omap: timer: implement timer_get_boot_us Christian Gmeiner
2022-01-11 6:50 ` Christian Gmeiner
2022-01-17 18:36 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox