From patchwork Thu Jul 29 06:41:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 114994 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 o6T6fc0U004173 for ; Thu, 29 Jul 2010 06:41:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752062Ab0G2Gli (ORCPT ); Thu, 29 Jul 2010 02:41:38 -0400 Received: from smtp.nokia.com ([192.100.122.230]:43107 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751737Ab0G2Glh (ORCPT ); Thu, 29 Jul 2010 02:41:37 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o6T6fQ1L019768; Thu, 29 Jul 2010 09:41:27 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 29 Jul 2010 09:41:23 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 29 Jul 2010 09:41:22 +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 o6T6fISd014558; Thu, 29 Jul 2010 09:41:20 +0300 From: Mikko Rapeli To: linux-omap@vger.kernel.org Cc: mturquette@ti.com, sameo@linux.intel.com Subject: [PATCH v2] twl4030 reboot workaround Date: Thu, 29 Jul 2010 09:41:18 +0300 Message-Id: <1280385678-4366-1-git-send-email-ext-mikko.rapeli@nokia.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <20100729061608.GG12063@edollo> References: <20100729061608.GG12063@edollo> X-OriginalArrivalTime: 29 Jul 2010 06:41:23.0214 (UTC) FILETIME=[0F7A92E0:01CB2EE9] 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]); Thu, 29 Jul 2010 06:41:39 +0000 (UTC) diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 7efa878..5c6da1e 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,30 @@ 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 +574,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: