[U-Boot] [PATCH 0/7] Remove individual I2C commands and cleanup

This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Peter Tyser (7): cm5200: Make function test command names more unique cmd_i2c: Create common default i2c_[set|get]_bus_speed() functions cmd_i2c: Remove deprecated individual i2c commands cmd_i2c: Update references to individual i2c commands cmd_i2c: Clean up i2c command argument parsing cmd_i2c: Clean up trivial helper functions cmd_i2c: Fix i2c help command output when CONFIG_I2C_MUX
README | 20 +---- board/cm5200/cmd_cm5200.c | 18 ++-- board/esd/tasreg/tasreg.c | 4 +- common/cmd_i2c.c | 176 +++++++++++++------------------------- cpu/arm920t/at91rm9200/i2c.c | 10 -- cpu/mpc512x/i2c.c | 14 --- cpu/mpc8260/i2c.c | 13 --- cpu/ppc4xx/i2c.c | 14 --- doc/README.ebony | 20 ++-- doc/README.m52277evb | 8 +-- doc/README.m5373evb | 8 +-- doc/README.m54455evb | 8 +-- doc/README.m5475evb | 8 +-- doc/README.ppc440 | 4 +- doc/README.xpedite1k | 6 +- doc/feature-removal-schedule.txt | 12 --- drivers/i2c/soft_i2c.c | 14 --- drivers/i2c/tsi108_i2c.c | 2 +- include/configs/DU405.h | 1 - include/configs/DU440.h | 1 - include/configs/MPC8313ERDB.h | 1 - include/configs/MPC8349EMDS.h | 1 - include/configs/MPC8349ITX.h | 1 - include/configs/MPC8360ERDK.h | 1 - include/configs/MPC8536DS.h | 1 - include/configs/MPC8568MDS.h | 1 - include/configs/MPC8569MDS.h | 1 - include/configs/MPC8572DS.h | 1 - include/configs/MVBLM7.h | 1 - include/configs/PMC440.h | 1 - include/configs/SIMPC8313.h | 1 - include/configs/XPEDITE5200.h | 1 - include/configs/XPEDITE5370.h | 1 - include/configs/ads5121.h | 1 - include/configs/at91rm9200ek.h | 1 - include/configs/bubinga.h | 2 +- include/configs/katmai.h | 1 - include/configs/keymile-common.h | 1 - include/configs/kmeter1.h | 1 - include/configs/korat.h | 1 - include/configs/sacsng.h | 6 +- include/configs/sbc8349.h | 1 - include/configs/socrates.h | 1 - include/configs/taihu.h | 2 +- 44 files changed, 99 insertions(+), 293 deletions(-)

Add "_test" to cm5200's function test command names to prevent overlap with common, global function names. Originally, the "do_i2c" function test command interfered with common/cmd_i2c.c's "do_i2c" when CONFIG_I2C_CMD_TREE was defined.
The functions were also made static as they are not globally accessed.
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- board/cm5200/cmd_cm5200.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/board/cm5200/cmd_cm5200.c b/board/cm5200/cmd_cm5200.c index 52f031c..f009eed 100644 --- a/board/cm5200/cmd_cm5200.c +++ b/board/cm5200/cmd_cm5200.c @@ -29,7 +29,7 @@
#ifdef CONFIG_CMD_BSP
-int do_i2c(char *argv[]) +static int do_i2c_test(char *argv[]) { unsigned char temp, temp1;
@@ -57,7 +57,7 @@ int do_i2c(char *argv[]) return 0; }
-int do_usbtest(char *argv[]) +static int do_usb_test(char *argv[]) { int i; static int usb_stor_curr_dev = -1; /* current device */ @@ -90,7 +90,7 @@ int do_usbtest(char *argv[]) return 0; }
-int do_led(char *argv[]) +static int do_led_test(char *argv[]) { int i = 0; struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT; @@ -134,7 +134,7 @@ int do_led(char *argv[]) return 0; }
-int do_rs232(char *argv[]) +static int do_rs232_test(char *argv[]) { int error_status = 0; struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO; @@ -397,22 +397,22 @@ int do_rs232(char *argv[]) return error_status; }
-int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +static int cmd_fkt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int rcode = -1;
switch (argc) { case 2: if (strncmp(argv[1], "i2c", 3) == 0) - rcode = do_i2c(argv); + rcode = do_i2c_test(argv); else if (strncmp(argv[1], "led", 3) == 0) - rcode = do_led(argv); + rcode = do_led_test(argv); else if (strncmp(argv[1], "usb", 3) == 0) - rcode = do_usbtest(argv); + rcode = do_usb_test(argv); break; case 3: if (strncmp(argv[1], "rs232", 3) == 0) - rcode = do_rs232(argv); + rcode = do_rs232_test(argv); break; }

New default, weak i2c_get_bus_speed() and i2c_set_bus_speed() functions replace a number of architecture-specific implementations.
Also, providing default functions will allow all boards to enable CONFIG_I2C_CMD_TREE. This was previously not possible since the tree-form of the i2c command provides the ability to display and modify the i2c bus speed which requires i2c_[set|get]_bus_speed() to be present.
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- common/cmd_i2c.c | 18 ++++++++++++++++++ cpu/arm920t/at91rm9200/i2c.c | 10 ---------- cpu/mpc512x/i2c.c | 14 -------------- cpu/mpc8260/i2c.c | 13 ------------- cpu/ppc4xx/i2c.c | 14 -------------- drivers/i2c/soft_i2c.c | 14 -------------- 6 files changed, 18 insertions(+), 65 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 16439ac..29baadd 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -138,6 +138,24 @@ DECLARE_GLOBAL_DATA_PTR; static int mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]);
+/* TODO: Implement architecture-specific get/set functions */ +unsigned int __def_i2c_get_bus_speed(void) +{ + return CONFIG_SYS_I2C_SPEED; +} +unsigned int i2c_get_bus_speed(void) + __attribute((weak, alias("__def_i2c_get_bus_speed"))); + +int __def_i2c_set_bus_speed(unsigned int speed) +{ + if (speed != CONFIG_SYS_I2C_SPEED) + return -1; + + return 0; +} +int i2c_set_bus_speed(unsigned int) + __attribute((weak, alias("__def_i2c_set_bus_speed"))); + /* * Syntax: * imd {i2c_chip} {addr}{.0, .1, .2} {len} diff --git a/cpu/arm920t/at91rm9200/i2c.c b/cpu/arm920t/at91rm9200/i2c.c index 9fd72d3..1711088 100644 --- a/cpu/arm920t/at91rm9200/i2c.c +++ b/cpu/arm920t/at91rm9200/i2c.c @@ -189,14 +189,4 @@ i2c_init(int speed, int slaveaddr) return; }
-int i2c_set_bus_speed(unsigned int speed) -{ - return -1; -} - -unsigned int i2c_get_bus_speed(void) -{ - return CONFIG_SYS_I2C_SPEED; -} - #endif /* CONFIG_HARD_I2C */ diff --git a/cpu/mpc512x/i2c.c b/cpu/mpc512x/i2c.c index 4f6bc86..0da906a 100644 --- a/cpu/mpc512x/i2c.c +++ b/cpu/mpc512x/i2c.c @@ -397,18 +397,4 @@ unsigned int i2c_get_bus_num (void) return bus_num; }
-/* TODO */ -unsigned int i2c_get_bus_speed (void) -{ - return -1; -} - -int i2c_set_bus_speed (unsigned int speed) -{ - if (speed != CONFIG_SYS_I2C_SPEED) - return -1; - - return 0; -} - #endif /* CONFIG_HARD_I2C */ diff --git a/cpu/mpc8260/i2c.c b/cpu/mpc8260/i2c.c index 35cf8f1..7fcd00f 100644 --- a/cpu/mpc8260/i2c.c +++ b/cpu/mpc8260/i2c.c @@ -783,19 +783,6 @@ int i2c_set_bus_num(unsigned int bus) #endif return 0; } -/* TODO: add 100/400k switching */ -unsigned int i2c_get_bus_speed(void) -{ - return CONFIG_SYS_I2C_SPEED; -} - -int i2c_set_bus_speed(unsigned int speed) -{ - if (speed != CONFIG_SYS_I2C_SPEED) - return -1; - - return 0; -}
#endif /* CONFIG_I2C_MULTI_BUS */ #endif /* CONFIG_HARD_I2C */ diff --git a/cpu/ppc4xx/i2c.c b/cpu/ppc4xx/i2c.c index 9d416ca..e3e1bab 100644 --- a/cpu/ppc4xx/i2c.c +++ b/cpu/ppc4xx/i2c.c @@ -438,18 +438,4 @@ int i2c_set_bus_num(unsigned int bus) return 0; } #endif /* CONFIG_I2C_MULTI_BUS */ - -/* TODO: add 100/400k switching */ -unsigned int i2c_get_bus_speed(void) -{ - return CONFIG_SYS_I2C_SPEED; -} - -int i2c_set_bus_speed(unsigned int speed) -{ - if (speed != CONFIG_SYS_I2C_SPEED) - return -1; - - return 0; -} #endif /* CONFIG_HARD_I2C */ diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c index 185634d..59883a5 100644 --- a/drivers/i2c/soft_i2c.c +++ b/drivers/i2c/soft_i2c.c @@ -244,20 +244,6 @@ int i2c_set_bus_num(unsigned int bus) } #endif
-/* TODO: add 100/400k switching */ -unsigned int i2c_get_bus_speed(void) -{ - return CONFIG_SYS_I2C_SPEED; -} - -int i2c_set_bus_speed(unsigned int speed) -{ - if (speed != CONFIG_SYS_I2C_SPEED) - return -1; - - return 0; -} - /*----------------------------------------------------------------------- * if ack == I2C_ACK, ACK the byte so can continue reading, else * send I2C_NOACK to end the read.

On Sat, 2009-04-18 at 14:23 -0400, Mike Frysinger wrote:
On Thursday 16 April 2009 15:41:22 Peter Tyser wrote:
+unsigned int i2c_get_bus_speed(void)
- __attribute((weak, alias("__def_i2c_get_bus_speed")));
__attribute__ ?
Interesting, thanks for catching that. I blindly copied the weak functions in net/eth.c which also use the __attribute declaration. It looks like gcc treats __attribute and __attribute__ the same, but I couldn't find any definitive info on __attribute. I'll resubmit using __attribute__.
Anyone have a reason that we shouldn't replace all u-boot references to __attribute with __attribute__?
Thanks, Peter

On Saturday 18 April 2009 23:13:58 Peter Tyser wrote:
On Sat, 2009-04-18 at 14:23 -0400, Mike Frysinger wrote:
On Thursday 16 April 2009 15:41:22 Peter Tyser wrote:
+unsigned int i2c_get_bus_speed(void)
- __attribute((weak, alias("__def_i2c_get_bus_speed")));
__attribute__ ?
Interesting, thanks for catching that. I blindly copied the weak functions in net/eth.c which also use the __attribute declaration. It looks like gcc treats __attribute and __attribute__ the same, but I couldn't find any definitive info on __attribute. I'll resubmit using __attribute__.
Anyone have a reason that we shouldn't replace all u-boot references to __attribute with __attribute__?
not that i know of ... using __XXX__ with gcc keywords tends to be preferred. -mike

The following individual I2C commands have been removed: imd, imm, inm, imw, icrc32, iprobe, iloop, isdram.
The functionality of the individual commands is still available via the 'i2c' command.
This change only has an impact on those boards which did not have CONFIG_I2C_CMD_TREE defined.
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- README | 5 --- common/cmd_i2c.c | 58 -------------------------------------- doc/feature-removal-schedule.txt | 12 -------- include/configs/DU405.h | 1 - include/configs/DU440.h | 1 - include/configs/MPC8313ERDB.h | 1 - include/configs/MPC8349EMDS.h | 1 - include/configs/MPC8349ITX.h | 1 - include/configs/MPC8360ERDK.h | 1 - include/configs/MPC8536DS.h | 1 - include/configs/MPC8568MDS.h | 1 - include/configs/MPC8569MDS.h | 1 - include/configs/MPC8572DS.h | 1 - include/configs/MVBLM7.h | 1 - include/configs/PMC440.h | 1 - include/configs/SIMPC8313.h | 1 - include/configs/XPEDITE5200.h | 1 - include/configs/XPEDITE5370.h | 1 - include/configs/ads5121.h | 1 - include/configs/at91rm9200ek.h | 1 - include/configs/katmai.h | 1 - include/configs/keymile-common.h | 1 - include/configs/kmeter1.h | 1 - include/configs/korat.h | 1 - include/configs/sbc8349.h | 1 - include/configs/socrates.h | 1 - 26 files changed, 0 insertions(+), 98 deletions(-)
diff --git a/README b/README index 142dbcc..03ad69a 100644 --- a/README +++ b/README @@ -1315,11 +1315,6 @@ The following options need to be configured: clock chips. See common/cmd_i2c.c for a description of the command line interface.
- CONFIG_I2C_CMD_TREE is a recommended option that places - all I2C commands under a single 'i2c' root command. The - older 'imm', 'imd', 'iprobe' etc. commands are considered - deprecated and may disappear in the future. - CONFIG_HARD_I2C selects a hardware I2C controller.
CONFIG_SOFT_I2C configures u-boot to use a software (aka diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 29baadd..81f3db5 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1204,7 +1204,6 @@ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } #endif
-#if defined(CONFIG_I2C_CMD_TREE) int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); @@ -1314,11 +1313,9 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) cmd_usage(cmdtp); return 0; } -#endif /* CONFIG_I2C_CMD_TREE */
/***************************************************/
-#if defined(CONFIG_I2C_CMD_TREE) U_BOOT_CMD( i2c, 6, 1, do_i2c, "I2C sub-system", @@ -1341,61 +1338,6 @@ U_BOOT_CMD( "i2c sdram chip - print SDRAM configuration information\n" #endif ); -#endif /* CONFIG_I2C_CMD_TREE */ -U_BOOT_CMD( - imd, 4, 1, do_i2c_md, \ - "i2c memory display", \ - "chip address[.0, .1, .2] [# of objects]\n - i2c memory display\n" \ -); - -U_BOOT_CMD( - imm, 3, 1, do_i2c_mm, - "i2c memory modify (auto-incrementing)", - "chip address[.0, .1, .2]\n" - " - memory modify, auto increment address\n" -); -U_BOOT_CMD( - inm, 3, 1, do_i2c_nm, - "memory modify (constant address)", - "chip address[.0, .1, .2]\n - memory modify, read and keep address\n" -); - -U_BOOT_CMD( - imw, 5, 1, do_i2c_mw, - "memory write (fill)", - "chip address[.0, .1, .2] value [count]\n - memory write (fill)\n" -); - -U_BOOT_CMD( - icrc32, 5, 1, do_i2c_crc, - "checksum calculation", - "chip address[.0, .1, .2] count\n - compute CRC32 checksum\n" -); - -U_BOOT_CMD( - iprobe, 1, 1, do_i2c_probe, - "probe to discover valid I2C chip addresses", - "\n -discover valid I2C chip addresses\n" -); - -/* - * Require full name for "iloop" because it is an infinite loop! - */ -U_BOOT_CMD( - iloop, 5, 1, do_i2c_loop, - "infinite loop on address range", - "chip address[.0, .1, .2] [# of objects]\n" - " - loop, reading a set of addresses\n" -); - -#if defined(CONFIG_CMD_SDRAM) -U_BOOT_CMD( - isdram, 2, 1, do_sdram, - "print SDRAM configuration information", - "chip\n - print SDRAM configuration information\n" - " (valid chip values 50..57)\n" -); -#endif
#if defined(CONFIG_I2C_MUX)
diff --git a/doc/feature-removal-schedule.txt b/doc/feature-removal-schedule.txt index d966abb..72a0dad 100644 --- a/doc/feature-removal-schedule.txt +++ b/doc/feature-removal-schedule.txt @@ -40,18 +40,6 @@ Who: Wolfgang Denk wd@denx.de and board maintainers
---------------------------
-What: Individual I2C commands -When: April 2009 -Why: Per the U-Boot README, individual I2C commands such as "imd", "imm", - "imw", etc are deprecated. The single "i2c" command which is - currently enabled via CONFIG_I2C_CMD_TREE contains the same - functionality as the individual I2C commands. The individual - I2C commands should be removed as well as any references to - CONFIG_I2C_CMD_TREE. -Who: Peter Tyser ptyser@xes-inc.com - ---------------------------- - What: Legacy NAND code When: April 2009 Why: Legacy NAND code is deprecated. Similar functionality exists in diff --git a/include/configs/DU405.h b/include/configs/DU405.h index d1edd24..cfb3023 100644 --- a/include/configs/DU405.h +++ b/include/configs/DU405.h @@ -211,7 +211,6 @@ /*----------------------------------------------------------------------- * I2C EEPROM (CAT24WC08) for environment */ -#define CONFIG_I2C_CMD_TREE 1 #define CONFIG_HARD_I2C /* I2c with hardware support */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/DU440.h b/include/configs/DU440.h index e6abbdc..e9ea1bf 100644 --- a/include/configs/DU440.h +++ b/include/configs/DU440.h @@ -170,7 +170,6 @@ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F -#define CONFIG_I2C_CMD_TREE 1 #define CONFIG_I2C_MULTI_BUS 1
#define CONFIG_SYS_SPD_BUS_NUM 0 diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h index 21aedee..52d27a1 100644 --- a/include/configs/MPC8313ERDB.h +++ b/include/configs/MPC8313ERDB.h @@ -321,7 +321,6 @@ #define CONFIG_HARD_I2C /* I2C with hardware support*/ #define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {{0,0x69}} /* Don't probe these addrs */ diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h index 3c57403..387f22f 100644 --- a/include/configs/MPC8349EMDS.h +++ b/include/configs/MPC8349EMDS.h @@ -315,7 +315,6 @@ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {{0,0x69}} /* Don't probe these addrs */ diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h index ab6fe55..ef0a09f 100644 --- a/include/configs/MPC8349ITX.h +++ b/include/configs/MPC8349ITX.h @@ -95,7 +95,6 @@
#define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_OFFSET 0x3000 #define CONFIG_SYS_I2C2_OFFSET 0x3100 #define CONFIG_SYS_SPD_BUS_NUM 1 /* The I2C bus for SPD */ diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h index f7ebdaa..8852d19 100644 --- a/include/configs/MPC8360ERDK.h +++ b/include/configs/MPC8360ERDK.h @@ -265,7 +265,6 @@ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {{0x52}} /* Don't probe these addrs */ diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index bbb448d..bc1267f 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -337,7 +337,6 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy); #define CONFIG_HARD_I2C /* I2C with hardware support */ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {{0, 0x29}} /* Don't probe these addrs */ diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index 77224d9..ac34047 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -287,7 +287,6 @@ extern unsigned long get_clock_freq(void); #define CONFIG_HARD_I2C /* I2C with hardware support*/ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x52 #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index b0af5dc..b4a74e9 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -231,7 +231,6 @@ extern unsigned long get_clock_freq(void); #define CONFIG_HARD_I2C /* I2C with hardware support*/ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {{0,0x69}} /* Don't probe these addrs */ diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index b60b364..2aba689 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -378,7 +378,6 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy); #define CONFIG_HARD_I2C /* I2C with hardware support */ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x57 #define CONFIG_SYS_I2C_SLAVE 0x7F diff --git a/include/configs/MVBLM7.h b/include/configs/MVBLM7.h index 8f741f5..9fd27e3 100644 --- a/include/configs/MVBLM7.h +++ b/include/configs/MVBLM7.h @@ -53,7 +53,6 @@
#define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_OFFSET 0x3000 #define CONFIG_SYS_I2C2_OFFSET 0x3100
diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h index fc48bc1..012ae79 100644 --- a/include/configs/PMC440.h +++ b/include/configs/PMC440.h @@ -230,7 +230,6 @@ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F
-#define CONFIG_I2C_CMD_TREE 1 #define CONFIG_I2C_MULTI_BUS 1
#define CONFIG_SYS_I2C_MULTI_EEPROMS diff --git a/include/configs/SIMPC8313.h b/include/configs/SIMPC8313.h index 79582e1..88ea7c7 100644 --- a/include/configs/SIMPC8313.h +++ b/include/configs/SIMPC8313.h @@ -223,7 +223,6 @@ #define CONFIG_HARD_I2C /* I2C with hardware support*/ #define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {{0,0x69}} /* Don't probe these addrs */ diff --git a/include/configs/XPEDITE5200.h b/include/configs/XPEDITE5200.h index 370aae1..89ab692 100644 --- a/include/configs/XPEDITE5200.h +++ b/include/configs/XPEDITE5200.h @@ -226,7 +226,6 @@ #define CONFIG_SYS_I2C_OFFSET 0x3000 #define CONFIG_SYS_I2C2_OFFSET 0x3100 #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE
/* I2C EEPROM */ #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 diff --git a/include/configs/XPEDITE5370.h b/include/configs/XPEDITE5370.h index a353a14..536e063 100644 --- a/include/configs/XPEDITE5370.h +++ b/include/configs/XPEDITE5370.h @@ -244,7 +244,6 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy); #define CONFIG_SYS_I2C_OFFSET 0x3000 #define CONFIG_SYS_I2C2_OFFSET 0x3100 #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE
/* PEX8518 slave I2C interface */ #define CONFIG_SYS_I2C_PEX8518_ADDR 0x70 diff --git a/include/configs/ads5121.h b/include/configs/ads5121.h index d879024..b1420fa 100644 --- a/include/configs/ads5121.h +++ b/include/configs/ads5121.h @@ -287,7 +287,6 @@ #define CONFIG_HARD_I2C /* I2C with hardware support */ #undef CONFIG_SOFT_I2C /* so disable bit-banged I2C */ #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #if 0 diff --git a/include/configs/at91rm9200ek.h b/include/configs/at91rm9200ek.h index a018873..c898c73 100644 --- a/include/configs/at91rm9200ek.h +++ b/include/configs/at91rm9200ek.h @@ -266,7 +266,6 @@
#ifdef CONFIG_HARD_I2C #define CONFIG_CMD_I2C -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 0 /* not used */ #define CONFIG_SYS_I2C_SLAVE 0 /* not used */ #endif diff --git a/include/configs/katmai.h b/include/configs/katmai.h index 0d89594..3840267 100644 --- a/include/configs/katmai.h +++ b/include/configs/katmai.h @@ -129,7 +129,6 @@ #define CONFIG_SYS_I2C_SPEED 100000 /* I2C speed and slave address */
#define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_SPD_BUS_NUM 0 /* The I2C bus for SPD */
#define IIC0_BOOTPROM_ADDR 0x50 diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index b2e37ec..0fcf692 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -97,7 +97,6 @@ #define CONFIG_SYS_SLOT_ID_MASK (0x3f) /* mask for slot ID bits */
#define CONFIG_I2C_MULTI_BUS 1 -#define CONFIG_I2C_CMD_TREE 1 #define CONFIG_SYS_MAX_I2C_BUS 2 #define CONFIG_SYS_I2C_INIT_BOARD 1 #define CONFIG_I2C_MUX 1 diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h index f7fc6c5..61250ad 100644 --- a/include/configs/kmeter1.h +++ b/include/configs/kmeter1.h @@ -314,7 +314,6 @@ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_OFFSET 0x3000 #define CONFIG_I2C_MULTI_BUS 1 -#define CONFIG_I2C_CMD_TREE 1 #define CONFIG_SYS_MAX_I2C_BUS 2 #define CONFIG_I2C_MUX 1
diff --git a/include/configs/korat.h b/include/configs/korat.h index eb2c1d4..ea6ba89 100644 --- a/include/configs/korat.h +++ b/include/configs/korat.h @@ -282,7 +282,6 @@ #define CONFIG_CMD_ELF #define CONFIG_CMD_FAT #define CONFIG_CMD_I2C -#define CONFIG_I2C_CMD_TREE #define CONFIG_CMD_IRQ #define CONFIG_CMD_MII #define CONFIG_CMD_NET diff --git a/include/configs/sbc8349.h b/include/configs/sbc8349.h index d0338f1..2ea1897 100644 --- a/include/configs/sbc8349.h +++ b/include/configs/sbc8349.h @@ -279,7 +279,6 @@ #define CONFIG_HARD_I2C /* I2C with hardware support*/ #undef CONFIG_SOFT_I2C /* I2C bit-banged */ #define CONFIG_FSL_I2C -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */ #define CONFIG_SYS_I2C_SLAVE 0x7F #define CONFIG_SYS_I2C_NOPROBES {0x69} /* Don't probe these addrs */ diff --git a/include/configs/socrates.h b/include/configs/socrates.h index becd13e..5b91b4d 100644 --- a/include/configs/socrates.h +++ b/include/configs/socrates.h @@ -243,7 +243,6 @@ #define CONFIG_SYS_I2C_OFFSET 0x3000
#define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_CMD_TREE #define CONFIG_SYS_I2C2_OFFSET 0x3100
/* I2C RTC */

The individual i2c commands imd, imm, inm, imw, icrc32, iprobe, iloop, and isdram are no longer available so all references to them have been updated to the new form of "i2c <cmd>".
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- README | 15 ++++----------- board/esd/tasreg/tasreg.c | 4 ++-- common/cmd_i2c.c | 27 +++++++++++---------------- doc/README.ebony | 20 ++++++++++---------- doc/README.m52277evb | 8 +------- doc/README.m5373evb | 8 +------- doc/README.m54455evb | 8 +------- doc/README.m5475evb | 8 +------- doc/README.ppc440 | 4 ++-- doc/README.xpedite1k | 6 +++--- drivers/i2c/tsi108_i2c.c | 2 +- include/configs/bubinga.h | 2 +- include/configs/sacsng.h | 6 +++--- include/configs/taihu.h | 2 +- 14 files changed, 42 insertions(+), 78 deletions(-)
diff --git a/README b/README index 03ad69a..75fc4b7 100644 --- a/README +++ b/README @@ -1430,9 +1430,9 @@ The following options need to be configured: CONFIG_SYS_I2C_NOPROBES
This option specifies a list of I2C devices that will be skipped - when the 'i2c probe' command is issued (or 'iprobe' using the legacy - command). If CONFIG_I2C_MULTI_BUS is set, specify a list of bus-device - pairs. Otherwise, specify a 1D array of device addresses + when the 'i2c probe' command is issued. If CONFIG_I2C_MULTI_BUS + is set, specify a list of bus-device pairs. Otherwise, specify + a 1D array of device addresses
e.g. #undef CONFIG_I2C_MULTI_BUS @@ -2866,14 +2866,7 @@ mw - memory write (fill) cp - memory copy cmp - memory compare crc32 - checksum calculation -imd - i2c memory display -imm - i2c memory modify (auto-incrementing) -inm - i2c memory modify (constant address) -imw - i2c memory write (fill) -icrc32 - i2c checksum calculation -iprobe - probe to discover valid I2C chip addresses -iloop - infinite loop on address range -isdram - print SDRAM configuration information +i2c - I2C sub-system sspi - SPI utility commands base - print or set address offset printenv- print environment variables diff --git a/board/esd/tasreg/tasreg.c b/board/esd/tasreg/tasreg.c index 760c71d..9602ee5 100644 --- a/board/esd/tasreg/tasreg.c +++ b/board/esd/tasreg/tasreg.c @@ -231,7 +231,7 @@ int do_iploop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
addr = simple_strtol (argv[1], NULL, 16);
- printf("iprobe looping on addr 0x%lx (cntrl-c aborts)...\n", addr); + printf("i2c probe looping on addr 0x%lx (cntrl-c aborts)...\n", addr);
for (;;) { i2c_probe(addr); @@ -249,7 +249,7 @@ int do_iploop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } U_BOOT_CMD( iploop, 2, 1, do_iploop, - "iprobe loop <addr>", + "i2c probe loop <addr>", NULL );
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 81f3db5..0a97f9c 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -27,11 +27,6 @@ * There are several parameters in many of the commands that bear further * explanations: * - * Two of the commands (imm and imw) take a byte/word/long modifier - * (e.g. imm.w specifies the word-length modifier). This was done to - * allow manipulating word-length registers. It was not done on any other - * commands because it was not deemed useful. - * * {i2c_chip} is the I2C chip address (the first byte sent on the bus). * Each I2C chip on the bus has a unique address. On the I2C data bus, * the address is the upper seven bits and the LSB is the "read/write" @@ -69,11 +64,11 @@ * {addr} field (since .1 is the default, it doesn't actually have to * be specified). Examples: given a memory chip at I2C chip address * 0x50, the following would happen... - * imd 50 0 10 display 16 bytes starting at 0x000 + * i2c md 50 0 10 display 16 bytes starting at 0x000 * On the bus: <S> A0 00 <E> <S> A1 <rd> ... <rd> - * imd 50 100 10 display 16 bytes starting at 0x100 + * i2c md 50 100 10 display 16 bytes starting at 0x100 * On the bus: <S> A2 00 <E> <S> A3 <rd> ... <rd> - * imd 50 210 10 display 16 bytes starting at 0x210 + * i2c md 50 210 10 display 16 bytes starting at 0x210 * On the bus: <S> A4 10 <E> <S> A5 <rd> ... <rd> * This is awfully ugly. It would be nice if someone would think up * a better way of handling this. @@ -158,7 +153,7 @@ int i2c_set_bus_speed(unsigned int)
/* * Syntax: - * imd {i2c_chip} {addr}{.0, .1, .2} {len} + * i2c md {i2c_chip} {addr}{.0, .1, .2} {len} */ #define DISP_LINE_LEN 16
@@ -275,7 +270,7 @@ int do_i2c_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Write (fill) memory * * Syntax: - * imw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}] + * i2c mw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}] */ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -359,7 +354,7 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Calculate a CRC on memory * * Syntax: - * icrc32 {i2c_chip} {addr}{.0, .1, .2} {count} + * i2c crc32 {i2c_chip} {addr}{.0, .1, .2} {count} */ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -428,8 +423,8 @@ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* Modify memory. * * Syntax: - * imm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} - * inm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} + * i2c mm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} + * i2c nm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2} */
static int @@ -562,7 +557,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
/* * Syntax: - * iprobe {addr}{.0, .1, .2} + * i2c probe {addr}{.0, .1, .2} */ int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { @@ -604,7 +599,7 @@ int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* * Syntax: - * iloop {i2c_chip} {addr}{.0, .1, .2} [{length}] [{delay}] + * i2c loop {i2c_chip} {addr}{.0, .1, .2} [{length}] [{delay}] * {length} - Number of bytes to read * {delay} - A DECIMAL number and defaults to 1000 uSec */ @@ -726,7 +721,7 @@ static void decode_bits (u_char const b, char const *str[], int const do_once)
/* * Syntax: - * sdram {i2c_chip} + * i2c sdram {i2c_chip} */ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { diff --git a/doc/README.ebony b/doc/README.ebony index a395a49..a8479a4 100644 --- a/doc/README.ebony +++ b/doc/README.ebony @@ -31,17 +31,17 @@ J42: open All others are factory default.
-I2C iprobe +I2C probe =====================
The i2c utilities have been tested on both Rev B. and Rev C. and look good. The CONFIG_SYS_I2C_NOPROBES macro is defined to prevent probing the CDCV850 clock controller at address 0x69 (since reading it causes the i2c implementation to misbehave. The output of -iprobe should look like this (assuming you are only using a single +'i2c probe' should look like this (assuming you are only using a single SO-DIMM:
-=> iprobe +=> i2c probe Valid chip addresses: 50 53 54 Excluded chip addresses: 69
@@ -63,13 +63,13 @@ J42 - strapped
This will select the default sys0 and sys1 settings (the serial eeproms are not used). Then power up the board and fix the serial -eeprom using the imm command. Here are the values I currently +eeprom using the 'i2c mm' command. Here are the values I currently use:
-=> imd 50 0 10 +=> i2c md 50 0 10 0000: bf a2 04 01 ae 94 11 00 00 00 00 00 00 00 00 00 ................
-=> imd 54 0 10 +=> i2c md 54 0 10 0000: 8f b3 24 01 4d 14 11 00 00 00 00 00 00 00 00 00 ..$.M...........
Once you have the eeproms set correctly change the @@ -83,8 +83,8 @@ the SPD to initialize the DDR SDRAM control registers. So if the SPD eeprom is corrupted, U-Boot will never get into ram. Here's how I got out of this situation:
-0. First, _before_ playing with the i2c utilities, do an iprobe, then -use imd to capture the various device contents to a file. Some day +0. First, _before_ playing with the i2c utilities, do an 'i2c probe', then +use 'i2c md' to capture the various device contents to a file. Some day you may be glad you did this ... trust me :-). Otherwise try the following:
@@ -100,12 +100,12 @@ settings without using the SPD eeprom.
3. Load the new U-Boot image and reboot ebony.
-4. Repair the SPD eeprom using the imm command. Here's the eeprom +4. Repair the SPD eeprom using the 'i2c mm' command. Here's the eeprom contents that work with the default SO-DIMM that comes with the ebony board (micron 8VDDT164AG-265A1). Note: these are probably _not_ the factory settings ... but they work.
-=> imd 53 0 10 80 +=> i2c md 53 0 10 80 0000: 80 08 07 0c 0a 01 40 00 04 75 75 00 80 08 00 01 ......@..uu..... 0010: 0e 04 0c 01 02 20 00 a0 75 00 00 50 3c 50 2d 20 ..... ..u..P<P- 0020: 90 90 50 50 00 00 00 00 00 41 4b 34 32 75 00 00 ..PP.....AK42u.. diff --git a/doc/README.m52277evb b/doc/README.m52277evb index e002947..bec77b4 100644 --- a/doc/README.m52277evb +++ b/doc/README.m52277evb @@ -204,16 +204,10 @@ erase - erase FLASH memory flinfo - print FLASH memory information go - start application at address 'addr' help - print online help +i2c - I2C sub-system icache - enable or disable instruction cache -icrc32 - checksum calculation -iloop - infinite loop on address range -imd - i2c memory display iminfo - print header information for application image imls - list all images found in flash -imm - i2c memory modify (auto-incrementing) -imw - memory write (fill) -inm - memory modify (constant address) -iprobe - probe to discover valid I2C chip addresses itest - return true/false on integer compare loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line diff --git a/doc/README.m5373evb b/doc/README.m5373evb index 4781d94..0bd1101 100644 --- a/doc/README.m5373evb +++ b/doc/README.m5373evb @@ -215,16 +215,10 @@ erase - erase FLASH memory flinfo - print FLASH memory information go - start application at address 'addr' help - print online help +i2c - I2C sub-system icache - enable or disable instruction cache -icrc32 - checksum calculation -iloop - infinite loop on address range -imd - i2c memory display iminfo - print header information for application image imls - list all images found in flash -imm - i2c memory modify (auto-incrementing) -imw - memory write (fill) -inm - memory modify (constant address) -iprobe - probe to discover valid I2C chip addresses itest - return true/false on integer compare loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line diff --git a/doc/README.m54455evb b/doc/README.m54455evb index f695da5..b769ff9 100644 --- a/doc/README.m54455evb +++ b/doc/README.m54455evb @@ -304,17 +304,11 @@ fsinfo - print information about filesystems fsload - load binary file from a filesystem image go - start application at address 'addr' help - print online help +i2c - I2C sub-system icache - enable or disable instruction cache -icrc32 - checksum calculation ide - IDE sub-system -iloop - infinite loop on address range -imd - i2c memory display iminfo - print header information for application image imls - list all images found in flash -imm - i2c memory modify (auto-incrementing) -imw - memory write (fill) -inm - memory modify (constant address) -iprobe - probe to discover valid I2C chip addresses itest - return true/false on integer compare loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line diff --git a/doc/README.m5475evb b/doc/README.m5475evb index dc9a605..936c018 100644 --- a/doc/README.m5475evb +++ b/doc/README.m5475evb @@ -234,16 +234,10 @@ erase - erase FLASH memory flinfo - print FLASH memory information go - start application at address 'addr' help - print online help +i2c - I2C sub-system icache - enable or disable instruction cache -icrc32 - checksum calculation -iloop - infinite loop on address range -imd - i2c memory display iminfo - print header information for application image imls - list all images found in flash -imm - i2c memory modify (auto-incrementing) -imw - memory write (fill) -inm - memory modify (constant address) -iprobe - probe to discover valid I2C chip addresses itest - return true/false on integer compare loadb - load binary file over serial line (kermit mode) loads - load S-Record file over serial line diff --git a/doc/README.ppc440 b/doc/README.ppc440 index 0a5f99f..1b96458 100644 --- a/doc/README.ppc440 +++ b/doc/README.ppc440 @@ -88,7 +88,7 @@ I2C =================
The i2c utilities have been tested on both Rev B. and Rev C. and -look good. The iprobe command implementation has been updated to +look good. The 'i2c probe' command implementation has been updated to allow for 'skipped' addresses. Some i2c slaves are write only and cause problems when a probe (read) is performed (for example the CDCV850 clock controller at address 0x69 on the ebony board). @@ -97,7 +97,7 @@ To prevent probing certain addresses you can define the CONFIG_SYS_I2C_NOPROBES macro in your board-specific header file. When defined, all specified addresses are skipped during a probe. The addresses that are skipped will be displayed in the output -of the iprobe command. +of the 'i2c probe' command.
For example, to prevent probing address 0x69, define the macro as follows: diff --git a/doc/README.xpedite1k b/doc/README.xpedite1k index 34bba13..1da8b80 100644 --- a/doc/README.xpedite1k +++ b/doc/README.xpedite1k @@ -23,7 +23,7 @@ strappings and the 2 EMAC HW Ethernet addresses. Be careful not to change the 1st page of the EEPROM! Unpopulated jumper J560 can get you out of trouble as it disables the strapping read from EEPROM.
-I2C iprobe +I2C probe =====================
The i2c utilities work and have been tested on Rev B. of the 440GX. See @@ -47,10 +47,10 @@ J560 - closed
This will select the default sys0 and sys1 settings (the serial eeproms are not used). Then power up the board and fix the serial -eeprom using the imm command. Here are the values I currently +eeprom using the 'i2c mm' command. Here are the values I currently use:
-=> imd 50 0 10 +=> i2c md 50 0 10
0000: 85 7d 42 06 07 80 11 00 00 00 00 00 00 00 00 00 .}B.............
diff --git a/drivers/i2c/tsi108_i2c.c b/drivers/i2c/tsi108_i2c.c index fda822c..e768c86 100644 --- a/drivers/i2c/tsi108_i2c.c +++ b/drivers/i2c/tsi108_i2c.c @@ -120,7 +120,7 @@ static int i2c_read_byte ( * chip_addr: I2C chip address, range 0..127 * (to read from SPD channel EEPROM use (0xD0 ... 0xD7) * NOTE: The bit 7 in the chip_addr serves as a channel select. - * This hack is for enabling "isdram" command on Tsi108 boards + * This hack is for enabling "i2c sdram" command on Tsi108 boards * without changes to common code. Used for I2C reads only. * byte_addr: Memory or register address within the chip * alen: Number of bytes to use for addr (typically 1, 2 for larger diff --git a/include/configs/bubinga.h b/include/configs/bubinga.h index dcf5b6d..627060a 100644 --- a/include/configs/bubinga.h +++ b/include/configs/bubinga.h @@ -134,7 +134,7 @@ */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */
-#define CONFIG_SYS_I2C_NOPROBES { 0x69 } /* avoid iprobe hangup (why?) */ +#define CONFIG_SYS_I2C_NOPROBES { 0x69 } /* avoid i2c probe hangup (why?) */ #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 6 /* 24C02 requires 5ms delay */
#if defined(CONFIG_CMD_EEPROM) diff --git a/include/configs/sacsng.h b/include/configs/sacsng.h index f4e08c6..0ab6fc3 100644 --- a/include/configs/sacsng.h +++ b/include/configs/sacsng.h @@ -408,9 +408,9 @@ "echo hostname ${hostname}\0" \ "ana=run adc ; run dac\0" \ "adc=run adc-12 ; run adc-34\0" \ -"adc-12=echo ### ADC-12 ; imd.b e 81 e\0" \ -"adc-34=echo ### ADC-34 ; imd.b f 81 e\0" \ -"dac=echo ### DAC ; imd.b 11 81 5\0" \ +"adc-12=echo ### ADC-12 ; i2c md e 81 e\0" \ +"adc-34=echo ### ADC-34 ; i2c md f 81 e\0" \ +"dac=echo ### DAC ; i2c md 11 81 5\0" \ "boot-hook=echo\0"
/* What should the console's baud rate be? */ diff --git a/include/configs/taihu.h b/include/configs/taihu.h index 8c48c66..836081d 100644 --- a/include/configs/taihu.h +++ b/include/configs/taihu.h @@ -139,7 +139,7 @@ */ #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */
-#define CONFIG_SYS_I2C_NOPROBES { 0x69 } /* avoid iprobe hangup (why?) */ +#define CONFIG_SYS_I2C_NOPROBES { 0x69 } /* avoid i2c probe hangup (why?) */ #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 6 /* 24C02 requires 5ms delay */
#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 /* I2C boot EEPROM (24C02W) */

argc and argv should only be modified once instead of once for every i2c sub-command
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- common/cmd_i2c.c | 52 ++++++++++++++++++++++++++++------------------------ 1 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 0a97f9c..41f6e33 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1274,35 +1274,39 @@ int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { + /* Strip off leading 'i2c' command argument */ + argc--; + argv++; + #if defined(CONFIG_I2C_MUX) - if (!strncmp(argv[1], "bu", 2)) - return do_i2c_add_bus(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "bu", 2)) + return do_i2c_add_bus(cmdtp, flag, argc, argv); #endif /* CONFIG_I2C_MUX */ - if (!strncmp(argv[1], "sp", 2)) - return do_i2c_bus_speed(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "sp", 2)) + return do_i2c_bus_speed(cmdtp, flag, argc, argv); #if defined(CONFIG_I2C_MULTI_BUS) - if (!strncmp(argv[1], "de", 2)) - return do_i2c_bus_num(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "de", 2)) + return do_i2c_bus_num(cmdtp, flag, argc, argv); #endif /* CONFIG_I2C_MULTI_BUS */ - if (!strncmp(argv[1], "md", 2)) - return do_i2c_md(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "mm", 2)) - return do_i2c_mm(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "mw", 2)) - return do_i2c_mw(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "nm", 2)) - return do_i2c_nm(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "cr", 2)) - return do_i2c_crc(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "pr", 2)) - return do_i2c_probe(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "re", 2)) - return do_i2c_reset(cmdtp, flag, --argc, ++argv); - if (!strncmp(argv[1], "lo", 2)) - return do_i2c_loop(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "md", 2)) + return do_i2c_md(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "mm", 2)) + return do_i2c_mm(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "mw", 2)) + return do_i2c_mw(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "nm", 2)) + return do_i2c_nm(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "cr", 2)) + return do_i2c_crc(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "pr", 2)) + return do_i2c_probe(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "re", 2)) + return do_i2c_reset(cmdtp, flag, argc, argv); + if (!strncmp(argv[0], "lo", 2)) + return do_i2c_loop(cmdtp, flag, argc, argv); #if defined(CONFIG_CMD_SDRAM) - if (!strncmp(argv[1], "sd", 2)) - return do_sdram(cmdtp, flag, --argc, ++argv); + if (!strncmp(argv[0], "sd", 2)) + return do_sdram(cmdtp, flag, argc, argv); #endif else cmd_usage(cmdtp);

Signed-off-by: Peter Tyser ptyser@xes-inc.com --- common/cmd_i2c.c | 25 ++++--------------------- 1 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 41f6e33..74a7735 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -130,9 +130,6 @@ DECLARE_GLOBAL_DATA_PTR;
#endif
-static int -mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]); - /* TODO: Implement architecture-specific get/set functions */ unsigned int __def_i2c_get_bus_speed(void) { @@ -257,15 +254,6 @@ int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; }
-int do_i2c_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - return mod_i2c_mem (cmdtp, 1, flag, argc, argv); -} - -int do_i2c_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -{ - return mod_i2c_mem (cmdtp, 0, flag, argc, argv); -}
/* Write (fill) memory * @@ -1199,12 +1187,6 @@ int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } #endif
-int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) -{ - i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); - return 0; -} - #if defined(CONFIG_I2C_MUX) int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { @@ -1291,17 +1273,18 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) if (!strncmp(argv[0], "md", 2)) return do_i2c_md(cmdtp, flag, argc, argv); if (!strncmp(argv[0], "mm", 2)) - return do_i2c_mm(cmdtp, flag, argc, argv); + return mod_i2c_mem (cmdtp, 1, flag, argc, argv); if (!strncmp(argv[0], "mw", 2)) return do_i2c_mw(cmdtp, flag, argc, argv); if (!strncmp(argv[0], "nm", 2)) - return do_i2c_nm(cmdtp, flag, argc, argv); + return mod_i2c_mem (cmdtp, 0, flag, argc, argv); if (!strncmp(argv[0], "cr", 2)) return do_i2c_crc(cmdtp, flag, argc, argv); if (!strncmp(argv[0], "pr", 2)) return do_i2c_probe(cmdtp, flag, argc, argv); if (!strncmp(argv[0], "re", 2)) - return do_i2c_reset(cmdtp, flag, argc, argv); + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + return 0; if (!strncmp(argv[0], "lo", 2)) return do_i2c_loop(cmdtp, flag, argc, argv); #if defined(CONFIG_CMD_SDRAM)

When CONFIG_I2C_MUX was defined the output of 'help i2c' was not correct, eg:
=> help i2c i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes. speed [speed] - show or set I2C bus speed i2c dev [dev] - show or set current I2C bus ...
It has been changed to: i2c speed [speed] - show or set I2C bus speed i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes i2c dev [dev] - show or set current I2C bus ...
Signed-off-by: Peter Tyser ptyser@xes-inc.com --- common/cmd_i2c.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 74a7735..52e7245 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1301,10 +1301,10 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( i2c, 6, 1, do_i2c, "I2C sub-system", + "speed [speed] - show or set I2C bus speed\n" #if defined(CONFIG_I2C_MUX) - "bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes.\n" + "i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes\n" #endif /* CONFIG_I2C_MUX */ - "speed [speed] - show or set I2C bus speed\n" #if defined(CONFIG_I2C_MULTI_BUS) "i2c dev [dev] - show or set current I2C bus\n" #endif /* CONFIG_I2C_MULTI_BUS */

On Thu, Apr 16, 2009 at 2:41 PM, Peter Tyser ptyser@xes-inc.com wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
I reviewed the code briefly, and it looks okay. The general idea is good, so I ACK these patches.

Hello Peter,
Peter Tyser wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Thanks for your work, looks good to me. I make some tests with your patches, and if they are OK, I apply your patches to u-boot-i2c.git.
Hmm.. maybe you can have a look at my posting:
http://lists.denx.de/pipermail/u-boot/2009-March/049506.html
There is a new i2c_core.c file which holds all "common" i2c functions, for example the i2c_[set|get]_bus_speed(). I think such a file is a better place for it.
I wonder I get no response for cleaning up the i2c subsystem ... is here no interest in doing such a cleanup? (I think it is a necessary step ...)
comments are welcome ;-)
bye Heiko

Heiko Schocher wrote:
Hello Peter,
Peter Tyser wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Thanks for your work, looks good to me. I make some tests with your patches, and if they are OK, I apply your patches to u-boot-i2c.git.
Hmm.. maybe you can have a look at my posting:
http://lists.denx.de/pipermail/u-boot/2009-March/049506.html
There is a new i2c_core.c file which holds all "common" i2c functions, for example the i2c_[set|get]_bus_speed(). I think such a file is a better place for it.
I wonder I get no response for cleaning up the i2c subsystem ... is here no interest in doing such a cleanup? (I think it is a necessary step ...)
comments are welcome ;-)
bye Heiko
I am in favor of an i2c cleanup, and also Peter's changeover to the i2c "tree style" fix. I would take the lack of opposition as tacit approval, rather than apathy. Thankfully, the u-boot list isn't made up of a flock of dittoheads (def'n #2): http://www.urbandictionary.com/define.php?term=dittohead
Thanks, gvb

Hello Jerry,
Jerry Van Baren wrote:
Heiko Schocher wrote:
Hello Peter,
Peter Tyser wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Thanks for your work, looks good to me. I make some tests with your patches, and if they are OK, I apply your patches to u-boot-i2c.git.
Hmm.. maybe you can have a look at my posting:
http://lists.denx.de/pipermail/u-boot/2009-March/049506.html
There is a new i2c_core.c file which holds all "common" i2c functions, for example the i2c_[set|get]_bus_speed(). I think such a file is a better place for it.
I wonder I get no response for cleaning up the i2c subsystem ... is here no interest in doing such a cleanup? (I think it is a necessary step ...)
comments are welcome ;-)
bye Heiko
I am in favor of an i2c cleanup, and also Peter's changeover to the i2c "tree style" fix. I would take the lack of opposition as tacit approval, rather than apathy. Thankfully, the u-boot list isn't made up
:-) Ok, so I try to go on with it ...
of a flock of dittoheads (def'n #2): http://www.urbandictionary.com/define.php?term=dittohead
;-)
thanks bye Heiko

Hi Heiko,
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Thanks for your work, looks good to me. I make some tests with your patches, and if they are OK, I apply your patches to u-boot-i2c.git.
Great, thanks.
Hmm.. maybe you can have a look at my posting:
http://lists.denx.de/pipermail/u-boot/2009-March/049506.html
There is a new i2c_core.c file which holds all "common" i2c functions, for example the i2c_[set|get]_bus_speed(). I think such a file is a better place for it.
I agree that the concept of having common i2c functions in common file (and not in cmd_i2c.c) is a good idea. If you want me to rebase my changes on the i2c multibus_v2 tree let me know and I'll move the i2c_[set|get]_bus_speed() to i2c_core.c and resubmit.
While we're discussing the i2c commands, another TODO item could be to transition the new tree-style I2C command to use a cmd_tbl_t instead of the current ifs/strncmp.
I wonder I get no response for cleaning up the i2c subsystem ... is here no interest in doing such a cleanup? (I think it is a necessary step ...)
My guess would be that people aren't making lots of comments because: - Most people don't require the new functionality of the i2c subsystem cleanup with their current hardware, thus they have less of an interest in critiquing it as it doesn't really affect them. They also don't have any hardware to test/play with the new features. - Most people are busy working on changes that do affect their hardware, etc - It takes more effort to review patches that haven't been posted to the mailing list - The original i2c discussion/flameware scared them off:)
Anyway, I agree with Jerry that the added functionality of the i2c subsystem cleanup is good (but can't speak to the implementation), hopefully the lack of comments mean people haven't found anything too objectionable in your changes.
Best, Peter

Hello Peter,
Peter Tyser wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Thanks for your work, looks good to me. I make some tests with your patches, and if they are OK, I apply your patches to u-boot-i2c.git.
Great, thanks.
Sorry, I had no time for it, but hopefully I am ready with it on monday.
Hmm.. maybe you can have a look at my posting:
http://lists.denx.de/pipermail/u-boot/2009-March/049506.html
There is a new i2c_core.c file which holds all "common" i2c functions, for example the i2c_[set|get]_bus_speed(). I think such a file is a better place for it.
I agree that the concept of having common i2c functions in common file (and not in cmd_i2c.c) is a good idea. If you want me to rebase my changes on the i2c multibus_v2 tree let me know and I'll move the i2c_[set|get]_bus_speed() to i2c_core.c and resubmit.
No need for you to do this, because I think, the "new" multibus update must have some time to test, so it takes a while for it to go in main- line.
While we're discussing the i2c commands, another TODO item could be to transition the new tree-style I2C command to use a cmd_tbl_t instead of the current ifs/strncmp.
Yes, thats right, patches are welcome ;-)
I wonder I get no response for cleaning up the i2c subsystem ... is here no interest in doing such a cleanup? (I think it is a necessary step ...)
My guess would be that people aren't making lots of comments because:
- Most people don't require the new functionality of the i2c subsystem
cleanup with their current hardware, thus they have less of an interest in critiquing it as it doesn't really affect them. They also don't have any hardware to test/play with the new features.
It maybe affects them, because also "old" hardware with only one I2C driver should be tested, and I have not all boards for testing ... so it would be nice if some boardmaintainers can do also tests with the new i2c subsystem, and give a little feedback ... preferred feedback: "My board works without problems with the new multibus core" ;-)
- Most people are busy working on changes that do affect their hardware,
etc
Yes, thats probably the biggest reason.
- It takes more effort to review patches that haven't been posted to the
mailing list
Hmm.. sorry for that, but some patches were greater then 100k, because they affected a lot of boards (for example the ppc_4xx i2c driver), so I didn;t post them ... and it is not such a big work to get this patches with git ... but you are right, it is more effort to do this, then just reading an EMail ...
- The original i2c discussion/flameware scared them off:)
Yes, maybe. It was a "hard" discussion ...
Anyway, I agree with Jerry that the added functionality of the i2c subsystem cleanup is good (but can't speak to the implementation), hopefully the lack of comments mean people haven't found anything too objectionable in your changes.
That sounds like a dream ;-)
So I try to hold the to branches in sync with mainline, and maybe I find time to port the missing i2c driver to it, and then I start a second(third) round for it
thanks
bye Heiko

