* [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver
@ 2021-10-16 0:57 Stanley Chu
2021-10-16 0:58 ` [PATCH v2 1/3] scsi: ufs-mediatek: Introduce default delay for reference clock Stanley Chu
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Stanley Chu @ 2021-10-16 0:57 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: alice.chao, jonathan.hsu, peter.wang, powen.kao, cc.chou,
tun-yu.yu, eddie.huang, chaotian.jing, qilin.tan, lin.gui,
gray.jia, stanley.chu
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(-)
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] scsi: ufs-mediatek: Introduce default delay for reference clock
2021-10-16 0:57 [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Stanley Chu
@ 2021-10-16 0:58 ` Stanley Chu
2021-10-16 0:58 ` [PATCH v2 2/3] scsi: ufs-mediatek: Fix build error of using sched_clock() Stanley Chu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Stanley Chu @ 2021-10-16 0:58 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: alice.chao, jonathan.hsu, peter.wang, powen.kao, cc.chou,
tun-yu.yu, eddie.huang, chaotian.jing, qilin.tan, lin.gui,
gray.jia, stanley.chu
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.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 13 ++++++++-----
drivers/scsi/ufs/ufs-mediatek.h | 1 +
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index d1696db70ce8..2c7d12a30493 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -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;
}
diff --git a/drivers/scsi/ufs/ufs-mediatek.h b/drivers/scsi/ufs/ufs-mediatek.h
index c96b9b529ee2..414dca86c09f 100644
--- a/drivers/scsi/ufs/ufs-mediatek.h
+++ b/drivers/scsi/ufs/ufs-mediatek.h
@@ -34,6 +34,7 @@
#define REFCLK_ACK BIT(1)
#define REFCLK_REQ_TIMEOUT_US 3000
+#define REFCLK_DEFAULT_WAIT_US 32
/*
* Other attributes
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] scsi: ufs-mediatek: Fix build error of using sched_clock()
2021-10-16 0:57 [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Stanley Chu
2021-10-16 0:58 ` [PATCH v2 1/3] scsi: ufs-mediatek: Introduce default delay for reference clock Stanley Chu
@ 2021-10-16 0:58 ` Stanley Chu
2021-10-16 0:58 ` [PATCH v2 3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delay Stanley Chu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Stanley Chu @ 2021-10-16 0:58 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: alice.chao, jonathan.hsu, peter.wang, powen.kao, cc.chou,
tun-yu.yu, eddie.huang, chaotian.jing, qilin.tan, lin.gui,
gray.jia, stanley.chu
Add proper header for using sched_clock() in MediaTek driver.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 2c7d12a30493..bc193ba46b31 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -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"
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delay
2021-10-16 0:57 [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Stanley Chu
2021-10-16 0:58 ` [PATCH v2 1/3] scsi: ufs-mediatek: Introduce default delay for reference clock Stanley Chu
2021-10-16 0:58 ` [PATCH v2 2/3] scsi: ufs-mediatek: Fix build error of using sched_clock() Stanley Chu
@ 2021-10-16 0:58 ` Stanley Chu
2021-10-17 2:57 ` [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Martin K. Petersen
2021-10-21 3:42 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Stanley Chu @ 2021-10-16 0:58 UTC (permalink / raw)
To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: alice.chao, jonathan.hsu, peter.wang, powen.kao, cc.chou,
tun-yu.yu, eddie.huang, chaotian.jing, qilin.tan, lin.gui,
gray.jia, stanley.chu
From: Peter Wang <peter.wang@mediatek.com>
Fix the location of delay for ref-clk gating and ungating in
ufs_mtk_setup_ref_clk().
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index bc193ba46b31..d0a8e1319ab3 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -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;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver
2021-10-16 0:57 [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Stanley Chu
` (2 preceding siblings ...)
2021-10-16 0:58 ` [PATCH v2 3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delay Stanley Chu
@ 2021-10-17 2:57 ` Martin K. Petersen
2021-10-21 3:42 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-10-17 2:57 UTC (permalink / raw)
To: Stanley Chu
Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb,
alice.chao, jonathan.hsu, peter.wang, powen.kao, cc.chou,
tun-yu.yu, eddie.huang, chaotian.jing, qilin.tan, lin.gui,
gray.jia
Stanley,
> This series fixes some defects in MediaTek UFS drivers.
Applied to 5.16/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver
2021-10-16 0:57 [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Stanley Chu
` (3 preceding siblings ...)
2021-10-17 2:57 ` [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Martin K. Petersen
@ 2021-10-21 3:42 ` Martin K. Petersen
4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2021-10-21 3:42 UTC (permalink / raw)
To: jejb, avri.altman, alim.akhtar, Stanley Chu, linux-scsi
Cc: Martin K . Petersen, jonathan.hsu, qilin.tan, alice.chao, cc.chou,
gray.jia, tun-yu.yu, peter.wang, lin.gui, chaotian.jing,
eddie.huang, powen.kao
On Sat, 16 Oct 2021 08:57:59 +0800, Stanley Chu wrote:
> 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
>
> [...]
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
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-21 3:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-16 0:57 [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Stanley Chu
2021-10-16 0:58 ` [PATCH v2 1/3] scsi: ufs-mediatek: Introduce default delay for reference clock Stanley Chu
2021-10-16 0:58 ` [PATCH v2 2/3] scsi: ufs-mediatek: Fix build error of using sched_clock() Stanley Chu
2021-10-16 0:58 ` [PATCH v2 3/3] scsi: ufs-mediatek: Fix wrong place of ref-clk delay Stanley Chu
2021-10-17 2:57 ` [PATCH v2 0/3] scsi: ufs-mediatek: Fix some defects in MediaTek UFS driver Martin K. Petersen
2021-10-21 3:42 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox