Skip to content

Commit 7ca3699

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
mlxsw: reg: Add MCIA register for cable info access
The MCIA register is used to access the SFP+ and QSFP connector's EPROM. It will be used to query the cable info. Signed-off-by: Arkadi Sharshevsky <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4071bd8 commit 7ca3699

File tree

1 file changed

+76
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+76
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5491,6 +5491,81 @@ static inline void mlxsw_reg_mtmp_unpack(char *payload, unsigned int *p_temp,
54915491
mlxsw_reg_mtmp_sensor_name_memcpy_from(payload, sensor_name);
54925492
}
54935493

5494+
/* MCIA - Management Cable Info Access
5495+
* -----------------------------------
5496+
* MCIA register is used to access the SFP+ and QSFP connector's EPROM.
5497+
*/
5498+
5499+
#define MLXSW_REG_MCIA_ID 0x9014
5500+
#define MLXSW_REG_MCIA_LEN 0x40
5501+
5502+
MLXSW_REG_DEFINE(mcia, MLXSW_REG_MCIA_ID, MLXSW_REG_MCIA_LEN);
5503+
5504+
/* reg_mcia_l
5505+
* Lock bit. Setting this bit will lock the access to the specific
5506+
* cable. Used for updating a full page in a cable EPROM. Any access
5507+
* other then subsequence writes will fail while the port is locked.
5508+
* Access: RW
5509+
*/
5510+
MLXSW_ITEM32(reg, mcia, l, 0x00, 31, 1);
5511+
5512+
/* reg_mcia_module
5513+
* Module number.
5514+
* Access: Index
5515+
*/
5516+
MLXSW_ITEM32(reg, mcia, module, 0x00, 16, 8);
5517+
5518+
/* reg_mcia_status
5519+
* Module status.
5520+
* Access: RO
5521+
*/
5522+
MLXSW_ITEM32(reg, mcia, status, 0x00, 0, 8);
5523+
5524+
/* reg_mcia_i2c_device_address
5525+
* I2C device address.
5526+
* Access: RW
5527+
*/
5528+
MLXSW_ITEM32(reg, mcia, i2c_device_address, 0x04, 24, 8);
5529+
5530+
/* reg_mcia_page_number
5531+
* Page number.
5532+
* Access: RW
5533+
*/
5534+
MLXSW_ITEM32(reg, mcia, page_number, 0x04, 16, 8);
5535+
5536+
/* reg_mcia_device_address
5537+
* Device address.
5538+
* Access: RW
5539+
*/
5540+
MLXSW_ITEM32(reg, mcia, device_address, 0x04, 0, 16);
5541+
5542+
/* reg_mcia_size
5543+
* Number of bytes to read/write (up to 48 bytes).
5544+
* Access: RW
5545+
*/
5546+
MLXSW_ITEM32(reg, mcia, size, 0x08, 0, 16);
5547+
5548+
#define MLXSW_SP_REG_MCIA_EEPROM_SIZE 48
5549+
5550+
/* reg_mcia_eeprom
5551+
* Bytes to read/write.
5552+
* Access: RW
5553+
*/
5554+
MLXSW_ITEM_BUF(reg, mcia, eeprom, 0x10, MLXSW_SP_REG_MCIA_EEPROM_SIZE);
5555+
5556+
static inline void mlxsw_reg_mcia_pack(char *payload, u8 module, u8 lock,
5557+
u8 page_number, u16 device_addr,
5558+
u8 size, u8 i2c_device_addr)
5559+
{
5560+
MLXSW_REG_ZERO(mcia, payload);
5561+
mlxsw_reg_mcia_module_set(payload, module);
5562+
mlxsw_reg_mcia_l_set(payload, lock);
5563+
mlxsw_reg_mcia_page_number_set(payload, page_number);
5564+
mlxsw_reg_mcia_device_address_set(payload, device_addr);
5565+
mlxsw_reg_mcia_size_set(payload, size);
5566+
mlxsw_reg_mcia_i2c_device_address_set(payload, i2c_device_addr);
5567+
}
5568+
54945569
/* MPAT - Monitoring Port Analyzer Table
54955570
* -------------------------------------
54965571
* MPAT Register is used to query and configure the Switch PortAnalyzer Table.
@@ -6433,6 +6508,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
64336508
MLXSW_REG(mfsl),
64346509
MLXSW_REG(mtcap),
64356510
MLXSW_REG(mtmp),
6511+
MLXSW_REG(mcia),
64366512
MLXSW_REG(mpat),
64376513
MLXSW_REG(mpar),
64386514
MLXSW_REG(mlcr),

0 commit comments

Comments
 (0)