[U-Boot] [PATCH v3 2/9] i2c: common changes for multibus/multiadapter support

Heiko Schocher hs at denx.de
Mon May 13 07:41:00 CEST 2013


Hello Simon,

Am 11.05.2013 23:33, schrieb Simon Glass:
> Hi Heiko,
> 
> On Sat, May 4, 2013 at 6:01 AM, Heiko Schocher <hs at denx.de> wrote:
>> Signed-off-by: Heiko Schocher <hs at denx.de>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> Cc: Henrik Nordström <henrik at henriknordstrom.net>
>>
>> ---
>> - changes for v2:
>>   add comment from Henrik Nordström <henrik at henriknordstrom.net>
>>   remove wrong line in README
>>   - rebase against current mainline 178d0cc1a4c73c3341afbeb2a93b172de8c96bd1
>> - changes for v3:
>>   - adapt to the new introduced U_BOOT_I2C_ADAP_COMPLETE define
>>   - fix Codingstyle issues
>>   - adapt README
>> ---
>>  README                          |  74 ++++++++++++++++++++++++-
>>  arch/arm/lib/board.c            |   7 ++-
>>  arch/blackfin/lib/board.c       |   7 +++
>>  arch/m68k/lib/board.c           |  17 +++++-
>>  arch/mips/lib/board.c           |   7 +++
>>  arch/nds32/lib/board.c          |  10 +++-
>>  arch/powerpc/cpu/mpc8xx/video.c |   4 ++
>>  arch/powerpc/lib/board.c        |  12 +++-
>>  common/cmd_date.c               |   9 +++
>>  common/cmd_dtt.c                |   9 +++
>>  common/cmd_i2c.c                | 120 ++++++++++++++++++++++++++--------------
>>  common/env_eeprom.c             |  14 +++++
>>  common/stdio.c                  |  13 ++++-
>>  include/i2c.h                   |   9 ---
>>  14 Dateien geändert, 251 Zeilen hinzugefügt(+), 61 Zeilen entfernt(-)
>>
> 
> ...
>> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
>> index 4380794..d59f10d 100644
> 
>> @@ -1508,16 +1543,21 @@ static int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>>   */
>>  static int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>>  {
>> +#if defined(CONFIG_SYS_I2C)
>> +       i2c_init(I2C_ADAP->speed, I2C_ADAP->slaveaddr);
>> +#else
>>         i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
>> +#endif
>>         return 0;
>>  }
>>
>>  static cmd_tbl_t cmd_i2c_sub[] = {
>> -#if defined(CONFIG_I2C_MUX)
>> -       U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_add_bus, "", ""),
>> +#if defined(CONFIG_SYS_I2C)
>> +       U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_show_bus, "", ""),
>>  #endif  /* CONFIG_I2C_MUX */
>>         U_BOOT_CMD_MKENT(crc32, 3, 1, do_i2c_crc, "", ""),
>> -#if defined(CONFIG_I2C_MULTI_BUS)
>> +#if defined(CONFIG_SYS_I2C) || \
>> +       defined(CONFIG_I2C_MULTI_BUS)
>>         U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""),
> 
> If you are changing the condition here you should change the condition
> on the help also.

Fixed.

>>  #endif  /* CONFIG_I2C_MULTI_BUS */
>>  #if defined(CONFIG_I2C_EDID)
>> @@ -1576,11 +1616,11 @@ static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>>  /***************************************************/
>>  #ifdef CONFIG_SYS_LONGHELP
>>  static char i2c_help_text[] =
>> -#if defined(CONFIG_I2C_MUX)
>> -       "bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes\ni2c "
>> +#if defined(CONFIG_SYS_I2C)
>> +       "bus [muxtype:muxaddr:muxchannel] - show I2C bus info\n"
>>  #endif  /* CONFIG_I2C_MUX */
>>         "crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
>> -#if defined(CONFIG_I2C_MULTI_BUS)
>> +#if defined(CONFIG_SYS_I2C)
>>         "i2c dev [dev] - show or set current I2C bus\n"
>>  #endif  /* CONFIG_I2C_MULTI_BUS */
>>  #if defined(CONFIG_I2C_EDID)
>> diff --git a/common/env_eeprom.c b/common/env_eeprom.c
>> index 45c935b..fbd459a 100644
> 
> I tested this on snow and it seems to disable every bus except bus 0.
> I will see if I can take a look.

Bad news ... did you tried it with debug traces enabled?

> Hopefully one of the Nvidia guys can test on seaboard as I don't have
> mind with me right now.
> 
> SMDK5250 # i2c dev 4
> Invalid bus 4

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list