On 31/08/2025 02:46, Jens Reidel wrote:
From: Danila Tikhonov <[email protected]>

Import the init sequence for the UFS on SM7150.

Signed-off-by: Danila Tikhonov <[email protected]>
Signed-off-by: Jens Reidel <[email protected]>
---
  drivers/phy/qcom/phy-qcom-qmp-ufs.c | 61 +++++++++++++++++++++++++++++
  1 file changed, 61 insertions(+)

diff --git a/drivers/phy/qcom/phy-qcom-qmp-ufs.c 
b/drivers/phy/qcom/phy-qcom-qmp-ufs.c
index f3c606847fb..a2a0e226f0c 100644
--- a/drivers/phy/qcom/phy-qcom-qmp-ufs.c
+++ b/drivers/phy/qcom/phy-qcom-qmp-ufs.c
@@ -221,6 +221,36 @@ static const struct qmp_ufs_init_tbl 
sm8150_ufsphy_hs_g4_rx[] = {
        QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x3c),
  };
+static const struct qmp_ufs_init_tbl sm7150_ufsphy_rx[] = {
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_LVL, 0x24),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x0f),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x1e),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_INTERFACE_MODE, 0x40),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_TERM_BW, 0x5b),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x06),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1b),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SVS_SO_GAIN_HALF, 0x04),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SVS_SO_GAIN_QUARTER, 0x04),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SVS_SO_GAIN, 0x04),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x5b),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x81),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x80),
+       QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_MODE_00, 0x59),
+};
+
+static const struct qmp_ufs_init_tbl sm7150_ufsphy_pcs[] = {
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_RX_SIGDET_CTRL2, 0x6f),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_TX_LARGE_AMP_DRV_LVL, 0x0f),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_TX_SMALL_AMP_DRV_LVL, 0x02),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_RX_SYM_RESYNC_CTRL, 0x03),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_TX_MID_TERM_CTRL1, 0x43),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_RX_SIGDET_CTRL1, 0x0f),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_RX_MIN_HIBERN8_TIME, 0xff),
+       QMP_PHY_INIT_CFG(QPHY_V3_PCS_UFS_MULTI_LANE_CTRL1, 0x02),
+};
+
  static const struct qmp_ufs_init_tbl sm8150_ufsphy_serdes[] = {
        QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0xd9),
        QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x11),
@@ -1018,6 +1048,36 @@ static const struct qmp_ufs_cfg sm8150_ufsphy_cfg = {
        .no_pcs_sw_reset        = false,
  };
+static const struct qmp_ufs_cfg sm7150_ufsphy_cfg = {
+       .lanes                  = 1,
+
+       .offsets                = &qmp_ufs_offsets,
+
+       .tbls = {
+               .serdes         = sdm845_ufsphy_serdes,
+               .serdes_num     = ARRAY_SIZE(sdm845_ufsphy_serdes),
+               .tx             = sdm845_ufsphy_tx,
+               .tx_num         = ARRAY_SIZE(sdm845_ufsphy_tx),
+               .rx             = sm7150_ufsphy_rx,
+               .rx_num         = ARRAY_SIZE(sm7150_ufsphy_rx),
+               .pcs            = sm7150_ufsphy_pcs,
+               .pcs_num        = ARRAY_SIZE(sm7150_ufsphy_pcs),
+       },
+       .tbls_hs_b = {
+               .serdes         = sdm845_ufsphy_hs_b_serdes,
+               .serdes_num     = ARRAY_SIZE(sdm845_ufsphy_hs_b_serdes),
+       },
+       .clk_list               = sdm845_ufs_phy_clk_l,
+       .num_clks               = ARRAY_SIZE(sdm845_ufs_phy_clk_l),
+       .vreg_list              = qmp_ufs_vreg_l,
+       .num_vregs              = ARRAY_SIZE(qmp_ufs_vreg_l),
+       .reset_list             = qmp_ufs_reset_l,
+       .num_resets             = ARRAY_SIZE(qmp_ufs_reset_l),
+       .regs                   = ufsphy_v3_regs_layout,
+
+       .no_pcs_sw_reset        = true,
+};
+
  static const struct qmp_ufs_cfg sm8250_ufsphy_cfg = {
        .lanes                  = 2,
@@ -1593,6 +1653,7 @@ static struct phy_ops qmp_ufs_ops = {
  static const struct udevice_id qmp_ufs_ids[] = {
        { .compatible = "qcom,sa8775p-qmp-ufs-phy", .data = 
(ulong)&sa8775p_ufsphy_cfg, },
        { .compatible = "qcom,sdm845-qmp-ufs-phy", .data = 
(ulong)&sdm845_ufsphy_cfg },
+       { .compatible = "qcom,sm7150-qmp-ufs-phy", .data = 
(ulong)&sm7150_ufsphy_cfg },
        { .compatible = "qcom,sm8150-qmp-ufs-phy", .data = 
(ulong)&sm8150_ufsphy_cfg },
        { .compatible = "qcom,sm8250-qmp-ufs-phy", .data = 
(ulong)&sm8250_ufsphy_cfg },
        { .compatible = "qcom,qcs8300-qmp-ufs-phy", .data = 
(ulong)&sa8775p_ufsphy_cfg },

Reviewed-by: Neil Armstrong <[email protected]>

Reply via email to