1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
8 #include <linux/sizes.h>
10 #include <asm/reboot.h>
12 #include <loongson1.h>
14 static void __iomem
*wdt_reg_base
;
16 static void ls1x_halt(void)
24 static void ls1x_restart(char *command
)
26 __raw_writel(0x1, wdt_reg_base
+ WDT_EN
);
27 __raw_writel(0x1, wdt_reg_base
+ WDT_TIMER
);
28 __raw_writel(0x1, wdt_reg_base
+ WDT_SET
);
33 static void ls1x_power_off(void)
38 static int __init
ls1x_reboot_setup(void)
40 wdt_reg_base
= ioremap(LS1X_WDT_BASE
, (SZ_4
+ SZ_8
));
42 panic("Failed to remap watchdog registers");
44 _machine_restart
= ls1x_restart
;
45 _machine_halt
= ls1x_halt
;
46 pm_power_off
= ls1x_power_off
;
51 arch_initcall(ls1x_reboot_setup
);