From: Fabio Estevam <festevam@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled
Date: Mon, 3 Feb 2020 09:01:09 -0300 [thread overview]
Message-ID: <20200203120109.11287-2-festevam@gmail.com> (raw)
In-Reply-To: <20200203120109.11287-1-festevam@gmail.com>
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
next prev parent reply other threads:[~2020-02-03 12:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-03 12:01 [PATCH v2 1/2] mx7ulp: Remove duplicated definitions Fabio Estevam
2020-02-03 12:01 ` Fabio Estevam [this message]
2020-02-03 12:07 ` [PATCH v2 2/2] mx7ulp: Only enable LDO if it is not already enabled 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
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=20200203120109.11287-2-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=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 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.