From patchwork Tue Jun 20 14:09:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 9799645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EC08C60328 for ; Tue, 20 Jun 2017 14:18:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6FBF2623C for ; Tue, 20 Jun 2017 14:18:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB7E928445; Tue, 20 Jun 2017 14:18:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 76CAB2623C for ; Tue, 20 Jun 2017 14:18:24 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=9lYmehsjnZe4oaPprTxdG0wrWLPlibp+n2a8MoQp+TA=; b=u+tml0lNur9UNGpyJ3u/En7aD9 4qycB3kRb2wnsW2+wBsgO7l9K5x0WZtlVWyJt7F10F+PEH4TYDUbCCsehmS3ir/EHJGJ9n0QOsc7C 7VxKn/dVXexdxuj35hjsSzWWEs/egYGuxq5UhHkUKNy/QDax2NZzj5WMupBZm42smaR8EZqloElav 7psZhQAzQI9l9bRbEFxl4pk7K4GDW0xkNArFp/AcnoI+PwPQTjUBDfuU2KL2OzbbqbX2/xldO6k1T Ez1gfogLDTIw1J3E5s+mNSOlplwtqeHEwW2IoSIeUIiPfPb9xjBvbuWaDWrC6JD4FJ8TjcGE6Jvjr 0PILZviA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dNJz4-0002ZI-IE; Tue, 20 Jun 2017 14:18:22 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNJy6-0001KD-Rk for linux-arm-kernel@bombadil.infradead.org; Tue, 20 Jun 2017 14:17:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1LZsHcPMI19WD6ku8QdNBaX7jQAFmVRgUa3OxsiVp3M=; b=VlFDX0aYiVaZAKhbKXh10nKYG J765V8k5UBKsIh339QFuRfuyaJpibzmuCQ6Y++Pv1pbIcLJXMYa0yYBKTt5T6yJ9+ZxUrzho86kpG gNn/aWdlSFpWntd2otbwUI2vo8JC4oF83+o8+xlQhaxn4AgBM0HolQ05S6o5pWHDilJLgmIh2mkkk FTbdPdpQIAr22zxiWgREqrLzDfLbTFufvG2M88V8+Ig1fngCQcB/LzCLiMFtPG3zDih/UkErFQi7C gVUQDKZytTil0cUs2U/S/AWiB2JFmA+xgv9WXpUc0KF6myHzv36G6VRBbbFmKf1lCa+dKgLiWZWb0 kbpAz+W/g==; Received: from metis.ext.4.pengutronix.de ([92.198.50.35]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNJqc-0001TY-2q for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2017 14:09:40 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dNJqE-00066R-AD; Tue, 20 Jun 2017 16:09:14 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1dNJqC-00020z-Cc; Tue, 20 Jun 2017 16:09:12 +0200 From: Oleksij Rempel To: Andrew Morton , devicetree@vger.kernel.org, Fabio Estevam , kernel@pengutronix.de, Liam Girdwood , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown , Mark Rutland , Michael Turquette , Rob Herring , Russell King , Shawn Guo , Stephen Boyd , Leonard Crestez Subject: [PATCH v6 2/6] ARM: imx6: register pm_power_off handler if "fsl, pmic-stby-poweroff" is set Date: Tue, 20 Jun 2017 16:09:06 +0200 Message-Id: <20170620140910.7568-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170620140910.7568-1-o.rempel@pengutronix.de> References: <20170620140910.7568-1-o.rempel@pengutronix.de> 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-20170620_150938_602341_E5A9AF0C X-CRM114-Status: GOOD ( 13.27 ) 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: Oleksij Rempel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP One of the Freescale recommended sequences for power off with external PMIC is the following: ... 3. SoC is programming PMIC for power off when standby is asserted. 4. In CCM STOP mode, Standby is asserted, PMIC gates SoC supplies. See: http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf page 5083 This patch implements step 4. of this sequence. Signed-off-by: Oleksij Rempel --- arch/arm/mach-imx/pm-imx6.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index e61b1d1027e1..0f141caa71f6 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -602,6 +602,28 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata IMX6Q_GPR1_GINT); } +static void imx6_pm_stby_poweroff(void) +{ + imx6_set_lpm(STOP_POWER_OFF); + cpu_suspend(0, imx6q_suspend_finish); + + mdelay(1000); + + pr_emerg("Unable to poweroff system\n"); +} + +static int imx6_pm_stby_poweroff_probe(void) +{ + if (pm_power_off) { + pr_warn("%s: pm_power_off already claimed %p %pf!\n", + __func__, pm_power_off, pm_power_off); + return -EBUSY; + } + + pm_power_off = imx6_pm_stby_poweroff; + return 0; +} + void __init imx6_pm_ccm_init(const char *ccm_compat) { struct device_node *np; @@ -618,6 +640,9 @@ void __init imx6_pm_ccm_init(const char *ccm_compat) val = readl_relaxed(ccm_base + CLPCR); val &= ~BM_CLPCR_LPM; writel_relaxed(val, ccm_base + CLPCR); + + if (of_property_read_bool(np, "fsl,pmic-stby-poweroff")) + imx6_pm_stby_poweroff_probe(); } void __init imx6q_pm_init(void)