Commit c649dda537a1a585e51066169e6fdb67e2b8f59e

Authored by Stefan Bigler
Committed by Heiko Schocher
1 parent a000b7950d

i2c: add i2c deblock sequence before and after every mux config

To make sure that the mux can be configured a deblocking sequence
is done before the mux configuration. After the mux switch the new leaf
of, the i2c tree must be again deblocked.

Signed-off-by: Stefan Bigler <stefan.bigler@keymile.com>
Acked-by: Heiko Schocher <hs@denx.de>
cc: Wolfgang Denk <wd@denx.de>
cc: Detlev Zundel <dzu@denx.de>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>

Showing 2 changed files with 12 additions and 2 deletions Side-by-side Diff

... ... @@ -132,6 +132,14 @@
132 132  
133 133 #define DISP_LINE_LEN 16
134 134  
  135 +/* implement possible board specific board init */
  136 +void __def_i2c_init_board(void)
  137 +{
  138 + return;
  139 +}
  140 +void i2c_init_board(void)
  141 + __attribute__((weak, alias("__def_i2c_init_board")));
  142 +
135 143 /* TODO: Implement architecture-specific get/set functions */
136 144 unsigned int __def_i2c_get_bus_speed(void)
137 145 {
... ... @@ -1541,6 +1549,8 @@
1541 1549  
1542 1550 mux = dev->mux;
1543 1551 while (mux != NULL) {
  1552 + /* do deblocking on each level of mux, before mux config */
  1553 + i2c_init_board();
1544 1554 if (i2c_write(mux->chip, 0, 0, &mux->channel, 1) != 0) {
1545 1555 printf ("Error setting Mux: chip:%x channel: \
1546 1556 %x\n", mux->chip, mux->channel);
... ... @@ -1548,6 +1558,8 @@
1548 1558 }
1549 1559 mux = mux->next;
1550 1560 }
  1561 + /* do deblocking on each level of mux and after mux config */
  1562 + i2c_init_board();
1551 1563 return 0;
1552 1564 }
1553 1565 #endif /* CONFIG_I2C_MUX */
... ... @@ -108,9 +108,7 @@
108 108 * repeatedly to change the speed and slave addresses.
109 109 */
110 110 void i2c_init(int speed, int slaveaddr);
111   -#ifdef CONFIG_SYS_I2C_INIT_BOARD
112 111 void i2c_init_board(void);
113   -#endif
114 112 #ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
115 113 void i2c_board_late_init(void);
116 114 #endif