scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver
v2 cover scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver
Hi,
This series fixes some defects in MediaTek UFS drivers.
Change since v1:
- Add patch [3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delay
Peter Wang (1):
scsi: ufs-mediatek: Fix wrong place of ref-clk delay
Stanley Chu (2):
scsi: ufs-mediatek: Introduce default delay for reference clock
scsi: ufs-mediatek: Fix build error of using sched_clock()
drivers/scsi/ufs/ufs-mediatek.c | 22 +++++++++++++--------- drivers/scsi/ufs/ufs-mediatek.h | 1 + 2 files changed, 14 insertions(+), 9 deletions(-)
Signature · 1 line
2.18.0
PATCH v2 1/3 scsi: ufs-mediatek: Introduce default delay for reference clock
Introduce default delay time for gating or ungating reference clock instead of ambiguous magic numbers.
The defined value is suitable for all current MediaTek UFS platforms.
--- drivers/scsi/ufs/ufs-mediatek.c | 13 ++++++++----- drivers/scsi/ufs/ufs-mediatek.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +8 -5
@@ -282,7 +282,7 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on) }static void ufs_mtk_setup_ref_clk_wait_us (struct ufs_hba *hba, -u16 gating_us,u16 ungating_us) +u16 gating_us) {struct ufs_mtk_host *host =ufshcd_get_variant (hba);
@@ -293,7 +293,7 @@ static void ufs_mtk_setup_ref_clk_wait_us(struct ufs_hba *hba, host->ref_clk_gating_wait_us = gating_us; } - host->ref_clk_ungating_wait_us = ungating_us; + host->ref_clk_ungating_wait_us =REFCLK_DEFAULT_WAIT_US ; }static void ufs_mtk_dbg_sel (struct ufs_hba *hba)
@@ -1102,11 +1102,14 @@ static int ufs_mtk_apply_dev_quirks(struct ufs_hba *hba)* requirements. */ if (mid ==UFS_VENDOR_SAMSUNG ) -ufs_mtk_setup_ref_clk_wait_us (hba,1 ,1 ); +ufs_mtk_setup_ref_clk_wait_us (hba,1 );else if (mid ==UFS_VENDOR_SKHYNIX ) -ufs_mtk_setup_ref_clk_wait_us (hba,30 ,30 ); +ufs_mtk_setup_ref_clk_wait_us (hba,30 );else if (mid ==UFS_VENDOR_TOSHIBA ) -ufs_mtk_setup_ref_clk_wait_us (hba,100 ,32 ); +ufs_mtk_setup_ref_clk_wait_us (hba,100 ); +else +ufs_mtk_setup_ref_clk_wait_us (hba, +REFCLK_DEFAULT_WAIT_US );return 0 ; }
drivers/scsi/ufs/ufs-mediatek.h +1 -0
@@ -34,6 +34,7 @@#define REFCLK_ACK BIT(1)#define REFCLK_REQ_TIMEOUT_US 3000 +#define REFCLK_DEFAULT_WAIT_US 32/* * Other attributes
Signature · 1 line
2.18.0
PATCH v2 2/3 scsi: ufs-mediatek: Fix build error of using sched_clock()
In reply to Stanley ChuAdd proper header for using sched_clock() in MediaTek driver.
--- drivers/scsi/ufs/ufs-mediatek.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ufs/ufs-mediatek.c +1 -0
@@ -15,6 +15,7 @@#include <linux/platform_device.h> #include <linux/regulator/consumer.h> #include <linux/reset.h> +#include <linux/sched/clock.h> #include <linux/soc/mediatek/mtk_sip_svc.h> #include "ufshcd.h"
Signature · 1 line
2.18.0
PATCH v2 3/3 scsi: ufs-mediatek: Fix wrong place of ref-clk delay
In reply to Stanley ChuFrom: Peter Wang <[email protected]>
Fix the location of delay for ref-clk gating and ungating in ufs_mtk_setup_ref_clk().
--- drivers/scsi/ufs/ufs-mediatek.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ufs-mediatek.c +4 -4
@@ -247,9 +247,9 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on)if (on) {ufs_mtk_ref_clk_notify (on, res); -ufshcd_delay_us (host->ref_clk_ungating_wait_us,10 );ufshcd_writel (hba,REFCLK_REQUEST ,REG_UFS_REFCLK_CTRL ); }else { +ufshcd_delay_us (host->ref_clk_gating_wait_us,10 );ufshcd_writel (hba,REFCLK_RELEASE ,REG_UFS_REFCLK_CTRL ); }
@@ -274,10 +274,10 @@ static int ufs_mtk_setup_ref_clk(struct ufs_hba *hba, bool on) out: host->ref_clk_enabled = on; -if (!on) { -ufshcd_delay_us (host->ref_clk_gating_wait_us,10 ); +if (on) +ufshcd_delay_us (host->ref_clk_ungating_wait_us,10 ); +else ufs_mtk_ref_clk_notify (on, res); - }return 0 ; }
Signature · 1 line
2.18.0
Martin K. Petersen
AppliedStanley,
Quoted 1 line
This series fixes some defects in MediaTek UFS drivers.
Applied to 5.16/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 9 lines · Stanley Chu
This series fixes some defects in MediaTek UFS drivers.
Change since v1:
- Add patch [3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delayPeter Wang (1):
scsi: ufs-mediatek: Fix wrong place of ref-clk delay[...]
Applied to 5.16/scsi-queue, thanks!
[1/3] scsi: ufs-mediatek: Introduce default delay for reference clock
https://git.kernel.org/mkp/scsi/c/fc65e933fbcc [2/3] scsi: ufs-mediatek: Fix build error of using sched_clock() https://git.kernel.org/mkp/scsi/c/1eaff502a8f1 [3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delay https://git.kernel.org/mkp/scsi/c/25d542a85374
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering