scsi: ufs: introduce common function to disable host TX LCC
authorStanley Chu <stanley.chu@mediatek.com>
Fri, 7 Feb 2020 07:03:57 +0000 (15:03 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 13 Feb 2020 00:27:16 +0000 (19:27 -0500)
Many vendors would like to disable host TX LCC during initialization
flow. Introduce a common function for all users to make drivers easier to
read and maintained. This patch does not change any functionality.

Link: https://lore.kernel.org/r/20200207070357.17169-3-stanley.chu@mediatek.com
Reviewed-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/cdns-pltfrm.c
drivers/scsi/ufs/ufs-hisi.c
drivers/scsi/ufs/ufs-mediatek.c
drivers/scsi/ufs/ufs-qcom.c
drivers/scsi/ufs/ufshcd-pci.c
drivers/scsi/ufs/ufshcd.h

index 56a6a1ed5ec2eb8263199fa8467473018362ccdd..da065a259f6e4ea9b09e92597ba4046919516922 100644 (file)
@@ -192,7 +192,7 @@ static int cdns_ufs_link_startup_notify(struct ufs_hba *hba,
         * and device TX LCC are disabled once link startup is
         * completed.
         */
-       ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0);
+       ufshcd_disable_host_tx_lcc(hba);
 
        /*
         * Disabling Autohibern8 feature in cadence UFS
index 5d6487350a6c9199f4a3067d4dbf523a3d5bc4fe..074a6a055a4c06134241db6b03fa57e14a0b0a7a 100644 (file)
@@ -235,7 +235,7 @@ static int ufs_hisi_link_startup_pre_change(struct ufs_hba *hba)
        ufshcd_writel(hba, reg, REG_AUTO_HIBERNATE_IDLE_TIMER);
 
        /* Unipro PA_Local_TX_LCC_Enable */
-       ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0x155E, 0x0), 0x0);
+       ufshcd_disable_host_tx_lcc(hba);
        /* close Unipro VS_Mk2ExtnSupport */
        ufshcd_dme_set(hba, UIC_ARG_MIB_SEL(0xD0AB, 0x0), 0x0);
        ufshcd_dme_get(hba, UIC_ARG_MIB_SEL(0xD0AB, 0x0), &value);
index 8f73c860f423f4e6176e612a39c0601ee0f37e1a..9d05962feb15e497e43fe2557cb507ba25cbd121 100644 (file)
@@ -318,7 +318,7 @@ static int ufs_mtk_pre_link(struct ufs_hba *hba)
         * to make sure that both host and device TX LCC are disabled
         * once link startup is completed.
         */
-       ret = ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0);
+       ret = ufshcd_disable_host_tx_lcc(hba);
        if (ret)
                return ret;
 
index c69c29a1ceb904814c77a3fb6dd0c4295cdf46ff..c2e703d58f630b14420137c86197cb251b7a4aed 100644 (file)
@@ -554,9 +554,7 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba *hba,
                 * completed.
                 */
                if (ufshcd_get_local_unipro_ver(hba) != UFS_UNIPRO_VER_1_41)
-                       err = ufshcd_dme_set(hba,
-                                       UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE),
-                                       0);
+                       err = ufshcd_disable_host_tx_lcc(hba);
 
                break;
        case POST_CHANGE:
index 3b19de3ae9a3014f584acdf22023b9acdd03b1c9..8f78a815149911706ecd21e8eed5cbba85cf2043 100644 (file)
@@ -44,7 +44,7 @@ static int ufs_intel_disable_lcc(struct ufs_hba *hba)
 
        ufshcd_dme_get(hba, attr, &lcc_enable);
        if (lcc_enable)
-               ufshcd_dme_set(hba, attr, 0);
+               ufshcd_disable_host_tx_lcc(hba);
 
        return 0;
 }
index 81c71a3e3474d0ee88689e0a7c47c4b911efbb6e..8f516b205c32b78091747477b24ddb39067b32aa 100644 (file)
@@ -914,6 +914,11 @@ static inline bool ufshcd_is_hs_mode(struct ufs_pa_layer_attr *pwr_info)
                pwr_info->pwr_tx == FASTAUTO_MODE);
 }
 
+static inline int ufshcd_disable_host_tx_lcc(struct ufs_hba *hba)
+{
+       return ufshcd_dme_set(hba, UIC_ARG_MIB(PA_LOCAL_TX_LCC_ENABLE), 0);
+}
+
 /* Expose Query-Request API */
 int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
                                  enum query_opcode opcode,