Now that this is always 0, remove it and the associated dead code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
CFG_SYS_I2C_DIRECT_BUS
define this, if you don't use i2c muxes on your hardware.
- if CFG_SYS_I2C_MAX_HOPS is not defined or == 0 you can
- omit this define.
-
- CFG_SYS_I2C_MAX_HOPS
- define how many muxes are maximal consecutively connected
- on one i2c bus. If you not use i2c muxes, omit this
- define.
CFG_SYS_I2C_BUSES
hold a list of buses you want to use, only used if
CFG_SYS_I2C_DIRECT_BUS is not defined, for example
- a board with CFG_SYS_I2C_MAX_HOPS = 1 and
- CFG_SYS_NUM_I2C_BUSES = 9:
+ a board with CFG_SYS_NUM_I2C_BUSES = 9:
CFG_SYS_I2C_BUSES {{0, {I2C_NULL_HOP}}, \
{0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \
for (i = 0; i < CFG_SYS_NUM_I2C_BUSES; i++) {
printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CFG_SYS_I2C_DIRECT_BUS
- int j;
-
- for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
- if (i2c_bus[i].next_hop[j].chip == 0)
- break;
- printf("->%s@0x%2x:%d",
- i2c_bus[i].next_hop[j].mux.name,
- i2c_bus[i].next_hop[j].chip,
- i2c_bus[i].next_hop[j].channel);
- }
-#endif
printf("\n");
}
#endif
return -1;
}
printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CFG_SYS_I2C_DIRECT_BUS
- int j;
- for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
- if (i2c_bus[i].next_hop[j].chip == 0)
- break;
- printf("->%s@0x%2x:%d",
- i2c_bus[i].next_hop[j].mux.name,
- i2c_bus[i].next_hop[j].chip,
- i2c_bus[i].next_hop[j].channel);
- }
-#endif
printf("\n");
#endif
}
struct i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
int i;
- /* Connect requested bus if behind muxes */
- if (i2c_bus_tmp->next_hop[0].chip != 0) {
- /* Set all muxes along the path to that bus */
- for (i = 0; i < CFG_SYS_I2C_MAX_HOPS; i++) {
- int ret;
-
- if (i2c_bus_tmp->next_hop[i].chip == 0)
- break;
-
- ret = i2c_mux_set(I2C_ADAP,
- i2c_bus_tmp->next_hop[i].mux.id,
- i2c_bus_tmp->next_hop[i].chip,
- i2c_bus_tmp->next_hop[i].channel);
- if (ret != 0)
- return ret;
- }
- }
return 0;
}
if (I2C_ADAP->init_done == 0)
return 0;
- /* Disconnect current bus (turn off muxes if any) */
- if ((i2c_bus_tmp->next_hop[0].chip != 0) &&
- (I2C_ADAP->init_done != 0)) {
- i = CFG_SYS_I2C_MAX_HOPS;
- do {
- uint8_t chip;
- int ret;
-
- chip = i2c_bus_tmp->next_hop[--i].chip;
- if (chip == 0)
- continue;
-
- ret = I2C_ADAP->write(I2C_ADAP, chip, 0, 0, &buf, 1);
- if (ret != 0) {
- printf("i2c: mux disconnect error\n");
- return ret;
- }
- } while (i > 0);
- }
-
return 0;
}
#endif
*/
#define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */
-#if !defined(CFG_SYS_I2C_MAX_HOPS)
/* no muxes used bus = i2c adapters */
#define CFG_SYS_I2C_DIRECT_BUS 1
-#define CFG_SYS_I2C_MAX_HOPS 0
#define CFG_SYS_NUM_I2C_BUSES ll_entry_count(struct i2c_adapter, i2c)
-#else
-/* we use i2c muxes */
-#undef CFG_SYS_I2C_DIRECT_BUS
-#endif
struct i2c_adapter {
void (*init)(struct i2c_adapter *adap, int speed,
struct i2c_bus_hose {
int adapter;
- struct i2c_next_hop next_hop[CFG_SYS_I2C_MAX_HOPS];
};
#define I2C_NULL_HOP {{-1, ""}, 0, 0}
extern struct i2c_bus_hose i2c_bus[];