[U-Boot,1/7] mx7ulp: Print the LDO mode status
diff mbox series

Message ID 20191021135034.18677-1-festevam@gmail.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series
  • [U-Boot,1/7] mx7ulp: Print the LDO mode status
Related show

Commit Message

Fabio Estevam Oct. 21, 2019, 1:50 p.m. UTC
As per the i.MX7ULP datasheet, it can boot in LDO enabled mode
or LDO bypass mode.

Print the LDO mode status in the U-Boot log for convenience.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 arch/arm/mach-imx/mx7ulp/soc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch
diff mbox series

diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
index 127fcfeea1..b9a108a514 100644
--- a/arch/arm/mach-imx/mx7ulp/soc.c
+++ b/arch/arm/mach-imx/mx7ulp/soc.c
@@ -131,6 +131,21 @@  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;
@@ -159,6 +174,11 @@  int print_cpuinfo(void)
 		break;
 	}
 
+	if (ldo_mode_is_enabled())
+		printf("PMC1:  LDO enabled mode\n");
+	else
+		printf("PMC1:  LDO bypass mode\n");
+
 	return 0;
 }
 #endif