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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 2511FC433FE for ; Wed, 22 Sep 2021 02:40:04 +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 E8A6361184 for ; Wed, 22 Sep 2021 02:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E8A6361184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FPhsCLLctz1XL56l2esZTRofGYs4977c4T7dISgkk94=; b=iAv5J9U7M3XhHi WlCSv3SGNDuvQ7KyakI5olL5pYeGtQvqV5ATZn+tFMQOjhe4gwbkBgTLg5NcQSeRkXY/DJManOJK+ HClDL2UKfnMMyAGgeOGWDsHsBd7QU66+250v/7076yRGLVdDDBaq0eMhaPRhU/E38at26fTT7g2rl /zKQTAKKJ7XKGtAPPXTnrZSETY/F5LWediaSOdsI0o3rz0OHXQMM9UEtW9AEVYj3hTXVfh0aYk+UF 5oZ3JKafS216qvqvC7RPUPhuPNmkvpXVrY+yk32l1RRA+uuLeSU/tphAP9p0DXT7zh4bpnn4aPlVU td6uKH0AMRxSvZrObHuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSs8r-006d0G-Rm; Wed, 22 Sep 2021 02:37:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSs8o-006czg-GF for linux-arm-kernel@lists.infradead.org; Wed, 22 Sep 2021 02:37:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6D1D61184; Wed, 22 Sep 2021 02:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632278266; bh=VbdVnj2YHKrJ1F4mJdb4/092wxfGkS9kFWwgMIvJcow=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WAKNTFQ7fhi0qJgddSjilERZ65w4KRSyEeBVDrEnXsnQ8ZNoHpU+heZfpKraeB1xy MaI0DW1+HLdDFjRVmOjT8F7XAJhe27r6Ef0tc+dlq8oNS1FeQpI9Lh7tmDDxc/p1m0 IpmDEZIuDGuu7zFXnrqbIB5sohHZg5ZaNb0kPvr0DgZBZO9G6pomyYh5hmHl4EL4aJ 725KCD+cCjAVz63sL1Sp5JJkQoThgLD9X3/m8AudyxAkrTVHh33F08WliP29uORn0m JVkFhMIL016YU2MngZheXkdMJxoh0sb1R5yrOfIZwqY5Ulm8JVCDI1AYb3NK6a+gsR HJZHAkUd39ktg== Date: Wed, 22 Sep 2021 10:37:40 +0800 From: Shawn Guo To: Oleksij Rempel Cc: Sascha Hauer , kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com Subject: Re: [PATCH v2] ARM: imx6: mask all interrupts before calling stby-poweroff sequence Message-ID: <20210922023740.GD10217@dragon> References: <20210817122500.31953-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210817122500.31953-1-o.rempel@pengutronix.de> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210921_193746_606026_E7DCC8CC X-CRM114-Status: GOOD ( 21.78 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 17, 2021 at 02:25:00PM +0200, Oleksij Rempel wrote: > Any pending interrupt can prevent entering standby based power off state. > To avoid it, mask all interrupts. > > Fixes: 8148d2136002 ("ARM: imx6: register pm_power_off handler if "fsl,pmic-stby-poweroff" is set") > 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); Is it possible to have a helper function in GIC driver, that we can simply call into? Shawn > } > > 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); > > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel