aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
diff options
context:
space:
mode:
authorJohn Garry <john.garry@huawei.com>2018-05-21 18:09:13 +0800
committerMartin K. Petersen <martin.petersen@oracle.com>2018-05-28 22:40:31 -0400
commit757db2dae2c79b1f713043fcc13542683963fa82 (patch)
tree729057109aa8fd2da7565b9daf6aa95d42b8a4a9 /drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
parentscsi: hisi_sas: fix a typo in hisi_sas_task_prep() (diff)
downloadlinux-dev-757db2dae2c79b1f713043fcc13542683963fa82.tar.xz
linux-dev-757db2dae2c79b1f713043fcc13542683963fa82.zip
scsi: hisi_sas: Introduce hisi_sas_phy_set_linkrate()
There is much common code and functionality between the HW versions to set the PHY linkrate. As such, this patch factors out the common code into a generic function hisi_sas_phy_set_linkrate(). Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/hisi_sas/hisi_sas_v3_hw.c')
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_v3_hw.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index c013673ee8ac..0a80a39eccdd 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -1879,29 +1879,12 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba)
static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no,
struct sas_phy_linkrates *r)
{
- struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
- struct asd_sas_phy *sas_phy = &phy->sas_phy;
- enum sas_linkrate min, max;
+ enum sas_linkrate max = r->maximum_linkrate;
u32 prog_phy_link_rate = 0x800;
- if (r->maximum_linkrate == SAS_LINK_RATE_UNKNOWN) {
- max = sas_phy->phy->maximum_linkrate;
- min = r->minimum_linkrate;
- } else if (r->minimum_linkrate == SAS_LINK_RATE_UNKNOWN) {
- max = r->maximum_linkrate;
- min = sas_phy->phy->minimum_linkrate;
- } else
- return;
-
- sas_phy->phy->maximum_linkrate = max;
- sas_phy->phy->minimum_linkrate = min;
prog_phy_link_rate |= hisi_sas_get_prog_phy_linkrate_mask(max);
-
- disable_phy_v3_hw(hisi_hba, phy_no);
- msleep(100);
hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE,
- prog_phy_link_rate);
- start_phy_v3_hw(hisi_hba, phy_no);
+ prog_phy_link_rate);
}
static void interrupt_disable_v3_hw(struct hisi_hba *hisi_hba)