ramips: fix subtarget kernel version assignment (only mt7621 is ready for now)
[openwrt/svn-archive/archive.git] / target / linux / ramips / patches-4.3 / 0018-arch-mips-ralink-reset-pci-prior-to-reboot.patch
1 From d3c1e72c755cf67427b5d410039a096520d6537f Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Mon, 7 Dec 2015 17:19:55 +0100
4 Subject: [PATCH 18/53] arch: mips: ralink: reset pci prior to reboot
5
6 Signed-off-by: John Crispin <blogic@openwrt.org>
7 ---
8 arch/mips/ralink/reset.c | 12 ++++++++++--
9 1 file changed, 10 insertions(+), 2 deletions(-)
10
11 --- a/arch/mips/ralink/reset.c
12 +++ b/arch/mips/ralink/reset.c
13 @@ -11,6 +11,7 @@
14 #include <linux/pm.h>
15 #include <linux/io.h>
16 #include <linux/of.h>
17 +#include <linux/delay.h>
18 #include <linux/reset-controller.h>
19
20 #include <asm/reboot.h>
21 @@ -18,8 +19,10 @@
22 #include <asm/mach-ralink/ralink_regs.h>
23
24 /* Reset Control */
25 -#define SYSC_REG_RESET_CTRL 0x034
26 -#define RSTCTL_RESET_SYSTEM BIT(0)
27 +#define SYSC_REG_RESET_CTRL 0x034
28 +
29 +#define RSTCTL_RESET_PCI BIT(26)
30 +#define RSTCTL_RESET_SYSTEM BIT(0)
31
32 static int ralink_assert_device(struct reset_controller_dev *rcdev,
33 unsigned long id)
34 @@ -83,6 +86,11 @@ void ralink_rst_init(void)
35
36 static void ralink_restart(char *command)
37 {
38 + if (IS_ENABLED(CONFIG_PCI)) {
39 + rt_sysc_m32(0, RSTCTL_RESET_PCI, SYSC_REG_RESET_CTRL);
40 + mdelay(50);
41 + }
42 +
43 local_irq_disable();
44 rt_sysc_w32(RSTCTL_RESET_SYSTEM, SYSC_REG_RESET_CTRL);
45 unreachable();