[U-Boot,2/2] arm: zynq: Try to enable the first watchdog via aliases

Message ID 9e422e39f59faadef36175d422353917fe8de2dd.1531291597.git.michal.simek@xilinx.com
State Accepted
Commit 501fc50a2964210412cb39679d0ac8e994c40ef8
Delegated to: Michal Simek
Headers show
Series
  • [U-Boot,1/2] arm64: zynqmp: Try to enable the first watchdog via aliases
Related show

Commit Message

Michal Simek July 11, 2018, 6:46 a.m.
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 | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 1106f5c2a892..9c005e40e895 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -36,12 +36,16 @@  int board_early_init_f(void)
 int board_init(void)
 {
 #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
 
 	return 0;