From patchwork Thu Feb 19 01:01:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Olivari X-Patchwork-Id: 441512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3608014007F for ; Thu, 19 Feb 2015 12:01:40 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 55CBB28C172; Thu, 19 Feb 2015 02:01:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id ECA1928C173 for ; Thu, 19 Feb 2015 02:01:18 +0100 (CET) X-policyd-weight: using cached result; rate: -7.6 Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 19 Feb 2015 02:01:18 +0100 (CET) Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 1B6FD1405F3; Thu, 19 Feb 2015 01:01:21 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 0911E1405F7; Thu, 19 Feb 2015 01:01:21 +0000 (UTC) Received: from mathieu-linux.qualcomm.com (qf-scl1nat.qualcomm.com [207.114.132.30]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: mathieu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 84B9F1405F3; Thu, 19 Feb 2015 01:01:20 +0000 (UTC) From: Mathieu Olivari To: blogic@openwrt.org Date: Wed, 18 Feb 2015 17:01:13 -0800 Message-Id: <1424307674-30507-2-git-send-email-mathieu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424307674-30507-1-git-send-email-mathieu@codeaurora.org> References: <1424307674-30507-1-git-send-email-mathieu@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH 2/3] ipq806x: fix restart X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" 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 --- .../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 +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 +--- + 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 ++#include ++#include + + #include ++#include ++ ++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 +