From: Jorge Ramirez-Ortiz, Gmail <jorge.ramirez.ortiz@gmail.com>
To: u-boot@lists.denx.de
Subject: question: mx7ulp - LDO_ENABLED_MODE
Date: Thu, 16 Jan 2020 23:24:21 +0100 [thread overview]
Message-ID: <20200116222421.GB20815@trex> (raw)
In-Reply-To: <CAOMZO5B_bJuSOUwSxZcNHreyvBV0QXsVvmst=wg+mbK-NZK5Pw@mail.gmail.com>
On 16/01/20 19:04:09, Fabio Estevam wrote:
> Hi Jorge,
>
> On Thu, Jan 16, 2020 at 6:51 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> > Could you please test these two patches? (They were only compiled tested)
>
> Please discard these patches. Just realized that CTRL is at a
> different offset for PMC1.
>
> Please try these instead.
um still nothing.
will debug more in the morning - will add more debug info.
thanks for the quick responses!
jorge
> From 50d4598ae23c549fe3809bfa5f365364ac36d71b Mon Sep 17 00:00:00 2001
> From: Fabio Estevam <festevam@gmail.com>
> Date: Thu, 16 Jan 2020 18:59:30 -0300
> Subject: [PATCH 1/2] mx7ulp: Fix the PMC register set
>
> On i.MX7ULP the PMC0 registers control the M4 side and
> the PMC1 controls the A7 side.
>
> In order to enable the A7 LDO-enabled mode the PMC1 registers
> need to configured instead.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> arch/arm/mach-imx/mx7ulp/soc.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
> index 8345b01398..481cfe226a 100644
> --- a/arch/arm/mach-imx/mx7ulp/soc.c
> +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> @@ -16,6 +16,7 @@
> #define PMC0_CTRL_LDOOKDIS BIT(30)
> #define PMC0_CTRL_PMC1ON BIT(24)
> #define PMC1_BASE_ADDR 0x40400000
> +#define PMC1_CTRL 0x24
> #define PMC1_RUN 0x8
> #define PMC1_STOP 0x10
> #define PMC1_VLPS 0x14
> @@ -123,7 +124,7 @@ static void init_ldo_mode(void)
> unsigned int reg;
>
> /* Set LDOOKDIS */
> - setbits_le32(PMC0_BASE_ADDR + PMC0_CTRL, PMC0_CTRL_LDOOKDIS);
> + setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_LDOOKDIS);
>
> /* Set LDOVL to 0.95V in PMC1_RUN */
> reg = readl(PMC1_BASE_ADDR + PMC1_RUN);
> @@ -149,10 +150,10 @@ static void init_ldo_mode(void)
> writel(PMC1_BASE_ADDR + PMC1_VLPS, reg);
>
> /* Set LDOEN bit */
> - setbits_le32(PMC0_BASE_ADDR + PMC0_CTRL, PMC0_CTRL_LDOEN);
> + setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_LDOEN);
>
> /* Set the PMC1ON bit */
> - setbits_le32(PMC0_BASE_ADDR + PMC0_CTRL, PMC0_CTRL_PMC1ON);
> + setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_PMC1ON);
> }
> #endif
>
> @@ -198,7 +199,7 @@ static bool ldo_mode_is_enabled(void)
> {
> unsigned int reg;
>
> - reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> + reg = readl(PMC1_BASE_ADDR + PMC1_CTRL);
> if (reg & PMC0_CTRL_LDOEN)
> return true;
> else
> --
> 2.17.1
>
> From d1a07fb70610184c042df7f593dd0ff8302235c8 Mon Sep 17 00:00:00 2001
> From: Fabio Estevam <festevam@gmail.com>
> Date: Thu, 16 Jan 2020 19:00:23 -0300
> Subject: [PATCH 2/2] mx7ulp: Fix the order for enabling LDO
>
> As per the i.MX7ULP Reference Manual:
>
> "28.5.9.1.1 Using internal LDO regulator
> After a POR event, when the PMC 0 is running in RUN mode and the PMC 1 is turned
> off, the process to turn on the PMC 1 using the internal LDO regulator
> is as follows:
> - Assert the LDOEN bit (PMC0_CTRL).
> - Assert the LDOOKDIS bit (PMC0_CTRL) if required.
> - Assert the PMC1ON bit (PMC0_CTRL)."
>
> So follow the recommended intialization order.
>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> arch/arm/mach-imx/mx7ulp/soc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
> index 481cfe226a..9b114a8604 100644
> --- a/arch/arm/mach-imx/mx7ulp/soc.c
> +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> @@ -123,9 +123,6 @@ static void init_ldo_mode(void)
> {
> unsigned int reg;
>
> - /* Set LDOOKDIS */
> - setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_LDOOKDIS);
> -
> /* Set LDOVL to 0.95V in PMC1_RUN */
> reg = readl(PMC1_BASE_ADDR + PMC1_RUN);
> reg &= ~PMC1_LDOVL_MASK;
> @@ -152,6 +149,9 @@ static void init_ldo_mode(void)
> /* Set LDOEN bit */
> setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_LDOEN);
>
> + /* Set LDOOKDIS */
> + setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_LDOOKDIS);
> +
> /* Set the PMC1ON bit */
> setbits_le32(PMC1_BASE_ADDR + PMC1_CTRL, PMC0_CTRL_PMC1ON);
> }
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-01-16 22:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 20:30 question: mx7ulp - LDO_ENABLED_MODE Jorge
2020-01-16 21:33 ` Fabio Estevam
2020-01-16 21:51 ` Fabio Estevam
2020-01-16 22:04 ` Fabio Estevam
2020-01-16 22:24 ` Jorge [this message]
2020-01-16 22:38 ` Fabio Estevam
2020-01-17 9:24 ` Jorge
2020-01-16 22:01 ` Jorge
2020-01-17 13:26 ` Fabio Estevam
2020-01-17 14:26 ` Jorge
2020-01-17 16:51 ` Jorge
2020-01-17 17:18 ` Fabio Estevam
2020-01-17 18:40 ` Jorge
2020-01-17 18:53 ` Fabio Estevam
2020-01-17 19:02 ` Jorge
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=20200116222421.GB20815@trex \
--to=u-boot@lists.denx.de \
/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