| // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| * Copyright (c) 2019 Amlogic, Inc. All rights reserved. |
| static int do_watchdog(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| struct udevice *watchdog_devp; |
| ret = uclass_get_device_by_name(UCLASS_WDT, "watchdog", &watchdog_devp); |
| printf("Failed to find watchdog node, check device tree.\n"); |
| if (strcmp(cmd, "off") == 0) { |
| if (strcmp(cmd, "ping") == 0) { |
| wdt_reset(watchdog_devp); |
| timeout = simple_strtoul(cmd, &endp, 0); |
| /* enable the watchdog and set timeout */ |
| wdt_start(watchdog_devp, timeout * 1000, 0); |
| wdt_reset(watchdog_devp); |
| watchdog, 2, 0, do_watchdog, |
| "enable or disable watchdog", |
| "<timeout> - enable watchdog with `timeout' seconds timeout\n" |
| "watchdog off - disable watchdog\n" |
| "watchdog ping - ping watchdog\n" |