2 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
12 #include <linux/sizes.h>
14 #include <asm/reboot.h>
16 #include <loongson1.h>
18 static void __iomem *wdt_reg_base;
20 static void ls1x_halt(void)
28 static void ls1x_restart(char *command)
30 __raw_writel(0x1, wdt_reg_base + WDT_EN);
31 __raw_writel(0x1, wdt_reg_base + WDT_TIMER);
32 __raw_writel(0x1, wdt_reg_base + WDT_SET);
37 static void ls1x_power_off(void)
42 static int __init ls1x_reboot_setup(void)
44 wdt_reg_base = ioremap_nocache(LS1X_WDT_BASE, (SZ_4 + SZ_8));
46 panic("Failed to remap watchdog registers");
48 _machine_restart = ls1x_restart;
49 _machine_halt = ls1x_halt;
50 pm_power_off = ls1x_power_off;
55 arch_initcall(ls1x_reboot_setup);