[U-Boot] [PATCH 05/18] compulab: eeprom: add support for defining eeprom i2c bus
Marek Vasut
marex at denx.de
Sun Aug 3 15:48:20 CEST 2014
On Sunday, August 03, 2014 at 09:34:35 AM, Nikita Kiryanov wrote:
> 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 at compulab.co.il>
> Cc: Dmitry Lifshitz <lifshitz at compulab.co.il>
> Cc: Tom Rini <trini at ti.com>
> Acked-by: Igor Grinberg <grinberg at compulab.co.il>
> Acked-by: Dmitry Lifshitz <lifshitz at compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita at compulab.co.il>
> ---
> board/compulab/common/eeprom.c | 10 +++++++++-
> include/configs/cm_t335.h | 1 +
> include/configs/cm_t35.h | 1 +
> include/configs/cm_t54.h | 1 +
> 4 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/board/compulab/common/eeprom.c
> b/board/compulab/common/eeprom.c index 20fe3e1..b5c1c2a 100644
> --- a/board/compulab/common/eeprom.c
> +++ b/board/compulab/common/eeprom.c
> @@ -31,8 +31,16 @@ 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();
> +
> + i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
Please handle the return value of this function too.
[...]
BR,MV
More information about the U-Boot
mailing list