[U-Boot] mxs: fixed battery boot on imx233-olinuxino-micro
diff mbox

Message ID 1400637715-24117-1-git-send-email-peter.schumann@jeepxj.de
State Superseded
Delegated to: Stefano Babic
Headers show

Commit Message

Peter Schumann May 21, 2014, 2:01 a.m. UTC
This patch makes it possible to boot from battery on olinuxino Boards
from Olimex.

We should not set DOUBLE_FETS in HW_POWER_MINPWR, it makes my system
reset with in seconds while running on battery power.

Also  mxs_power_enable_4p2() should not be called if running from
battery. It switches VDDD and VDDA to LinReg mode and than turns off
the VDDIO DCDC supply. At this point the system resets.
If we run on battery this is no good idea because the LinRegs are
chained behind VDDIO and battery voltage seems not enough to power
the system from LinRegs.
Also is the power system already running on DCDC after BootROM hands
over to u-boot, so no sense in switching back to LinRegs.
---
 arch/arm/cpu/arm926ejs/mxs/spl_power_init.c |    6 ------
 1 file changed, 6 deletions(-)

Comments

Marek Vasut May 24, 2014, 10:44 a.m. UTC | #1
On Wednesday, May 21, 2014 at 04:01:55 AM, Peter Schumann wrote:
> This patch makes it possible to boot from battery on olinuxino Boards
> from Olimex.
> 
> We should not set DOUBLE_FETS in HW_POWER_MINPWR

Please explain how you arrived to this conclusion.

> , it makes my system
> reset with in seconds while running on battery power.
>
> Also  mxs_power_enable_4p2() should not be called if running from
> battery. It switches VDDD and VDDA to LinReg mode and than turns off
> the VDDIO DCDC supply. At this point the system resets.

This has been tested on i.MX28 , can you please check what the differences are 
between these two chips and why it works only on one of them ?

> If we run on battery this is no good idea because the LinRegs are
> chained behind VDDIO and battery voltage seems not enough to power
> the system from LinRegs.
> Also is the power system already running on DCDC after BootROM hands
> over to u-boot, so no sense in switching back to LinRegs.

The BootROM never hands over to U-Boot, so this really makes no sense. Can you 
please explain ? The BootROM handles over to U-Boot SPL, which configures the 
power block.

Also, I find it a very bad idea to depend on the BootROM to actually start the 
DCDC converter. I don't think we can universally say the DCDC converter is 
running when entering U-Boot SPL. I also don't think we can even depend on the 
power block configuration when exiting the BootROM -- for example in JTAG Boot 
Mode, the BootROM halts early in the boot process and will likely not configure 
anything with regards to the power block.

[...]

THanks!

Best regards,
Marek Vasut
Peter Schumann May 25, 2014, 8:02 p.m. UTC | #2
Am 24.05.2014 12:44, schrieb Marek Vasut:

> 
> Please explain how you arrived to this conclusion.
> 
Hello Marek,

I started writing an powerblock driver for the i.MX233 to use the imx233
olimex board with a battery.
Short time (instant up to 90 seconds) after the 5v to battery handoff
the system reseted.
The system was running on DCDC prior to the handoff. I suspected that
some of the power rails where droping and trigger
hardware brownouts. But this was not the case. The DCDC got shutdown and
some ms after that the rails begun to drop.
I have some scope pic of this happening i it is of interest.

I than tried out some random bits in the MINPWR register and the reset
problem was gone. Than I track down it to this 1 bit causing the
instability.
> 
> This has been tested on i.MX28 , can you please check what the differences are 
> between these two chips and why it works only on one of them ?
> 

From the block diagram in the AN4199 pdf i am quite sure that it wont
work this way on the i.MX28 either. The VDDIO Linreg is sourced from the
5V rail. So if we run from battery only we can not deactivate VDDIO from
DCDC by setting DISABLE_FET.

> The BootROM never hands over to U-Boot, so this really makes no sense. Can you 
> please explain ? The BootROM handles over to U-Boot SPL, which configures the 
> power block.
> 
Sorry I meant the U-Boot SPL.I not that familiar with U-Boot architecture.
> Also, I find it a very bad idea to depend on the BootROM to actually start the 
> DCDC converter. I don't think we can universally say the DCDC converter is 
> running when entering U-Boot SPL. I also don't think we can even depend on the 
> power block configuration when exiting the BootROM -- for example in JTAG Boot 
> Mode, the BootROM halts early in the boot process and will likely not configure 
> anything with regards to the power block.

I am with you at the point that proper initialization is very important
and we should not rely on BootROM.

If the system is running on battery only, we should not switch the VDDIO
regulator to Linreg mode because there are no 5V to source it. In
mxs_power_enable_4p2() all Regulators get switched to Linreg mode and
that kills the power to hole system and there by is triggering an
brownout reset.

