Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: qcom-qmp-ufs: Add HS G4 mode support to SM8250 SoC

UFS PHY in SM8250 SoC is capable of operating at HS G4 mode. Hence, add the
required register settings using the tables_hs_g4 struct instance. This
also requires a separate qmp_phy_cfg for SM8250 instead of reusing SM8150.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Andrew Halaney <ahalaney@redhat.com> # Qdrive3/sa8540p-ride
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20230114071009.88102-9-manivannan.sadhasivam@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Manivannan Sadhasivam and committed by
Vinod Koul
692b6551 f89dcb24

+62 -1
+1
drivers/phy/qualcomm/phy-qcom-qmp-pcs-ufs-v5.h
··· 16 16 #define QPHY_V5_PCS_UFS_PLL_CNTL 0x02c 17 17 #define QPHY_V5_PCS_UFS_TX_LARGE_AMP_DRV_LVL 0x030 18 18 #define QPHY_V5_PCS_UFS_TX_SMALL_AMP_DRV_LVL 0x038 19 + #define QPHY_V5_PCS_UFS_BIST_FIXED_PAT_CTRL 0x060 19 20 #define QPHY_V5_PCS_UFS_TX_HSGEAR_CAPABILITY 0x074 20 21 #define QPHY_V5_PCS_UFS_RX_HSGEAR_CAPABILITY 0x0b4 21 22 #define QPHY_V5_PCS_UFS_DEBUG_BUS_CLKSEL 0x124
+61 -1
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
··· 454 454 QMP_PHY_INIT_CFG(QPHY_V4_PCS_UFS_BIST_FIXED_PAT_CTRL, 0x0a), 455 455 }; 456 456 457 + static const struct qmp_phy_init_tbl sm8250_ufsphy_hs_g4_tx[] = { 458 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xe5), 459 + }; 460 + 461 + static const struct qmp_phy_init_tbl sm8250_ufsphy_hs_g4_rx[] = { 462 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x5a), 463 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CTRL2, 0x81), 464 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0e), 465 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_TERM_BW, 0x6f), 466 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x04), 467 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x00), 468 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x09), 469 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x07), 470 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17), 471 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_MEASURE_TIME, 0x20), 472 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0x80), 473 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x01), 474 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x3f), 475 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff), 476 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff), 477 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 478 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x2c), 479 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x6d), 480 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x6d), 481 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xed), 482 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x3c), 483 + }; 484 + 457 485 static const struct qmp_phy_init_tbl sm8350_ufsphy_serdes[] = { 458 486 QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0xd9), 459 487 QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x11), ··· 830 802 .tx_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_tx), 831 803 .rx = sm8150_ufsphy_hs_g4_rx, 832 804 .rx_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_rx), 805 + .pcs = sm8150_ufsphy_hs_g4_pcs, 806 + .pcs_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_pcs), 807 + }, 808 + .clk_list = sdm845_ufs_phy_clk_l, 809 + .num_clks = ARRAY_SIZE(sdm845_ufs_phy_clk_l), 810 + .vreg_list = qmp_phy_vreg_l, 811 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 812 + .regs = ufsphy_v4_regs_layout, 813 + }; 814 + 815 + static const struct qmp_phy_cfg sm8250_ufsphy_cfg = { 816 + .lanes = 2, 817 + 818 + .tbls = { 819 + .serdes = sm8150_ufsphy_serdes, 820 + .serdes_num = ARRAY_SIZE(sm8150_ufsphy_serdes), 821 + .tx = sm8150_ufsphy_tx, 822 + .tx_num = ARRAY_SIZE(sm8150_ufsphy_tx), 823 + .rx = sm8150_ufsphy_rx, 824 + .rx_num = ARRAY_SIZE(sm8150_ufsphy_rx), 825 + .pcs = sm8150_ufsphy_pcs, 826 + .pcs_num = ARRAY_SIZE(sm8150_ufsphy_pcs), 827 + }, 828 + .tbls_hs_b = { 829 + .serdes = sm8150_ufsphy_hs_b_serdes, 830 + .serdes_num = ARRAY_SIZE(sm8150_ufsphy_hs_b_serdes), 831 + }, 832 + .tbls_hs_g4 = { 833 + .tx = sm8250_ufsphy_hs_g4_tx, 834 + .tx_num = ARRAY_SIZE(sm8250_ufsphy_hs_g4_tx), 835 + .rx = sm8250_ufsphy_hs_g4_rx, 836 + .rx_num = ARRAY_SIZE(sm8250_ufsphy_hs_g4_rx), 833 837 .pcs = sm8150_ufsphy_hs_g4_pcs, 834 838 .pcs_num = ARRAY_SIZE(sm8150_ufsphy_hs_g4_pcs), 835 839 }, ··· 1424 1364 .data = &sm8150_ufsphy_cfg, 1425 1365 }, { 1426 1366 .compatible = "qcom,sm8250-qmp-ufs-phy", 1427 - .data = &sm8150_ufsphy_cfg, 1367 + .data = &sm8250_ufsphy_cfg, 1428 1368 }, { 1429 1369 .compatible = "qcom,sm8350-qmp-ufs-phy", 1430 1370 .data = &sm8350_ufsphy_cfg,