hw21/26: optimize extension module powerup

Enable extension module power in first state loader.
Reasoning: Unpowered module can block I2C bus.
This commit is contained in:
Rene Straub 2024-02-20 15:29:56 +01:00
parent 250b26288e
commit 3a82e018ea
1 changed files with 27 additions and 11 deletions

View File

@ -794,6 +794,29 @@ static void init_bd_spl(void)
}
}
static void power_um(void)
{
int bus;
da9063_init(CONFIG_PMIC_I2C_BUS);
bus = da9063_claim_i2c_bus();
REQUEST_AND_CLEAR_GPIO(GPIO_RST_UM_N); /* Assert reset (active low) */
REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N);
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 0); /* Switch Supply off */
mdelay(30); /* Give time to discharge output */
da9063_set_gpio(PMIC_UM_SUPPLY_VSEL_IO, 0); /* Set voltage to 3.3V */
mdelay(1);
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 1); /* Enable Supply */
mdelay(10);
da9063_release_i2c_bus(bus);
}
void am33xx_spl_board_init(void)
{
/* Set CPU speed to 600 MHz (fix) */
@ -805,6 +828,9 @@ void am33xx_spl_board_init(void)
/* Configure both I2C buses used */
init_i2c();
/* Power on Extension/User module, so it doesn't block I2C bus */
power_um();
/* Get board descriptor */
init_bd_spl();
@ -1052,17 +1078,7 @@ static void init_user_module(void)
puts("UM: ");
REQUEST_AND_CLEAR_GPIO(GPIO_RST_UM_N); /* Assert reset (active low) */
REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N) /* TODO: CHECK */
/* TODO: Should this be done at first power up as well? */
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 0); /* Switch Supply off */
mdelay(30); /* Give time to discharge output */
da9063_set_gpio(PMIC_UM_SUPPLY_VSEL_IO, 0); /* Set voltage to 3.3V */
mdelay(1);
da9063_set_gpio(PMIC_UM_SUPPLY_EN_IO, 1); /* Enable Supply */
mdelay(10);
REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N);
gpio_direction_input(GPIO_RST_UM_N); /* Release reset (open drain) */
mdelay(10);