From patchwork Wed Jul 28 09:41:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 114719 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6S9fprP021577 for ; Wed, 28 Jul 2010 09:41:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754397Ab0G1Jlv (ORCPT ); Wed, 28 Jul 2010 05:41:51 -0400 Received: from smtp.nokia.com ([192.100.105.134]:29061 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752934Ab0G1Jlu (ORCPT ); Wed, 28 Jul 2010 05:41:50 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o6S9fEs6011590; Wed, 28 Jul 2010 04:41:43 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 28 Jul 2010 12:41:36 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 28 Jul 2010 12:41:35 +0300 Received: from localhost.localdomain (ouped11834.nmp.nokia.com [172.23.118.34]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o6S9fWr8020344; Wed, 28 Jul 2010 12:41:33 +0300 From: Mikko Rapeli To: linux-omap@vger.kernel.org Cc: mturquette@ti.com, sameo@linux.intel.com Subject: [PATCH] twl4030 reboot workaround Date: Wed, 28 Jul 2010 12:41:32 +0300 Message-Id: <1280310092-27260-1-git-send-email-ext-mikko.rapeli@nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1265226207-22971-3-git-send-email-mturquette@ti.com> References: <1265226207-22971-3-git-send-email-mturquette@ti.com> X-OriginalArrivalTime: 28 Jul 2010 09:41:36.0362 (UTC) FILETIME=[123444A0:01CB2E39] X-Nokia-AV: Clean 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.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 09:41:52 +0000 (UTC) diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 7efa878..5d46768 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -127,6 +128,29 @@ static u8 res_config_addrs[] = { [RES_Main_Ref] = 0x94, }; +/* + * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset. + * This causes Gaia sleep script to execute, usually killing VDD1 and + * VDD2 while code is running. WA is to disable the sleep script + * before warm reset. + */ +static int twl4030_prepare_for_reboot(struct notifier_block *this, + unsigned long cmd, void *p) +{ + int err; + err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT); + if (err) + pr_err("TWL4030: error trying to disable sleep script!\n"); + + return NOTIFY_DONE; +} + +static struct notifier_block twl4030_reboot_notifier = { + .notifier_call = twl4030_prepare_for_reboot, + .next = NULL, + .priority = 0 +}; + static int __init twl4030_write_script_byte(u8 address, u8 byte) { int err; @@ -549,6 +573,11 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY); if (err) pr_err("TWL4030 Unable to relock registers\n"); + + err = register_reboot_notifier(&twl4030_reboot_notifier); + if (err) + pr_err("TWL4030 Failed to register reboot notifier\n"); + return; unlock: