From patchwork Tue Oct 23 18:09:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1631751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A2A173FD4E for ; Tue, 23 Oct 2012 18:11:14 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TQiv5-0007gP-8s; Tue, 23 Oct 2012 18:09:39 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TQiv1-0007fd-DT for linux-arm-kernel@lists.infradead.org; Tue, 23 Oct 2012 18:09:36 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so2753165pad.36 for ; Tue, 23 Oct 2012 11:09:34 -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=sC0f7CrXd2VwVBV000XaVjh1dz+MFkabIACCqCVioJg=; b=N8pStJnsXG5oOVEpjMjo1n9SpGkSAA22d0HHSbkJ40ZUO9548sQ4zcQW8wJ2GwQRMl AbCYZiNLUnRywZ4RoOGzt1KQr8t/JPdXNOqYle+AEgJEh1+83OiSvIKBtiv2AdSCVDgt yUWBS9PX1jg6vVQedxgnda9YahDivaJaRfWsl2zrPkBjkEsK09pwzcP1/OZ0L5tARimO 7fCe5Kbwy6g3QFbI/iYgmRFyTxXQRasCFvEdJys+R8MdxWXlIIvGE9rzJf0nRWHpXCVr xVKMibJjiuYExOaywRRMZ8l27ncYS5aW1/qR/IwzHaeR1aUyN/K8jjPwwLzEQYfT45wa 0N2g== Received: by 10.66.75.168 with SMTP id d8mr37265081paw.63.1351015773968; Tue, 23 Oct 2012 11:09:33 -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 b6sm7177165pav.33.2012.10.23.11.09.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 23 Oct 2012 11:09:33 -0700 (PDT) From: Kevin Hilman To: Linus Walleij , Felipe Balbi , linux-omap@vger.kernel.org Subject: [PATCH] gpio/omap: fix off-mode bug: clear debounce clock enable mask on disable Date: Tue, 23 Oct 2012 11:09:31 -0700 Message-Id: <1351015771-6308-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.8.0 X-Gm-Message-State: ALoCoQmUD0BgKZTfzTKJRkrXDVN4ajCYPP6ATbRS1I6Zg6beCTqXHhITqqMCxqPjBV1ha+K+jSLN 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.220.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Paul Walmsley , Igor Grinberg , 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: , 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 When debounce clocks are disabled, ensure that the banks dbck_enable_mask is cleared also. Otherwise, context restore on subsequent off-mode transition will restore previous value from the shadow copies (bank->context.debounce*) leading to mismatch state between driver state and hardware state. This was discovered when board code was doing gpio_request_one() gpio_set_debounce() gpio_free() which was leaving the GPIO debounce settings in a confused state. Then, enabling off mode causing bogus state to be restored, leaving GPIO debounce enabled which then prevented the CORE powerdomain from transitioning. Reported-by: Paul Walmsley Cc: Igor Grinberg Signed-off-by: Kevin Hilman Acked-by: Santosh Shilimkar Acked-by: Igor Grinberg --- Applies on v3.7-rc2, targetted for v3.7. drivers/gpio/gpio-omap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc84..dee2856 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -187,6 +187,7 @@ static inline void _gpio_dbck_disable(struct gpio_bank *bank) * to detect events and generate interrupts at least on OMAP3. */ __raw_writel(0, bank->base + bank->regs->debounce_en); + bank->dbck_enable_mask = 0; clk_disable(bank->dbck); bank->dbck_enabled = false;