From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6564AC04A6B for ; Wed, 8 May 2019 18:20:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 308F721019 for ; Wed, 8 May 2019 18:20:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="meUlg1gF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 308F721019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=YfH0piIWOAsB7m4ItCpzT+JZmCRo/Y2YoMQfEkVkugE=; b=meUlg1gF2Lk8tP pQmu77vn2NysEGwG5QHSh22y4FR2e5U73udPUWxAHyk+5HNcbqXD7W3OV4PPquP1cHjxXDkJnC4eM xT/NVNpfrQG4FQ5weh2w2nHIuYjR/gDJfjgejN0c0F+qfbG9qIP/ozGhf0mtNe8QPV5lJKsnw/jEw UcQHywx59A1jKYfAAR33woAyZ+pgVC1FzpcJ+ZU6Asd3rAtszAr+ejf5EOzq+9Mn8UjqaAMjDfL9A YWdkI6BieIra+XhRpB9ZqdRYQJH7zSUh7PZwUKLyErq6x2Ycmqqf4WV35y77oBvh2Rmixx2kn0AWZ dmXoVUvhZLxP9aqB+s1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hORAZ-0005U2-8H; Wed, 08 May 2019 18:19:55 +0000 Received: from muru.com ([72.249.23.125]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hORAV-0005T4-Tx for linux-arm-kernel@lists.infradead.org; Wed, 08 May 2019 18:19:53 +0000 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id B8153809F; Wed, 8 May 2019 18:20:05 +0000 (UTC) From: Tony Lindgren To: Linus Walleij , Bartosz Golaszewski Subject: [PATCH] gpio: gpio-omap: Fix lost edge wake-up interrupts Date: Wed, 8 May 2019 11:19:39 -0700 Message-Id: <20190508181939.1990-1-tony@atomide.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190508_111952_008321_E6983D62 X-CRM114-Status: UNSURE ( 8.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tero Kristo , Grygorii Strashko , Aaro Koskinen , Keerthy , Peter Ujfalusi , linux-gpio@vger.kernel.org, Russell King , Ladislav Michl , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org If an edge interrupt triggers while entering idle just before we save GPIO datain register to saved_datain, the triggered GPIO will not be noticed on wake-up. This is because the saved_datain and GPIO datain are the same. Let's fix this by ignoring any pending edge interrupts in saved_datain. This can be somewhat easily reproduced by pinging an idle system with smsc911x Ethernet interface configured IRQ_TYPE_EDGE_FALLING. At some point the smsc911x interrupts will just stop triggering. Note that in the long run we may be able to cancel entering idle by returning an error in gpio_omap_cpu_notifier(). But let's fix the bug first. Also note that because of the recent clean-up efforts this patch does not apply directly to older kernels. This does fix a long term issue though, and can be backported as needed. Cc: Aaro Koskinen Cc: Grygorii Strashko Cc: Keerthy Cc: Ladislav Michl Cc: Peter Ujfalusi Cc: Russell King Cc: Tero Kristo Signed-off-by: Tony Lindgren --- drivers/gpio/gpio-omap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1279,7 +1279,14 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) void __iomem *base = bank->base; u32 nowake; + /* + * Save datain register to trigger edge interrupts on unidle for GPIOS + * that are not wake-up capable. Ignore any enabled_non_wakeup_gpios + * that may have just triggered as we're entering idle. Otherwise unidle + * will not notice them. + */ bank->saved_datain = readl_relaxed(base + bank->regs->datain); + bank->saved_datain |= bank->enabled_non_wakeup_gpios; if (!bank->enabled_non_wakeup_gpios) goto update_gpio_context_count; -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel