linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] permit vendor specific values of unipro timeouts
       [not found] <CGME20201219030743epcas2p39ee0570eea153915ad8e525e8f508e66@epcas2p3.samsung.com>
@ 2020-12-19  2:56 ` Kiwoong Kim
       [not found]   ` <CGME20201219030745epcas2p465db4e50311807fdd1edffa50b0e6eac@epcas2p4.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-19  2:56 UTC (permalink / raw)
  To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen,
	beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh,
	hy50.seo, sh425.lee, bhoon95.kim
  Cc: Kiwoong Kim

v1 -> v2: change some comments and rename the quirk

There are some attribute settings before power mode change in ufshcd.c
that should have been variant per vendor.

Kiwoong Kim (2):
  ufs: add a quirk not to use default unipro timeout values
  ufs: ufs-exynos: apply vendor specifics for three timeouts

 drivers/scsi/ufs/ufs-exynos.c |  8 +++++++-
 drivers/scsi/ufs/ufshcd.c     | 40 +++++++++++++++++++++-------------------
 drivers/scsi/ufs/ufshcd.h     |  6 ++++++
 3 files changed, 34 insertions(+), 20 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] ufs: add a quirk not to use default unipro timeout values
       [not found]   ` <CGME20201219030745epcas2p465db4e50311807fdd1edffa50b0e6eac@epcas2p4.samsung.com>
@ 2020-12-19  2:56     ` Kiwoong Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-19  2:56 UTC (permalink / raw)
  To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen,
	beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh,
	hy50.seo, sh425.lee, bhoon95.kim
  Cc: Kiwoong Kim

Unipro specification says attribute IDs of the following
thing are vendor-specific values, so some SoCs could have
no regions at the defined addresses
- DME_LocalFC0ProtectionTimeOutVal
- DME_LocalTC0ReplayTimeOutVal
- DME_LocalAFC0ReqTimeOutVal

The following things should be set considering the compatibility
between host and device, so those values must not be fixed and
you could use reset values or vendor specific values
- PA_PWRMODEUSERDATA0
- PA_PWRMODEUSERDATA1
- PA_PWRMODEUSERDATA2
- PA_PWRMODEUSERDATA3
- PA_PWRMODEUSERDATA4
- PA_PWRMODEUSERDATA5

Change-Id: Ifbb55e9ea221156804121c4dedb3a099ce02cb95
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 40 +++++++++++++++++++++-------------------
 drivers/scsi/ufs/ufshcd.h |  6 ++++++
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 92d433d..9d3a41d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4153,25 +4153,27 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba,
 		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_HSSERIES),
 						pwr_mode->hs_rate);
 
-	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA0),
-			DL_FC0ProtectionTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA1),
-			DL_TC0ReplayTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA2),
-			DL_AFC0ReqTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA3),
-			DL_FC1ProtectionTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA4),
-			DL_TC1ReplayTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA5),
-			DL_AFC1ReqTimeOutVal_Default);
-
-	ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalFC0ProtectionTimeOutVal),
-			DL_FC0ProtectionTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalTC0ReplayTimeOutVal),
-			DL_TC0ReplayTimeOutVal_Default);
-	ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalAFC0ReqTimeOutVal),
-			DL_AFC0ReqTimeOutVal_Default);
+	if (!(hba->quirks & UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING)) {
+		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA0),
+				DL_FC0ProtectionTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA1),
+				DL_TC0ReplayTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA2),
+				DL_AFC0ReqTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA3),
+				DL_FC1ProtectionTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA4),
+				DL_TC1ReplayTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA5),
+				DL_AFC1ReqTimeOutVal_Default);
+
+		ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalFC0ProtectionTimeOutVal),
+				DL_FC0ProtectionTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalTC0ReplayTimeOutVal),
+				DL_TC0ReplayTimeOutVal_Default);
+		ufshcd_dme_set(hba, UIC_ARG_MIB(DME_LocalAFC0ReqTimeOutVal),
+				DL_AFC0ReqTimeOutVal_Default);
+	}
 
 	ret = ufshcd_uic_change_pwr_mode(hba, pwr_mode->pwr_rx << 4
 			| pwr_mode->pwr_tx);
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 61344c4..f36f73c8 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -549,6 +549,12 @@ enum ufshcd_quirks {
 	 */
 	UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL		= 1 << 12,
 
+	/*
+	 * This quirk needs to disable unipro timeout values
+	 * before power mode change
+	 */
+	UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING = 1 << 13,
+
 };
 
 enum ufshcd_caps {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] ufs: ufs-exynos: apply vendor specifics for three timeouts
       [not found]   ` <CGME20201219030745epcas2p20989804ebd913d14a0d2536933248674@epcas2p2.samsung.com>
@ 2020-12-19  2:56     ` Kiwoong Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-19  2:56 UTC (permalink / raw)
  To: linux-scsi, alim.akhtar, avri.altman, jejb, martin.petersen,
	beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh,
	hy50.seo, sh425.lee, bhoon95.kim
  Cc: Kiwoong Kim

Set optimized values for those timeouts
- FC0_PROTECTION_TIMER
- TC0_REPLAY_TIMER
- AFC0_REQUEST_TIMER

