1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * (C) Copyright 2016 Google, Inc 4 */ 5 6 #include <common.h> 7 #include <dm.h> 8 #include <errno.h> 9 #include <sysreset.h> 10 #include <wdt.h> 11 #include <asm/io.h> 12 #include <linux/err.h> 13 14 static int ast_sysreset_request(struct udevice *dev, enum sysreset_t type) 15 { 16 struct udevice *wdt; 17 u32 reset_mode; 18 int ret = uclass_first_device(UCLASS_WDT, &wdt); 19 20 if (ret) 21 return ret; 22 23 ret = wdt_expire_now(wdt, reset_mode); 24 if (ret) { 25 debug("Sysreset failed: %d", ret); 26 return ret; 27 } 28 29 return -EINPROGRESS; 30 } 31 32 static struct sysreset_ops ast_sysreset = { 33 .request = ast_sysreset_request, 34 }; 35 36 U_BOOT_DRIVER(sysreset_ast) = { 37 .name = "ast_sysreset", 38 .id = UCLASS_SYSRESET, 39 .ops = &ast_sysreset, 40 }; 41