* [PATCH] mx7ulp: Only enable LDO if it is not already enabled
@ 2020-01-17 19:07 Fabio Estevam
2020-01-20 16:20 ` Fabio Estevam
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Fabio Estevam @ 2020-01-17 19:07 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>
---
arch/arm/mach-imx/mx7ulp/soc.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
index 8345b01398..4d84193dec 100644
--- a/arch/arm/mach-imx/mx7ulp/soc.c
+++ b/arch/arm/mach-imx/mx7ulp/soc.c
@@ -117,11 +117,28 @@ void init_wdog(void)
disable_wdog(WDG2_RBASE);
}
+#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;
+
+ reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
+ if (reg & PMC0_CTRL_LDOEN)
+ return true;
+ else
+ return false;
+}
#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);
@@ -190,21 +207,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;
-
- 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] mx7ulp: Only enable LDO if it is not already enabled
2020-01-17 19:07 [PATCH] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
@ 2020-01-20 16:20 ` Fabio Estevam
2020-01-20 17:38 ` Jorge
2020-01-20 18:13 ` Jorge
2020-02-03 11:33 ` Stefano Babic
2 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2020-01-20 16:20 UTC (permalink / raw)
To: u-boot
Hi Jorge,
On Fri, Jan 17, 2020 at 4:07 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> 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>
Please test this patch when you have a chance and if it works for you
please provide your Tested-by tag.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mx7ulp: Only enable LDO if it is not already enabled
2020-01-20 16:20 ` Fabio Estevam
@ 2020-01-20 17:38 ` Jorge
2020-01-20 17:39 ` Fabio Estevam
0 siblings, 1 reply; 7+ messages in thread
From: Jorge @ 2020-01-20 17:38 UTC (permalink / raw)
To: u-boot
On 20/01/20 13:20:11, Fabio Estevam wrote:
> Hi Jorge,
>
> On Fri, Jan 17, 2020 at 4:07 PM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > 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>
>
> Please test this patch when you have a chance and if it works for you
> please provide your Tested-by tag.
hi Favio
yes I did test it the other day. Do you need me to re-submit your
patch or you can add my Tested-by: just as per the reported by?
>
> Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mx7ulp: Only enable LDO if it is not already enabled
2020-01-20 17:38 ` Jorge
@ 2020-01-20 17:39 ` Fabio Estevam
0 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2020-01-20 17:39 UTC (permalink / raw)
To: u-boot
Hi Jorge,
On Mon, Jan 20, 2020 at 2:38 PM Jorge Ramirez-Ortiz, Foundries
<jorge@foundries.io> wrote:
> hi Favio
>
> yes I did test it the other day. Do you need me to re-submit your
> patch or you can add my Tested-by: just as per the reported by?
Just reply to this email with your Tested-by and patchwork will pick it.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mx7ulp: Only enable LDO if it is not already enabled
2020-01-17 19:07 [PATCH] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
2020-01-20 16:20 ` Fabio Estevam
@ 2020-01-20 18:13 ` Jorge
2020-02-03 11:33 ` Stefano Babic
2 siblings, 0 replies; 7+ messages in thread
From: Jorge @ 2020-01-20 18:13 UTC (permalink / raw)
To: u-boot
On 17/01/20 16:07:14, Fabio Estevam wrote:
> 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>
Tested-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> arch/arm/mach-imx/mx7ulp/soc.c | 32 +++++++++++++++++---------------
> 1 file changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
> index 8345b01398..4d84193dec 100644
> --- a/arch/arm/mach-imx/mx7ulp/soc.c
> +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> @@ -117,11 +117,28 @@ void init_wdog(void)
> disable_wdog(WDG2_RBASE);
> }
>
> +#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;
> +
> + reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> + if (reg & PMC0_CTRL_LDOEN)
> + return true;
> + else
> + return false;
> +}
> #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);
>
> @@ -190,21 +207,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;
> -
> - 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] mx7ulp: Only enable LDO if it is not already enabled
2020-01-17 19:07 [PATCH] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
2020-01-20 16:20 ` Fabio Estevam
2020-01-20 18:13 ` Jorge
@ 2020-02-03 11:33 ` Stefano Babic
2020-02-03 12:02 ` Fabio Estevam
2 siblings, 1 reply; 7+ messages in thread
From: Stefano Babic @ 2020-02-03 11:33 UTC (permalink / raw)
To: u-boot
Hi Fabio,
On 17/01/20 20:07, Fabio Estevam wrote:
> 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>
> ---
> arch/arm/mach-imx/mx7ulp/soc.c | 32 +++++++++++++++++---------------
> 1 file changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
> index 8345b01398..4d84193dec 100644
> --- a/arch/arm/mach-imx/mx7ulp/soc.c
> +++ b/arch/arm/mach-imx/mx7ulp/soc.c
> @@ -117,11 +117,28 @@ void init_wdog(void)
> disable_wdog(WDG2_RBASE);
> }
>
> +#define PMC0_BASE_ADDR 0x410a1000
> +#define PMC0_CTRL 0x28
> +#define PMC0_CTRL_LDOEN BIT(31)
> +
But are they not already defined at the beginning of the file ? They
were duplicated later, and you let them duplicated.
Best regards,
Stefano
> +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_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);
>
> @@ -190,21 +207,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;
> -
> - reg = readl(PMC0_BASE_ADDR + PMC0_CTRL);
> - if (reg & PMC0_CTRL_LDOEN)
> - return true;
> - else
> - return false;
> -}
> -
> int print_cpuinfo(void)
> {
> u32 cpurev;
>
--
=====================================================================
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] mx7ulp: Only enable LDO if it is not already enabled
2020-02-03 11:33 ` Stefano Babic
@ 2020-02-03 12:02 ` Fabio Estevam
0 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2020-02-03 12:02 UTC (permalink / raw)
To: u-boot
Hi Stefano,
On Mon, Feb 3, 2020 at 8:34 AM Stefano Babic <sbabic@denx.de> wrote:
> But are they not already defined at the beginning of the file ? They
> were duplicated later, and you let them duplicated.
Good catch. I have just sent a v2 series fixing this.
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-02-03 12:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 19:07 [PATCH] mx7ulp: Only enable LDO if it is not already enabled Fabio Estevam
2020-01-20 16:20 ` Fabio Estevam
2020-01-20 17:38 ` Jorge
2020-01-20 17:39 ` Fabio Estevam
2020-01-20 18:13 ` Jorge
2020-02-03 11:33 ` Stefano Babic
2020-02-03 12:02 ` Fabio Estevam
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.