ufs: ufs-exynos: apply vendor specifics for three timeouts
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20201221013532epcas2p4cfd78329e4d56e3ac5317ae23c27bc8c@epcas2p4.samsung.com
v3 cover permit vendor specific values of unipro timeouts
v2 -> v3: remove change ids
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(-)
Signature · 1 line
2.7.4
PATCH v3 1/2 ufs: add a quirk not to use default unipro timeout values
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
--- drivers/scsi/ufs/ufshcd.c | 40 +++++++++++++++++++++------------------- drivers/scsi/ufs/ufshcd.h | 6 ++++++ 2 files changed, 27 insertions(+), 19 deletions(-)
drivers/scsi/ufs/ufshcd.c +21 -19
@@ -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);
drivers/scsi/ufs/ufshcd.h +6 -0
@@ -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 {
Signature · 1 line
2.7.4
PATCH v3 2/2 ufs: ufs-exynos: apply vendor specifics for three timeouts
In reply to Kiwoong KimSet optimized values for those timeouts
- FC0_PROTECTION_TIMER
- TC0_REPLAY_TIMER
- AFC0_REQUEST_TIMER
Exynos doesn't yet use traffic class #1.
--- drivers/scsi/ufs/ufs-exynos.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufs-exynos.c +7 -1
@@ -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 |
Signature · 1 line
2.7.4
RE: [PATCH v3 0/2] permit vendor specific values of unipro timeouts
In reply to Kiwoong KimLooks good to me.
Thanks,
Avri
Quoted 17 lines
v2 -> v3: remove change ids
v1 -> v2: change some comments and rename the quirkThere are some attribute settings before power mode change in
ufshcd.cthat 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 timeoutsdrivers/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
Martin K. Petersen
AppliedRe: [PATCH v3 0/2] permit vendor specific values of unipro timeouts
In reply to Kiwoong KimQuoted 11 lines · Kiwoong Kim
v2 -> v3: remove change ids
v1 -> v2: change some comments and rename the quirkThere are some attribute settings before power mode change in
ufshcd.cthat 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[...]
Applied to 5.12/scsi-queue, thanks!
[1/2] ufs: add a quirk not to use default unipro timeout values
https://git.kernel.org/mkp/scsi/c/b1d0d2eb89d4 [2/2] ufs: ufs-exynos: apply vendor specifics for three timeouts https://git.kernel.org/mkp/scsi/c/a967ddb22d94
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering