summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2014-08-20 15:08:52 +0300
committerStefano Babic <sbabic@denx.de>2014-09-09 15:32:32 +0200
commit52658fda7abc4319ff7f8fe934d2e7c0a32202d7 (patch)
tree16f6a0edb0a856c39256e8ec539759cb7ccb3f4b /board
parent224beb833e544b802f08765271cec07667d39669 (diff)
downloadu-boot-imx-52658fda7abc4319ff7f8fe934d2e7c0a32202d7.zip
u-boot-imx-52658fda7abc4319ff7f8fe934d2e7c0a32202d7.tar.gz
u-boot-imx-52658fda7abc4319ff7f8fe934d2e7c0a32202d7.tar.bz2
compulab: eeprom: add support for defining eeprom i2c bus
Create CONFIG_SYS_I2C_EEPROM_BUS #define to tell the EEPROM module what I2C bus the EEPROM is located at. Make cl_eeprom_read() switch to that bus when reading EEPROM. Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Dmitry Lifshitz <lifshitz@compulab.co.il> Cc: Tom Rini <trini@ti.com> Cc: Marek Vasut <marex@denx.de> Acked-by: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Dmitry Lifshitz <lifshitz@compulab.co.il> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Diffstat (limited to 'board')
-rw-r--r--board/compulab/common/eeprom.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 20fe3e1..85442cd 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -31,8 +31,19 @@ static int cl_eeprom_layout; /* Implicitly LAYOUT_INVALID */
static int cl_eeprom_read(uint offset, uchar *buf, int len)
{
- return i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
+ int res;
+ unsigned int current_i2c_bus = i2c_get_bus_num();
+
+ res = i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
+ if (res < 0)
+ return res;
+
+ res = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
+
+ i2c_set_bus_num(current_i2c_bus);
+
+ return res;
}
static int cl_eeprom_setup_layout(void)