Enable HS-G5 support on SM8550
Subsystems (2)
v9 cover Enable HS-G5 support on SM8550
This series enables HS-G5 support on SM8550.
Please note that the changes to drivers/ufs/ have been picked up, resending this series for the remaining two changes to UFS PHY.
This series is rebased on below changes from Mani -
https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/
https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/
This series is tested on below HW combinations -
SM8550 MTP + UFS4.0
SM8550 QRD + UFS3.1
SM8450 MTP + UFS3.1 (for regression test)
SM8350 MTP + UFS3.1 (for regression test)
Note that during reboot test on above platforms, I occasinally hit PA (PHY) error during the 2nd init, this is not related with this series. A fix for this is mentioned in below patchwork -
https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/
Also note that on platforms, which have two sets of UFS PHY settings are provided (say G4 and no-G4, G5 and no-G5). The two sets of PHY settings are basically programming different values to different registers, mixing the two sets and/or overwriting one set with another set is definitely not blessed by UFS PHY designers. For SM8550, this series will make sure we honor the rule. However, for old targets Mani and I will fix them in another series in future.
v8 -> v9:
Rebased two changes to UFS PHY to the phy/next tree
v7 -> v8:
In "scsi: ufs: ufs-qcom: Add support for UFS device version detection", fixed a BUG introduced from v6 -> v7. The spare register is added since HW ver 5, although reading the spare register on HW ver 4 is just getting 0x0, to be on the safe side, we are exluding HW ver 4.
v6 -> v7:
1. Rebased on linux-next, based SM8650 PHY settings are merged there, no changes to patches for UFS driver
2. Addressed comments from Mani
v5 -> v6:
1. Rebased on scsi-queue-6.8
2. Addressed comments from Dmitry and Mani in patches to phy-qcom-qmp-ufs.c
v4 -> v5:
Removed two useless debug prints in patch #9
v3 -> v4:
Used .tbls_hs_overlay array instead of adding more tables with different names like .tbls_hs_g5
v2 -> v3:
1. Addressed comments from Andrew, Mani and Bart in patch #1
2. Added patch #2 as per request from Andrew and Mani
3. Added patch #4 to fix a common issue on old targets, it is not necessary for this series, but put in this series only because it would be easier to maintain and no need to rebase
4. Addressed comments from Dmitry and Mani in patches to phy-qcom-qmp-ufs.c
v1 -> v2:
1. Removed 2 changes which were exposing power info in sysfs
2. Removed 1 change which was moving data structs to phy-qcom-qmp-ufs.h
3. Added one new change (the 1st one) to clean up usage of ufs_dev_params based on comments from Mani
4. Adjusted the logic of UFS device version detection according to comments from Mani:
4.1 For HW version < 0x5, go through dual init
4.2 For HW version >= 0x5
a. If UFS device version is populated, one init is required b. If UFS device version is not populated, go through dual init
Can Guo (2):
phy: qualcomm: phy-qcom-qmp-ufs: Rectify SM8550 UFS HS-G4 PHY Settings
phy: qualcomm: phy-qcom-qmp-ufs: Add High Speed Gear 5 support for
SM8550
drivers/phy/qualcomm/phy-qcom-qmp-pcs-ufs-v6.h | 2 + drivers/phy/qualcomm/phy-qcom-qmp-qserdes-com-v6.h | 2 + .../qualcomm/phy-qcom-qmp-qserdes-txrx-ufs-v6.h | 12 ++ drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 186 ++++++++++++++++++--- 4 files changed, 175 insertions(+), 27 deletions(-)
Signature · 1 line
2.7.4
PATCH RESEND v9 1/2 phy: qualcomm: phy-qcom-qmp-ufs: Rectify SM8550 UFS HS-G4 PHY Settings
The registers, which are being touched in current SM8550 UFS PHY settings, and the values being programmed are mainly the ones working for HS-G4 mode, meanwhile, there are also a few ones somehow taken from HS-G5 PHY settings. However, even consider HS-G4 mode only, some of them are incorrect and some are missing. Rectify the HS-G4 PHY settings by strictly aligning with the SM8550 UFS PHY Hardware Programming Guide suggested HS-G4 PHY settings.
--- .../qualcomm/phy-qcom-qmp-qserdes-txrx-ufs-v6.h | 3 +++ drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 28 +++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-qserdes-txrx-ufs-v6.h +3 -0
@@ -10,9 +10,12 @@#define QSERDES_UFS_V6_TX_RES_CODE_LANE_RX 0x2c#define QSERDES_UFS_V6_TX_RES_CODE_LANE_OFFSET_TX 0x30#define QSERDES_UFS_V6_TX_RES_CODE_LANE_OFFSET_RX 0x34 +#define QSERDES_UFS_V6_TX_LANE_MODE_1 0x7c +#define QSERDES_UFS_V6_TX_FR_DCC_CTRL 0x108#define QSERDES_UFS_V6_RX_UCDR_FASTLOCK_FO_GAIN_RATE2 0x08#define QSERDES_UFS_V6_RX_UCDR_FASTLOCK_FO_GAIN_RATE4 0x10 +#define QSERDES_UFS_V6_RX_UCDR_FO_GAIN_RATE2 0xd4#define QSERDES_UFS_V6_RX_VGA_CAL_MAN_VAL 0x178#define QSERDES_UFS_V6_RX_MODE_RATE_0_1_B0 0x208#define QSERDES_UFS_V6_RX_MODE_RATE_0_1_B1 0x20c
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +19 -9
@@ -658,22 +658,26 @@ static const struct qmp_phy_init_tbl sm8550_ufsphy_serdes[] = {QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE0 ,0x14 ),QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x7f ),QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP2_MODE0 ,0x06 ), -QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE0 ,0x4c ), -QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE0 ,0x0a ), -QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE0 ,0x18 ), -QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE0 ,0x14 ), -QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE0 ,0x99 ), - QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE0, 0x07), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_DEC_START_MODE1 ,0x4c ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_CP_CTRL_MODE1 ,0x0a ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_RCTRL_MODE1 ,0x18 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_PLL_CCTRL_MODE1 ,0x14 ), +QMP_PHY_INIT_CFG (QSERDES_V6_COM_LOCK_CMP1_MODE1 ,0x99 ), + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE1, 0x07), +}; + +static const struct qmp_phy_init_tbl sm8550_ufsphy_hs_b_serdes[] = { +QMP_PHY_INIT_CFG (QSERDES_V6_COM_VCO_TUNE_MAP ,0x44 ), };static const struct qmp_phy_init_tbl sm8550_ufsphy_tx[] = { -QMP_PHY_INIT_CFG (QSERDES_V6_TX_LANE_MODE_1 ,0x05 ), +QMP_PHY_INIT_CFG (QSERDES_UFS_V6_TX_LANE_MODE_1 ,0x05 ),QMP_PHY_INIT_CFG (QSERDES_UFS_V6_TX_RES_CODE_LANE_OFFSET_TX ,0x07 ), +QMP_PHY_INIT_CFG (QSERDES_UFS_V6_TX_FR_DCC_CTRL ,0x4c ), };static const struct qmp_phy_init_tbl sm8550_ufsphy_rx[] = { -QMP_PHY_INIT_CFG (QSERDES_UFS_V6_RX_UCDR_FASTLOCK_FO_GAIN_RATE2 ,0x0c ), -QMP_PHY_INIT_CFG (QSERDES_UFS_V6_RX_UCDR_FASTLOCK_FO_GAIN_RATE4 ,0x0f ), +QMP_PHY_INIT_CFG (QSERDES_UFS_V6_RX_UCDR_FO_GAIN_RATE2 ,0x0c ),QMP_PHY_INIT_CFG (QSERDES_UFS_V6_RX_VGA_CAL_MAN_VAL ,0x0e ), QMP_PHY_INIT_CFG(QSERDES_UFS_V6_RX_MODE_RATE_0_1_B0, 0xc2),
@@ -696,6 +700,8 @@ static const struct qmp_phy_init_tbl sm8550_ufsphy_pcs[] = {QMP_PHY_INIT_CFG (QPHY_V6_PCS_UFS_TX_MID_TERM_CTRL1 ,0x43 ),QMP_PHY_INIT_CFG (QPHY_V6_PCS_UFS_PLL_CNTL ,0x2b ),QMP_PHY_INIT_CFG (QPHY_V6_PCS_UFS_MULTI_LANE_CTRL1 ,0x02 ), +QMP_PHY_INIT_CFG (QPHY_V6_PCS_UFS_TX_HSGEAR_CAPABILITY ,0x04 ), + QMP_PHY_INIT_CFG(QPHY_V6_PCS_UFS_RX_HSGEAR_CAPABILITY, 0x04), }; struct qmp_ufs_offsets {
@@ -1157,6 +1163,10 @@ static const struct qmp_phy_cfg sm8550_ufsphy_cfg = { .pcs = sm8550_ufsphy_pcs, .pcs_num = ARRAY_SIZE(sm8550_ufsphy_pcs), }, + .tbls_hs_b = { + .serdes = sm8550_ufsphy_hs_b_serdes, + .serdes_num = ARRAY_SIZE(sm8550_ufsphy_hs_b_serdes), + }, .clk_list = sdm845_ufs_phy_clk_l, .num_clks = ARRAY_SIZE(sdm845_ufs_phy_clk_l), .vreg_list = qmp_phy_vreg_l,
Signature · 1 line
2.7.4
PATCH RESEND v9 2/2 phy: qualcomm: phy-qcom-qmp-ufs: Add High Speed Gear 5 support for SM8550
In reply to Can GuoOn SM8550, two sets of UFS PHY settings are provided, one set is to support HS-G5, another set is to support HS-G4 and lower gears. The two sets of PHY settings are programming different values to different registers, mixing the two sets and/or overwriting one set with another set is definitely not blessed by UFS PHY designers.
To add HS-G5 support for SM8550, split the two sets of PHY settings into their dedicated overlay tables, only the common parts of the two sets of PHY settings are left in the .tbls.
Consider we are going to add even higher gear support in future, to avoid adding more tables with different names, rename the .tbls_hs_g4 and make it an array, a size of 2 is enough as of now.
In this case, .tbls alone is not a complete set of PHY settings, so either tbls_hs_overlay[0] or tbls_hs_overlay[1] must be applied on top of the .tbls to become a complete set of PHY settings.
--- drivers/phy/qualcomm/phy-qcom-qmp-pcs-ufs-v6.h | 2 + drivers/phy/qualcomm/phy-qcom-qmp-qserdes-com-v6.h | 2 + .../qualcomm/phy-qcom-qmp-qserdes-txrx-ufs-v6.h | 9 ++ drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 164 ++++++++++++++++++--- 4 files changed, 156 insertions(+), 21 deletions(-)
drivers/phy/qualcomm/phy-qcom-qmp-pcs-ufs-v6.h +2 -0
@@ -18,6 +18,7 @@#define QPHY_V6_PCS_UFS_BIST_FIXED_PAT_CTRL 0x060#define QPHY_V6_PCS_UFS_TX_HSGEAR_CAPABILITY 0x074#define QPHY_V6_PCS_UFS_RX_HSGEAR_CAPABILITY 0x0bc +#define QPHY_V6_PCS_UFS_RX_HS_G5_SYNC_LENGTH_CAPABILITY 0x12c#define QPHY_V6_PCS_UFS_DEBUG_BUS_CLKSEL 0x158#define QPHY_V6_PCS_UFS_LINECFG_DISABLE 0x17c#define QPHY_V6_PCS_UFS_RX_MIN_HIBERN8_TIME 0x184
@@ -27,5 +28,6 @@#define QPHY_V6_PCS_UFS_READY_STATUS 0x1a8#define QPHY_V6_PCS_UFS_TX_MID_TERM_CTRL1 0x1f4#define QPHY_V6_PCS_UFS_MULTI_LANE_CTRL1 0x1fc +#define QPHY_V6_PCS_UFS_RX_HSG5_SYNC_WAIT_TIME 0x220#endif
drivers/phy/qualcomm/phy-qcom-qmp-qserdes-com-v6.h +2 -0
@@ -56,6 +56,8 @@#define QSERDES_V6_COM_SYS_CLK_CTRL 0xe4#define QSERDES_V6_COM_SYSCLK_BUF_ENABLE 0xe8#define QSERDES_V6_COM_PLL_IVCO 0xf4 +#define QSERDES_V6_COM_CMN_IETRIM 0xfc +#define QSERDES_V6_COM_CMN_IPTRIM 0x100#define QSERDES_V6_COM_SYSCLK_EN_SEL 0x110#define QSERDES_V6_COM_RESETSM_CNTRL 0x118#define QSERDES_V6_COM_LOCK_CMP_EN 0x120
drivers/phy/qualcomm/phy-qcom-qmp-qserdes-txrx-ufs-v6.h +9 -0
@@ -15,8 +15,15 @@#define QSERDES_UFS_V6_RX_UCDR_FASTLOCK_FO_GAIN_RATE2 0x08#define QSERDES_UFS_V6_RX_UCDR_FASTLOCK_FO_GAIN_RATE4 0x10 +#define QSERDES_UFS_V6_RX_UCDR_FASTLOCK_SO_GAIN_RATE4 0x24 +#define QSERDES_UFS_V6_RX_UCDR_FASTLOCK_COUNT_HIGH_RATE4 0x54#define QSERDES_UFS_V6_RX_UCDR_FO_GAIN_RATE2 0xd4 +#define QSERDES_UFS_V6_RX_UCDR_FO_GAIN_RATE4 0xdc +#define QSERDES_UFS_V6_RX_UCDR_SO_GAIN_RATE4 0xf0 +#define QSERDES_UFS_V6_RX_UCDR_PI_CONTROLS 0xf4#define QSERDES_UFS_V6_RX_VGA_CAL_MAN_VAL 0x178 +#define QSERDES_UFS_V6_RX_EQ_OFFSET_ADAPTOR_CNTRL1 0x1bc +#define QSERDES_UFS_V6_RX_OFFSET_ADAPTOR_CNTRL3 0x1c4#define QSERDES_UFS_V6_RX_MODE_RATE_0_1_B0 0x208#define QSERDES_UFS_V6_RX_MODE_RATE_0_1_B1 0x20c#define QSERDES_UFS_V6_RX_MODE_RATE_0_1_B3 0x214
@@ -28,6 +35,8 @@#define QSERDES_UFS_V6_RX_MODE_RATE3_B5 0x264#define QSERDES_UFS_V6_RX_MODE_RATE3_B8 0x270#define QSERDES_UFS_V6_RX_MODE_RATE4_B3 0x280 +#define QSERDES_UFS_V6_RX_MODE_RATE4_B4 0x284#define QSERDES_UFS_V6_RX_MODE_RATE4_B6 0x28c +#define QSERDES_UFS_V6_RX_DLL0_FTUNE_CTRL 0x2f8#endif
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +143 -21
391 lines not on this page · raw message
Signature · 1 line
2.7.4