Skip to content

Commit 8d9da46

Browse files
Amit Cohendavem330
authored andcommitted
mlxsw: pci: Move software reset code to a separate function
In general, the existing flow of software reset in the driver is: 1. Wait for system ready status. 2. Send MRSR command, to start the reset. 3. Wait for system ready status. This flow will be extended once a new reset command is supported. As a preparation, move step #2 to a separate 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 bdf85f3 commit 8d9da46

File tree

1 file changed

+9
-3
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,11 +1476,18 @@ static int mlxsw_pci_sys_ready_wait(struct mlxsw_pci *mlxsw_pci,
14761476
return -EBUSY;
14771477
}
14781478

1479+
static int mlxsw_pci_reset_sw(struct mlxsw_pci *mlxsw_pci)
1480+
{
1481+
char mrsr_pl[MLXSW_REG_MRSR_LEN];
1482+
1483+
mlxsw_reg_mrsr_pack(mrsr_pl, MLXSW_REG_MRSR_COMMAND_SOFTWARE_RESET);
1484+
return mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl);
1485+
}
1486+
14791487
static int
14801488
mlxsw_pci_reset(struct mlxsw_pci *mlxsw_pci, const struct pci_device_id *id)
14811489
{
14821490
struct pci_dev *pdev = mlxsw_pci->pdev;
1483-
char mrsr_pl[MLXSW_REG_MRSR_LEN];
14841491
u32 sys_status;
14851492
int err;
14861493

@@ -1491,8 +1498,7 @@ mlxsw_pci_reset(struct mlxsw_pci *mlxsw_pci, const struct pci_device_id *id)
14911498
return err;
14921499
}
14931500

1494-
mlxsw_reg_mrsr_pack(mrsr_pl, MLXSW_REG_MRSR_COMMAND_SOFTWARE_RESET);
1495-
err = mlxsw_reg_write(mlxsw_pci->core, MLXSW_REG(mrsr), mrsr_pl);
1501+
err = mlxsw_pci_reset_sw(mlxsw_pci);
14961502
if (err)
14971503
return err;
14981504

0 commit comments

Comments
 (0)