Hello Peter,
Peter Tyser wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Peter Tyser (7): cm5200: Make function test command names more unique cmd_i2c: Create common default i2c_[set|get]_bus_speed() functions cmd_i2c: Remove deprecated individual i2c commands cmd_i2c: Update references to individual i2c commands cmd_i2c: Clean up i2c command argument parsing cmd_i2c: Clean up trivial helper functions cmd_i2c: Fix i2c help command output when CONFIG_I2C_MUX
Changes since v1:
- replaced __attribute references with __attribute__
Applied to u-boot-i2c.git next branch Thanks!
bye Heiko

Hello Peter,
Heiko Schocher wrote:
Peter Tyser wrote:
This patch series removes the "individual" I2C commands (and the CONFIG_I2C_CMD_TREE define) and migrates all boards to the newer "tree style" I2C commands.
A small amount of cleanup was performed before and after removing the individual commands.
Peter Tyser (7): cm5200: Make function test command names more unique cmd_i2c: Create common default i2c_[set|get]_bus_speed() functions cmd_i2c: Remove deprecated individual i2c commands cmd_i2c: Update references to individual i2c commands cmd_i2c: Clean up i2c command argument parsing cmd_i2c: Clean up trivial helper functions cmd_i2c: Fix i2c help command output when CONFIG_I2C_MUX
Changes since v1:
- replaced __attribute references with __attribute__
Applied to u-boot-i2c.git next branch Thanks!
Damned, I should have wait for the "MAKEALL" is finished ... the nearly two last boards showed me the following error:
Configuring for CPCI750 board... cmd_i2c.c: In function 'do_i2c': cmd_i2c.c:1286: error: 'CONFIG_SYS_I2C_SLAVE' undeclared (first use in this function) cmd_i2c.c:1286: error: (Each undeclared identifier is reported only once cmd_i2c.c:1286: error: for each function it appears in.) make[1]: *** [cmd_i2c.o] Fehler 1 make[1]: *** Warte auf noch nicht beendete Prozesse... make: *** [common/libcommon.a] Fehler 2 ppc_82xx-size: './u-boot': No such file Configuring for ELPPC board... text data bss dec hex filename 169744 19652 38320 227716 37984 ./u-boot Configuring for p3mx board... cmd_i2c.c: In function 'do_i2c': cmd_i2c.c:1286: error: 'CONFIG_SYS_I2C_SLAVE' undeclared (first use in this function) cmd_i2c.c:1286: error: (Each undeclared identifier is reported only once cmd_i2c.c:1286: error: for each function it appears in.) make[1]: *** [cmd_i2c.o] Fehler 1 make[1]: *** Warte auf noch nicht beendete Prozesse... make: *** [common/libcommon.a] Fehler 2 ppc_82xx-size: './u-boot': No such file
This is introduced from your patch [PATCH v2 3/7] i2c: Remove deprecated individual i2c commands from your patchseries ... can you please fix this?
thanks Heiko

