From patchwork Thu Feb 24 16:13:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: R Sricharan X-Patchwork-Id: 587871 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1OGE84j028836 for ; Thu, 24 Feb 2011 16:14:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754186Ab1BXQOH (ORCPT ); Thu, 24 Feb 2011 11:14:07 -0500 Received: from na3sys009aog106.obsmtp.com ([74.125.149.77]:49976 "EHLO na3sys009aog106.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753845Ab1BXQOF (ORCPT ); Thu, 24 Feb 2011 11:14:05 -0500 Received: from source ([209.85.212.43]) (using TLSv1) by na3sys009aob106.postini.com ([74.125.148.12]) with SMTP ID DSNKTWaDy+qpg6ZeHfgkFKXBnFvT5QPw8e1j@postini.com; Thu, 24 Feb 2011 08:14:04 PST Received: by mail-vw0-f43.google.com with SMTP id 18so658666vws.2 for ; Thu, 24 Feb 2011 08:14:03 -0800 (PST) Received: by 10.52.165.136 with SMTP id yy8mr1808790vdb.273.1298563994737; Thu, 24 Feb 2011 08:13:14 -0800 (PST) From: Sricharan R References: <1294234855-6623-1-git-send-email-santosh.shilimkar@ti.com> <007049e3361a3c4d0e7d2cfa105e2e67@mail.gmail.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acutzxyb86277zrCTDC63Xk7/Kkr2AIla2OQB3T9qiA= In-Reply-To: <007049e3361a3c4d0e7d2cfa105e2e67@mail.gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 Date: Thu, 24 Feb 2011 21:43:12 +0530 Message-ID: Subject: RE: [PATCH] omap: wd_timer: Fix crash frm wdt_probe when !CONFIG_RUNTIME_PM To: Santosh Shilimkar , Paul Walmsley Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 24 Feb 2011 16:14:08 +0000 (UTC) diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 657f3c8..2641d73 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -382,24 +382,6 @@ void __init omap2_init_common_infrastructure(void) #endif omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); - /* - * Set the default postsetup state for unusual modules (like - * MPU WDT). - * - * The postsetup_state is not actually used until - * omap_hwmod_late_init(), so boards that desire full watchdog - * coverage of kernel initialization can reprogram the - * postsetup_state between the calls to - * omap2_init_common_infra() and omap2_init_common_devices(). - * - * XXX ideally we could detect whether the MPU WDT was currently - * enabled here and make this conditional - */ - postsetup_state = _HWMOD_STATE_DISABLED; - omap_hwmod_for_each_by_class("wd_timer", - _set_hwmod_postsetup_state, - &postsetup_state); - omap_pm_if_early_init(); if (cpu_is_omap2420()) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 879f55f..d665ee5 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -545,7 +545,8 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = { static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { .name = "wd_timer", .sysc = &omap3xxx_wd_timer_sysc, - .pre_shutdown = &omap2_wd_timer_disable + .pre_shutdown = &omap2_wd_timer_disable, + .reset = &omap2_wd_timer_reset }; /* wd_timer2 */ diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c index 4067669..e11c5f3 100644 --- a/arch/arm/mach-omap2/wd_timer.c +++ b/arch/arm/mach-omap2/wd_timer.c @@ -24,7 +24,8 @@ */ #define OMAP_WDT_WPS 0x34 #define OMAP_WDT_SPR 0x48 - +#define OMAP_WDT_DSC 0x10 +#define OMAP_WDT_DST 0x14 int omap2_wd_timer_disable(struct omap_hwmod *oh) { @@ -54,3 +55,32 @@ int omap2_wd_timer_disable(struct omap_hwmod *oh) return 0; } +int omap2_wd_timer_reset(struct omap_hwmod *oh) +{ + void __iomem *base; + pr_err("\n\n\n\n\n\n\n\n\n omap2_wd_timer_reset \n\n\n\n\n"); + + if (!oh) { + pr_err("%s: could not look up wdtimer_hwmod\n",__func__); + } + + base = omap_hwmod_get_mpu_rt_va(oh); + if(!base) { + pr_err("%s: Could not get the base address for %s\n", + oh->name, __func__); + return -EINVAL; + } + + /* soft reset on watch dog timer */ + __raw_writel(0x02, base + OMAP_WDT_DSC); + while (__raw_readl(base + OMAP_WDT_DST) & 0x1) + cpu_relax(); + +#ifdef CONFIG_OMAP_WATCHDOG + /* Disable the watchdog */ + omap2_wd_timer_disable(oh); +#endif + + return 0; +} + diff --git a/arch/arm/mach-omap2/wd_timer.h b/arch/arm/mach-omap2/wd_timer.h index e0054a2..f6bbba7 100644 --- a/arch/arm/mach-omap2/wd_timer.h +++ b/arch/arm/mach-omap2/wd_timer.h @@ -13,5 +13,6 @@ #include extern int omap2_wd_timer_disable(struct omap_hwmod *oh); +extern int omap2_wd_timer_reset(struct omap_hwmod *oh);