The mxs_power_enable_4p2() function can only work if we assume
there is 5V present.

I hope I got clearer way this will not work in a battery only scenario.

Best regards,
Peter Schumann
Marek Vasut June 5, 2014, 10:18 p.m. UTC | #3
On Wednesday, May 21, 2014 at 04:01:55 AM, Peter Schumann wrote:
> This patch makes it possible to boot from battery on olinuxino Boards
> from Olimex.
> 
> We should not set DOUBLE_FETS in HW_POWER_MINPWR, it makes my system
> reset with in seconds while running on battery power.
> 
> Also  mxs_power_enable_4p2() should not be called if running from
> battery. It switches VDDD and VDDA to LinReg mode and than turns off
> the VDDIO DCDC supply. At this point the system resets.
> If we run on battery this is no good idea because the LinRegs are
> chained behind VDDIO and battery voltage seems not enough to power
> the system from LinRegs.
> Also is the power system already running on DCDC after BootROM hands
> over to u-boot, so no sense in switching back to LinRegs.

Sorry for the late reply, I'm somewhat congested recently. In the meantime, I 
was not able to test this yet. But you're missing Signed-off-by: line, can you 
please re-send this with a proper SoB line [1] ?

[1] http://www.denx.de/wiki/U-Boot/Patches#General_Patch_Submission_Rules

Thanks

Best regards,
Marek Vasut
Marek Vasut June 13, 2014, 1:04 a.m. UTC | #4
On Friday, June 06, 2014 at 12:18:09 AM, Marek Vasut wrote:
> On Wednesday, May 21, 2014 at 04:01:55 AM, Peter Schumann wrote:
> > This patch makes it possible to boot from battery on olinuxino Boards
> > from Olimex.
> > 
> > We should not set DOUBLE_FETS in HW_POWER_MINPWR, it makes my system
> > reset with in seconds while running on battery power.
> > 
> > Also  mxs_power_enable_4p2() should not be called if running from
> > battery. It switches VDDD and VDDA to LinReg mode and than turns off
> > the VDDIO DCDC supply. At this point the system resets.
> > If we run on battery this is no good idea because the LinRegs are
> > chained behind VDDIO and battery voltage seems not enough to power
> > the system from LinRegs.
> > Also is the power system already running on DCDC after BootROM hands
> > over to u-boot, so no sense in switching back to LinRegs.
> 
> Sorry for the late reply, I'm somewhat congested recently. In the meantime,
> I was not able to test this yet. But you're missing Signed-off-by: line,
> can you please re-send this with a proper SoB line [1] ?
> 
> [1] http://www.denx.de/wiki/U-Boot/Patches#General_Patch_Submission_Rules

Bump?

Best regards,
Marek Vasut
Peter Schumann June 13, 2014, 7:36 a.m. UTC | #5
> 
> Bump?
> 
> Best regards,
> Marek Vasut
> 
Hi Marek,

I am occupied with work at the moment. I will get it done at the weekend.

Best regards,
Peter Schumann
Marek Vasut June 13, 2014, 10:33 a.m. UTC | #6
On Friday, June 13, 2014 at 09:36:51 AM, Peter Schumann wrote:
> > Bump?
> > 
> > Best regards,
> > Marek Vasut
> 
> Hi Marek,
> 
> I am occupied with work at the moment. I will get it done at the weekend.

Thanks!

Best regards,
Marek Vasut

Patch
diff mbox

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index d25019a..0cbb6c4 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -237,9 +237,6 @@  static void mxs_src_power_init(void)
 			POWER_LOOPCTRL_RCSCALE_THRESH |
 			POWER_LOOPCTRL_EN_RCSCALE_8X);
 
-	clrsetbits_le32(&power_regs->hw_power_minpwr,
-			POWER_MINPWR_HALFFETS, POWER_MINPWR_DOUBLE_FETS);
-
 	/* 5V to battery handoff ... FIXME */
 	setbits_le32(&power_regs->hw_power_5vctrl, POWER_5VCTRL_DCDC_XFER);
 	early_delay(30);
@@ -631,8 +628,6 @@  static void mxs_batt_boot(void)
 
 	writel(POWER_CTRL_ENIRQ_DCDC4P2_BO, &power_regs->hw_power_ctrl_clr);
 
-	clrsetbits_le32(&power_regs->hw_power_minpwr,
-			POWER_MINPWR_HALFFETS, POWER_MINPWR_DOUBLE_FETS);
 
 	mxs_power_set_linreg();
 
@@ -655,7 +650,6 @@  static void mxs_batt_boot(void)
 		POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
 		0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
 
-	mxs_power_enable_4p2();
 }
 
 /**