summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/mx7ulp/soc.c
diff options
context:
space:
mode:
authorFabio Estevam <festevam@gmail.com>2020-02-03 09:01:09 -0300
committerStefano Babic <sbabic@denx.de>2020-04-17 18:54:14 +0200
commitcbc81b735ea751def692bf40710c0116be3ee863 (patch)
tree0b684b951f59990a83d5d04ce94e0c0a1ba6dfe4 /arch/arm/mach-imx/mx7ulp/soc.c
parent2cfdb3bca7c452942fe6513b3ea12a45d5c58564 (diff)
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>
Diffstat (limited to 'arch/arm/mach-imx/mx7ulp/soc.c')
-rw-r--r--arch/arm/mach-imx/mx7ulp/soc.c25
1 files 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;