]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: zynq: Try to enable the first watchdog via aliases
authorMichal Simek <michal.simek@xilinx.com>
Wed, 11 Jul 2018 06:35:22 +0000 (08:35 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 24 Jul 2018 09:36:01 +0000 (11:36 +0200)
The same change as was done for zynqmp with this description:

Add support for enabling the first watchdog pointed via aliases.

DT fragment:
aliases {
...
watchdog0= &watchdog0;
watchdog1 = &watchdog_lpd;
...
};

<zynqmp example removed>

Till this patch the first watchdog found in DT was used and started
which is not enabling all possible configuration based on user request.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynq/board.c

index 9fcfd5df02cf3de400182aeee2443c7dee645b01..10ed4644cb03afb9e25f630dbaa37cc2f9d9c35f 100644 (file)
@@ -96,12 +96,16 @@ int board_init(void)
 #endif
 
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-       if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
-               puts("Watchdog: Not found!\n");
-       } else {
-               wdt_start(watchdog_dev, 0, 0);
-               puts("Watchdog: Started\n");
+       if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
+               debug("Watchdog: Not found by seq!\n");
+               if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
+                       puts("Watchdog: Not found!\n");
+                       return 0;
+               }
        }
+
+       wdt_start(watchdog_dev, 0, 0);
+       puts("Watchdog: Started\n");
 # endif
 
 #if (defined(CONFIG_FPGA) && !defined(CONFIG_SPL_BUILD)) || \