.. | .. |
---|
207 | 207 | */ |
---|
208 | 208 | #define SFP_PHY_ADDR 22 |
---|
209 | 209 | |
---|
| 210 | +/* SFP_EEPROM_BLOCK_SIZE is the size of data chunk to read the EEPROM |
---|
| 211 | + * at a time. Some SFP modules and also some Linux I2C drivers do not like |
---|
| 212 | + * reads longer than 16 bytes. |
---|
| 213 | + */ |
---|
| 214 | +#define SFP_EEPROM_BLOCK_SIZE 16 |
---|
| 215 | + |
---|
210 | 216 | struct sff_data { |
---|
211 | 217 | unsigned int gpios; |
---|
212 | 218 | bool (*module_supported)(const struct sfp_eeprom_id *id); |
---|
.. | .. |
---|
1754 | 1760 | u8 check; |
---|
1755 | 1761 | int ret; |
---|
1756 | 1762 | |
---|
1757 | | - /* Some SFP modules and also some Linux I2C drivers do not like reads |
---|
1758 | | - * longer than 16 bytes, so read the EEPROM in chunks of 16 bytes at |
---|
1759 | | - * a time. |
---|
1760 | | - */ |
---|
1761 | | - sfp->i2c_block_size = 16; |
---|
| 1763 | + sfp->i2c_block_size = SFP_EEPROM_BLOCK_SIZE; |
---|
1762 | 1764 | |
---|
1763 | 1765 | ret = sfp_read(sfp, false, 0, &id.base, sizeof(id.base)); |
---|
1764 | 1766 | if (ret < 0) { |
---|
.. | .. |
---|
2385 | 2387 | return ERR_PTR(-ENOMEM); |
---|
2386 | 2388 | |
---|
2387 | 2389 | sfp->dev = dev; |
---|
| 2390 | + sfp->i2c_block_size = SFP_EEPROM_BLOCK_SIZE; |
---|
2388 | 2391 | |
---|
2389 | 2392 | mutex_init(&sfp->sm_mutex); |
---|
2390 | 2393 | mutex_init(&sfp->st_mutex); |
---|