From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] dm: implement a Timer uclass
Date: Tue, 29 Sep 2015 09:32:03 +0800 [thread overview]
Message-ID: <5609EA13.4000400@wytron.com.tw> (raw)
In-Reply-To: <1443446357-21393-1-git-send-email-thomas@wytron.com.tw>
On 09/28/2015 09:19 PM, Thomas Chou wrote:
> diff --git a/drivers/timer/timer.c b/drivers/timer/timer.c
> new file mode 100644
> index 0000000..648fd06
> --- /dev/null
> +++ b/drivers/timer/timer.c
> @@ -0,0 +1,51 @@
> +/*
> + * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <errno.h>
> +#include <timer.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +unsigned long notrace get_tbclk(void)
> +{
> + struct udevice *dev;
> + unsigned long rate;
> +
> + uclass_first_device(UCLASS_TIMER, &dev);
> + if (!dev)
> + return 100000000; /* 100MHz, fail-safe */
return -ENODEV;
> +
> + timer_get_rate(dev, &rate);
> +
> + return rate;
> +}
> +
> +unsigned long notrace timer_read_counter(void)
> +{
> + struct udevice *dev;
> + unsigned long count;
> +
> + uclass_first_device(UCLASS_TIMER, &dev);
> + if (!dev)
> + return 0; /* 0, fail-safe */
return -ENODEV;
next prev parent reply other threads:[~2015-09-29 1:32 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 ` Thomas Chou [this message]
2015-09-29 12:39 ` [U-Boot] [PATCH v2 1/2] dm: implement a Timer uclass 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
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=5609EA13.4000400@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