[U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input

Stefan Wahren stefan.wahren at i2se.com
Wed May 13 08:02:21 CEST 2015


Hi,

during the study of DC-DC handling in u-boot i noticed a possible bug.

In case the DC-DC is already enabled the function returns without reenabling
brown out detection. I don't think that's okay.
A possible fix would be to do the check if DC-DC is already enabled before
disabling brown out detection. This idea is
attached as a draft. If it's acceptable i will send a proper patch.

Best regards
Stefan

-------------------%<-------------------------------------------------------------------------
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index c342217..42f3df2 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -332,6 +332,11 @@ static void mxs_enable_4p2_dcdc_input(int xfer)
 
 	debug("SPL: %s 4P2 DC-DC Input\n", xfer ? "Enabling" : "Disabling");
 
+	if (xfer && (readl(&power_regs->hw_power_5vctrl) &
+			POWER_5VCTRL_ENABLE_DCDC)) {
+		return;
+	}
+
 	prev_5v_brnout = readl(&power_regs->hw_power_5vctrl) &
 				POWER_5VCTRL_PWDN_5VBRNOUT;
 	prev_5v_droop = readl(&power_regs->hw_power_ctrl) &
@@ -343,11 +348,6 @@ static void mxs_enable_4p2_dcdc_input(int xfer)
 
 	clrbits_le32(&power_regs->hw_power_ctrl, POWER_CTRL_ENIRQ_VDD5V_DROOP);
 
-	if (xfer && (readl(&power_regs->hw_power_5vctrl) &
-			POWER_5VCTRL_ENABLE_DCDC)) {
-		return;
-	}
-
 	/*
 	 * Recording orignal values that will be modified temporarlily
 	 * to handle a chip bug. See chip errata for CQ ENGR00115837


More information about the U-Boot mailing list