hw21/26: power up extension module early

The extension module is connected to the system I2C bus. Before the
module is powered, it can pull the lines low, preventing I2C access to
the board descriptor.

- enable extension module power already in SPL

id: 417848
This commit is contained in:
Rene Straub 2023-10-25 21:41:40 +02:00
parent 4e67fc3997
commit 69e9c386dd
1 changed files with 25 additions and 16 deletions

View File

@ -794,6 +794,27 @@ 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);
mdelay(1);
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 +826,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();
@ -1045,30 +1069,15 @@ static void init_usb_hub(void)
static void init_user_module(void)
{
int bus;
bus = da9063_claim_i2c_bus();
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 */
REQUEST_AND_CLEAR_GPIO(GPIO_CTRL_WDIS_N); /* TODO: CHECK */
mdelay(10);
gpio_direction_input(GPIO_RST_UM_N); /* Release reset (open drain) */
mdelay(10);
da9063_release_i2c_bus(bus);
mdelay(200); /* Give module some time to boot */
um_init(CONFIG_UM_I2C_BUS); /* Try to detect user module */