Merge tag 'u-boot-stm32-20211012' of https://source.denx.de/u-boot/custodians/u-boot-stm
[platform/kernel/u-boot.git] / drivers / timer / rockchip_timer.c
index 8d3eceb..62eacb9 100644 (file)
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <init.h>
 #include <log.h>
+#include <asm/global_data.h>
 #include <dm/ofnode.h>
 #include <mapmem.h>
 #include <asm/arch-rockchip/timer.h>
@@ -54,8 +55,7 @@ ulong timer_get_boot_us(void)
                /* The timer is available */
                rate = timer_get_rate(gd->timer);
                timer_get_count(gd->timer, &ticks);
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-       } else if (ret == -EAGAIN) {
+       } else if (CONFIG_IS_ENABLED(OF_REAL) && ret == -EAGAIN) {
                /* We have been called so early that the DM is not ready,... */
                ofnode node = offset_to_ofnode(-1);
                struct rk_timer *timer = NULL;
@@ -78,7 +78,6 @@ ulong timer_get_boot_us(void)
                        debug("%s: could not read clock-frequency\n", __func__);
                        return 0;
                }
-#endif
        } else {
                return 0;
        }
@@ -99,13 +98,13 @@ static u64 rockchip_timer_get_count(struct udevice *dev)
 
 static int rockchip_clk_of_to_plat(struct udevice *dev)
 {
-#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-       struct rockchip_timer_priv *priv = dev_get_priv(dev);
+       if (CONFIG_IS_ENABLED(OF_REAL)) {
+               struct rockchip_timer_priv *priv = dev_get_priv(dev);
 
-       priv->timer = dev_read_addr_ptr(dev);
-       if (!priv->timer)
-               return -ENOENT;
-#endif
+               priv->timer = dev_read_addr_ptr(dev);
+               if (!priv->timer)
+                       return -ENOENT;
+       }
 
        return 0;
 }