watchdog: Use dev_read only if OF_PLATDATA is not enabled
authorWalter Lozano <walter.lozano@collabora.com>
Thu, 23 Jan 2020 19:05:05 +0000 (16:05 -0300)
committerStefan Roese <sr@denx.de>
Mon, 16 Mar 2020 10:25:12 +0000 (11:25 +0100)
Currently watchdog tries to use dev_read_u32_default to get timeout
configuration in case OF_CONTROL is enabled. However, if SPL is
built with OF_PLATDATA this has no sense as there is no device tree.

This patch fixes this issue by only use dev_read_u32_default if OF_CONTROL
is enabled but OF_PLATDATA is not.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/wdt.h

index 5bcff24ab310020a19b053e22e85db7345a62b64..dd83dfdd32083c94182104612000c9c744cfe484 100644 (file)
@@ -130,11 +130,10 @@ static inline int initr_watchdog(void)
                }
        }
 
-       if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+       if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
                                               WATCHDOG_TIMEOUT_SECS);
        }
-
        wdt_start(gd->watchdog_dev, timeout * 1000, 0);
        gd->flags |= GD_FLG_WDT_READY;
        printf("WDT:   Started with%s servicing (%ds timeout)\n",