mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
power: axp818: Add support for FLDOs
The FLDOs on AXP818 PMIC normally provide power to CPUS and USB HSIC PHY on the A83T/H8. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
4c6a9ca103
commit
38491d9c65
5 changed files with 69 additions and 0 deletions
|
@ -486,6 +486,12 @@ void sunxi_board_init(void)
|
|||
power_failed |= axp_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
|
||||
power_failed |= axp_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AXP818_POWER
|
||||
power_failed |= axp_set_fldo(1, CONFIG_AXP_FLDO1_VOLT);
|
||||
power_failed |= axp_set_fldo(2, CONFIG_AXP_FLDO2_VOLT);
|
||||
power_failed |= axp_set_fldo(3, CONFIG_AXP_FLDO3_VOLT);
|
||||
#endif
|
||||
#endif
|
||||
printf("DRAM:");
|
||||
ramsize = sunxi_dram_init();
|
||||
|
|
|
@ -238,6 +238,33 @@ config AXP_ELDO3_VOLT
|
|||
1.2V for the SSD2828 chip (converter of parallel LCD interface
|
||||
into MIPI DSI).
|
||||
|
||||
config AXP_FLDO1_VOLT
|
||||
int "axp pmic fldo1 voltage"
|
||||
depends on AXP818_POWER
|
||||
default 0 if MACH_SUN8I_A83T
|
||||
---help---
|
||||
Set the voltage (mV) to program the axp pmic fldo1 at, set to 0 to
|
||||
disable fldo1.
|
||||
On A83T / H8 boards fldo1 is VCC-HSIC and should be 1.2V if HSIC is
|
||||
used.
|
||||
|
||||
config AXP_FLDO2_VOLT
|
||||
int "axp pmic eldo2 voltage"
|
||||
depends on AXP818_POWER
|
||||
default 900 if MACH_SUN8I_A83T
|
||||
---help---
|
||||
Set the voltage (mV) to program the axp pmic fldo2 at, set to 0 to
|
||||
disable fldo2.
|
||||
On A83T / H8 boards fldo2 is VCC-CPUS and should be 0.9V.
|
||||
|
||||
config AXP_FLDO3_VOLT
|
||||
int "axp pmic fldo3 voltage"
|
||||
depends on AXP818_POWER
|
||||
default 0
|
||||
---help---
|
||||
Set the voltage (mV) to program the axp pmic fldo3 at, set to 0 to
|
||||
disable fldo3.
|
||||
|
||||
config SY8106A_VOUT1_VOLT
|
||||
int "SY8106A pmic VOUT1 voltage"
|
||||
depends on SY8106A_POWER
|
||||
|
|
|
@ -191,6 +191,40 @@ int axp_set_eldo(int eldo_num, unsigned int mvolt)
|
|||
AXP818_OUTPUT_CTRL2_ELDO1_EN << (eldo_num - 1));
|
||||
}
|
||||
|
||||
int axp_set_fldo(int fldo_num, unsigned int mvolt)
|
||||
{
|
||||
int ret;
|
||||
u8 cfg;
|
||||
|
||||
if (fldo_num < 1 || fldo_num > 3)
|
||||
return -EINVAL;
|
||||
|
||||
if (mvolt == 0)
|
||||
return pmic_bus_clrbits(AXP818_OUTPUT_CTRL3,
|
||||
AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1));
|
||||
|
||||
if (fldo_num < 3) {
|
||||
cfg = axp818_mvolt_to_cfg(mvolt, 700, 1450, 50);
|
||||
ret = pmic_bus_write(AXP818_FLDO1_CTRL + (fldo_num - 1), cfg);
|
||||
} else {
|
||||
/*
|
||||
* Special case for FLDO3, which is DCDC5 / 2 or FLDOIN / 2
|
||||
* Since FLDOIN is unknown, test against DCDC5.
|
||||
*/
|
||||
if (mvolt * 2 == CONFIG_AXP_DCDC5_VOLT)
|
||||
ret = pmic_bus_clrbits(AXP818_FLDO2_3_CTRL,
|
||||
AXP818_FLDO2_3_CTRL_FLDO3_VOL);
|
||||
else
|
||||
ret = pmic_bus_setbits(AXP818_FLDO2_3_CTRL,
|
||||
AXP818_FLDO2_3_CTRL_FLDO3_VOL);
|
||||
}
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return pmic_bus_setbits(AXP818_OUTPUT_CTRL3,
|
||||
AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1));
|
||||
}
|
||||
|
||||
int axp_init(void)
|
||||
{
|
||||
u8 axp_chip_id;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#define AXP818_ELDO3_CTRL 0x1b
|
||||
#define AXP818_FLDO1_CTRL 0x1c
|
||||
#define AXP818_FLDO2_3_CTRL 0x1d
|
||||
#define AXP818_FLDO2_3_CTRL_FLDO3_VOL (1 << 4)
|
||||
#define AXP818_DCDC1_CTRL 0x20
|
||||
#define AXP818_DCDC2_CTRL 0x21
|
||||
#define AXP818_DCDC3_CTRL 0x22
|
||||
|
|
|
@ -31,6 +31,7 @@ int axp_set_aldo3(unsigned int mvolt);
|
|||
int axp_set_aldo4(unsigned int mvolt);
|
||||
int axp_set_dldo(int dldo_num, unsigned int mvolt);
|
||||
int axp_set_eldo(int eldo_num, unsigned int mvolt);
|
||||
int axp_set_fldo(int fldo_num, unsigned int mvolt);
|
||||
int axp_init(void);
|
||||
int axp_get_sid(unsigned int *sid);
|
||||
|
||||
|
|
Loading…
Reference in a new issue