From 1514244cc137fe29c9321ea2990de2ec827a9549 Mon Sep 17 00:00:00 2001 From: Jean-Jacques Hiblot Date: Fri, 7 Dec 2018 14:50:49 +0100 Subject: 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 Reviewed-by: Tom Rini Reviewed-by: Heiko Schocher --- board/ti/am57xx/board.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'board/ti/am57xx') diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index 177a324..355ea55 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -623,7 +623,7 @@ void am57x_idk_lcd_detect(void) { int r = -ENODEV; char *idk_lcd = "no"; - uint8_t buf = 0; + u8 buf = 0; /* Only valid for IDKs */ if (board_is_x15() || board_is_am572x_evm()) @@ -633,6 +633,7 @@ void am57x_idk_lcd_detect(void) if (board_is_am571x_idk() && !am571x_idk_needs_lcd()) goto out; +#ifndef CONFIG_DM_I2C r = i2c_set_bus_num(OSD_TS_FT_BUS_ADDRESS); if (r) { printf("%s: Failed to set bus address to %d: %d\n", @@ -657,6 +658,32 @@ void am57x_idk_lcd_detect(void) OSD_TS_FT_REG_ID, r); goto out; } +#else + struct udevice *dev; + + r = i2c_get_chip_for_busnum(OSD_TS_FT_BUS_ADDRESS, + OSD_TS_FT_CHIP_ADDRESS, 1, &dev); + if (r) { + printf("%s: Failed to get I2C device %d/%d (ret %d)\n", + __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, + r); + /* AM572x IDK has no explicit settings for optional LCD kit */ + if (board_is_am571x_idk()) + printf("%s: Touch screen detect failed: %d!\n", + __func__, r); + goto out; + } + + /* Read FT ID */ + r = dm_i2c_reg_read(dev, OSD_TS_FT_REG_ID); + if (r < 0) { + printf("%s: Touch screen ID read %d:0x%02x[0x%02x] failed:%d\n", + __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, + OSD_TS_FT_REG_ID, r); + goto out; + } + buf = (u8)r; +#endif switch (buf) { case OSD_TS_FT_ID_5606: -- cgit v1.1 From 7eb1f607f15310a7b62eedcf7516fecbfda517da Mon Sep 17 00:00:00 2001 From: Jean-Jacques Hiblot Date: Fri, 7 Dec 2018 14:50:50 +0100 Subject: am57xx: remove non-DM I2C code am57xx configs uses DM_I2C both in SPL and u-boot. Remove code for non-DM I2C support. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Tom Rini Reviewed-by: Heiko Schocher --- board/ti/am57xx/board.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'board/ti/am57xx') diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index 355ea55..9738beb 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -623,7 +623,7 @@ void am57x_idk_lcd_detect(void) { int r = -ENODEV; char *idk_lcd = "no"; - u8 buf = 0; + struct udevice *dev; /* Only valid for IDKs */ if (board_is_x15() || board_is_am572x_evm()) @@ -633,34 +633,6 @@ void am57x_idk_lcd_detect(void) if (board_is_am571x_idk() && !am571x_idk_needs_lcd()) goto out; -#ifndef CONFIG_DM_I2C - r = i2c_set_bus_num(OSD_TS_FT_BUS_ADDRESS); - if (r) { - printf("%s: Failed to set bus address to %d: %d\n", - __func__, OSD_TS_FT_BUS_ADDRESS, r); - goto out; - } - r = i2c_probe(OSD_TS_FT_CHIP_ADDRESS); - if (r) { - /* AM572x IDK has no explicit settings for optional LCD kit */ - if (board_is_am571x_idk()) { - printf("%s: Touch screen detect failed: %d!\n", - __func__, r); - } - goto out; - } - - /* Read FT ID */ - r = i2c_read(OSD_TS_FT_CHIP_ADDRESS, OSD_TS_FT_REG_ID, 1, &buf, 1); - if (r) { - printf("%s: Touch screen ID read %d:0x%02x[0x%02x] failed:%d\n", - __func__, OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, - OSD_TS_FT_REG_ID, r); - goto out; - } -#else - struct udevice *dev; - r = i2c_get_chip_for_busnum(OSD_TS_FT_BUS_ADDRESS, OSD_TS_FT_CHIP_ADDRESS, 1, &dev); if (r) { @@ -682,10 +654,8 @@ void am57x_idk_lcd_detect(void) OSD_TS_FT_REG_ID, r); goto out; } - buf = (u8)r; -#endif - switch (buf) { + switch (r) { case OSD_TS_FT_ID_5606: idk_lcd = "osd101t2045"; break; @@ -694,7 +664,7 @@ void am57x_idk_lcd_detect(void) break; default: printf("%s: Unidentifed Touch screen ID 0x%02x\n", - __func__, buf); + __func__, r); /* we will let default be "no lcd" */ } out: -- cgit v1.1