unify {de,}mangle_poll(), get rid of kernel-side POLL...
[cris-mirror.git] / arch / mips / pic32 / common / reset.c
blob83345757be5fd146d172c3625e599df5f2dad688
1 /*
2 * Joshua Henderson <joshua.henderson@microchip.com>
3 * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
14 #include <linux/init.h>
15 #include <linux/pm.h>
16 #include <asm/reboot.h>
17 #include <asm/mach-pic32/pic32.h>
19 #define PIC32_RSWRST 0x10
21 static void pic32_halt(void)
23 while (1) {
24 __asm__(".set push;\n"
25 ".set arch=r4000;\n"
26 "wait;\n"
27 ".set pop;\n"
32 static void pic32_machine_restart(char *command)
34 void __iomem *reg =
35 ioremap(PIC32_BASE_RESET + PIC32_RSWRST, sizeof(u32));
37 pic32_syskey_unlock();
39 /* magic write/read */
40 __raw_writel(1, reg);
41 (void)__raw_readl(reg);
43 pic32_halt();
46 static void pic32_machine_halt(void)
48 local_irq_disable();
50 pic32_halt();
53 static int __init mips_reboot_setup(void)
55 _machine_restart = pic32_machine_restart;
56 _machine_halt = pic32_machine_halt;
57 pm_power_off = pic32_machine_halt;
59 return 0;
62 arch_initcall(mips_reboot_setup);