|
25 | 25 | #include "phy-qcom-qmp-pcs-usb-v4.h"
|
26 | 26 | #include "phy-qcom-qmp-pcs-usb-v5.h"
|
27 | 27 | #include "phy-qcom-qmp-pcs-usb-v6.h"
|
| 28 | +#include "phy-qcom-qmp-pcs-usb-v7.h" |
28 | 29 |
|
29 | 30 | /* QPHY_SW_RESET bit */
|
30 | 31 | #define SW_RESET BIT(0)
|
@@ -163,6 +164,17 @@ static const unsigned int qmp_v6_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = {
|
163 | 164 | [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V6_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR,
|
164 | 165 | };
|
165 | 166 |
|
| 167 | +static const unsigned int qmp_v7_usb3phy_regs_layout[QPHY_LAYOUT_SIZE] = { |
| 168 | + [QPHY_SW_RESET] = QPHY_V7_PCS_SW_RESET, |
| 169 | + [QPHY_START_CTRL] = QPHY_V7_PCS_START_CONTROL, |
| 170 | + [QPHY_PCS_STATUS] = QPHY_V7_PCS_PCS_STATUS1, |
| 171 | + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V7_PCS_POWER_DOWN_CONTROL, |
| 172 | + |
| 173 | + /* In PCS_USB */ |
| 174 | + [QPHY_PCS_AUTONOMOUS_MODE_CTRL] = QPHY_V7_PCS_USB3_AUTONOMOUS_MODE_CTRL, |
| 175 | + [QPHY_PCS_LFPS_RXTERM_IRQ_CLEAR] = QPHY_V7_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR, |
| 176 | +}; |
| 177 | + |
166 | 178 | static const struct qmp_phy_init_tbl ipq9574_usb3_serdes_tbl[] = {
|
167 | 179 | QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x1a),
|
168 | 180 | QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x08),
|
@@ -1301,6 +1313,134 @@ static const struct qmp_phy_init_tbl sa8775p_usb3_uniphy_pcs_usb_tbl[] = {
|
1301 | 1313 | QMP_PHY_INIT_CFG(QPHY_V5_PCS_USB3_POWER_STATE_CONFIG1, 0x6f),
|
1302 | 1314 | };
|
1303 | 1315 |
|
| 1316 | +static const struct qmp_phy_init_tbl x1e80100_usb3_uniphy_serdes_tbl[] = { |
| 1317 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_STEP_SIZE1_MODE1, 0xc0), |
| 1318 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_STEP_SIZE2_MODE1, 0x01), |
| 1319 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_CP_CTRL_MODE1, 0x02), |
| 1320 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_PLL_RCTRL_MODE1, 0x16), |
| 1321 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_PLL_CCTRL_MODE1, 0x36), |
| 1322 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_CORECLK_DIV_MODE1, 0x04), |
| 1323 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_LOCK_CMP1_MODE1, 0x16), |
| 1324 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_LOCK_CMP2_MODE1, 0x41), |
| 1325 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DEC_START_MODE1, 0x41), |
| 1326 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DIV_FRAC_START1_MODE1, 0x55), |
| 1327 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DIV_FRAC_START2_MODE1, 0x75), |
| 1328 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DIV_FRAC_START3_MODE1, 0x01), |
| 1329 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_HSCLK_SEL_1, 0x01), |
| 1330 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_VCO_TUNE1_MODE1, 0x25), |
| 1331 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_VCO_TUNE2_MODE1, 0x02), |
| 1332 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0x5c), |
| 1333 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x0f), |
| 1334 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0x5c), |
| 1335 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x0f), |
| 1336 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_STEP_SIZE1_MODE0, 0xc0), |
| 1337 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_STEP_SIZE2_MODE0, 0x01), |
| 1338 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_CP_CTRL_MODE0, 0x02), |
| 1339 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_PLL_RCTRL_MODE0, 0x16), |
| 1340 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_PLL_CCTRL_MODE0, 0x36), |
| 1341 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_LOCK_CMP1_MODE0, 0x08), |
| 1342 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_LOCK_CMP2_MODE0, 0x1a), |
| 1343 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DEC_START_MODE0, 0x41), |
| 1344 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DIV_FRAC_START1_MODE0, 0x55), |
| 1345 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DIV_FRAC_START2_MODE0, 0x75), |
| 1346 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_DIV_FRAC_START3_MODE0, 0x01), |
| 1347 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_VCO_TUNE1_MODE0, 0x25), |
| 1348 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_VCO_TUNE2_MODE0, 0x02), |
| 1349 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_BG_TIMER, 0x0a), |
| 1350 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_EN_CENTER, 0x01), |
| 1351 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_PER1, 0x62), |
| 1352 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SSC_PER2, 0x02), |
| 1353 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SYSCLK_BUF_ENABLE, 0x0a), |
| 1354 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_SYSCLK_EN_SEL, 0x1a), |
| 1355 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_LOCK_CMP_CFG, 0x14), |
| 1356 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_VCO_TUNE_MAP, 0x04), |
| 1357 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_CORE_CLK_EN, 0x20), |
| 1358 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_CMN_CONFIG_1, 0x16), |
| 1359 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_AUTO_GAIN_ADJ_CTRL_1, 0xb6), |
| 1360 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_AUTO_GAIN_ADJ_CTRL_2, 0x4b), |
| 1361 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_AUTO_GAIN_ADJ_CTRL_3, 0x37), |
| 1362 | + QMP_PHY_INIT_CFG(QSERDES_V7_COM_ADDITIONAL_MISC, 0x0c), |
| 1363 | +}; |
| 1364 | + |
| 1365 | +static const struct qmp_phy_init_tbl x1e80100_usb3_uniphy_tx_tbl[] = { |
| 1366 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_RES_CODE_LANE_TX, 0x00), |
| 1367 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_RES_CODE_LANE_RX, 0x00), |
| 1368 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_RES_CODE_LANE_OFFSET_TX, 0x1f), |
| 1369 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_RES_CODE_LANE_OFFSET_RX, 0x09), |
| 1370 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_LANE_MODE_1, 0xf5), |
| 1371 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_LANE_MODE_3, 0x3f), |
| 1372 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_LANE_MODE_4, 0x3f), |
| 1373 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_LANE_MODE_5, 0x5f), |
| 1374 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_RCV_DETECT_LVL_2, 0x12), |
| 1375 | + QMP_PHY_INIT_CFG(QSERDES_V7_TX_PI_QEC_CTRL, 0x21), |
| 1376 | +}; |
| 1377 | + |
| 1378 | +static const struct qmp_phy_init_tbl x1e80100_usb3_uniphy_rx_tbl[] = { |
| 1379 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_FO_GAIN, 0x0a), |
| 1380 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_SO_GAIN, 0x06), |
| 1381 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_FASTLOCK_FO_GAIN, 0x2f), |
| 1382 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), |
| 1383 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_FASTLOCK_COUNT_LOW, 0xff), |
| 1384 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_FASTLOCK_COUNT_HIGH, 0x0f), |
| 1385 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_PI_CONTROLS, 0x99), |
| 1386 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_SB2_THRESH1, 0x08), |
| 1387 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_SB2_THRESH2, 0x08), |
| 1388 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_SB2_GAIN1, 0x00), |
| 1389 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_UCDR_SB2_GAIN2, 0x0a), |
| 1390 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), |
| 1391 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_VGA_CAL_CNTRL1, 0x54), |
| 1392 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_VGA_CAL_CNTRL2, 0x0f), |
| 1393 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_GM_CAL, 0x13), |
| 1394 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), |
| 1395 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), |
| 1396 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0a), |
| 1397 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_IDAC_TSETTLE_LOW, 0x07), |
| 1398 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_IDAC_TSETTLE_HIGH, 0x00), |
| 1399 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x47), |
| 1400 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_SIGDET_CNTRL, 0x04), |
| 1401 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_SIGDET_DEGLITCH_CNTRL, 0x0e), |
| 1402 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_00_LOW, 0x3f), |
| 1403 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_00_HIGH, 0xbf), |
| 1404 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_00_HIGH2, 0xff), |
| 1405 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_00_HIGH3, 0xdf), |
| 1406 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_00_HIGH4, 0xed), |
| 1407 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_01_LOW, 0xdc), |
| 1408 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_01_HIGH, 0x5c), |
| 1409 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_01_HIGH2, 0x9c), |
| 1410 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_01_HIGH3, 0x1d), |
| 1411 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_RX_MODE_01_HIGH4, 0x09), |
| 1412 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_DFE_EN_TIMER, 0x04), |
| 1413 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), |
| 1414 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_DCC_CTRL1, 0x0c), |
| 1415 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_VTH_CODE, 0x10), |
| 1416 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_SIGDET_CAL_CTRL1, 0x14), |
| 1417 | + QMP_PHY_INIT_CFG(QSERDES_V7_RX_SIGDET_CAL_TRIM, 0x08), |
| 1418 | +}; |
| 1419 | + |
| 1420 | +static const struct qmp_phy_init_tbl x1e80100_usb3_uniphy_pcs_tbl[] = { |
| 1421 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_LOCK_DETECT_CONFIG1, 0xc4), |
| 1422 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_LOCK_DETECT_CONFIG2, 0x89), |
| 1423 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_LOCK_DETECT_CONFIG3, 0x20), |
| 1424 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_LOCK_DETECT_CONFIG6, 0x13), |
| 1425 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_REFGEN_REQ_CONFIG1, 0x21), |
| 1426 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_RX_SIGDET_LVL, 0xaa), |
| 1427 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_RCVR_DTCT_DLY_P1U2_L, 0xe7), |
| 1428 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_RCVR_DTCT_DLY_P1U2_H, 0x03), |
| 1429 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_CDR_RESET_TIME, 0x0a), |
| 1430 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_ALIGN_DETECT_CONFIG1, 0x88), |
| 1431 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_ALIGN_DETECT_CONFIG2, 0x13), |
| 1432 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_PCS_TX_RX_CONFIG, 0x0c), |
| 1433 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_EQ_CONFIG1, 0x4b), |
| 1434 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_EQ_CONFIG5, 0x10), |
| 1435 | +}; |
| 1436 | + |
| 1437 | +static const struct qmp_phy_init_tbl x1e80100_usb3_uniphy_pcs_usb_tbl[] = { |
| 1438 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL, 0xf8), |
| 1439 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_USB3_RXEQTRAINING_DFE_TIME_S2, 0x07), |
| 1440 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_USB3_RCVR_DTCT_DLY_U3_L, 0x40), |
| 1441 | + QMP_PHY_INIT_CFG(QPHY_V7_PCS_USB3_RCVR_DTCT_DLY_U3_H, 0x00), |
| 1442 | +}; |
| 1443 | + |
1304 | 1444 | struct qmp_usb_offsets {
|
1305 | 1445 | u16 serdes;
|
1306 | 1446 | u16 pcs;
|
@@ -1465,6 +1605,14 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v6 = {
|
1465 | 1605 | .rx = 0x1000,
|
1466 | 1606 | };
|
1467 | 1607 |
|
| 1608 | +static const struct qmp_usb_offsets qmp_usb_offsets_v7 = { |
| 1609 | + .serdes = 0, |
| 1610 | + .pcs = 0x0200, |
| 1611 | + .pcs_usb = 0x1200, |
| 1612 | + .tx = 0x0e00, |
| 1613 | + .rx = 0x1000, |
| 1614 | +}; |
| 1615 | + |
1468 | 1616 | static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
|
1469 | 1617 | .lanes = 1,
|
1470 | 1618 |
|
@@ -1752,6 +1900,26 @@ static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = {
|
1752 | 1900 | .regs = qmp_v3_usb3phy_regs_layout_qcm2290,
|
1753 | 1901 | };
|
1754 | 1902 |
|
| 1903 | +static const struct qmp_phy_cfg x1e80100_usb3_uniphy_cfg = { |
| 1904 | + .lanes = 1, |
| 1905 | + |
| 1906 | + .offsets = &qmp_usb_offsets_v7, |
| 1907 | + |
| 1908 | + .serdes_tbl = x1e80100_usb3_uniphy_serdes_tbl, |
| 1909 | + .serdes_tbl_num = ARRAY_SIZE(x1e80100_usb3_uniphy_serdes_tbl), |
| 1910 | + .tx_tbl = x1e80100_usb3_uniphy_tx_tbl, |
| 1911 | + .tx_tbl_num = ARRAY_SIZE(x1e80100_usb3_uniphy_tx_tbl), |
| 1912 | + .rx_tbl = x1e80100_usb3_uniphy_rx_tbl, |
| 1913 | + .rx_tbl_num = ARRAY_SIZE(x1e80100_usb3_uniphy_rx_tbl), |
| 1914 | + .pcs_tbl = x1e80100_usb3_uniphy_pcs_tbl, |
| 1915 | + .pcs_tbl_num = ARRAY_SIZE(x1e80100_usb3_uniphy_pcs_tbl), |
| 1916 | + .pcs_usb_tbl = x1e80100_usb3_uniphy_pcs_usb_tbl, |
| 1917 | + .pcs_usb_tbl_num = ARRAY_SIZE(x1e80100_usb3_uniphy_pcs_usb_tbl), |
| 1918 | + .vreg_list = qmp_phy_vreg_l, |
| 1919 | + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), |
| 1920 | + .regs = qmp_v7_usb3phy_regs_layout, |
| 1921 | +}; |
| 1922 | + |
1755 | 1923 | static void qmp_usb_configure_lane(void __iomem *base,
|
1756 | 1924 | const struct qmp_phy_init_tbl tbl[],
|
1757 | 1925 | int num,
|
@@ -2441,6 +2609,9 @@ static const struct of_device_id qmp_usb_of_match_table[] = {
|
2441 | 2609 | }, {
|
2442 | 2610 | .compatible = "qcom,sm8350-qmp-usb3-uni-phy",
|
2443 | 2611 | .data = &sm8350_usb3_uniphy_cfg,
|
| 2612 | + }, { |
| 2613 | + .compatible = "qcom,x1e80100-qmp-usb3-uni-phy", |
| 2614 | + .data = &x1e80100_usb3_uniphy_cfg, |
2444 | 2615 | },
|
2445 | 2616 | { },
|
2446 | 2617 | };
|
|
0 commit comments