Skip to content

Commit

Permalink
mlxsw: Extend MRSR pack() function to support new commands
Browse files Browse the repository at this point in the history
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 <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Amit Cohen authored and David S. Miller committed Nov 18, 2023
1 parent 0a5ef95 commit e6dbab4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlxsw/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci,
return err;
}

mlxsw_reg_mrsr_pack(mrsr_pl);
mlxsw_reg_mrsr_pack(mrsr_pl, MLXSW_REG_MRSR_COMMAND_SOFTWARE_RESET);
err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl);
if (err)
return err;
Expand Down
14 changes: 12 additions & 2 deletions drivers/net/ethernet/mellanox/mlxsw/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -10122,6 +10122,15 @@ mlxsw_reg_mgir_unpack(char *payload, u32 *hw_rev, char *fw_info_psid,

MLXSW_REG_DEFINE(mrsr, MLXSW_REG_MRSR_ID, MLXSW_REG_MRSR_LEN);

enum mlxsw_reg_mrsr_command {
/* Switch soft reset, does not reset PCI firmware. */
MLXSW_REG_MRSR_COMMAND_SOFTWARE_RESET = 1,
/* Reset will be done when PCI link will be disabled.
* This command will reset PCI firmware also.
*/
MLXSW_REG_MRSR_COMMAND_RESET_AT_PCI_DISABLE = 6,
};

/* reg_mrsr_command
* Reset/shutdown command
* 0 - do nothing
Expand All @@ -10130,10 +10139,11 @@ MLXSW_REG_DEFINE(mrsr, MLXSW_REG_MRSR_ID, MLXSW_REG_MRSR_LEN);
*/
MLXSW_ITEM32(reg, mrsr, command, 0x00, 0, 4);

static inline void mlxsw_reg_mrsr_pack(char *payload)
static inline void mlxsw_reg_mrsr_pack(char *payload,
enum mlxsw_reg_mrsr_command command)
{
MLXSW_REG_ZERO(mrsr, payload);
mlxsw_reg_mrsr_command_set(payload, 1);
mlxsw_reg_mrsr_command_set(payload, command);
}

/* MLCR - Management LED Control Register
Expand Down

0 comments on commit e6dbab4

Please sign in to comment.