diff mbox series

[v2,1/2] timer: sti: convert to livetree

Message ID 20200313224244.4502-2-nicolas.heemeryck@gmail.com
State Accepted
Commit 123123d695a9b024a1413645eeff4bb41f610332
Headers show
Series timer: sti: mimic Linux declaration and usage | expand

Commit Message

Nicolas Heemeryck March 13, 2020, 10:42 p.m. UTC
Update STI timer to support a live tree

Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck at gmail.com>
Cc: Patrice Chotard <patrice.chotard at st.com>

---

Changes for v2: None
---
 drivers/timer/sti-timer.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Patrice CHOTARD March 17, 2020, 3:32 p.m. UTC | #1
Hi Nicolas

On 3/13/20 11:42 PM, Nicolas Heemeryck wrote:
> Update STI timer to support a live tree
>
> Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck at gmail.com>
> Cc: Patrice Chotard <patrice.chotard at st.com>
>
> ---
>
> Changes for v2: None
> ---
>  drivers/timer/sti-timer.c | 9 +++------
>  1 file 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);

Acked-by: Patrice Chotard <patrice.chotard at st.com>

Thanks

Patrice
Patrick Delaunay March 19, 2020, 9:28 a.m. UTC | #2
Hi,

> From: U-Boot <u-boot-bounces at lists.denx.de> On Behalf Of Nicolas Heemeryck
> Sent: vendredi 13 mars 2020 23:43
> 
> Update STI timer to support a live tree
> 
> Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck at gmail.com>
> Cc: Patrice Chotard <patrice.chotard at st.com>
> 
> ---

Applied to u-boot-stm/next, thanks!

Regards

Patrick
diff mbox series

Patch

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);