linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC
       [not found] <CGME20201218074142epcas2p4c5f276e54ff896b8e990303376a15154@epcas2p4.samsung.com>
@ 2020-12-18  7:30 ` Kiwoong Kim
       [not found]   ` <CGME20201218074144epcas2p1dfe10a239993fec0c9998f367a029c51@epcas2p1.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-18  7:30 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

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

Kiwoong Kim (2):
  ufs: add a quirk for vendor specifics before pmc
  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

* [RFC PATCH v1 1/2] ufs: add a quirk for vendor specifics before pmc
       [not found]   ` <CGME20201218074144epcas2p1dfe10a239993fec0c9998f367a029c51@epcas2p1.samsung.com>
@ 2020-12-18  7:30     ` Kiwoong Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-18  7:30 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 address
- 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
could be 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..934d96f 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_VENDOR_SPECIFIC_BEFORE_PMC)) {
+		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..ab7af1d 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 vendor specific setting
+	 * before power mode change
+	 */
+	UFSHCD_QUIRK_SKIP_VENDOR_SPECIFIC_BEFORE_PMC = 1 << 13,
+
 };
 
 enum ufshcd_caps {
-- 
2.7.4


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

* [RFC PATCH v1 2/2] ufs: ufs-exynos: apply vendor specifics for three timeouts
       [not found]   ` <CGME20201218074145epcas2p3563711f5d05a41dff0602d3e7aef5891@epcas2p3.samsung.com>
@ 2020-12-18  7:30     ` Kiwoong Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-18  7:30 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..1ea8244 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_VENDOR_SPECIFIC_BEFORE_PMC,
 	.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: [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC
  2020-12-18  7:30 ` [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC Kiwoong Kim
       [not found]   ` <CGME20201218074144epcas2p1dfe10a239993fec0c9998f367a029c51@epcas2p1.samsung.com>
       [not found]   ` <CGME20201218074145epcas2p3563711f5d05a41dff0602d3e7aef5891@epcas2p3.samsung.com>
@ 2020-12-18 13:33   ` Avri Altman
  2020-12-19  2:55     ` Kiwoong Kim
  2 siblings, 1 reply; 5+ messages in thread
From: Avri Altman @ 2020-12-18 13:33 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

> 
> 
> There are some attribute settings before power mode change in ufshcd.c
> that should be variant per vendor.
But you've added a quirk, which is not what your commit log say.
If indeed unipro allows to skip/set values other than default - add the appropriate vop.
Otherwise, if it's just a non-standard behavior of exynos - then your patch is appropriate,
But you need to reword your commit log: both here and in your 1/2 patch.

Also, you forgot to remove the gerrit change-id.

Thanks,
Avri

> 
> Kiwoong Kim (2):
>   ufs: add a quirk for vendor specifics before pmc
>   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: [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC
  2020-12-18 13:33   ` [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC Avri Altman
@ 2020-12-19  2:55     ` Kiwoong Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kiwoong Kim @ 2020-12-19  2:55 UTC (permalink / raw)
  To: 'Avri Altman', linux-scsi

> > There are some attribute settings before power mode change in ufshcd.c
> > that should be variant per vendor.
> But you've added a quirk, which is not what your commit log say.
> If indeed unipro allows to skip/set values other than default - add the
> appropriate vop.
> Otherwise, if it's just a non-standard behavior of exynos - then your
> patch is appropriate, But you need to reword your commit log: both here
> and in your 1/2 patch.
> 
> Also, you forgot to remove the gerrit change-id.
> 
> Thanks,
> Avri

You're right and for change-id, there might be something wrong in my local branch.
Anyway thanks !


Thanks.
Kiwoong Kim

> >
> > Kiwoong Kim (2):
> >   ufs: add a quirk for vendor specifics before pmc
> >   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-19  2:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201218074142epcas2p4c5f276e54ff896b8e990303376a15154@epcas2p4.samsung.com>
2020-12-18  7:30 ` [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC Kiwoong Kim
     [not found]   ` <CGME20201218074144epcas2p1dfe10a239993fec0c9998f367a029c51@epcas2p1.samsung.com>
2020-12-18  7:30     ` [RFC PATCH v1 1/2] ufs: add a quirk for vendor specifics before pmc Kiwoong Kim
     [not found]   ` <CGME20201218074145epcas2p3563711f5d05a41dff0602d3e7aef5891@epcas2p3.samsung.com>
2020-12-18  7:30     ` [RFC PATCH v1 2/2] ufs: ufs-exynos: apply vendor specifics for three timeouts Kiwoong Kim
2020-12-18 13:33   ` [RFC PATCH v1 0/2] permit vendor specific timeouts for PMC Avri Altman
2020-12-19  2:55     ` 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).