From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 02/10] dm: timer: Implement pre_probe()
Date: Fri, 6 Nov 2015 15:00:21 +0800 [thread overview]
Message-ID: <563C5005.3010305@wytron.com.tw> (raw)
In-Reply-To: <1446732171-7439-3-git-send-email-bmeng.cn@gmail.com>
Hi Bin,
On 2015?11?05? 22:02, Bin Meng wrote:
> Every timer device needs to have a valid clock frequency and it
> can be specified in the device tree. Use pre_probe() to get this
> in the timer uclass driver.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> drivers/timer/timer-uclass.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
> index 82c6897..0218591 100644
> --- a/drivers/timer/timer-uclass.c
> +++ b/drivers/timer/timer-uclass.c
> @@ -9,6 +9,8 @@
> #include <errno.h>
> #include <timer.h>
>
> +DECLARE_GLOBAL_DATA_PTR;
> +
> /*
> * Implement a timer uclass to work with lib/time.c. The timer is usually
> * a 32 bits free-running up counter. The get_rate() method is used to get
> @@ -35,8 +37,19 @@ unsigned long timer_get_rate(struct udevice *dev)
> return uc_priv->clock_rate;
> }
>
> +static int timer_pre_probe(struct udevice *dev)
> +{
> + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
> +
> + uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
> + "clock-frequency", 0);
> +
> + return 0;
> +}
> +
> UCLASS_DRIVER(timer) = {
> .id = UCLASS_TIMER,
> .name = "timer",
> + .pre_probe = timer_pre_probe,
> .per_device_auto_alloc_size = sizeof(struct timer_dev_priv),
> };
>
Acked-by: Thomas Chou <thomas@wytron.com.tw>
next prev parent reply other threads:[~2015-11-06 7:00 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-05 14:02 [U-Boot] [PATCH 00/10] dm: timer: x86: 64-bit counter support and tsc timer dm conversion Bin Meng
2015-11-05 14:02 ` [U-Boot] [PATCH 01/10] dm: timer: Fix several nits Bin Meng
2015-11-06 6:59 ` Thomas Chou
2015-11-06 12:06 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 02/10] dm: timer: Implement pre_probe() Bin Meng
2015-11-06 7:00 ` Thomas Chou [this message]
2015-11-06 12:08 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 03/10] timer: altera: Remove the codes to get clock frequency Bin Meng
2015-11-06 7:01 ` Thomas Chou
2015-11-06 12:08 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 04/10] dm: timer: Support 64-bit counter Bin Meng
2015-11-06 7:14 ` Thomas Chou
2015-11-06 14:35 ` Bin Meng
2015-11-06 22:40 ` Thomas Chou
2015-11-10 2:46 ` Bin Meng
2015-11-05 14:02 ` [U-Boot] [PATCH 05/10] x86: Reomve MIN_PORT80_KCLOCKS_DELAY Bin Meng
2015-11-06 12:08 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 06/10] x86: tsc: Use notrace from <linux/compiler.h> Bin Meng
2015-11-06 12:08 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 07/10] x86: tsc: Add driver model timer support Bin Meng
2015-11-06 12:08 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 08/10] x86: Convert to use driver model timer Bin Meng
2015-11-06 12:08 ` Simon Glass
2015-11-06 14:28 ` Bin Meng
2015-11-06 23:58 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 09/10] x86: tsc: Remove legacy timer codes Bin Meng
2015-11-06 12:08 ` Simon Glass
2015-11-05 14:02 ` [U-Boot] [PATCH 10/10] x86: tsc: Move tsc_timer.c to drivers/timer Bin Meng
2015-11-06 12:08 ` Simon Glass
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=563C5005.3010305@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