imx233: fix regulator code on stmp3700
For some reason the power subsystem needs to know the relationship between the VDD{D,A,IO} and uses a weird register to do so. Change-Id: I7fcc75f6cc0460b4997914986deda7ca544a4940
This commit is contained in:
parent
4b2f59b3db
commit
9fe3687923
1 changed files with 17 additions and 0 deletions
|
@ -355,6 +355,19 @@ void imx233_power_get_regulator(enum imx233_regulator_t reg, unsigned *value_mv,
|
||||||
*brownout_mv = 0;
|
*brownout_mv = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IMX233_SUBTARGET >= 3700 && IMX233_SUBTARGET < 3780
|
||||||
|
static void update_dcfuncv(void)
|
||||||
|
{
|
||||||
|
int vddd, vdda, vddio;
|
||||||
|
imx233_power_get_regulator(REGULATOR_VDDD, &vddd, NULL);
|
||||||
|
imx233_power_get_regulator(REGULATOR_VDDA, &vdda, NULL);
|
||||||
|
imx233_power_get_regulator(REGULATOR_VDDIO, &vddio, NULL);
|
||||||
|
// assume Li-Ion, to divide by 6.25, do *100 and /625
|
||||||
|
HW_POWER_DCFUNCV = BF_OR2(POWER_DCFUNCV, VDDIO(((vddio - vdda) * 100) / 625),
|
||||||
|
VDDD(((vdda - vddd) * 100) / 625));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void imx233_power_set_regulator(enum imx233_regulator_t reg, unsigned value_mv,
|
void imx233_power_set_regulator(enum imx233_regulator_t reg, unsigned value_mv,
|
||||||
unsigned brownout_mv)
|
unsigned brownout_mv)
|
||||||
{
|
{
|
||||||
|
@ -392,6 +405,10 @@ void imx233_power_set_regulator(enum imx233_regulator_t reg, unsigned value_mv,
|
||||||
yield();
|
yield();
|
||||||
if(!BF_RD(POWER_STS, DC1_OK) || !BF_RD(POWER_STS, DC2_OK))
|
if(!BF_RD(POWER_STS, DC1_OK) || !BF_RD(POWER_STS, DC2_OK))
|
||||||
panicf("regulator %d: failed to stabilize", reg);
|
panicf("regulator %d: failed to stabilize", reg);
|
||||||
|
#endif
|
||||||
|
/* On STMP37xx, we need to update the weird HW_POWER_DCFUNCV register */
|
||||||
|
#if IMX233_SUBTARGET >= 3700 && IMX233_SUBTARGET < 3780
|
||||||
|
update_dcfuncv();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue