summaryrefslogtreecommitdiffstats
path: root/drivers/timer/sti-timer.c
diff options
context:
space:
mode:
authorNicolas Heemeryck <nicolas.heemeryck@gmail.com>2020-03-13 23:42:43 +0100
committerPatrick Delaunay <patrick.delaunay@st.com>2020-03-24 14:23:33 +0100
commit123123d695a9b024a1413645eeff4bb41f610332 (patch)
treec0088e809d2b7a457e637697ab90348e869f9041 /drivers/timer/sti-timer.c
parentc32446557627699cd17c93d1077b9d0466a81589 (diff)
downloadu-boot-123123d695a9b024a1413645eeff4bb41f610332.tar.gz
u-boot-123123d695a9b024a1413645eeff4bb41f610332.tar.xz
u-boot-123123d695a9b024a1413645eeff4bb41f610332.zip
timer: sti: convert to livetree
Update STI timer to support a live tree Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@gmail.com> Cc: Patrice Chotard <patrice.chotard@st.com> Acked-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'drivers/timer/sti-timer.c')
-rw-r--r--drivers/timer/sti-timer.c9
1 files changed, 3 insertions, 6 deletions
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 <common.h>
#include <dm.h>
-#include <fdtdec.h>
#include <timer.h>
#include <asm/io.h>
#include <asm/arch-armv7/globaltimer.h>
-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);