X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fcmd_i2c.c;h=e79513985924d64da809c3f1201cc24e3b00e0b2;hb=e38cc2c7713c3a6f25b75317bb4ddcf290d33dfd;hp=1283c82afb0c6dae2cd6b286b786dee34f407d74;hpb=7a92e53cd0d8164d518216bebd52679603d6ffe9;p=u-boot diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 1283c82afb..e795139859 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -132,6 +132,14 @@ DECLARE_GLOBAL_DATA_PTR; #define DISP_LINE_LEN 16 +/* implement possible board specific board init */ +void __def_i2c_init_board(void) +{ + return; +} +void i2c_init_board(void) + __attribute__((weak, alias("__def_i2c_init_board"))); + /* TODO: Implement architecture-specific get/set functions */ unsigned int __def_i2c_get_bus_speed(void) { @@ -441,7 +449,6 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg ulong data; int size = 1; int nbytes; - extern char console_buffer[]; if (argc != 3) return cmd_usage(cmdtp); @@ -1201,9 +1208,7 @@ static int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar device = device->next; } } else { - I2C_MUX_DEVICE *dev; - - dev = i2c_mux_ident_muxstring ((uchar *)argv[1]); + (void)i2c_mux_ident_muxstring ((uchar *)argv[1]); ret = 0; } return ret; @@ -1284,10 +1289,19 @@ static cmd_tbl_t cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), }; +#ifdef CONFIG_NEEDS_MANUAL_RELOC +void i2c_reloc(void) { + fixup_cmdtable(cmd_i2c_sub, ARRAY_SIZE(cmd_i2c_sub)); +} +#endif + static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { cmd_tbl_t *c; + if (argc < 2) + return cmd_usage(cmdtp); + /* Strip off leading 'i2c' command argument */ argc--; argv++; @@ -1380,8 +1394,8 @@ static int i2c_mux_get_busid (void) return tmp; } -/* Analyses a Muxstring and sends immediately the - Commands to the Muxes. Runs from Flash. +/* Analyses a Muxstring and immediately sends the + commands to the muxes. Runs from flash. */ int i2c_mux_ident_muxstring_f (uchar *buf) { @@ -1532,6 +1546,8 @@ int i2x_mux_select_mux(int bus) mux = dev->mux; while (mux != NULL) { + /* do deblocking on each level of mux, before mux config */ + i2c_init_board(); if (i2c_write(mux->chip, 0, 0, &mux->channel, 1) != 0) { printf ("Error setting Mux: chip:%x channel: \ %x\n", mux->chip, mux->channel); @@ -1539,6 +1555,8 @@ int i2x_mux_select_mux(int bus) } mux = mux->next; } + /* do deblocking on each level of mux and after mux config */ + i2c_init_board(); return 0; } #endif /* CONFIG_I2C_MUX */