Damned, I should have wait for the "MAKEALL" is finished ... the nearly two last boards showed me the following error:
Configuring for CPCI750 board... cmd_i2c.c: In function 'do_i2c': cmd_i2c.c:1286: error: 'CONFIG_SYS_I2C_SLAVE' undeclared (first use in this function) cmd_i2c.c:1286: error: (Each undeclared identifier is reported only once cmd_i2c.c:1286: error: for each function it appears in.) make[1]: *** [cmd_i2c.o] Fehler 1 make[1]: *** Warte auf noch nicht beendete Prozesse... make: *** [common/libcommon.a] Fehler 2 ppc_82xx-size: './u-boot': No such file Configuring for ELPPC board... text data bss dec hex filename 169744 19652 38320 227716 37984 ./u-boot Configuring for p3mx board... cmd_i2c.c: In function 'do_i2c': cmd_i2c.c:1286: error: 'CONFIG_SYS_I2C_SLAVE' undeclared (first use in this function) cmd_i2c.c:1286: error: (Each undeclared identifier is reported only once cmd_i2c.c:1286: error: for each function it appears in.) make[1]: *** [cmd_i2c.o] Fehler 1 make[1]: *** Warte auf noch nicht beendete Prozesse... make: *** [common/libcommon.a] Fehler 2 ppc_82xx-size: './u-boot': No such file
Thanks for catching that Heiko. I'll send fixups tomorrow.
Best, Peter
participants (5)
-
Heiko Schocher
-
Jerry Van Baren
-
Mike Frysinger
-
Peter Tyser
-
Timur Tabi