* [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input
@ 2015-05-13 6:02 Stefan Wahren
2015-05-13 7:13 ` Marek Vasut
2015-05-15 11:14 ` Stefano Babic
0 siblings, 2 replies; 5+ messages in thread
From: Stefan Wahren @ 2015-05-13 6:02 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input
2015-05-13 6:02 [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input Stefan Wahren
@ 2015-05-13 7:13 ` Marek Vasut
2015-05-13 8:14 ` Stefan Wahren
2015-05-15 11:14 ` Stefano Babic
1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2015-05-13 7:13 UTC (permalink / raw)
To: u-boot
On Wednesday, May 13, 2015 at 08:02:21 AM, Stefan Wahren wrote:
> Hi,
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.
What exactly would happen if you enable DCDC converter while BO detection
is already enabled ? It is possible, that enabling the DCDC would cause a
dip on the power rail and cause in turn a BO, no ? IIRC, that is the reason
why BO detection is disabled when enabling DCDC.
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input
2015-05-13 7:13 ` Marek Vasut
@ 2015-05-13 8:14 ` Stefan Wahren
2015-05-13 20:03 ` Marek Vasut
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Wahren @ 2015-05-13 8:14 UTC (permalink / raw)
To: u-boot
Hi Marek,
Am 13.05.2015 um 09:13 schrieb Marek Vasut:
> On Wednesday, May 13, 2015 at 08:02:21 AM, Stefan Wahren wrote:
>> Hi,
> 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.
> What exactly would happen if you enable DCDC converter while BO detection
> is already enabled ? It is possible, that enabling the DCDC would cause a
> dip on the power rail and cause in turn a BO, no ? IIRC, that is the reason
> why BO detection is disabled when enabling DCDC.
i think we're talking about different things. The patch won't touch this
necessary behaviour.
No, i think it's faulty to leave the function with BO detection disabled
in the case the DC-DC is already enabled:
if (xfer && (readl(&power_regs->hw_power_5vctrl) &
POWER_5VCTRL_ENABLE_DCDC)) {
return;
}
>
> Best regards,
> Marek Vasut
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input
2015-05-13 8:14 ` Stefan Wahren
@ 2015-05-13 20:03 ` Marek Vasut
0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2015-05-13 20:03 UTC (permalink / raw)
To: u-boot
On Wednesday, May 13, 2015 at 10:14:19 AM, Stefan Wahren wrote:
> Hi Marek,
>
> Am 13.05.2015 um 09:13 schrieb Marek Vasut:
> > On Wednesday, May 13, 2015 at 08:02:21 AM, Stefan Wahren wrote:
> >> Hi,
> >
> > 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.
> >
> > What exactly would happen if you enable DCDC converter while BO detection
> > is already enabled ? It is possible, that enabling the DCDC would cause a
> > dip on the power rail and cause in turn a BO, no ? IIRC, that is the
> > reason why BO detection is disabled when enabling DCDC.
>
> i think we're talking about different things. The patch won't touch this
> necessary behaviour.
>
> No, i think it's faulty to leave the function with BO detection disabled
> in the case the DC-DC is already enabled:
>
> if (xfer && (readl(&power_regs->hw_power_5vctrl) &
> POWER_5VCTRL_ENABLE_DCDC)) {
> return;
> }
Uh uh, I'm an idiot and I was probably half asleep when I blurted this last
mail, sorry.
Obviously, enabling the BO properly makes sense.
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input
2015-05-13 6:02 [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input Stefan Wahren
2015-05-13 7:13 ` Marek Vasut
@ 2015-05-15 11:14 ` Stefano Babic
1 sibling, 0 replies; 5+ messages in thread
From: Stefano Babic @ 2015-05-15 11:14 UTC (permalink / raw)
To: u-boot
Hi Stefan,
On 13/05/2015 08:02, Stefan Wahren wrote:
> 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.
>
It looks like we agree on your changes. Can you send then a proper patch
with your Signed-off-by ?
Thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-15 11:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13 6:02 [U-Boot] mxs: Possible in bug in mxs_enable_4p2_dcdc_input Stefan Wahren
2015-05-13 7:13 ` Marek Vasut
2015-05-13 8:14 ` Stefan Wahren
2015-05-13 20:03 ` Marek Vasut
2015-05-15 11:14 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox