From 2fe50ef4034b69b45413108dd3e736de2548c04a Mon Sep 17 00:00:00 2001 From: Mark Tomlinson Date: Tue, 2 Dec 2014 08:49:18 +1300 Subject: i2c: Fix deselection of muxes Due to an uninitialised variable, when muxes were deselected, any value could be written to the mux control register. On the PCA9548, this could result in multiple channels being selected, thus enabling multiple pull-up resistors, and much bus capacitance. The fix is simply to initialise the written value to zero. Signed-off-by: Mark Tomlinson --- drivers/i2c/i2c_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c index d34b749..4539667 100644 --- a/drivers/i2c/i2c_core.c +++ b/drivers/i2c/i2c_core.c @@ -178,7 +178,7 @@ static int i2c_mux_disconnet_all(void) { struct i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS]; int i; - uint8_t buf; + uint8_t buf = 0; if (I2C_ADAP->init_done == 0) return 0; -- cgit v1.1 From f4ed36964a7ab4e729d62e96dac15a674dcc2668 Mon Sep 17 00:00:00 2001 From: Mark Tomlinson Date: Tue, 2 Dec 2014 08:49:19 +1300 Subject: i2c: Correct spelling error "diconnect" and "disconnet" should both be "disconnect". Signed-off-by: Mark Tomlinson --- drivers/i2c/i2c_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c index 4539667..41cc3b8 100644 --- a/drivers/i2c/i2c_core.c +++ b/drivers/i2c/i2c_core.c @@ -174,7 +174,7 @@ static int i2c_mux_set_all(void) return 0; } -static int i2c_mux_disconnet_all(void) +static int i2c_mux_disconnect_all(void) { struct i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS]; int i; @@ -197,7 +197,7 @@ static int i2c_mux_disconnet_all(void) ret = I2C_ADAP->write(I2C_ADAP, chip, 0, 0, &buf, 1); if (ret != 0) { - printf("i2c: mux diconnect error\n"); + printf("i2c: mux disconnect error\n"); return ret; } } while (i > 0); @@ -293,7 +293,7 @@ int i2c_set_bus_num(unsigned int bus) } #ifndef CONFIG_SYS_I2C_DIRECT_BUS - i2c_mux_disconnet_all(); + i2c_mux_disconnect_all(); #endif gd->cur_i2c_bus = bus; -- cgit v1.1