scsi: hisi_sas: fix the issue of setting linkrate register
authorXiaofei Tan <tanxiaofei@huawei.com>
Wed, 7 Mar 2018 12:25:08 +0000 (20:25 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Mar 2018 01:55:24 +0000 (21:55 -0400)
It is not right to set the register PROG_PHY_LINK_RATE while PHY is still
enabled. So if we want to change PHY linkrate, we need to disable PHY before
setting the register PROG_PHY_LINK_RATE, and then start-up PHY. This patch
is to fix this issue.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 38bbda938bc1ca3e3d61ea1a37c24945a07a52b2..2eb89806c512d0ce4c76d29653f43e20e3e8530a 100644 (file)
@@ -881,10 +881,11 @@ static void phy_set_linkrate_v1_hw(struct hisi_hba *hisi_hba, int phy_no,
        prog_phy_link_rate &= ~0xff;
        prog_phy_link_rate |= rate_mask;
 
+       disable_phy_v1_hw(hisi_hba, phy_no);
+       msleep(100);
        hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE,
                        prog_phy_link_rate);
-
-       phy_hard_reset_v1_hw(hisi_hba, phy_no);
+       start_phy_v1_hw(hisi_hba, phy_no);
 }
 
 static int get_wideport_bitmap_v1_hw(struct hisi_hba *hisi_hba, int port_id)
index 67be346db239150495770fd87c52fcd3af173939..bd1a48a590bc0db89166dd77ffdfe0a2ec0ca476 100644 (file)
@@ -1611,10 +1611,11 @@ static void phy_set_linkrate_v2_hw(struct hisi_hba *hisi_hba, int phy_no,
        prog_phy_link_rate &= ~0xff;
        prog_phy_link_rate |= rate_mask;
 
+       disable_phy_v2_hw(hisi_hba, phy_no);
+       msleep(100);
        hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE,
                        prog_phy_link_rate);
-
-       phy_hard_reset_v2_hw(hisi_hba, phy_no);
+       start_phy_v2_hw(hisi_hba, phy_no);
 }
 
 static int get_wideport_bitmap_v2_hw(struct hisi_hba *hisi_hba, int port_id)
index 1ee95abda1c5a7d425de57aa5eee4b4b86209381..8da9de7d67e5f779fce18b2e583e56300aabc93a 100644 (file)
@@ -1862,10 +1862,11 @@ static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no,
        prog_phy_link_rate &= ~0xff;
        prog_phy_link_rate |= rate_mask;
 
+       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);
-
-       phy_hard_reset_v3_hw(hisi_hba, phy_no);
+       start_phy_v3_hw(hisi_hba, phy_no);
 }
 
 static void interrupt_disable_v3_hw(struct hisi_hba *hisi_hba)