Skip to content

Commit e6dbab4

Browse files
Amit Cohendavem330
authored andcommitted
mlxsw: Extend MRSR pack() function to support new commands
Currently mlxsw_reg_mrsr_pack() always sets 'command=1'. As preparation for support of new reset flow, pass the command as an argument to the function and add an enum for this field. For now, always pass 'command=1' to the pack() function. Signed-off-by: Amit Cohen <[email protected]> Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0a5ef95 commit e6dbab4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci,
14911491
return err;
14921492
}
14931493

1494-
mlxsw_reg_mrsr_pack(mrsr_pl);
1494+
mlxsw_reg_mrsr_pack(mrsr_pl, MLXSW_REG_MRSR_COMMAND_SOFTWARE_RESET);
14951495
err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl);
14961496
if (err)
14971497
return err;

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10122,6 +10122,15 @@ mlxsw_reg_mgir_unpack(char *payload, u32 *hw_rev, char *fw_info_psid,
1012210122

1012310123
MLXSW_REG_DEFINE(mrsr, MLXSW_REG_MRSR_ID, MLXSW_REG_MRSR_LEN);
1012410124

10125+
enum mlxsw_reg_mrsr_command {
10126+
/* Switch soft reset, does not reset PCI firmware. */
10127+
MLXSW_REG_MRSR_COMMAND_SOFTWARE_RESET = 1,
10128+
/* Reset will be done when PCI link will be disabled.
10129+
* This command will reset PCI firmware also.
10130+
*/
10131+
MLXSW_REG_MRSR_COMMAND_RESET_AT_PCI_DISABLE = 6,
10132+
};
10133+
1012510134
/* reg_mrsr_command
1012610135
* Reset/shutdown command
1012710136
* 0 - do nothing
@@ -10130,10 +10139,11 @@ MLXSW_REG_DEFINE(mrsr, MLXSW_REG_MRSR_ID, MLXSW_REG_MRSR_LEN);
1013010139
*/
1013110140
MLXSW_ITEM32(reg, mrsr, command, 0x00, 0, 4);
1013210141

10133-
static inline void mlxsw_reg_mrsr_pack(char *payload)
10142+
static inline void mlxsw_reg_mrsr_pack(char *payload,
10143+
enum mlxsw_reg_mrsr_command command)
1013410144
{
1013510145
MLXSW_REG_ZERO(mrsr, payload);
10136-
mlxsw_reg_mrsr_command_set(payload, 1);
10146+
mlxsw_reg_mrsr_command_set(payload, command);
1013710147
}
1013810148

1013910149
/* MLCR - Management LED Control Register

0 commit comments

Comments
 (0)