Update the Rockchip timer driver to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.toms...@theobroma-systems.com>
Reviewed-by: Simon Glass <s...@chromium.org>
Acked-by: Philipp Tomsich <philipp.toms...@theobroma-systems.com>

---

Changes in v3: None
Changes in v2:
- use the new dev_read_addr_ptr() function
- improve error handling, in case dev_read_addr_ptr returns NULL

 drivers/timer/rockchip_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c
index b19aaed..07d1448 100644
--- a/drivers/timer/rockchip_timer.c
+++ b/drivers/timer/rockchip_timer.c
@@ -101,7 +101,9 @@ static int rockchip_clk_ofdata_to_platdata(struct udevice 
*dev)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        struct rockchip_timer_priv *priv = dev_get_priv(dev);
 
-       priv->timer = (struct rk_timer *)devfdt_get_addr(dev);
+       priv->timer = dev_read_addr_ptr(dev);
+       if (!priv->timer)
+               return -ENOENT;
 #endif
 
        return 0;
-- 
2.1.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to