From patchwork Wed Jul 4 15:54:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zumeng Chen X-Patchwork-Id: 1156751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 4C2FEDFF0F for ; Wed, 4 Jul 2012 16:01:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SmRwU-0003jR-0W; Wed, 04 Jul 2012 15:56:39 +0000 Received: from mail1.windriver.com ([147.11.146.13]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SmRuV-0003Gq-Jb for linux-arm-kernel@lists.infradead.org; Wed, 04 Jul 2012 15:54:39 +0000 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca [147.11.189.40]) by mail1.windriver.com (8.14.3/8.14.3) with ESMTP id q64FsMDN014096 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 4 Jul 2012 08:54:22 -0700 (PDT) Received: from pek-yocto-build2.corp.ad.wrs.com (128.224.162.103) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.1.255.0; Wed, 4 Jul 2012 08:54:22 -0700 From: Zumeng Chen To: , Subject: [PATCH 1/1] Watchdog: OMAP3: fix wrong boot status from wdt reboot Date: Wed, 4 Jul 2012 23:54:01 +0800 Message-ID: <1341417241-11563-1-git-send-email-zumeng.chen@windriver.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: zumeng.chen@windriver.com, linux-omap@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Does the following fix make sense? WDIOC_GETBOOTSTATUS always return 0 even if the machine comes from omap-wdt reboot. Because WKUP_MOD is not right for OMAP3, so give the right addr 0xA00 of PRM_RSTST for get_reset_sources, which inputs the signal from omap-wdt reboot, and return 1 when coming from omap-wdt reboot for WDIOC_GETBOOTSTATUS. Signed-off-by: Zumeng Chen --- arch/arm/mach-omap2/prcm.c | 4 +++- drivers/watchdog/omap_wdt.c | 3 +++ drivers/watchdog/omap_wdt.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index 480f40a..43f3feb 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c @@ -49,8 +49,10 @@ void __iomem *prcm_mpu_base; u32 omap_prcm_get_reset_sources(void) { /* XXX This presumably needs modification for 34XX */ - if (cpu_is_omap24xx() || cpu_is_omap34xx()) + if (cpu_is_omap24xx()) return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f; + if (cpu_is_omap34xx()) + return omap2_prm_read_mod_reg(0xA00, OMAP2_RM_RSTST) & 0x7f; if (cpu_is_omap44xx()) return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f; diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 8285d65..ea57078 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -234,6 +234,9 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd, if (cpu_is_omap24xx()) return put_user(omap_prcm_get_reset_sources(), (int __user *)arg); + if (cpu_is_omap34xx()) + return put_user(omap_prcm_get_reset_sources() & 0x10 >> + OMAP3_PRM_RSTST_BIT, (int __user *)arg); return put_user(0, (int __user *)arg); case WDIOC_KEEPALIVE: pm_runtime_get_sync(wdev->dev); diff --git a/drivers/watchdog/omap_wdt.h b/drivers/watchdog/omap_wdt.h index 09b774c..d8d5daa 100644 --- a/drivers/watchdog/omap_wdt.h +++ b/drivers/watchdog/omap_wdt.h @@ -40,6 +40,9 @@ #define OMAP_WATCHDOG_WPS (0x34) #define OMAP_WATCHDOG_SPR (0x48) +/* PRM_RSTST MPU_WD_RST bit */ +#define OMAP3_PRM_RSTST_BIT 4 + /* Using the prescaler, the OMAP watchdog could go for many * months before firing. These limits work without scaling, * with the 60 second default assumed by most tools and docs.