From: peng.fan@nxp.com
To: shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com,
abel.vesa@nxp.com, robh+dt@kernel.org
Cc: kernel@pengutronix.de, linux-imx@nxp.com, Anson.Huang@nxp.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, aisheng.dong@nxp.com,
devicetree@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 3/4] ARM: imx: imx7ulp: support HSRUN mode
Date: Fri, 11 Sep 2020 11:30:52 +0800 [thread overview]
Message-ID: <1599795053-5091-4-git-send-email-peng.fan@nxp.com> (raw)
In-Reply-To: <1599795053-5091-1-git-send-email-peng.fan@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
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 <peng.fan@nxp.com>
---
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..543ac69f5f70 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-pmc-m4");
+ 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);
}
--
2.28.0
next prev parent reply other threads:[~2020-09-11 3:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-11 3:30 [PATCH 0/4] imx: support i.MX7ULP HSRUN mode peng.fan
2020-09-11 3:30 ` [PATCH 1/4] dt-bindings: fsl: add i.MX7ULP PMC binding doc peng.fan
2020-09-11 7:19 ` Aisheng Dong
2020-09-11 7:45 ` Peng Fan
2020-09-11 10:02 ` Aisheng Dong
2020-09-13 2:50 ` Shawn Guo
2020-09-13 2:57 ` Shawn Guo
2020-09-11 3:30 ` [PATCH 2/4] ARM: dts: imx7ulp: add pmc node peng.fan
2020-09-11 3:30 ` peng.fan [this message]
2020-09-11 3:30 ` [PATCH 4/4] ARM: imx: cpuidle-imx7ulp: Stop mode disallowed when HSRUN peng.fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1599795053-5091-4-git-send-email-peng.fan@nxp.com \
--to=peng.fan@nxp.com \
--cc=Anson.Huang@nxp.com \
--cc=abel.vesa@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).