|
24 | 24 |
|
25 | 25 | #include "phy-qcom-qmp-dp-phy.h"
|
26 | 26 | #include "phy-qcom-qmp-qserdes-com-v4.h"
|
| 27 | +#include "phy-qcom-qmp-qserdes-com-v6.h" |
27 | 28 |
|
28 | 29 | /* EDP_PHY registers */
|
29 | 30 | #define DP_PHY_CFG 0x0010
|
@@ -532,6 +533,184 @@ static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
|
532 | 533 | .ver_ops = &qcom_edp_phy_ops_v4,
|
533 | 534 | };
|
534 | 535 |
|
| 536 | +static int qcom_edp_phy_power_on_v6(const struct qcom_edp *edp) |
| 537 | +{ |
| 538 | + u32 val; |
| 539 | + |
| 540 | + writel(DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN | |
| 541 | + DP_PHY_PD_CTL_LANE_0_1_PWRDN | DP_PHY_PD_CTL_LANE_2_3_PWRDN | |
| 542 | + DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN, |
| 543 | + edp->edp + DP_PHY_PD_CTL); |
| 544 | + writel(0xfc, edp->edp + DP_PHY_MODE); |
| 545 | + |
| 546 | + return readl_poll_timeout(edp->pll + QSERDES_V6_COM_CMN_STATUS, |
| 547 | + val, val & BIT(7), 5, 200); |
| 548 | +} |
| 549 | + |
| 550 | +static int qcom_edp_phy_com_resetsm_cntrl_v6(const struct qcom_edp *edp) |
| 551 | +{ |
| 552 | + u32 val; |
| 553 | + |
| 554 | + writel(0x20, edp->pll + QSERDES_V6_COM_RESETSM_CNTRL); |
| 555 | + |
| 556 | + return readl_poll_timeout(edp->pll + QSERDES_V6_COM_C_READY_STATUS, |
| 557 | + val, val & BIT(0), 500, 10000); |
| 558 | +} |
| 559 | + |
| 560 | +static int qcom_edp_com_bias_en_clkbuflr_v6(const struct qcom_edp *edp) |
| 561 | +{ |
| 562 | + /* Turn on BIAS current for PHY/PLL */ |
| 563 | + writel(0x1f, edp->pll + QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN); |
| 564 | + |
| 565 | + return 0; |
| 566 | +} |
| 567 | + |
| 568 | +static int qcom_edp_com_configure_ssc_v6(const struct qcom_edp *edp) |
| 569 | +{ |
| 570 | + const struct phy_configure_opts_dp *dp_opts = &edp->dp_opts; |
| 571 | + u32 step1; |
| 572 | + u32 step2; |
| 573 | + |
| 574 | + switch (dp_opts->link_rate) { |
| 575 | + case 1620: |
| 576 | + case 2700: |
| 577 | + case 8100: |
| 578 | + step1 = 0x92; |
| 579 | + step2 = 0x01; |
| 580 | + break; |
| 581 | + |
| 582 | + case 5400: |
| 583 | + step1 = 0x18; |
| 584 | + step2 = 0x02; |
| 585 | + break; |
| 586 | + |
| 587 | + default: |
| 588 | + /* Other link rates aren't supported */ |
| 589 | + return -EINVAL; |
| 590 | + } |
| 591 | + |
| 592 | + writel(0x01, edp->pll + QSERDES_V6_COM_SSC_EN_CENTER); |
| 593 | + writel(0x00, edp->pll + QSERDES_V6_COM_SSC_ADJ_PER1); |
| 594 | + writel(0x36, edp->pll + QSERDES_V6_COM_SSC_PER1); |
| 595 | + writel(0x01, edp->pll + QSERDES_V6_COM_SSC_PER2); |
| 596 | + writel(step1, edp->pll + QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0); |
| 597 | + writel(step2, edp->pll + QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0); |
| 598 | + |
| 599 | + return 0; |
| 600 | +} |
| 601 | + |
| 602 | +static int qcom_edp_com_configure_pll_v6(const struct qcom_edp *edp) |
| 603 | +{ |
| 604 | + const struct phy_configure_opts_dp *dp_opts = &edp->dp_opts; |
| 605 | + u32 div_frac_start2_mode0; |
| 606 | + u32 div_frac_start3_mode0; |
| 607 | + u32 dec_start_mode0; |
| 608 | + u32 lock_cmp1_mode0; |
| 609 | + u32 lock_cmp2_mode0; |
| 610 | + u32 code1_mode0; |
| 611 | + u32 code2_mode0; |
| 612 | + u32 hsclk_sel; |
| 613 | + |
| 614 | + switch (dp_opts->link_rate) { |
| 615 | + case 1620: |
| 616 | + hsclk_sel = 0x5; |
| 617 | + dec_start_mode0 = 0x34; |
| 618 | + div_frac_start2_mode0 = 0xc0; |
| 619 | + div_frac_start3_mode0 = 0x0b; |
| 620 | + lock_cmp1_mode0 = 0x37; |
| 621 | + lock_cmp2_mode0 = 0x04; |
| 622 | + code1_mode0 = 0x71; |
| 623 | + code2_mode0 = 0x0c; |
| 624 | + break; |
| 625 | + |
| 626 | + case 2700: |
| 627 | + hsclk_sel = 0x3; |
| 628 | + dec_start_mode0 = 0x34; |
| 629 | + div_frac_start2_mode0 = 0xc0; |
| 630 | + div_frac_start3_mode0 = 0x0b; |
| 631 | + lock_cmp1_mode0 = 0x07; |
| 632 | + lock_cmp2_mode0 = 0x07; |
| 633 | + code1_mode0 = 0x71; |
| 634 | + code2_mode0 = 0x0c; |
| 635 | + break; |
| 636 | + |
| 637 | + case 5400: |
| 638 | + hsclk_sel = 0x1; |
| 639 | + dec_start_mode0 = 0x46; |
| 640 | + div_frac_start2_mode0 = 0x00; |
| 641 | + div_frac_start3_mode0 = 0x05; |
| 642 | + lock_cmp1_mode0 = 0x0f; |
| 643 | + lock_cmp2_mode0 = 0x0e; |
| 644 | + code1_mode0 = 0x97; |
| 645 | + code2_mode0 = 0x10; |
| 646 | + break; |
| 647 | + |
| 648 | + case 8100: |
| 649 | + hsclk_sel = 0x0; |
| 650 | + dec_start_mode0 = 0x34; |
| 651 | + div_frac_start2_mode0 = 0xc0; |
| 652 | + div_frac_start3_mode0 = 0x0b; |
| 653 | + lock_cmp1_mode0 = 0x17; |
| 654 | + lock_cmp2_mode0 = 0x15; |
| 655 | + code1_mode0 = 0x71; |
| 656 | + code2_mode0 = 0x0c; |
| 657 | + break; |
| 658 | + |
| 659 | + default: |
| 660 | + /* Other link rates aren't supported */ |
| 661 | + return -EINVAL; |
| 662 | + } |
| 663 | + |
| 664 | + writel(0x01, edp->pll + QSERDES_V6_COM_SVS_MODE_CLK_SEL); |
| 665 | + writel(0x0b, edp->pll + QSERDES_V6_COM_SYSCLK_EN_SEL); |
| 666 | + writel(0x02, edp->pll + QSERDES_V6_COM_SYS_CLK_CTRL); |
| 667 | + writel(0x0c, edp->pll + QSERDES_V6_COM_CLK_ENABLE1); |
| 668 | + writel(0x06, edp->pll + QSERDES_V6_COM_SYSCLK_BUF_ENABLE); |
| 669 | + writel(0x30, edp->pll + QSERDES_V6_COM_CLK_SELECT); |
| 670 | + writel(hsclk_sel, edp->pll + QSERDES_V6_COM_HSCLK_SEL_1); |
| 671 | + writel(0x07, edp->pll + QSERDES_V6_COM_PLL_IVCO); |
| 672 | + writel(0x08, edp->pll + QSERDES_V6_COM_LOCK_CMP_EN); |
| 673 | + writel(0x36, edp->pll + QSERDES_V6_COM_PLL_CCTRL_MODE0); |
| 674 | + writel(0x16, edp->pll + QSERDES_V6_COM_PLL_RCTRL_MODE0); |
| 675 | + writel(0x06, edp->pll + QSERDES_V6_COM_CP_CTRL_MODE0); |
| 676 | + writel(dec_start_mode0, edp->pll + QSERDES_V6_COM_DEC_START_MODE0); |
| 677 | + writel(0x00, edp->pll + QSERDES_V6_COM_DIV_FRAC_START1_MODE0); |
| 678 | + writel(div_frac_start2_mode0, edp->pll + QSERDES_V6_COM_DIV_FRAC_START2_MODE0); |
| 679 | + writel(div_frac_start3_mode0, edp->pll + QSERDES_V6_COM_DIV_FRAC_START3_MODE0); |
| 680 | + writel(0x12, edp->pll + QSERDES_V6_COM_CMN_CONFIG_1); |
| 681 | + writel(0x3f, edp->pll + QSERDES_V6_COM_INTEGLOOP_GAIN0_MODE0); |
| 682 | + writel(0x00, edp->pll + QSERDES_V6_COM_INTEGLOOP_GAIN1_MODE0); |
| 683 | + writel(0x00, edp->pll + QSERDES_V6_COM_VCO_TUNE_MAP); |
| 684 | + writel(lock_cmp1_mode0, edp->pll + QSERDES_V6_COM_LOCK_CMP1_MODE0); |
| 685 | + writel(lock_cmp2_mode0, edp->pll + QSERDES_V6_COM_LOCK_CMP2_MODE0); |
| 686 | + |
| 687 | + writel(0x0a, edp->pll + QSERDES_V6_COM_BG_TIMER); |
| 688 | + writel(0x14, edp->pll + QSERDES_V6_COM_PLL_CORE_CLK_DIV_MODE0); |
| 689 | + writel(0x00, edp->pll + QSERDES_V6_COM_VCO_TUNE_CTRL); |
| 690 | + writel(0x1f, edp->pll + QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN); |
| 691 | + writel(0x0f, edp->pll + QSERDES_V6_COM_CORE_CLK_EN); |
| 692 | + writel(0xa0, edp->pll + QSERDES_V6_COM_VCO_TUNE1_MODE0); |
| 693 | + writel(0x03, edp->pll + QSERDES_V6_COM_VCO_TUNE2_MODE0); |
| 694 | + |
| 695 | + writel(code1_mode0, edp->pll + QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0); |
| 696 | + writel(code2_mode0, edp->pll + QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0); |
| 697 | + |
| 698 | + return 0; |
| 699 | +} |
| 700 | + |
| 701 | +static const struct phy_ver_ops qcom_edp_phy_ops_v6 = { |
| 702 | + .com_power_on = qcom_edp_phy_power_on_v6, |
| 703 | + .com_resetsm_cntrl = qcom_edp_phy_com_resetsm_cntrl_v6, |
| 704 | + .com_bias_en_clkbuflr = qcom_edp_com_bias_en_clkbuflr_v6, |
| 705 | + .com_configure_pll = qcom_edp_com_configure_pll_v6, |
| 706 | + .com_configure_ssc = qcom_edp_com_configure_ssc_v6, |
| 707 | +}; |
| 708 | + |
| 709 | +static struct qcom_edp_phy_cfg x1e80100_phy_cfg = { |
| 710 | + .swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg, |
| 711 | + .ver_ops = &qcom_edp_phy_ops_v6, |
| 712 | +}; |
| 713 | + |
535 | 714 | static int qcom_edp_phy_power_on(struct phy *phy)
|
536 | 715 | {
|
537 | 716 | const struct qcom_edp *edp = phy_get_drvdata(phy);
|
@@ -933,6 +1112,7 @@ static const struct of_device_id qcom_edp_phy_match_table[] = {
|
933 | 1112 | { .compatible = "qcom,sc8180x-edp-phy", .data = &sc7280_dp_phy_cfg, },
|
934 | 1113 | { .compatible = "qcom,sc8280xp-dp-phy", .data = &sc8280xp_dp_phy_cfg, },
|
935 | 1114 | { .compatible = "qcom,sc8280xp-edp-phy", .data = &sc8280xp_edp_phy_cfg, },
|
| 1115 | + { .compatible = "qcom,x1e80100-dp-phy", .data = &x1e80100_phy_cfg, }, |
936 | 1116 | { }
|
937 | 1117 | };
|
938 | 1118 | MODULE_DEVICE_TABLE(of, qcom_edp_phy_match_table);
|
|
0 commit comments