From patchwork Wed Sep 16 02:48:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11778755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40E1D746 for ; Wed, 16 Sep 2020 02:56:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 0FA7120708 for ; Wed, 16 Sep 2020 02:56:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Mj7kDk+f"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mROZ1hJZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FA7120708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=NLMwRzBywIG7jvHVdFX4vXz8rhhGyzlGNYJajFJOoPE=; b=Mj7kDk+fyjua4moFJAH93fvP9 zV9ZCJEkx6RIi+3icoOQQHpwEe91h0mO/A4QkPhKhCiCmklNhpIB3TBmuhINuemVptEMGmJUMSw8L ik1YEolH2aneDkydGAo4XBaA0W2EU8P8UpQPf4+ZGtRChTO6IuV/dBYtca4lpAumskhtwo3sh6Yql ItZu6ZAnWAEMbxtTRZuQbSdYXQjHvOm2/c8bCWOeBJcu12ammzyCReqQHyPK6baRn5huX+76f3Y8R 03XlGKpaAEdHaglXOQ00KX2vvrpN4d8mtK+Kfc8LF9j5IKHK2u/GIzaE3+aktmzQlECc1VJQjGmVi 2D8FTrFnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kINc0-0004a3-H8; Wed, 16 Sep 2020 02:56:00 +0000 Received: from mail-db8eur05on2045.outbound.protection.outlook.com ([40.107.20.45] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kINbu-0004Xz-Ai for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 02:55:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KOF5iRhb/x+V+XuW5eHCp8OM8pVBVm5ssnj2heaBNWqkcNPcStUefdI7p+JiO3HeJ9wZMXOk7AGx23U5oaibMz2YK2oTH16f25rtL/hR9W4ohEQmX66YfJmTNkC9/7A1a8Rj3zvx+XzQrO1WzzubgLqYL2w8J0rkPqklssckAzyeI6daaqEmjsK+HDtvVMHrmpU1v4BLCJBwfKtBTh/svuzqRNvifh17EzsRR6us9xDvVyR8T5wMmIUF39CNb2/KTcetS+aH7fmzpa4/MvDzlvKJ9KPCL9/vd0AA2OEKi3jSHbpma+XyXzYZwfyxWXn07pJejp+/AVqnIWc6mGGYdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nKZH0/mBvr3NUzlpnWt25MgUCsw8ZS+FS22rHg2+nd8=; b=B9rci/qvji7LdhJSN3o+fyZ3P+FrpZpKqj+7nFAReVDroezivDzc26w1aqHDqILZng+6EWIT35KDh/RcUSfoF3VzarJkMTzPZpTho5vr8NgTzxdiRaCv/7nQhnMAfv7q5yYL7B3eONv5qfYi8oRCWfeEb1KpNK90kc4PKNQSueZG32QOV/oK9kQqkyihsjNCOVZLaFuoLcAhr8REfQvWN2WRPYEM2EvSzGwbxUXnQ/cSvSCq1OwEeGWlI/dDEgGUOB/m44DCtPdA7YucYi5rEjapU8nweBaHQi3EpuaDd6Zzky1cRGeeYwZ134UhjhyRljnwOoOvo1oVTSMW8ho3Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nKZH0/mBvr3NUzlpnWt25MgUCsw8ZS+FS22rHg2+nd8=; b=mROZ1hJZazZOZevZCOQvxvpXem9LFMOb7QtGsnwsGG5yoOGAF7NApDbeXGxcnstRMwBnuMyvn+gSbIjsCNfIE8jJhLgCKa1LiIiICiFwc/2pupsNtq4ruK+4DvUjOu7PT7PliXtwCAqQ2H+UrW6fop+mqyTImsFX35J4P9+Wwuc= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB8PR04MB7177.eurprd04.prod.outlook.com (2603:10a6:10:127::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.17; Wed, 16 Sep 2020 02:55:49 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::39ff:13b4:4f28:1413%10]) with mapi id 15.20.3370.019; Wed, 16 Sep 2020 02:55:49 +0000 From: peng.fan@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, abel.vesa@nxp.com, robh+dt@kernel.org Subject: [PATCH V2 3/4] ARM: imx: imx7ulp: support HSRUN mode Date: Wed, 16 Sep 2020 10:48:36 +0800 Message-Id: <1600224517-31465-4-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600224517-31465-1-git-send-email-peng.fan@nxp.com> References: <1600224517-31465-1-git-send-email-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR01CA0165.apcprd01.prod.exchangelabs.com (2603:1096:4:28::21) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 10.192.242.69 (119.31.174.67) by SG2PR01CA0165.apcprd01.prod.exchangelabs.com (2603:1096:4:28::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3391.11 via Frontend Transport; Wed, 16 Sep 2020 02:55:44 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.67] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 776c5198-6a65-434e-828b-08d859ec045a X-MS-TrafficTypeDiagnostic: DB8PR04MB7177: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: siO4AYxvQyjRXzuY1MGRem4XrkzamYXcPVFXaMAjDb4tjUoOAJnN5RAFcOtJavG9GixIK0Ly+a9k1iL4L1G/OTjIxq1QWaSaAp+CNuXXuRlXROVS79wmIGLBa6K9VbHXQC5MOFRYRQ1ovjPDA7iCkJvJE4DdeTJTn+NDN9kXw1H3i4IVA+9fTexxUpYVQ6WpOtOfgND7AheMk0AL5w6r3yC8JLYNEg/tRm/o4hCSoW6oyPqnLh2GHL+6B4nKPcPK07DxMkvXKYtW706HgbElMhT88H7zG+PydyENr46LHH7NxBr04N7F8eipBqsBzFuhy6wgCZeEEP1q7Mkyfoj6A9+uIZTzgDvC3JcS/QhKGEuJLFIwcStgyAfdzhEJBDYO X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(376002)(346002)(136003)(39860400002)(4326008)(8676002)(66946007)(36756003)(16576012)(316002)(86362001)(8936002)(9686003)(16526019)(186003)(5660300002)(6666004)(26005)(66476007)(66556008)(478600001)(52116002)(6486002)(2906002)(956004)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 9bxrCF0AKejYeGU1JiHkniVshh4ObMvKm0bKI7OZ7FINuIpK0+pY84e++C/XDwPCIi2OOUqn3jNxixvvE7ZL2TuLUupwx/HN2BrgudI1wh0WDHNyPpeuvenQrh44fKxGWylns2oT07RjgUHsXcgNVRjwRYOw/sTFdvUkwltijW1S3h4Y3DsfjDsYvjIFtBO2QsbJ+VkV9qAidh8MqSFFAdu8fcAuuNgdHBpoBVO+QkjnHDCPgHmu2WRqOp5ZIvyIv111A8EzkndlS3i9wCoFPKbxsjS5aDQnJY4BUgrCNxKOd4cHxBTQ558m2VBHzkjlrVw0cIBALqhZbkBDDSf4nNAlToTHT58CfPm4efzvqkRNvZwgTL7uCKd47fQsuQnPJCpx8u0jxSRff1ymEehAVnzUGdIYitrvddU2tGO+kiWiAvQYSCrEnMweCEfX9nzKBU5EAeOfCzS6kOMQlDZHucac5Ti0ImwpU64NTlPL62OmfnXyj7pU3BRR0Fj1mYcVO1jRdIdQpIZ1cYAZoSLknWYdipWOBH2BP+xY6TVlViVi1tIUjQLOJ1p547lUfe7OwhHK6Wfm/cqeLN/9YgBcgJK+oGrWf/ywM90tgOSajGajgimRSMzN04S2OlHWWVnwoCfqfpvE1OB6RhSlAmpG3g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 776c5198-6a65-434e-828b-08d859ec045a X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2760.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2020 02:55:49.6158 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uuLySBIkdqG2sQwQhNDarJoEBnmNGd9pmzR2RVqe8AsjDkxcKFxMsei2AdVY8T1fJFXpf68Ui+dj7XxsuGLvig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7177 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200915_225554_421182_B9103C7E X-CRM114-Status: GOOD ( 13.65 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.20.45 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.20.45 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, devicetree@vger.kernel.org, Peng Fan , Anson.Huang@nxp.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peng Fan Configure PMPROT to let ARM core could run into HSRUN mode. In LDO-enabled mode, HSRUN mode is not allowed, so add a check before configure PMPROT. Signed-off-by: Peng Fan --- arch/arm/mach-imx/pm-imx7ulp.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/pm-imx7ulp.c b/arch/arm/mach-imx/pm-imx7ulp.c index 2e756d8191fa..393faf1e8382 100644 --- a/arch/arm/mach-imx/pm-imx7ulp.c +++ b/arch/arm/mach-imx/pm-imx7ulp.c @@ -11,6 +11,10 @@ #include "common.h" +#define PMC0_CTRL 0x28 +#define BM_CTRL_LDOEN BIT(31) + +#define SMC_PMPROT 0x8 #define SMC_PMCTRL 0x10 #define BP_PMCTRL_PSTOPO 16 #define PSTOPO_PSTOP3 0x3 @@ -25,7 +29,10 @@ #define BM_PMCTRL_RUNM (3 << BP_PMCTRL_RUNM) #define BM_PMCTRL_STOPM (7 << BP_PMCTRL_STOPM) +#define BM_PMPROT_AHSRUN BIT(7) + static void __iomem *smc1_base; +static void __iomem *pmc0_base; int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode) { @@ -65,5 +72,13 @@ void __init imx7ulp_pm_init(void) of_node_put(np); WARN_ON(!smc1_base); + np = of_find_compatible_node(NULL, NULL, "fsl,imx7ulp-pmc0"); + pmc0_base = of_iomap(np, 0); + WARN_ON(!pmc0_base); + of_node_put(np); + + if (!(readl_relaxed(pmc0_base + PMC0_CTRL) & BM_CTRL_LDOEN)) + writel_relaxed(BM_PMPROT_AHSRUN, smc1_base + SMC_PMPROT); + imx7ulp_set_lpm(ULP_PM_RUN); }