1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-08-31 16:22:36 +02:00

pinephone: Disable experimental low battery monitoring code

Signed-off-by: Ondrej Jirman <megi@xff.cz>
This commit is contained in:
Ondrej Jirman
2024-03-28 20:37:33 +01:00
parent 2cbc52050a
commit 5d284a149c

View File

@@ -29,21 +29,6 @@
#define PMUGRF_CON0_VOLSEL_SHIFT 8
#define PMUGRF_CON0_VOL_SHIFT 9
static void setup_iodomain(void)
{
struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
struct rk3399_pmugrf_regs *pmugrf =
syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
/* BT565 is in 1.8v domain */
rk_setreg(&grf->io_vsel,
GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
/* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VOLSEL_SHIFT | 1 << PMUGRF_CON0_VOL_SHIFT);
}
#ifdef CONFIG_MISC_INIT_R
int misc_init_r(void)
{
@@ -78,8 +63,24 @@ int ft_board_setup(void *blob, struct bd_info *bd)
}
#endif
// disable this experimental code (superseded by rk2aw boot hold to a large extent)
#ifdef CONFIG_SPL_BUILD
static void setup_iodomain(void)
{
struct rk3399_grf_regs *grf =
syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
struct rk3399_pmugrf_regs *pmugrf =
syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
/* BT565 is in 1.8v domain */
rk_setreg(&grf->io_vsel,
GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
/* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VOLSEL_SHIFT | 1 << PMUGRF_CON0_VOL_SHIFT);
}
#define VB_MON_REG 0x21
#define THERMAL_REG 0x22
#define SUP_STS_REG 0xa0
@@ -160,6 +161,9 @@ int ft_board_setup(void *blob, struct bd_info *bd)
#define INVALID_COFFSET_MIN 0x780
#define INVALID_COFFSET_MAX 0x980
#if 0
static int rk818_get_bat_vol(struct udevice *pmic)
{
int val = pmic_reg_read(pmic, BAT_VOL_REGL)
@@ -508,4 +512,37 @@ report_low_power_and_poweroff:
hang();
}
#else
void led_setup(void)
{
struct udevice *pmic = NULL;
int ret;
setup_iodomain();
ret = uclass_first_device_err(UCLASS_PMIC, &pmic);
if (ret) {
printf("ERROR: PMIC not found! (%d)\n", ret);
return;
}
/*
* Raise LDO2 voltage to 3V (needed for touch controller)
*/
pmic_reg_write(pmic, 0x3d, 0x0c);
udelay(2000);
/* enable charger, Ibatmax = 1.4A Vbatmax = 4.3V */
pmic_reg_write(pmic, CHRG_CTRL_REG1, 0xb2);
/* term = 150mA trickle timeout = 60min cc-cv timeout = 6h */
pmic_reg_write(pmic, CHRG_CTRL_REG2, 0x4a);
/* enable timers, safe defaults */
pmic_reg_write(pmic, CHRG_CTRL_REG3, 0x0e);
/* USB input limits: 850 mA / 3.26V - Just don't put this into a legacy. */
pmic_reg_write(pmic, USB_CTRL_REG, 0xf2);
}
#endif
#endif