[OpenWrt-Devel] [PATCH 2/3] ipq806x: fix restart

Mathieu Olivari mathieu at codeaurora.org
Wed Feb 18 20:01:13 EST 2015


Add an out of tree patch to fix reset on IPQ806x. Patch is available on
codeaurora.org but needs to be cleaned-up and upstreamed properly at
some point.

Signed-off-by: Mathieu Olivari <mathieu at codeaurora.org>
---
 .../003-HACK-qcom-make-restart-work-w-IPQ.patch    | 65 ++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 target/linux/ipq806x/patches/003-HACK-qcom-make-restart-work-w-IPQ.patch

diff --git a/target/linux/ipq806x/patches/003-HACK-qcom-make-restart-work-w-IPQ.patch b/target/linux/ipq806x/patches/003-HACK-qcom-make-restart-work-w-IPQ.patch
new file mode 100644
index 0000000..6a82ac4
--- /dev/null
+++ b/target/linux/ipq806x/patches/003-HACK-qcom-make-restart-work-w-IPQ.patch
@@ -0,0 +1,65 @@
+From 1e09cb4ab430cac62687bd1e5cf796a654f4d78d Mon Sep 17 00:00:00 2001
+From: Josh Cartwright <joshc at codeaurora.org>
+Date: Mon, 8 Sep 2014 00:15:40 -0500
+Subject: [PATCH] HACK: qcom: make restart work w/ IPQ
+
+Make use of the watchdog to trigger a reset.  This is hacky for a
+variety of reasons:
+ - Other mechanisms should be used on other systems proper PS_HOLD
+   handling
+ - This doesn't belong in the board file.  It should belong in a
+   watchdog driver.
+ - As a proper driver, it should make use of device tree to query the
+   start of the register region
+
+Change-Id: Ib5ca21a42ac64e0812186d31a87c8d63d49976c2
+Signed-off-by: Josh Cartwright <joshc at codeaurora.org>
+---
+ arch/arm/mach-qcom/board.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/arch/arm/mach-qcom/board.c b/arch/arm/mach-qcom/board.c
+index 6d8bbf7..7c6891d 100644
+--- a/arch/arm/mach-qcom/board.c
++++ b/arch/arm/mach-qcom/board.c
+@@ -11,8 +11,37 @@
+  */
+ 
+ #include <linux/init.h>
++#include <linux/io.h>
++#include <linux/kernel.h>
+ 
+ #include <asm/mach/arch.h>
++#include <asm/system_misc.h>
++
++static void __iomem *wdt;
++
++#define WDT0_RST	0x38
++#define WDT0_EN		0x40
++#define WDT0_BARK_TIME	0x4C
++#define WDT0_BITE_TIME	0x5C
++
++static void wdt_restart(enum reboot_mode reboot_mode, const char *cmd)
++{
++	writel_relaxed(1, wdt + WDT0_RST);
++	writel_relaxed(5*0x31F3, wdt + WDT0_BARK_TIME);
++	writel_relaxed(0x31F3, wdt + WDT0_BITE_TIME);
++	writel_relaxed(1, wdt + WDT0_EN);
++}
++
++static int wdt_init(void)
++{
++	wdt = ioremap(0x0200A000, 4096);
++	if (!wdt)
++		return -EINVAL;
++
++	arm_pm_restart = wdt_restart;
++	return 0;
++}
++late_initcall(wdt_init);
+ 
+ static const char * const qcom_dt_match[] __initconst = {
+ 	"qcom,apq8064",
+-- 
+1.9.1
+
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list