From: Nicolas Heemeryck Date: Fri, 13 Mar 2020 22:42:43 +0000 (+0100) Subject: timer: sti: convert to livetree X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=123123d695a9b024a1413645eeff4bb41f610332;p=u-boot.git timer: sti: convert to livetree Update STI timer to support a live tree Signed-off-by: Nicolas Heemeryck Cc: Patrice Chotard Acked-by: Patrice Chotard --- diff --git a/drivers/timer/sti-timer.c b/drivers/timer/sti-timer.c index 9def7e02f4..eac22ae39b 100644 --- a/drivers/timer/sti-timer.c +++ b/drivers/timer/sti-timer.c @@ -6,14 +6,11 @@ #include #include -#include #include #include #include -DECLARE_GLOBAL_DATA_PTR; - struct sti_timer_priv { struct globaltimer *global_timer; }; @@ -44,13 +41,13 @@ static int sti_timer_probe(struct udevice *dev) { struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct sti_timer_priv *priv = dev_get_priv(dev); - fdt_addr_t addr; uc_priv->clock_rate = CONFIG_SYS_HZ_CLOCK; /* get arm global timer base address */ - addr = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), "reg"); - priv->global_timer = (struct globaltimer *)addr; + priv->global_timer = (struct globaltimer *)dev_read_addr_ptr(dev); + if (!priv->global_timer) + return -ENOENT; /* init timer */ writel(0x01, &priv->global_timer->ctl);