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.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 1CE6AC31E4B for ; Thu, 13 Jun 2019 15:58:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9D7D20679 for ; Thu, 13 Jun 2019 15:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560441499; bh=boL3nWCzla5lT6QeNwDsvpbHGX1QWNYlDdNfDmkwvKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ecJieBYDmzTBC2VYWy23RcCRlrYBnXn5HMyQfSWyj/9EK6JOtsEd736z+kIlpo4at NlWuaSFL2DjZ82F8FV2pwTo9BZSzemgYQ88p23EyO3UhxRWei3AuirNZ4paceuR/KG TPjFiWYf8O/kpbyeumbuJhK9cUVUa6RGg/MUJPi0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732152AbfFMP6C (ORCPT ); Thu, 13 Jun 2019 11:58:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:37928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731499AbfFMIuV (ORCPT ); Thu, 13 Jun 2019 04:50:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A22E720851; Thu, 13 Jun 2019 08:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415820; bh=boL3nWCzla5lT6QeNwDsvpbHGX1QWNYlDdNfDmkwvKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QJt7VH00bWYepXfPYL1Nv8XQOVYb3fQiC8Vs7anAQRVpix7Pzue85Ec0g1lcvpPuf WIm9zUOmTo7wmBJIhjMLPlsM/sI29i9bXT/SDMFljRPdpBqp2TJfxRaF8rfGvnFAo7 2uEXbaMRmyLtjqKn3AAcSakBz7IW/daUf4bKW+xA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , Grygorii Strashko , Keerthy , Peter Ujfalusi , Russell King , Tero Kristo , Tony Lindgren , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.1 135/155] gpio: gpio-omap: limit errata 1.101 handling to wkup domain gpios only Date: Thu, 13 Jun 2019 10:34:07 +0200 Message-Id: <20190613075700.284753913@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075652.691765927@linuxfoundation.org> References: <20190613075652.691765927@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit 21e2118f470302f16bee7ebd1444505eadbc2c20 ] We need to only apply errata 1.101 handling to clear non-wakeup edge gpios for idle to the gpio bank(s) in the wkup domain to prevent spurious wake-up events. And we must restore what we did after idle manually as the gpio bank in wkup domain is not restored otherwise. Let's keep bank->saved_datain register reading separate, that's not related to the 1.101 errata and is used separately on restore. Cc: Aaro Koskinen Cc: Grygorii Strashko Cc: Keerthy Cc: Peter Ujfalusi Cc: Russell King Cc: Tero Kristo Reported-by: Grygorii Strashko Signed-off-by: Tony Lindgren Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-omap.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index e8bfee919a7e..fafd79438bbf 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1453,7 +1453,10 @@ static void omap_gpio_restore_context(struct gpio_bank *bank); static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) { struct device *dev = bank->chip.parent; - u32 l1 = 0, l2 = 0; + void __iomem *base = bank->base; + u32 nowake; + + bank->saved_datain = readl_relaxed(base + bank->regs->datain); if (bank->funcs.idle_enable_level_quirk) bank->funcs.idle_enable_level_quirk(bank); @@ -1465,20 +1468,15 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) goto update_gpio_context_count; /* - * If going to OFF, remove triggering for all + * If going to OFF, remove triggering for all wkup domain * non-wakeup GPIOs. Otherwise spurious IRQs will be * generated. See OMAP2420 Errata item 1.101. */ - bank->saved_datain = readl_relaxed(bank->base + - bank->regs->datain); - l1 = bank->context.fallingdetect; - l2 = bank->context.risingdetect; - - l1 &= ~bank->enabled_non_wakeup_gpios; - l2 &= ~bank->enabled_non_wakeup_gpios; - - writel_relaxed(l1, bank->base + bank->regs->fallingdetect); - writel_relaxed(l2, bank->base + bank->regs->risingdetect); + if (!bank->loses_context && bank->enabled_non_wakeup_gpios) { + nowake = bank->enabled_non_wakeup_gpios; + omap_gpio_rmw(base, bank->regs->fallingdetect, nowake, ~nowake); + omap_gpio_rmw(base, bank->regs->risingdetect, nowake, ~nowake); + } bank->workaround_enabled = true; @@ -1527,6 +1525,12 @@ static void omap_gpio_unidle(struct gpio_bank *bank) return; } } + } else { + /* Restore changes done for OMAP2420 errata 1.101 */ + writel_relaxed(bank->context.fallingdetect, + bank->base + bank->regs->fallingdetect); + writel_relaxed(bank->context.risingdetect, + bank->base + bank->regs->risingdetect); } if (!bank->workaround_enabled) -- 2.20.1