From patchwork Tue Aug 17 12:08:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 12441391 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 13F89C432BE for ; Tue, 17 Aug 2021 12:11:08 +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 CFA0460184 for ; Tue, 17 Aug 2021 12:11:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CFA0460184 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :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=hSgsLfGHpouyjilQrcXN5I+ymCzJ11zK4zU4P3NkiZM=; b=SfADg66Yi6UptG gp+l3RnKgZabN4oP2Oo9fvoUb1FX06eJA5vmJUs3HC3E4OUJ2SxdudaYq8NOFtrXK3x1ltM1S1Fo6 PoFewJA+vcSJAq8AOsEj57mxnl4wKgWlbC4Yrab1/7zGNzN/zm2dbaDf3q4DvtjkRy4RPTZnE7iMh CabSv0SFdkdz2eYSTv0h2RV6u0ZvPsW6zfshgZe+KOciZl5RdMysEV8FQi++YaZQK1YekDkhExlWW lRy4J6EBRHe5PwvsPwetqchwW0Bxe6MlmlF/9yfeuVy1vdqB205gFIwibeBoHDn2S1Nh1mvT7Coij 61HZ6J/198HDIlm9Fdlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFxtc-002NXS-VQ; Tue, 17 Aug 2021 12:08:45 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mFxtV-002NVH-Dn for linux-arm-kernel@lists.infradead.org; Tue, 17 Aug 2021 12:08:41 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mFxtR-0008Cj-N9; Tue, 17 Aug 2021 14:08:33 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mFxtR-0001Va-1p; Tue, 17 Aug 2021 14:08:33 +0200 From: Oleksij Rempel To: Shawn Guo , Sascha Hauer Cc: Oleksij Rempel , kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com Subject: [PATCH v1] ARM: imx6: mask all interrupts before calling stby-poweroff sequence Date: Tue, 17 Aug 2021 14:08:32 +0200 Message-Id: <20210817120832.5746-1-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210817_050837_531276_D50D38BA X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Any pending interrupt can prevent entering standby based power off state. To avoid it, mask all interrupts. Signed-off-by: Oleksij Rempel --- arch/arm/mach-imx/pm-imx6.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 9244437cb1b9..63887ade411a 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -59,8 +59,11 @@ #define MX6Q_SUSPEND_OCRAM_SIZE 0x1000 #define MX6_MAX_MMDC_IO_NUM 33 +#define GIC_DIST_ENABLE_CLEAR 0x180 + static void __iomem *ccm_base; static void __iomem *suspend_ocram_base; +static void __iomem *gic_raw_dist_base; static void (*imx6_suspend_in_ocram_fn)(void __iomem *ocram_vbase); /* @@ -592,6 +595,7 @@ static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata) static void __init imx6_pm_common_init(const struct imx6_pm_socdata *socdata) { + struct device_node *np; struct regmap *gpr; int ret; @@ -615,10 +619,29 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata if (!IS_ERR(gpr)) regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT, IMX6Q_GPR1_GINT); + + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic"); + gic_raw_dist_base = of_iomap(np, 0); +} + +static void imx_gic_mask_all(void) +{ + int i; + + if (WARN_ON(!gic_raw_dist_base)) + return; + + for (i = 0; i < 4; i++) + writel_relaxed(~0, gic_raw_dist_base + GIC_DIST_ENABLE_CLEAR + 4 * i); } static void imx6_pm_stby_poweroff(void) { + /* + * A pending interrupt can prevent power off signal to be activated. + * So, mask all interrupts to avoid it. + */ + imx_gic_mask_all(); imx6_set_lpm(STOP_POWER_OFF); imx6q_suspend_finish(0);