summaryrefslogtreecommitdiff
path: root/board/ti/common
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2018-12-07 16:50:49 +0300
committerHeiko Schocher <hs@denx.de>2018-12-10 09:15:21 +0300
commit1514244cc137fe29c9321ea2990de2ec827a9549 (patch)
tree7bd338feaa0ea0e779e9bf9e7b668cc6d1b35dc9 /board/ti/common
parentad95da1f3c2d67e36f2b334083bc487b05085c7e (diff)
downloadu-boot-1514244cc137fe29c9321ea2990de2ec827a9549.tar.xz
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>
Diffstat (limited to 'board/ti/common')
-rw-r--r--board/ti/common/board_detect.c60
1 files changed, 3 insertions, 57 deletions
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 085e7320bd..e258e22f37 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -14,43 +14,7 @@
#include "board_detect.h"
-#if defined(CONFIG_DM_I2C_COMPAT)
-/**
- * ti_i2c_set_alen - Set chip's i2c address length
- * @bus_addr - I2C bus number
- * @dev_addr - I2C eeprom id
- * @alen - I2C address length in bytes
- *
- * DM_I2C by default sets the address length to be used to 1. This
- * function allows this address length to be changed to match the
- * eeprom used for board detection.
- */
-int __maybe_unused ti_i2c_set_alen(int bus_addr, int dev_addr, int alen)
-{
- struct udevice *dev;
- struct udevice *bus;
- int rc;
-
- rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, &bus);
- if (rc)
- return rc;
- rc = i2c_get_chip(bus, dev_addr, 1, &dev);
- if (rc)
- return rc;
- rc = i2c_set_chip_offset_len(dev, alen);
- if (rc)
- return rc;
-
- return 0;
-}
-#else
-int __maybe_unused ti_i2c_set_alen(int bus_addr, int dev_addr, int alen)
-{
- return 0;
-}
-#endif
-
-#if !defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT)
+#if !defined(CONFIG_DM_I2C)
/**
* ti_i2c_eeprom_init - Initialize an i2c bus and probe for a device
* @i2c_bus: i2c bus number to initialize
@@ -83,17 +47,7 @@ static int __maybe_unused ti_i2c_eeprom_init(int i2c_bus, int dev_addr)
static int __maybe_unused ti_i2c_eeprom_read(int dev_addr, int offset,
uchar *ep, int epsize)
{
- int bus_num, rc, alen;
-
- bus_num = i2c_get_bus_num();
-
- alen = 2;
-
- rc = ti_i2c_set_alen(bus_num, dev_addr, alen);
- if (rc)
- return rc;
-
- return i2c_read(dev_addr, offset, alen, ep, epsize);
+ return i2c_read(dev_addr, offset, 2, ep, epsize);
}
#endif
@@ -127,7 +81,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
u32 hdr_read;
int rc;
-#if defined(CONFIG_DM_I2C) && !defined(CONFIG_DM_I2C_COMPAT)
+#if defined(CONFIG_DM_I2C)
struct udevice *dev;
struct udevice *bus;
@@ -185,10 +139,6 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
*/
byte = 2;
- rc = ti_i2c_set_alen(bus_addr, dev_addr, byte);
- if (rc)
- return rc;
-
rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read, 4);
if (rc)
return rc;
@@ -202,10 +152,6 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr,
*/
byte = 1;
if (rc) {
- rc = ti_i2c_set_alen(bus_addr, dev_addr, byte);
- if (rc)
- return rc;
-
rc = i2c_read(dev_addr, 0x0, byte, (uint8_t *)&hdr_read,
4);
}