194a407ccSDmitry Baryshkov // SPDX-License-Identifier: GPL-2.0 294a407ccSDmitry Baryshkov /* 394a407ccSDmitry Baryshkov * Copyright (c) 2017, The Linux Foundation. All rights reserved. 494a407ccSDmitry Baryshkov */ 594a407ccSDmitry Baryshkov 694a407ccSDmitry Baryshkov #include <linux/clk.h> 794a407ccSDmitry Baryshkov #include <linux/clk-provider.h> 894a407ccSDmitry Baryshkov #include <linux/delay.h> 994a407ccSDmitry Baryshkov #include <linux/err.h> 1094a407ccSDmitry Baryshkov #include <linux/io.h> 1194a407ccSDmitry Baryshkov #include <linux/iopoll.h> 1294a407ccSDmitry Baryshkov #include <linux/kernel.h> 1394a407ccSDmitry Baryshkov #include <linux/module.h> 1494a407ccSDmitry Baryshkov #include <linux/of.h> 1594a407ccSDmitry Baryshkov #include <linux/of_device.h> 1694a407ccSDmitry Baryshkov #include <linux/of_address.h> 1711bf53a3SDmitry Baryshkov #include <linux/phy/pcie.h> 1894a407ccSDmitry Baryshkov #include <linux/phy/phy.h> 1994a407ccSDmitry Baryshkov #include <linux/platform_device.h> 2094a407ccSDmitry Baryshkov #include <linux/regulator/consumer.h> 2194a407ccSDmitry Baryshkov #include <linux/reset.h> 2294a407ccSDmitry Baryshkov #include <linux/slab.h> 2394a407ccSDmitry Baryshkov 2494a407ccSDmitry Baryshkov #include <dt-bindings/phy/phy.h> 2594a407ccSDmitry Baryshkov 2694a407ccSDmitry Baryshkov #include "phy-qcom-qmp.h" 2794a407ccSDmitry Baryshkov 2894a407ccSDmitry Baryshkov /* QPHY_SW_RESET bit */ 2994a407ccSDmitry Baryshkov #define SW_RESET BIT(0) 3094a407ccSDmitry Baryshkov /* QPHY_POWER_DOWN_CONTROL */ 3194a407ccSDmitry Baryshkov #define SW_PWRDN BIT(0) 3294a407ccSDmitry Baryshkov #define REFCLK_DRV_DSBL BIT(1) 3394a407ccSDmitry Baryshkov /* QPHY_START_CONTROL bits */ 3494a407ccSDmitry Baryshkov #define SERDES_START BIT(0) 3594a407ccSDmitry Baryshkov #define PCS_START BIT(1) 3694a407ccSDmitry Baryshkov /* QPHY_PCS_STATUS bit */ 3794a407ccSDmitry Baryshkov #define PHYSTATUS BIT(6) 3894a407ccSDmitry Baryshkov #define PHYSTATUS_4_20 BIT(7) 3994a407ccSDmitry Baryshkov 4094a407ccSDmitry Baryshkov #define PHY_INIT_COMPLETE_TIMEOUT 10000 4194a407ccSDmitry Baryshkov 4294a407ccSDmitry Baryshkov struct qmp_phy_init_tbl { 4394a407ccSDmitry Baryshkov unsigned int offset; 4494a407ccSDmitry Baryshkov unsigned int val; 4594a407ccSDmitry Baryshkov /* 4694a407ccSDmitry Baryshkov * mask of lanes for which this register is written 4794a407ccSDmitry Baryshkov * for cases when second lane needs different values 4894a407ccSDmitry Baryshkov */ 4994a407ccSDmitry Baryshkov u8 lane_mask; 5094a407ccSDmitry Baryshkov }; 5194a407ccSDmitry Baryshkov 5294a407ccSDmitry Baryshkov #define QMP_PHY_INIT_CFG(o, v) \ 5394a407ccSDmitry Baryshkov { \ 5494a407ccSDmitry Baryshkov .offset = o, \ 5594a407ccSDmitry Baryshkov .val = v, \ 5694a407ccSDmitry Baryshkov .lane_mask = 0xff, \ 5794a407ccSDmitry Baryshkov } 5894a407ccSDmitry Baryshkov 5994a407ccSDmitry Baryshkov #define QMP_PHY_INIT_CFG_LANE(o, v, l) \ 6094a407ccSDmitry Baryshkov { \ 6194a407ccSDmitry Baryshkov .offset = o, \ 6294a407ccSDmitry Baryshkov .val = v, \ 6394a407ccSDmitry Baryshkov .lane_mask = l, \ 6494a407ccSDmitry Baryshkov } 6594a407ccSDmitry Baryshkov 6694a407ccSDmitry Baryshkov /* set of registers with offsets different per-PHY */ 6794a407ccSDmitry Baryshkov enum qphy_reg_layout { 6894a407ccSDmitry Baryshkov /* PCS registers */ 6994a407ccSDmitry Baryshkov QPHY_SW_RESET, 7094a407ccSDmitry Baryshkov QPHY_START_CTRL, 7194a407ccSDmitry Baryshkov QPHY_PCS_STATUS, 7294a407ccSDmitry Baryshkov QPHY_PCS_POWER_DOWN_CONTROL, 7394a407ccSDmitry Baryshkov /* Keep last to ensure regs_layout arrays are properly initialized */ 7494a407ccSDmitry Baryshkov QPHY_LAYOUT_SIZE 7594a407ccSDmitry Baryshkov }; 7694a407ccSDmitry Baryshkov 7794a407ccSDmitry Baryshkov static const unsigned int ipq_pciephy_gen3_regs_layout[QPHY_LAYOUT_SIZE] = { 7894a407ccSDmitry Baryshkov [QPHY_SW_RESET] = 0x00, 7994a407ccSDmitry Baryshkov [QPHY_START_CTRL] = 0x44, 8094a407ccSDmitry Baryshkov [QPHY_PCS_STATUS] = 0x14, 8194a407ccSDmitry Baryshkov [QPHY_PCS_POWER_DOWN_CONTROL] = 0x40, 8294a407ccSDmitry Baryshkov }; 8394a407ccSDmitry Baryshkov 8494a407ccSDmitry Baryshkov static const unsigned int pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { 8594a407ccSDmitry Baryshkov [QPHY_SW_RESET] = 0x00, 8694a407ccSDmitry Baryshkov [QPHY_START_CTRL] = 0x08, 8794a407ccSDmitry Baryshkov [QPHY_PCS_STATUS] = 0x174, 886d5b1e20SJohan Hovold [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04, 8994a407ccSDmitry Baryshkov }; 9094a407ccSDmitry Baryshkov 9194a407ccSDmitry Baryshkov static const unsigned int sdm845_qmp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { 9294a407ccSDmitry Baryshkov [QPHY_SW_RESET] = 0x00, 9394a407ccSDmitry Baryshkov [QPHY_START_CTRL] = 0x08, 9494a407ccSDmitry Baryshkov [QPHY_PCS_STATUS] = 0x174, 956d5b1e20SJohan Hovold [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04, 9694a407ccSDmitry Baryshkov }; 9794a407ccSDmitry Baryshkov 9894a407ccSDmitry Baryshkov static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { 9994a407ccSDmitry Baryshkov [QPHY_SW_RESET] = 0x00, 10094a407ccSDmitry Baryshkov [QPHY_START_CTRL] = 0x08, 10194a407ccSDmitry Baryshkov [QPHY_PCS_STATUS] = 0x2ac, 1026d5b1e20SJohan Hovold [QPHY_PCS_POWER_DOWN_CONTROL] = 0x04, 10394a407ccSDmitry Baryshkov }; 10494a407ccSDmitry Baryshkov 10594a407ccSDmitry Baryshkov static const unsigned int sm8250_pcie_regs_layout[QPHY_LAYOUT_SIZE] = { 10694a407ccSDmitry Baryshkov [QPHY_SW_RESET] = 0x00, 10794a407ccSDmitry Baryshkov [QPHY_START_CTRL] = 0x44, 10894a407ccSDmitry Baryshkov [QPHY_PCS_STATUS] = 0x14, 10994a407ccSDmitry Baryshkov [QPHY_PCS_POWER_DOWN_CONTROL] = 0x40, 11094a407ccSDmitry Baryshkov }; 11194a407ccSDmitry Baryshkov 11294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_serdes_tbl[] = { 11394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14), 11494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), 11594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x0f), 11694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06), 11794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x01), 11894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL, 0x20), 11994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x00), 12094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01), 12194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xc9), 12294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER1, 0xff), 12394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER2, 0x3f), 12494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x01), 12594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00), 12694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORECLK_DIV_MODE0, 0x0a), 12794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_EP_DIV, 0x19), 12894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_ENABLE1, 0x90), 12994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82), 13094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START3_MODE0, 0x03), 13194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START2_MODE0, 0x55), 13294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START1_MODE0, 0x55), 13394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP3_MODE0, 0x00), 13494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x0d), 13594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0x04), 13694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x00), 13794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x08), 13894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16), 13994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x34), 14094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06), 14194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x33), 14294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02), 14394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_BUF_ENABLE, 0x07), 14494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x04), 14594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00), 14694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f), 14794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_BG_TIMER, 0x09), 14894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_EN_CENTER, 0x01), 14994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER1, 0x40), 15094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER2, 0x01), 15194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER1, 0x02), 15294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER2, 0x00), 15394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE1, 0x7e), 15494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE2, 0x15), 15594a407ccSDmitry Baryshkov }; 15694a407ccSDmitry Baryshkov 15794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_tx_tbl[] = { 15894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x02), 15994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12), 16094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10), 16194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x06), 16294a407ccSDmitry Baryshkov }; 16394a407ccSDmitry Baryshkov 16494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_rx_tbl[] = { 16594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03), 16694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_ENABLES, 0x1c), 16794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 16894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0a), 16994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04), 17094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1a), 17194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), 17294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN, 0x04), 17394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN_HALF, 0x04), 17494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x00), 17594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80), 17694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_INTERFACE_MODE, 0x40), 17794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x71), 17894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x40), 17994a407ccSDmitry Baryshkov }; 18094a407ccSDmitry Baryshkov 18194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_pcs_tbl[] = { 18294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_ENDPOINT_REFCLK_DRIVE, 0x04), 18394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_OSC_DTCT_ACTIONS, 0x00), 18494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x01), 18594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00), 18694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x20), 18794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00), 18894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x01), 18994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73), 19094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0x99), 19194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_SIGDET_CNTRL, 0x03), 19294a407ccSDmitry Baryshkov }; 19394a407ccSDmitry Baryshkov 19494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_serdes_tbl[] = { 19594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_PER1, 0x7d), 19694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_PER2, 0x01), 19794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE1_MODE0, 0x0a), 19894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE2_MODE0, 0x05), 19994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE1_MODE1, 0x08), 20094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE2_MODE1, 0x04), 20194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CLKBUFLR_EN, 0x18), 20294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90), 20394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SYS_CLK_CTRL, 0x02), 20494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_BUF_ENABLE, 0x07), 20594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_IVCO, 0x0f), 20694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE0, 0xd4), 20794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE0, 0x14), 20894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE1, 0xaa), 20994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE1, 0x29), 21094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TRIM, 0x0f), 21194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE0, 0x09), 21294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE1, 0x09), 21394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE0, 0x16), 21494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE1, 0x16), 21594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE0, 0x28), 21694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE1, 0x28), 21794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CTRL_BY_PSM, 0x01), 21894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_EN_SEL, 0x08), 21994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_RESETSM_CNTRL, 0x20), 22094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP_EN, 0x42), 22194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE0, 0x68), 22294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE1, 0x53), 22394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE0, 0xab), 22494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE0, 0xaa), 22594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE0, 0x02), 22694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE1, 0x55), 22794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE1, 0x55), 22894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE1, 0x05), 22994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE0, 0xa0), 23094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE1, 0xa0), 23194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE0, 0x24), 23294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE0, 0x02), 23394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE1, 0xb4), 23494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE1, 0x03), 23594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x32), 23694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x01), 23794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x00), 23894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CMN_CONFIG, 0x06), 23994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), 24094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV_MODE1, 0x08), 24194a407ccSDmitry Baryshkov }; 24294a407ccSDmitry Baryshkov 24394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_tx_tbl[] = { 244079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x02), 245079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x06), 246079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 24794a407ccSDmitry Baryshkov }; 24894a407ccSDmitry Baryshkov 24994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_rx_tbl[] = { 250079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c), 251079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x02), 252079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 253079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70), 254079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x61), 255079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04), 256079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1e), 257079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 258079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 259079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x73), 260079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80), 261079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c), 262079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03), 263079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 264079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xf0), 265079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x01), 266079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x2f), 267079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0xd3), 268079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x40), 269079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x01), 270079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x02), 271079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xc8), 272079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x09), 273079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb1), 274079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0x00), 275079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x02), 276079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xc8), 277079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x09), 278079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1), 279079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 28094a407ccSDmitry Baryshkov }; 28194a407ccSDmitry Baryshkov 28294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_pcs_tbl[] = { 28360f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNTRL1, 0x01), 28460f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d), 28560f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_G12S1_TXDEEMPH_M3P5DB, 0x10), 28660f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 28760f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 28860f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_DCC_CAL_CONFIG, 0x01), 28960f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x01), 290af664324SDmitry Baryshkov }; 291af664324SDmitry Baryshkov 292af664324SDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_pcs_misc_tbl[] = { 29360f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG2, 0x0d), 29460f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07), 29560f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 29660f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 29760f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 29860f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 29960f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG1, 0x11), 30060f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00), 30160f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58), 30294a407ccSDmitry Baryshkov }; 30394a407ccSDmitry Baryshkov 30494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { 30594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x18), 30694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CLK_ENABLE1, 0x10), 30794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf), 30894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1), 30994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0), 31094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff), 31194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f), 31294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6), 31394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf), 31494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0), 31594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SVS_MODE_CLK_SEL, 0x1), 31694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CORE_CLK_EN, 0x20), 31794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CORECLK_DIV, 0xa), 31894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_RESETSM_CNTRL, 0x20), 31994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0xa), 32094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0xa), 32194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x82), 32294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x3), 32394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x55), 32494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x55), 32594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x0), 32694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0xD), 32794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0xD04), 32894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x33), 32994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SYS_CLK_CTRL, 0x2), 33094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_BUF_ENABLE, 0x1f), 33194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CP_CTRL_MODE0, 0xb), 33294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_PLL_RCTRL_MODE0, 0x16), 33394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_PLL_CCTRL_MODE0, 0x28), 33494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0), 33594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80), 33694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1), 33794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1), 33894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31), 33994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1), 34094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER1, 0x2), 34194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER2, 0x0), 34294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f), 34394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19), 34494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19), 34594a407ccSDmitry Baryshkov }; 34694a407ccSDmitry Baryshkov 34794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { 34894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN, 0x45), 34994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6), 35094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2), 35194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12), 352f7c5cedbSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_TX_TX_EMP_POST1_LVL, 0x36), 35394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a), 35494a407ccSDmitry Baryshkov }; 35594a407ccSDmitry Baryshkov 35694a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { 35794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_ENABLES, 0x1c), 35894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 35994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2, 0x1), 36094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL3, 0x0), 36194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb), 36294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), 36394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4), 36494a407ccSDmitry Baryshkov }; 36594a407ccSDmitry Baryshkov 36694a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = { 3676cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_ENDPOINT_REFCLK_DRIVE, 0x4), 3686cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_OSC_DTCT_ACTIONS, 0x0), 3696cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x40), 3706cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x0), 3716cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x40), 3726cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME_AUXCLK_LSB, 0x0), 3736cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x40), 374c1ab64aaSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73), 3756cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_RX_SIGDET_LVL, 0x99), 3766cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_TXDEEMPH_M6DB_V0, 0x15), 3776cad2983SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V2_PCS_TXDEEMPH_M3P5DB_V0, 0xe), 37894a407ccSDmitry Baryshkov }; 37994a407ccSDmitry Baryshkov 380334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_serdes_tbl[] = { 381334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CLKBUFLR_EN, 0x18), 382334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CTRL_BY_PSM, 0x01), 383334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x31), 384334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_IVCO, 0x0f), 385334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TRIM, 0x0f), 386334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CMN_CONFIG, 0x06), 387334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP_EN, 0x42), 388334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_RESETSM_CNTRL, 0x20), 389334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x01), 390334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_MAP, 0x04), 391334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), 392334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_TIMER1, 0xff), 393334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_TIMER2, 0x3f), 394334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x30), 395334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x21), 396334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE0, 0x82), 397334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE0, 0x03), 398334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE0, 0x355), 399334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE0, 0x35555), 400334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE0, 0x1a), 401334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE0, 0x1a0a), 402334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE0, 0xb), 403334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE0, 0x16), 404334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE0, 0x28), 405334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN1_MODE0, 0x0), 406334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE0, 0x40), 407334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE0, 0x02), 408334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE0, 0x24), 409334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), 410334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x20), 411334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV, 0xa), 412334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x32), 413334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SYS_CLK_CTRL, 0x02), 414334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_BUF_ENABLE, 0x07), 415334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_EN_SEL, 0x08), 416334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TIMER, 0xa), 417334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x1), 418334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE1, 0x68), 419334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE1, 0x2), 420334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE1, 0x2aa), 421334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE1, 0x2aaab), 422334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90), 423334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE1, 0x34), 424334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE1, 0x3414), 425334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE1, 0x0b), 426334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE1, 0x16), 427334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE1, 0x28), 428334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN1_MODE1, 0x0), 429334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE1, 0x40), 430334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE1, 0x03), 431334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE1, 0xb4), 432334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), 433334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x0), 434334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV_MODE1, 0x08), 435334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_EP_DIV_MODE0, 0x19), 436334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_EP_DIV_MODE1, 0x28), 437334fad18SRobert Marko QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90), 438334fad18SRobert Marko }; 439334fad18SRobert Marko 440334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_tx_tbl[] = { 441079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x02), 442079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 443079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_HIGHZ_DRVR_EN, 0x10), 444079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x06), 445334fad18SRobert Marko }; 446334fad18SRobert Marko 447334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_rx_tbl[] = { 448079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03), 449079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c), 450079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 451079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0xe), 452079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4), 453079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1b), 454079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 455079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 456079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70), 457079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x73), 458079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80), 459079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0x00), 460079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x02), 461079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xc8), 462079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x09), 463079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1), 464079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x01), 465079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x02), 466079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xc8), 467079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x09), 468079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb1), 469079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xf0), 470079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x2), 471079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x2f), 472079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0xd3), 473079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x40), 474079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 475079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 476079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c), 477079328a9SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x02), 478334fad18SRobert Marko }; 479334fad18SRobert Marko 480334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_pcs_tbl[] = { 48160f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNTRL2, 0x83), 48260f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNT_VAL_L, 0x9), 48360f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNT_VAL_H_TOL, 0x42), 48460f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_MAN_CODE, 0x40), 48560f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNTRL1, 0x01), 48660f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_H, 0x0), 48760f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x1), 48860f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x0), 48960f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_H, 0x00), 49060f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 49160f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_H, 0x00), 49260f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 49360f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG1, 0x11), 49460f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG2, 0xb), 49560f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07), 49660f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_CONFIG2, 0x52), 49760f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_MODE2_CONFIG2, 0x50), 49860f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_MODE2_CONFIG4, 0x1a), 49960f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5, 0x6), 50060f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_G12S1_TXDEEMPH_M3P5DB, 0x10), 50160f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 50260f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_DCC_CAL_CONFIG, 0x01), 50360f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 50460f23414SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d), 505334fad18SRobert Marko }; 506334fad18SRobert Marko 50794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = { 50894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14), 50994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), 51094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x007), 51194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06), 51294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x01), 51394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL, 0x20), 51494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x00), 51594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01), 51694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xc9), 51794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER1, 0xff), 51894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER2, 0x3f), 51994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x01), 52094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00), 52194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORECLK_DIV_MODE0, 0x0a), 52294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_EP_DIV, 0x19), 52394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_ENABLE1, 0x90), 52494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82), 52594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START3_MODE0, 0x02), 52694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START2_MODE0, 0xea), 52794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START1_MODE0, 0xab), 52894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP3_MODE0, 0x00), 52994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x0d), 53094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0x04), 53194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x00), 53294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x06), 53394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16), 53494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x36), 53594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_MODE, 0x01), 53694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x33), 53794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02), 53894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_BUF_ENABLE, 0x06), 53994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x04), 54094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00), 54194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f), 54294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_BG_TIMER, 0x09), 54394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_EN_CENTER, 0x01), 54494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER1, 0x40), 54594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER2, 0x01), 54694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER1, 0x02), 54794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER2, 0x00), 54894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE1, 0x7e), 54994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE2, 0x15), 55094a407ccSDmitry Baryshkov }; 55194a407ccSDmitry Baryshkov 55294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_tx_tbl[] = { 55394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x02), 55494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12), 55594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10), 55694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x06), 55794a407ccSDmitry Baryshkov }; 55894a407ccSDmitry Baryshkov 55994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_rx_tbl[] = { 56094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03), 56194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_ENABLES, 0x10), 56294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 56394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0e), 56494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04), 56594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1a), 56694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), 56794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN, 0x04), 56894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN_HALF, 0x04), 56994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x71), 57094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_MODE_00, 0x59), 57194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_MODE_01, 0x59), 57294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80), 57394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_INTERFACE_MODE, 0x40), 57494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x71), 57594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x40), 57694a407ccSDmitry Baryshkov }; 57794a407ccSDmitry Baryshkov 57894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_pcs_tbl[] = { 57994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_ENDPOINT_REFCLK_DRIVE, 0x04), 58094a407ccSDmitry Baryshkov 58194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL2, 0x83), 58294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_L, 0x09), 58394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_H_TOL, 0xa2), 58494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_MAN_CODE, 0x40), 58594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL1, 0x02), 58694a407ccSDmitry Baryshkov 58794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_OSC_DTCT_ACTIONS, 0x00), 58894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x01), 58994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00), 59094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x20), 59194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00), 59294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x01), 59394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73), 59494a407ccSDmitry Baryshkov 59594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0xbb), 59694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_SIGDET_CNTRL, 0x03), 59794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_REFGEN_REQ_CONFIG1, 0x0d), 59894a407ccSDmitry Baryshkov 59994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_POWER_STATE_CONFIG4, 0x00), 60094a407ccSDmitry Baryshkov }; 60194a407ccSDmitry Baryshkov 60294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_pcs_misc_tbl[] = { 60394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_CONFIG2, 0x52), 60494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG2, 0x10), 60594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG4, 0x1a), 60694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG5, 0x06), 60794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_PCIE_INT_AUX_CLK_CONFIG1, 0x00), 60894a407ccSDmitry Baryshkov }; 60994a407ccSDmitry Baryshkov 61094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_serdes_tbl[] = { 61194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SYSCLK_EN_SEL, 0x27), 61294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_EN_CENTER, 0x01), 61394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_PER1, 0x31), 61494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_PER2, 0x01), 61594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE1, 0xde), 61694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE2, 0x07), 61794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE1_MODE1, 0x4c), 61894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE2_MODE1, 0x06), 61994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_BIAS_EN_CKBUFLR_EN, 0x18), 62094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CLK_ENABLE1, 0xb0), 62194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP1_MODE0, 0x8c), 62294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP2_MODE0, 0x20), 62394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP1_MODE1, 0x14), 62494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP2_MODE1, 0x34), 62594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CP_CTRL_MODE0, 0x06), 62694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CP_CTRL_MODE1, 0x06), 62794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_RCTRL_MODE0, 0x16), 62894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_RCTRL_MODE1, 0x16), 62994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_CCTRL_MODE0, 0x36), 63094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_CCTRL_MODE1, 0x36), 63194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_RESTRIM_CTRL2, 0x05), 63294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP_EN, 0x42), 63394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DEC_START_MODE0, 0x82), 63494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DEC_START_MODE1, 0x68), 63594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START1_MODE0, 0x55), 63694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START2_MODE0, 0x55), 63794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START3_MODE0, 0x03), 63894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START1_MODE1, 0xab), 63994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START2_MODE1, 0xaa), 64094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START3_MODE1, 0x02), 64194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_INTEGLOOP_GAIN0_MODE0, 0x3f), 64294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_INTEGLOOP_GAIN0_MODE1, 0x3f), 64394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_VCO_TUNE_MAP, 0x10), 64494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CLK_SELECT, 0x04), 64594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_HSCLK_SEL1, 0x30), 64694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CORECLK_DIV, 0x04), 64794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CORE_CLK_EN, 0x73), 64894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CMN_CONFIG, 0x0c), 64994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SVS_MODE_CLK_SEL, 0x15), 65094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CORECLK_DIV_MODE1, 0x04), 65194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CMN_MODE, 0x01), 65294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_VREGCLK_DIV1, 0x22), 65394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_VREGCLK_DIV2, 0x00), 65494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_BGV_TRIM, 0x20), 65594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_BG_CTRL, 0x07), 65694a407ccSDmitry Baryshkov }; 65794a407ccSDmitry Baryshkov 65894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_tx_tbl[] = { 65994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_CTRL0, 0x00), 66094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_TAP_EN, 0x0d), 66194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_TX_BAND_MODE, 0x01), 66294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_LANE_MODE, 0x1a), 66394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PARALLEL_RATE, 0x2f), 66494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CML_CTRL_MODE0, 0x09), 66594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CML_CTRL_MODE1, 0x09), 66694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CML_CTRL_MODE2, 0x1b), 66794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PREAMP_CTRL_MODE1, 0x01), 66894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PREAMP_CTRL_MODE2, 0x07), 66994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_MIXER_CTRL_MODE0, 0x31), 67094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_MIXER_CTRL_MODE1, 0x31), 67194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_MIXER_CTRL_MODE2, 0x03), 67294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CTLE_THRESH_DFE, 0x02), 67394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CGA_THRESH_DFE, 0x00), 67494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXENGINE_EN0, 0x12), 67594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CTLE_TRAIN_TIME, 0x25), 67694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CTLE_DFE_OVRLP_TIME, 0x00), 67794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DFE_REFRESH_TIME, 0x05), 67894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DFE_ENABLE_TIME, 0x01), 67994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_VGA_GAIN, 0x26), 68094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DFE_GAIN, 0x12), 68194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_EQ_GAIN, 0x04), 68294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_OFFSET_GAIN, 0x04), 68394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PRE_GAIN, 0x09), 68494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_EQ_INTVAL, 0x15), 68594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_EDAC_INITVAL, 0x28), 68694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXEQ_INITB0, 0x7f), 68794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXEQ_INITB1, 0x07), 68894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RCVRDONE_THRESH1, 0x04), 68994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXEQ_CTRL, 0x70), 69094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_FO_GAIN_MODE0, 0x8b), 69194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_FO_GAIN_MODE1, 0x08), 69294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_FO_GAIN_MODE2, 0x0a), 69394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_GAIN_MODE0, 0x03), 69494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_GAIN_MODE1, 0x04), 69594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_GAIN_MODE2, 0x04), 69694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_CONFIG, 0x0c), 69794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_BAND, 0x02), 69894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RCVR_PATH1_MODE0, 0x5c), 69994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RCVR_PATH1_MODE1, 0x3e), 70094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RCVR_PATH1_MODE2, 0x3f), 70194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_SIGDET_ENABLES, 0x01), 70294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_SIGDET_CNTRL, 0xa0), 70394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_SIGDET_DEGLITCH_CNTRL, 0x08), 70494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DCC_GAIN, 0x01), 70594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_EN_SIGNAL, 0xc3), 70694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PSM_RX_EN_CAL, 0x00), 70794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_MISC_CNTRL0, 0xbc), 70894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_TS0_TIMER, 0x7f), 70994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DLL_HIGHDATARATE, 0x15), 71094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_CTRL1, 0x0c), 71194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_CTRL2, 0x0f), 71294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RESETCODE_OFFSET, 0x04), 71394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_VGA_INITVAL, 0x20), 71494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RSM_START, 0x01), 71594a407ccSDmitry Baryshkov }; 71694a407ccSDmitry Baryshkov 71794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_rx_tbl[] = { 71894a407ccSDmitry Baryshkov }; 71994a407ccSDmitry Baryshkov 72094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_pcs_tbl[] = { 72194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_POWER_STATE_CONFIG, 0x3f), 72294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_PCS_TX_RX_CONFIG, 0x50), 72394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_MAIN_V0_M3P5DB, 0x19), 72494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_POST_V0_M3P5DB, 0x07), 72594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_MAIN_V0_M6DB, 0x17), 72694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_POST_V0_M6DB, 0x09), 72794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_POWER_STATE_CONFIG5, 0x9f), 72894a407ccSDmitry Baryshkov }; 72994a407ccSDmitry Baryshkov 73094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_serdes_tbl[] = { 73194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x08), 73294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_SELECT, 0x34), 73394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08), 73494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f), 73594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x42), 73694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24), 73794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x03), 73894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0xb4), 73994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 74094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 74194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82), 74294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x03), 74394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0x55), 74494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0x55), 74594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x1a), 74694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x0a), 74794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x68), 74894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02), 74994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xaa), 75094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab), 75194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x34), 75294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x14), 75394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01), 75494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06), 75594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16), 75694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36), 75794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06), 75894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16), 75994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36), 76094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 76194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 76294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18), 76394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2), 76494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x07), 76594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01), 76694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31), 76794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01), 76894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde), 76994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07), 77094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0x4c), 77194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x06), 77294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_ENABLE1, 0x90), 77394a407ccSDmitry Baryshkov }; 77494a407ccSDmitry Baryshkov 77594a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_tx_tbl[] = { 77694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 77794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x5), 77894a407ccSDmitry Baryshkov }; 77994a407ccSDmitry Baryshkov 78094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_rx_tbl[] = { 78194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03), 78294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c), 78394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 78494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x07), 78594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x6e), 78694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x6e), 78794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x4a), 78894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 78994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 79094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70), 79194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17), 79294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54), 79394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x37), 79494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xd4), 79594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x54), 79694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xdb), 79794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x39), 79894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0x31), 79994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x24), 80094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xe4), 80194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xec), 80294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x39), 80394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x36), 80494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x7f), 80594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff), 80694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff), 80794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0xdb), 80894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x75), 80994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 81094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 81194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0), 81294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RCLK_AUXDATA_SEL, 0xc0), 81394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 81494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x05), 81594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c), 81694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x03), 81794a407ccSDmitry Baryshkov }; 81894a407ccSDmitry Baryshkov 81994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_pcs_tbl[] = { 82094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 82194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa), 82294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RATE_SLEW_CNTRL1, 0x0b), 82394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d), 82494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x01), 82594a407ccSDmitry Baryshkov }; 82694a407ccSDmitry Baryshkov 82794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_pcs_misc_tbl[] = { 82894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 82994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 83094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 83194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00), 83294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00), 83394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58), 83494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 83594a407ccSDmitry Baryshkov }; 83694a407ccSDmitry Baryshkov 83794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_serdes_tbl[] = { 83894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x08), 83994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_SELECT, 0x34), 84094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08), 84194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f), 84294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x42), 84394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24), 84494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x03), 84594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0xb4), 84694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 84794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 84894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82), 84994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x03), 85094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0x55), 85194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0x55), 85294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x1a), 85394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x0a), 85494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x68), 85594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02), 85694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xaa), 85794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab), 85894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x34), 85994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x14), 86094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01), 86194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06), 86294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16), 86394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36), 86494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06), 86594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16), 86694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36), 86794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 86894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 86994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18), 87094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2), 87194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01), 87294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31), 87394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01), 87494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde), 87594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07), 87694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0x4c), 87794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x06), 87894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_ENABLE1, 0x90), 87994a407ccSDmitry Baryshkov }; 88094a407ccSDmitry Baryshkov 88194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_serdes_tbl[] = { 88294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x07), 88394a407ccSDmitry Baryshkov }; 88494a407ccSDmitry Baryshkov 88594a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_tx_tbl[] = { 88694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12), 88794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x35), 88894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x11), 88994a407ccSDmitry Baryshkov }; 89094a407ccSDmitry Baryshkov 89194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_rx_tbl[] = { 89294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c), 89394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x03), 89494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1b), 89594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00), 89694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0), 89794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0x30), 89894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x04), 89994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x07), 90094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f), 90194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70), 90294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0e), 90394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a), 90494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0f), 90594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03), 90694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c), 90794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x1e), 90894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17), 90994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xd4), 91094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x54), 91194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xdb), 91294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x3b), 91394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0x31), 91494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x24), 91594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff), 91694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f), 91794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c), 91894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xe4), 91994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xec), 92094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x3b), 92194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x36), 92294a407ccSDmitry Baryshkov }; 92394a407ccSDmitry Baryshkov 92494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_rx_tbl[] = { 92594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RCLK_AUXDATA_SEL, 0x00), 92694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x00), 92794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04), 92894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x3f), 92994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x14), 93094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x30), 93194a407ccSDmitry Baryshkov }; 93294a407ccSDmitry Baryshkov 93394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_pcs_tbl[] = { 93494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 93594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0x77), 93694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_RATE_SLEW_CNTRL1, 0x0b), 93794a407ccSDmitry Baryshkov }; 93894a407ccSDmitry Baryshkov 93994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_pcs_tbl[] = { 94094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d), 94194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x12), 94294a407ccSDmitry Baryshkov }; 94394a407ccSDmitry Baryshkov 94494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_pcs_misc_tbl[] = { 94594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 94694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 94794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), 94894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P6_P7_PRE, 0x33), 94994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00), 95094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58), 95194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 95294a407ccSDmitry Baryshkov }; 95394a407ccSDmitry Baryshkov 95494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_pcs_misc_tbl[] = { 95594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00), 95694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG2, 0x0f), 95794a407ccSDmitry Baryshkov }; 95894a407ccSDmitry Baryshkov 95994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_tx_tbl[] = { 96094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_TX_PI_QEC_CTRL, 0x20), 96194a407ccSDmitry Baryshkov }; 96294a407ccSDmitry Baryshkov 96394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_rx_tbl[] = { 96494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x04), 96594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xbf), 96694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x15), 96794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 96894a407ccSDmitry Baryshkov }; 96994a407ccSDmitry Baryshkov 97094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_pcs_tbl[] = { 97194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x05), 97294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG2, 0x0f), 97394a407ccSDmitry Baryshkov }; 97494a407ccSDmitry Baryshkov 97594a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_pcs_misc_tbl[] = { 97694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG2, 0x0d), 97794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07), 97894a407ccSDmitry Baryshkov }; 97994a407ccSDmitry Baryshkov 98094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_serdes_tbl[] = { 98194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BG_TIMER, 0x02), 98294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN, 0x18), 98394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYS_CLK_CTRL, 0x07), 98494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f), 98594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x0a), 98694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x0a), 98794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x19), 98894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x19), 98994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x03), 99094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x03), 99194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x00), 99294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x46), 99394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_CFG, 0x04), 99494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x7f), 99594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x02), 99694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0xff), 99794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x04), 99894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x4b), 99994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x50), 100094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x00), 100194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN0_MODE0, 0xfb), 100294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN1_MODE0, 0x01), 100394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN0_MODE1, 0xfb), 100494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN1_MODE1, 0x01), 100594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02), 100694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x12), 100794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_HS_SWITCH_SEL, 0x00), 100894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE0, 0x05), 100994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x04), 101094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_CONFIG, 0x04), 101194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_MISC1, 0x88), 10121195c1daSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_MISC2, 0x03), 101394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_MODE, 0x17), 101494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_DC_LEVEL_CTRL, 0x0b), 101594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0x56), 101694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1d), 101794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0x4b), 101894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x1f), 101994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x22), 102094a407ccSDmitry Baryshkov }; 102194a407ccSDmitry Baryshkov 102294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_tx_tbl[] = { 102394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_LANE_MODE_1, 0x05), 102494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_LANE_MODE_2, 0xf6), 102594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_LANE_MODE_3, 0x13), 102694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_VMODE_CTRL1, 0x00), 102794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_PI_QEC_CTRL, 0x00), 102894a407ccSDmitry Baryshkov }; 102994a407ccSDmitry Baryshkov 103094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_rx_tbl[] = { 103194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_FO_GAIN_RATE2, 0x0c), 103294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_UCDR_PI_CONTROLS, 0x16), 103394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_AUX_DATA_TCOARSE_TFINE, 0x7f), 103494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_3, 0x55), 103594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_DAC_ENABLE1, 0x0c), 103694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_DAC_ENABLE2, 0x00), 103794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_VGA_CAL_CNTRL2, 0x08), 103894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x27), 103994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B1, 0x1a), 104094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B2, 0x5a), 104194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B3, 0x09), 104294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B4, 0x37), 104394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B0, 0xbd), 104494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B1, 0xf9), 104594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B2, 0xbf), 104694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B3, 0xce), 104794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B4, 0x62), 104894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B0, 0xbf), 104994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B1, 0x7d), 105094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B2, 0xbf), 105194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B3, 0xcf), 105294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B4, 0xd6), 105394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_PHPRE_CTRL, 0xa0), 105494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 105594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_MARG_COARSE_CTRL2, 0x12), 105694a407ccSDmitry Baryshkov }; 105794a407ccSDmitry Baryshkov 105894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_pcs_tbl[] = { 105994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_RX_SIGDET_LVL, 0x77), 106094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_EQ_CONFIG2, 0x01), 106194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_EQ_CONFIG4, 0x16), 106294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_EQ_CONFIG5, 0x02), 106394a407ccSDmitry Baryshkov }; 106494a407ccSDmitry Baryshkov 106594a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_pcs_misc_tbl[] = { 106694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_EQ_CONFIG1, 0x17), 106794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G3_RXEQEVAL_TIME, 0x13), 106894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G4_RXEQEVAL_TIME, 0x13), 106994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG2, 0x01), 107094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02), 107194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00), 107294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00), 107394a407ccSDmitry Baryshkov }; 107494a407ccSDmitry Baryshkov 107594a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_serdes_tbl[] = { 107694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08), 107794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34), 107894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x08), 107994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f), 108094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x42), 108194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE1_MODE0, 0x24), 108294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE2_MODE1, 0x03), 108394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE1_MODE1, 0xb4), 108494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02), 108594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_HSCLK_SEL, 0x11), 108694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82), 108794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03), 108894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55), 108994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55), 109094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a), 109194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a), 109294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x68), 109394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x02), 109494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0xaa), 109594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0xab), 109694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34), 109794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14), 109894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x01), 109994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06), 110094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16), 110194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36), 110294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06), 110394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16), 110494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36), 110594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 110694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca), 110794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18), 110894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2), 110994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_BUF_ENABLE, 0x07), 111094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_EN_CENTER, 0x01), 111194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31), 111294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01), 111394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde), 111494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07), 111594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x4c), 111694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x06), 111794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90), 111894a407ccSDmitry Baryshkov }; 111994a407ccSDmitry Baryshkov 112094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_tx_tbl[] = { 112194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_TX_PI_QEC_CTRL, 0x20), 112294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0x75), 112394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x3f), 112494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x16), 112594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x04), 112694a407ccSDmitry Baryshkov }; 112794a407ccSDmitry Baryshkov 112894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_rx_tbl[] = { 112994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_LOW, 0x7f), 113094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH, 0xff), 113194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0xbf), 113294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3f), 113394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH4, 0xd8), 113494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_LOW, 0xdc), 113594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH, 0xdc), 113694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH2, 0x5c), 113794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH3, 0x34), 113894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH4, 0xa6), 113994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_10_HIGH3, 0x34), 114094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_10_HIGH4, 0x38), 114194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x07), 114294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00), 114394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH1, 0x08), 114494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH2, 0x08), 114594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0xf0), 114694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 114794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_TX_ADAPT_POST_THRESH, 0xf0), 114894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL4, 0x07), 114994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FO_GAIN, 0x09), 115094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_GAIN, 0x05), 115194a407ccSDmitry Baryshkov }; 115294a407ccSDmitry Baryshkov 115394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_pcs_tbl[] = { 115494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0x77), 115594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_RATE_SLEW_CNTRL1, 0x0b), 115694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x05), 115794a407ccSDmitry Baryshkov }; 115894a407ccSDmitry Baryshkov 115994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_pcs_misc_tbl[] = { 116094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 116194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00), 116294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_EQ_CONFIG2, 0x0f), 116394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 116494a407ccSDmitry Baryshkov }; 116594a407ccSDmitry Baryshkov 116694a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_serdes_tbl[] = { 1167f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x14), 1168f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f), 1169f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x46), 1170f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_CFG, 0x04), 1171f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02), 1172f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x12), 1173f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_HS_SWITCH_SEL, 0x00), 1174f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE0, 0x0a), 1175f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x04), 1176f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MISC1, 0x88), 1177f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_CONFIG, 0x06), 1178f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE, 0x14), 1179f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_DC_LEVEL_CTRL, 0x0f), 1180f5682f13SDmitry Baryshkov }; 1181f5682f13SDmitry Baryshkov 1182f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_rc_serdes_tbl[] = { 118394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31), 118494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01), 118594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde), 118694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07), 118794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x97), 118894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x0c), 118994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90), 119094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06), 119194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06), 119294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16), 119394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16), 119494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36), 119594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36), 119694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08), 119794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a), 119894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a), 119994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14), 120094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34), 120194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82), 120294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0xd0), 120394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55), 120494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55), 120594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03), 120694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0x55), 120794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0x55), 120894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x05), 120994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34), 121094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x20), 121194a407ccSDmitry Baryshkov }; 121294a407ccSDmitry Baryshkov 121394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_tx_tbl[] = { 121494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_1, 0x05), 121594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_2, 0xf6), 121694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_TX, 0x1a), 121794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_RX, 0x0c), 121894a407ccSDmitry Baryshkov }; 121994a407ccSDmitry Baryshkov 122094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_rx_tbl[] = { 122194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_PI_CONTROLS, 0x16), 122294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38), 122394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B1, 0xcc), 122494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B2, 0x12), 122594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B3, 0xcc), 122694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B5, 0x4a), 122794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B6, 0x29), 122894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B0, 0xc5), 122994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B1, 0xad), 123094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B2, 0xb6), 123194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B3, 0xc0), 123294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B4, 0x1f), 123394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B5, 0xfb), 123494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B6, 0x0f), 123594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B0, 0xc7), 123694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B1, 0xef), 123794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B2, 0xbf), 123894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B3, 0xa0), 123994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B4, 0x81), 124094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B5, 0xde), 124194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B6, 0x7f), 124294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_PHPRE_CTRL, 0x20), 124394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_0_1, 0x3f), 124494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_2_3, 0x37), 124594a407ccSDmitry Baryshkov 124694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_3, 0x05), 124794a407ccSDmitry Baryshkov 124894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE3, 0x1f), 124994a407ccSDmitry Baryshkov 125094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE3, 0x1f), 125194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE3, 0x1f), 125294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH4_RATE3, 0x1f), 125394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH5_RATE3, 0x1f), 125494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH6_RATE3, 0x1f), 125594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE210, 0x1f), 125694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE210, 0x1f), 125794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE210, 0x1f), 125894a407ccSDmitry Baryshkov 125994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE2, 0x0c), 126094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE3, 0x0a), 126194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_MAN_VAL, 0x0a), 126294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0b), 126394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_IDAC_SAOFFSET, 0x10), 126494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_DAC_ENABLE1, 0x00), 126594a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_GM_CAL, 0x0f), 126694a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH1, 0x00), 126794a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH2, 0x1f), 126894a407ccSDmitry Baryshkov }; 126994a407ccSDmitry Baryshkov 127094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_pcs_tbl[] = { 127194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_EQ_CONFIG2, 0x16), 127294a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_EQ_CONFIG3, 0x22), 127394a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_G3S2_PRE_GAIN, 0x2e), 127494a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0x99), 127594a407ccSDmitry Baryshkov }; 127694a407ccSDmitry Baryshkov 127794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_pcs_misc_tbl[] = { 127894a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02), 127994a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_EQ_CONFIG1, 0x16), 128094a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_RX_MARGINING_CONFIG3, 0x28), 128194a407ccSDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e), 128294a407ccSDmitry Baryshkov }; 128394a407ccSDmitry Baryshkov 1284f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_rc_pcs_misc_tbl[] = { 1285f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 1286f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 1287f5682f13SDmitry Baryshkov }; 1288f5682f13SDmitry Baryshkov 1289f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_ep_serdes_tbl[] = { 1290f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_BG_TIMER, 0x02), 1291f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYS_CLK_CTRL, 0x07), 1292f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x27), 1293f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x0a), 1294f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x17), 1295f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x19), 1296f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x00), 1297f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x03), 1298f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x00), 1299f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0xff), 1300f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x04), 1301f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0xff), 1302f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x09), 1303f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x19), 1304f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x28), 1305f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE0, 0xfb), 1306f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE0, 0x01), 1307f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE1, 0xfb), 1308f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE1, 0x01), 1309f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x60), 1310f5682f13SDmitry Baryshkov }; 1311f5682f13SDmitry Baryshkov 1312f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl[] = { 1313f5682f13SDmitry Baryshkov QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5, 0x08), 1314f5682f13SDmitry Baryshkov }; 1315f5682f13SDmitry Baryshkov 13162566ad8eSDmitry Baryshkov struct qmp_phy_cfg_tables { 13172566ad8eSDmitry Baryshkov const struct qmp_phy_init_tbl *serdes; 13182566ad8eSDmitry Baryshkov int serdes_num; 13192566ad8eSDmitry Baryshkov const struct qmp_phy_init_tbl *tx; 13202566ad8eSDmitry Baryshkov int tx_num; 13212566ad8eSDmitry Baryshkov const struct qmp_phy_init_tbl *rx; 13222566ad8eSDmitry Baryshkov int rx_num; 13232566ad8eSDmitry Baryshkov const struct qmp_phy_init_tbl *pcs; 13242566ad8eSDmitry Baryshkov int pcs_num; 13252566ad8eSDmitry Baryshkov const struct qmp_phy_init_tbl *pcs_misc; 13262566ad8eSDmitry Baryshkov int pcs_misc_num; 13272566ad8eSDmitry Baryshkov }; 13282566ad8eSDmitry Baryshkov 132994a407ccSDmitry Baryshkov /* struct qmp_phy_cfg - per-PHY initialization config */ 133094a407ccSDmitry Baryshkov struct qmp_phy_cfg { 1331f02543faSJohan Hovold int lanes; 133294a407ccSDmitry Baryshkov 13332566ad8eSDmitry Baryshkov /* Main init sequence for PHY blocks - serdes, tx, rx, pcs */ 13342566ad8eSDmitry Baryshkov const struct qmp_phy_cfg_tables tables; 13352566ad8eSDmitry Baryshkov /* 133611bf53a3SDmitry Baryshkov * Additional init sequences for PHY blocks, providing additional 133711bf53a3SDmitry Baryshkov * register programming. They are used for providing separate sequences 133811bf53a3SDmitry Baryshkov * for the Root Complex and End Point use cases. 133911bf53a3SDmitry Baryshkov * 134011bf53a3SDmitry Baryshkov * If EP mode is not supported, both tables can be left unset. 13412566ad8eSDmitry Baryshkov */ 13422566ad8eSDmitry Baryshkov const struct qmp_phy_cfg_tables *tables_rc; 134311bf53a3SDmitry Baryshkov const struct qmp_phy_cfg_tables *tables_ep; 134494a407ccSDmitry Baryshkov 134594a407ccSDmitry Baryshkov /* clock ids to be requested */ 134694a407ccSDmitry Baryshkov const char * const *clk_list; 134794a407ccSDmitry Baryshkov int num_clks; 134894a407ccSDmitry Baryshkov /* resets to be requested */ 134994a407ccSDmitry Baryshkov const char * const *reset_list; 135094a407ccSDmitry Baryshkov int num_resets; 135194a407ccSDmitry Baryshkov /* regulators to be requested */ 135294a407ccSDmitry Baryshkov const char * const *vreg_list; 135394a407ccSDmitry Baryshkov int num_vregs; 135494a407ccSDmitry Baryshkov 135594a407ccSDmitry Baryshkov /* array of registers with different offsets */ 135694a407ccSDmitry Baryshkov const unsigned int *regs; 135794a407ccSDmitry Baryshkov 135894a407ccSDmitry Baryshkov unsigned int pwrdn_ctrl; 135994a407ccSDmitry Baryshkov /* bit offset of PHYSTATUS in QPHY_PCS_STATUS register */ 136094a407ccSDmitry Baryshkov unsigned int phy_status; 136194a407ccSDmitry Baryshkov 136251bd3306SJohan Hovold bool skip_start_delay; 136394a407ccSDmitry Baryshkov 13642ec9bc8dSRobert Marko /* QMP PHY pipe clock interface rate */ 13652ec9bc8dSRobert Marko unsigned long pipe_clock_rate; 136694a407ccSDmitry Baryshkov }; 136794a407ccSDmitry Baryshkov 136894a407ccSDmitry Baryshkov /** 136994a407ccSDmitry Baryshkov * struct qmp_phy - per-lane phy descriptor 137094a407ccSDmitry Baryshkov * 137194a407ccSDmitry Baryshkov * @phy: generic phy 137294a407ccSDmitry Baryshkov * @cfg: phy specific configuration 137394a407ccSDmitry Baryshkov * @serdes: iomapped memory space for phy's serdes (i.e. PLL) 137494a407ccSDmitry Baryshkov * @tx: iomapped memory space for lane's tx 137594a407ccSDmitry Baryshkov * @rx: iomapped memory space for lane's rx 137694a407ccSDmitry Baryshkov * @pcs: iomapped memory space for lane's pcs 137794a407ccSDmitry Baryshkov * @tx2: iomapped memory space for second lane's tx (in dual lane PHYs) 137894a407ccSDmitry Baryshkov * @rx2: iomapped memory space for second lane's rx (in dual lane PHYs) 137994a407ccSDmitry Baryshkov * @pcs_misc: iomapped memory space for lane's pcs_misc 138094a407ccSDmitry Baryshkov * @pipe_clk: pipe clock 138194a407ccSDmitry Baryshkov * @qmp: QMP phy to which this lane belongs 138211bf53a3SDmitry Baryshkov * @mode: currently selected PHY mode 138394a407ccSDmitry Baryshkov */ 138494a407ccSDmitry Baryshkov struct qmp_phy { 138594a407ccSDmitry Baryshkov struct phy *phy; 138694a407ccSDmitry Baryshkov const struct qmp_phy_cfg *cfg; 138794a407ccSDmitry Baryshkov void __iomem *serdes; 138894a407ccSDmitry Baryshkov void __iomem *tx; 138994a407ccSDmitry Baryshkov void __iomem *rx; 139094a407ccSDmitry Baryshkov void __iomem *pcs; 139194a407ccSDmitry Baryshkov void __iomem *tx2; 139294a407ccSDmitry Baryshkov void __iomem *rx2; 139394a407ccSDmitry Baryshkov void __iomem *pcs_misc; 139494a407ccSDmitry Baryshkov struct clk *pipe_clk; 139594a407ccSDmitry Baryshkov struct qcom_qmp *qmp; 139611bf53a3SDmitry Baryshkov int mode; 139794a407ccSDmitry Baryshkov }; 139894a407ccSDmitry Baryshkov 139994a407ccSDmitry Baryshkov /** 140094a407ccSDmitry Baryshkov * struct qcom_qmp - structure holding QMP phy block attributes 140194a407ccSDmitry Baryshkov * 140294a407ccSDmitry Baryshkov * @dev: device 140394a407ccSDmitry Baryshkov * 140494a407ccSDmitry Baryshkov * @clks: array of clocks required by phy 140594a407ccSDmitry Baryshkov * @resets: array of resets required by phy 140694a407ccSDmitry Baryshkov * @vregs: regulator supplies bulk data 140794a407ccSDmitry Baryshkov * 140894a407ccSDmitry Baryshkov * @phys: array of per-lane phy descriptors 140994a407ccSDmitry Baryshkov */ 141094a407ccSDmitry Baryshkov struct qcom_qmp { 141194a407ccSDmitry Baryshkov struct device *dev; 141294a407ccSDmitry Baryshkov 141394a407ccSDmitry Baryshkov struct clk_bulk_data *clks; 1414189ac6b8SDmitry Baryshkov struct reset_control_bulk_data *resets; 141594a407ccSDmitry Baryshkov struct regulator_bulk_data *vregs; 141694a407ccSDmitry Baryshkov 141794a407ccSDmitry Baryshkov struct qmp_phy **phys; 141894a407ccSDmitry Baryshkov }; 141994a407ccSDmitry Baryshkov 142094a407ccSDmitry Baryshkov static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val) 142194a407ccSDmitry Baryshkov { 142294a407ccSDmitry Baryshkov u32 reg; 142394a407ccSDmitry Baryshkov 142494a407ccSDmitry Baryshkov reg = readl(base + offset); 142594a407ccSDmitry Baryshkov reg |= val; 142694a407ccSDmitry Baryshkov writel(reg, base + offset); 142794a407ccSDmitry Baryshkov 142894a407ccSDmitry Baryshkov /* ensure that above write is through */ 142994a407ccSDmitry Baryshkov readl(base + offset); 143094a407ccSDmitry Baryshkov } 143194a407ccSDmitry Baryshkov 143294a407ccSDmitry Baryshkov static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val) 143394a407ccSDmitry Baryshkov { 143494a407ccSDmitry Baryshkov u32 reg; 143594a407ccSDmitry Baryshkov 143694a407ccSDmitry Baryshkov reg = readl(base + offset); 143794a407ccSDmitry Baryshkov reg &= ~val; 143894a407ccSDmitry Baryshkov writel(reg, base + offset); 143994a407ccSDmitry Baryshkov 144094a407ccSDmitry Baryshkov /* ensure that above write is through */ 144194a407ccSDmitry Baryshkov readl(base + offset); 144294a407ccSDmitry Baryshkov } 144394a407ccSDmitry Baryshkov 144494a407ccSDmitry Baryshkov /* list of clocks required by phy */ 14455b76f5ecSJohan Hovold static const char * const ipq8074_pciephy_clk_l[] = { 14465b76f5ecSJohan Hovold "aux", "cfg_ahb", 14475b76f5ecSJohan Hovold }; 14485b76f5ecSJohan Hovold 144994a407ccSDmitry Baryshkov static const char * const msm8996_phy_clk_l[] = { 145094a407ccSDmitry Baryshkov "aux", "cfg_ahb", "ref", 145194a407ccSDmitry Baryshkov }; 145294a407ccSDmitry Baryshkov 145394a407ccSDmitry Baryshkov 145494a407ccSDmitry Baryshkov static const char * const sdm845_pciephy_clk_l[] = { 145594a407ccSDmitry Baryshkov "aux", "cfg_ahb", "ref", "refgen", 145694a407ccSDmitry Baryshkov }; 145794a407ccSDmitry Baryshkov 145894a407ccSDmitry Baryshkov /* list of regulators */ 145994a407ccSDmitry Baryshkov static const char * const qmp_phy_vreg_l[] = { 146094a407ccSDmitry Baryshkov "vdda-phy", "vdda-pll", 146194a407ccSDmitry Baryshkov }; 146294a407ccSDmitry Baryshkov 146394a407ccSDmitry Baryshkov /* list of resets */ 146494a407ccSDmitry Baryshkov static const char * const ipq8074_pciephy_reset_l[] = { 146594a407ccSDmitry Baryshkov "phy", "common", 146694a407ccSDmitry Baryshkov }; 146794a407ccSDmitry Baryshkov 1468b35a5311SDmitry Baryshkov static const char * const sdm845_pciephy_reset_l[] = { 1469b35a5311SDmitry Baryshkov "phy", 1470b35a5311SDmitry Baryshkov }; 1471b35a5311SDmitry Baryshkov 147294a407ccSDmitry Baryshkov static const struct qmp_phy_cfg ipq8074_pciephy_cfg = { 1473f02543faSJohan Hovold .lanes = 1, 147494a407ccSDmitry Baryshkov 14752566ad8eSDmitry Baryshkov .tables = { 14762566ad8eSDmitry Baryshkov .serdes = ipq8074_pcie_serdes_tbl, 14772566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(ipq8074_pcie_serdes_tbl), 14782566ad8eSDmitry Baryshkov .tx = ipq8074_pcie_tx_tbl, 14792566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(ipq8074_pcie_tx_tbl), 14802566ad8eSDmitry Baryshkov .rx = ipq8074_pcie_rx_tbl, 14812566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl), 14822566ad8eSDmitry Baryshkov .pcs = ipq8074_pcie_pcs_tbl, 14832566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl), 14842566ad8eSDmitry Baryshkov }, 148594a407ccSDmitry Baryshkov .clk_list = ipq8074_pciephy_clk_l, 148694a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l), 148794a407ccSDmitry Baryshkov .reset_list = ipq8074_pciephy_reset_l, 148894a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), 148994a407ccSDmitry Baryshkov .vreg_list = NULL, 149094a407ccSDmitry Baryshkov .num_vregs = 0, 149194a407ccSDmitry Baryshkov .regs = pciephy_regs_layout, 149294a407ccSDmitry Baryshkov 149394a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 149494a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 149594a407ccSDmitry Baryshkov }; 149694a407ccSDmitry Baryshkov 1497334fad18SRobert Marko static const struct qmp_phy_cfg ipq8074_pciephy_gen3_cfg = { 1498f02543faSJohan Hovold .lanes = 1, 1499334fad18SRobert Marko 15002566ad8eSDmitry Baryshkov .tables = { 15012566ad8eSDmitry Baryshkov .serdes = ipq8074_pcie_gen3_serdes_tbl, 15022566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(ipq8074_pcie_gen3_serdes_tbl), 15032566ad8eSDmitry Baryshkov .tx = ipq8074_pcie_gen3_tx_tbl, 15042566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(ipq8074_pcie_gen3_tx_tbl), 15052566ad8eSDmitry Baryshkov .rx = ipq8074_pcie_gen3_rx_tbl, 15062566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(ipq8074_pcie_gen3_rx_tbl), 15072566ad8eSDmitry Baryshkov .pcs = ipq8074_pcie_gen3_pcs_tbl, 15082566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(ipq8074_pcie_gen3_pcs_tbl), 15092566ad8eSDmitry Baryshkov }, 1510334fad18SRobert Marko .clk_list = ipq8074_pciephy_clk_l, 1511334fad18SRobert Marko .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l), 1512334fad18SRobert Marko .reset_list = ipq8074_pciephy_reset_l, 1513334fad18SRobert Marko .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), 1514334fad18SRobert Marko .vreg_list = NULL, 1515334fad18SRobert Marko .num_vregs = 0, 1516334fad18SRobert Marko .regs = ipq_pciephy_gen3_regs_layout, 1517334fad18SRobert Marko 1518334fad18SRobert Marko .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 151994b7288eSJohan Hovold .phy_status = PHYSTATUS, 1520334fad18SRobert Marko 1521334fad18SRobert Marko .pipe_clock_rate = 250000000, 1522334fad18SRobert Marko }; 1523334fad18SRobert Marko 152494a407ccSDmitry Baryshkov static const struct qmp_phy_cfg ipq6018_pciephy_cfg = { 1525f02543faSJohan Hovold .lanes = 1, 152694a407ccSDmitry Baryshkov 15272566ad8eSDmitry Baryshkov .tables = { 15282566ad8eSDmitry Baryshkov .serdes = ipq6018_pcie_serdes_tbl, 15292566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(ipq6018_pcie_serdes_tbl), 15302566ad8eSDmitry Baryshkov .tx = ipq6018_pcie_tx_tbl, 15312566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(ipq6018_pcie_tx_tbl), 15322566ad8eSDmitry Baryshkov .rx = ipq6018_pcie_rx_tbl, 15332566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(ipq6018_pcie_rx_tbl), 15342566ad8eSDmitry Baryshkov .pcs = ipq6018_pcie_pcs_tbl, 15352566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(ipq6018_pcie_pcs_tbl), 15362566ad8eSDmitry Baryshkov .pcs_misc = ipq6018_pcie_pcs_misc_tbl, 15372566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(ipq6018_pcie_pcs_misc_tbl), 15382566ad8eSDmitry Baryshkov }, 153994a407ccSDmitry Baryshkov .clk_list = ipq8074_pciephy_clk_l, 154094a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l), 154194a407ccSDmitry Baryshkov .reset_list = ipq8074_pciephy_reset_l, 154294a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), 154394a407ccSDmitry Baryshkov .vreg_list = NULL, 154494a407ccSDmitry Baryshkov .num_vregs = 0, 154594a407ccSDmitry Baryshkov .regs = ipq_pciephy_gen3_regs_layout, 154694a407ccSDmitry Baryshkov 154794a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 154830518b19SJohan Hovold .phy_status = PHYSTATUS, 154994a407ccSDmitry Baryshkov }; 155094a407ccSDmitry Baryshkov 155194a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sdm845_qmp_pciephy_cfg = { 1552f02543faSJohan Hovold .lanes = 1, 155394a407ccSDmitry Baryshkov 15542566ad8eSDmitry Baryshkov .tables = { 15552566ad8eSDmitry Baryshkov .serdes = sdm845_qmp_pcie_serdes_tbl, 15562566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sdm845_qmp_pcie_serdes_tbl), 15572566ad8eSDmitry Baryshkov .tx = sdm845_qmp_pcie_tx_tbl, 15582566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sdm845_qmp_pcie_tx_tbl), 15592566ad8eSDmitry Baryshkov .rx = sdm845_qmp_pcie_rx_tbl, 15602566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sdm845_qmp_pcie_rx_tbl), 15612566ad8eSDmitry Baryshkov .pcs = sdm845_qmp_pcie_pcs_tbl, 15622566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sdm845_qmp_pcie_pcs_tbl), 15632566ad8eSDmitry Baryshkov .pcs_misc = sdm845_qmp_pcie_pcs_misc_tbl, 15642566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sdm845_qmp_pcie_pcs_misc_tbl), 15652566ad8eSDmitry Baryshkov }, 156694a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 156794a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 156894a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 156994a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 157094a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 157194a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 157294a407ccSDmitry Baryshkov .regs = sdm845_qmp_pciephy_regs_layout, 157394a407ccSDmitry Baryshkov 157494a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 157594a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 157694a407ccSDmitry Baryshkov }; 157794a407ccSDmitry Baryshkov 157894a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sdm845_qhp_pciephy_cfg = { 1579f02543faSJohan Hovold .lanes = 1, 158094a407ccSDmitry Baryshkov 15812566ad8eSDmitry Baryshkov .tables = { 15822566ad8eSDmitry Baryshkov .serdes = sdm845_qhp_pcie_serdes_tbl, 15832566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sdm845_qhp_pcie_serdes_tbl), 15842566ad8eSDmitry Baryshkov .tx = sdm845_qhp_pcie_tx_tbl, 15852566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sdm845_qhp_pcie_tx_tbl), 15862566ad8eSDmitry Baryshkov .rx = sdm845_qhp_pcie_rx_tbl, 15872566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sdm845_qhp_pcie_rx_tbl), 15882566ad8eSDmitry Baryshkov .pcs = sdm845_qhp_pcie_pcs_tbl, 15892566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sdm845_qhp_pcie_pcs_tbl), 15902566ad8eSDmitry Baryshkov }, 159194a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 159294a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 159394a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 159494a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 159594a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 159694a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 159794a407ccSDmitry Baryshkov .regs = sdm845_qhp_pciephy_regs_layout, 159894a407ccSDmitry Baryshkov 159994a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 160094a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 160194a407ccSDmitry Baryshkov }; 160294a407ccSDmitry Baryshkov 160394a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8250_qmp_gen3x1_pciephy_cfg = { 1604f02543faSJohan Hovold .lanes = 1, 160594a407ccSDmitry Baryshkov 16062566ad8eSDmitry Baryshkov .tables = { 16072566ad8eSDmitry Baryshkov .serdes = sm8250_qmp_pcie_serdes_tbl, 16082566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl), 16092566ad8eSDmitry Baryshkov .tx = sm8250_qmp_pcie_tx_tbl, 16102566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sm8250_qmp_pcie_tx_tbl), 16112566ad8eSDmitry Baryshkov .rx = sm8250_qmp_pcie_rx_tbl, 16122566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sm8250_qmp_pcie_rx_tbl), 16132566ad8eSDmitry Baryshkov .pcs = sm8250_qmp_pcie_pcs_tbl, 16142566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_tbl), 16152566ad8eSDmitry Baryshkov .pcs_misc = sm8250_qmp_pcie_pcs_misc_tbl, 16162566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_misc_tbl), 16172566ad8eSDmitry Baryshkov }, 16182566ad8eSDmitry Baryshkov .tables_rc = &(const struct qmp_phy_cfg_tables) { 16192566ad8eSDmitry Baryshkov .serdes = sm8250_qmp_gen3x1_pcie_serdes_tbl, 16202566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_serdes_tbl), 16212566ad8eSDmitry Baryshkov .rx = sm8250_qmp_gen3x1_pcie_rx_tbl, 16222566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_rx_tbl), 16232566ad8eSDmitry Baryshkov .pcs = sm8250_qmp_gen3x1_pcie_pcs_tbl, 16242566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_pcs_tbl), 16252566ad8eSDmitry Baryshkov .pcs_misc = sm8250_qmp_gen3x1_pcie_pcs_misc_tbl, 16262566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_pcs_misc_tbl), 16272566ad8eSDmitry Baryshkov }, 162894a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 162994a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 163094a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 163194a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 163294a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 163394a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 163494a407ccSDmitry Baryshkov .regs = sm8250_pcie_regs_layout, 163594a407ccSDmitry Baryshkov 163694a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 163794a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 163894a407ccSDmitry Baryshkov }; 163994a407ccSDmitry Baryshkov 164094a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8250_qmp_gen3x2_pciephy_cfg = { 1641f02543faSJohan Hovold .lanes = 2, 164294a407ccSDmitry Baryshkov 16432566ad8eSDmitry Baryshkov .tables = { 16442566ad8eSDmitry Baryshkov .serdes = sm8250_qmp_pcie_serdes_tbl, 16452566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl), 16462566ad8eSDmitry Baryshkov .tx = sm8250_qmp_pcie_tx_tbl, 16472566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sm8250_qmp_pcie_tx_tbl), 16482566ad8eSDmitry Baryshkov .rx = sm8250_qmp_pcie_rx_tbl, 16492566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sm8250_qmp_pcie_rx_tbl), 16502566ad8eSDmitry Baryshkov .pcs = sm8250_qmp_pcie_pcs_tbl, 16512566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_tbl), 16522566ad8eSDmitry Baryshkov .pcs_misc = sm8250_qmp_pcie_pcs_misc_tbl, 16532566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8250_qmp_pcie_pcs_misc_tbl), 16542566ad8eSDmitry Baryshkov }, 16552566ad8eSDmitry Baryshkov .tables_rc = &(const struct qmp_phy_cfg_tables) { 16562566ad8eSDmitry Baryshkov .tx = sm8250_qmp_gen3x2_pcie_tx_tbl, 16572566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_tx_tbl), 16582566ad8eSDmitry Baryshkov .rx = sm8250_qmp_gen3x2_pcie_rx_tbl, 16592566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_rx_tbl), 16602566ad8eSDmitry Baryshkov .pcs = sm8250_qmp_gen3x2_pcie_pcs_tbl, 16612566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_pcs_tbl), 16622566ad8eSDmitry Baryshkov .pcs_misc = sm8250_qmp_gen3x2_pcie_pcs_misc_tbl, 16632566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_pcs_misc_tbl), 16642566ad8eSDmitry Baryshkov }, 166594a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 166694a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 166794a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 166894a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 166994a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 167094a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 167194a407ccSDmitry Baryshkov .regs = sm8250_pcie_regs_layout, 167294a407ccSDmitry Baryshkov 167394a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 167494a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 167594a407ccSDmitry Baryshkov }; 167694a407ccSDmitry Baryshkov 167794a407ccSDmitry Baryshkov static const struct qmp_phy_cfg msm8998_pciephy_cfg = { 1678f02543faSJohan Hovold .lanes = 1, 167994a407ccSDmitry Baryshkov 16802566ad8eSDmitry Baryshkov .tables = { 16812566ad8eSDmitry Baryshkov .serdes = msm8998_pcie_serdes_tbl, 16822566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(msm8998_pcie_serdes_tbl), 16832566ad8eSDmitry Baryshkov .tx = msm8998_pcie_tx_tbl, 16842566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(msm8998_pcie_tx_tbl), 16852566ad8eSDmitry Baryshkov .rx = msm8998_pcie_rx_tbl, 16862566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(msm8998_pcie_rx_tbl), 16872566ad8eSDmitry Baryshkov .pcs = msm8998_pcie_pcs_tbl, 16882566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(msm8998_pcie_pcs_tbl), 16892566ad8eSDmitry Baryshkov }, 169094a407ccSDmitry Baryshkov .clk_list = msm8996_phy_clk_l, 169194a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(msm8996_phy_clk_l), 169294a407ccSDmitry Baryshkov .reset_list = ipq8074_pciephy_reset_l, 169394a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), 169494a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 169594a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 169694a407ccSDmitry Baryshkov .regs = pciephy_regs_layout, 169794a407ccSDmitry Baryshkov 169894a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 169994a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 170051bd3306SJohan Hovold 170151bd3306SJohan Hovold .skip_start_delay = true, 170294a407ccSDmitry Baryshkov }; 170394a407ccSDmitry Baryshkov 170494a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sc8180x_pciephy_cfg = { 1705f02543faSJohan Hovold .lanes = 1, 170694a407ccSDmitry Baryshkov 17072566ad8eSDmitry Baryshkov .tables = { 17082566ad8eSDmitry Baryshkov .serdes = sc8180x_qmp_pcie_serdes_tbl, 17092566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sc8180x_qmp_pcie_serdes_tbl), 17102566ad8eSDmitry Baryshkov .tx = sc8180x_qmp_pcie_tx_tbl, 17112566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sc8180x_qmp_pcie_tx_tbl), 17122566ad8eSDmitry Baryshkov .rx = sc8180x_qmp_pcie_rx_tbl, 17132566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sc8180x_qmp_pcie_rx_tbl), 17142566ad8eSDmitry Baryshkov .pcs = sc8180x_qmp_pcie_pcs_tbl, 17152566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sc8180x_qmp_pcie_pcs_tbl), 17162566ad8eSDmitry Baryshkov .pcs_misc = sc8180x_qmp_pcie_pcs_misc_tbl, 17172566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sc8180x_qmp_pcie_pcs_misc_tbl), 17182566ad8eSDmitry Baryshkov }, 171994a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 172094a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 172194a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 172294a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 172394a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 172494a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 172594a407ccSDmitry Baryshkov .regs = sm8250_pcie_regs_layout, 172694a407ccSDmitry Baryshkov 172794a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 17284a9eac5aSJohan Hovold .phy_status = PHYSTATUS, 172994a407ccSDmitry Baryshkov }; 173094a407ccSDmitry Baryshkov 173194a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sdx55_qmp_pciephy_cfg = { 1732f02543faSJohan Hovold .lanes = 2, 173394a407ccSDmitry Baryshkov 17342566ad8eSDmitry Baryshkov .tables = { 17352566ad8eSDmitry Baryshkov .serdes = sdx55_qmp_pcie_serdes_tbl, 17362566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sdx55_qmp_pcie_serdes_tbl), 17372566ad8eSDmitry Baryshkov .tx = sdx55_qmp_pcie_tx_tbl, 17382566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sdx55_qmp_pcie_tx_tbl), 17392566ad8eSDmitry Baryshkov .rx = sdx55_qmp_pcie_rx_tbl, 17402566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sdx55_qmp_pcie_rx_tbl), 17412566ad8eSDmitry Baryshkov .pcs = sdx55_qmp_pcie_pcs_tbl, 17422566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sdx55_qmp_pcie_pcs_tbl), 17432566ad8eSDmitry Baryshkov .pcs_misc = sdx55_qmp_pcie_pcs_misc_tbl, 17442566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sdx55_qmp_pcie_pcs_misc_tbl), 17452566ad8eSDmitry Baryshkov }, 174694a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 174794a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 174894a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 174994a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 175094a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 175194a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 175294a407ccSDmitry Baryshkov .regs = sm8250_pcie_regs_layout, 175394a407ccSDmitry Baryshkov 175494a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN, 175594a407ccSDmitry Baryshkov .phy_status = PHYSTATUS_4_20, 175694a407ccSDmitry Baryshkov }; 175794a407ccSDmitry Baryshkov 175894a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8450_qmp_gen3x1_pciephy_cfg = { 1759f02543faSJohan Hovold .lanes = 1, 176094a407ccSDmitry Baryshkov 17612566ad8eSDmitry Baryshkov .tables = { 17622566ad8eSDmitry Baryshkov .serdes = sm8450_qmp_gen3x1_pcie_serdes_tbl, 17632566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_serdes_tbl), 17642566ad8eSDmitry Baryshkov .tx = sm8450_qmp_gen3x1_pcie_tx_tbl, 17652566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_tx_tbl), 17662566ad8eSDmitry Baryshkov .rx = sm8450_qmp_gen3x1_pcie_rx_tbl, 17672566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_rx_tbl), 17682566ad8eSDmitry Baryshkov .pcs = sm8450_qmp_gen3x1_pcie_pcs_tbl, 17692566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_pcs_tbl), 17702566ad8eSDmitry Baryshkov .pcs_misc = sm8450_qmp_gen3x1_pcie_pcs_misc_tbl, 17712566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_pcs_misc_tbl), 17722566ad8eSDmitry Baryshkov }, 177394a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 177494a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 177594a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 177694a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 177794a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 177894a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 177994a407ccSDmitry Baryshkov .regs = sm8250_pcie_regs_layout, 178094a407ccSDmitry Baryshkov 178194a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 178294a407ccSDmitry Baryshkov .phy_status = PHYSTATUS, 178394a407ccSDmitry Baryshkov }; 178494a407ccSDmitry Baryshkov 178594a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8450_qmp_gen4x2_pciephy_cfg = { 1786f02543faSJohan Hovold .lanes = 2, 178794a407ccSDmitry Baryshkov 17882566ad8eSDmitry Baryshkov .tables = { 17892566ad8eSDmitry Baryshkov .serdes = sm8450_qmp_gen4x2_pcie_serdes_tbl, 17902566ad8eSDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_serdes_tbl), 17912566ad8eSDmitry Baryshkov .tx = sm8450_qmp_gen4x2_pcie_tx_tbl, 17922566ad8eSDmitry Baryshkov .tx_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_tx_tbl), 17932566ad8eSDmitry Baryshkov .rx = sm8450_qmp_gen4x2_pcie_rx_tbl, 17942566ad8eSDmitry Baryshkov .rx_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_rx_tbl), 17952566ad8eSDmitry Baryshkov .pcs = sm8450_qmp_gen4x2_pcie_pcs_tbl, 17962566ad8eSDmitry Baryshkov .pcs_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_pcs_tbl), 17972566ad8eSDmitry Baryshkov .pcs_misc = sm8450_qmp_gen4x2_pcie_pcs_misc_tbl, 17982566ad8eSDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_pcs_misc_tbl), 17992566ad8eSDmitry Baryshkov }, 1800f5682f13SDmitry Baryshkov 1801f5682f13SDmitry Baryshkov .tables_rc = &(const struct qmp_phy_cfg_tables) { 1802f5682f13SDmitry Baryshkov .serdes = sm8450_qmp_gen4x2_pcie_rc_serdes_tbl, 1803f5682f13SDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_rc_serdes_tbl), 1804f5682f13SDmitry Baryshkov .pcs_misc = sm8450_qmp_gen4x2_pcie_rc_pcs_misc_tbl, 1805f5682f13SDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_rc_pcs_misc_tbl), 1806f5682f13SDmitry Baryshkov }, 1807f5682f13SDmitry Baryshkov 1808f5682f13SDmitry Baryshkov .tables_ep = &(const struct qmp_phy_cfg_tables) { 1809f5682f13SDmitry Baryshkov .serdes = sm8450_qmp_gen4x2_pcie_ep_serdes_tbl, 1810f5682f13SDmitry Baryshkov .serdes_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_ep_serdes_tbl), 1811f5682f13SDmitry Baryshkov .pcs_misc = sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl, 1812f5682f13SDmitry Baryshkov .pcs_misc_num = ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl), 1813f5682f13SDmitry Baryshkov }, 1814f5682f13SDmitry Baryshkov 181594a407ccSDmitry Baryshkov .clk_list = sdm845_pciephy_clk_l, 181694a407ccSDmitry Baryshkov .num_clks = ARRAY_SIZE(sdm845_pciephy_clk_l), 181794a407ccSDmitry Baryshkov .reset_list = sdm845_pciephy_reset_l, 181894a407ccSDmitry Baryshkov .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 181994a407ccSDmitry Baryshkov .vreg_list = qmp_phy_vreg_l, 182094a407ccSDmitry Baryshkov .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 182194a407ccSDmitry Baryshkov .regs = sm8250_pcie_regs_layout, 182294a407ccSDmitry Baryshkov 182394a407ccSDmitry Baryshkov .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 182494a407ccSDmitry Baryshkov .phy_status = PHYSTATUS_4_20, 182594a407ccSDmitry Baryshkov }; 182694a407ccSDmitry Baryshkov 182727878615SJohan Hovold static void qmp_pcie_configure_lane(void __iomem *base, 182894a407ccSDmitry Baryshkov const struct qmp_phy_init_tbl tbl[], 182994a407ccSDmitry Baryshkov int num, 183094a407ccSDmitry Baryshkov u8 lane_mask) 183194a407ccSDmitry Baryshkov { 183294a407ccSDmitry Baryshkov int i; 183394a407ccSDmitry Baryshkov const struct qmp_phy_init_tbl *t = tbl; 183494a407ccSDmitry Baryshkov 183594a407ccSDmitry Baryshkov if (!t) 183694a407ccSDmitry Baryshkov return; 183794a407ccSDmitry Baryshkov 183894a407ccSDmitry Baryshkov for (i = 0; i < num; i++, t++) { 183994a407ccSDmitry Baryshkov if (!(t->lane_mask & lane_mask)) 184094a407ccSDmitry Baryshkov continue; 184194a407ccSDmitry Baryshkov 184294a407ccSDmitry Baryshkov writel(t->val, base + t->offset); 184394a407ccSDmitry Baryshkov } 184494a407ccSDmitry Baryshkov } 184594a407ccSDmitry Baryshkov 184627878615SJohan Hovold static void qmp_pcie_configure(void __iomem *base, 184794a407ccSDmitry Baryshkov const struct qmp_phy_init_tbl tbl[], 184894a407ccSDmitry Baryshkov int num) 184994a407ccSDmitry Baryshkov { 1850f2175762SJohan Hovold qmp_pcie_configure_lane(base, tbl, num, 0xff); 185194a407ccSDmitry Baryshkov } 185294a407ccSDmitry Baryshkov 18532566ad8eSDmitry Baryshkov static void qmp_pcie_serdes_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tables *tables) 185494a407ccSDmitry Baryshkov { 185594a407ccSDmitry Baryshkov void __iomem *serdes = qphy->serdes; 185694a407ccSDmitry Baryshkov 18572566ad8eSDmitry Baryshkov if (!tables) 18582566ad8eSDmitry Baryshkov return; 185994a407ccSDmitry Baryshkov 1860f2175762SJohan Hovold qmp_pcie_configure(serdes, tables->serdes, tables->serdes_num); 18612566ad8eSDmitry Baryshkov } 18622566ad8eSDmitry Baryshkov 18632566ad8eSDmitry Baryshkov static void qmp_pcie_lanes_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tables *tables) 18642566ad8eSDmitry Baryshkov { 18652566ad8eSDmitry Baryshkov const struct qmp_phy_cfg *cfg = qphy->cfg; 18662566ad8eSDmitry Baryshkov void __iomem *tx = qphy->tx; 18672566ad8eSDmitry Baryshkov void __iomem *rx = qphy->rx; 18682566ad8eSDmitry Baryshkov 18692566ad8eSDmitry Baryshkov if (!tables) 18702566ad8eSDmitry Baryshkov return; 18712566ad8eSDmitry Baryshkov 1872f2175762SJohan Hovold qmp_pcie_configure_lane(tx, tables->tx, tables->tx_num, 1); 18732566ad8eSDmitry Baryshkov 18742566ad8eSDmitry Baryshkov if (cfg->lanes >= 2) 1875f2175762SJohan Hovold qmp_pcie_configure_lane(qphy->tx2, tables->tx, tables->tx_num, 2); 18762566ad8eSDmitry Baryshkov 1877f2175762SJohan Hovold qmp_pcie_configure_lane(rx, tables->rx, tables->rx_num, 1); 18782566ad8eSDmitry Baryshkov if (cfg->lanes >= 2) 1879f2175762SJohan Hovold qmp_pcie_configure_lane(qphy->rx2, tables->rx, tables->rx_num, 2); 18802566ad8eSDmitry Baryshkov } 18812566ad8eSDmitry Baryshkov 18822566ad8eSDmitry Baryshkov static void qmp_pcie_pcs_init(struct qmp_phy *qphy, const struct qmp_phy_cfg_tables *tables) 18832566ad8eSDmitry Baryshkov { 18842566ad8eSDmitry Baryshkov void __iomem *pcs = qphy->pcs; 18852566ad8eSDmitry Baryshkov void __iomem *pcs_misc = qphy->pcs_misc; 18862566ad8eSDmitry Baryshkov 18872566ad8eSDmitry Baryshkov if (!tables) 18882566ad8eSDmitry Baryshkov return; 18892566ad8eSDmitry Baryshkov 1890f2175762SJohan Hovold qmp_pcie_configure(pcs, tables->pcs, tables->pcs_num); 1891f2175762SJohan Hovold qmp_pcie_configure(pcs_misc, tables->pcs_misc, tables->pcs_misc_num); 189294a407ccSDmitry Baryshkov } 189394a407ccSDmitry Baryshkov 189491174e2cSJohan Hovold static int qmp_pcie_init(struct phy *phy) 189594a407ccSDmitry Baryshkov { 189691174e2cSJohan Hovold struct qmp_phy *qphy = phy_get_drvdata(phy); 189794a407ccSDmitry Baryshkov struct qcom_qmp *qmp = qphy->qmp; 189894a407ccSDmitry Baryshkov const struct qmp_phy_cfg *cfg = qphy->cfg; 1899189ac6b8SDmitry Baryshkov int ret; 190094a407ccSDmitry Baryshkov 190194a407ccSDmitry Baryshkov ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs); 190294a407ccSDmitry Baryshkov if (ret) { 190394a407ccSDmitry Baryshkov dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret); 19041239fd71SDmitry Baryshkov return ret; 190594a407ccSDmitry Baryshkov } 190694a407ccSDmitry Baryshkov 1907189ac6b8SDmitry Baryshkov ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets); 190894a407ccSDmitry Baryshkov if (ret) { 1909189ac6b8SDmitry Baryshkov dev_err(qmp->dev, "reset assert failed\n"); 191094a407ccSDmitry Baryshkov goto err_disable_regulators; 191194a407ccSDmitry Baryshkov } 191294a407ccSDmitry Baryshkov 1913189ac6b8SDmitry Baryshkov ret = reset_control_bulk_deassert(cfg->num_resets, qmp->resets); 191494a407ccSDmitry Baryshkov if (ret) { 1915189ac6b8SDmitry Baryshkov dev_err(qmp->dev, "reset deassert failed\n"); 1916189ac6b8SDmitry Baryshkov goto err_disable_regulators; 191794a407ccSDmitry Baryshkov } 191894a407ccSDmitry Baryshkov 191994a407ccSDmitry Baryshkov ret = clk_bulk_prepare_enable(cfg->num_clks, qmp->clks); 192094a407ccSDmitry Baryshkov if (ret) 192194a407ccSDmitry Baryshkov goto err_assert_reset; 192294a407ccSDmitry Baryshkov 192394a407ccSDmitry Baryshkov return 0; 192494a407ccSDmitry Baryshkov 192594a407ccSDmitry Baryshkov err_assert_reset: 1926189ac6b8SDmitry Baryshkov reset_control_bulk_assert(cfg->num_resets, qmp->resets); 192794a407ccSDmitry Baryshkov err_disable_regulators: 192894a407ccSDmitry Baryshkov regulator_bulk_disable(cfg->num_vregs, qmp->vregs); 192994a407ccSDmitry Baryshkov 193094a407ccSDmitry Baryshkov return ret; 193194a407ccSDmitry Baryshkov } 193294a407ccSDmitry Baryshkov 193391174e2cSJohan Hovold static int qmp_pcie_exit(struct phy *phy) 193494a407ccSDmitry Baryshkov { 193591174e2cSJohan Hovold struct qmp_phy *qphy = phy_get_drvdata(phy); 193694a407ccSDmitry Baryshkov struct qcom_qmp *qmp = qphy->qmp; 193794a407ccSDmitry Baryshkov const struct qmp_phy_cfg *cfg = qphy->cfg; 193894a407ccSDmitry Baryshkov 1939189ac6b8SDmitry Baryshkov reset_control_bulk_assert(cfg->num_resets, qmp->resets); 194094a407ccSDmitry Baryshkov 194194a407ccSDmitry Baryshkov clk_bulk_disable_unprepare(cfg->num_clks, qmp->clks); 194294a407ccSDmitry Baryshkov 194394a407ccSDmitry Baryshkov regulator_bulk_disable(cfg->num_vregs, qmp->vregs); 194494a407ccSDmitry Baryshkov 194594a407ccSDmitry Baryshkov return 0; 194694a407ccSDmitry Baryshkov } 194794a407ccSDmitry Baryshkov 194827878615SJohan Hovold static int qmp_pcie_power_on(struct phy *phy) 194994a407ccSDmitry Baryshkov { 195094a407ccSDmitry Baryshkov struct qmp_phy *qphy = phy_get_drvdata(phy); 195194a407ccSDmitry Baryshkov struct qcom_qmp *qmp = qphy->qmp; 195294a407ccSDmitry Baryshkov const struct qmp_phy_cfg *cfg = qphy->cfg; 195311bf53a3SDmitry Baryshkov const struct qmp_phy_cfg_tables *mode_tables; 195494a407ccSDmitry Baryshkov void __iomem *pcs = qphy->pcs; 195594a407ccSDmitry Baryshkov void __iomem *status; 19562577ba8cSJohan Hovold unsigned int mask, val; 195794a407ccSDmitry Baryshkov int ret; 195894a407ccSDmitry Baryshkov 19595b68d95cSJohan Hovold qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], 19605b68d95cSJohan Hovold cfg->pwrdn_ctrl); 19615b68d95cSJohan Hovold 196211bf53a3SDmitry Baryshkov if (qphy->mode == PHY_MODE_PCIE_RC) 196311bf53a3SDmitry Baryshkov mode_tables = cfg->tables_rc; 196411bf53a3SDmitry Baryshkov else 196511bf53a3SDmitry Baryshkov mode_tables = cfg->tables_ep; 196611bf53a3SDmitry Baryshkov 19672566ad8eSDmitry Baryshkov qmp_pcie_serdes_init(qphy, &cfg->tables); 196811bf53a3SDmitry Baryshkov qmp_pcie_serdes_init(qphy, mode_tables); 196994a407ccSDmitry Baryshkov 197094a407ccSDmitry Baryshkov ret = clk_prepare_enable(qphy->pipe_clk); 197194a407ccSDmitry Baryshkov if (ret) { 197294a407ccSDmitry Baryshkov dev_err(qmp->dev, "pipe_clk enable failed err=%d\n", ret); 1973fd926994SDmitry Baryshkov return ret; 197494a407ccSDmitry Baryshkov } 197594a407ccSDmitry Baryshkov 197694a407ccSDmitry Baryshkov /* Tx, Rx, and PCS configurations */ 19772566ad8eSDmitry Baryshkov qmp_pcie_lanes_init(qphy, &cfg->tables); 197811bf53a3SDmitry Baryshkov qmp_pcie_lanes_init(qphy, mode_tables); 197994a407ccSDmitry Baryshkov 19802566ad8eSDmitry Baryshkov qmp_pcie_pcs_init(qphy, &cfg->tables); 198111bf53a3SDmitry Baryshkov qmp_pcie_pcs_init(qphy, mode_tables); 198294a407ccSDmitry Baryshkov 198394a407ccSDmitry Baryshkov /* Pull PHY out of reset state */ 198494a407ccSDmitry Baryshkov qphy_clrbits(pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); 1985fd926994SDmitry Baryshkov 198694a407ccSDmitry Baryshkov /* start SerDes and Phy-Coding-Sublayer */ 19875806b87dSJohan Hovold qphy_setbits(pcs, cfg->regs[QPHY_START_CTRL], SERDES_START | PCS_START); 198894a407ccSDmitry Baryshkov 198951bd3306SJohan Hovold if (!cfg->skip_start_delay) 199051bd3306SJohan Hovold usleep_range(1000, 1200); 199151bd3306SJohan Hovold 199294a407ccSDmitry Baryshkov status = pcs + cfg->regs[QPHY_PCS_STATUS]; 199394a407ccSDmitry Baryshkov mask = cfg->phy_status; 19945cbeb75aSJohan Hovold ret = readl_poll_timeout(status, val, !(val & mask), 200, 199594a407ccSDmitry Baryshkov PHY_INIT_COMPLETE_TIMEOUT); 199694a407ccSDmitry Baryshkov if (ret) { 199794a407ccSDmitry Baryshkov dev_err(qmp->dev, "phy initialization timed-out\n"); 199894a407ccSDmitry Baryshkov goto err_disable_pipe_clk; 199994a407ccSDmitry Baryshkov } 2000da07a06bSDmitry Baryshkov 200194a407ccSDmitry Baryshkov return 0; 200294a407ccSDmitry Baryshkov 200394a407ccSDmitry Baryshkov err_disable_pipe_clk: 200494a407ccSDmitry Baryshkov clk_disable_unprepare(qphy->pipe_clk); 200594a407ccSDmitry Baryshkov 200694a407ccSDmitry Baryshkov return ret; 200794a407ccSDmitry Baryshkov } 200894a407ccSDmitry Baryshkov 200927878615SJohan Hovold static int qmp_pcie_power_off(struct phy *phy) 201094a407ccSDmitry Baryshkov { 201194a407ccSDmitry Baryshkov struct qmp_phy *qphy = phy_get_drvdata(phy); 201294a407ccSDmitry Baryshkov const struct qmp_phy_cfg *cfg = qphy->cfg; 201394a407ccSDmitry Baryshkov 201494a407ccSDmitry Baryshkov clk_disable_unprepare(qphy->pipe_clk); 201594a407ccSDmitry Baryshkov 201694a407ccSDmitry Baryshkov /* PHY reset */ 201794a407ccSDmitry Baryshkov qphy_setbits(qphy->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET); 201894a407ccSDmitry Baryshkov 201994a407ccSDmitry Baryshkov /* stop SerDes and Phy-Coding-Sublayer */ 20205806b87dSJohan Hovold qphy_clrbits(qphy->pcs, cfg->regs[QPHY_START_CTRL], 20215806b87dSJohan Hovold SERDES_START | PCS_START); 202294a407ccSDmitry Baryshkov 202394a407ccSDmitry Baryshkov /* Put PHY into POWER DOWN state: active low */ 202494a407ccSDmitry Baryshkov qphy_clrbits(qphy->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], 202594a407ccSDmitry Baryshkov cfg->pwrdn_ctrl); 202694a407ccSDmitry Baryshkov 202794a407ccSDmitry Baryshkov return 0; 202894a407ccSDmitry Baryshkov } 202994a407ccSDmitry Baryshkov 203027878615SJohan Hovold static int qmp_pcie_enable(struct phy *phy) 203194a407ccSDmitry Baryshkov { 203294a407ccSDmitry Baryshkov int ret; 203394a407ccSDmitry Baryshkov 203427878615SJohan Hovold ret = qmp_pcie_init(phy); 203594a407ccSDmitry Baryshkov if (ret) 203694a407ccSDmitry Baryshkov return ret; 203794a407ccSDmitry Baryshkov 203827878615SJohan Hovold ret = qmp_pcie_power_on(phy); 203994a407ccSDmitry Baryshkov if (ret) 204027878615SJohan Hovold qmp_pcie_exit(phy); 204194a407ccSDmitry Baryshkov 204294a407ccSDmitry Baryshkov return ret; 204394a407ccSDmitry Baryshkov } 204494a407ccSDmitry Baryshkov 204527878615SJohan Hovold static int qmp_pcie_disable(struct phy *phy) 204694a407ccSDmitry Baryshkov { 204794a407ccSDmitry Baryshkov int ret; 204894a407ccSDmitry Baryshkov 204927878615SJohan Hovold ret = qmp_pcie_power_off(phy); 205094a407ccSDmitry Baryshkov if (ret) 205194a407ccSDmitry Baryshkov return ret; 205227878615SJohan Hovold 205327878615SJohan Hovold return qmp_pcie_exit(phy); 205494a407ccSDmitry Baryshkov } 205594a407ccSDmitry Baryshkov 205611bf53a3SDmitry Baryshkov static int qmp_pcie_set_mode(struct phy *phy, enum phy_mode mode, int submode) 205711bf53a3SDmitry Baryshkov { 205811bf53a3SDmitry Baryshkov struct qmp_phy *qphy = phy_get_drvdata(phy); 205911bf53a3SDmitry Baryshkov 206011bf53a3SDmitry Baryshkov switch (submode) { 206111bf53a3SDmitry Baryshkov case PHY_MODE_PCIE_RC: 206211bf53a3SDmitry Baryshkov case PHY_MODE_PCIE_EP: 206311bf53a3SDmitry Baryshkov qphy->mode = submode; 206411bf53a3SDmitry Baryshkov break; 206511bf53a3SDmitry Baryshkov default: 206611bf53a3SDmitry Baryshkov dev_err(&phy->dev, "Unsupported submode %d\n", submode); 206711bf53a3SDmitry Baryshkov return -EINVAL; 206811bf53a3SDmitry Baryshkov } 206911bf53a3SDmitry Baryshkov 207011bf53a3SDmitry Baryshkov return 0; 207111bf53a3SDmitry Baryshkov } 207211bf53a3SDmitry Baryshkov 207327878615SJohan Hovold static int qmp_pcie_vreg_init(struct device *dev, const struct qmp_phy_cfg *cfg) 207494a407ccSDmitry Baryshkov { 207594a407ccSDmitry Baryshkov struct qcom_qmp *qmp = dev_get_drvdata(dev); 207694a407ccSDmitry Baryshkov int num = cfg->num_vregs; 207794a407ccSDmitry Baryshkov int i; 207894a407ccSDmitry Baryshkov 207994a407ccSDmitry Baryshkov qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); 208094a407ccSDmitry Baryshkov if (!qmp->vregs) 208194a407ccSDmitry Baryshkov return -ENOMEM; 208294a407ccSDmitry Baryshkov 208394a407ccSDmitry Baryshkov for (i = 0; i < num; i++) 208494a407ccSDmitry Baryshkov qmp->vregs[i].supply = cfg->vreg_list[i]; 208594a407ccSDmitry Baryshkov 208694a407ccSDmitry Baryshkov return devm_regulator_bulk_get(dev, num, qmp->vregs); 208794a407ccSDmitry Baryshkov } 208894a407ccSDmitry Baryshkov 208927878615SJohan Hovold static int qmp_pcie_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) 209094a407ccSDmitry Baryshkov { 209194a407ccSDmitry Baryshkov struct qcom_qmp *qmp = dev_get_drvdata(dev); 209294a407ccSDmitry Baryshkov int i; 2093189ac6b8SDmitry Baryshkov int ret; 209494a407ccSDmitry Baryshkov 209594a407ccSDmitry Baryshkov qmp->resets = devm_kcalloc(dev, cfg->num_resets, 209694a407ccSDmitry Baryshkov sizeof(*qmp->resets), GFP_KERNEL); 209794a407ccSDmitry Baryshkov if (!qmp->resets) 209894a407ccSDmitry Baryshkov return -ENOMEM; 209994a407ccSDmitry Baryshkov 2100189ac6b8SDmitry Baryshkov for (i = 0; i < cfg->num_resets; i++) 2101189ac6b8SDmitry Baryshkov qmp->resets[i].id = cfg->reset_list[i]; 210294a407ccSDmitry Baryshkov 2103189ac6b8SDmitry Baryshkov ret = devm_reset_control_bulk_get_exclusive(dev, cfg->num_resets, qmp->resets); 2104189ac6b8SDmitry Baryshkov if (ret) 2105189ac6b8SDmitry Baryshkov return dev_err_probe(dev, ret, "failed to get resets\n"); 210694a407ccSDmitry Baryshkov 210794a407ccSDmitry Baryshkov return 0; 210894a407ccSDmitry Baryshkov } 210994a407ccSDmitry Baryshkov 211027878615SJohan Hovold static int qmp_pcie_clk_init(struct device *dev, const struct qmp_phy_cfg *cfg) 211194a407ccSDmitry Baryshkov { 211294a407ccSDmitry Baryshkov struct qcom_qmp *qmp = dev_get_drvdata(dev); 211394a407ccSDmitry Baryshkov int num = cfg->num_clks; 211494a407ccSDmitry Baryshkov int i; 211594a407ccSDmitry Baryshkov 211694a407ccSDmitry Baryshkov qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL); 211794a407ccSDmitry Baryshkov if (!qmp->clks) 211894a407ccSDmitry Baryshkov return -ENOMEM; 211994a407ccSDmitry Baryshkov 212094a407ccSDmitry Baryshkov for (i = 0; i < num; i++) 212194a407ccSDmitry Baryshkov qmp->clks[i].id = cfg->clk_list[i]; 212294a407ccSDmitry Baryshkov 212394a407ccSDmitry Baryshkov return devm_clk_bulk_get(dev, num, qmp->clks); 212494a407ccSDmitry Baryshkov } 212594a407ccSDmitry Baryshkov 212694a407ccSDmitry Baryshkov static void phy_clk_release_provider(void *res) 212794a407ccSDmitry Baryshkov { 212894a407ccSDmitry Baryshkov of_clk_del_provider(res); 212994a407ccSDmitry Baryshkov } 213094a407ccSDmitry Baryshkov 213194a407ccSDmitry Baryshkov /* 213294a407ccSDmitry Baryshkov * Register a fixed rate pipe clock. 213394a407ccSDmitry Baryshkov * 213494a407ccSDmitry Baryshkov * The <s>_pipe_clksrc generated by PHY goes to the GCC that gate 213594a407ccSDmitry Baryshkov * controls it. The <s>_pipe_clk coming out of the GCC is requested 213694a407ccSDmitry Baryshkov * by the PHY driver for its operations. 213794a407ccSDmitry Baryshkov * We register the <s>_pipe_clksrc here. The gcc driver takes care 213894a407ccSDmitry Baryshkov * of assigning this <s>_pipe_clksrc as parent to <s>_pipe_clk. 213994a407ccSDmitry Baryshkov * Below picture shows this relationship. 214094a407ccSDmitry Baryshkov * 214194a407ccSDmitry Baryshkov * +---------------+ 214294a407ccSDmitry Baryshkov * | PHY block |<<---------------------------------------+ 214394a407ccSDmitry Baryshkov * | | | 214494a407ccSDmitry Baryshkov * | +-------+ | +-----+ | 214594a407ccSDmitry Baryshkov * I/P---^-->| PLL |---^--->pipe_clksrc--->| GCC |--->pipe_clk---+ 214694a407ccSDmitry Baryshkov * clk | +-------+ | +-----+ 214794a407ccSDmitry Baryshkov * +---------------+ 214894a407ccSDmitry Baryshkov */ 214994a407ccSDmitry Baryshkov static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np) 215094a407ccSDmitry Baryshkov { 215194a407ccSDmitry Baryshkov struct clk_fixed_rate *fixed; 215294a407ccSDmitry Baryshkov struct clk_init_data init = { }; 215394a407ccSDmitry Baryshkov int ret; 215494a407ccSDmitry Baryshkov 215594a407ccSDmitry Baryshkov ret = of_property_read_string(np, "clock-output-names", &init.name); 215694a407ccSDmitry Baryshkov if (ret) { 215794a407ccSDmitry Baryshkov dev_err(qmp->dev, "%pOFn: No clock-output-names\n", np); 215894a407ccSDmitry Baryshkov return ret; 215994a407ccSDmitry Baryshkov } 216094a407ccSDmitry Baryshkov 216194a407ccSDmitry Baryshkov fixed = devm_kzalloc(qmp->dev, sizeof(*fixed), GFP_KERNEL); 216294a407ccSDmitry Baryshkov if (!fixed) 216394a407ccSDmitry Baryshkov return -ENOMEM; 216494a407ccSDmitry Baryshkov 216594a407ccSDmitry Baryshkov init.ops = &clk_fixed_rate_ops; 216694a407ccSDmitry Baryshkov 21672ec9bc8dSRobert Marko /* 21682ec9bc8dSRobert Marko * Controllers using QMP PHY-s use 125MHz pipe clock interface 21692ec9bc8dSRobert Marko * unless other frequency is specified in the PHY config. 21702ec9bc8dSRobert Marko */ 21712ec9bc8dSRobert Marko if (qmp->phys[0]->cfg->pipe_clock_rate) 21722ec9bc8dSRobert Marko fixed->fixed_rate = qmp->phys[0]->cfg->pipe_clock_rate; 21732ec9bc8dSRobert Marko else 217494a407ccSDmitry Baryshkov fixed->fixed_rate = 125000000; 21752ec9bc8dSRobert Marko 217694a407ccSDmitry Baryshkov fixed->hw.init = &init; 217794a407ccSDmitry Baryshkov 217894a407ccSDmitry Baryshkov ret = devm_clk_hw_register(qmp->dev, &fixed->hw); 217994a407ccSDmitry Baryshkov if (ret) 218094a407ccSDmitry Baryshkov return ret; 218194a407ccSDmitry Baryshkov 218294a407ccSDmitry Baryshkov ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, &fixed->hw); 218394a407ccSDmitry Baryshkov if (ret) 218494a407ccSDmitry Baryshkov return ret; 218594a407ccSDmitry Baryshkov 218694a407ccSDmitry Baryshkov /* 218794a407ccSDmitry Baryshkov * Roll a devm action because the clock provider is the child node, but 218894a407ccSDmitry Baryshkov * the child node is not actually a device. 218994a407ccSDmitry Baryshkov */ 219094a407ccSDmitry Baryshkov return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np); 219194a407ccSDmitry Baryshkov } 219294a407ccSDmitry Baryshkov 219327878615SJohan Hovold static const struct phy_ops qmp_pcie_ops = { 219427878615SJohan Hovold .power_on = qmp_pcie_enable, 219527878615SJohan Hovold .power_off = qmp_pcie_disable, 219611bf53a3SDmitry Baryshkov .set_mode = qmp_pcie_set_mode, 219794a407ccSDmitry Baryshkov .owner = THIS_MODULE, 219894a407ccSDmitry Baryshkov }; 219994a407ccSDmitry Baryshkov 220027878615SJohan Hovold static int qmp_pcie_create(struct device *dev, struct device_node *np, int id, 220194a407ccSDmitry Baryshkov void __iomem *serdes, const struct qmp_phy_cfg *cfg) 220294a407ccSDmitry Baryshkov { 220394a407ccSDmitry Baryshkov struct qcom_qmp *qmp = dev_get_drvdata(dev); 220494a407ccSDmitry Baryshkov struct phy *generic_phy; 220594a407ccSDmitry Baryshkov struct qmp_phy *qphy; 220694a407ccSDmitry Baryshkov int ret; 220794a407ccSDmitry Baryshkov 220894a407ccSDmitry Baryshkov qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL); 220994a407ccSDmitry Baryshkov if (!qphy) 221094a407ccSDmitry Baryshkov return -ENOMEM; 221194a407ccSDmitry Baryshkov 221211bf53a3SDmitry Baryshkov qphy->mode = PHY_MODE_PCIE_RC; 221311bf53a3SDmitry Baryshkov 221494a407ccSDmitry Baryshkov qphy->cfg = cfg; 221594a407ccSDmitry Baryshkov qphy->serdes = serdes; 221694a407ccSDmitry Baryshkov /* 22178d3bf724SJohan Hovold * Get memory resources for the PHY: 221894a407ccSDmitry Baryshkov * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. 221994a407ccSDmitry Baryshkov * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5 222094a407ccSDmitry Baryshkov * For single lane PHYs: pcs_misc (optional) -> 3. 222194a407ccSDmitry Baryshkov */ 22224be26f69SJohan Hovold qphy->tx = devm_of_iomap(dev, np, 0, NULL); 22234be26f69SJohan Hovold if (IS_ERR(qphy->tx)) 22244be26f69SJohan Hovold return PTR_ERR(qphy->tx); 222594a407ccSDmitry Baryshkov 22260a40891bSDmitry Baryshkov if (of_device_is_compatible(dev->of_node, "qcom,sdm845-qhp-pcie-phy")) 22270a40891bSDmitry Baryshkov qphy->rx = qphy->tx; 22280a40891bSDmitry Baryshkov else 22294be26f69SJohan Hovold qphy->rx = devm_of_iomap(dev, np, 1, NULL); 22304be26f69SJohan Hovold if (IS_ERR(qphy->rx)) 22314be26f69SJohan Hovold return PTR_ERR(qphy->rx); 223294a407ccSDmitry Baryshkov 22334be26f69SJohan Hovold qphy->pcs = devm_of_iomap(dev, np, 2, NULL); 22344be26f69SJohan Hovold if (IS_ERR(qphy->pcs)) 22354be26f69SJohan Hovold return PTR_ERR(qphy->pcs); 223694a407ccSDmitry Baryshkov 2237f02543faSJohan Hovold if (cfg->lanes >= 2) { 22384be26f69SJohan Hovold qphy->tx2 = devm_of_iomap(dev, np, 3, NULL); 223969c90cb5SJohan Hovold if (IS_ERR(qphy->tx2)) 224069c90cb5SJohan Hovold return PTR_ERR(qphy->tx2); 224169c90cb5SJohan Hovold 22424be26f69SJohan Hovold qphy->rx2 = devm_of_iomap(dev, np, 4, NULL); 224369c90cb5SJohan Hovold if (IS_ERR(qphy->rx2)) 224469c90cb5SJohan Hovold return PTR_ERR(qphy->rx2); 224594a407ccSDmitry Baryshkov 22464be26f69SJohan Hovold qphy->pcs_misc = devm_of_iomap(dev, np, 5, NULL); 224794a407ccSDmitry Baryshkov } else { 22484be26f69SJohan Hovold qphy->pcs_misc = devm_of_iomap(dev, np, 3, NULL); 224994a407ccSDmitry Baryshkov } 225094a407ccSDmitry Baryshkov 22514be26f69SJohan Hovold if (IS_ERR(qphy->pcs_misc) && 2252af664324SDmitry Baryshkov of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy")) 2253af664324SDmitry Baryshkov qphy->pcs_misc = qphy->pcs + 0x400; 2254af664324SDmitry Baryshkov 22554be26f69SJohan Hovold if (IS_ERR(qphy->pcs_misc)) { 22562566ad8eSDmitry Baryshkov if (cfg->tables.pcs_misc || 225711bf53a3SDmitry Baryshkov (cfg->tables_rc && cfg->tables_rc->pcs_misc) || 225811bf53a3SDmitry Baryshkov (cfg->tables_ep && cfg->tables_ep->pcs_misc)) 22594be26f69SJohan Hovold return PTR_ERR(qphy->pcs_misc); 2260ecd5507eSJohan Hovold } 226194a407ccSDmitry Baryshkov 2262f8432544SJohan Hovold qphy->pipe_clk = devm_get_clk_from_child(dev, np, NULL); 226394a407ccSDmitry Baryshkov if (IS_ERR(qphy->pipe_clk)) { 22648f662cd9SJohan Hovold return dev_err_probe(dev, PTR_ERR(qphy->pipe_clk), 22658f662cd9SJohan Hovold "failed to get lane%d pipe clock\n", id); 226694a407ccSDmitry Baryshkov } 226794a407ccSDmitry Baryshkov 226827878615SJohan Hovold generic_phy = devm_phy_create(dev, np, &qmp_pcie_ops); 226994a407ccSDmitry Baryshkov if (IS_ERR(generic_phy)) { 227094a407ccSDmitry Baryshkov ret = PTR_ERR(generic_phy); 227194a407ccSDmitry Baryshkov dev_err(dev, "failed to create qphy %d\n", ret); 227294a407ccSDmitry Baryshkov return ret; 227394a407ccSDmitry Baryshkov } 227494a407ccSDmitry Baryshkov 227594a407ccSDmitry Baryshkov qphy->phy = generic_phy; 227694a407ccSDmitry Baryshkov qphy->qmp = qmp; 227794a407ccSDmitry Baryshkov qmp->phys[id] = qphy; 227894a407ccSDmitry Baryshkov phy_set_drvdata(generic_phy, qphy); 227994a407ccSDmitry Baryshkov 228094a407ccSDmitry Baryshkov return 0; 228194a407ccSDmitry Baryshkov } 228294a407ccSDmitry Baryshkov 228327878615SJohan Hovold static int qmp_pcie_probe(struct platform_device *pdev) 228494a407ccSDmitry Baryshkov { 228594a407ccSDmitry Baryshkov struct qcom_qmp *qmp; 228694a407ccSDmitry Baryshkov struct device *dev = &pdev->dev; 228794a407ccSDmitry Baryshkov struct device_node *child; 228894a407ccSDmitry Baryshkov struct phy_provider *phy_provider; 228994a407ccSDmitry Baryshkov void __iomem *serdes; 229094a407ccSDmitry Baryshkov const struct qmp_phy_cfg *cfg = NULL; 22911239fd71SDmitry Baryshkov int num, id; 229294a407ccSDmitry Baryshkov int ret; 229394a407ccSDmitry Baryshkov 229494a407ccSDmitry Baryshkov qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); 229594a407ccSDmitry Baryshkov if (!qmp) 229694a407ccSDmitry Baryshkov return -ENOMEM; 229794a407ccSDmitry Baryshkov 229894a407ccSDmitry Baryshkov qmp->dev = dev; 229994a407ccSDmitry Baryshkov dev_set_drvdata(dev, qmp); 230094a407ccSDmitry Baryshkov 230194a407ccSDmitry Baryshkov cfg = of_device_get_match_data(dev); 2302b35a5311SDmitry Baryshkov if (!cfg) 230394a407ccSDmitry Baryshkov return -EINVAL; 230494a407ccSDmitry Baryshkov 230573ad6a9dSJohan Hovold WARN_ON_ONCE(!cfg->pwrdn_ctrl); 230673ad6a9dSJohan Hovold WARN_ON_ONCE(!cfg->phy_status); 230773ad6a9dSJohan Hovold 2308da07a06bSDmitry Baryshkov serdes = devm_platform_ioremap_resource(pdev, 0); 230994a407ccSDmitry Baryshkov if (IS_ERR(serdes)) 231094a407ccSDmitry Baryshkov return PTR_ERR(serdes); 231194a407ccSDmitry Baryshkov 231227878615SJohan Hovold ret = qmp_pcie_clk_init(dev, cfg); 231394a407ccSDmitry Baryshkov if (ret) 231494a407ccSDmitry Baryshkov return ret; 231594a407ccSDmitry Baryshkov 231627878615SJohan Hovold ret = qmp_pcie_reset_init(dev, cfg); 231794a407ccSDmitry Baryshkov if (ret) 231894a407ccSDmitry Baryshkov return ret; 231994a407ccSDmitry Baryshkov 232027878615SJohan Hovold ret = qmp_pcie_vreg_init(dev, cfg); 2321a548b6b4SYuan Can if (ret) 232228d74fc3SJohan Hovold return ret; 232394a407ccSDmitry Baryshkov 232494a407ccSDmitry Baryshkov num = of_get_available_child_count(dev->of_node); 232594a407ccSDmitry Baryshkov /* do we have a rogue child node ? */ 23261239fd71SDmitry Baryshkov if (num > 1) 232794a407ccSDmitry Baryshkov return -EINVAL; 232894a407ccSDmitry Baryshkov 232994a407ccSDmitry Baryshkov qmp->phys = devm_kcalloc(dev, num, sizeof(*qmp->phys), GFP_KERNEL); 233094a407ccSDmitry Baryshkov if (!qmp->phys) 233194a407ccSDmitry Baryshkov return -ENOMEM; 233294a407ccSDmitry Baryshkov 233394a407ccSDmitry Baryshkov id = 0; 233494a407ccSDmitry Baryshkov for_each_available_child_of_node(dev->of_node, child) { 233594a407ccSDmitry Baryshkov /* Create per-lane phy */ 233627878615SJohan Hovold ret = qmp_pcie_create(dev, child, id, serdes, cfg); 233794a407ccSDmitry Baryshkov if (ret) { 233894a407ccSDmitry Baryshkov dev_err(dev, "failed to create lane%d phy, %d\n", 233994a407ccSDmitry Baryshkov id, ret); 234094a407ccSDmitry Baryshkov goto err_node_put; 234194a407ccSDmitry Baryshkov } 234294a407ccSDmitry Baryshkov 234394a407ccSDmitry Baryshkov /* 234494a407ccSDmitry Baryshkov * Register the pipe clock provided by phy. 234594a407ccSDmitry Baryshkov * See function description to see details of this pipe clock. 234694a407ccSDmitry Baryshkov */ 234794a407ccSDmitry Baryshkov ret = phy_pipe_clk_register(qmp, child); 234894a407ccSDmitry Baryshkov if (ret) { 234994a407ccSDmitry Baryshkov dev_err(qmp->dev, 235094a407ccSDmitry Baryshkov "failed to register pipe clock source\n"); 235194a407ccSDmitry Baryshkov goto err_node_put; 235294a407ccSDmitry Baryshkov } 2353da07a06bSDmitry Baryshkov 235494a407ccSDmitry Baryshkov id++; 235594a407ccSDmitry Baryshkov } 235694a407ccSDmitry Baryshkov 235794a407ccSDmitry Baryshkov phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 235894a407ccSDmitry Baryshkov 235994a407ccSDmitry Baryshkov return PTR_ERR_OR_ZERO(phy_provider); 236094a407ccSDmitry Baryshkov 236194a407ccSDmitry Baryshkov err_node_put: 236294a407ccSDmitry Baryshkov of_node_put(child); 236394a407ccSDmitry Baryshkov return ret; 236494a407ccSDmitry Baryshkov } 236594a407ccSDmitry Baryshkov 2366*cebc6ca7SJohan Hovold static const struct of_device_id qmp_pcie_of_match_table[] = { 2367*cebc6ca7SJohan Hovold { 2368*cebc6ca7SJohan Hovold .compatible = "qcom,ipq6018-qmp-pcie-phy", 2369*cebc6ca7SJohan Hovold .data = &ipq6018_pciephy_cfg, 2370*cebc6ca7SJohan Hovold }, { 2371*cebc6ca7SJohan Hovold .compatible = "qcom,ipq8074-qmp-gen3-pcie-phy", 2372*cebc6ca7SJohan Hovold .data = &ipq8074_pciephy_gen3_cfg, 2373*cebc6ca7SJohan Hovold }, { 2374*cebc6ca7SJohan Hovold .compatible = "qcom,ipq8074-qmp-pcie-phy", 2375*cebc6ca7SJohan Hovold .data = &ipq8074_pciephy_cfg, 2376*cebc6ca7SJohan Hovold }, { 2377*cebc6ca7SJohan Hovold .compatible = "qcom,msm8998-qmp-pcie-phy", 2378*cebc6ca7SJohan Hovold .data = &msm8998_pciephy_cfg, 2379*cebc6ca7SJohan Hovold }, { 2380*cebc6ca7SJohan Hovold .compatible = "qcom,sc8180x-qmp-pcie-phy", 2381*cebc6ca7SJohan Hovold .data = &sc8180x_pciephy_cfg, 2382*cebc6ca7SJohan Hovold }, { 2383*cebc6ca7SJohan Hovold .compatible = "qcom,sdm845-qhp-pcie-phy", 2384*cebc6ca7SJohan Hovold .data = &sdm845_qhp_pciephy_cfg, 2385*cebc6ca7SJohan Hovold }, { 2386*cebc6ca7SJohan Hovold .compatible = "qcom,sdm845-qmp-pcie-phy", 2387*cebc6ca7SJohan Hovold .data = &sdm845_qmp_pciephy_cfg, 2388*cebc6ca7SJohan Hovold }, { 2389*cebc6ca7SJohan Hovold .compatible = "qcom,sdx55-qmp-pcie-phy", 2390*cebc6ca7SJohan Hovold .data = &sdx55_qmp_pciephy_cfg, 2391*cebc6ca7SJohan Hovold }, { 2392*cebc6ca7SJohan Hovold .compatible = "qcom,sm8250-qmp-gen3x1-pcie-phy", 2393*cebc6ca7SJohan Hovold .data = &sm8250_qmp_gen3x1_pciephy_cfg, 2394*cebc6ca7SJohan Hovold }, { 2395*cebc6ca7SJohan Hovold .compatible = "qcom,sm8250-qmp-gen3x2-pcie-phy", 2396*cebc6ca7SJohan Hovold .data = &sm8250_qmp_gen3x2_pciephy_cfg, 2397*cebc6ca7SJohan Hovold }, { 2398*cebc6ca7SJohan Hovold .compatible = "qcom,sm8250-qmp-modem-pcie-phy", 2399*cebc6ca7SJohan Hovold .data = &sm8250_qmp_gen3x2_pciephy_cfg, 2400*cebc6ca7SJohan Hovold }, { 2401*cebc6ca7SJohan Hovold .compatible = "qcom,sm8450-qmp-gen3x1-pcie-phy", 2402*cebc6ca7SJohan Hovold .data = &sm8450_qmp_gen3x1_pciephy_cfg, 2403*cebc6ca7SJohan Hovold }, { 2404*cebc6ca7SJohan Hovold .compatible = "qcom,sm8450-qmp-gen4x2-pcie-phy", 2405*cebc6ca7SJohan Hovold .data = &sm8450_qmp_gen4x2_pciephy_cfg, 2406*cebc6ca7SJohan Hovold }, 2407*cebc6ca7SJohan Hovold { }, 2408*cebc6ca7SJohan Hovold }; 2409*cebc6ca7SJohan Hovold MODULE_DEVICE_TABLE(of, qmp_pcie_of_match_table); 2410*cebc6ca7SJohan Hovold 241127878615SJohan Hovold static struct platform_driver qmp_pcie_driver = { 241227878615SJohan Hovold .probe = qmp_pcie_probe, 241394a407ccSDmitry Baryshkov .driver = { 2414b35a5311SDmitry Baryshkov .name = "qcom-qmp-pcie-phy", 241527878615SJohan Hovold .of_match_table = qmp_pcie_of_match_table, 241694a407ccSDmitry Baryshkov }, 241794a407ccSDmitry Baryshkov }; 241894a407ccSDmitry Baryshkov 241927878615SJohan Hovold module_platform_driver(qmp_pcie_driver); 242094a407ccSDmitry Baryshkov 242194a407ccSDmitry Baryshkov MODULE_AUTHOR("Vivek Gautam <vivek.gautam@codeaurora.org>"); 2422b35a5311SDmitry Baryshkov MODULE_DESCRIPTION("Qualcomm QMP PCIe PHY driver"); 242394a407ccSDmitry Baryshkov MODULE_LICENSE("GPL v2"); 2424