UFS cleanups and enhancements to ufs-exynos for gs101
Peter Griffin
maintainerv2 cover UFS cleanups and enhancements to ufs-exynos for gs101
Hi folks,
This series provides a few cleanups, bug fixes and feature enhancements for the ufs-exynos driver, particularly for gs101 SoC.
Regarding cleanup we remove some unused phy attribute data that isn't required when EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR is not set.
Regarding bug fixes the check for EXYNOS_UFS_OPT_UFSPR_SECURE is moved inside exynos_ufs_config_smu() which fixes a Serror in the resume path for gs101.
Regarding feature enhancements:
* Gear 4 is enabled which has higher speeds and better power management.
* WriteBooster capability is enabled for gs101 which increases write performance.
In v2 of this series additionally I've added following patches 8-11 which add
* Clock gating and hibern8 capabilities are enabled for gs101. This leads to a significantly cooler phone when running the upstream kernel on Pixel 6.
Approximately 10 degrees cooler after 20 minutes at a shell prompt.
* AXI bus on gs101 is correctly configured for write line unique transactions
* ACG is set to be controlled by UFS_ACG_DISABLE for gs101
In v1 I mentioned the phy hibern8 series in [1] that is still under discussion however further testing reveals hibern8 feature still works without the additional UFS phy register writes done in [1]. So this series can be merged as is.
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/T/
regards,
Peter
Changes since v1:
- Remove superfluous struct device parameter to exynos_ufs_shareability() (Peter)
- Add patches 8-11 (hibern8 fixes, WLU support etc)
Peter Griffin (11):
scsi: ufs: exynos: Allow UFS Gear 4
scsi: ufs: exynos: add check inside exynos_ufs_config_smu()
scsi: ufs: exynos: gs101: remove EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL
scsi: ufs: exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR check
scsi: ufs: exynos: gs101: remove unused phy attribute fields
scsi: ufs: exynos: remove tx_dif_p_nsec from exynosauto_ufs_drv_init()
scsi: ufs: exynos: add gs101_ufs_drv_init() hook and enable
WriteBooster
scsi: ufs: exynos: enable write line unique transactions on gs101
scsi: ufs: exynos: set ACG to be controlled by UFS_ACG_DISABLE
scsi: ufs: exynos: fix hibern8 notify callbacks
scsi: ufs: exynos: gs101: enable clock gating with hibern8
drivers/ufs/host/ufs-exynos.c | 126 +++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 56 deletions(-)
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Peter Griffin
maintainerPATCH v2 1/11 scsi: ufs: exynos: Allow UFS Gear 4
UFS Gear 4 offers faster speeds, and better power usage so lets enable it.
Currently ufshcd_init_host_params() sets UFS_HS_G3 as a default, so even if the device supports G4 we end up negotiating down to G3.
For SoCs like gs101 which have a UFS major controller version of 3 or above advertise Gear 4. This then allows a Gear 4 link on Pixel 6.
For earlier controller versions keep the current default behaviour of reporting G3.
--- drivers/ufs/host/ufs-exynos.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/ufs/host/ufs-exynos.c +17 -0
@@ -771,6 +771,21 @@ static void exynos_ufs_config_sync_pattern_mask(struct exynos_ufs *ufs,exynos_ufs_disable_ov_tm (hba); } +#define UFS_HW_VER_MAJOR_MASK GENMASK(15, 8) + +static u32 exynos_ufs_get_hs_gear (struct ufs_hba *hba) +{ +u8 major; + + major =FIELD_GET (UFS_HW_VER_MAJOR_MASK , hba->ufs_version); + +if (major >=3 ) +return UFS_HS_G4 ; + +/* Default is HS-G3 */ +return UFS_HS_G3 ; +} +static int exynos_ufs_pre_pwr_mode (struct ufs_hba *hba,struct ufs_pa_layer_attr *dev_max_params,struct ufs_pa_layer_attr *dev_req_params)
@@ -787,6 +802,8 @@ static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, }ufshcd_init_host_params (&host_params); +/* This driver only support symmetric gear setting e.g. hs_tx_gear == hs_rx_gear */ + host_params.hs_tx_gear = host_params.hs_rx_gear =exynos_ufs_get_hs_gear (hba); ret =ufshcd_negotiate_pwr_params (&host_params, dev_max_params, dev_req_params);if (ret) {
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 01/11] scsi: ufs: exynos: Allow UFS Gear 4
Quoted 7 lines · Peter Griffin
UFS Gear 4 offers faster speeds, and better power usage so lets enable it.
Currently
ufshcd_init_host_params()setsUFS_HS_G3as a default, so even if the device supports G4 we end up negotiating down to G3.
Quoted 8 lines
For SoCs like gs101 which have a UFS major controller version of 3 or above advertise Gear 4. This then allows a Gear 4 link on Pixel 6.
For earlier controller versions keep the current default behaviour of reporting G3.
Signed-off-by Peter Griffin <[email protected]>
some nits/personal preferences below, no need to address them
Quoted 31 lines
--- drivers/ufs/host/ufs-exynos.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/ufs/host/ufs-exynos.c +15
-0@@ -771,6 +771,21 @@ static void exynos_ufs_config_sync_pattern_mask(struct exynos_ufs *ufs,exynos_ufs_disable_ov_tm (hba); } +#define UFS_HW_VER_MAJOR_MASK GENMASK(15, 8) + +static u32 exynos_ufs_get_hs_gear (struct ufs_hba *hba) +{ +u8 major; + + major =FIELD_GET (UFS_HW_VER_MAJOR_MASK , hba->ufs_version); + +if (major >=3 ) +return UFS_HS_G4 ; + +/* Default is HS-G3 */ +return UFS_HS_G3 ; +} +static int exynos_ufs_pre_pwr_mode (struct ufs_hba *hba,struct ufs_pa_layer_attr *dev_max_params,struct ufs_pa_layer_attr *dev_req_params)
drivers/ufs/host/ufs-exynos.c static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, · line 804
Quoted 3 lines
drivers/ufs/host/ufs-exynos.c +0
-0@@ -787,6 +802,8 @@ static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, }ufshcd_init_host_params (&host_params);
blank line
drivers/ufs/host/ufs-exynos.c static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba, · line 806
Quoted 2 lines
drivers/ufs/host/ufs-exynos.c +2
-0+/* This driver only support symmetric gear setting e.g. hs_tx_gear == hs_rx_gear */ + host_params.hs_tx_gear = host_params.hs_rx_gear =exynos_ufs_get_hs_gear (hba);
I find it easier to read if you split inits on their own line:
host_params.hs_tx_gear = exynos_ufs_get_hs_gear(hba); host_params.hs_rx_gear = exynos_ufs_get_hs_gear(hba);
Quoted 3 lines
drivers/ufs/host/ufs-exynos.c +0
-0ret =ufshcd_negotiate_pwr_params (&host_params, dev_max_params, dev_req_params);if (ret) {
Peter Griffin
maintainerRe: [PATCH v2 01/11] scsi: ufs: exynos: Allow UFS Gear 4
Hi Tudor,
Quoted 15 lines · Tudor Ambarus
Quoted 11 lines · Peter Griffin
UFS Gear 4 offers faster speeds, and better power usage so lets enable it.
Currently
ufshcd_init_host_params()setsUFS_HS_G3as a default, so even if the device supports G4 we end up negotiating down to G3.For SoCs like gs101 which have a UFS major controller version of 3 or above advertise Gear 4. This then allows a Gear 4 link on Pixel 6.
Quoted 8 lines
Quoted 4 lines
For earlier controller versions keep the current default behaviour of reporting G3.
Signed-off-by Peter Griffin <[email protected]>Reviewed-by Tudor Ambarus <[email protected]>some nits/personal preferences below, no need to address them
As I'm re-spinning anyways I'll update it like you suggest.
Peter.
Peter Griffin
maintainerPATCH v2 2/11 scsi: ufs: exynos: add check inside exynos_ufs_config_smu()
In reply to Peter GriffinMove the EXYNOS_UFS_OPT_UFSPR_SECURE check inside exynos_ufs_config_smu().
This way all call sites will benefit from the check. This fixes a bug currently in the exynos_ufs_resume() path on gs101 which will cause a serror.
--- drivers/ufs/host/ufs-exynos.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/ufs/host/ufs-exynos.c +5 -2
@@ -724,6 +724,9 @@ static void exynos_ufs_config_smu(struct exynos_ufs *ufs) {u32 reg, val; +if (ufs->opts &EXYNOS_UFS_OPT_UFSPR_SECURE ) +return ; +exynos_ufs_disable_auto_ctrl_hcc_save (ufs, &val);/* make encryption disabled by default */
@@ -1457,8 +1460,8 @@ static int exynos_ufs_init(struct ufs_hba *hba)if (ret) goto out;exynos_ufs_specify_phy_time_attr (ufs); -if (!(ufs->opts &EXYNOS_UFS_OPT_UFSPR_SECURE )) -exynos_ufs_config_smu (ufs); + +exynos_ufs_config_smu (ufs); hba->host->dma_alignment =DATA_UNIT_SIZE -1 ;return 0 ;
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 02/11] scsi: ufs: exynos: add check inside exynos_ufs_config_smu()
Quoted 5 lines · Peter Griffin
Move the
EXYNOS_UFS_OPT_UFSPR_SECUREcheck insideexynos_ufs_config_smu().This way all call sites will benefit from the check. This fixes a bug currently in the
exynos_ufs_resume()path on gs101 which will cause a serror.
because resume() calls exynos_ufs_config_smu() and we ended up accessing register fields that we shouldn't have.
Quoted 2 lines
Fixes d11e0a318df8 ("scsi: ufs: exynos: Add support for Tensor gs101 SoC")
Quoted 30 lines
Signed-off-by Peter Griffin <[email protected]>--- drivers/ufs/host/ufs-exynos.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/ufs/host/ufs-exynos.c +5
-2@@ -724,6 +724,9 @@ static void exynos_ufs_config_smu(struct exynos_ufs *ufs) {u32 reg, val; +if (ufs->opts &EXYNOS_UFS_OPT_UFSPR_SECURE ) +return ; +exynos_ufs_disable_auto_ctrl_hcc_save (ufs, &val);/* make encryption disabled by default */ @@ -1457,8 +1460,8 @@ static int exynos_ufs_init(struct ufs_hba *hba)if (ret) goto out;exynos_ufs_specify_phy_time_attr (ufs); -if (!(ufs->opts &EXYNOS_UFS_OPT_UFSPR_SECURE )) -exynos_ufs_config_smu (ufs); + +exynos_ufs_config_smu (ufs); hba->host->dma_alignment =DATA_UNIT_SIZE -1 ;return 0 ;
Peter Griffin
maintainerPATCH v2 3/11 scsi: ufs: exynos: gs101: remove EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL
In reply to Peter GriffinThis flag is not required for gs101 SoC.
--- drivers/ufs/host/ufs-exynos.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ufs/host/ufs-exynos.c +1 -2
@@ -2142,8 +2142,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = {UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR |UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL | UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING, - .opts =EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL | -EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | + .opts =EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR |EXYNOS_UFS_OPT_UFSPR_SECURE | EXYNOS_UFS_OPT_TIMER_TICK_SELECT, .drv_init = exynosauto_ufs_drv_init,
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 03/11] scsi: ufs: exynos: gs101: remove EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL
Quoted 2 lines · Peter Griffin
This flag is not required for gs101 SoC.
nitpick, use imperative
Auto clk control works fine for gs101, removeEXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL flag.
(or something along these lines)
Quoted 19 lines
Signed-off-by Peter Griffin <[email protected]>--- drivers/ufs/host/ufs-exynos.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/ufs/host/ufs-exynos.c +1
-2@@ -2142,8 +2142,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = {UFSHCD_QUIRK_BROKEN_OCS_FATAL_ERROR |UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL | UFSHCD_QUIRK_SKIP_DEF_UNIPRO_TIMEOUT_SETTING, - .opts =EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL | -EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR | + .opts =EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR |EXYNOS_UFS_OPT_UFSPR_SECURE | EXYNOS_UFS_OPT_TIMER_TICK_SELECT, .drv_init = exynosauto_ufs_drv_init,
Peter Griffin
maintainerPATCH v2 4/11 scsi: ufs: exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR check
In reply to Peter GriffinThe values calculated in exynos_ufs_specify_phy_time_attr() are only used in exynos_ufs_config_phy_time_attr() and exynos_ufs_config_phy_cap_attr() if EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR flag is not set.
Add a check for this flag to exynos_ufs_specify_phy_time_attr() and return for platforms that don't set it.
--- drivers/ufs/host/ufs-exynos.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ufs/host/ufs-exynos.c +3 -0
@@ -546,6 +546,9 @@ static void exynos_ufs_specify_phy_time_attr(struct exynos_ufs *ufs)struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr;struct ufs_phy_time_cfg *t_cfg = &ufs->t_cfg; +if (ufs->opts &EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR ) +return ; + t_cfg->tx_linereset_p =exynos_ufs_calc_time_cntr (ufs, attr->tx_dif_p_nsec); t_cfg->tx_linereset_n =
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 04/11] scsi: ufs: exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR check
Quoted 2 lines · Peter Griffin
The values calculated in
exynos_ufs_specify_phy_time_attr()are only used inexynos_ufs_config_phy_time_attr()andexynos_ufs_config_phy_cap_attr()
all values set in exynos_ufs_specify_phy_time_attr() are used *only* in exynos_ufs_config_phy_time_attr(). Or did I miss something?
Quoted 1 line
if
EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTRflag is not set.
yep, wonderful.
Quoted 14 lines
Add a check for this flag to
exynos_ufs_specify_phy_time_attr()and return for platforms that don't set it.Signed-off-by Peter Griffin <[email protected]>--- drivers/ufs/host/ufs-exynos.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs-exynos.c +0
-0
drivers/ufs/host/ufs-exynos.c static void exynos_ufs_specify_phy_time_attr(struct exynos_ufs *ufs) · line 554
Quoted 9 lines
drivers/ufs/host/ufs-exynos.c +3
-0@@ -546,6 +546,9 @@ static void exynos_ufs_specify_phy_time_attr(struct exynos_ufs *ufs)struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr;struct ufs_phy_time_cfg *t_cfg = &ufs->t_cfg; +if (ufs->opts &EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR ) +return ; + t_cfg->tx_linereset_p =exynos_ufs_calc_time_cntr (ufs, attr->tx_dif_p_nsec); t_cfg->tx_linereset_n =
tx_linereset_n, rx_hibern8_wait is set but not used anywhere. Can we remove it? Not related to this patch though.
Re: [PATCH v2 04/11] scsi: ufs: exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR check
Quoted 2 lines · Tudor Ambarus
tx_linereset_n,rx_hibern8_waitis set but not used anywhere. Can we remove it? Not related to this patch though.
Sent patches to remove these fields at:
Peter Griffin
maintainerRe: [PATCH v2 04/11] scsi: ufs: exynos: Add EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR check
In reply to Tudor AmbarusHi Tudor,
Quoted 9 lines · Tudor Ambarus
Quoted 2 lines · Peter Griffin
The values calculated in
exynos_ufs_specify_phy_time_attr()are only used inexynos_ufs_config_phy_time_attr()andexynos_ufs_config_phy_cap_attr()all values set in
exynos_ufs_specify_phy_time_attr()are used *only* inexynos_ufs_config_phy_time_attr(). Or did I miss something?
Yes you're right, I'll update the commit message.
Quoted 22 lines
Quoted 2 lines
if
EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTRflag is not set.yep, wonderful.
Quoted 17 lines
Add a check for this flag to
exynos_ufs_specify_phy_time_attr()and return for platforms that don't set it.Signed-off-by Peter Griffin <[email protected]>--- drivers/ufs/host/ufs-exynos.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs-exynos.c +0
-0@@ -546,6 +546,9 @@ static void exynos_ufs_specify_phy_time_attr(struct exynos_ufs *ufs)struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr;struct ufs_phy_time_cfg *t_cfg = &ufs->t_cfg;
Quoted 9 lines
drivers/ufs/host/ufs-exynos.c static void exynos_ufs_specify_phy_time_attr(struct exynos_ufs *ufs) · line 554
Quoted 6 lines
drivers/ufs/host/ufs-exynos.c +3
-0+if (ufs->opts &EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR ) +return ; + t_cfg->tx_linereset_p =exynos_ufs_calc_time_cntr (ufs, attr->tx_dif_p_nsec); t_cfg->tx_linereset_n =
tx_linereset_n,rx_hibern8_waitis set but not used anywhere. Can we remove it? Not related to this patch though.
Yes they can be removed if they are unused.
Peter
Peter Griffin
maintainerPATCH v2 5/11 scsi: ufs: exynos: gs101: remove unused phy attribute fields
In reply to Peter GriffinNow that exynos_ufs_specify_phy_time_attr() checks the appropriate EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR flag. Remove the unused fields in gs101_uic_attr.
--- drivers/ufs/host/ufs-exynos.c | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/ufs/host/ufs-exynos.c +0 -20
@@ -2068,26 +2068,6 @@ static const struct exynos_ufs_drv_data exynos_ufs_drvs = {static struct exynos_ufs_uic_attr gs101_uic_attr = { .tx_trailingclks =0xff , - .tx_dif_p_nsec =3000000 ,/* unit: ns */ - .tx_dif_n_nsec =1000000 ,/* unit: ns */ - .tx_high_z_cnt_nsec =20000 ,/* unit: ns */ - .tx_base_unit_nsec =100000 ,/* unit: ns */ - .tx_gran_unit_nsec =4000 ,/* unit: ns */ - .tx_sleep_cnt =1000 ,/* unit: ns */ - .tx_min_activatetime =0xa , - .rx_filler_enable =0x2 , - .rx_dif_p_nsec =1000000 ,/* unit: ns */ - .rx_hibern8_wait_nsec =4000000 ,/* unit: ns */ - .rx_base_unit_nsec =100000 ,/* unit: ns */ - .rx_gran_unit_nsec =4000 ,/* unit: ns */ - .rx_sleep_cnt =1280 ,/* unit: ns */ - .rx_stall_cnt =320 ,/* unit: ns */ - .rx_hs_g1_sync_len_cap =SYNC_LEN_COARSE (0xf ), - .rx_hs_g2_sync_len_cap =SYNC_LEN_COARSE (0xf ), - .rx_hs_g3_sync_len_cap =SYNC_LEN_COARSE (0xf ), - .rx_hs_g1_prep_sync_len_cap =PREP_LEN (0xf ), - .rx_hs_g2_prep_sync_len_cap =PREP_LEN (0xf ), - .rx_hs_g3_prep_sync_len_cap =PREP_LEN (0xf ), .pa_dbg_opt_suite1_val =0x90913C1C , .pa_dbg_opt_suite1_off =PA_GS101_DBG_OPTION_SUITE1 , .pa_dbg_opt_suite2_val =0xE01C115F ,
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 05/11] scsi: ufs: exynos: gs101: remove unused phy attribute fields
Quoted 5 lines · Peter Griffin
Now that
exynos_ufs_specify_phy_time_attr()checks the appropriateEXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTRflag. Remove the unused fields ings101_uic_attr.Signed-off-by Peter Griffin <[email protected]>
Quoted 9 lines
--- drivers/ufs/host/ufs-exynos.c | 20 -------------------- 1 file changed, 20 deletions(-)drivers/ufs/host/ufs-exynos.c +0
-0
drivers/ufs/host/ufs-exynos.c static const struct exynos_ufs_drv_data exynos_ufs_drvs = { · line 2076
Quoted 9 lines
drivers/ufs/host/ufs-exynos.c +0
-6@@ -2068,26 +2068,6 @@ static const struct exynos_ufs_drv_data exynos_ufs_drvs = {static struct exynos_ufs_uic_attr gs101_uic_attr = { .tx_trailingclks =0xff , - .tx_dif_p_nsec =3000000 ,/* unit: ns */ - .tx_dif_n_nsec =1000000 ,/* unit: ns */ - .tx_high_z_cnt_nsec =20000 ,/* unit: ns */ - .tx_base_unit_nsec =100000 ,/* unit: ns */ - .tx_gran_unit_nsec =4000 ,/* unit: ns */ - .tx_sleep_cnt =1000 ,/* unit: ns */
Okay with the removal of the above. All are set in exynos_ufs_specify_phy_time_attr(), which returns early if EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR is set.
drivers/ufs/host/ufs-exynos.c static const struct exynos_ufs_drv_data exynos_ufs_drvs = { · line 2078
Quoted 2 lines
drivers/ufs/host/ufs-exynos.c +0
-2- .tx_min_activatetime = 0xa, - .rx_filler_enable = 0x2,
Okay with these. They are used just in exynos_ufs_config_phy_time_attr which is guarded by EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR.
drivers/ufs/host/ufs-exynos.c static const struct exynos_ufs_drv_data exynos_ufs_drvs = { · line 2084
Quoted 6 lines
drivers/ufs/host/ufs-exynos.c +0
-6- .rx_dif_p_nsec = 1000000, /* unit: ns */ - .rx_hibern8_wait_nsec = 4000000, /* unit: ns */ - .rx_base_unit_nsec = 100000, /* unit: ns */ - .rx_gran_unit_nsec = 4000, /* unit: ns */ - .rx_sleep_cnt = 1280, /* unit: ns */ - .rx_stall_cnt = 320, /* unit: ns */
Okay with the removal of the above. All are set in exynos_ufs_specify_phy_time_attr(), which returns early if EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR is set.
drivers/ufs/host/ufs-exynos.c static const struct exynos_ufs_drv_data exynos_ufs_drvs = { · line 2090
Quoted 6 lines
drivers/ufs/host/ufs-exynos.c +0
-6- .rx_hs_g1_sync_len_cap = SYNC_LEN_COARSE(0xf), - .rx_hs_g2_sync_len_cap = SYNC_LEN_COARSE(0xf), - .rx_hs_g3_sync_len_cap = SYNC_LEN_COARSE(0xf), - .rx_hs_g1_prep_sync_len_cap = PREP_LEN(0xf), - .rx_hs_g2_prep_sync_len_cap = PREP_LEN(0xf), - .rx_hs_g3_prep_sync_len_cap = PREP_LEN(0xf),
Okay for these as well, all are set in exynos_ufs_config_phy_cap_attr() which is guarded by EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR.
Quoted 3 lines
drivers/ufs/host/ufs-exynos.c +0
-0.pa_dbg_opt_suite1_val = 0x90913C1C, .pa_dbg_opt_suite1_off = PA_GS101_DBG_OPTION_SUITE1, .pa_dbg_opt_suite2_val = 0xE01C115F,
Peter Griffin
maintainerPATCH v2 6/11 scsi: ufs: exynos: remove tx_dif_p_nsec from exynosauto_ufs_drv_init()
In reply to Peter GriffinFirstly exynosauto sets EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR so setting tx_dif_p_nsec has no effect.
Secondly this assignment can't get executed as samsung,sysreg dt property is provided in for this platform. Meaning the execution flow will return on regmap_update_bits call above.
--- drivers/ufs/host/ufs-exynos.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/ufs/host/ufs-exynos.c +0 -4
@@ -205,8 +205,6 @@ static int exynos7_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs)static int exynosauto_ufs_drv_init (struct device *dev,struct exynos_ufs *ufs) { -struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; -/* IO Coherency setting */ if (ufs->sysreg) { return regmap_update_bits(ufs->sysreg,
@@ -214,8 +212,6 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs) UFS_SHARABLE, UFS_SHARABLE); } - attr->tx_dif_p_nsec =3200000 ; -return 0 ; }
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 06/11] scsi: ufs: exynos: remove tx_dif_p_nsec from exynosauto_ufs_drv_init()
Quoted 1 line · Peter Griffin
Firstly exynosauto sets
EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTRso setting
exynosauto and gs101, the users of exynosauto_ufs_drv_init().
Quoted 1 line
tx_dif_p_nsechas no effect.
Both set EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR, the conclusion is correct for gs101 as well.
With this addressed:
nitpick/personal preference: I wouldn't use the commit body as a continuation of the subject. I would specify what the commit does in the body as well. No need to address.
Also, as a side note, I thought of removing tx_dif_p_nsec from exynos7_uic_attr, but it seems that this struct is used by exynos_ufs_drvs as well, which don't set EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR. That's a little confusing, I guess it's more clear if each driver has its own required settings specified.
Peter Griffin
maintainerPATCH v2 7/11 scsi: ufs: exynos: add gs101_ufs_drv_init() hook and enable WriteBooster
In reply to Peter GriffinFactor out the common code into a new exynos_ufs_shareability() function and provide a dedicated gs101_drv_init() hook.
This allows us to enable WriteBooster capability (UFSHCD_CAP_WB_EN) in a way that doesn't effect other SoCs supported in this driver.
WriteBooster improves write speeds by enabling a pseudo SLC cache. Using the fio seqwrite test we can achieve speeds of 945MB/s with this feature enabled (until the cache is exhausted) before dropping back to ~260MB/s (which are the speeds we see without the WriteBooster feature enabled).
Assuming the UFSHCD_CAP_WB_EN capability is set by the host then WriteBooster can also be enabled and disabled via sysfs so it is possible for the system to only enable it when extra write performance is required.
--- drivers/ufs/host/ufs-exynos.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/ufs/host/ufs-exynos.c +17 -2
@@ -203,7 +203,7 @@ static int exynos7_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs)return 0 ; } -static int exynosauto_ufs_drv_init (struct device *dev,struct exynos_ufs *ufs) +static int exynos_ufs_shareability (struct exynos_ufs *ufs) {/* IO Coherency setting */ if (ufs->sysreg) {
@@ -215,6 +215,21 @@ static int exynosauto_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs)return 0 ; } +static int gs101_ufs_drv_init (struct device *dev,struct exynos_ufs *ufs) +{ +struct ufs_hba *hba = ufs->hba; + +/* Enable WriteBooster */ + hba->caps |=UFSHCD_CAP_WB_EN ; + +return exynos_ufs_shareability (ufs); +} + +static int exynosauto_ufs_drv_init (struct device *dev,struct exynos_ufs *ufs) +{ +return exynos_ufs_shareability (ufs); +} +static int exynosauto_ufs_post_hce_enable (struct exynos_ufs *ufs) {struct ufs_hba *hba = ufs->hba;
@@ -2124,7 +2139,7 @@ static const struct exynos_ufs_drv_data gs101_ufs_drvs = { .opts = EXYNOS_UFS_OPT_SKIP_CONFIG_PHY_ATTR |EXYNOS_UFS_OPT_UFSPR_SECURE | EXYNOS_UFS_OPT_TIMER_TICK_SELECT, - .drv_init = exynosauto_ufs_drv_init, + .drv_init = gs101_ufs_drv_init, .pre_link = gs101_ufs_pre_link, .post_link = gs101_ufs_post_link, .pre_pwr_change = gs101_ufs_pre_pwr_change,
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 07/11] scsi: ufs: exynos: add gs101_ufs_drv_init() hook and enable WriteBooster
Quoted 11 lines · Peter Griffin
Factor out the common code into a new
exynos_ufs_shareability()function and provide a dedicatedgs101_drv_init()hook.This allows us to enable WriteBooster capability (
UFSHCD_CAP_WB_EN) in a way that doesn't effect other SoCs supported in this driver.WriteBooster improves write speeds by enabling a pseudo SLC cache. Using the
fio seqwritetest we can achieve speeds of 945MB/s with this feature enabled (until the cache is exhausted) before dropping back to ~260MB/s (which are the speeds we see without the WriteBooster feature enabled).
Quoted 5 lines
Assuming the
UFSHCD_CAP_WB_ENcapability is set by the host then WriteBooster can also be enabled and disabled via sysfs so it is possible for the system to only enable it when extra write performance is required.Signed-off-by Peter Griffin <[email protected]>
While reviewing this patch I noticed few cleanups can be made. I sent them here:
https://lore.kernel.org/linux-scsi/[email protected]/
Feel free to include them in your set if you're going to respin. Or not, if you don't want to tie your head with cleanup patches. I can respin them on top of yours later on.
Peter Griffin
maintainerPATCH v2 8/11 scsi: ufs: exynos: enable write line unique transactions on gs101
In reply to Peter GriffinPreviously just AXIDMA_RWDATA_BURST_LEN[3:0] field was set to 8.
To enable WLU transaction additionally we need to set Write Line Unique enable [31], Write Line Unique Burst Length [30:27] and AXIDMA_RWDATA_BURST_LEN[3:0].
To support WLU transaction, both burth length fields need to be 0x3.
--- drivers/ufs/host/ufs-exynos.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ufs/host/ufs-exynos.c +8 -0
@@ -48,6 +48,8 @@#define HCI_UNIPRO_APB_CLK_CTRL 0x68#define UNIPRO_APB_CLK (v, x) (((v) & ~0xF) | ((x) & 0xF))#define HCI_AXIDMA_RWDATA_BURST_LEN 0x6C +#define WLU_EN BIT(31) +#define WLU_BURST_LEN (x) ((x) << 27 | ((x) & 0xF))#define HCI_GPIO_OUT 0x70#define HCI_ERR_EN_PA_LAYER 0x78#define HCI_ERR_EN_DL_LAYER 0x7C
@@ -1925,6 +1927,12 @@ static int gs101_ufs_post_link(struct exynos_ufs *ufs) {struct ufs_hba *hba = ufs->hba; +/* +* Enable Write Line Unique. This field has to be 0x3 +* to support Write Line Unique transaction on gs101. +*/ +hci_writel (ufs,WLU_EN |WLU_BURST_LEN (3 ),HCI_AXIDMA_RWDATA_BURST_LEN ); +exynos_ufs_enable_dbg_mode (hba);ufshcd_dme_set (hba,UIC_ARG_MIB (PA_SAVECONFIGTIME ),0x3e8 );exynos_ufs_disable_dbg_mode (hba);
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 08/11] scsi: ufs: exynos: enable write line unique transactions on gs101
Quoted 1 line · Peter Griffin
Previously just AXIDMA_RWDATA_BURST_LEN[3:0] field was set to 8.
where was this set?
Quoted 7 lines
To enable WLU transaction additionally we need to set Write Line Unique enable [31], Write Line Unique Burst Length [30:27] and AXIDMA_RWDATA_BURST_LEN[3:0].
To support WLU transaction, both burth length fields need to be
0x3.
typo, s/burth/burst
Peter Griffin
maintainerRe: [PATCH v2 08/11] scsi: ufs: exynos: enable write line unique transactions on gs101
Hi Tudor,
Quoted 7 lines · Tudor Ambarus
Quoted 1 line · Peter Griffin
Previously just AXIDMA_RWDATA_BURST_LEN[3:0] field was set to 8.
where was this set?
It is set to 0xf in exynos_ufs_post_link() function, see the following line hci_writel(ufs, 0xf, HCI_AXIDMA_RWDATA_BURST_LEN);
As all other SoCs expect the current value, I've left that assignment in the common function, and we update it in the gs101_ufs_post_link() specific hook.
Quoted 10 lines
Quoted 8 lines
To enable WLU transaction additionally we need to set Write Line Unique enable [31], Write Line Unique Burst Length [30:27] and AXIDMA_RWDATA_BURST_LEN[3:0].
To support WLU transaction, both burth length fields need to be
0x3.typo, s/burth/burst
Will fix.
Peter
Tudor Ambarus
Reviewed-byRe: [PATCH v2 08/11] scsi: ufs: exynos: enable write line unique transactions on gs101
Quoted 9 lines · Peter Griffin
Quoted 2 lines
Quoted 1 line
Previously just AXIDMA_RWDATA_BURST_LEN[3:0] field was set to 8.
where was this set?
It is set to
0xfinexynos_ufs_post_link()function, see the following linehci_writel(ufs, 0xf, HCI_AXIDMA_RWDATA_BURST_LEN);As all other SoCs expect the current value, I've left that assignment in the common function, and we update it in the
gs101_ufs_post_link()specific hook.
oh yes, as a driver quirk.
Peter Griffin
maintainerPATCH v2 9/11 scsi: ufs: exynos: set ACG to be controlled by UFS_ACG_DISABLE
In reply to Peter GriffinHCI_IOP_ACG_DISABLE is an undocumented register in the TRM but the downstream driver sets this register so we follow suit here.
The register is already 0 presumed to be set by the bootloader as the comment downstream implies the reset state is 1. So whilst this is a nop currently, it should help with suspend/resume.
--- drivers/ufs/host/ufs-exynos.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/ufs/host/ufs-exynos.c +9 -0
@@ -76,6 +76,10 @@#define CLK_CTRL_EN_MASK (REFCLK_CTRL_EN |\ UNIPRO_PCLK_CTRL_EN |\ UNIPRO_MCLK_CTRL_EN) + +#define HCI_IOP_ACG_DISABLE 0x100 +#define HCI_IOP_ACG_DISABLE_EN BIT(0) +/* Device fatal error */ #define DFES_ERR_EN BIT(31)#define DFES_DEF_L2_ERRS (UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF |\
@@ -220,10 +224,15 @@ static int exynos_ufs_shareability(struct exynos_ufs *ufs)static int gs101_ufs_drv_init (struct device *dev,struct exynos_ufs *ufs) {struct ufs_hba *hba = ufs->hba; +u32 reg;/* Enable WriteBooster */ hba->caps |=UFSHCD_CAP_WB_EN ; +/* set ACG to be controlled by UFS_ACG_DISABLE */ + reg =hci_readl (ufs,HCI_IOP_ACG_DISABLE ); +hci_writel (ufs, reg & (~HCI_IOP_ACG_DISABLE_EN ),HCI_IOP_ACG_DISABLE ); +return exynos_ufs_shareability (ufs); }
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 09/11] scsi: ufs: exynos: set ACG to be controlled by UFS_ACG_DISABLE
Quoted 6 lines · Peter Griffin
HCI_IOP_ACG_DISABLEis an undocumented register in the TRM but the downstream driver sets this register so we follow suit here.The register is already 0 presumed to be set by the bootloader as the comment downstream implies the reset state is 1. So whilst this is a nop currently, it should help with suspend/resume.
It should help in case the bootloader changes I assume. I see gs101_ufs_drv_init() gets called only at probe time, via ufshcd_pltfrm_init().
Quoted 2 lines
Signed-off-by Peter Griffin <[email protected]>
Quoted 35 lines
--- drivers/ufs/host/ufs-exynos.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/ufs/host/ufs-exynos.c +9
-0@@ -76,6 +76,10 @@#define CLK_CTRL_EN_MASK (REFCLK_CTRL_EN |\ UNIPRO_PCLK_CTRL_EN |\ UNIPRO_MCLK_CTRL_EN) + +#define HCI_IOP_ACG_DISABLE 0x100 +#define HCI_IOP_ACG_DISABLE_EN BIT(0) +/* Device fatal error */ #define DFES_ERR_EN BIT(31)#define DFES_DEF_L2_ERRS (UIC_DATA_LINK_LAYER_ERROR_RX_BUF_OF |\@@ -220,10 +224,15 @@ static int exynos_ufs_shareability(struct exynos_ufs *ufs)static int gs101_ufs_drv_init (struct device *dev,struct exynos_ufs *ufs) {struct ufs_hba *hba = ufs->hba; +u32 reg;/* Enable WriteBooster */ hba->caps |=UFSHCD_CAP_WB_EN ; +/* set ACG to be controlled by UFS_ACG_DISABLE */ + reg =hci_readl (ufs,HCI_IOP_ACG_DISABLE ); +hci_writel (ufs, reg & (~HCI_IOP_ACG_DISABLE_EN ),HCI_IOP_ACG_DISABLE ); +return exynos_ufs_shareability (ufs); }
Peter Griffin
maintainerPATCH v2 10/11 scsi: ufs: exynos: fix hibern8 notify callbacks
In reply to Peter Griffinv1 of the patch which introduced the ufshcd_vops_hibern8_notify() callback used a bool instead of an enum. In v2 this was updated to an enum based on the review feedback in [1].
ufs-exynos hibernate calls have always been broken upstream as it follows the v1 bool implementation.
[1] https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/
---
--- drivers/ufs/host/ufs-exynos.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/ufs/host/ufs-exynos.c +8 -8
@@ -1529,12 +1529,12 @@ static void exynos_ufs_dev_hw_reset(struct ufs_hba *hba)hci_writel (ufs,1 <<0 ,HCI_GPIO_OUT ); } -static void exynos_ufs_pre_hibern8 (struct ufs_hba *hba,u8 enter) +static void exynos_ufs_pre_hibern8 (struct ufs_hba *hba,enum uic_cmd_dme cmd) {struct exynos_ufs *ufs =ufshcd_get_variant (hba);struct exynos_ufs_uic_attr *attr = ufs->drv_data->uic_attr; -if (!enter) { +if (cmd ==UIC_CMD_DME_HIBER_EXIT ) {if (ufs->opts &EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL )exynos_ufs_disable_auto_ctrl_hcc (ufs);exynos_ufs_ungate_clks (ufs);
@@ -1562,11 +1562,11 @@ static void exynos_ufs_pre_hibern8(struct ufs_hba *hba, u8 enter) } } -static void exynos_ufs_post_hibern8 (struct ufs_hba *hba,u8 enter) +static void exynos_ufs_post_hibern8 (struct ufs_hba *hba,enum uic_cmd_dme cmd) {struct exynos_ufs *ufs =ufshcd_get_variant (hba); -if (!enter) { +if (cmd ==UIC_CMD_DME_HIBER_EXIT ) {u32 cur_mode =0 ;u32 pwrmode;
@@ -1585,7 +1585,7 @@ static void exynos_ufs_post_hibern8(struct ufs_hba *hba, u8 enter)if (!(ufs->opts &EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB ))exynos_ufs_establish_connt (ufs); - }else { + }else if (cmd ==UIC_CMD_DME_HIBER_ENTER ) { ufs->entry_hibern8_t =ktime_get ();exynos_ufs_gate_clks (ufs);if (ufs->opts &EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL )
@@ -1672,15 +1672,15 @@ static int exynos_ufs_pwr_change_notify(struct ufs_hba *hba, }static void exynos_ufs_hibern8_notify (struct ufs_hba *hba, -enum uic_cmd_dme enter, +enum uic_cmd_dme cmd,enum ufs_notify_change_status notify) {switch ((u8 )notify) {case PRE_CHANGE : -exynos_ufs_pre_hibern8 (hba, enter); +exynos_ufs_pre_hibern8 (hba, cmd);break ;case POST_CHANGE : -exynos_ufs_post_hibern8 (hba, enter); +exynos_ufs_post_hibern8 (hba, cmd);break ; } }
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 10/11] scsi: ufs: exynos: fix hibern8 notify callbacks
Quoted 8 lines · Peter Griffin
v1 of the patch which introduced the
ufshcd_vops_hibern8_notify()callback used a bool instead of an enum. In v2 this was updated to an enum based on the review feedback in [1].ufs-exynos hibernate calls have always been broken upstream as it follows the v1 bool implementation.
[1] https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/
you can use the Link tag, Link: blabla [1]
A Fixes tag and maybe Cc to stable? Or maybe you chose to not backport it intentionally, in which case you have to add:
Cc: <[email protected]> # reason goes here, and must be present
In order to avoid scripts queuing your patch. It contains "fix" in the subject, there's a high probability to be queued to stable.
With these addressed:
Peter Griffin
maintainerRe: [PATCH v2 10/11] scsi: ufs: exynos: fix hibern8 notify callbacks
Hi Tudor,
Quoted 8 lines · Tudor Ambarus
Quoted 4 lines · Peter Griffin
v1 of the patch which introduced the
ufshcd_vops_hibern8_notify()callback used a bool instead of an enum. In v2 this was updated to an enum based on the review feedback in [1].
Quoted 6 lines
Quoted 4 lines
ufs-exynos hibernate calls have always been broken upstream as it follows the v1 bool implementation.
[1] https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/
you can use the Link tag, Link: blabla [1]
Will fix in v3
Quoted 4 lines
A Fixes tag and maybe Cc to stable? Or maybe you chose to not backport it intentionally, in which case you have to add:
Cc: <[email protected]> # reason goes here, and must be present
I'll add a cc stable tag, as there is no reason not to backport this fix.
Quoted 6 lines
In order to avoid scripts queuing your patch. It contains "fix" in the subject, there's a high probability to be queued to stable.
With these addressed:
Reviewed-by Tudor Ambarus <[email protected]>
Thanks for the reviews!
Peter.
Peter Griffin
maintainerPATCH v2 11/11 scsi: ufs: exynos: gs101: enable clock gating with hibern8
In reply to Peter GriffinEnable clock gating and hibern8 capabilities for gs101. This leads to a significantly cooler phone when running the upstream kernel.
The exynos_ufs_post_hibern8() hook is also updated to remove the UIC_CMD_DME_HIBER_EXIT code path as this causes a hang on gs101.
The code path is removed rather than re-factored as no other SoC in ufs-exynos driver sets UFSHCD_CAP_HIBERN8_WITH_CLK_GATING capability. Additionally until the previous commit the hibern8 callbacks were broken anyway as they expected a bool.
--- drivers/ufs/host/ufs-exynos.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)
drivers/ufs/host/ufs-exynos.c +4 -20
@@ -229,6 +229,9 @@ static int gs101_ufs_drv_init(struct device *dev, struct exynos_ufs *ufs)/* Enable WriteBooster */ hba->caps |=UFSHCD_CAP_WB_EN ; +/* Enable clock gating and hibern8 */ + hba->caps |=UFSHCD_CAP_CLK_GATING |UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ; +/* set ACG to be controlled by UFS_ACG_DISABLE */ reg =hci_readl (ufs,HCI_IOP_ACG_DISABLE );hci_writel (ufs, reg & (~HCI_IOP_ACG_DISABLE_EN ),HCI_IOP_ACG_DISABLE );
@@ -1566,26 +1569,7 @@ static void exynos_ufs_post_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) {struct exynos_ufs *ufs =ufshcd_get_variant (hba); -if (cmd ==UIC_CMD_DME_HIBER_EXIT ) { -u32 cur_mode =0 ; -u32 pwrmode; - -if (ufshcd_is_hs_mode (&ufs->dev_req_params)) - pwrmode =FAST_MODE ; -else - pwrmode =SLOW_MODE ; - -ufshcd_dme_get (hba,UIC_ARG_MIB (PA_PWRMODE ), &cur_mode); -if (cur_mode != (pwrmode <<4 | pwrmode)) { -dev_warn (hba->dev,"%s: power mode change\n" , __func__); - hba->pwr_info.pwr_rx = (cur_mode >>4 ) &0xf ; - hba->pwr_info.pwr_tx = cur_mode &0xf ; -ufshcd_config_pwr_mode (hba, &hba->max_pwr_info.info); - } - -if (!(ufs->opts &EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB )) -exynos_ufs_establish_connt (ufs); - }else if (cmd ==UIC_CMD_DME_HIBER_ENTER ) { +if (cmd ==UIC_CMD_DME_HIBER_ENTER ) { ufs->entry_hibern8_t =ktime_get ();exynos_ufs_gate_clks (ufs);if (ufs->opts &EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL )
Signature · 1 line
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v2 11/11] scsi: ufs: exynos: gs101: enable clock gating with hibern8
Quoted 11 lines · Peter Griffin
Enable clock gating and hibern8 capabilities for gs101. This leads to a significantly cooler phone when running the upstream kernel.
The
exynos_ufs_post_hibern8()hook is also updated to remove theUIC_CMD_DME_HIBER_EXITcode path as this causes a hang on gs101.The code path is removed rather than re-factored as no other SoC in ufs-exynos driver sets
UFSHCD_CAP_HIBERN8_WITH_CLK_GATINGcapability. Additionally until the previous commit the hibern8 callbacks were broken anyway as they expected a bool.
I think too it's fine to remove uneeded code as it was broken anyway.
Quoted 10 lines
Signed-off-by Peter Griffin <[email protected]>--- drivers/ufs/host/ufs-exynos.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)drivers/ufs/host/ufs-exynos.c +0
-0
cut
Quoted 2 lines
drivers/ufs/host/ufs-exynos.c +0
-0@@ -1566,26 +1569,7 @@ static void exynos_ufs_post_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) {
cut
drivers/ufs/host/ufs-exynos.c static void exynos_ufs_post_hibern8(struct ufs_hba *hba, enum uic_cmd_dme cmd) · line 1572
Quoted 1 line
drivers/ufs/host/ufs-exynos.c +1
-0+if (cmd ==UIC_CMD_DME_HIBER_ENTER ) {
I verified that the order of operations at hibern8_enter/exit() is sane:
---hibern8_notify() gets called in ufshcd_uic_hibern8_enter/exit()
exynos_ufs_post_hibern8 disables the clocks for:
ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_ENTER, POST_CHANGE)
exynos_ufs_pre_hibern8() enables the clocks for:
ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_EXIT, PRE_CHANGE);