Skip to content

Commit 9ce8439

Browse files
Shalom Toledodavem330
authored andcommitted
mlxsw: reg: Add new port type-speed fields for PTYS register
PTYS register introduces a new layout for port type-speed fields. These fields extend the existing ones in order to handle more types and speeds. For example, the new 200Gbps speed. Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1dc3c0a commit 9ce8439

File tree

1 file changed

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

1 file changed

+57
-0
lines changed

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3971,6 +3971,25 @@ enum {
39713971
*/
39723972
MLXSW_ITEM32(reg, ptys, an_status, 0x04, 28, 4);
39733973

3974+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_SGMII_100M BIT(0)
3975+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_1000BASE_X_SGMII BIT(1)
3976+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_2_5GBASE_X_2_5GMII BIT(2)
3977+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_5GBASE_R BIT(3)
3978+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_XFI_XAUI_1_10G BIT(4)
3979+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_XLAUI_4_XLPPI_4_40G BIT(5)
3980+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_25GAUI_1_25GBASE_CR_KR BIT(6)
3981+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_50GAUI_2_LAUI_2_50GBASE_CR2_KR2 BIT(7)
3982+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_50GAUI_1_LAUI_1_50GBASE_CR_KR BIT(8)
3983+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_CAUI_4_100GBASE_CR4_KR4 BIT(9)
3984+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_100GAUI_2_100GBASE_CR2_KR2 BIT(10)
3985+
#define MLXSW_REG_PTYS_EXT_ETH_SPEED_200GAUI_4_200GBASE_CR4_KR4 BIT(12)
3986+
3987+
/* reg_ptys_ext_eth_proto_cap
3988+
* Extended Ethernet port supported speeds and protocols.
3989+
* Access: RO
3990+
*/
3991+
MLXSW_ITEM32(reg, ptys, ext_eth_proto_cap, 0x08, 0, 32);
3992+
39743993
#define MLXSW_REG_PTYS_ETH_SPEED_SGMII BIT(0)
39753994
#define MLXSW_REG_PTYS_ETH_SPEED_1000BASE_KX BIT(1)
39763995
#define MLXSW_REG_PTYS_ETH_SPEED_10GBASE_CX4 BIT(2)
@@ -4025,6 +4044,12 @@ MLXSW_ITEM32(reg, ptys, ib_link_width_cap, 0x10, 16, 16);
40254044
*/
40264045
MLXSW_ITEM32(reg, ptys, ib_proto_cap, 0x10, 0, 16);
40274046

4047+
/* reg_ptys_ext_eth_proto_admin
4048+
* Extended speed and protocol to set port to.
4049+
* Access: RW
4050+
*/
4051+
MLXSW_ITEM32(reg, ptys, ext_eth_proto_admin, 0x14, 0, 32);
4052+
40284053
/* reg_ptys_eth_proto_admin
40294054
* Speed and protocol to set port to.
40304055
* Access: RW
@@ -4043,6 +4068,12 @@ MLXSW_ITEM32(reg, ptys, ib_link_width_admin, 0x1C, 16, 16);
40434068
*/
40444069
MLXSW_ITEM32(reg, ptys, ib_proto_admin, 0x1C, 0, 16);
40454070

4071+
/* reg_ptys_ext_eth_proto_oper
4072+
* The extended current speed and protocol configured for the port.
4073+
* Access: RO
4074+
*/
4075+
MLXSW_ITEM32(reg, ptys, ext_eth_proto_oper, 0x20, 0, 32);
4076+
40464077
/* reg_ptys_eth_proto_oper
40474078
* The current speed and protocol configured for the port.
40484079
* Access: RO
@@ -4089,6 +4120,16 @@ static inline void mlxsw_reg_ptys_eth_pack(char *payload, u8 local_port,
40894120
mlxsw_reg_ptys_an_disable_admin_set(payload, !autoneg);
40904121
}
40914122

4123+
static inline void mlxsw_reg_ptys_ext_eth_pack(char *payload, u8 local_port,
4124+
u32 proto_admin, bool autoneg)
4125+
{
4126+
MLXSW_REG_ZERO(ptys, payload);
4127+
mlxsw_reg_ptys_local_port_set(payload, local_port);
4128+
mlxsw_reg_ptys_proto_mask_set(payload, MLXSW_REG_PTYS_PROTO_MASK_ETH);
4129+
mlxsw_reg_ptys_ext_eth_proto_admin_set(payload, proto_admin);
4130+
mlxsw_reg_ptys_an_disable_admin_set(payload, !autoneg);
4131+
}
4132+
40924133
static inline void mlxsw_reg_ptys_eth_unpack(char *payload,
40934134
u32 *p_eth_proto_cap,
40944135
u32 *p_eth_proto_admin,
@@ -4105,6 +4146,22 @@ static inline void mlxsw_reg_ptys_eth_unpack(char *payload,
41054146
mlxsw_reg_ptys_eth_proto_oper_get(payload);
41064147
}
41074148

4149+
static inline void mlxsw_reg_ptys_ext_eth_unpack(char *payload,
4150+
u32 *p_eth_proto_cap,
4151+
u32 *p_eth_proto_admin,
4152+
u32 *p_eth_proto_oper)
4153+
{
4154+
if (p_eth_proto_cap)
4155+
*p_eth_proto_cap =
4156+
mlxsw_reg_ptys_ext_eth_proto_cap_get(payload);
4157+
if (p_eth_proto_admin)
4158+
*p_eth_proto_admin =
4159+
mlxsw_reg_ptys_ext_eth_proto_admin_get(payload);
4160+
if (p_eth_proto_oper)
4161+
*p_eth_proto_oper =
4162+
mlxsw_reg_ptys_ext_eth_proto_oper_get(payload);
4163+
}
4164+
41084165
static inline void mlxsw_reg_ptys_ib_pack(char *payload, u8 local_port,
41094166
u16 proto_admin, u16 link_width)
41104167
{

0 commit comments

Comments
 (0)