summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-09-11 22:04:11 +0200
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-09-18 20:40:33 +0200
commitaf823151641b1a9a8eae8c3b111f5fa27e6873ac (patch)
treeab1c2cc6793ab8511b5f66bea2b95d38cbb5e4c7 /drivers/timer
parentb61e8b0c9e76dacf0b670c3948c3cd738b2379a3 (diff)
dm: timer: handle being called before dm_root is ready
When used with bootstage recording, dm_timer_init may be called surprisingly early: i.e. before dm_root is ready. To deal with this case, we explicitly check for this condition and return -EAGAIN to the caller (refer to drivers/timer/rockchip_timer.c for a case where this is needed/used). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/timer-uclass.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index 62d6f0b29a..45397b230f 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -92,6 +92,13 @@ int notrace dm_timer_init(void)
if (gd->timer)
return 0;
+ /*
+ * Directly access gd->dm_root to suppress error messages, if the
+ * virtual root driver does not yet exist.
+ */
+ if (gd->dm_root == NULL)
+ return -EAGAIN;
+
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
/* Check for a chosen timer to be used for tick */
node = ofnode_get_chosen_node("tick-timer");