mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
board: pinephone-pro: Increase the PMIC input current limit during boot
The limit needs to be raised as soon as possible to prevent boot loops on empty or removed battery. The default 450mA limit is crossed when eMMC or SD card starts seeing reads in SPL after DRAM was already enabled in TPL. Running this PMIC setup in main U-Boot binary is a bit too late, and 1.5A is a bit too low for a completely battery-less boot. That would need the input current limit to be raised before initializing DRAM in TPL and at least to 2A, because peak power consumption in Linux during boot is currently 8W. But this fix is good enough to prevent boot loops when the phone can still get ~100mA from the battery to cover the difference between 450 mA current limit and ~550 mA needed to load main U-Boot from eMMC while the DRAM is already initialized by TPL. Signed-off-by: Ondrej Jirman <megi@xff.cz>
This commit is contained in:
@@ -187,10 +187,16 @@ int board_late_init(void)
|
||||
return rk_board_late_init();
|
||||
}
|
||||
|
||||
void __weak pmic_setup(void)
|
||||
{
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
pmic_setup();
|
||||
|
||||
#ifdef CONFIG_DM_REGULATOR
|
||||
ret = regulators_enable_boot_on(false);
|
||||
if (ret)
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <asm/arch-rockchip/hardware.h>
|
||||
#include <asm/arch-rockchip/misc.h>
|
||||
#include <power/regulator.h>
|
||||
#include <power/rk8xx_pmic.h>
|
||||
|
||||
#define GRF_IO_VSEL_BT565_GPIO2AB 1
|
||||
#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2
|
||||
@@ -55,3 +56,34 @@ int misc_init_r(void)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void pinephone_pro_init(void)
|
||||
{
|
||||
struct udevice *pmic;
|
||||
int ret;
|
||||
|
||||
ret = uclass_first_device_err(UCLASS_PMIC, &pmic);
|
||||
if (ret) {
|
||||
printf("ERROR: PMIC not found! (%d)\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Raise input current limit to 1.5A, which is a standard CDC charger
|
||||
* allowance.
|
||||
*/
|
||||
ret = rk818_spl_configure_usb_input_current(pmic, 1500);
|
||||
if (ret)
|
||||
printf("ERROR: Input current limit setup failed!\n");
|
||||
|
||||
/*
|
||||
* Close charger when USB lower then 3.26V
|
||||
*/
|
||||
rk818_spl_configure_usb_chrg_shutdown(pmic, 3260000);
|
||||
}
|
||||
|
||||
void pmic_setup(void)
|
||||
{
|
||||
if (of_machine_is_compatible("pine64,pinephone-pro"))
|
||||
pinephone_pro_init();
|
||||
}
|
||||
|
Reference in New Issue
Block a user