scsi: ufs-mediatek: use common delay function
authorStanley Chu <stanley.chu@mediatek.com>
Wed, 18 Mar 2020 10:40:13 +0000 (18:40 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 27 Mar 2020 02:07:14 +0000 (22:07 -0400)
A common delay function is introduced in UFS core driver, thus ufs-mediatek
can use it instead of the private delay function.

Link: https://lore.kernel.org/r/20200318104016.28049-5-stanley.chu@mediatek.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufs-mediatek.c

index 3b0e575d74609cbc21be3f23c7c5373f1095cc88..73bd4c245f4a5c848309ef6911d98234b6c494d5 100644 (file)
@@ -100,17 +100,6 @@ static int ufs_mtk_bind_mphy(struct ufs_hba *hba)
        return err;
 }
 
-static void ufs_mtk_udelay(unsigned long us)
-{
-       if (!us)
-               return;
-
-       if (us < 10)
-               udelay(us);
-       else
-               usleep_range(us, us + 10);
-}
-
 static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
 {
        struct ufs_mtk_host *host = ufshcd_get_variant(hba);
@@ -123,7 +112,7 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
 
        if (on) {
                ufs_mtk_ref_clk_notify(on, res);
-               ufs_mtk_udelay(host->ref_clk_ungating_wait_us);
+               ufshcd_delay_us(host->ref_clk_ungating_wait_us, 10);
                ufshcd_writel(hba, REFCLK_REQUEST, REG_UFS_REFCLK_CTRL);
        } else {
                ufshcd_writel(hba, REFCLK_RELEASE, REG_UFS_REFCLK_CTRL);
@@ -150,7 +139,7 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)
 out:
        host->ref_clk_enabled = on;
        if (!on) {
-               ufs_mtk_udelay(host->ref_clk_gating_wait_us);
+               ufshcd_delay_us(host->ref_clk_gating_wait_us, 10);
                ufs_mtk_ref_clk_notify(on, res);
        }