scsi: ufs: Implement Quirks for Samsung UFS Devices
Subsystems (4)
v2 cover scsi: ufs: Implement Quirks for Samsung UFS Devices
Introduce quirks for Samsung UFS devices to modify the PA TX HSG1 sync length and TX_HS_EQUALIZER settings on the Qualcomm UFS Host controller.
Additionally, Samsung UFS devices require extra time in hibern8 mode before exiting, beyond the standard handshaking phase between the host and device. Introduce a quirk to increase the PA_HIBERN8TIME parameter by 100 µs to ensure a proper hibernation process.
---
Changes in V2
- Split patches to add PA_HIBERN8TIME quirk in ufshcd.c
---
Manish Pandey (2):
ufs: qcom: Add quirks for Samsung UFS devices
scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
drivers/ufs/core/ufshcd.c | 31 ++++++++++++++++++++++++++ drivers/ufs/host/ufs-qcom.c | 43 +++++++++++++++++++++++++++++++++++++ drivers/ufs/host/ufs-qcom.h | 18 ++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 4 files changed, 98 insertions(+)
Signature · 1 line
2.17.1
PATCH v2 1/2 ufs: qcom: Add quirks for Samsung UFS devices
Introduce quirks for Samsung UFS devices to adjust PA TX HSG1 sync length and TX_HS_EQUALIZER settings on the Qualcomm UFS Host controller. These adjustments are necessary to ensure proper functionality of Samsung UFS devices with the Qualcomm UFS Host controller.
--- drivers/ufs/host/ufs-qcom.c | 43 +++++++++++++++++++++++++++++++++++++ drivers/ufs/host/ufs-qcom.h | 18 ++++++++++++++++ 2 files changed, 61 insertions(+)
drivers/ufs/host/ufs-qcom.c +43 -0
@@ -31,6 +31,10 @@ ((((c) >> 16) & MCQ_QCFGPTR_MASK) * MCQ_QCFGPTR_UNIT)#define MCQ_QCFG_SIZE 0x40 +/* De-emphasis for gear-5 */ +#define DEEMPHASIS_3_5_dB 0x04 +#define NO_DEEMPHASIS 0x0 +enum {TSTBUS_UAWM ,TSTBUS_UARM ,
@@ -778,6 +782,24 @@ static int ufs_qcom_icc_update_bw(struct ufs_qcom_host *host)return ufs_qcom_icc_set_bw (host, bw_table.mem_bw, bw_table.cfg_bw); } +static void ufs_qcom_set_tx_hs_equalizer (struct ufs_hba *hba, +u32 gear,u32 tx_lanes) +{ +u32 equalizer_val; +int ret, i; + +/* Determine the equalizer value based on the gear */ + equalizer_val = (gear ==5 ) ? DEEMPHASIS_3_5_dB :NO_DEEMPHASIS ; + +for (i =0 ; i < tx_lanes; i++) { + ret =ufshcd_dme_set (hba,UIC_ARG_MIB_SEL (TX_HS_EQUALIZER , i), + equalizer_val); +if (ret) +dev_err (hba->dev,"%s: failed equalizer lane %d\n" , + __func__, i); + } +} + static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, enum ufs_notify_change_status status, struct ufs_pa_layer_attr *dev_max_params,
@@ -829,6 +851,10 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, dev_req_params->gear_tx, PA_INITIAL_ADAPT); } + +if (hba->dev_quirks &UFS_DEVICE_QUIRK_PA_TX_DEEMPHASIS_TUNING ) +ufs_qcom_set_tx_hs_equalizer (hba, + dev_req_params->gear_tx, dev_req_params->lane_tx);break ;case POST_CHANGE : if (ufs_qcom_cfg_timers(hba, dev_req_params->gear_rx,
@@ -878,6 +904,16 @@ static int ufs_qcom_quirk_host_pa_saveconfigtime(struct ufs_hba *hba) (pa_vs_config_reg1 | (1 << 12))); } +static void ufs_qcom_override_pa_tx_hsg1_sync_len (struct ufs_hba *hba) +{ +int err; + + err =ufshcd_dme_peer_set (hba,UIC_ARG_MIB (PA_TX_HSG1_SYNC_LENGTH ), +PA_TX_HSG1_SYNC_LENGTH_VAL ); +if (err) +dev_err (hba->dev,"Failed (%d) set PA_TX_HSG1_SYNC_LENGTH\n" , err); +} +static int ufs_qcom_apply_dev_quirks (struct ufs_hba *hba) {int err =0 ;
@@ -885,6 +921,9 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba)if (hba->dev_quirks &UFS_DEVICE_QUIRK_HOST_PA_SAVECONFIGTIME ) err =ufs_qcom_quirk_host_pa_saveconfigtime (hba); +if (hba->dev_quirks &UFS_DEVICE_QUIRK_PA_TX_HSG1_SYNC_LENGTH ) +ufs_qcom_override_pa_tx_hsg1_sync_len (hba); +return err; }
@@ -899,6 +938,10 @@ static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = { { .wmanufacturerid = UFS_VENDOR_WDC, .model = UFS_ANY_MODEL, .quirk = UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE }, + { .wmanufacturerid = UFS_VENDOR_SAMSUNG, + .model = UFS_ANY_MODEL, + .quirk = UFS_DEVICE_QUIRK_PA_TX_HSG1_SYNC_LENGTH | + UFS_DEVICE_QUIRK_PA_TX_DEEMPHASIS_TUNING }, {} };
drivers/ufs/host/ufs-qcom.h +18 -0
@@ -116,8 +116,11 @@ enum { TMRLUT_HW_CGC_EN | OCSC_HW_CGC_EN)/* QUniPro Vendor specific attributes */ +#define PA_TX_HSG1_SYNC_LENGTH 0x1552#define PA_VS_CONFIG_REG1 0x9000#define DME_VS_CORE_CLK_CTRL 0xD002 +#define TX_HS_EQUALIZER 0x0037 +/* bit and mask definitions for DME_VS_CORE_CLK_CTRL attribute */ #define CLK_1US_CYCLES_MASK_V4 GENMASK(27, 16)#define CLK_1US_CYCLES_MASK GENMASK(7, 0)
@@ -135,6 +138,21 @@ enum {#define UNIPRO_CORE_CLK_FREQ_201_5_MHZ 202#define UNIPRO_CORE_CLK_FREQ_403_MHZ 403 +/* TX_HSG1_SYNC_LENGTH attr value */ +#define PA_TX_HSG1_SYNC_LENGTH_VAL 0x4A + +/* +* Some ufs device vendors need a different TSync length. +* Enable this quirk to give an additional TX_HS_SYNC_LENGTH. +*/ +#define UFS_DEVICE_QUIRK_PA_TX_HSG1_SYNC_LENGTH (1 << 16) + +/* +* Some ufs device vendors need a different Deemphasis setting. +* Enable this quirk to tune TX Deemphasis parameters. +*/ +#define UFS_DEVICE_QUIRK_PA_TX_DEEMPHASIS_TUNING (1 << 17) +static inline void ufs_qcom_get_controller_revision (struct ufs_hba *hba,u8 *major,u16 *minor,u16 *step)
Signature · 1 line
2.17.1
PATCH v2 2/2 scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
In reply to Manish PandeySome UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the PA_HIBERN8TIME parameter by 100 µs to ensure proper hibernation process.
--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)
drivers/ufs/core/ufshcd.c +31 -0
@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,
@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter +* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ; +int ret; + + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ + ret =ufshcd_dme_set (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + pa_h8time +1 ); +if (ret) +dev_err (hba->dev,"Failed updating PA_HIBERN8TIME: %d\n" , ret); +} +static void ufshcd_tune_unipro_params (struct ufs_hba *hba) {ufshcd_vops_apply_dev_quirks (hba);
@@ -8394,6 +8422,9 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba)if (hba->dev_quirks &UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE )ufshcd_quirk_tune_host_pa_tactivate (hba); + +if (hba->dev_quirks &UFS_DEVICE_QUIRK_PA_HIBER8TIME ) +ufshcd_quirk_override_pa_h8time (hba); }static void ufshcd_clear_dbg_ufs_stats (struct ufs_hba *hba)
include/ufs/ufs_quirks.h +6 -0
@@ -107,4 +107,10 @@ struct ufs_dev_quirk {*/ #define UFS_DEVICE_QUIRK_DELAY_AFTER_LPM (1 << 11) +/* +* Some ufs devices may need more time to be in hibern8 before exiting. +* Enable this quirk to give it an additional 100us. +*/ +#define UFS_DEVICE_QUIRK_PA_HIBER8TIME (1 << 12) +#endif /* UFS_QUIRKS_H_ */
Signature · 1 line
2.17.1
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.
This commit message didn't mention the UFS device for which this quirk is being applied.
Quoted 23 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +2
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/**
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8398
Quoted 10 lines
drivers/ufs/core/ufshcd.c +10
-0+* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter +* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;
Why do you need to initialize it?
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8408
Quoted 10 lines
drivers/ufs/core/ufshcd.c +10
-0+int ret; + + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */
From where the value of 100us adjustment is coming from?
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 10 lines · Manivannan Sadhasivam
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.This commit message didn't mention the UFS device for which this quirk is being applied.
Since it's a quirk and may be applicable to other vendors also in future, so i thought to keep it general.
Will update in next patch set if required.
Quoted 22 lines
Quoted 22 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +1
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; }
Quoted 14 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8398
Quoted 11 lines
drivers/ufs/core/ufshcd.c +11
-0+/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter +* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;Why do you need to initialize it?
Agree.. Not needed, will update.>> + int ret;
Quoted 12 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8408
Quoted 9 lines
drivers/ufs/core/ufshcd.c +9
-0+ + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ From where the value of 100us adjustment is coming from?
Quoted 2 lines
- Mani
These values are derived from experiments on Qualcomm SoCs. However this is also matching with ufs-exynos.c
fsd_ufs_post_link() {
ufshcd_dme_get(hba,UIC_ARG_MIB(PA_HIBERN8TIME),
&max_rx_hibern8_time_cap);
.......
ufshcd_dme_set(hba, UIC_ARG_MIB(PA_HIBERN8TIME),
max_rx_hibern8_time_cap + 1);
...
}Thanks
Manish
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 10 lines · MANISH PANDEY
Quoted 7 lines · Manivannan Sadhasivam
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.
Quoted 6 lines
Quoted 3 lines
This commit message didn't mention the UFS device for which this quirk is being applied.
Since it's a quirk and may be applicable to other vendors also in future, so i thought to keep it general.
You cannot make commit message generic. It should precisely describe the change.
Quoted 49 lines
Will update in next patch set if required.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +6
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter Quoted 9 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8398
Quoted 6 lines
drivers/ufs/core/ufshcd.c +6
-0+* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;Why do you need to initialize it?
Agree.. Not needed, will update.>> + int ret;
Quoted 12 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8408
Quoted 9 lines
drivers/ufs/core/ufshcd.c +9
-0+ + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ From where the value of 100us adjustment is coming from?
Quoted 5 lines
Quoted 2 lines
- Mani
These values are derived from experiments on Qualcomm SoCs. However this is also matching with
ufs-exynos.c
Okay. In that case, you should mention that the 100us value is derived from experiments on Qcom and Samsung SoCs. Otherwise, it gives an assumption that this value is universal.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 75 lines · Manivannan Sadhasivam
Quoted 10 lines · MANISH PANDEY
Quoted 7 lines · Manivannan Sadhasivam
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.Quoted 6 lines
Quoted 3 lines
This commit message didn't mention the UFS device for which this quirk is being applied.
Since it's a quirk and may be applicable to other vendors also in future, so i thought to keep it general.
You cannot make commit message generic. It should precisely describe the change.
Quoted 49 lines
Will update in next patch set if required.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +6
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter Quoted 9 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8398
Quoted 6 lines
drivers/ufs/core/ufshcd.c +6
-0+* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;Why do you need to initialize it?
Agree.. Not needed, will update.>> + int ret;
Quoted 12 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8408
Quoted 9 lines
drivers/ufs/core/ufshcd.c +9
-0+ + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ From where the value of 100us adjustment is coming from?
Quoted 5 lines
Quoted 2 lines
- Mani
These values are derived from experiments on Qualcomm SoCs. However this is also matching with
ufs-exynos.c
Quoted 6 lines
Okay. In that case, you should mention that the 100us value is derived from experiments on Qcom and Samsung SoCs. Otherwise, it gives an assumption that this value is universal.
- Mani
<< Otherwise, it gives an assumption that this value is universal. >>
So with this, should i add this quirk for Qcom only, or should add in ufshcd.c and make it common for all SoC vendors?
Regards
Manish
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 82 lines · MANISH PANDEY
Quoted 79 lines · Manivannan Sadhasivam
Quoted 10 lines · MANISH PANDEY
Quoted 7 lines · Manivannan Sadhasivam
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.Quoted 6 lines
Quoted 3 lines
This commit message didn't mention the UFS device for which this quirk is being applied.
Since it's a quirk and may be applicable to other vendors also in future, so i thought to keep it general.
You cannot make commit message generic. It should precisely describe the change.
Quoted 49 lines
Will update in next patch set if required.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +6
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter Quoted 9 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8398
Quoted 6 lines
drivers/ufs/core/ufshcd.c +6
-0+* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;Why do you need to initialize it?
Agree.. Not needed, will update.>> + int ret;
Quoted 12 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8408
Quoted 9 lines
drivers/ufs/core/ufshcd.c +9
-0+ + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ From where the value of 100us adjustment is coming from?
Quoted 5 lines
Quoted 2 lines
- Mani
These values are derived from experiments on Qualcomm SoCs. However this is also matching with
ufs-exynos.cOkay. In that case, you should mention that the 100us value is derived from experiments on Qcom and Samsung SoCs. Otherwise, it gives an assumption that this value is universal.
Quoted 6 lines
Quoted 2 lines
- Mani
<< Otherwise, it gives an assumption that this value is universal. >>
So with this, should i add this quirk for Qcom only, or should add inufshcd.cand make it common for all SoC vendors?
You can add the quirk for both Qcom and Samsung. My comment was about clarifying it in the kernel doc comments.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 90 lines · Manivannan Sadhasivam
Quoted 82 lines · MANISH PANDEY
Quoted 79 lines · Manivannan Sadhasivam
Quoted 10 lines · MANISH PANDEY
Quoted 7 lines · Manivannan Sadhasivam
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.Quoted 6 lines
Quoted 3 lines
This commit message didn't mention the UFS device for which this quirk is being applied.
Since it's a quirk and may be applicable to other vendors also in future, so i thought to keep it general.
You cannot make commit message generic. It should precisely describe the change.
Quoted 49 lines
Will update in next patch set if required.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +6
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter Quoted 9 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8398
Quoted 6 lines
drivers/ufs/core/ufshcd.c +6
-0+* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;Why do you need to initialize it?
Agree.. Not needed, will update.>> + int ret;
Quoted 12 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8408
Quoted 9 lines
drivers/ufs/core/ufshcd.c +9
-0+ + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ From where the value of 100us adjustment is coming from?
Quoted 5 lines
Quoted 2 lines
- Mani
These values are derived from experiments on Qualcomm SoCs. However this is also matching with
ufs-exynos.cOkay. In that case, you should mention that the 100us value is derived from experiments on Qcom and Samsung SoCs. Otherwise, it gives an assumption that this value is universal.
Quoted 6 lines
Quoted 2 lines
- Mani
<< Otherwise, it gives an assumption that this value is universal. >>
So with this, should i add this quirk for Qcom only, or should add inufshcd.cand make it common for all SoC vendors?
Quoted 5 lines
You can add the quirk for both Qcom and Samsung. My comment was about clarifying it in the kernel doc comments.
- Mani
Just for conclusion, why i moved this quirk from ufs-qcom to ufshcd.c is as per Bart's suggestion in patchset https://lore.kernel.org/lkml/[email protected]/
<< Which of these quirks are required for all host controllers and which of these quirks are only required for Qualcomm host controllers?
Quoted 2 lines
Should we consider moving the
QUIRK_PA_HIBER8TIMEquirk to the ufshcd driver? Please advise.
That would be appreciated. >>
Just to brief, QUIRK_PA_HIBER8TIME is required for Samsung UFS devices and may be applicable to all SoC vendors with Samsung ufs device.
If you suggest to move it to ufs-qcom.c, i don't have any concern. BTW Samsung UFS driver already has this implemented in their driver, So i need not have to add this quirk to Samsung driver (ufs-exynos.c).
Regards
Manish
Re: [PATCH V2 2/2] scsi: ufs: introduce quirk to extend PA_HIBERN8TIME for UFS devices
Quoted 108 lines · MANISH PANDEY
Quoted 90 lines · Manivannan Sadhasivam
Quoted 82 lines · MANISH PANDEY
Quoted 79 lines · Manivannan Sadhasivam
Quoted 10 lines · MANISH PANDEY
Quoted 7 lines · Manivannan Sadhasivam
Quoted 5 lines · Manish Pandey
Some UFS devices need additional time in hibern8 mode before exiting, beyond the negotiated handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure proper hibernation process.Quoted 6 lines
Quoted 3 lines
This commit message didn't mention the UFS device for which this quirk is being applied.
Since it's a quirk and may be applicable to other vendors also in future, so i thought to keep it general.
You cannot make commit message generic. It should precisely describe the change.
Quoted 49 lines
Will update in next patch set if required.
Quoted 26 lines
Quoted 26 lines
Signed-off-by Manish Pandey <[email protected]>--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 2 files changed, 37 insertions(+)drivers/ufs/core/ufshcd.c +6
-0@@ -278,6 +278,7 @@ static const struct ufs_dev_quirk ufs_fixups[] = { .model = UFS_ANY_MODEL, .quirk =UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM |UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE | +UFS_DEVICE_QUIRK_PA_HIBER8TIME | UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS }, { .wmanufacturerid = UFS_VENDOR_SKHYNIX, .model = UFS_ANY_MODEL,@@ -8384,6 +8385,33 @@ static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba)return ret; } +/** +* ufshcd_quirk_override_pa_h8time - Ensures proper adjustment of PA_HIBERN8TIME. +* @hba: per-adapter instance +* +* Some UFS devices require specific adjustments to the PA_HIBERN8TIME parameter Quoted 9 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8397
Quoted 6 lines
drivers/ufs/core/ufshcd.c +6
-0+* to ensure proper hibernation timing. This function retrieves the current +* PA_HIBERN8TIME value and increments it by 100us. +*/ +static void ufshcd_quirk_override_pa_h8time (struct ufs_hba *hba) +{ +u32 pa_h8time =0 ;Why do you need to initialize it?
Agree.. Not needed, will update.>> + int ret;
Quoted 12 lines
drivers/ufs/core/ufshcd.c static int ufshcd_quirk_tune_host_pa_tactivate(struct ufs_hba *hba) · line 8406
Quoted 9 lines
drivers/ufs/core/ufshcd.c +9
-0+ + ret =ufshcd_dme_get (hba,UIC_ARG_MIB (PA_HIBERN8TIME ), + &pa_h8time); +if (ret) { +dev_err (hba->dev,"Failed to get PA_HIBERN8TIME: %d\n" , ret); +return ; + } + +/* Increment by 1 to increase hibernation time by 100 µs */ From where the value of 100us adjustment is coming from?
Quoted 5 lines
Quoted 2 lines
- Mani
These values are derived from experiments on Qualcomm SoCs. However this is also matching with
ufs-exynos.cOkay. In that case, you should mention that the 100us value is derived from experiments on Qcom and Samsung SoCs. Otherwise, it gives an assumption that this value is universal.
Quoted 6 lines
Quoted 2 lines
- Mani
<< Otherwise, it gives an assumption that this value is universal. >>
So with this, should i add this quirk for Qcom only, or should add inufshcd.cand make it common for all SoC vendors?Quoted 5 lines
You can add the quirk for both Qcom and Samsung. My comment was about clarifying it in the kernel doc comments.
- Mani
Just for conclusion, why i moved this quirk from ufs-qcom to
ufshcd.cis as per Bart's suggestion in patchset
https://lore.kernel.org/lkml/[email protected]/<< Which of these quirks are required for all host controllers and which of these quirks are only required for Qualcomm host controllers?
Quoted 2 lines
Should we consider moving the
QUIRK_PA_HIBER8TIMEquirk to the ufshcd driver? Please advise.
Quoted 9 lines
That would be appreciated. >>
Just to brief,
QUIRK_PA_HIBER8TIMEis required for Samsung UFS devices and may be applicable to all SoC vendors with Samsung ufs device.If you suggest to move it to
ufs-qcom.c, i don't have any concern. BTW Samsung UFS driver already has this implemented in their driver, So i need not have to add this quirk to Samsung driver (ufs-exynos.c).
No. I think there was a miscommunication. You can add the quirk in ufshcd.c, but I just want you to mention that the quirk is currently applicable to Samsung UFS devices and the value of 100us is derived from experiments.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Quoted 2 lines · Manish Pandey
Introduce quirks for Samsung UFS devices to modify the PA TX HSG1 sync length and
TX_HS_EQUALIZERsettings on the Qualcomm UFS Host controller.
For what purpose, these quirks are required ? Is there any problem statement which you can mention first ?
Quoted 20 lines
Additionally, Samsung UFS devices require extra time in hibern8 mode before exiting, beyond the standard handshaking phase between the host and device. Introduce a quirk to increase the
PA_HIBERN8TIMEparameter by 100 µs to ensure a proper hibernation process.
---
Changes in V2
- Split patches to addPA_HIBERN8TIMEquirk inufshcd.c---
Manish Pandey (2):
ufs: qcom: Add quirks for Samsung UFS devices
scsi: ufs: introduce quirk to extendPA_HIBERN8TIMEfor UFS devicesdrivers/ufs/core/ufshcd.c | 31 ++++++++++++++++++++++++++ drivers/ufs/host/ufs-qcom.c | 43 +++++++++++++++++++++++++++++++++++++ drivers/ufs/host/ufs-qcom.h | 18 ++++++++++++++++ include/ufs/ufs_quirks.h | 6 ++++++ 4 files changed, 98 insertions(+)