public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mx7ulp: Remove duplicated definitions
@ 2020-02-03 12:01 Fabio Estevam
  2020-02-03 12:01 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fabio Estevam @ 2020-02-03 12:01 UTC (permalink / raw)
  To: u-boot

These PMC0 definitions are already defined in the beginning
of the file, so remove the duplication.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Newly introduced in this version.

 arch/arm/mach-imx/mx7ulp/soc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
index 46484813d2..d8d691692c 100644
--- a/arch/arm/mach-imx/mx7ulp/soc.c
+++ b/arch/arm/mach-imx/mx7ulp/soc.c
@@ -193,10 +193,6 @@ const char *get_imx_type(u32 imxtype)
 	return "7ULP";
 }
 
-#define PMC0_BASE_ADDR		0x410a1000
-#define PMC0_CTRL		0x28
-#define PMC0_CTRL_LDOEN		BIT(31)
-
 static bool ldo_mode_is_enabled(void)
 {
 	unsigned int reg;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled
  2020-02-03 12:01 [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Fabio Estevam
@ 2020-02-03 12:01 ` Fabio Estevam
  2020-02-03 12:07   ` Peng Fan
  2020-04-18 10:51   ` sbabic at denx.de
  2020-02-03 12:10 ` [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Peng Fan
  2020-04-18 10:51 ` sbabic at denx.de
  2 siblings, 2 replies; 7+ messages in thread
From: Fabio Estevam @ 2020-02-03 12:01 UTC (permalink / raw)
  To: u-boot

LDO mode may be already enabled by the ROM and enabling it again
can cause U-Boot to hang.

Avoid this problem by only enabling LDO mode if it is initially disabled.

Reported-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---
Changes since v1:
- Drop the define changes as they are duplicated (Stefano).

 arch/arm/mach-imx/mx7ulp/soc.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
index d8d691692c..0d39dab7ea 100644
--- a/arch/arm/mach-imx/mx7ulp/soc.c
+++ b/arch/arm/mach-imx/mx7ulp/soc.c
@@ -118,12 +118,26 @@ void init_wdog(void)
 	disable_wdog(WDG2_RBASE);
 }
 
+static bool ldo_mode_is_enabled(void)
+{
+	unsigned int reg;
+
+	reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
+	if (reg & PMC0_CTRL_LDOEN)
+		return true;
+	else
+		return false;
+}
+
 #if !defined(CONFIG_SPL) || (defined(CONFIG_SPL) && defined(CONFIG_SPL_BUILD))
 #if defined(CONFIG_LDO_ENABLED_MODE)
 static void init_ldo_mode(void)
 {
 	unsigned int reg;
 
+	if (ldo_mode_is_enabled())
+		return;
+
 	/* Set LDOOKDIS */
 	setbits_le32(PMC0_BASE_ADDR + PMC0_CTRL, PMC0_CTRL_LDOOKDIS);
 
@@ -193,17 +207,6 @@ const char *get_imx_type(u32 imxtype)
 	return "7ULP";
 }
 
-static bool ldo_mode_is_enabled(void)
-{
-	unsigned int reg;
-
-	reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
-	if (reg & PMC0_CTRL_LDOEN)
-		return true;
-	else
-		return false;
-}
-
 int print_cpuinfo(void)
 {
 	u32 cpurev;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled
  2020-02-03 12:01 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
@ 2020-02-03 12:07   ` Peng Fan
  2020-02-03 12:13     ` Fabio Estevam
  2020-04-18 10:51   ` sbabic at denx.de
  1 sibling, 1 reply; 7+ messages in thread
From: Peng Fan @ 2020-02-03 12:07 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled
> 
> LDO mode may be already enabled by the ROM and enabling it again can
> cause U-Boot to hang.
> 
> Avoid this problem by only enabling LDO mode if it is initially disabled.
> 
> Reported-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Tested-by: Jorge Ramirez-Ortiz <jorge@foundries.io>

Reviewed-by: Peng Fan <peng.fan@nxp.com>


Just have a question, LDO mode enabled by ROM, this is configured with fuse?

Is there any special configuration need to be done in Linux? I not touch this
part before (:

Thanks,
Peng.

> ---
> Changes since v1:
> - Drop the define changes as they are duplicated (Stefano).
> 
>  arch/arm/mach-imx/mx7ulp/soc.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mx7ulp/soc.c
> b/arch/arm/mach-imx/mx7ulp/soc.c index d8d691692c..0d39dab7ea 100644
> --- a/arch/arm/mach-imx/mx7ulp/soc.c
> +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> @@ -118,12 +118,26 @@ void init_wdog(void)
>  	disable_wdog(WDG2_RBASE);
>  }
> 
> +static bool ldo_mode_is_enabled(void)
> +{
> +	unsigned int reg;
> +
> +	reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> +	if (reg & PMC0_CTRL_LDOEN)
> +		return true;
> +	else
> +		return false;
> +}
> +
>  #if !defined(CONFIG_SPL) || (defined(CONFIG_SPL) &&
> defined(CONFIG_SPL_BUILD))  #if defined(CONFIG_LDO_ENABLED_MODE)
> static void init_ldo_mode(void)  {
>  	unsigned int reg;
> 
> +	if (ldo_mode_is_enabled())
> +		return;
> +
>  	/* Set LDOOKDIS */
>  	setbits_le32(PMC0_BASE_ADDR + PMC0_CTRL,
> PMC0_CTRL_LDOOKDIS);
> 
> @@ -193,17 +207,6 @@ const char *get_imx_type(u32 imxtype)
>  	return "7ULP";
>  }
> 
> -static bool ldo_mode_is_enabled(void)
> -{
> -	unsigned int reg;
> -
> -	reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> -	if (reg & PMC0_CTRL_LDOEN)
> -		return true;
> -	else
> -		return false;
> -}
> -
>  int print_cpuinfo(void)
>  {
>  	u32 cpurev;
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] mx7ulp: Remove duplicated definitions
  2020-02-03 12:01 [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Fabio Estevam
  2020-02-03 12:01 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
@ 2020-02-03 12:10 ` Peng Fan
  2020-04-18 10:51 ` sbabic at denx.de
  2 siblings, 0 replies; 7+ messages in thread
From: Peng Fan @ 2020-02-03 12:10 UTC (permalink / raw)
  To: u-boot

> Subject: [PATCH v2 1/2] mx7ulp: Remove duplicated definitions
> 
> These PMC0 definitions are already defined in the beginning of the file, so
> remove the duplication.
> 
> Reported-by: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> ---
> Changes since v1:
> - Newly introduced in this version.
> 
>  arch/arm/mach-imx/mx7ulp/soc.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mx7ulp/soc.c
> b/arch/arm/mach-imx/mx7ulp/soc.c index 46484813d2..d8d691692c 100644
> --- a/arch/arm/mach-imx/mx7ulp/soc.c
> +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> @@ -193,10 +193,6 @@ const char *get_imx_type(u32 imxtype)
>  	return "7ULP";
>  }
> 
> -#define PMC0_BASE_ADDR		0x410a1000
> -#define PMC0_CTRL		0x28
> -#define PMC0_CTRL_LDOEN		BIT(31)
> -
>  static bool ldo_mode_is_enabled(void)
>  {
>  	unsigned int reg;
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled
  2020-02-03 12:07   ` Peng Fan
@ 2020-02-03 12:13     ` Fabio Estevam
  0 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2020-02-03 12:13 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On Mon, Feb 3, 2020 at 9:07 AM Peng Fan <peng.fan@nxp.com> wrote:

> Just have a question, LDO mode enabled by ROM, this is configured with fuse?

I looked at the fuse map and did not see a fuse that controls it.

> Is there any special configuration need to be done in Linux? I not touch this
> part before (:

In LDO-enabled mode cpufreq needs to be disabled.

Please see:
https://github.com/fabioestevam/linux-imx/commit/8d66e5aae5b32261c9e2757c3844438c98ed0dfe

The reason is that in LDO-enabled mode only RUN mode at 500MHz is supported.

HSRUN at 720MHz is not supported in LDO-enabled mode, so ROM boots at
500MHz and kernel keeps always running at this frequency.

Regards,

Fabio Estevam


>
> Thanks,
> Peng.
>
> > ---
> > Changes since v1:
> > - Drop the define changes as they are duplicated (Stefano).
> >
> >  arch/arm/mach-imx/mx7ulp/soc.c | 25 ++++++++++++++-----------
> >  1 file changed, 14 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/arm/mach-imx/mx7ulp/soc.c
> > b/arch/arm/mach-imx/mx7ulp/soc.c index d8d691692c..0d39dab7ea 100644
> > --- a/arch/arm/mach-imx/mx7ulp/soc.c
> > +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> > @@ -118,12 +118,26 @@ void init_wdog(void)
> >       disable_wdog(WDG2_RBASE);
> >  }
> >
> > +static bool ldo_mode_is_enabled(void)
> > +{
> > +     unsigned int reg;
> > +
> > +     reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> > +     if (reg & PMC0_CTRL_LDOEN)
> > +             return true;
> > +     else
> > +             return false;
> > +}
> > +
> >  #if !defined(CONFIG_SPL) || (defined(CONFIG_SPL) &&
> > defined(CONFIG_SPL_BUILD))  #if defined(CONFIG_LDO_ENABLED_MODE)
> > static void init_ldo_mode(void)  {
> >       unsigned int reg;
> >
> > +     if (ldo_mode_is_enabled())
> > +             return;
> > +
> >       /* Set LDOOKDIS */
> >       setbits_le32(PMC0_BASE_ADDR + PMC0_CTRL,
> > PMC0_CTRL_LDOOKDIS);
> >
> > @@ -193,17 +207,6 @@ const char *get_imx_type(u32 imxtype)
> >       return "7ULP";
> >  }
> >
> > -static bool ldo_mode_is_enabled(void)
> > -{
> > -     unsigned int reg;
> > -
> > -     reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> > -     if (reg & PMC0_CTRL_LDOEN)
> > -             return true;
> > -     else
> > -             return false;
> > -}
> > -
> >  int print_cpuinfo(void)
> >  {
> >       u32 cpurev;
> > --
> > 2.17.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled
  2020-02-03 12:01 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
  2020-02-03 12:07   ` Peng Fan
@ 2020-04-18 10:51   ` sbabic at denx.de
  1 sibling, 0 replies; 7+ messages in thread
From: sbabic at denx.de @ 2020-04-18 10:51 UTC (permalink / raw)
  To: u-boot

> LDO mode may be already enabled by the ROM and enabling it again
> can cause U-Boot to hang.
> Avoid this problem by only enabling LDO mode if it is initially disabled.
> Reported-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Tested-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] mx7ulp: Remove duplicated definitions
  2020-02-03 12:01 [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Fabio Estevam
  2020-02-03 12:01 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
  2020-02-03 12:10 ` [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Peng Fan
@ 2020-04-18 10:51 ` sbabic at denx.de
  2 siblings, 0 replies; 7+ messages in thread
From: sbabic at denx.de @ 2020-04-18 10:51 UTC (permalink / raw)
  To: u-boot

> These PMC0 definitions are already defined in the beginning
> of the file, so remove the duplication.
> Reported-by: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-18 10:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-03 12:01 [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Fabio Estevam
2020-02-03 12:01 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
2020-02-03 12:07   ` Peng Fan
2020-02-03 12:13     ` Fabio Estevam
2020-04-18 10:51   ` sbabic at denx.de
2020-02-03 12:10 ` [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Peng Fan
2020-04-18 10:51 ` sbabic at denx.de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox