Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / mips / loongson32 / common / reset.c
blob0c7399b303fbe7b073929ec4f7f181f0ec4c5619
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
4 */
6 #include <linux/io.h>
7 #include <linux/pm.h>
8 #include <linux/sizes.h>
9 #include <asm/idle.h>
10 #include <asm/reboot.h>
12 #include <loongson1.h>
14 static void __iomem *wdt_reg_base;
16 static void ls1x_halt(void)
18 while (1) {
19 if (cpu_wait)
20 cpu_wait();
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);
30 ls1x_halt();
33 static void ls1x_power_off(void)
35 ls1x_halt();
38 static int __init ls1x_reboot_setup(void)
40 wdt_reg_base = ioremap(LS1X_WDT_BASE, (SZ_4 + SZ_8));
41 if (!wdt_reg_base)
42 panic("Failed to remap watchdog registers");
44 _machine_restart = ls1x_restart;
45 _machine_halt = ls1x_halt;
46 pm_power_off = ls1x_power_off;
48 return 0;
51 arch_initcall(ls1x_reboot_setup);