From patchwork Thu Sep 13 20:45:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1454271 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id AE44CDF24C for ; Thu, 13 Sep 2012 21:13:35 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TCGIZ-0005jF-5z; Thu, 13 Sep 2012 20:46:07 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TCGIW-0005io-0y for linux-arm-kernel@lists.infradead.org; Thu, 13 Sep 2012 20:46:04 +0000 Received: by pbbrq8 with SMTP id rq8so4884565pbb.36 for ; Thu, 13 Sep 2012 13:46:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=3MggaXD6euRRG/0Nhy7oP1YoJ/kiRWar0os9X4yMdoA=; b=AujQRu3y6WfHjVKK5sc67d71hCRXnQEYGTm/DMo/2wSfPiMy1PTyBEwP91cyUQADw5 Vz3RAVy/X0y8P2pXqEhF1huJGh7xewRN2kl6rhPYGUKU3CM2cy/Nx0kZI6vDNeRDRAzC R2wzbDNpooJn4v6Y1wAKWEr/INYKUaB9oNeoXf3j1eMrS7TjsJTXBlyax5W6O7K2Mvc0 MJWgKQiWKPeF9sBo4fzApehRG9Zfk1TzMVJBotg3/qbErLU6ny8I8XILIlSN3eBY4VXv QyG8PNG408cLhVNWXv+KDGHnB+bN8Amhe5JicS8YyShyByDhiJdjC/WxjUTnwVlbvfLA sC1w== Received: by 10.68.202.193 with SMTP id kk1mr1072290pbc.136.1347569159830; Thu, 13 Sep 2012 13:45:59 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPS id vz8sm7463060pbc.63.2012.09.13.13.45.58 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Sep 2012 13:45:58 -0700 (PDT) From: Kevin Hilman To: Andrew Morton , linux-omap@vger.kernel.org Subject: [PATCH] RTC: TWL: ensure all interrupts are disabled during probe Date: Thu, 13 Sep 2012 13:45:57 -0700 Message-Id: <1347569157-19262-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.7.9.2 X-Gm-Message-State: ALoCoQmsjk3EIZDIbAQl2Iqw7lbEBoEgRd1Gv76jeBmxdHfSuZt7Hve+w7JDgvmpLcWaUMGmY4No X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Kevin Hilman , Alessandro Zummo , Felipe Balbi , linux-arm-kernel@lists.infradead.org, Steve Sakoman 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kevin Hilman On some platforms, bootloaders are known to do some interesting RTC programming. Without going into the obscurities as to why this may be the case, suffice it to say the the driver should not make any assumptions about the state of the RTC when the driver loads. In particular, the driver probe should be sure that all interrupts are disabled until otherwise programmed. This was discovered when finding bursty I2C traffic every second on Overo platforms. This I2C overhead was keeping the SoC from hitting deep power states. The cause was found to be the RTC firing every second on the I2C-connected TWL PMIC. Special thanks to Felipe Balbi for suggesting to look for a rogue driver as the source of the I2C traffic rather than the I2C driver itself. Special thanks to Steve Sakoman for helping track down the source of the continuous RTC interrups on the Overo boards. Cc: Felipe Balbi Cc: Steve Sakoman Signed-off-by: Kevin Hilman Tested-by: Steve Sakoman --- Patch applies to v3.6-rc5 drivers/rtc/rtc-twl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index c5d06fe..9277d94 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -495,6 +495,11 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) if (ret < 0) goto out1; + /* ensure interrupts are disabled, bootloaders can be strange */ + ret = twl_rtc_write_u8(0, REG_RTC_INTERRUPTS_REG); + if (ret < 0) + dev_warn(&pdev->dev, "unable to disable interrupt\n"); + /* init cached IRQ enable bits */ ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); if (ret < 0)