1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

modules/mqnic: software_node struct must be static, just set I2C mux props for all clients instead of attempting to do something dynamic

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich 2023-06-10 20:14:29 -07:00
parent 5638287413
commit 397ea57cbd

View File

@ -44,14 +44,17 @@ static const struct property_entry i2c_mux_props[] = {
{} {}
}; };
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
static const struct software_node i2c_mux_node = {
.properties = i2c_mux_props
};
#endif
static struct i2c_client *create_i2c_client(struct i2c_adapter *adapter, static struct i2c_client *create_i2c_client(struct i2c_adapter *adapter,
const char *type, int addr, const struct property_entry *props) const char *type, int addr)
{ {
struct i2c_client *client; struct i2c_client *client;
struct i2c_board_info board_info; struct i2c_board_info board_info;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
struct software_node sw_node;
#endif
int err; int err;
if (!adapter) if (!adapter)
@ -60,15 +63,11 @@ static struct i2c_client *create_i2c_client(struct i2c_adapter *adapter,
memset(&board_info, 0, sizeof(board_info)); memset(&board_info, 0, sizeof(board_info));
strscpy(board_info.type, type, I2C_NAME_SIZE); strscpy(board_info.type, type, I2C_NAME_SIZE);
board_info.addr = addr; board_info.addr = addr;
if (props) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
memset(&sw_node, 0, sizeof(sw_node)); board_info.swnode = &i2c_mux_node;
sw_node.properties = props;
board_info.swnode = &sw_node;
#else #else
board_info.properties = props; board_info.properties = i2c_mux_props;
#endif #endif
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)
client = i2c_new_client_device(adapter, &board_info); client = i2c_new_client_device(adapter, &board_info);
#else #else
@ -237,19 +236,19 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// IC31 TCA9548 I2C MUX // IC31 TCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x74, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x74);
// IC3 SFP1 // IC3 SFP1
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c02", 0x50);
// IC5 SFP2 // IC5 SFP2
mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 1), "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 1), "24c02", 0x50);
// IC6 SFP3 // IC6 SFP3
mqnic->mod_i2c_client[2] = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c02", 0x50, NULL); mqnic->mod_i2c_client[2] = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c02", 0x50);
// IC8 SFP4 // IC8 SFP4
mqnic->mod_i2c_client[3] = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c02", 0x50, NULL); mqnic->mod_i2c_client[3] = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c02", 0x50);
mqnic->mod_i2c_client_count = 4; mqnic->mod_i2c_client_count = 4;
@ -278,16 +277,16 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U28 TCA9548 I2C MUX // U28 TCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x74, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x74);
// U145 QSFP // U145 QSFP
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c02", 0x50);
// U80 PCA9544 I2C MUX // U80 PCA9544 I2C MUX
mux = create_i2c_client(adapter, "pca9544", 0x75, i2c_mux_props); mux = create_i2c_client(adapter, "pca9544", 0x75);
// U12 I2C EEPROM // U12 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c08", 0x54, NULL); mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c08", 0x54);
mqnic->mod_i2c_client_count = 1; mqnic->mod_i2c_client_count = 1;
@ -323,19 +322,19 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U28 TCA9548 I2C MUX // U28 TCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x74, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x74);
// U145 QSFP1 // U145 QSFP1
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c02", 0x50);
// U123 QSFP2 // U123 QSFP2
mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c02", 0x50);
// U80 PCA9548 I2C MUX // U80 PCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x75, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x75);
// U12 I2C EEPROM // U12 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c08", 0x54, NULL); mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 3), "24c08", 0x54);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -359,16 +358,16 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U28 TCA9546 I2C MUX // U28 TCA9546 I2C MUX
mux = create_i2c_client(adapter, "pca9546", 0x74, i2c_mux_props); mux = create_i2c_client(adapter, "pca9546", 0x74);
// J7 QSFP0 // J7 QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c02", 0x50);
// J9 QSFP1 // J9 QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 1), "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 1), "24c02", 0x50);
// U12 I2C EEPROM // U12 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c08", 0x54, NULL); mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c08", 0x54);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -412,19 +411,19 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U34 TCA9548 I2C MUX // U34 TCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x74, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x74);
// U23 I2C EEPROM // U23 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c08", 0x54, NULL); mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c08", 0x54);
// U135 TCA9548 I2C MUX // U135 TCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x75, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x75);
// P1 SFP0 // P1 SFP0
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 7), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 7), "24c02", 0x50);
// P2 SFP1 // P2 SFP1
mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 6), "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 6), "24c02", 0x50);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -441,7 +440,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
// FPC202 default address 0x0f, module addresses 0x78 and 0x7c // FPC202 default address 0x0f, module addresses 0x78 and 0x7c
// release reset and deassert lpmode // release reset and deassert lpmode
client = create_i2c_client(adapter, "24c02", 0x0f, NULL); client = create_i2c_client(adapter, "24c02", 0x0f);
if (client) { if (client) {
i2c_smbus_write_i2c_block_data(client, 0x08, 1, "\x55"); i2c_smbus_write_i2c_block_data(client, 0x08, 1, "\x55");
@ -451,15 +450,15 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
} }
// QSFP 1 // QSFP 1
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x78, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x78);
// QSFP 2 // QSFP 2
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x7c, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x7c);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
// U94 I2C EEPROM // U94 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c128", 0x57, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c128", 0x57);
break; break;
case MQNIC_BOARD_ID_DK_DEV_AGF014EA: case MQNIC_BOARD_ID_DK_DEV_AGF014EA:
@ -470,7 +469,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U23 I2C EEPROM // U23 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c64", 0x50, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c64", 0x50);
break; break;
case MQNIC_BOARD_ID_DE10_AGILEX: case MQNIC_BOARD_ID_DE10_AGILEX:
@ -481,13 +480,13 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// QSFP-DD A // QSFP-DD A
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// QSFP-DD B // QSFP-DD B
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -513,13 +512,13 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U34 TCA9548 I2C MUX // U34 TCA9548 I2C MUX
mux = create_i2c_client(adapter, "pca9548", 0x70, i2c_mux_props); mux = create_i2c_client(adapter, "pca9548", 0x70);
// QSFP0 // QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 6), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 6), "24c02", 0x50);
// QSFP1 // QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 7), "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 7), "24c02", 0x50);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -530,7 +529,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 2); adapter = mqnic_i2c_adapter_create(mqnic, 2);
// I2C EEPROM // I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c16", 0x50, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c16", 0x50);
break; break;
case MQNIC_BOARD_ID_XUPP3R: case MQNIC_BOARD_ID_XUPP3R:
@ -541,25 +540,25 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// QSFP0 // QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// QSFP1 // QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 2); adapter = mqnic_i2c_adapter_create(mqnic, 2);
// QSFP2 // QSFP2
mqnic->mod_i2c_client[2] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[2] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 3); adapter = mqnic_i2c_adapter_create(mqnic, 3);
// QSFP3 // QSFP3
mqnic->mod_i2c_client[3] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[3] = create_i2c_client(adapter, "24c02", 0x50);
mqnic->mod_i2c_client_count = 4; mqnic->mod_i2c_client_count = 4;
@ -567,7 +566,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 4); adapter = mqnic_i2c_adapter_create(mqnic, 4);
// I2C EEPROM // I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c04", 0x50, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c04", 0x50);
// read MACs from EEPROM // read MACs from EEPROM
init_mac_list_from_eeprom_base_hex(mqnic, mqnic->eeprom_i2c_client, 4, MQNIC_MAX_IF); init_mac_list_from_eeprom_base_hex(mqnic, mqnic->eeprom_i2c_client, 4, MQNIC_MAX_IF);
@ -583,7 +582,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// I2C EEPROM // I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c02", 0x50);
// read MACs from EEPROM // read MACs from EEPROM
init_mac_list_from_eeprom_base(mqnic, mqnic->eeprom_i2c_client, 0, MQNIC_MAX_IF); init_mac_list_from_eeprom_base(mqnic, mqnic->eeprom_i2c_client, 0, MQNIC_MAX_IF);
@ -597,13 +596,13 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// QSFP0 // QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// QSFP1 // QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -611,7 +610,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 2); adapter = mqnic_i2c_adapter_create(mqnic, 2);
// I2C EEPROM // I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c02", 0x50);
// read MACs from EEPROM // read MACs from EEPROM
init_mac_list_from_eeprom_base(mqnic, mqnic->eeprom_i2c_client, 0, MQNIC_MAX_IF); init_mac_list_from_eeprom_base(mqnic, mqnic->eeprom_i2c_client, 0, MQNIC_MAX_IF);
@ -625,13 +624,13 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// QSFP0 // QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// QSFP1 // QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -639,7 +638,7 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 2); adapter = mqnic_i2c_adapter_create(mqnic, 2);
// I2C EEPROM // I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c256", 0x50, NULL); mqnic->eeprom_i2c_client = create_i2c_client(adapter, "24c256", 0x50);
// read MACs from EEPROM // read MACs from EEPROM
// init_mac_list_from_eeprom(mqnic, mqnic->eeprom_i2c_client, 0x000E, MQNIC_MAX_IF); // init_mac_list_from_eeprom(mqnic, mqnic->eeprom_i2c_client, 0x000E, MQNIC_MAX_IF);
@ -653,25 +652,25 @@ static int mqnic_generic_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// QSFP0 // QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// QSFP1 // QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 2); adapter = mqnic_i2c_adapter_create(mqnic, 2);
// QSFP2 // QSFP2
mqnic->mod_i2c_client[2] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[2] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 3); adapter = mqnic_i2c_adapter_create(mqnic, 3);
// QSFP3 // QSFP3
mqnic->mod_i2c_client[3] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[3] = create_i2c_client(adapter, "24c02", 0x50);
mqnic->mod_i2c_client_count = 4; mqnic->mod_i2c_client_count = 4;
@ -801,16 +800,16 @@ static int mqnic_alveo_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// U28 TCA9546 I2C MUX // U28 TCA9546 I2C MUX
mux = create_i2c_client(adapter, "pca9546", 0x74, i2c_mux_props); mux = create_i2c_client(adapter, "pca9546", 0x74);
// J7 QSFP0 // J7 QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(get_i2c_mux_channel(mux, 0), "24c02", 0x50);
// J9 QSFP1 // J9 QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 1), "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(get_i2c_mux_channel(mux, 1), "24c02", 0x50);
// U12 I2C EEPROM // U12 I2C EEPROM
mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c08", 0x54, NULL); mqnic->eeprom_i2c_client = create_i2c_client(get_i2c_mux_channel(mux, 2), "24c08", 0x54);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;
@ -979,13 +978,13 @@ static int mqnic_gecko_board_init(struct mqnic_dev *mqnic)
adapter = mqnic_i2c_adapter_create(mqnic, 0); adapter = mqnic_i2c_adapter_create(mqnic, 0);
// QSFP0 // QSFP0
mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[0] = create_i2c_client(adapter, "24c02", 0x50);
// I2C adapter // I2C adapter
adapter = mqnic_i2c_adapter_create(mqnic, 1); adapter = mqnic_i2c_adapter_create(mqnic, 1);
// QSFP1 // QSFP1
mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50, NULL); mqnic->mod_i2c_client[1] = create_i2c_client(adapter, "24c02", 0x50);
mqnic->mod_i2c_client_count = 2; mqnic->mod_i2c_client_count = 2;