ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C
API when DM_I2C is used. The goal is to eventually remove DM_I2C_COMPAT
when all I2C "clients" have been migrated to use the DM API.
This a step in that direction for the TI based platforms.
Build tested with buildman:
buildman -dle am33xx ti omap3 omap4 omap5 davinci keystone
boot tested with:
am335x_evm, am335x_boneblack, am335x_boneblack_vboot (DM version),
am57xx_evm, dra7xx_evm, k2g_evm, am437x_evm
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 2a59b06..31bc0f4 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -43,6 +43,8 @@
#ifdef CONFIG_TI_I2C_BOARD_DETECT
void do_board_detect(void)
{
+ /* Ensure I2C is initialized for EEPROM access*/
+ gpi2c_init();
if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
CONFIG_EEPROM_CHIP_ADDRESS))
printf("ti_i2c_eeprom_init failed\n");
@@ -386,8 +388,13 @@
{
int mpu_vdd, ddr_volt;
+#ifndef CONFIG_DM_I2C
if (i2c_probe(TPS65218_CHIP_PM))
return;
+#else
+ if (power_tps65218_init(0))
+ return;
+#endif
switch (m) {
case 1000:
@@ -439,8 +446,13 @@
{
int mpu_vdd;
+#ifndef CONFIG_DM_I2C
if (i2c_probe(TPS62362_I2C_ADDR))
return;
+#else
+ if (power_tps62362_init(0))
+ return;
+#endif
switch (m) {
case 1000:
@@ -462,14 +474,12 @@
puts("Unknown MPU clock, not scaling\n");
return;
}
-
/* Set VDD_MPU voltage */
if (tps62362_voltage_update(TPS62362_SET3, mpu_vdd)) {
printf("%s failure\n", __func__);
return;
}
}
-
void gpi2c_init(void)
{
/* When needed to be invoked prior to BSS initialization */
@@ -477,8 +487,10 @@
if (first_time) {
enable_i2c0_pin_mux();
+#ifndef CONFIG_DM_I2C
i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED,
CONFIG_SYS_OMAP24_I2C_SLAVE);
+#endif
first_time = false;
}
}
@@ -614,20 +626,32 @@
/* setup board specific PMIC */
int power_init_board(void)
{
- struct pmic *p;
-
+ int rc;
+#ifndef CONFIG_DM_I2C
+ struct pmic *p = NULL;
+#endif
if (board_is_idk()) {
- power_tps62362_init(I2C_PMIC);
+ rc = power_tps62362_init(0);
+ if (rc)
+ goto done;
+#ifndef CONFIG_DM_I2C
p = pmic_get("TPS62362");
- if (p && !pmic_probe(p))
- puts("PMIC: TPS62362\n");
+ if (!p || pmic_probe(p))
+ goto done;
+#endif
+ puts("PMIC: TPS62362\n");
} else {
- power_tps65218_init(I2C_PMIC);
+ rc = power_tps65218_init(0);
+ if (rc)
+ goto done;
+#ifndef CONFIG_DM_I2C
p = pmic_get("TPS65218_PMIC");
- if (p && !pmic_probe(p))
- puts("PMIC: TPS65218\n");
+ if (!p || pmic_probe(p))
+ goto done;
+#endif
+ puts("PMIC: TPS65218\n");
}
-
+done:
return 0;
}