[U-Boot] [RFC PATCH 1/2] i.MX28: Check if we are using a valid VBUS when initializing power
Otavio Salvador
otavio at ossystems.com.br
Mon Jul 16 22:39:41 CEST 2012
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/mx28/spl_power_init.c b/arch/arm/cpu/arm926ejs/mx28/spl_power_init.c
index 4b09b0c..c8a35af 100644
--- a/arch/arm/cpu/arm926ejs/mx28/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mx28/spl_power_init.c
@@ -564,6 +564,15 @@ void mx28_batt_boot(void)
0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
}
+static int mx28_valid_vbus(void)
+{
+ struct mx28_power_regs *power_regs =
+ (struct mx28_power_regs *)MXS_POWER_BASE;
+
+ /* iMX23 uses POWER_STS_VBUSVALID_STATUS at same offset */
+ return readl(&power_regs->hw_power_sts) & POWER_STS_VBUSVALID0_STATUS;
+}
+
void mx28_handle_5v_conflict(void)
{
struct mx28_power_regs *power_regs =
@@ -581,7 +590,7 @@ void mx28_handle_5v_conflict(void)
break;
}
- if (tmp & POWER_STS_VDD5V_GT_VDDIO) {
+ if (mx28_valid_vbus() && (tmp & POWER_STS_VDD5V_GT_VDDIO)) {
mx28_boot_valid_5v();
break;
} else {
@@ -601,17 +610,15 @@ void mx28_5v_boot(void)
struct mx28_power_regs *power_regs =
(struct mx28_power_regs *)MXS_POWER_BASE;
- /*
- * NOTE: In original IMX-Bootlets, this also checks for VBUSVALID,
- * but their implementation always returns 1 so we omit it here.
- */
- if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
+ if (mx28_valid_vbus() &&
+ (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO)) {
mx28_boot_valid_5v();
return;
}
early_delay(1000);
- if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
+ if (mx28_valid_vbus() &&
+ (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO)) {
mx28_boot_valid_5v();
return;
}
--
1.7.10.4
More information about the U-Boot
mailing list