ar71xx: update to 3.10.1
[openwrt/openwrt.git] / target / linux / ramips / patches-3.8 / 0003-MIPS-ralink-adds-reset-code.patch
1 From 3cdf3d713c81ffd3032d7c664f0be89d1ddce3e3 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 20 Jan 2013 22:00:57 +0100
4 Subject: [PATCH 03/79] MIPS: ralink: adds reset code
5
6 Resetting these SoCs requires no real magic. The code is straight forward.
7
8 Signed-off-by: John Crispin <blogic@openwrt.org>
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Patchwork: http://patchwork.linux-mips.org/patch/4891/
11 ---
12 arch/mips/ralink/reset.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
13 1 file changed, 44 insertions(+)
14 create mode 100644 arch/mips/ralink/reset.c
15
16 diff --git a/arch/mips/ralink/reset.c b/arch/mips/ralink/reset.c
17 new file mode 100644
18 index 0000000..22120e5
19 --- /dev/null
20 +++ b/arch/mips/ralink/reset.c
21 @@ -0,0 +1,44 @@
22 +/*
23 + * This program is free software; you can redistribute it and/or modify it
24 + * under the terms of the GNU General Public License version 2 as published
25 + * by the Free Software Foundation.
26 + *
27 + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
28 + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
29 + * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
30 + */
31 +
32 +#include <linux/pm.h>
33 +#include <linux/io.h>
34 +
35 +#include <asm/reboot.h>
36 +
37 +#include <asm/mach-ralink/ralink_regs.h>
38 +
39 +/* Reset Control */
40 +#define SYSC_REG_RESET_CTRL 0x034
41 +#define RSTCTL_RESET_SYSTEM BIT(0)
42 +
43 +static void ralink_restart(char *command)
44 +{
45 + local_irq_disable();
46 + rt_sysc_w32(RSTCTL_RESET_SYSTEM, SYSC_REG_RESET_CTRL);
47 + unreachable();
48 +}
49 +
50 +static void ralink_halt(void)
51 +{
52 + local_irq_disable();
53 + unreachable();
54 +}
55 +
56 +static int __init mips_reboot_setup(void)
57 +{
58 + _machine_restart = ralink_restart;
59 + _machine_halt = ralink_halt;
60 + pm_power_off = ralink_halt;
61 +
62 + return 0;
63 +}
64 +
65 +arch_initcall(mips_reboot_setup);
66 --
67 1.7.10.4
68