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

phy: qcom-qmp-usb: split off the legacy USB+dp_com support

When adding support for some of the platforms (sc7180, sc8180x, sdm845,
sm8[1234]50), we added USB PHYs for the combo USB+DP QMP PHYs. Now all
such usecases were migrated to use USB+DP Combo driver. To simplify the
qcom-qmp-usb PHY driver split the legacy USB+dp_com support into a
separate driver.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230531023415.1209301-6-dmitry.baryshkov@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Dmitry Baryshkov and committed by
Vinod Koul
e464a318 ff4cb058

+1418 -556
+10
drivers/phy/qualcomm/Kconfig
··· 102 102 Enable this to support the QMP USB PHY transceiver that is used 103 103 with USB3 controllers on Qualcomm chips. 104 104 105 + config PHY_QCOM_QMP_USB_LEGACY 106 + tristate "Qualcomm QMP legacy USB PHY Driver" 107 + select GENERIC_PHY 108 + default n 109 + help 110 + Enable this legacy driver to support the QMP USB+DisplayPort Combo 111 + PHY transceivers working only in USB3 mode on Qualcomm chips. This 112 + driver exists only for compatibility with older device trees, 113 + existing users have been migrated to PHY_QCOM_QMP_COMBO driver. 114 + 105 115 endif # PHY_QCOM_QMP 106 116 107 117 config PHY_QCOM_QUSB2
+1
drivers/phy/qualcomm/Makefile
··· 11 11 obj-$(CONFIG_PHY_QCOM_QMP_PCIE_8996) += phy-qcom-qmp-pcie-msm8996.o 12 12 obj-$(CONFIG_PHY_QCOM_QMP_UFS) += phy-qcom-qmp-ufs.o 13 13 obj-$(CONFIG_PHY_QCOM_QMP_USB) += phy-qcom-qmp-usb.o 14 + obj-$(CONFIG_PHY_QCOM_QMP_USB_LEGACY) += phy-qcom-qmp-usb-legacy.o 14 15 15 16 obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o 16 17 obj-$(CONFIG_PHY_QCOM_SNPS_EUSB2) += phy-qcom-snps-eusb2.o
+1407
drivers/phy/qualcomm/phy-qcom-qmp-usb-legacy.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2017, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #include <linux/clk.h> 7 + #include <linux/clk-provider.h> 8 + #include <linux/delay.h> 9 + #include <linux/err.h> 10 + #include <linux/io.h> 11 + #include <linux/iopoll.h> 12 + #include <linux/kernel.h> 13 + #include <linux/module.h> 14 + #include <linux/of.h> 15 + #include <linux/of_device.h> 16 + #include <linux/of_address.h> 17 + #include <linux/phy/phy.h> 18 + #include <linux/platform_device.h> 19 + #include <linux/regulator/consumer.h> 20 + #include <linux/reset.h> 21 + #include <linux/slab.h> 22 + 23 + #include "phy-qcom-qmp.h" 24 + #include "phy-qcom-qmp-pcs-misc-v3.h" 25 + #include "phy-qcom-qmp-pcs-usb-v4.h" 26 + #include "phy-qcom-qmp-pcs-usb-v5.h" 27 + 28 + /* QPHY_SW_RESET bit */ 29 + #define SW_RESET BIT(0) 30 + /* QPHY_POWER_DOWN_CONTROL */ 31 + #define SW_PWRDN BIT(0) 32 + /* QPHY_START_CONTROL bits */ 33 + #define SERDES_START BIT(0) 34 + #define PCS_START BIT(1) 35 + /* QPHY_PCS_STATUS bit */ 36 + #define PHYSTATUS BIT(6) 37 + 38 + /* QPHY_V3_DP_COM_RESET_OVRD_CTRL register bits */ 39 + /* DP PHY soft reset */ 40 + #define SW_DPPHY_RESET BIT(0) 41 + /* mux to select DP PHY reset control, 0:HW control, 1: software reset */ 42 + #define SW_DPPHY_RESET_MUX BIT(1) 43 + /* USB3 PHY soft reset */ 44 + #define SW_USB3PHY_RESET BIT(2) 45 + /* mux to select USB3 PHY reset control, 0:HW control, 1: software reset */ 46 + #define SW_USB3PHY_RESET_MUX BIT(3) 47 + 48 + /* QPHY_V3_DP_COM_PHY_MODE_CTRL register bits */ 49 + #define USB3_MODE BIT(0) /* enables USB3 mode */ 50 + #define DP_MODE BIT(1) /* enables DP mode */ 51 + 52 + /* QPHY_PCS_AUTONOMOUS_MODE_CTRL register bits */ 53 + #define ARCVR_DTCT_EN BIT(0) 54 + #define ALFPS_DTCT_EN BIT(1) 55 + #define ARCVR_DTCT_EVENT_SEL BIT(4) 56 + 57 + /* QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR register bits */ 58 + #define IRQ_CLEAR BIT(0) 59 + 60 + /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ 61 + #define CLAMP_EN BIT(0) /* enables i/o clamp_n */ 62 + 63 + #define PHY_INIT_COMPLETE_TIMEOUT 10000 64 + 65 + struct qmp_phy_init_tbl { 66 + unsigned int offset; 67 + unsigned int val; 68 + /* 69 + * mask of lanes for which this register is written 70 + * for cases when second lane needs different values 71 + */ 72 + u8 lane_mask; 73 + }; 74 + 75 + #define QMP_PHY_INIT_CFG(o, v) \ 76 + { \ 77 + .offset = o, \ 78 + .val = v, \ 79 + .lane_mask = 0xff, \ 80 + } 81 + 82 + #define QMP_PHY_INIT_CFG_LANE(o, v, l) \ 83 + { \ 84 + .offset = o, \ 85 + .val = v, \ 86 + .lane_mask = l, \ 87 + } 88 + 89 + /* set of registers with offsets different per-PHY */ 90 + enum qphy_reg_layout { 91 + /* PCS registers */ 92 + QPHY_SW_RESET, 93 + QPHY_START_CTRL, 94 + QPHY_PCS_STATUS, 95 + QPHY_PCS_AUTONOMOUS_MODE_CTRL, 96 + QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR, 97 + QPHY_PCS_POWER_DOWN_CONTROL, 98 + /* Keep last to ensure regs_layout arrays are properly initialized */ 99 + QPHY_LAYOUT_SIZE 100 + }; 101 + 102 + static const unsigned int qmp_v3_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { 103 + [QPHY_SW_RESET] = QPHY_V3_PCS_SW_RESET, 104 + [QPHY_START_CTRL] = QPHY_V3_PCS_START_CONTROL, 105 + [QPHY_PCS_STATUS] = QPHY_V3_PCS_PCS_STATUS, 106 + [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V3_PCS_AUTONOMOUS_MODE_CTRL, 107 + [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V3_PCS_LFPS_RXTERM_IRQ_CLEAR, 108 + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V3_PCS_POWER_DOWN_CONTROL, 109 + }; 110 + 111 + static const unsigned int qmp_v4_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { 112 + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, 113 + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, 114 + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, 115 + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, 116 + 117 + /* In PCS_USB */ 118 + [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL, 119 + [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR, 120 + }; 121 + 122 + static const unsigned int qmp_v5_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { 123 + [QPHY_SW_RESET] = QPHY_V5_PCS_SW_RESET, 124 + [QPHY_START_CTRL] = QPHY_V5_PCS_START_CONTROL, 125 + [QPHY_PCS_STATUS] = QPHY_V5_PCS_PCS_STATUS1, 126 + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V5_PCS_POWER_DOWN_CONTROL, 127 + 128 + /* In PCS_USB */ 129 + [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V5_PCS_USB3_AUTONOMOUS_MODE_CTRL, 130 + [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V5_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR, 131 + }; 132 + 133 + static const struct qmp_phy_init_tbl qmp_v3_usb3_serdes_tbl[] = { 134 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x07), 135 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x14), 136 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x08), 137 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), 138 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02), 139 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL2, 0x08), 140 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x16), 141 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x01), 142 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x80), 143 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82), 144 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START1_MODE0, 0xab), 145 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START2_MODE0, 0xea), 146 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START3_MODE0, 0x02), 147 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x06), 148 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16), 149 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x36), 150 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00), 151 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f), 152 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01), 153 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xc9), 154 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORECLK_DIV_MODE0, 0x0a), 155 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP3_MODE0, 0x00), 156 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x34), 157 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0x15), 158 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x04), 159 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00), 160 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_CFG, 0x00), 161 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x00), 162 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_BUF_ENABLE, 0x0a), 163 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_EN_CENTER, 0x01), 164 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER1, 0x31), 165 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER2, 0x01), 166 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER1, 0x00), 167 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER2, 0x00), 168 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE1, 0x85), 169 + QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE2, 0x07), 170 + }; 171 + 172 + static const struct qmp_phy_init_tbl qmp_v3_usb3_tx_tbl[] = { 173 + QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10), 174 + QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12), 175 + QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x16), 176 + QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_RX, 0x09), 177 + QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x06), 178 + }; 179 + 180 + static const struct qmp_phy_init_tbl qmp_v3_usb3_rx_tbl[] = { 181 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b), 182 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 183 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4e), 184 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x18), 185 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 186 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80), 187 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03), 188 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x16), 189 + QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x75), 190 + }; 191 + 192 + static const struct qmp_phy_init_tbl qmp_v3_usb3_pcs_tbl[] = { 193 + /* FLL settings */ 194 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL2, 0x83), 195 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_L, 0x09), 196 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_H_TOL, 0xa2), 197 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_MAN_CODE, 0x40), 198 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL1, 0x02), 199 + 200 + /* Lock Det settings */ 201 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG1, 0xd1), 202 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG2, 0x1f), 203 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG3, 0x47), 204 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_POWER_STATE_CONFIG2, 0x1b), 205 + 206 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0xba), 207 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V0, 0x9f), 208 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V1, 0x9f), 209 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V2, 0xb7), 210 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V3, 0x4e), 211 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V4, 0x65), 212 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_LS, 0x6b), 213 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V0, 0x15), 214 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V0, 0x0d), 215 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V1, 0x15), 216 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V1, 0x0d), 217 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V2, 0x15), 218 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V2, 0x0d), 219 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V3, 0x15), 220 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V3, 0x1d), 221 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V4, 0x15), 222 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V4, 0x0d), 223 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_LS, 0x15), 224 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_LS, 0x0d), 225 + 226 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RATE_SLEW_CNTRL, 0x02), 227 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x04), 228 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_TSYNC_RSYNC_TIME, 0x44), 229 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x04), 230 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_P1U2_L, 0xe7), 231 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), 232 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_U3_L, 0x40), 233 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_U3_H, 0x00), 234 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_WAIT_TIME, 0x75), 235 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_LFPS_TX_ECSTART_EQTLOCK, 0x86), 236 + QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13), 237 + }; 238 + 239 + static const struct qmp_phy_init_tbl sm8150_usb3_serdes_tbl[] = { 240 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01), 241 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31), 242 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01), 243 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde), 244 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07), 245 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0xde), 246 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x07), 247 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x0a), 248 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_IPTRIM, 0x20), 249 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06), 250 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06), 251 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16), 252 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16), 253 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36), 254 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36), 255 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x1a), 256 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x04), 257 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x14), 258 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x34), 259 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x34), 260 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x82), 261 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82), 262 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x82), 263 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0xab), 264 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0xea), 265 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x02), 266 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 267 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab), 268 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xea), 269 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02), 270 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24), 271 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0x24), 272 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x02), 273 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01), 274 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08), 275 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 276 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 277 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xca), 278 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x1e), 279 + QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 280 + }; 281 + 282 + static const struct qmp_phy_init_tbl sm8150_usb3_tx_tbl[] = { 283 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_TX, 0x00), 284 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_RX, 0x00), 285 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xd5), 286 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 287 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_PI_QEC_CTRL, 0x20), 288 + }; 289 + 290 + static const struct qmp_phy_init_tbl sm8150_usb3_rx_tbl[] = { 291 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x05), 292 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 293 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 294 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 295 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 296 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x99), 297 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH1, 0x04), 298 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH2, 0x08), 299 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN1, 0x05), 300 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN2, 0x05), 301 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54), 302 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x0e), 303 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 304 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 305 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 306 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 307 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 308 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 309 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x04), 310 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 311 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xbf), 312 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xbf), 313 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x3f), 314 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 315 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x94), 316 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0xdc), 317 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xdc), 318 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0x5c), 319 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x0b), 320 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb3), 321 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 322 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 323 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 324 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 325 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1f), 326 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VTH_CODE, 0x10), 327 + }; 328 + 329 + static const struct qmp_phy_init_tbl sm8150_usb3_pcs_tbl[] = { 330 + /* Lock Det settings */ 331 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 332 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 333 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 334 + 335 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 336 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 337 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 338 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 339 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 340 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 341 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 342 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 343 + }; 344 + 345 + static const struct qmp_phy_init_tbl sm8150_usb3_pcs_usb_tbl[] = { 346 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 347 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 348 + }; 349 + 350 + static const struct qmp_phy_init_tbl sm8250_usb3_tx_tbl[] = { 351 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_TX, 0x60), 352 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_RX, 0x60), 353 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x11), 354 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_RX, 0x02), 355 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xd5), 356 + QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 357 + QMP_PHY_INIT_CFG_LANE(QSERDES_V4_TX_PI_QEC_CTRL, 0x40, 1), 358 + QMP_PHY_INIT_CFG_LANE(QSERDES_V4_TX_PI_QEC_CTRL, 0x54, 2), 359 + }; 360 + 361 + static const struct qmp_phy_init_tbl sm8250_usb3_rx_tbl[] = { 362 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x06), 363 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 364 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 365 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 366 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 367 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x99), 368 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH1, 0x04), 369 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH2, 0x08), 370 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN1, 0x05), 371 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN2, 0x05), 372 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54), 373 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x0c), 374 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 375 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 376 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 377 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 378 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 379 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 380 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x04), 381 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 382 + QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_LOW, 0xff, 1), 383 + QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_LOW, 0x7f, 2), 384 + QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x7f, 1), 385 + QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff, 2), 386 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x7f), 387 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 388 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x97), 389 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0xdc), 390 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xdc), 391 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0x5c), 392 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x7b), 393 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb4), 394 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 395 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 396 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 397 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 398 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1f), 399 + QMP_PHY_INIT_CFG(QSERDES_V4_RX_VTH_CODE, 0x10), 400 + }; 401 + 402 + static const struct qmp_phy_init_tbl sm8250_usb3_pcs_tbl[] = { 403 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 404 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 405 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG3, 0x20), 406 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 407 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 408 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xa9), 409 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 410 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 411 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 412 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 413 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 414 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 415 + }; 416 + 417 + static const struct qmp_phy_init_tbl sm8250_usb3_pcs_usb_tbl[] = { 418 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 419 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 420 + }; 421 + 422 + static const struct qmp_phy_init_tbl sm8350_usb3_tx_tbl[] = { 423 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_TX, 0x00), 424 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_RX, 0x00), 425 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x16), 426 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x0e), 427 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0x35), 428 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_3, 0x3f), 429 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x7f), 430 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_5, 0x3f), 431 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_RCV_DETECT_LVL_2, 0x12), 432 + QMP_PHY_INIT_CFG(QSERDES_V5_TX_PI_QEC_CTRL, 0x21), 433 + }; 434 + 435 + static const struct qmp_phy_init_tbl sm8350_usb3_rx_tbl[] = { 436 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FO_GAIN, 0x0a), 437 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_GAIN, 0x05), 438 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 439 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 440 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 441 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 442 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0x99), 443 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH1, 0x08), 444 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH2, 0x08), 445 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_GAIN1, 0x00), 446 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_GAIN2, 0x04), 447 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL1, 0x54), 448 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x0f), 449 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 450 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 451 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 452 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 453 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 454 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x47), 455 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_SIGDET_CNTRL, 0x04), 456 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 457 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_LOW, 0xbb), 458 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH, 0x7b), 459 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0xbb), 460 + QMP_PHY_INIT_CFG_LANE(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3d, 1), 461 + QMP_PHY_INIT_CFG_LANE(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3c, 2), 462 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH4, 0xdb), 463 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_LOW, 0x64), 464 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH, 0x24), 465 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH2, 0xd2), 466 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH3, 0x13), 467 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH4, 0xa9), 468 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_EN_TIMER, 0x04), 469 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 470 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 471 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_DCC_CTRL1, 0x0c), 472 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00), 473 + QMP_PHY_INIT_CFG(QSERDES_V5_RX_VTH_CODE, 0x10), 474 + }; 475 + 476 + static const struct qmp_phy_init_tbl sm8350_usb3_pcs_tbl[] = { 477 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RCVR_DTCT_DLY_P1U2_L, 0xe7), 478 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), 479 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 480 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 481 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG3, 0x20), 482 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 483 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 484 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 485 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 486 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 487 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 488 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 489 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 490 + QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 491 + }; 492 + 493 + static const struct qmp_phy_init_tbl sm8350_usb3_pcs_usb_tbl[] = { 494 + QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), 495 + QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RCVR_DTCT_DLY_U3_H, 0x00), 496 + QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 497 + QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 498 + }; 499 + 500 + struct qmp_usb_legacy_offsets { 501 + u16 serdes; 502 + u16 pcs; 503 + u16 pcs_usb; 504 + u16 tx; 505 + u16 rx; 506 + }; 507 + 508 + /* struct qmp_phy_cfg - per-PHY initialization config */ 509 + struct qmp_phy_cfg { 510 + int lanes; 511 + 512 + const struct qmp_usb_legacy_offsets *offsets; 513 + 514 + /* Init sequence for PHY blocks - serdes, tx, rx, pcs */ 515 + const struct qmp_phy_init_tbl *serdes_tbl; 516 + int serdes_tbl_num; 517 + const struct qmp_phy_init_tbl *tx_tbl; 518 + int tx_tbl_num; 519 + const struct qmp_phy_init_tbl *rx_tbl; 520 + int rx_tbl_num; 521 + const struct qmp_phy_init_tbl *pcs_tbl; 522 + int pcs_tbl_num; 523 + const struct qmp_phy_init_tbl *pcs_usb_tbl; 524 + int pcs_usb_tbl_num; 525 + 526 + /* clock ids to be requested */ 527 + const char * const *clk_list; 528 + int num_clks; 529 + /* resets to be requested */ 530 + const char * const *reset_list; 531 + int num_resets; 532 + /* regulators to be requested */ 533 + const char * const *vreg_list; 534 + int num_vregs; 535 + 536 + /* array of registers with different offsets */ 537 + const unsigned int *regs; 538 + 539 + /* Offset from PCS to PCS_USB region */ 540 + unsigned int pcs_usb_offset; 541 + }; 542 + 543 + struct qmp_usb { 544 + struct device *dev; 545 + 546 + const struct qmp_phy_cfg *cfg; 547 + 548 + void __iomem *serdes; 549 + void __iomem *pcs; 550 + void __iomem *pcs_misc; 551 + void __iomem *pcs_usb; 552 + void __iomem *tx; 553 + void __iomem *rx; 554 + void __iomem *tx2; 555 + void __iomem *rx2; 556 + 557 + void __iomem *dp_com; 558 + 559 + struct clk *pipe_clk; 560 + struct clk_bulk_data *clks; 561 + struct reset_control_bulk_data *resets; 562 + struct regulator_bulk_data *vregs; 563 + 564 + enum phy_mode mode; 565 + 566 + struct phy *phy; 567 + 568 + struct clk_fixed_rate pipe_clk_fixed; 569 + }; 570 + 571 + static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) 572 + { 573 + u32 reg; 574 + 575 + reg = readl(base + offset); 576 + reg |= val; 577 + writel(reg, base + offset); 578 + 579 + /* ensure that above write is through */ 580 + readl(base + offset); 581 + } 582 + 583 + static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val) 584 + { 585 + u32 reg; 586 + 587 + reg = readl(base + offset); 588 + reg &= ~val; 589 + writel(reg, base + offset); 590 + 591 + /* ensure that above write is through */ 592 + readl(base + offset); 593 + } 594 + 595 + /* list of clocks required by phy */ 596 + static const char * const qmp_v3_phy_clk_l[] = { 597 + "aux", "cfg_ahb", "ref", "com_aux", 598 + }; 599 + 600 + static const char * const qmp_v4_ref_phy_clk_l[] = { 601 + "aux", "ref_clk_src", "ref", "com_aux", 602 + }; 603 + 604 + /* the primary usb3 phy on sm8250 doesn't have a ref clock */ 605 + static const char * const qmp_v4_sm8250_usbphy_clk_l[] = { 606 + "aux", "ref_clk_src", "com_aux" 607 + }; 608 + 609 + /* list of resets */ 610 + static const char * const msm8996_usb3phy_reset_l[] = { 611 + "phy", "common", 612 + }; 613 + 614 + static const char * const sc7180_usb3phy_reset_l[] = { 615 + "phy", 616 + }; 617 + 618 + /* list of regulators */ 619 + static const char * const qmp_phy_vreg_l[] = { 620 + "vdda-phy", "vdda-pll", 621 + }; 622 + 623 + static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg = { 624 + .lanes = 2, 625 + 626 + .serdes_tbl = qmp_v3_usb3_serdes_tbl, 627 + .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), 628 + .tx_tbl = qmp_v3_usb3_tx_tbl, 629 + .tx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_tx_tbl), 630 + .rx_tbl = qmp_v3_usb3_rx_tbl, 631 + .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), 632 + .pcs_tbl = qmp_v3_usb3_pcs_tbl, 633 + .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), 634 + .clk_list = qmp_v3_phy_clk_l, 635 + .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), 636 + .reset_list = msm8996_usb3phy_reset_l, 637 + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 638 + .vreg_list = qmp_phy_vreg_l, 639 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 640 + .regs = qmp_v3_usb3phy_regs_layout, 641 + }; 642 + 643 + static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { 644 + .lanes = 2, 645 + 646 + .serdes_tbl = qmp_v3_usb3_serdes_tbl, 647 + .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), 648 + .tx_tbl = qmp_v3_usb3_tx_tbl, 649 + .tx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_tx_tbl), 650 + .rx_tbl = qmp_v3_usb3_rx_tbl, 651 + .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), 652 + .pcs_tbl = qmp_v3_usb3_pcs_tbl, 653 + .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), 654 + .clk_list = qmp_v3_phy_clk_l, 655 + .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), 656 + .reset_list = sc7180_usb3phy_reset_l, 657 + .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), 658 + .vreg_list = qmp_phy_vreg_l, 659 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 660 + .regs = qmp_v3_usb3phy_regs_layout, 661 + }; 662 + 663 + static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { 664 + .lanes = 2, 665 + 666 + .serdes_tbl = sm8150_usb3_serdes_tbl, 667 + .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 668 + .tx_tbl = sm8150_usb3_tx_tbl, 669 + .tx_tbl_num = ARRAY_SIZE(sm8150_usb3_tx_tbl), 670 + .rx_tbl = sm8150_usb3_rx_tbl, 671 + .rx_tbl_num = ARRAY_SIZE(sm8150_usb3_rx_tbl), 672 + .pcs_tbl = sm8150_usb3_pcs_tbl, 673 + .pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_tbl), 674 + .pcs_usb_tbl = sm8150_usb3_pcs_usb_tbl, 675 + .pcs_usb_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_usb_tbl), 676 + .clk_list = qmp_v4_ref_phy_clk_l, 677 + .num_clks = ARRAY_SIZE(qmp_v4_ref_phy_clk_l), 678 + .reset_list = msm8996_usb3phy_reset_l, 679 + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 680 + .vreg_list = qmp_phy_vreg_l, 681 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 682 + .regs = qmp_v4_usb3phy_regs_layout, 683 + .pcs_usb_offset = 0x300, 684 + }; 685 + 686 + static const struct qmp_phy_cfg sm8250_usb3phy_cfg = { 687 + .lanes = 2, 688 + 689 + .serdes_tbl = sm8150_usb3_serdes_tbl, 690 + .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 691 + .tx_tbl = sm8250_usb3_tx_tbl, 692 + .tx_tbl_num = ARRAY_SIZE(sm8250_usb3_tx_tbl), 693 + .rx_tbl = sm8250_usb3_rx_tbl, 694 + .rx_tbl_num = ARRAY_SIZE(sm8250_usb3_rx_tbl), 695 + .pcs_tbl = sm8250_usb3_pcs_tbl, 696 + .pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_tbl), 697 + .pcs_usb_tbl = sm8250_usb3_pcs_usb_tbl, 698 + .pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_usb_tbl), 699 + .clk_list = qmp_v4_sm8250_usbphy_clk_l, 700 + .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), 701 + .reset_list = msm8996_usb3phy_reset_l, 702 + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 703 + .vreg_list = qmp_phy_vreg_l, 704 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 705 + .regs = qmp_v4_usb3phy_regs_layout, 706 + .pcs_usb_offset = 0x300, 707 + }; 708 + 709 + static const struct qmp_phy_cfg sm8350_usb3phy_cfg = { 710 + .lanes = 2, 711 + 712 + .serdes_tbl = sm8150_usb3_serdes_tbl, 713 + .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 714 + .tx_tbl = sm8350_usb3_tx_tbl, 715 + .tx_tbl_num = ARRAY_SIZE(sm8350_usb3_tx_tbl), 716 + .rx_tbl = sm8350_usb3_rx_tbl, 717 + .rx_tbl_num = ARRAY_SIZE(sm8350_usb3_rx_tbl), 718 + .pcs_tbl = sm8350_usb3_pcs_tbl, 719 + .pcs_tbl_num = ARRAY_SIZE(sm8350_usb3_pcs_tbl), 720 + .pcs_usb_tbl = sm8350_usb3_pcs_usb_tbl, 721 + .pcs_usb_tbl_num = ARRAY_SIZE(sm8350_usb3_pcs_usb_tbl), 722 + .clk_list = qmp_v4_sm8250_usbphy_clk_l, 723 + .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), 724 + .reset_list = msm8996_usb3phy_reset_l, 725 + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 726 + .vreg_list = qmp_phy_vreg_l, 727 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 728 + .regs = qmp_v5_usb3phy_regs_layout, 729 + .pcs_usb_offset = 0x300, 730 + }; 731 + 732 + static void qmp_usb_legacy_configure_lane(void __iomem *base, 733 + const struct qmp_phy_init_tbl tbl[], 734 + int num, 735 + u8 lane_mask) 736 + { 737 + int i; 738 + const struct qmp_phy_init_tbl *t = tbl; 739 + 740 + if (!t) 741 + return; 742 + 743 + for (i = 0; i < num; i++, t++) { 744 + if (!(t->lane_mask & lane_mask)) 745 + continue; 746 + 747 + writel(t->val, base + t->offset); 748 + } 749 + } 750 + 751 + static void qmp_usb_legacy_configure(void __iomem *base, 752 + const struct qmp_phy_init_tbl tbl[], 753 + int num) 754 + { 755 + qmp_usb_legacy_configure_lane(base, tbl, num, 0xff); 756 + } 757 + 758 + static int qmp_usb_legacy_serdes_init(struct qmp_usb *qmp) 759 + { 760 + const struct qmp_phy_cfg *cfg = qmp->cfg; 761 + void __iomem *serdes = qmp->serdes; 762 + const struct qmp_phy_init_tbl *serdes_tbl = cfg->serdes_tbl; 763 + int serdes_tbl_num = cfg->serdes_tbl_num; 764 + 765 + qmp_usb_legacy_configure(serdes, serdes_tbl, serdes_tbl_num); 766 + 767 + return 0; 768 + } 769 + 770 + static void qmp_usb_legacy_init_dp_com(struct phy *phy) 771 + { 772 + struct qmp_usb *qmp = phy_get_drvdata(phy); 773 + void __iomem *dp_com = qmp->dp_com; 774 + 775 + qphy_setbits(dp_com, QPHY_V3_DP_COM_POWER_DOWN_CTRL, 776 + SW_PWRDN); 777 + /* override hardware control for reset of qmp phy */ 778 + qphy_setbits(dp_com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, 779 + SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | 780 + SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); 781 + 782 + /* Default type-c orientation, i.e CC1 */ 783 + qphy_setbits(dp_com, QPHY_V3_DP_COM_TYPEC_CTRL, 0x02); 784 + 785 + qphy_setbits(dp_com, QPHY_V3_DP_COM_PHY_MODE_CTRL, 786 + USB3_MODE | DP_MODE); 787 + 788 + /* bring both QMP USB and QMP DP PHYs PCS block out of reset */ 789 + qphy_clrbits(dp_com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, 790 + SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | 791 + SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); 792 + 793 + qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03); 794 + qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET); 795 + } 796 + 797 + static int qmp_usb_legacy_init(struct phy *phy) 798 + { 799 + struct qmp_usb *qmp = phy_get_drvdata(phy); 800 + const struct qmp_phy_cfg *cfg = qmp->cfg; 801 + void __iomem *pcs = qmp->pcs; 802 + int ret; 803 + 804 + ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); 805 + if (ret) { 806 + dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret); 807 + return ret; 808 + } 809 + 810 + ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets); 811 + if (ret) { 812 + dev_err(qmp->dev, "reset assert failed\n"); 813 + goto err_disable_regulators; 814 + } 815 + 816 + ret = reset_control_bulk_deassert(cfg->num_resets, qmp->resets); 817 + if (ret) { 818 + dev_err(qmp->dev, "reset deassert failed\n"); 819 + goto err_disable_regulators; 820 + } 821 + 822 + ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks); 823 + if (ret) 824 + goto err_assert_reset; 825 + 826 + qmp_usb_legacy_init_dp_com(phy); 827 + 828 + qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); 829 + 830 + return 0; 831 + 832 + err_assert_reset: 833 + reset_control_bulk_assert(cfg->num_resets, qmp->resets); 834 + err_disable_regulators: 835 + regulator_bulk_disable(cfg->num_vregs, qmp->vregs); 836 + 837 + return ret; 838 + } 839 + 840 + static int qmp_usb_legacy_exit(struct phy *phy) 841 + { 842 + struct qmp_usb *qmp = phy_get_drvdata(phy); 843 + const struct qmp_phy_cfg *cfg = qmp->cfg; 844 + 845 + reset_control_bulk_assert(cfg->num_resets, qmp->resets); 846 + 847 + clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); 848 + 849 + regulator_bulk_disable(cfg->num_vregs, qmp->vregs); 850 + 851 + return 0; 852 + } 853 + 854 + static int qmp_usb_legacy_power_on(struct phy *phy) 855 + { 856 + struct qmp_usb *qmp = phy_get_drvdata(phy); 857 + const struct qmp_phy_cfg *cfg = qmp->cfg; 858 + void __iomem *tx = qmp->tx; 859 + void __iomem *rx = qmp->rx; 860 + void __iomem *pcs = qmp->pcs; 861 + void __iomem *status; 862 + unsigned int val; 863 + int ret; 864 + 865 + qmp_usb_legacy_serdes_init(qmp); 866 + 867 + ret = clk_prepare_enable(qmp->pipe_clk); 868 + if (ret) { 869 + dev_err(qmp->dev, "pipe_clk enable failed err=%d\n", ret); 870 + return ret; 871 + } 872 + 873 + /* Tx, Rx, and PCS configurations */ 874 + qmp_usb_legacy_configure_lane(tx, cfg->tx_tbl, cfg->tx_tbl_num, 1); 875 + qmp_usb_legacy_configure_lane(rx, cfg->rx_tbl, cfg->rx_tbl_num, 1); 876 + 877 + if (cfg->lanes >= 2) { 878 + qmp_usb_legacy_configure_lane(qmp->tx2, cfg->tx_tbl, cfg->tx_tbl_num, 2); 879 + qmp_usb_legacy_configure_lane(qmp->rx2, cfg->rx_tbl, cfg->rx_tbl_num, 2); 880 + } 881 + 882 + qmp_usb_legacy_configure(pcs, cfg->pcs_tbl, cfg->pcs_tbl_num); 883 + 884 + usleep_range(10, 20); 885 + 886 + /* Pull PHY out of reset state */ 887 + qphy_clrbits(pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); 888 + 889 + /* start SerDes and Phy-Coding-Sublayer */ 890 + qphy_setbits(pcs, cfg->regs[QPHY_START_CTRL], SERDES_START | PCS_START); 891 + 892 + status = pcs + cfg->regs[QPHY_PCS_STATUS]; 893 + ret = readl_poll_timeout(status, val, !(val & PHYSTATUS), 200, 894 + PHY_INIT_COMPLETE_TIMEOUT); 895 + if (ret) { 896 + dev_err(qmp->dev, "phy initialization timed-out\n"); 897 + goto err_disable_pipe_clk; 898 + } 899 + 900 + return 0; 901 + 902 + err_disable_pipe_clk: 903 + clk_disable_unprepare(qmp->pipe_clk); 904 + 905 + return ret; 906 + } 907 + 908 + static int qmp_usb_legacy_power_off(struct phy *phy) 909 + { 910 + struct qmp_usb *qmp = phy_get_drvdata(phy); 911 + const struct qmp_phy_cfg *cfg = qmp->cfg; 912 + 913 + clk_disable_unprepare(qmp->pipe_clk); 914 + 915 + /* PHY reset */ 916 + qphy_setbits(qmp->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); 917 + 918 + /* stop SerDes and Phy-Coding-Sublayer */ 919 + qphy_clrbits(qmp->pcs, cfg->regs[QPHY_START_CTRL], 920 + SERDES_START | PCS_START); 921 + 922 + /* Put PHY into POWER DOWN state: active low */ 923 + qphy_clrbits(qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], 924 + SW_PWRDN); 925 + 926 + return 0; 927 + } 928 + 929 + static int qmp_usb_legacy_enable(struct phy *phy) 930 + { 931 + int ret; 932 + 933 + ret = qmp_usb_legacy_init(phy); 934 + if (ret) 935 + return ret; 936 + 937 + ret = qmp_usb_legacy_power_on(phy); 938 + if (ret) 939 + qmp_usb_legacy_exit(phy); 940 + 941 + return ret; 942 + } 943 + 944 + static int qmp_usb_legacy_disable(struct phy *phy) 945 + { 946 + int ret; 947 + 948 + ret = qmp_usb_legacy_power_off(phy); 949 + if (ret) 950 + return ret; 951 + return qmp_usb_legacy_exit(phy); 952 + } 953 + 954 + static int qmp_usb_legacy_set_mode(struct phy *phy, enum phy_mode mode, int submode) 955 + { 956 + struct qmp_usb *qmp = phy_get_drvdata(phy); 957 + 958 + qmp->mode = mode; 959 + 960 + return 0; 961 + } 962 + 963 + static const struct phy_ops qmp_usb_legacy_phy_ops = { 964 + .init = qmp_usb_legacy_enable, 965 + .exit = qmp_usb_legacy_disable, 966 + .set_mode = qmp_usb_legacy_set_mode, 967 + .owner = THIS_MODULE, 968 + }; 969 + 970 + static void qmp_usb_legacy_enable_autonomous_mode(struct qmp_usb *qmp) 971 + { 972 + const struct qmp_phy_cfg *cfg = qmp->cfg; 973 + void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; 974 + void __iomem *pcs_misc = qmp->pcs_misc; 975 + u32 intr_mask; 976 + 977 + if (qmp->mode == PHY_MODE_USB_HOST_SS || 978 + qmp->mode == PHY_MODE_USB_DEVICE_SS) 979 + intr_mask = ARCVR_DTCT_EN | ALFPS_DTCT_EN; 980 + else 981 + intr_mask = ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL; 982 + 983 + /* Clear any pending interrupts status */ 984 + qphy_setbits(pcs_usb, cfg->regs[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR], IRQ_CLEAR); 985 + /* Writing 1 followed by 0 clears the interrupt */ 986 + qphy_clrbits(pcs_usb, cfg->regs[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR], IRQ_CLEAR); 987 + 988 + qphy_clrbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], 989 + ARCVR_DTCT_EN | ALFPS_DTCT_EN | ARCVR_DTCT_EVENT_SEL); 990 + 991 + /* Enable required PHY autonomous mode interrupts */ 992 + qphy_setbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], intr_mask); 993 + 994 + /* Enable i/o clamp_n for autonomous mode */ 995 + if (pcs_misc) 996 + qphy_clrbits(pcs_misc, QPHY_V3_PCS_MISC_CLAMP_ENABLE, CLAMP_EN); 997 + } 998 + 999 + static void qmp_usb_legacy_disable_autonomous_mode(struct qmp_usb *qmp) 1000 + { 1001 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1002 + void __iomem *pcs_usb = qmp->pcs_usb ?: qmp->pcs; 1003 + void __iomem *pcs_misc = qmp->pcs_misc; 1004 + 1005 + /* Disable i/o clamp_n on resume for normal mode */ 1006 + if (pcs_misc) 1007 + qphy_setbits(pcs_misc, QPHY_V3_PCS_MISC_CLAMP_ENABLE, CLAMP_EN); 1008 + 1009 + qphy_clrbits(pcs_usb, cfg->regs[QPHY_PCS_AUTONOMOUS_MODE_CTRL], 1010 + ARCVR_DTCT_EN | ARCVR_DTCT_EVENT_SEL | ALFPS_DTCT_EN); 1011 + 1012 + qphy_setbits(pcs_usb, cfg->regs[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR], IRQ_CLEAR); 1013 + /* Writing 1 followed by 0 clears the interrupt */ 1014 + qphy_clrbits(pcs_usb, cfg->regs[QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR], IRQ_CLEAR); 1015 + } 1016 + 1017 + static int __maybe_unused qmp_usb_legacy_runtime_suspend(struct device *dev) 1018 + { 1019 + struct qmp_usb *qmp = dev_get_drvdata(dev); 1020 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1021 + 1022 + dev_vdbg(dev, "Suspending QMP phy, mode:%d\n", qmp->mode); 1023 + 1024 + if (!qmp->phy->init_count) { 1025 + dev_vdbg(dev, "PHY not initialized, bailing out\n"); 1026 + return 0; 1027 + } 1028 + 1029 + qmp_usb_legacy_enable_autonomous_mode(qmp); 1030 + 1031 + clk_disable_unprepare(qmp->pipe_clk); 1032 + clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); 1033 + 1034 + return 0; 1035 + } 1036 + 1037 + static int __maybe_unused qmp_usb_legacy_runtime_resume(struct device *dev) 1038 + { 1039 + struct qmp_usb *qmp = dev_get_drvdata(dev); 1040 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1041 + int ret = 0; 1042 + 1043 + dev_vdbg(dev, "Resuming QMP phy, mode:%d\n", qmp->mode); 1044 + 1045 + if (!qmp->phy->init_count) { 1046 + dev_vdbg(dev, "PHY not initialized, bailing out\n"); 1047 + return 0; 1048 + } 1049 + 1050 + ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks); 1051 + if (ret) 1052 + return ret; 1053 + 1054 + ret = clk_prepare_enable(qmp->pipe_clk); 1055 + if (ret) { 1056 + dev_err(dev, "pipe_clk enable failed, err=%d\n", ret); 1057 + clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); 1058 + return ret; 1059 + } 1060 + 1061 + qmp_usb_legacy_disable_autonomous_mode(qmp); 1062 + 1063 + return 0; 1064 + } 1065 + 1066 + static const struct dev_pm_ops qmp_usb_legacy_pm_ops = { 1067 + SET_RUNTIME_PM_OPS(qmp_usb_legacy_runtime_suspend, 1068 + qmp_usb_legacy_runtime_resume, NULL) 1069 + }; 1070 + 1071 + static int qmp_usb_legacy_vreg_init(struct qmp_usb *qmp) 1072 + { 1073 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1074 + struct device *dev = qmp->dev; 1075 + int num = cfg->num_vregs; 1076 + int i; 1077 + 1078 + qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); 1079 + if (!qmp->vregs) 1080 + return -ENOMEM; 1081 + 1082 + for (i = 0; i < num; i++) 1083 + qmp->vregs[i].supply = cfg->vreg_list[i]; 1084 + 1085 + return devm_regulator_bulk_get(dev, num, qmp->vregs); 1086 + } 1087 + 1088 + static int qmp_usb_legacy_reset_init(struct qmp_usb *qmp) 1089 + { 1090 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1091 + struct device *dev = qmp->dev; 1092 + int i; 1093 + int ret; 1094 + 1095 + qmp->resets = devm_kcalloc(dev, cfg->num_resets, 1096 + sizeof(*qmp->resets), GFP_KERNEL); 1097 + if (!qmp->resets) 1098 + return -ENOMEM; 1099 + 1100 + for (i = 0; i < cfg->num_resets; i++) 1101 + qmp->resets[i].id = cfg->reset_list[i]; 1102 + 1103 + ret = devm_reset_control_bulk_get_exclusive(dev, cfg->num_resets, qmp->resets); 1104 + if (ret) 1105 + return dev_err_probe(dev, ret, "failed to get resets\n"); 1106 + 1107 + return 0; 1108 + } 1109 + 1110 + static int qmp_usb_legacy_clk_init(struct qmp_usb *qmp) 1111 + { 1112 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1113 + struct device *dev = qmp->dev; 1114 + int num = cfg->num_clks; 1115 + int i; 1116 + 1117 + qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); 1118 + if (!qmp->clks) 1119 + return -ENOMEM; 1120 + 1121 + for (i = 0; i < num; i++) 1122 + qmp->clks[i].id = cfg->clk_list[i]; 1123 + 1124 + return devm_clk_bulk_get(dev, num, qmp->clks); 1125 + } 1126 + 1127 + static void phy_clk_release_provider(void *res) 1128 + { 1129 + of_clk_del_provider(res); 1130 + } 1131 + 1132 + /* 1133 + * Register a fixed rate pipe clock. 1134 + * 1135 + * The <s>_pipe_clksrc generated by PHY goes to the GCC that gate 1136 + * controls it. The <s>_pipe_clk coming out of the GCC is requested 1137 + * by the PHY driver for its operations. 1138 + * We register the <s>_pipe_clksrc here. The gcc driver takes care 1139 + * of assigning this <s>_pipe_clksrc as parent to <s>_pipe_clk. 1140 + * Below picture shows this relationship. 1141 + * 1142 + * +---------------+ 1143 + * | PHY block |<<---------------------------------------+ 1144 + * | | | 1145 + * | +-------+ | +-----+ | 1146 + * I/P---^-->| PLL |---^--->pipe_clksrc--->| GCC |--->pipe_clk---+ 1147 + * clk | +-------+ | +-----+ 1148 + * +---------------+ 1149 + */ 1150 + static int phy_pipe_clk_register(struct qmp_usb *qmp, struct device_node *np) 1151 + { 1152 + struct clk_fixed_rate *fixed = &qmp->pipe_clk_fixed; 1153 + struct clk_init_data init = { }; 1154 + int ret; 1155 + 1156 + ret = of_property_read_string(np, "clock-output-names", &init.name); 1157 + if (ret) { 1158 + dev_err(qmp->dev, "%pOFn: No clock-output-names\n", np); 1159 + return ret; 1160 + } 1161 + 1162 + init.ops = &clk_fixed_rate_ops; 1163 + 1164 + /* controllers using QMP phys use 125MHz pipe clock interface */ 1165 + fixed->fixed_rate = 125000000; 1166 + fixed->hw.init = &init; 1167 + 1168 + ret = devm_clk_hw_register(qmp->dev, &fixed->hw); 1169 + if (ret) 1170 + return ret; 1171 + 1172 + ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, &fixed->hw); 1173 + if (ret) 1174 + return ret; 1175 + 1176 + /* 1177 + * Roll a devm action because the clock provider is the child node, but 1178 + * the child node is not actually a device. 1179 + */ 1180 + return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np); 1181 + } 1182 + 1183 + static void __iomem *qmp_usb_legacy_iomap(struct device *dev, struct device_node *np, 1184 + int index, bool exclusive) 1185 + { 1186 + struct resource res; 1187 + 1188 + if (!exclusive) { 1189 + if (of_address_to_resource(np, index, &res)) 1190 + return IOMEM_ERR_PTR(-EINVAL); 1191 + 1192 + return devm_ioremap(dev, res.start, resource_size(&res)); 1193 + } 1194 + 1195 + return devm_of_iomap(dev, np, index, NULL); 1196 + } 1197 + 1198 + static int qmp_usb_legacy_parse_dt_legacy(struct qmp_usb *qmp, struct device_node *np) 1199 + { 1200 + struct platform_device *pdev = to_platform_device(qmp->dev); 1201 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1202 + struct device *dev = qmp->dev; 1203 + bool exclusive = true; 1204 + 1205 + qmp->serdes = devm_platform_ioremap_resource(pdev, 0); 1206 + if (IS_ERR(qmp->serdes)) 1207 + return PTR_ERR(qmp->serdes); 1208 + 1209 + qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); 1210 + if (IS_ERR(qmp->dp_com)) 1211 + return PTR_ERR(qmp->dp_com); 1212 + 1213 + /* 1214 + * Get memory resources for the PHY: 1215 + * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. 1216 + * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 1217 + * For single lane PHYs: pcs_misc (optional) -> 3. 1218 + */ 1219 + qmp->tx = devm_of_iomap(dev, np, 0, NULL); 1220 + if (IS_ERR(qmp->tx)) 1221 + return PTR_ERR(qmp->tx); 1222 + 1223 + qmp->rx = devm_of_iomap(dev, np, 1, NULL); 1224 + if (IS_ERR(qmp->rx)) 1225 + return PTR_ERR(qmp->rx); 1226 + 1227 + qmp->pcs = qmp_usb_legacy_iomap(dev, np, 2, exclusive); 1228 + if (IS_ERR(qmp->pcs)) 1229 + return PTR_ERR(qmp->pcs); 1230 + 1231 + if (cfg->pcs_usb_offset) 1232 + qmp->pcs_usb = qmp->pcs + cfg->pcs_usb_offset; 1233 + 1234 + if (cfg->lanes >= 2) { 1235 + qmp->tx2 = devm_of_iomap(dev, np, 3, NULL); 1236 + if (IS_ERR(qmp->tx2)) 1237 + return PTR_ERR(qmp->tx2); 1238 + 1239 + qmp->rx2 = devm_of_iomap(dev, np, 4, NULL); 1240 + if (IS_ERR(qmp->rx2)) 1241 + return PTR_ERR(qmp->rx2); 1242 + 1243 + qmp->pcs_misc = devm_of_iomap(dev, np, 5, NULL); 1244 + } else { 1245 + qmp->pcs_misc = devm_of_iomap(dev, np, 3, NULL); 1246 + } 1247 + 1248 + if (IS_ERR(qmp->pcs_misc)) { 1249 + dev_vdbg(dev, "PHY pcs_misc-reg not used\n"); 1250 + qmp->pcs_misc = NULL; 1251 + } 1252 + 1253 + qmp->pipe_clk = devm_get_clk_from_child(dev, np, NULL); 1254 + if (IS_ERR(qmp->pipe_clk)) { 1255 + return dev_err_probe(dev, PTR_ERR(qmp->pipe_clk), 1256 + "failed to get pipe clock\n"); 1257 + } 1258 + 1259 + return 0; 1260 + } 1261 + 1262 + static int qmp_usb_legacy_parse_dt(struct qmp_usb *qmp) 1263 + { 1264 + struct platform_device *pdev = to_platform_device(qmp->dev); 1265 + const struct qmp_phy_cfg *cfg = qmp->cfg; 1266 + const struct qmp_usb_legacy_offsets *offs = cfg->offsets; 1267 + struct device *dev = qmp->dev; 1268 + void __iomem *base; 1269 + 1270 + if (!offs) 1271 + return -EINVAL; 1272 + 1273 + base = devm_platform_ioremap_resource(pdev, 0); 1274 + if (IS_ERR(base)) 1275 + return PTR_ERR(base); 1276 + 1277 + qmp->serdes = base + offs->serdes; 1278 + qmp->pcs = base + offs->pcs; 1279 + qmp->pcs_usb = base + offs->pcs_usb; 1280 + qmp->tx = base + offs->tx; 1281 + qmp->rx = base + offs->rx; 1282 + 1283 + qmp->pipe_clk = devm_clk_get(dev, "pipe"); 1284 + if (IS_ERR(qmp->pipe_clk)) { 1285 + return dev_err_probe(dev, PTR_ERR(qmp->pipe_clk), 1286 + "failed to get pipe clock\n"); 1287 + } 1288 + 1289 + return 0; 1290 + } 1291 + 1292 + static int qmp_usb_legacy_probe(struct platform_device *pdev) 1293 + { 1294 + struct device *dev = &pdev->dev; 1295 + struct phy_provider *phy_provider; 1296 + struct device_node *np; 1297 + struct qmp_usb *qmp; 1298 + int ret; 1299 + 1300 + qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); 1301 + if (!qmp) 1302 + return -ENOMEM; 1303 + 1304 + qmp->dev = dev; 1305 + 1306 + qmp->cfg = of_device_get_match_data(dev); 1307 + if (!qmp->cfg) 1308 + return -EINVAL; 1309 + 1310 + ret = qmp_usb_legacy_clk_init(qmp); 1311 + if (ret) 1312 + return ret; 1313 + 1314 + ret = qmp_usb_legacy_reset_init(qmp); 1315 + if (ret) 1316 + return ret; 1317 + 1318 + ret = qmp_usb_legacy_vreg_init(qmp); 1319 + if (ret) 1320 + return ret; 1321 + 1322 + /* Check for legacy binding with child node. */ 1323 + np = of_get_next_available_child(dev->of_node, NULL); 1324 + if (np) { 1325 + ret = qmp_usb_legacy_parse_dt_legacy(qmp, np); 1326 + } else { 1327 + np = of_node_get(dev->of_node); 1328 + ret = qmp_usb_legacy_parse_dt(qmp); 1329 + } 1330 + if (ret) 1331 + goto err_node_put; 1332 + 1333 + pm_runtime_set_active(dev); 1334 + ret = devm_pm_runtime_enable(dev); 1335 + if (ret) 1336 + goto err_node_put; 1337 + /* 1338 + * Prevent runtime pm from being ON by default. Users can enable 1339 + * it using power/control in sysfs. 1340 + */ 1341 + pm_runtime_forbid(dev); 1342 + 1343 + ret = phy_pipe_clk_register(qmp, np); 1344 + if (ret) 1345 + goto err_node_put; 1346 + 1347 + qmp->phy = devm_phy_create(dev, np, &qmp_usb_legacy_phy_ops); 1348 + if (IS_ERR(qmp->phy)) { 1349 + ret = PTR_ERR(qmp->phy); 1350 + dev_err(dev, "failed to create PHY: %d\n", ret); 1351 + goto err_node_put; 1352 + } 1353 + 1354 + phy_set_drvdata(qmp->phy, qmp); 1355 + 1356 + of_node_put(np); 1357 + 1358 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 1359 + 1360 + return PTR_ERR_OR_ZERO(phy_provider); 1361 + 1362 + err_node_put: 1363 + of_node_put(np); 1364 + return ret; 1365 + } 1366 + 1367 + static const struct of_device_id qmp_usb_legacy_of_match_table[] = { 1368 + { 1369 + .compatible = "qcom,sc7180-qmp-usb3-phy", 1370 + .data = &sc7180_usb3phy_cfg, 1371 + }, { 1372 + .compatible = "qcom,sc8180x-qmp-usb3-phy", 1373 + .data = &sm8150_usb3phy_cfg, 1374 + }, { 1375 + .compatible = "qcom,sdm845-qmp-usb3-phy", 1376 + .data = &qmp_v3_usb3phy_cfg, 1377 + }, { 1378 + .compatible = "qcom,sm8150-qmp-usb3-phy", 1379 + .data = &sm8150_usb3phy_cfg, 1380 + }, { 1381 + .compatible = "qcom,sm8250-qmp-usb3-phy", 1382 + .data = &sm8250_usb3phy_cfg, 1383 + }, { 1384 + .compatible = "qcom,sm8350-qmp-usb3-phy", 1385 + .data = &sm8350_usb3phy_cfg, 1386 + }, { 1387 + .compatible = "qcom,sm8450-qmp-usb3-phy", 1388 + .data = &sm8350_usb3phy_cfg, 1389 + }, 1390 + { }, 1391 + }; 1392 + MODULE_DEVICE_TABLE(of, qmp_usb_legacy_of_match_table); 1393 + 1394 + static struct platform_driver qmp_usb_legacy_driver = { 1395 + .probe = qmp_usb_legacy_probe, 1396 + .driver = { 1397 + .name = "qcom-qmp-usb-legacy-phy", 1398 + .pm = &qmp_usb_legacy_pm_ops, 1399 + .of_match_table = qmp_usb_legacy_of_match_table, 1400 + }, 1401 + }; 1402 + 1403 + module_platform_driver(qmp_usb_legacy_driver); 1404 + 1405 + MODULE_AUTHOR("Vivek Gautam <vivek.gautam@codeaurora.org>"); 1406 + MODULE_DESCRIPTION("Qualcomm QMP legacy USB+DP PHY driver"); 1407 + MODULE_LICENSE("GPL v2");
-556
drivers/phy/qualcomm/phy-qcom-qmp-usb.c
··· 367 367 QMP_PHY_INIT_CFG(QPHY_V2_PCS_POWER_STATE_CONFIG2, 0x08), 368 368 }; 369 369 370 - static const struct qmp_phy_init_tbl qmp_v3_usb3_serdes_tbl[] = { 371 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x07), 372 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x14), 373 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x08), 374 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), 375 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02), 376 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL2, 0x08), 377 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x16), 378 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x01), 379 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x80), 380 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82), 381 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START1_MODE0, 0xab), 382 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START2_MODE0, 0xea), 383 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START3_MODE0, 0x02), 384 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x06), 385 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16), 386 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x36), 387 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00), 388 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f), 389 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01), 390 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xc9), 391 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORECLK_DIV_MODE0, 0x0a), 392 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP3_MODE0, 0x00), 393 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x34), 394 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0x15), 395 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x04), 396 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00), 397 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_CFG, 0x00), 398 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x00), 399 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_BUF_ENABLE, 0x0a), 400 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_EN_CENTER, 0x01), 401 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER1, 0x31), 402 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER2, 0x01), 403 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER1, 0x00), 404 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER2, 0x00), 405 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE1, 0x85), 406 - QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE2, 0x07), 407 - }; 408 - 409 - static const struct qmp_phy_init_tbl qmp_v3_usb3_tx_tbl[] = { 410 - QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10), 411 - QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12), 412 - QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x16), 413 - QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_RX, 0x09), 414 - QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x06), 415 - }; 416 - 417 - static const struct qmp_phy_init_tbl qmp_v3_usb3_rx_tbl[] = { 418 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b), 419 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 420 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4e), 421 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x18), 422 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 423 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80), 424 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03), 425 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x16), 426 - QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x75), 427 - }; 428 - 429 - static const struct qmp_phy_init_tbl qmp_v3_usb3_pcs_tbl[] = { 430 - /* FLL settings */ 431 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL2, 0x83), 432 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_L, 0x09), 433 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_H_TOL, 0xa2), 434 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_MAN_CODE, 0x40), 435 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL1, 0x02), 436 - 437 - /* Lock Det settings */ 438 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG1, 0xd1), 439 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG2, 0x1f), 440 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_LOCK_DETECT_CONFIG3, 0x47), 441 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_POWER_STATE_CONFIG2, 0x1b), 442 - 443 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0xba), 444 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V0, 0x9f), 445 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V1, 0x9f), 446 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V2, 0xb7), 447 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V3, 0x4e), 448 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_V4, 0x65), 449 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXMGN_LS, 0x6b), 450 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V0, 0x15), 451 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V0, 0x0d), 452 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V1, 0x15), 453 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V1, 0x0d), 454 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V2, 0x15), 455 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V2, 0x0d), 456 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V3, 0x15), 457 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V3, 0x1d), 458 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_V4, 0x15), 459 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_V4, 0x0d), 460 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M6DB_LS, 0x15), 461 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TXDEEMPH_M3P5DB_LS, 0x0d), 462 - 463 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RATE_SLEW_CNTRL, 0x02), 464 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x04), 465 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_TSYNC_RSYNC_TIME, 0x44), 466 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x04), 467 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_P1U2_L, 0xe7), 468 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), 469 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_U3_L, 0x40), 470 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RCVR_DTCT_DLY_U3_H, 0x00), 471 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_WAIT_TIME, 0x75), 472 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_LFPS_TX_ECSTART_EQTLOCK, 0x86), 473 - QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13), 474 - }; 475 - 476 370 static const struct qmp_phy_init_tbl qmp_v3_usb3_uniphy_serdes_tbl[] = { 477 371 QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x07), 478 372 QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x14), ··· 587 693 QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13), 588 694 }; 589 695 590 - static const struct qmp_phy_init_tbl sm8150_usb3_serdes_tbl[] = { 591 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01), 592 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31), 593 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01), 594 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde), 595 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07), 596 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0xde), 597 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x07), 598 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x0a), 599 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_IPTRIM, 0x20), 600 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06), 601 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06), 602 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16), 603 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16), 604 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36), 605 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36), 606 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x1a), 607 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x04), 608 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x14), 609 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x34), 610 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x34), 611 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x82), 612 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82), 613 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x82), 614 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0xab), 615 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0xea), 616 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x02), 617 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 618 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab), 619 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xea), 620 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02), 621 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24), 622 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0x24), 623 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x02), 624 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01), 625 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08), 626 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 627 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 628 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xca), 629 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x1e), 630 - QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 631 - }; 632 - 633 - static const struct qmp_phy_init_tbl sm8150_usb3_tx_tbl[] = { 634 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_TX, 0x00), 635 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_RX, 0x00), 636 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xd5), 637 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 638 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_PI_QEC_CTRL, 0x20), 639 - }; 640 - 641 - static const struct qmp_phy_init_tbl sm8150_usb3_rx_tbl[] = { 642 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x05), 643 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 644 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 645 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 646 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 647 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x99), 648 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH1, 0x04), 649 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH2, 0x08), 650 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN1, 0x05), 651 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN2, 0x05), 652 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54), 653 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x0e), 654 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 655 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 656 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 657 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 658 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 659 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 660 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x04), 661 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 662 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xbf), 663 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xbf), 664 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x3f), 665 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 666 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x94), 667 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0xdc), 668 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xdc), 669 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0x5c), 670 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x0b), 671 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb3), 672 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 673 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 674 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 675 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 676 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1f), 677 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_VTH_CODE, 0x10), 678 - }; 679 - 680 - static const struct qmp_phy_init_tbl sm8150_usb3_pcs_tbl[] = { 681 - /* Lock Det settings */ 682 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 683 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 684 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 685 - 686 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 687 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 688 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 689 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 690 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 691 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 692 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 693 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 694 - }; 695 - 696 - static const struct qmp_phy_init_tbl sm8150_usb3_pcs_usb_tbl[] = { 697 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 698 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 699 - }; 700 - 701 696 static const struct qmp_phy_init_tbl sm8150_usb3_uniphy_serdes_tbl[] = { 702 697 QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x1a), 703 698 QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), ··· 694 911 }; 695 912 696 913 static const struct qmp_phy_init_tbl sm8150_usb3_uniphy_pcs_usb_tbl[] = { 697 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 698 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 699 - }; 700 - 701 - static const struct qmp_phy_init_tbl sm8250_usb3_tx_tbl[] = { 702 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_TX, 0x60), 703 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_RX, 0x60), 704 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x11), 705 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_RX, 0x02), 706 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0xd5), 707 - QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 708 - QMP_PHY_INIT_CFG_LANE(QSERDES_V4_TX_PI_QEC_CTRL, 0x40, 1), 709 - QMP_PHY_INIT_CFG_LANE(QSERDES_V4_TX_PI_QEC_CTRL, 0x54, 2), 710 - }; 711 - 712 - static const struct qmp_phy_init_tbl sm8250_usb3_rx_tbl[] = { 713 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x06), 714 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 715 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 716 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 717 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 718 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x99), 719 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH1, 0x04), 720 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_THRESH2, 0x08), 721 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN1, 0x05), 722 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SB2_GAIN2, 0x05), 723 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54), 724 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x0c), 725 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 726 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 727 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 728 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 729 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 730 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x77), 731 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x04), 732 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 733 - QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_LOW, 0xff, 1), 734 - QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_LOW, 0x7f, 2), 735 - QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x7f, 1), 736 - QMP_PHY_INIT_CFG_LANE(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff, 2), 737 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x7f), 738 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 739 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x97), 740 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0xdc), 741 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xdc), 742 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0x5c), 743 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x7b), 744 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb4), 745 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 746 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 747 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 748 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 749 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1f), 750 - QMP_PHY_INIT_CFG(QSERDES_V4_RX_VTH_CODE, 0x10), 751 - }; 752 - 753 - static const struct qmp_phy_init_tbl sm8250_usb3_pcs_tbl[] = { 754 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 755 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 756 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG3, 0x20), 757 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 758 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 759 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xa9), 760 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 761 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 762 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 763 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 764 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 765 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 766 - }; 767 - 768 - static const struct qmp_phy_init_tbl sm8250_usb3_pcs_usb_tbl[] = { 769 914 QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 770 915 QMP_PHY_INIT_CFG(QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 771 916 }; ··· 857 1146 QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_GAIN, 0x05), 858 1147 QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00), 859 1148 QMP_PHY_INIT_CFG(QSERDES_V5_RX_SIGDET_ENABLES, 0x00), 860 - }; 861 - 862 - static const struct qmp_phy_init_tbl sm8350_usb3_tx_tbl[] = { 863 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_TX, 0x00), 864 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_RX, 0x00), 865 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x16), 866 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x0e), 867 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0x35), 868 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_3, 0x3f), 869 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x7f), 870 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_5, 0x3f), 871 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_RCV_DETECT_LVL_2, 0x12), 872 - QMP_PHY_INIT_CFG(QSERDES_V5_TX_PI_QEC_CTRL, 0x21), 873 - }; 874 - 875 - static const struct qmp_phy_init_tbl sm8350_usb3_rx_tbl[] = { 876 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FO_GAIN, 0x0a), 877 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_GAIN, 0x05), 878 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), 879 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 880 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), 881 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), 882 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0x99), 883 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH1, 0x08), 884 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH2, 0x08), 885 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_GAIN1, 0x00), 886 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_GAIN2, 0x04), 887 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL1, 0x54), 888 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x0f), 889 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), 890 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 891 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), 892 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 893 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 894 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x47), 895 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_SIGDET_CNTRL, 0x04), 896 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), 897 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_LOW, 0xbb), 898 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH, 0x7b), 899 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0xbb), 900 - QMP_PHY_INIT_CFG_LANE(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3d, 1), 901 - QMP_PHY_INIT_CFG_LANE(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3c, 2), 902 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH4, 0xdb), 903 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_LOW, 0x64), 904 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH, 0x24), 905 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH2, 0xd2), 906 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH3, 0x13), 907 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH4, 0xa9), 908 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_EN_TIMER, 0x04), 909 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 910 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 911 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_DCC_CTRL1, 0x0c), 912 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00), 913 - QMP_PHY_INIT_CFG(QSERDES_V5_RX_VTH_CODE, 0x10), 914 - }; 915 - 916 - static const struct qmp_phy_init_tbl sm8350_usb3_pcs_tbl[] = { 917 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_RCVR_DTCT_DLY_P1U2_L, 0xe7), 918 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), 919 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG1, 0xd0), 920 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG2, 0x07), 921 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG3, 0x20), 922 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_LOCK_DETECT_CONFIG6, 0x13), 923 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x21), 924 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 925 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_CDR_RESET_TIME, 0x0a), 926 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG1, 0x88), 927 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_ALIGN_DETECT_CONFIG2, 0x13), 928 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCS_TX_RX_CONFIG, 0x0c), 929 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG1, 0x4b), 930 - QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x10), 931 - }; 932 - 933 - static const struct qmp_phy_init_tbl sm8350_usb3_pcs_usb_tbl[] = { 934 - QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), 935 - QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RCVR_DTCT_DLY_U3_H, 0x00), 936 - QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), 937 - QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), 938 1149 }; 939 1150 940 1151 static const struct qmp_phy_init_tbl sm8350_usb3_uniphy_tx_tbl[] = { ··· 1189 1556 /* true, if PHY needs delay after POWER_DOWN */ 1190 1557 bool has_pwrdn_delay; 1191 1558 1192 - /* true, if PHY has a separate DP_COM control block */ 1193 - bool has_phy_dp_com_ctrl; 1194 - 1195 1559 /* Offset from PCS to PCS_USB region */ 1196 1560 unsigned int pcs_usb_offset; 1197 1561 }; ··· 1206 1576 void __iomem *rx; 1207 1577 void __iomem *tx2; 1208 1578 void __iomem *rx2; 1209 - 1210 - void __iomem *dp_com; 1211 1579 1212 1580 struct clk *pipe_clk; 1213 1581 struct clk_bulk_data *clks; ··· 1260 1632 "aux", "ref_clk_src", "ref", "com_aux", 1261 1633 }; 1262 1634 1263 - /* the primary usb3 phy on sm8250 doesn't have a ref clock */ 1264 - static const char * const qmp_v4_sm8250_usbphy_clk_l[] = { 1265 - "aux", "ref_clk_src", "com_aux" 1266 - }; 1267 - 1268 1635 /* usb3 phy on sdx55 doesn't have com_aux clock */ 1269 1636 static const char * const qmp_v4_sdx55_usbphy_clk_l[] = { 1270 1637 "aux", "cfg_ahb", "ref" ··· 1272 1649 /* list of resets */ 1273 1650 static const char * const msm8996_usb3phy_reset_l[] = { 1274 1651 "phy", "common", 1275 - }; 1276 - 1277 - static const char * const sc7180_usb3phy_reset_l[] = { 1278 - "phy", 1279 1652 }; 1280 1653 1281 1654 static const char * const qcm2290_usb3phy_reset_l[] = { ··· 1371 1752 .regs = qmp_v2_usb3phy_regs_layout, 1372 1753 }; 1373 1754 1374 - static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg = { 1375 - .lanes = 2, 1376 - 1377 - .serdes_tbl = qmp_v3_usb3_serdes_tbl, 1378 - .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), 1379 - .tx_tbl = qmp_v3_usb3_tx_tbl, 1380 - .tx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_tx_tbl), 1381 - .rx_tbl = qmp_v3_usb3_rx_tbl, 1382 - .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), 1383 - .pcs_tbl = qmp_v3_usb3_pcs_tbl, 1384 - .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), 1385 - .clk_list = qmp_v3_phy_clk_l, 1386 - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), 1387 - .reset_list = msm8996_usb3phy_reset_l, 1388 - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 1389 - .vreg_list = qmp_phy_vreg_l, 1390 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1391 - .regs = qmp_v3_usb3phy_regs_layout, 1392 - 1393 - .has_pwrdn_delay = true, 1394 - .has_phy_dp_com_ctrl = true, 1395 - }; 1396 - 1397 1755 static const struct qmp_phy_cfg sa8775p_usb3_uniphy_cfg = { 1398 1756 .lanes = 1, 1399 1757 ··· 1391 1795 .vreg_list = qmp_phy_vreg_l, 1392 1796 .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1393 1797 .regs = qmp_v5_usb3phy_regs_layout, 1394 - }; 1395 - 1396 - static const struct qmp_phy_cfg sc7180_usb3phy_cfg = { 1397 - .lanes = 2, 1398 - 1399 - .serdes_tbl = qmp_v3_usb3_serdes_tbl, 1400 - .serdes_tbl_num = ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), 1401 - .tx_tbl = qmp_v3_usb3_tx_tbl, 1402 - .tx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_tx_tbl), 1403 - .rx_tbl = qmp_v3_usb3_rx_tbl, 1404 - .rx_tbl_num = ARRAY_SIZE(qmp_v3_usb3_rx_tbl), 1405 - .pcs_tbl = qmp_v3_usb3_pcs_tbl, 1406 - .pcs_tbl_num = ARRAY_SIZE(qmp_v3_usb3_pcs_tbl), 1407 - .clk_list = qmp_v3_phy_clk_l, 1408 - .num_clks = ARRAY_SIZE(qmp_v3_phy_clk_l), 1409 - .reset_list = sc7180_usb3phy_reset_l, 1410 - .num_resets = ARRAY_SIZE(sc7180_usb3phy_reset_l), 1411 - .vreg_list = qmp_phy_vreg_l, 1412 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1413 - .regs = qmp_v3_usb3phy_regs_layout, 1414 - 1415 - .has_pwrdn_delay = true, 1416 - .has_phy_dp_com_ctrl = true, 1417 1798 }; 1418 1799 1419 1800 static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg = { ··· 1457 1884 .regs = qmp_v3_usb3phy_regs_layout, 1458 1885 }; 1459 1886 1460 - static const struct qmp_phy_cfg sm8150_usb3phy_cfg = { 1461 - .lanes = 2, 1462 - 1463 - .serdes_tbl = sm8150_usb3_serdes_tbl, 1464 - .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 1465 - .tx_tbl = sm8150_usb3_tx_tbl, 1466 - .tx_tbl_num = ARRAY_SIZE(sm8150_usb3_tx_tbl), 1467 - .rx_tbl = sm8150_usb3_rx_tbl, 1468 - .rx_tbl_num = ARRAY_SIZE(sm8150_usb3_rx_tbl), 1469 - .pcs_tbl = sm8150_usb3_pcs_tbl, 1470 - .pcs_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_tbl), 1471 - .pcs_usb_tbl = sm8150_usb3_pcs_usb_tbl, 1472 - .pcs_usb_tbl_num = ARRAY_SIZE(sm8150_usb3_pcs_usb_tbl), 1473 - .clk_list = qmp_v4_ref_phy_clk_l, 1474 - .num_clks = ARRAY_SIZE(qmp_v4_ref_phy_clk_l), 1475 - .reset_list = msm8996_usb3phy_reset_l, 1476 - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 1477 - .vreg_list = qmp_phy_vreg_l, 1478 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1479 - .regs = qmp_v4_usb3phy_regs_layout, 1480 - .pcs_usb_offset = 0x300, 1481 - 1482 - .has_pwrdn_delay = true, 1483 - .has_phy_dp_com_ctrl = true, 1484 - }; 1485 - 1486 1887 static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg = { 1487 1888 .lanes = 1, 1488 1889 ··· 1480 1933 .pcs_usb_offset = 0x600, 1481 1934 1482 1935 .has_pwrdn_delay = true, 1483 - }; 1484 - 1485 - static const struct qmp_phy_cfg sm8250_usb3phy_cfg = { 1486 - .lanes = 2, 1487 - 1488 - .serdes_tbl = sm8150_usb3_serdes_tbl, 1489 - .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 1490 - .tx_tbl = sm8250_usb3_tx_tbl, 1491 - .tx_tbl_num = ARRAY_SIZE(sm8250_usb3_tx_tbl), 1492 - .rx_tbl = sm8250_usb3_rx_tbl, 1493 - .rx_tbl_num = ARRAY_SIZE(sm8250_usb3_rx_tbl), 1494 - .pcs_tbl = sm8250_usb3_pcs_tbl, 1495 - .pcs_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_tbl), 1496 - .pcs_usb_tbl = sm8250_usb3_pcs_usb_tbl, 1497 - .pcs_usb_tbl_num = ARRAY_SIZE(sm8250_usb3_pcs_usb_tbl), 1498 - .clk_list = qmp_v4_sm8250_usbphy_clk_l, 1499 - .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), 1500 - .reset_list = msm8996_usb3phy_reset_l, 1501 - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 1502 - .vreg_list = qmp_phy_vreg_l, 1503 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1504 - .regs = qmp_v4_usb3phy_regs_layout, 1505 - .pcs_usb_offset = 0x300, 1506 - 1507 - .has_pwrdn_delay = true, 1508 - .has_phy_dp_com_ctrl = true, 1509 1936 }; 1510 1937 1511 1938 static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg = { ··· 1555 2034 .pcs_usb_offset = 0x1000, 1556 2035 1557 2036 .has_pwrdn_delay = true, 1558 - }; 1559 - 1560 - static const struct qmp_phy_cfg sm8350_usb3phy_cfg = { 1561 - .lanes = 2, 1562 - 1563 - .serdes_tbl = sm8150_usb3_serdes_tbl, 1564 - .serdes_tbl_num = ARRAY_SIZE(sm8150_usb3_serdes_tbl), 1565 - .tx_tbl = sm8350_usb3_tx_tbl, 1566 - .tx_tbl_num = ARRAY_SIZE(sm8350_usb3_tx_tbl), 1567 - .rx_tbl = sm8350_usb3_rx_tbl, 1568 - .rx_tbl_num = ARRAY_SIZE(sm8350_usb3_rx_tbl), 1569 - .pcs_tbl = sm8350_usb3_pcs_tbl, 1570 - .pcs_tbl_num = ARRAY_SIZE(sm8350_usb3_pcs_tbl), 1571 - .pcs_usb_tbl = sm8350_usb3_pcs_usb_tbl, 1572 - .pcs_usb_tbl_num = ARRAY_SIZE(sm8350_usb3_pcs_usb_tbl), 1573 - .clk_list = qmp_v4_sm8250_usbphy_clk_l, 1574 - .num_clks = ARRAY_SIZE(qmp_v4_sm8250_usbphy_clk_l), 1575 - .reset_list = msm8996_usb3phy_reset_l, 1576 - .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 1577 - .vreg_list = qmp_phy_vreg_l, 1578 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1579 - .regs = qmp_v5_usb3phy_regs_layout, 1580 - .pcs_usb_offset = 0x300, 1581 - 1582 - .has_pwrdn_delay = true, 1583 - .has_phy_dp_com_ctrl = true, 1584 2037 }; 1585 2038 1586 2039 static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg = { ··· 1647 2152 struct qmp_usb *qmp = phy_get_drvdata(phy); 1648 2153 const struct qmp_phy_cfg *cfg = qmp->cfg; 1649 2154 void __iomem *pcs = qmp->pcs; 1650 - void __iomem *dp_com = qmp->dp_com; 1651 2155 int ret; 1652 2156 1653 2157 ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); ··· 1670 2176 ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks); 1671 2177 if (ret) 1672 2178 goto err_assert_reset; 1673 - 1674 - if (cfg->has_phy_dp_com_ctrl) { 1675 - qphy_setbits(dp_com, QPHY_V3_DP_COM_POWER_DOWN_CTRL, 1676 - SW_PWRDN); 1677 - /* override hardware control for reset of qmp phy */ 1678 - qphy_setbits(dp_com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, 1679 - SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | 1680 - SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); 1681 - 1682 - /* Default type-c orientation, i.e CC1 */ 1683 - qphy_setbits(dp_com, QPHY_V3_DP_COM_TYPEC_CTRL, 0x02); 1684 - 1685 - qphy_setbits(dp_com, QPHY_V3_DP_COM_PHY_MODE_CTRL, 1686 - USB3_MODE | DP_MODE); 1687 - 1688 - /* bring both QMP USB and QMP DP PHYs PCS block out of reset */ 1689 - qphy_clrbits(dp_com, QPHY_V3_DP_COM_RESET_OVRD_CTRL, 1690 - SW_DPPHY_RESET_MUX | SW_DPPHY_RESET | 1691 - SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET); 1692 - 1693 - qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03); 1694 - qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET); 1695 - } 1696 2179 1697 2180 qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN); 1698 2181 ··· 2053 2582 if (IS_ERR(qmp->serdes)) 2054 2583 return PTR_ERR(qmp->serdes); 2055 2584 2056 - if (cfg->has_phy_dp_com_ctrl) { 2057 - qmp->dp_com = devm_platform_ioremap_resource(pdev, 1); 2058 - if (IS_ERR(qmp->dp_com)) 2059 - return PTR_ERR(qmp->dp_com); 2060 - } 2061 - 2062 2585 /* 2063 2586 * FIXME: These bindings should be fixed to not rely on overlapping 2064 2587 * mappings for PCS. ··· 2245 2780 .compatible = "qcom,sa8775p-qmp-usb3-uni-phy", 2246 2781 .data = &sa8775p_usb3_uniphy_cfg, 2247 2782 }, { 2248 - .compatible = "qcom,sc7180-qmp-usb3-phy", 2249 - .data = &sc7180_usb3phy_cfg, 2250 - }, { 2251 - .compatible = "qcom,sc8180x-qmp-usb3-phy", 2252 - .data = &sm8150_usb3phy_cfg, 2253 - }, { 2254 2783 .compatible = "qcom,sc8280xp-qmp-usb3-uni-phy", 2255 2784 .data = &sc8280xp_usb3_uniphy_cfg, 2256 - }, { 2257 - .compatible = "qcom,sdm845-qmp-usb3-phy", 2258 - .data = &qmp_v3_usb3phy_cfg, 2259 2785 }, { 2260 2786 .compatible = "qcom,sdm845-qmp-usb3-uni-phy", 2261 2787 .data = &qmp_v3_usb3_uniphy_cfg, ··· 2260 2804 .compatible = "qcom,sm6115-qmp-usb3-phy", 2261 2805 .data = &qcm2290_usb3phy_cfg, 2262 2806 }, { 2263 - .compatible = "qcom,sm8150-qmp-usb3-phy", 2264 - .data = &sm8150_usb3phy_cfg, 2265 - }, { 2266 2807 .compatible = "qcom,sm8150-qmp-usb3-uni-phy", 2267 2808 .data = &sm8150_usb3_uniphy_cfg, 2268 - }, { 2269 - .compatible = "qcom,sm8250-qmp-usb3-phy", 2270 - .data = &sm8250_usb3phy_cfg, 2271 2809 }, { 2272 2810 .compatible = "qcom,sm8250-qmp-usb3-uni-phy", 2273 2811 .data = &sm8250_usb3_uniphy_cfg, 2274 2812 }, { 2275 - .compatible = "qcom,sm8350-qmp-usb3-phy", 2276 - .data = &sm8350_usb3phy_cfg, 2277 - }, { 2278 2813 .compatible = "qcom,sm8350-qmp-usb3-uni-phy", 2279 2814 .data = &sm8350_usb3_uniphy_cfg, 2280 - }, { 2281 - .compatible = "qcom,sm8450-qmp-usb3-phy", 2282 - .data = &sm8350_usb3phy_cfg, 2283 2815 }, 2284 2816 { }, 2285 2817 };