Exynos doesn't yet use traffic class #1.

Change-Id: Ib672b554ea109159cd75ff67a111f46ebff4a7dc
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
 drivers/scsi/ufs/ufs-exynos.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c
index a8770ff..5ca21d1 100644
--- a/drivers/scsi/ufs/ufs-exynos.c
+++ b/drivers/scsi/ufs/ufs-exynos.c
@@ -640,6 +640,11 @@ static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba,
 		}
 	}
 
+	/* setting for three timeout values for traffic class #0 */
+	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA0), 8064);
+	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA1), 28224);
+	ufshcd_dme_set(hba, UIC_ARG_MIB(PA_PWRMODEUSERDATA2), 20160);
+
 	return 0;
 out:
 	return ret;
@@ -1236,7 +1241,8 @@ struct exynos_ufs_drv_data exynos_ufs_drvs = {
 				  UFSHCI_QUIRK_BROKEN_HCE |
 				  UFSHCI_QUIRK_SKIP_RESET_INTR_AGGR |
 				  UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR |
-				  UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL,
+				  UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL |
+				  UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING,
 	.opts			= EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL |
 				  EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL |
 				  EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX |
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH v2 0/2] permit vendor specific values of unipro timeouts
  2020-12-19  2:56 ` [PATCH v2 0/2] permit vendor specific values of unipro timeouts Kiwoong Kim
       [not found]   ` <CGME20201219030745epcas2p465db4e50311807fdd1edffa50b0e6eac@epcas2p4.samsung.com>
       [not found]   ` <CGME20201219030745epcas2p20989804ebd913d14a0d2536933248674@epcas2p2.samsung.com>
@ 2020-12-20 14:03   ` Avri Altman
  2020-12-21  1:37     ` Kiwoong Kim
  2 siblings, 1 reply; 5+ messages in thread
From: Avri Altman @ 2020-12-20 14:03 UTC (permalink / raw)
  To: Kiwoong Kim, linux-scsi, alim.akhtar, jejb, martin.petersen,
	beanhuo, asutoshd, cang, bvanassche, grant.jung, sc.suh,
	hy50.seo, sh425.lee, bhoon95.kim

Your gerrit change-ids still shows, other than that - looks good to me.

Thanks,
Avri
> 
> v1 -> v2: change some comments and rename the quirk
> 
> There are some attribute settings before power mode change in ufshcd.c
> that should have been variant per vendor.
> 
> Kiwoong Kim (2):
>   ufs: add a quirk not to use default unipro timeout values
>   ufs: ufs-exynos: apply vendor specifics for three timeouts
> 
>  drivers/scsi/ufs/ufs-exynos.c |  8 +++++++-
>  drivers/scsi/ufs/ufshcd.c     | 40 +++++++++++++++++++++-------------------
>  drivers/scsi/ufs/ufshcd.h     |  6 ++++++
>  3 files changed, 34 insertions(+), 20 deletions(-)
> 
> --
> 2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2 0/2] permit vendor specific values of unipro timeouts
  2020-12-20 14:03   ` [PATCH v2 0/2] permit vendor specific values of unipro timeouts Avri Altman
@ 2020-12-21  1:37     ` Kiwoong Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-21  1:37 UTC (permalink / raw)
  To: 'Avri Altman', linux-scsi

> 
> Your gerrit change-ids still shows, other than that - looks good to me.
> 
> Thanks,
> Avri

I missed removing them in the patches. Will take care. Sorry.


Thanks.
Kiwoong Kim
> >
> > v1 -> v2: change some comments and rename the quirk
> >
> > There are some attribute settings before power mode change in ufshcd.c
> > that should have been variant per vendor.
> >
> > Kiwoong Kim (2):
> >   ufs: add a quirk not to use default unipro timeout values
> >   ufs: ufs-exynos: apply vendor specifics for three timeouts
> >
> >  drivers/scsi/ufs/ufs-exynos.c |  8 +++++++-
> >  drivers/scsi/ufs/ufshcd.c     | 40 +++++++++++++++++++++----------------
> ---
> >  drivers/scsi/ufs/ufshcd.h     |  6 ++++++
> >  3 files changed, 34 insertions(+), 20 deletions(-)
> >
> > --
> > 2.7.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-21  1:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201219030743epcas2p39ee0570eea153915ad8e525e8f508e66@epcas2p3.samsung.com>
2020-12-19  2:56 ` [PATCH v2 0/2] permit vendor specific values of unipro timeouts Kiwoong Kim
     [not found]   ` <CGME20201219030745epcas2p465db4e50311807fdd1edffa50b0e6eac@epcas2p4.samsung.com>
2020-12-19  2:56     ` [PATCH v2 1/2] ufs: add a quirk not to use default unipro timeout values Kiwoong Kim
     [not found]   ` <CGME20201219030745epcas2p20989804ebd913d14a0d2536933248674@epcas2p2.samsung.com>
2020-12-19  2:56     ` [PATCH v2 2/2] ufs: ufs-exynos: apply vendor specifics for three timeouts Kiwoong Kim
2020-12-20 14:03   ` [PATCH v2 0/2] permit vendor specific values of unipro timeouts Avri Altman
2020-12-21  1:37     ` Kiwoong Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).