xref: /openbmc/linux/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
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>
136c37a02bSJohan Hovold #include <linux/mfd/syscon.h>
1494a407ccSDmitry Baryshkov #include <linux/module.h>
1594a407ccSDmitry Baryshkov #include <linux/of.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>
206c37a02bSJohan Hovold #include <linux/regmap.h>
2194a407ccSDmitry Baryshkov #include <linux/regulator/consumer.h>
2294a407ccSDmitry Baryshkov #include <linux/reset.h>
2394a407ccSDmitry Baryshkov #include <linux/slab.h>
2494a407ccSDmitry Baryshkov 
2594a407ccSDmitry Baryshkov #include "phy-qcom-qmp.h"
26eb5793fbSDmitry Baryshkov #include "phy-qcom-qmp-pcs-misc-v3.h"
27eb5793fbSDmitry Baryshkov #include "phy-qcom-qmp-pcs-pcie-v4.h"
28eb5793fbSDmitry Baryshkov #include "phy-qcom-qmp-pcs-pcie-v4_20.h"
29eb5793fbSDmitry Baryshkov #include "phy-qcom-qmp-pcs-pcie-v5.h"
30eb5793fbSDmitry Baryshkov #include "phy-qcom-qmp-pcs-pcie-v5_20.h"
31354fc6c5SAbel Vesa #include "phy-qcom-qmp-pcs-pcie-v6.h"
32baf172ccSAbel Vesa #include "phy-qcom-qmp-pcs-pcie-v6_20.h"
33eb5793fbSDmitry Baryshkov #include "phy-qcom-qmp-pcie-qhp.h"
3494a407ccSDmitry Baryshkov 
3594a407ccSDmitry Baryshkov /* QPHY_SW_RESET bit */
3694a407ccSDmitry Baryshkov #define SW_RESET				BIT(0)
3794a407ccSDmitry Baryshkov /* QPHY_POWER_DOWN_CONTROL */
3894a407ccSDmitry Baryshkov #define SW_PWRDN				BIT(0)
3994a407ccSDmitry Baryshkov #define REFCLK_DRV_DSBL				BIT(1)
4094a407ccSDmitry Baryshkov /* QPHY_START_CONTROL bits */
4194a407ccSDmitry Baryshkov #define SERDES_START				BIT(0)
4294a407ccSDmitry Baryshkov #define PCS_START				BIT(1)
4394a407ccSDmitry Baryshkov /* QPHY_PCS_STATUS bit */
4494a407ccSDmitry Baryshkov #define PHYSTATUS				BIT(6)
4594a407ccSDmitry Baryshkov #define PHYSTATUS_4_20				BIT(7)
4694a407ccSDmitry Baryshkov 
4794a407ccSDmitry Baryshkov #define PHY_INIT_COMPLETE_TIMEOUT		10000
4894a407ccSDmitry Baryshkov 
4994a407ccSDmitry Baryshkov struct qmp_phy_init_tbl {
5094a407ccSDmitry Baryshkov 	unsigned int offset;
5194a407ccSDmitry Baryshkov 	unsigned int val;
5294a407ccSDmitry Baryshkov 	/*
5394a407ccSDmitry Baryshkov 	 * mask of lanes for which this register is written
5494a407ccSDmitry Baryshkov 	 * for cases when second lane needs different values
5594a407ccSDmitry Baryshkov 	 */
5694a407ccSDmitry Baryshkov 	u8 lane_mask;
5794a407ccSDmitry Baryshkov };
5894a407ccSDmitry Baryshkov 
5994a407ccSDmitry Baryshkov #define QMP_PHY_INIT_CFG(o, v)		\
6094a407ccSDmitry Baryshkov 	{				\
6194a407ccSDmitry Baryshkov 		.offset = o,		\
6294a407ccSDmitry Baryshkov 		.val = v,		\
6394a407ccSDmitry Baryshkov 		.lane_mask = 0xff,	\
6494a407ccSDmitry Baryshkov 	}
6594a407ccSDmitry Baryshkov 
6694a407ccSDmitry Baryshkov #define QMP_PHY_INIT_CFG_LANE(o, v, l)	\
6794a407ccSDmitry Baryshkov 	{				\
6894a407ccSDmitry Baryshkov 		.offset = o,		\
6994a407ccSDmitry Baryshkov 		.val = v,		\
7094a407ccSDmitry Baryshkov 		.lane_mask = l,		\
7194a407ccSDmitry Baryshkov 	}
7294a407ccSDmitry Baryshkov 
7394a407ccSDmitry Baryshkov /* set of registers with offsets different per-PHY */
7494a407ccSDmitry Baryshkov enum qphy_reg_layout {
7594a407ccSDmitry Baryshkov 	/* PCS registers */
7694a407ccSDmitry Baryshkov 	QPHY_SW_RESET,
7794a407ccSDmitry Baryshkov 	QPHY_START_CTRL,
7894a407ccSDmitry Baryshkov 	QPHY_PCS_STATUS,
7994a407ccSDmitry Baryshkov 	QPHY_PCS_POWER_DOWN_CONTROL,
8094a407ccSDmitry Baryshkov 	/* Keep last to ensure regs_layout arrays are properly initialized */
8194a407ccSDmitry Baryshkov 	QPHY_LAYOUT_SIZE
8294a407ccSDmitry Baryshkov };
8394a407ccSDmitry Baryshkov 
84bbe207a1SDmitry Baryshkov static const unsigned int pciephy_v2_regs_layout[QPHY_LAYOUT_SIZE] = {
85027d16b5SDmitry Baryshkov 	[QPHY_SW_RESET]			= QPHY_V2_PCS_SW_RESET,
86027d16b5SDmitry Baryshkov 	[QPHY_START_CTRL]		= QPHY_V2_PCS_START_CONTROL,
87027d16b5SDmitry Baryshkov 	[QPHY_PCS_STATUS]		= QPHY_V2_PCS_PCI_PCS_STATUS,
88027d16b5SDmitry Baryshkov 	[QPHY_PCS_POWER_DOWN_CONTROL]	= QPHY_V2_PCS_POWER_DOWN_CONTROL,
8994a407ccSDmitry Baryshkov };
9094a407ccSDmitry Baryshkov 
91bbe207a1SDmitry Baryshkov static const unsigned int pciephy_v3_regs_layout[QPHY_LAYOUT_SIZE] = {
92027d16b5SDmitry Baryshkov 	[QPHY_SW_RESET]			= QPHY_V3_PCS_SW_RESET,
93027d16b5SDmitry Baryshkov 	[QPHY_START_CTRL]		= QPHY_V3_PCS_START_CONTROL,
94027d16b5SDmitry Baryshkov 	[QPHY_PCS_STATUS]		= QPHY_V3_PCS_PCS_STATUS,
95027d16b5SDmitry Baryshkov 	[QPHY_PCS_POWER_DOWN_CONTROL]	= QPHY_V3_PCS_POWER_DOWN_CONTROL,
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 
105bbe207a1SDmitry Baryshkov static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = {
106027d16b5SDmitry Baryshkov 	[QPHY_SW_RESET]			= QPHY_V4_PCS_SW_RESET,
107027d16b5SDmitry Baryshkov 	[QPHY_START_CTRL]		= QPHY_V4_PCS_START_CONTROL,
108027d16b5SDmitry Baryshkov 	[QPHY_PCS_STATUS]		= QPHY_V4_PCS_PCS_STATUS1,
109027d16b5SDmitry Baryshkov 	[QPHY_PCS_POWER_DOWN_CONTROL]	= QPHY_V4_PCS_POWER_DOWN_CONTROL,
11094a407ccSDmitry Baryshkov };
11194a407ccSDmitry Baryshkov 
112bbe207a1SDmitry Baryshkov static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = {
113bbe207a1SDmitry Baryshkov 	[QPHY_SW_RESET]			= QPHY_V5_PCS_SW_RESET,
114bbe207a1SDmitry Baryshkov 	[QPHY_START_CTRL]		= QPHY_V5_PCS_START_CONTROL,
115bbe207a1SDmitry Baryshkov 	[QPHY_PCS_STATUS]		= QPHY_V5_PCS_PCS_STATUS1,
116bbe207a1SDmitry Baryshkov 	[QPHY_PCS_POWER_DOWN_CONTROL]	= QPHY_V5_PCS_POWER_DOWN_CONTROL,
117bbe207a1SDmitry Baryshkov };
118bbe207a1SDmitry Baryshkov 
11994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_serdes_tbl[] = {
12094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
12194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30),
12294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x0f),
12394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06),
12494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x01),
12594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL, 0x20),
12694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x00),
12794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01),
12894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xc9),
12994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER1, 0xff),
13094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER2, 0x3f),
13194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x01),
13294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00),
13394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORECLK_DIV_MODE0, 0x0a),
13494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_EP_DIV, 0x19),
13594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_ENABLE1, 0x90),
13694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82),
13794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START3_MODE0, 0x03),
13894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START2_MODE0, 0x55),
13994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START1_MODE0, 0x55),
14094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP3_MODE0, 0x00),
14194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x0d),
14294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0x04),
14394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x00),
14494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x08),
14594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16),
14694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x34),
14794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06),
14894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x33),
14994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02),
15094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_BUF_ENABLE, 0x07),
15194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x04),
15294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00),
15394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f),
15494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_BG_TIMER, 0x09),
15594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_EN_CENTER, 0x01),
15694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER1, 0x40),
15794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER2, 0x01),
15894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER1, 0x02),
15994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER2, 0x00),
16094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE1, 0x7e),
16194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE2, 0x15),
16294a407ccSDmitry Baryshkov };
16394a407ccSDmitry Baryshkov 
16494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_tx_tbl[] = {
16594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x02),
16694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12),
16794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10),
16894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x06),
16994a407ccSDmitry Baryshkov };
17094a407ccSDmitry Baryshkov 
17194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_rx_tbl[] = {
17294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03),
17394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_ENABLES, 0x1c),
17494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
17594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0a),
17694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04),
17794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1a),
17894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
17994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN, 0x04),
18094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN_HALF, 0x04),
18194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x00),
18294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80),
18394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_INTERFACE_MODE, 0x40),
18494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x71),
18594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x40),
18694a407ccSDmitry Baryshkov };
18794a407ccSDmitry Baryshkov 
18894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl msm8998_pcie_pcs_tbl[] = {
18994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_ENDPOINT_REFCLK_DRIVE, 0x04),
19094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_OSC_DTCT_ACTIONS, 0x00),
19194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x01),
19294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00),
19394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x20),
19494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00),
19594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x01),
19694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73),
19794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0x99),
19894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_SIGDET_CNTRL, 0x03),
19994a407ccSDmitry Baryshkov };
20094a407ccSDmitry Baryshkov 
20194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_serdes_tbl[] = {
20294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_PER1, 0x7d),
20394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_PER2, 0x01),
20494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE1_MODE0, 0x0a),
20594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE2_MODE0, 0x05),
20694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE1_MODE1, 0x08),
20794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE2_MODE1, 0x04),
20894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CLKBUFLR_EN, 0x18),
20994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90),
21094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SYS_CLK_CTRL, 0x02),
21194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_BUF_ENABLE, 0x07),
21294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_IVCO, 0x0f),
21394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE0, 0xd4),
21494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE0, 0x14),
21594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE1, 0xaa),
21694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE1, 0x29),
21794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TRIM, 0x0f),
21894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE0, 0x09),
21994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE1, 0x09),
22094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE0, 0x16),
22194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE1, 0x16),
22294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE0, 0x28),
22394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE1, 0x28),
22494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CTRL_BY_PSM, 0x01),
22594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_EN_SEL, 0x08),
22694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_RESETSM_CNTRL, 0x20),
22794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP_EN, 0x42),
22894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE0, 0x68),
22994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE1, 0x53),
23094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE0, 0xab),
23194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE0, 0xaa),
23294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE0, 0x02),
23394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE1, 0x55),
23494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE1, 0x55),
23594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE1, 0x05),
23694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE0, 0xa0),
23794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE1, 0xa0),
23894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE0, 0x24),
23994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE0, 0x02),
24094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE1, 0xb4),
24194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE1, 0x03),
24294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x32),
24394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x01),
24494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x00),
24594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CMN_CONFIG, 0x06),
24694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05),
24794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV_MODE1, 0x08),
24894a407ccSDmitry Baryshkov };
24994a407ccSDmitry Baryshkov 
25094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_tx_tbl[] = {
251079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x02),
252079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x06),
253079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12),
25494a407ccSDmitry Baryshkov };
25594a407ccSDmitry Baryshkov 
25694a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_rx_tbl[] = {
257079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c),
258079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x02),
259079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f),
260079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70),
261079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x61),
262079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04),
263079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1e),
264079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0),
265079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00),
266079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x73),
267079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80),
268079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c),
269079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03),
270079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
271079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xf0),
272079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x01),
273079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x2f),
274079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0xd3),
275079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x40),
276079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x01),
277079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x02),
278079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xc8),
279079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x09),
280079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb1),
281079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0x00),
282079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x02),
283079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xc8),
284079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x09),
285079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1),
286079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04),
28794a407ccSDmitry Baryshkov };
28894a407ccSDmitry Baryshkov 
28994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_pcs_tbl[] = {
29060f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNTRL1, 0x01),
29160f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d),
29260f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_G12S1_TXDEEMPH_M3P5DB, 0x10),
29360f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa),
29460f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
29560f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_DCC_CAL_CONFIG, 0x01),
29660f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x01),
297af664324SDmitry Baryshkov };
298af664324SDmitry Baryshkov 
299af664324SDmitry Baryshkov static const struct qmp_phy_init_tbl ipq6018_pcie_pcs_misc_tbl[] = {
30060f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG2, 0x0d),
30160f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07),
30260f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
30360f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
30460f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
30560f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
30660f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG1, 0x11),
30760f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00),
30860f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58),
30994a407ccSDmitry Baryshkov };
31094a407ccSDmitry Baryshkov 
31194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = {
31294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x18),
31394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CLK_ENABLE1, 0x10),
31494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf),
31594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1),
31694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0),
31794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff),
31894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f),
31994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6),
32094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf),
32194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0),
32294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SVS_MODE_CLK_SEL, 0x1),
32394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CORE_CLK_EN, 0x20),
32494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CORECLK_DIV, 0xa),
32594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_RESETSM_CNTRL, 0x20),
32694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0xa),
32794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0xa),
32894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x82),
32994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x3),
33094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x55),
33194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x55),
33294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x0),
33394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0xD),
33494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0xD04),
33594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x33),
33694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SYS_CLK_CTRL, 0x2),
33794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_BUF_ENABLE, 0x1f),
33894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CP_CTRL_MODE0, 0xb),
33994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_PLL_RCTRL_MODE0, 0x16),
34094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_PLL_CCTRL_MODE0, 0x28),
34194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0),
34294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80),
34394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1),
34494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1),
34594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31),
34694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1),
34794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER1, 0x2),
34894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER2, 0x0),
34994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f),
35094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19),
35194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19),
35294a407ccSDmitry Baryshkov };
35394a407ccSDmitry Baryshkov 
35494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = {
35594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN, 0x45),
35694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6),
35794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2),
35894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12),
359f7c5cedbSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_TX_TX_EMP_POST1_LVL, 0x36),
36094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a),
36194a407ccSDmitry Baryshkov };
36294a407ccSDmitry Baryshkov 
36394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = {
36494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_ENABLES, 0x1c),
36594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
36694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2, 0x1),
36794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL3, 0x0),
36894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb),
36994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
37094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4),
37194a407ccSDmitry Baryshkov };
37294a407ccSDmitry Baryshkov 
37394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = {
3746cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_ENDPOINT_REFCLK_DRIVE, 0x4),
3756cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_OSC_DTCT_ACTIONS, 0x0),
3766cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x40),
3776cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x0),
3786cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x40),
3796cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME_AUXCLK_LSB, 0x0),
3806cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x40),
381c1ab64aaSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73),
3826cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_RX_SIGDET_LVL, 0x99),
3836cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_TXDEEMPH_M6DB_V0, 0x15),
3846cad2983SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V2_PCS_TXDEEMPH_M3P5DB_V0, 0xe),
38594a407ccSDmitry Baryshkov };
38694a407ccSDmitry Baryshkov 
387334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_serdes_tbl[] = {
388334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CLKBUFLR_EN, 0x18),
389334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CTRL_BY_PSM, 0x01),
390334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x31),
391334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_IVCO, 0x0f),
392334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TRIM, 0x0f),
393334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CMN_CONFIG, 0x06),
394334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP_EN, 0x42),
395334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_RESETSM_CNTRL, 0x20),
396334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x01),
397334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_MAP, 0x04),
398334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05),
399334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_TIMER1, 0xff),
400334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_TIMER2, 0x3f),
401334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x30),
402334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x21),
403334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE0, 0x82),
404334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE0, 0x03),
405334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE0, 0x355),
406334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE0, 0x35555),
407334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE0, 0x1a),
408334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE0, 0x1a0a),
409334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE0, 0xb),
410334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE0, 0x16),
411334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE0, 0x28),
412334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN1_MODE0, 0x0),
413334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE0, 0x40),
414334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE0, 0x02),
415334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE0, 0x24),
416334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05),
417334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x20),
418334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV, 0xa),
419334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x32),
420334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SYS_CLK_CTRL, 0x02),
421334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_BUF_ENABLE, 0x07),
422334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_EN_SEL, 0x08),
423334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TIMER, 0xa),
424334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x1),
425334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE1, 0x68),
426334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE1, 0x2),
427334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE1, 0x2aa),
428334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE1, 0x2aaab),
429334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90),
430334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE1, 0x34),
431334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE1, 0x3414),
432334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE1, 0x0b),
433334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE1, 0x16),
434334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE1, 0x28),
435334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN1_MODE1, 0x0),
436334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE1, 0x40),
437334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE1, 0x03),
438334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE1, 0xb4),
439334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05),
440334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x0),
441334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV_MODE1, 0x08),
442334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_EP_DIV_MODE0, 0x19),
443334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_EP_DIV_MODE1, 0x28),
444334fad18SRobert Marko 	QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90),
445334fad18SRobert Marko };
446334fad18SRobert Marko 
447334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_tx_tbl[] = {
448079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x02),
449079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12),
450079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_HIGHZ_DRVR_EN, 0x10),
451079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x06),
452334fad18SRobert Marko };
453334fad18SRobert Marko 
454334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_rx_tbl[] = {
455079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03),
456079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c),
457079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
458079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0xe),
459079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4),
460079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1b),
461079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04),
462079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f),
463079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70),
464079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x73),
465079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80),
466079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0x00),
467079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x02),
468079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xc8),
469079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x09),
470079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0xb1),
471079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x01),
472079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0x02),
473079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xc8),
474079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x09),
475079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0xb1),
476079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xf0),
477079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0x2),
478079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0x2f),
479079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0xd3),
480079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x40),
481079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00),
482079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0),
483079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c),
484079328a9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x02),
485334fad18SRobert Marko };
486334fad18SRobert Marko 
487334fad18SRobert Marko static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_pcs_tbl[] = {
48860f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNTRL2, 0x83),
48960f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNT_VAL_L, 0x9),
49060f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNT_VAL_H_TOL, 0x42),
49160f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_MAN_CODE, 0x40),
49260f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_FLL_CNTRL1, 0x01),
49360f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_H, 0x0),
49460f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x1),
4952584068aSChristian Marangi 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_G12S1_TXDEEMPH_M3P5DB, 0x10),
4962584068aSChristian Marangi 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_DCC_CAL_CONFIG, 0x01),
4972584068aSChristian Marangi 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa),
4982584068aSChristian Marangi 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d),
4992584068aSChristian Marangi };
5002584068aSChristian Marangi 
5012584068aSChristian Marangi static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_pcs_misc_tbl[] = {
50260f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x0),
50360f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_H, 0x00),
50460f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
50560f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_H, 0x00),
50660f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
50760f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG1, 0x11),
50860f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG2, 0xb),
50960f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07),
51060f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_CONFIG2, 0x52),
51160f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_MODE2_CONFIG2, 0x50),
51260f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_MODE2_CONFIG4, 0x1a),
51360f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5, 0x6),
51460f23414SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
515334fad18SRobert Marko };
516334fad18SRobert Marko 
51794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = {
51894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
51994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30),
52094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_IVCO, 0x007),
52194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_CONFIG, 0x06),
52294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP_EN, 0x01),
52394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_RESETSM_CNTRL, 0x20),
52494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_MAP, 0x00),
52594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE2_MODE0, 0x01),
52694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE1_MODE0, 0xc9),
52794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER1, 0xff),
52894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_VCO_TUNE_TIMER2, 0x3f),
52994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SVS_MODE_CLK_SEL, 0x01),
53094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORE_CLK_EN, 0x00),
53194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CORECLK_DIV_MODE0, 0x0a),
53294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_EP_DIV, 0x19),
53394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_ENABLE1, 0x90),
53494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DEC_START_MODE0, 0x82),
53594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START3_MODE0, 0x02),
53694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START2_MODE0, 0xea),
53794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_DIV_FRAC_START1_MODE0, 0xab),
53894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP3_MODE0, 0x00),
53994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP2_MODE0, 0x0d),
54094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_LOCK_CMP1_MODE0, 0x04),
54194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_HSCLK_SEL, 0x00),
54294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CP_CTRL_MODE0, 0x06),
54394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_RCTRL_MODE0, 0x16),
54494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_PLL_CCTRL_MODE0, 0x36),
54594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CMN_MODE, 0x01),
54694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x33),
54794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYS_CLK_CTRL, 0x02),
54894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_BUF_ENABLE, 0x06),
54994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SYSCLK_EN_SEL, 0x04),
55094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN1_MODE0, 0x00),
55194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_INTEGLOOP_GAIN0_MODE0, 0x3f),
55294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_BG_TIMER, 0x09),
55394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_EN_CENTER, 0x01),
55494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER1, 0x40),
55594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_PER2, 0x01),
55694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER1, 0x02),
55794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_ADJ_PER2, 0x00),
55894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE1, 0x7e),
55994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_COM_SSC_STEP_SIZE2, 0x15),
56094a407ccSDmitry Baryshkov };
56194a407ccSDmitry Baryshkov 
56294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_tx_tbl[] = {
56394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_RES_CODE_LANE_OFFSET_TX, 0x02),
56494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_RCV_DETECT_LVL_2, 0x12),
56594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_HIGHZ_DRVR_EN, 0x10),
56694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_TX_LANE_MODE_1, 0x06),
56794a407ccSDmitry Baryshkov };
56894a407ccSDmitry Baryshkov 
56994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_rx_tbl[] = {
57094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_CNTRL, 0x03),
57194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_ENABLES, 0x10),
57294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
57394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0e),
57494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL3, 0x04),
57594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL4, 0x1a),
57694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b),
57794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN, 0x04),
57894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_SO_GAIN_HALF, 0x04),
57994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x71),
58094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_MODE_00, 0x59),
58194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_MODE_01, 0x59),
58294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x80),
58394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_INTERFACE_MODE, 0x40),
58494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_PI_CONTROLS, 0x71),
58594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_COUNT_LOW, 0x40),
58694a407ccSDmitry Baryshkov };
58794a407ccSDmitry Baryshkov 
58894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_pcs_tbl[] = {
58994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_ENDPOINT_REFCLK_DRIVE, 0x04),
59094a407ccSDmitry Baryshkov 
59194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL2, 0x83),
59294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_L, 0x09),
59394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNT_VAL_H_TOL, 0xa2),
59494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_MAN_CODE, 0x40),
59594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_FLL_CNTRL1, 0x02),
59694a407ccSDmitry Baryshkov 
59794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_OSC_DTCT_ACTIONS, 0x00),
59894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x01),
59994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00),
60094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x20),
60194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x00),
60294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x01),
60394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73),
60494a407ccSDmitry Baryshkov 
60594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_RX_SIGDET_LVL, 0xbb),
60694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_SIGDET_CNTRL, 0x03),
60794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_REFGEN_REQ_CONFIG1, 0x0d),
60894a407ccSDmitry Baryshkov 
60994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_POWER_STATE_CONFIG4, 0x00),
61094a407ccSDmitry Baryshkov };
61194a407ccSDmitry Baryshkov 
61294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qmp_pcie_pcs_misc_tbl[] = {
61394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_CONFIG2, 0x52),
61494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG2, 0x10),
61594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG4, 0x1a),
61694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_OSC_DTCT_MODE2_CONFIG5, 0x06),
61794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V3_PCS_MISC_PCIE_INT_AUX_CLK_CONFIG1, 0x00),
61894a407ccSDmitry Baryshkov };
61994a407ccSDmitry Baryshkov 
62094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_serdes_tbl[] = {
62194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SYSCLK_EN_SEL, 0x27),
62294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_EN_CENTER, 0x01),
62394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_PER1, 0x31),
62494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_PER2, 0x01),
62594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE1, 0xde),
62694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE2, 0x07),
62794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE1_MODE1, 0x4c),
62894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SSC_STEP_SIZE2_MODE1, 0x06),
62994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_BIAS_EN_CKBUFLR_EN, 0x18),
63094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CLK_ENABLE1, 0xb0),
63194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP1_MODE0, 0x8c),
63294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP2_MODE0, 0x20),
63394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP1_MODE1, 0x14),
63494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP2_MODE1, 0x34),
63594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CP_CTRL_MODE0, 0x06),
63694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CP_CTRL_MODE1, 0x06),
63794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_RCTRL_MODE0, 0x16),
63894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_RCTRL_MODE1, 0x16),
63994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_CCTRL_MODE0, 0x36),
64094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_PLL_CCTRL_MODE1, 0x36),
64194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_RESTRIM_CTRL2, 0x05),
64294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_LOCK_CMP_EN, 0x42),
64394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DEC_START_MODE0, 0x82),
64494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DEC_START_MODE1, 0x68),
64594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START1_MODE0, 0x55),
64694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START2_MODE0, 0x55),
64794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START3_MODE0, 0x03),
64894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START1_MODE1, 0xab),
64994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START2_MODE1, 0xaa),
65094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_DIV_FRAC_START3_MODE1, 0x02),
65194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_INTEGLOOP_GAIN0_MODE0, 0x3f),
65294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_INTEGLOOP_GAIN0_MODE1, 0x3f),
65394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_VCO_TUNE_MAP, 0x10),
65494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CLK_SELECT, 0x04),
65594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_HSCLK_SEL1, 0x30),
65694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CORECLK_DIV, 0x04),
65794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CORE_CLK_EN, 0x73),
65894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CMN_CONFIG, 0x0c),
65994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_SVS_MODE_CLK_SEL, 0x15),
66094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CORECLK_DIV_MODE1, 0x04),
66194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_CMN_MODE, 0x01),
66294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_VREGCLK_DIV1, 0x22),
66394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_VREGCLK_DIV2, 0x00),
66494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_BGV_TRIM, 0x20),
66594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_COM_BG_CTRL, 0x07),
66694a407ccSDmitry Baryshkov };
66794a407ccSDmitry Baryshkov 
66894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_tx_tbl[] = {
66994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_CTRL0, 0x00),
67094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_TAP_EN, 0x0d),
67194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_TX_BAND_MODE, 0x01),
67294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_LANE_MODE, 0x1a),
67394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PARALLEL_RATE, 0x2f),
67494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CML_CTRL_MODE0, 0x09),
67594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CML_CTRL_MODE1, 0x09),
67694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CML_CTRL_MODE2, 0x1b),
67794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PREAMP_CTRL_MODE1, 0x01),
67894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PREAMP_CTRL_MODE2, 0x07),
67994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_MIXER_CTRL_MODE0, 0x31),
68094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_MIXER_CTRL_MODE1, 0x31),
68194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_MIXER_CTRL_MODE2, 0x03),
68294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CTLE_THRESH_DFE, 0x02),
68394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CGA_THRESH_DFE, 0x00),
68494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXENGINE_EN0, 0x12),
68594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CTLE_TRAIN_TIME, 0x25),
68694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_CTLE_DFE_OVRLP_TIME, 0x00),
68794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DFE_REFRESH_TIME, 0x05),
68894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DFE_ENABLE_TIME, 0x01),
68994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_VGA_GAIN, 0x26),
69094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DFE_GAIN, 0x12),
69194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_EQ_GAIN, 0x04),
69294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_OFFSET_GAIN, 0x04),
69394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PRE_GAIN, 0x09),
69494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_EQ_INTVAL, 0x15),
69594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_EDAC_INITVAL, 0x28),
69694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXEQ_INITB0, 0x7f),
69794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXEQ_INITB1, 0x07),
69894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RCVRDONE_THRESH1, 0x04),
69994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RXEQ_CTRL, 0x70),
70094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_FO_GAIN_MODE0, 0x8b),
70194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_FO_GAIN_MODE1, 0x08),
70294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_FO_GAIN_MODE2, 0x0a),
70394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_GAIN_MODE0, 0x03),
70494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_GAIN_MODE1, 0x04),
70594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_GAIN_MODE2, 0x04),
70694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_UCDR_SO_CONFIG, 0x0c),
70794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_BAND, 0x02),
70894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RCVR_PATH1_MODE0, 0x5c),
70994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RCVR_PATH1_MODE1, 0x3e),
71094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RCVR_PATH1_MODE2, 0x3f),
71194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_SIGDET_ENABLES, 0x01),
71294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_SIGDET_CNTRL, 0xa0),
71394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_SIGDET_DEGLITCH_CNTRL, 0x08),
71494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DCC_GAIN, 0x01),
71594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_EN_SIGNAL, 0xc3),
71694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_PSM_RX_EN_CAL, 0x00),
71794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_MISC_CNTRL0, 0xbc),
71894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_TS0_TIMER, 0x7f),
71994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DLL_HIGHDATARATE, 0x15),
72094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_CTRL1, 0x0c),
72194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_DRVR_CTRL2, 0x0f),
72294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RX_RESETCODE_OFFSET, 0x04),
72394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_VGA_INITVAL, 0x20),
72494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_L0_RSM_START, 0x01),
72594a407ccSDmitry Baryshkov };
72694a407ccSDmitry Baryshkov 
72794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdm845_qhp_pcie_pcs_tbl[] = {
72894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_POWER_STATE_CONFIG, 0x3f),
72994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_PCS_TX_RX_CONFIG, 0x50),
73094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_MAIN_V0_M3P5DB, 0x19),
73194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_POST_V0_M3P5DB, 0x07),
73294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_MAIN_V0_M6DB, 0x17),
73394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_TXMGN_POST_V0_M6DB, 0x09),
73494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(PCIE_GEN3_QHP_PHY_POWER_STATE_CONFIG5, 0x9f),
73594a407ccSDmitry Baryshkov };
73694a407ccSDmitry Baryshkov 
73794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_serdes_tbl[] = {
73894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x08),
73994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_SELECT, 0x34),
74094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08),
74194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f),
74294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x42),
74394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24),
74494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x03),
74594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0xb4),
74694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02),
74794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11),
74894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82),
74994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x03),
75094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0x55),
75194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0x55),
75294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x1a),
75394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x0a),
75494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x68),
75594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02),
75694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xaa),
75794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab),
75894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x34),
75994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x14),
76094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01),
76194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06),
76294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16),
76394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36),
76494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06),
76594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16),
76694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36),
76794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e),
76894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca),
76994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18),
77094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2),
77194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x07),
77294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01),
77394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31),
77494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01),
77594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde),
77694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07),
77794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0x4c),
77894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x06),
77994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_ENABLE1, 0x90),
78094a407ccSDmitry Baryshkov };
78194a407ccSDmitry Baryshkov 
78294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_tx_tbl[] = {
78394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12),
78494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x5),
78594a407ccSDmitry Baryshkov };
78694a407ccSDmitry Baryshkov 
78794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_rx_tbl[] = {
78894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03),
78994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c),
79094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
79194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x07),
79294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x6e),
79394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x6e),
79494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x4a),
79594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04),
79694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f),
79794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70),
79894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17),
79994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x54),
80094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x37),
80194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xd4),
80294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x54),
80394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xdb),
80494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x39),
80594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0x31),
80694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x24),
80794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xe4),
80894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xec),
80994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x39),
81094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x36),
81194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x7f),
81294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH, 0xff),
81394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff),
81494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0xdb),
81594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x75),
81694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00),
81794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0),
81894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0xa0),
81994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RCLK_AUXDATA_SEL, 0xc0),
82094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c),
82194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x05),
82294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c),
82394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x03),
82494a407ccSDmitry Baryshkov };
82594a407ccSDmitry Baryshkov 
82694a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_pcs_tbl[] = {
82794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
82894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0xaa),
82994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RATE_SLEW_CNTRL1, 0x0b),
83094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d),
83194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x01),
83294a407ccSDmitry Baryshkov };
83394a407ccSDmitry Baryshkov 
83494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sc8180x_qmp_pcie_pcs_misc_tbl[] = {
83594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
83694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
83794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
83894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00),
83994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00),
84094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58),
84194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
84294a407ccSDmitry Baryshkov };
84394a407ccSDmitry Baryshkov 
844d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_pcie_serdes_tbl[] = {
845d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_EN_CENTER, 0x00),
846d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31),
847d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01),
848d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde),
849d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07),
850d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x4c),
851d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x06),
852d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90),
853d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f),
854d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06),
855d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06),
856d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16),
857d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16),
858d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36),
859d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36),
860d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08),
861d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x42),
862d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a),
863d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a),
864d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14),
865d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34),
866d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82),
867d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x68),
868d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55),
869d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55),
870d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03),
871d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0xab),
872d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0xaa),
873d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x02),
874d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02),
875d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE1_MODE0, 0x24),
876d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE1_MODE1, 0xb4),
877d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE2_MODE1, 0x03),
878d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34),
879d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x01),
880d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x08),
881d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xb9),
882d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e),
883d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0x94),
884d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18),
885d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_HSCLK_SEL, 0x11),
886d0a846baSJohan Hovold };
887d0a846baSJohan Hovold 
888d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x1_pcie_rc_serdes_tbl[] = {
889d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_BUF_ENABLE, 0x07),
890d0a846baSJohan Hovold };
891d0a846baSJohan Hovold 
892d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x2_pcie_rc_serdes_tbl[] = {
893d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
894d0a846baSJohan Hovold };
895d0a846baSJohan Hovold 
8966c37a02bSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x4_pcie_serdes_4ln_tbl[] = {
8976c37a02bSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x1c),
8986c37a02bSJohan Hovold };
8996c37a02bSJohan Hovold 
900d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x1_pcie_tx_tbl[] = {
901d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_PI_QEC_CTRL, 0x20),
902d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0x75),
903d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x3f),
904d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x1d),
905d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x0c),
906d0a846baSJohan Hovold };
907d0a846baSJohan Hovold 
908d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x1_pcie_rx_tbl[] = {
909d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_LOW, 0x7f),
910d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH, 0xff),
911d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0xbf),
912d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3f),
913d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH4, 0xd8),
914d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_LOW, 0xdc),
915d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH, 0xdc),
916d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH2, 0x5c),
917d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH3, 0x34),
918d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH4, 0xa6),
919d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_TX_ADAPT_POST_THRESH, 0xf0),
920d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_10_HIGH3, 0x34),
921d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x07),
922d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00),
923d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH1, 0x08),
924d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH2, 0x08),
925d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0xf0),
926d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
927d0a846baSJohan Hovold };
928d0a846baSJohan Hovold 
929d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x1_pcie_pcs_tbl[] = {
930d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x05),
931d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0x77),
932d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RATE_SLEW_CNTRL1, 0x0b),
933d0a846baSJohan Hovold };
934d0a846baSJohan Hovold 
935d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x1_pcie_pcs_misc_tbl[] = {
936d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
937d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00),
938d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_EQ_CONFIG2, 0x0f),
939d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
940d0a846baSJohan Hovold };
941d0a846baSJohan Hovold 
942d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x2_pcie_tx_tbl[] = {
943d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG_LANE(QSERDES_V5_TX_PI_QEC_CTRL, 0x02, 1),
944d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG_LANE(QSERDES_V5_TX_PI_QEC_CTRL, 0x04, 2),
945d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0xd5),
946d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x3f),
947d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x11),
948d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x0c),
949d0a846baSJohan Hovold };
950d0a846baSJohan Hovold 
951d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x2_pcie_rx_tbl[] = {
952d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_LOW, 0x7f),
953d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH, 0xff),
954d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0x7f),
955d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x34),
956d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH4, 0xd8),
957d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_LOW, 0xdc),
958d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH, 0xdc),
959d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH2, 0x5c),
960d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH3, 0x34),
961d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH4, 0xa6),
962d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_10_HIGH3, 0x34),
963d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x0f),
964d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00),
965d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH1, 0x08),
966d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH2, 0x08),
967d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0xf0),
968d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
969d0a846baSJohan Hovold };
970d0a846baSJohan Hovold 
971d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x2_pcie_pcs_tbl[] = {
972d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x05),
973d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0x88),
974d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RATE_SLEW_CNTRL1, 0x0b),
975d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_EQ_CONFIG3, 0x0f),
976d0a846baSJohan Hovold };
977d0a846baSJohan Hovold 
978d0a846baSJohan Hovold static const struct qmp_phy_init_tbl sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl[] = {
979d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG2, 0x1d),
980d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG4, 0x07),
981d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
982d0a846baSJohan Hovold 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
983d0a846baSJohan Hovold };
984d0a846baSJohan Hovold 
98594a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_serdes_tbl[] = {
98694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x08),
98794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_SELECT, 0x34),
98894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x08),
98994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f),
99094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x42),
99194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE0, 0x24),
99294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE2_MODE1, 0x03),
99394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE1_MODE1, 0xb4),
99494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02),
99594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x11),
99694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x82),
99794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x03),
99894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE0, 0x55),
99994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE0, 0x55),
100094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x1a),
100194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x0a),
100294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x68),
100394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x02),
100494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0xaa),
100594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0xab),
100694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x34),
100794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x14),
100894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x01),
100994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06),
101094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16),
101194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36),
101294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06),
101394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16),
101494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36),
101594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e),
101694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca),
101794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18),
101894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2),
101994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01),
102094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31),
102194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01),
102294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xde),
102394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x07),
102494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0x4c),
102594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x06),
102694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_ENABLE1, 0x90),
102794a407ccSDmitry Baryshkov };
102894a407ccSDmitry Baryshkov 
102994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_serdes_tbl[] = {
103094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_BUF_ENABLE, 0x07),
103194a407ccSDmitry Baryshkov };
103294a407ccSDmitry Baryshkov 
103394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_tx_tbl[] = {
103494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RCV_DETECT_LVL_2, 0x12),
103594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_LANE_MODE_1, 0x35),
103694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_RES_CODE_LANE_OFFSET_TX, 0x11),
103794a407ccSDmitry Baryshkov };
103894a407ccSDmitry Baryshkov 
103994a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_rx_tbl[] = {
104094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_FO_GAIN, 0x0c),
104194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_GAIN, 0x03),
104294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_GM_CAL, 0x1b),
104394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_HIGH, 0x00),
104494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_IDAC_TSETTLE_LOW, 0xc0),
104594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_AUX_DATA_TCOARSE_TFINE, 0x30),
104694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL1, 0x04),
104794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_VGA_CAL_CNTRL2, 0x07),
104894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x7f),
104994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_UCDR_PI_CONTROLS, 0x70),
105094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0e),
105194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a),
105294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0f),
105394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_CNTRL, 0x03),
105494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_ENABLES, 0x1c),
105594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_SIGDET_DEGLITCH_CNTRL, 0x1e),
105694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x17),
105794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_LOW, 0xd4),
105894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH, 0x54),
105994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH2, 0xdb),
106094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH3, 0x3b),
106194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_10_HIGH4, 0x31),
106294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_LOW, 0x24),
106394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH2, 0xff),
106494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH3, 0x7f),
106594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DCC_CTRL1, 0x0c),
106694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH, 0xe4),
106794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH2, 0xec),
106894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH3, 0x3b),
106994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_01_HIGH4, 0x36),
107094a407ccSDmitry Baryshkov };
107194a407ccSDmitry Baryshkov 
107294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_rx_tbl[] = {
107394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RCLK_AUXDATA_SEL, 0x00),
107494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x00),
107594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_EN_TIMER, 0x04),
107694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0x3f),
107794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x14),
107894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x30),
107994a407ccSDmitry Baryshkov };
108094a407ccSDmitry Baryshkov 
108194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_pcs_tbl[] = {
108294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_P2U3_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
108394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RX_SIGDET_LVL, 0x77),
108494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_RATE_SLEW_CNTRL1, 0x0b),
108594a407ccSDmitry Baryshkov };
108694a407ccSDmitry Baryshkov 
108794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_pcs_tbl[] = {
108894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x0d),
108994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG5, 0x12),
109094a407ccSDmitry Baryshkov };
109194a407ccSDmitry Baryshkov 
109294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_pcie_pcs_misc_tbl[] = {
109394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
109494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
109594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01),
109694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P6_P7_PRE, 0x33),
109794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_PRE, 0x00),
109894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_PRESET_P10_POST, 0x58),
109994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
110094a407ccSDmitry Baryshkov };
110194a407ccSDmitry Baryshkov 
110294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x1_pcie_pcs_misc_tbl[] = {
110394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00),
110494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_EQ_CONFIG2, 0x0f),
110594a407ccSDmitry Baryshkov };
110694a407ccSDmitry Baryshkov 
110794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_tx_tbl[] = {
110894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_TX_PI_QEC_CTRL, 0x20),
110994a407ccSDmitry Baryshkov };
111094a407ccSDmitry Baryshkov 
111194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_rx_tbl[] = {
111294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_EQU_ADAPTOR_CNTRL1, 0x04),
111394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_LOW, 0xbf),
111494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_RX_MODE_00_HIGH4, 0x15),
111594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
111694a407ccSDmitry Baryshkov };
111794a407ccSDmitry Baryshkov 
111894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_pcs_tbl[] = {
111994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_REFGEN_REQ_CONFIG1, 0x05),
112094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_EQ_CONFIG2, 0x0f),
112194a407ccSDmitry Baryshkov };
112294a407ccSDmitry Baryshkov 
112394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8250_qmp_gen3x2_pcie_pcs_misc_tbl[] = {
112494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG2, 0x0d),
112594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_POWER_STATE_CONFIG4, 0x07),
112694a407ccSDmitry Baryshkov };
112794a407ccSDmitry Baryshkov 
112894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_serdes_tbl[] = {
112994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIAS_EN_CLKBUFLR_EN, 0x18),
113094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_IVCO, 0x0f),
1131458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_EN, 0x46),
1132458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP_CFG, 0x04),
1133458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_TUNE_MAP, 0x02),
1134458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_SEL, 0x12),
1135458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_HSCLK_HS_SWITCH_SEL, 0x00),
1136458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE0, 0x05),
1137458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CORECLK_DIV_MODE1, 0x04),
1138458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_MISC1, 0x88),
1139458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_MISC2, 0x03),
1140458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_MODE, 0x17),
1141458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_VCO_DC_LEVEL_CTRL, 0x0b),
1142458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_HSCLK_SEL, 0x22),
1143458aa820SManivannan Sadhasivam };
1144458aa820SManivannan Sadhasivam 
1145364c748dSManivannan Sadhasivam static const struct qmp_phy_init_tbl sdx55_qmp_pcie_rc_serdes_tbl[] = {
1146364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_EN_CENTER, 0x01),
1147364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER1, 0x31),
1148364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_PER2, 0x01),
1149364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE0, 0xce),
1150364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE0, 0x0b),
1151364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE1_MODE1, 0x97),
1152364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SSC_STEP_SIZE2_MODE1, 0x0c),
1153364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_ENABLE1, 0x90),
1154364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_EP_DIV_MODE0, 0x0a),
1155364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_EP_DIV_MODE1, 0x10),
1156364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x06),
1157364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x06),
1158364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x16),
1159364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x16),
1160364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x36),
1161364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x36),
1162364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x08),
1163364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x04),
1164364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x0d),
1165364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0x0a),
1166364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x1a),
1167364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0xc3),
1168364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0xd0),
1169364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x05),
1170364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START1_MODE1, 0x55),
1171364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START2_MODE1, 0x55),
1172364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE1, 0x05),
1173364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CLK_SELECT, 0x34),
1174364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca),
1175364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e),
1176364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xd8),
1177364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x20),
1178364c748dSManivannan Sadhasivam };
1179364c748dSManivannan Sadhasivam 
1180458aa820SManivannan Sadhasivam static const struct qmp_phy_init_tbl sdx55_qmp_pcie_ep_serdes_tbl[] = {
1181458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BG_TIMER, 0x02),
1182458aa820SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYS_CLK_CTRL, 0x07),
118394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE0, 0x0a),
118494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CP_CTRL_MODE1, 0x0a),
118594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE0, 0x19),
118694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_RCTRL_MODE1, 0x19),
118794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE0, 0x03),
118894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_PLL_CCTRL_MODE1, 0x03),
118994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_SYSCLK_EN_SEL, 0x00),
119094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE0, 0x7f),
119194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE0, 0x02),
119294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP1_MODE1, 0xff),
119394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_LOCK_CMP2_MODE1, 0x04),
119494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE0, 0x4b),
119594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DEC_START_MODE1, 0x50),
119694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_DIV_FRAC_START3_MODE0, 0x00),
119794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN0_MODE0, 0xfb),
119894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN1_MODE0, 0x01),
119994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN0_MODE1, 0xfb),
120094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_INTEGLOOP_GAIN1_MODE1, 0x01),
120194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_CMN_CONFIG, 0x04),
120294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0x56),
120394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1d),
120494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0x4b),
120594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x1f),
120694a407ccSDmitry Baryshkov };
120794a407ccSDmitry Baryshkov 
120894a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_tx_tbl[] = {
120994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_LANE_MODE_1, 0x05),
121094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_LANE_MODE_2, 0xf6),
121194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_LANE_MODE_3, 0x13),
121294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_VMODE_CTRL1, 0x00),
121394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_TX_PI_QEC_CTRL, 0x00),
121494a407ccSDmitry Baryshkov };
121594a407ccSDmitry Baryshkov 
121694a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_rx_tbl[] = {
121794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_FO_GAIN_RATE2, 0x0c),
121894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_UCDR_PI_CONTROLS, 0x16),
121994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_AUX_DATA_TCOARSE_TFINE, 0x7f),
122094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_3, 0x55),
122194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_DAC_ENABLE1, 0x0c),
122294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_DAC_ENABLE2, 0x00),
122394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_VGA_CAL_CNTRL2, 0x08),
122494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x27),
122594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B1, 0x1a),
122694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B2, 0x5a),
122794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B3, 0x09),
122894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE_0_1_B4, 0x37),
122994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B0, 0xbd),
123094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B1, 0xf9),
123194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B2, 0xbf),
123294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B3, 0xce),
123394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE2_B4, 0x62),
123494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B0, 0xbf),
123594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B1, 0x7d),
123694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B2, 0xbf),
123794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B3, 0xcf),
123894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_RX_MODE_RATE3_B4, 0xd6),
123994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_PHPRE_CTRL, 0xa0),
124094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
124194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V4_20_RX_MARG_COARSE_CTRL2, 0x12),
124294a407ccSDmitry Baryshkov };
124394a407ccSDmitry Baryshkov 
124494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_pcs_tbl[] = {
124594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_RX_SIGDET_LVL, 0x77),
124694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_EQ_CONFIG2, 0x01),
124794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_EQ_CONFIG4, 0x16),
124894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_EQ_CONFIG5, 0x02),
124994a407ccSDmitry Baryshkov };
125094a407ccSDmitry Baryshkov 
125194a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sdx55_qmp_pcie_pcs_misc_tbl[] = {
125294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_EQ_CONFIG1, 0x17),
125394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G3_RXEQEVAL_TIME, 0x13),
125494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G4_RXEQEVAL_TIME, 0x13),
125594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG2, 0x01),
125694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02),
1257458aa820SManivannan Sadhasivam };
1258458aa820SManivannan Sadhasivam 
1259364c748dSManivannan Sadhasivam static const struct qmp_phy_init_tbl sdx55_qmp_pcie_rc_pcs_misc_tbl[] = {
1260364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
1261364c748dSManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
1262364c748dSManivannan Sadhasivam };
1263364c748dSManivannan Sadhasivam 
1264458aa820SManivannan Sadhasivam static const struct qmp_phy_init_tbl sdx55_qmp_pcie_ep_pcs_misc_tbl[] = {
126594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00),
126694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00),
126794a407ccSDmitry Baryshkov };
126894a407ccSDmitry Baryshkov 
126992bd868fSRohit Agarwal static const struct qmp_phy_init_tbl sdx65_qmp_pcie_serdes_tbl[] = {
127092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BG_TIMER, 0x02),
127192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
127292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYS_CLK_CTRL, 0x07),
127392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f),
127492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x27),
127592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x0a),
127692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x17),
127792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x19),
127892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x00),
127992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x03),
128092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x00),
128192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x46),
128292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_CFG, 0x04),
128392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0xff),
128492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x04),
128592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0xff),
128692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x09),
128792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x19),
128892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x28),
128992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE0, 0xfb),
129092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE0, 0x01),
129192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE1, 0xfb),
129292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE1, 0x01),
129392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02),
129492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x12),
129592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_HS_SWITCH_SEL, 0x00),
129692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE0, 0x0a),
129792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x04),
129892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x60),
129992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MISC1, 0x88),
130092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_CONFIG, 0x06),
130192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE, 0x14),
130292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE_CONTD, 0x00),
130392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_DC_LEVEL_CTRL, 0x0f),
130492bd868fSRohit Agarwal };
130592bd868fSRohit Agarwal 
130692bd868fSRohit Agarwal static const struct qmp_phy_init_tbl sdx65_qmp_pcie_tx_tbl[] = {
130792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_1, 0x05),
130892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_2, 0xf6),
130992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_3, 0x00),
131092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_VMODE_CTRL1, 0x00),
131192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_PI_QEC_CTRL, 0x00),
131292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_TX, 0x1a),
131392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_RX, 0x0c),
131492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RCV_DETECT_LVL_2, 0x12),
131592bd868fSRohit Agarwal };
131692bd868fSRohit Agarwal 
131792bd868fSRohit Agarwal static const struct qmp_phy_init_tbl sdx65_qmp_pcie_rx_tbl[] = {
131892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_0_1, 0x3f),
131992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_1, 0x06),
132092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_2, 0x06),
132192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_PRE_THRESH1, 0x3e),
132292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_PRE_THRESH2, 0x1e),
132392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH1, 0x00),
132492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH2, 0x1f),
132592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_MAIN_THRESH1, 0x02),
132692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_MAIN_THRESH2, 0x1d),
132792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_CNTRL1, 0x44),
132892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_CNTRL2, 0x00),
132992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL2, 0x00),
133092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL3, 0x4a),
133192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x74),
133292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_OFFSET_ADAPTOR_CNTRL2, 0x00),
133392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_SIGDET_ENABLES, 0x1c),
133492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_SIGDET_CNTRL, 0x03),
133592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_SIGDET_DEGLITCH_CNTRL, 0x14),
133692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B0, 0x04),
133792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B1, 0xcc),
133892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B2, 0x12),
133992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B3, 0xcc),
134092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B4, 0x64),
134192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B5, 0x4a),
134292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B6, 0x29),
134392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_PHPRE_CTRL, 0x20),
134492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DCC_CTRL1, 0x0c),
134592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE210, 0x1f),
134692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE3, 0x1f),
134792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE210, 0x1f),
134892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE3, 0x1f),
134992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE210, 0x1f),
135092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE3, 0x1f),
135192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH4_RATE3, 0x1f),
135292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH5_RATE3, 0x1f),
135392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH6_RATE3, 0x1f),
135492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE2, 0x0c),
135592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE3, 0x0a),
135692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_PI_CONTROLS, 0x16),
135792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_2_3, 0x37),
135892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_IDAC_SAOFFSET, 0x10),
135992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_3, 0x05),
136092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_DAC_ENABLE1, 0x00),
136192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_DAC_ENABLE2, 0x00),
136292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_MAN_VAL, 0x0a),
136392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_GM_CAL, 0x0f),
136492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0b),
136592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B0, 0xc5),
136692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B1, 0xac),
136792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B2, 0xb6),
136892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B3, 0xc0),
136992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B4, 0x07),
137092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B5, 0xfb),
137192bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B6, 0x0d),
137292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B0, 0xc5),
137392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B1, 0xee),
137492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B2, 0xbf),
137592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B3, 0xa0),
137692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B4, 0x81),
137792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B5, 0xde),
137892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B6, 0x7f),
137992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_EN_TIMER, 0x28),
138092bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
138192bd868fSRohit Agarwal };
138292bd868fSRohit Agarwal 
138392bd868fSRohit Agarwal static const struct qmp_phy_init_tbl sdx65_qmp_pcie_pcs_tbl[] = {
138492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_G3S2_PRE_GAIN, 0x2e),
138592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_RX_SIGDET_LVL, 0xaa),
138692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG2, 0x0d),
138792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG4, 0x16),
138892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG5, 0x22),
138992bd868fSRohit Agarwal };
139092bd868fSRohit Agarwal 
139192bd868fSRohit Agarwal static const struct qmp_phy_init_tbl sdx65_qmp_pcie_pcs_misc_tbl[] = {
139292bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_EQ_CONFIG1, 0x16),
139392bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_RX_MARGINING_CONFIG3, 0x28),
139492bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5, 0x08),
139592bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG2, 0x0d),
139692bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02),
139792bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e),
139892bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00),
139992bd868fSRohit Agarwal 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00),
140092bd868fSRohit Agarwal };
140192bd868fSRohit Agarwal 
1402c99649c3SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3_pcie_serdes_tbl[] = {
140394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08),
140494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34),
140594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x08),
140694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f),
140794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x42),
140894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE1_MODE0, 0x24),
140994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE2_MODE1, 0x03),
141094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE1_MODE1, 0xb4),
141194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02),
141294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_HSCLK_SEL, 0x11),
141394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82),
141494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03),
141594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55),
141694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55),
141794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a),
141894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a),
141994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x68),
142094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x02),
142194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0xaa),
142294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0xab),
142394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34),
142494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14),
142594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x01),
142694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06),
142794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16),
142894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36),
142994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06),
143094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16),
143194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36),
143294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e),
143394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xca),
143494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x18),
143594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xa2),
143694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_EN_CENTER, 0x01),
143794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31),
143894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01),
143994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde),
144094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07),
144194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x4c),
144294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x06),
144394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90),
144494a407ccSDmitry Baryshkov };
144594a407ccSDmitry Baryshkov 
1446d8de49e9SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_rc_serdes_tbl[] = {
1447d8de49e9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_BUF_ENABLE, 0x07),
1448d8de49e9SDmitry Baryshkov };
1449d8de49e9SDmitry Baryshkov 
145094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_tx_tbl[] = {
145194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_PI_QEC_CTRL, 0x20),
145294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0x75),
145394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x3f),
145494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x16),
145594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x04),
145694a407ccSDmitry Baryshkov };
145794a407ccSDmitry Baryshkov 
1458c99649c3SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3_pcie_rx_tbl[] = {
145994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_LOW, 0x7f),
146094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH, 0xff),
146194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH4, 0xd8),
146294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_LOW, 0xdc),
146394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH, 0xdc),
146494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH2, 0x5c),
146594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH3, 0x34),
146694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_01_HIGH4, 0xa6),
146794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_10_HIGH3, 0x34),
146894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_GM_CAL, 0x00),
146994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH1, 0x08),
147094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SB2_THRESH2, 0x08),
147194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
147294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_TX_ADAPT_POST_THRESH, 0xf0),
1473d8de49e9SDmitry Baryshkov };
1474d8de49e9SDmitry Baryshkov 
1475d8de49e9SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_rc_rx_tbl[] = {
1476d8de49e9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0xbf),
1477d8de49e9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3f),
1478d8de49e9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_10_HIGH4, 0x38),
1479d8de49e9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x07),
1480d8de49e9SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0xf0),
148194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_EQU_ADAPTOR_CNTRL4, 0x07),
148294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_FO_GAIN, 0x09),
148394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_SO_GAIN, 0x05),
148494a407ccSDmitry Baryshkov };
148594a407ccSDmitry Baryshkov 
1486c99649c3SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3_pcie_pcs_tbl[] = {
148794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RX_SIGDET_LVL, 0x77),
148894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_RATE_SLEW_CNTRL1, 0x0b),
148994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_REFGEN_REQ_CONFIG1, 0x05),
149094a407ccSDmitry Baryshkov };
149194a407ccSDmitry Baryshkov 
149294a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen3x1_pcie_pcs_misc_tbl[] = {
149394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
149494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00),
149594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_EQ_CONFIG2, 0x0f),
149694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
149794a407ccSDmitry Baryshkov };
149894a407ccSDmitry Baryshkov 
1499c7005273SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8350_qmp_gen3x1_pcie_tx_tbl[] = {
1500c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_PI_QEC_CTRL, 0x20),
1501c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0x75),
1502c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x3f),
1503c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x1d),
1504c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x0c),
1505c7005273SDmitry Baryshkov };
1506c7005273SDmitry Baryshkov 
1507c7005273SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8350_qmp_gen3x1_pcie_rc_rx_tbl[] = {
1508c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0xbf),
1509c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x3f),
1510c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x07),
1511c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_UCDR_PI_CONTROLS, 0xf0),
1512c7005273SDmitry Baryshkov };
1513c7005273SDmitry Baryshkov 
1514c7005273SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8350_qmp_gen3x2_pcie_rc_rx_tbl[] = {
1515c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH2, 0x7f),
1516c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_RX_MODE_00_HIGH3, 0x34),
1517c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_RX_VGA_CAL_CNTRL2, 0x0f),
1518c7005273SDmitry Baryshkov };
1519c7005273SDmitry Baryshkov 
1520c7005273SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8350_qmp_gen3x2_pcie_tx_tbl[] = {
1521c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG_LANE(QSERDES_V5_TX_PI_QEC_CTRL, 0x02, 1),
1522c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG_LANE(QSERDES_V5_TX_PI_QEC_CTRL, 0x04, 2),
1523c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_1, 0xd5),
1524c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_LANE_MODE_4, 0x3f),
1525c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_TX, 0x1d),
1526c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_TX_RES_CODE_LANE_OFFSET_RX, 0x0c),
1527c7005273SDmitry Baryshkov };
1528c7005273SDmitry Baryshkov 
1529c7005273SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8350_qmp_gen3x2_pcie_rc_pcs_tbl[] = {
1530c7005273SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_PCS_EQ_CONFIG2, 0x0f),
1531c7005273SDmitry Baryshkov };
1532c7005273SDmitry Baryshkov 
153394a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_serdes_tbl[] = {
1534f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
1535f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f),
1536f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x46),
1537f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_CFG, 0x04),
1538f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02),
1539f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x12),
1540f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_HS_SWITCH_SEL, 0x00),
1541f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE0, 0x0a),
1542f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x04),
1543f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MISC1, 0x88),
1544f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_CONFIG, 0x06),
1545f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE, 0x14),
1546f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_DC_LEVEL_CTRL, 0x0f),
1547f5682f13SDmitry Baryshkov };
1548f5682f13SDmitry Baryshkov 
1549f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_rc_serdes_tbl[] = {
155094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31),
155194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01),
155294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde),
155394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07),
155494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x97),
155594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x0c),
155694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90),
155794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06),
155894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06),
155994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16),
156094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16),
156194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36),
156294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36),
156394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08),
156494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a),
156594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a),
156694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14),
156794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34),
156894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82),
156994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0xd0),
157094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55),
157194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55),
157294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03),
157394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0x55),
157494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0x55),
157594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x05),
157694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34),
157794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x20),
157894a407ccSDmitry Baryshkov };
157994a407ccSDmitry Baryshkov 
158094a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_tx_tbl[] = {
158194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_1, 0x05),
158294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_2, 0xf6),
158394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_TX, 0x1a),
158494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_RX, 0x0c),
158594a407ccSDmitry Baryshkov };
158694a407ccSDmitry Baryshkov 
158794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_rx_tbl[] = {
158894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_PI_CONTROLS, 0x16),
158994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
159094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B1, 0xcc),
159194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B2, 0x12),
159294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B3, 0xcc),
159394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B5, 0x4a),
159494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B6, 0x29),
159594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B0, 0xc5),
159694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B1, 0xad),
159794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B2, 0xb6),
159894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B3, 0xc0),
159994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B4, 0x1f),
160094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B5, 0xfb),
160194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B6, 0x0f),
160294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B0, 0xc7),
160394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B1, 0xef),
160494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B2, 0xbf),
160594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B3, 0xa0),
160694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B4, 0x81),
160794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B5, 0xde),
160894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B6, 0x7f),
160994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_PHPRE_CTRL, 0x20),
161094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_0_1, 0x3f),
161194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_2_3, 0x37),
161294a407ccSDmitry Baryshkov 
161394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_3, 0x05),
161494a407ccSDmitry Baryshkov 
161594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE3, 0x1f),
161694a407ccSDmitry Baryshkov 
161794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE3, 0x1f),
161894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE3, 0x1f),
161994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH4_RATE3, 0x1f),
162094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH5_RATE3, 0x1f),
162194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH6_RATE3, 0x1f),
162294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE210, 0x1f),
162394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE210, 0x1f),
162494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE210, 0x1f),
162594a407ccSDmitry Baryshkov 
162694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE2, 0x0c),
162794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE3, 0x0a),
162894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_MAN_VAL, 0x0a),
162994a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0b),
163094a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_IDAC_SAOFFSET, 0x10),
163194a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_DAC_ENABLE1, 0x00),
163294a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_GM_CAL, 0x0f),
163394a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH1, 0x00),
163494a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH2, 0x1f),
163594a407ccSDmitry Baryshkov };
163694a407ccSDmitry Baryshkov 
163794a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_pcs_tbl[] = {
1638883aebf6SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG4, 0x16),
1639883aebf6SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG5, 0x22),
1640883aebf6SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_G3S2_PRE_GAIN, 0x2e),
1641883aebf6SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_RX_SIGDET_LVL, 0x99),
164294a407ccSDmitry Baryshkov };
164394a407ccSDmitry Baryshkov 
164494a407ccSDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_pcs_misc_tbl[] = {
164594a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02),
164694a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_EQ_CONFIG1, 0x16),
164794a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_RX_MARGINING_CONFIG3, 0x28),
164894a407ccSDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e),
164994a407ccSDmitry Baryshkov };
165094a407ccSDmitry Baryshkov 
1651f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_rc_pcs_misc_tbl[] = {
1652f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
1653f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
16549ddcd920SManivannan Sadhasivam 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_PRESET_P10_POST, 0x00),
1655f5682f13SDmitry Baryshkov };
1656f5682f13SDmitry Baryshkov 
1657f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_ep_serdes_tbl[] = {
1658f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BG_TIMER, 0x02),
1659f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYS_CLK_CTRL, 0x07),
1660f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x27),
1661f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x0a),
1662f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x17),
1663f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x19),
1664f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x00),
1665f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x03),
1666f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x00),
1667f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0xff),
1668f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x04),
1669f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0xff),
1670f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x09),
1671f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x19),
1672f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0x28),
1673f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE0, 0xfb),
1674f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE0, 0x01),
1675f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN0_MODE1, 0xfb),
1676f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_INTEGLOOP_GAIN1_MODE1, 0x01),
1677f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x60),
1678f5682f13SDmitry Baryshkov };
1679f5682f13SDmitry Baryshkov 
1680f5682f13SDmitry Baryshkov static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl[] = {
1681f5682f13SDmitry Baryshkov 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5, 0x08),
1682f5682f13SDmitry Baryshkov };
1683f5682f13SDmitry Baryshkov 
1684269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen3x2_pcie_serdes_tbl[] = {
1685269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_EN_CENTER, 0x01),
1686269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER1, 0x62),
1687269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER2, 0x02),
1688269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0, 0xf8),
1689269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0, 0x01),
1690269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE1, 0x93),
1691269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE1, 0x01),
1692269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CLK_ENABLE1, 0x90),
1693269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYS_CLK_CTRL, 0x82),
1694269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_IVCO, 0x07),
1695269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE0, 0x02),
1696269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE1, 0x02),
1697269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE0, 0x16),
1698269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE1, 0x16),
1699269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE0, 0x36),
1700269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE1, 0x36),
1701269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYSCLK_EN_SEL, 0x08),
1702269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_BG_TIMER, 0x0a),
1703269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP_EN, 0x42),
1704269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE0, 0x04),
1705269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE0, 0x0d),
1706269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE1, 0x0a),
1707269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE1, 0x1a),
1708269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE0, 0x41),
1709269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE1, 0x34),
1710269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE0, 0xab),
1711269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE0, 0xaa),
1712269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE0, 0x01),
1713269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE1, 0x55),
1714269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE1, 0x55),
1715269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE1, 0x01),
1716269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE_MAP, 0x14),
1717269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CLK_SELECT, 0x34),
1718269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_HSCLK_SEL_1, 0x01),
1719269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORECLK_DIV_MODE1, 0x04),
1720269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_CONFIG_1, 0x16),
1721269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_ADDITIONAL_MISC_3, 0x0f),
1722269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORE_CLK_EN, 0xa0),
1723269b70e8SAbel Vesa };
1724269b70e8SAbel Vesa 
1725269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen3x2_pcie_tx_tbl[] = {
1726269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_TX_LANE_MODE_1, 0x15),
1727269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_TX_LANE_MODE_4, 0x3f),
1728269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_TX_PI_QEC_CTRL, 0x02),
1729269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_TX_RES_CODE_LANE_OFFSET_RX, 0x06),
1730269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_TX_RES_CODE_LANE_OFFSET_TX, 0x18),
1731269b70e8SAbel Vesa };
1732269b70e8SAbel Vesa 
1733269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen3x2_pcie_rx_tbl[] = {
1734269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
1735269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_GM_CAL, 0x11),
1736269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_00_HIGH, 0xbf),
1737269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_00_HIGH2, 0xbf),
1738269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_00_HIGH3, 0xb7),
1739269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_00_HIGH4, 0xea),
1740269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_00_LOW, 0x3f),
1741269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_01_HIGH, 0x5c),
1742269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_01_HIGH2, 0x9c),
1743269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_01_HIGH3, 0x1a),
1744269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_01_HIGH4, 0x89),
1745269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_01_LOW, 0xdc),
1746269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_10_HIGH, 0x94),
1747269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_10_HIGH2, 0x5b),
1748269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_10_HIGH3, 0x1a),
1749269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_MODE_10_HIGH4, 0x89),
1750269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_TX_ADAPT_POST_THRESH, 0xf0),
1751269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_UCDR_FO_GAIN, 0x09),
1752269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_UCDR_SO_GAIN, 0x05),
1753269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_UCDR_SB2_THRESH1, 0x08),
1754269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_UCDR_SB2_THRESH2, 0x08),
1755269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_VGA_CAL_CNTRL2, 0x0f),
1756269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_SIDGET_ENABLES, 0x1c),
1757269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_RX_IDAC_TSETTLE_LOW, 0x07),
1758269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_RX_SIGDET_CAL_TRIM, 0x08),
1759269b70e8SAbel Vesa };
1760269b70e8SAbel Vesa 
1761269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen3x2_pcie_pcs_tbl[] = {
1762269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_PCS_REFGEN_REQ_CONFIG1, 0x05),
1763269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_PCS_RX_SIGDET_LVL, 0x77),
1764269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_PCS_RATE_SLEW_CNTRL1, 0x0b),
1765269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_PCS_EQ_CONFIG2, 0x0f),
1766269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_PCS_PCS_TX_RX_CONFIG, 0x8c),
1767269b70e8SAbel Vesa };
1768269b70e8SAbel Vesa 
1769269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen3x2_pcie_pcs_misc_tbl[] = {
1770269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_POWER_STATE_CONFIG2, 0x1d),
1771269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_POWER_STATE_CONFIG4, 0x07),
1772269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
1773269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
1774269b70e8SAbel Vesa };
1775269b70e8SAbel Vesa 
1776269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen4x2_pcie_serdes_tbl[] = {
1777269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE1, 0x26),
1778269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE1, 0x03),
1779269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE1, 0x06),
1780269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE1, 0x16),
1781269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE1, 0x36),
1782269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORECLK_DIV_MODE1, 0x04),
1783269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE1, 0x0a),
1784269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE1, 0x1a),
1785269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE1, 0x68),
1786269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE1, 0xab),
1787269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE1, 0xaa),
1788269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE1, 0x02),
1789269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_HSCLK_SEL_1, 0x12),
1790269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0, 0xf8),
1791269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0, 0x01),
1792269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE0, 0x06),
1793269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE0, 0x16),
1794269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE0, 0x36),
1795269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CORE_CLK_DIV_MODE0, 0x0a),
1796269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE0, 0x04),
1797269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE0, 0x0d),
1798269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE0, 0x41),
1799269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE0, 0xab),
1800269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE0, 0xaa),
1801269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE0, 0x01),
1802269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_HSCLK_HS_SWITCH_SEL_1, 0x00),
1803269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_BG_TIMER, 0x0a),
1804269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_EN_CENTER, 0x01),
1805269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER1, 0x62),
1806269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER2, 0x02),
1807269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_POST_DIV_MUX, 0x40),
1808269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_BIAS_EN_CLK_BUFLR_EN, 0x14),
1809269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CLK_ENABLE1, 0x90),
1810269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYS_CLK_CTRL, 0x82),
1811269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_IVCO, 0x0f),
1812269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYSCLK_EN_SEL, 0x08),
1813269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP_EN, 0x46),
1814269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP_CFG, 0x04),
1815269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE_MAP, 0x14),
1816269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CLK_SELECT, 0x34),
1817269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORE_CLK_EN, 0xa0),
1818269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_CONFIG_1, 0x06),
1819269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_MISC_1, 0x88),
1820269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_MODE, 0x14),
1821269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_VCO_DC_LEVEL_CTRL, 0x0f),
1822269b70e8SAbel Vesa };
1823269b70e8SAbel Vesa 
1824269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen4x2_pcie_ln_shrd_tbl[] = {
1825269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RXCLK_DIV2_CTRL, 0x01),
1826269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_Q_EN_RATES, 0xe),
1827269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_DFE_DAC_ENABLE1, 0x00),
1828269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_TX_ADAPT_POST_THRESH1, 0x00),
1829269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_TX_ADAPT_POST_THRESH2, 0x1f),
1830269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B0, 0x12),
1831269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B1, 0x12),
1832269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B2, 0xdb),
1833269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B3, 0x9a),
1834269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B4, 0x38),
1835269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B5, 0xb6),
1836269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MODE_RATE_0_1_B6, 0x64),
1837269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH1_RATE210, 0x1f),
1838269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH1_RATE3, 0x1f),
1839269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH2_RATE210, 0x1f),
1840269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH2_RATE3, 0x1f),
1841269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH3_RATE210, 0x1f),
1842269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH3_RATE3, 0x1f),
1843269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH4_RATE3, 0x1f),
1844269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH5_RATE3, 0x1f),
1845269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_LN_SHRD_RX_MARG_COARSE_THRESH6_RATE3, 0x1f),
1846269b70e8SAbel Vesa };
1847269b70e8SAbel Vesa 
1848269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen4x2_pcie_tx_tbl[] = {
1849269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_TX_RES_CODE_LANE_OFFSET_TX, 0x1d),
1850269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_TX_RES_CODE_LANE_OFFSET_RX, 0x03),
1851269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_TX_LANE_MODE_1, 0x01),
1852269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_TX_LANE_MODE_2, 0x00),
1853269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_TX_LANE_MODE_3, 0x51),
1854269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_TX_TRAN_DRVR_EMP_EN, 0x34),
1855269b70e8SAbel Vesa };
1856269b70e8SAbel Vesa 
1857269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen4x2_pcie_rx_tbl[] = {
1858269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_UCDR_FO_GAIN_RATE_2, 0x0a),
1859269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_UCDR_FO_GAIN_RATE_3, 0x0a),
1860269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_UCDR_PI_CONTROLS, 0x16),
1861269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_UCDR_SO_ACC_DEFAULT_VAL_RATE3, 0x00),
1862269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_IVCM_CAL_CTRL2, 0x80),
1863269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_IVCM_POSTCAL_OFFSET, 0x7c),
1864269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_DFE_3, 0x05),
1865269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_VGA_CAL_MAN_VAL, 0x0a),
1866269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_GM_CAL, 0x0d),
1867269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_EQU_ADAPTOR_CNTRL4, 0x0b),
1868269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_SIGDET_ENABLES, 0x1c),
1869269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_PHPRE_CTRL, 0x20),
1870269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x30),
1871269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_Q_PI_INTRINSIC_BIAS_RATE32, 0x09),
1872269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B0, 0x14),
1873269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B1, 0xb3),
1874269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B2, 0x58),
1875269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B3, 0x9a),
1876269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B4, 0x26),
1877269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B5, 0xb6),
1878269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE2_B6, 0xee),
1879269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B0, 0xdb),
1880269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B1, 0xdb),
1881269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B2, 0xa0),
1882269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B3, 0xdf),
1883269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B4, 0x78),
1884269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B5, 0x76),
1885269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QSERDES_V6_20_RX_MODE_RATE3_B6, 0xff),
1886269b70e8SAbel Vesa };
1887269b70e8SAbel Vesa 
1888269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen4x2_pcie_pcs_tbl[] = {
1889269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_20_PCS_G3S2_PRE_GAIN, 0x2e),
1890269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_20_PCS_COM_ELECIDLE_DLY_SEL, 0x25),
1891269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_20_PCS_EQ_CONFIG4, 0x00),
1892269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_20_PCS_EQ_CONFIG5, 0x22),
1893269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_20_PCS_TX_RX_CONFIG1, 0x04),
1894269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_V6_20_PCS_TX_RX_CONFIG2, 0x02),
1895269b70e8SAbel Vesa };
1896269b70e8SAbel Vesa 
1897269b70e8SAbel Vesa static const struct qmp_phy_init_tbl sm8550_qmp_gen4x2_pcie_pcs_misc_tbl[] = {
1898269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_ENDPOINT_REFCLK_DRIVE, 0xc1),
1899269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_OSC_DTCT_ATCIONS, 0x00),
1900269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_EQ_CONFIG1, 0x16),
1901269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_EQ_CONFIG5, 0x02),
1902269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_G4_PRE_GAIN, 0x2e),
1903269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_RX_MARGINING_CONFIG1, 0x03),
1904269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_RX_MARGINING_CONFIG3, 0x28),
1905269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_TX_RX_CONFIG, 0xc0),
1906269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_POWER_STATE_CONFIG2, 0x1d),
1907269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_RX_MARGINING_CONFIG5, 0x0f),
1908269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_G3_FOM_EQ_CONFIG5, 0xf2),
1909269b70e8SAbel Vesa 	QMP_PHY_INIT_CFG(QPHY_PCIE_V6_20_PCS_G4_FOM_EQ_CONFIG5, 0xf2),
1910269b70e8SAbel Vesa };
1911269b70e8SAbel Vesa 
1912a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_serdes_alt_tbl[] = {
1913a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
1914a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f),
1915a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x46),
1916a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_CFG, 0x04),
1917a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02),
1918a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x12),
1919a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_HS_SWITCH_SEL, 0x00),
1920a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE0, 0x0a),
1921a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x04),
1922a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MISC1, 0x88),
1923a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x60),
1924a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_CONFIG, 0x06),
1925a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE, 0x14),
1926a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_DC_LEVEL_CTRL, 0x0f),
1927a05b6d51SMrinmay Sarkar };
1928a05b6d51SMrinmay Sarkar 
1929a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_rc_serdes_alt_tbl[] = {
1930a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_EN_CENTER, 0x00),
1931a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31),
1932a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01),
1933a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde),
1934a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07),
1935a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x97),
1936a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x0c),
1937a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90),
1938a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06),
1939a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06),
1940a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16),
1941a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16),
1942a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36),
1943a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36),
1944a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08),
1945a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a),
1946a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a),
1947a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14),
1948a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34),
1949a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82),
1950a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0xd0),
1951a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55),
1952a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55),
1953a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03),
1954a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0x55),
1955a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0x55),
1956a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x05),
1957a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34),
1958a05b6d51SMrinmay Sarkar };
1959a05b6d51SMrinmay Sarkar 
1960a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_rx_alt_tbl[] = {
1961a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_PI_CONTROLS, 0x16),
1962a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
1963a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B0, 0x9a),
1964a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B1, 0xb0),
1965a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B2, 0x92),
1966a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B3, 0xf0),
1967a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B4, 0x42),
1968a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B5, 0x99),
1969a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B6, 0x29),
1970a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B0, 0x9a),
1971a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B1, 0xfb),
1972a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B2, 0x92),
1973a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B3, 0xec),
1974a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B4, 0x43),
1975a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B5, 0xdd),
1976a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B6, 0x0d),
1977a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B0, 0xf3),
1978a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B1, 0xf8),
1979a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B2, 0xec),
1980a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B3, 0xd6),
1981a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B4, 0x83),
1982a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B5, 0xf5),
1983a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B6, 0x5e),
1984a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_PHPRE_CTRL, 0x20),
1985a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_0_1, 0x3f),
1986a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_2_3, 0x37),
1987a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_3, 0x00),
1988a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE3, 0x1f),
1989a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE3, 0x1f),
1990a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE3, 0x1f),
1991a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH4_RATE3, 0x1f),
1992a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH5_RATE3, 0x1f),
1993a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH6_RATE3, 0x1f),
1994a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE210, 0x1f),
1995a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE210, 0x1f),
1996a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE210, 0x1f),
1997a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_Q_PI_INTRINSIC_BIAS_RATE32, 0x09),
1998a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE2, 0x0c),
1999a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE3, 0x08),
2000a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_SO_GAIN_RATE3, 0x04),
2001a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_CNTRL1, 0x04),
2002a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_MAN_VAL, 0x08),
2003a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0b),
2004a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x7c),
2005a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_IDAC_SAOFFSET, 0x10),
2006a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_DAC_ENABLE1, 0x00),
2007a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_GM_CAL, 0x05),
2008a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH1, 0x00),
2009a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH2, 0x1f),
2010a05b6d51SMrinmay Sarkar };
2011a05b6d51SMrinmay Sarkar 
2012a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4_pcie_tx_tbl[] = {
2013a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_TX, 0x1f),
2014a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_RES_CODE_LANE_OFFSET_RX, 0x07),
2015a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_1, 0x05),
2016a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_2, 0xf6),
2017a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_TX_LANE_MODE_3, 0x0f),
2018a05b6d51SMrinmay Sarkar };
2019a05b6d51SMrinmay Sarkar 
2020a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4_pcie_pcs_misc_tbl[] = {
2021a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_EQ_CONFIG1, 0x16),
2022a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02),
2023a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e),
2024a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_RX_MARGINING_CONFIG3, 0x28),
2025a05b6d51SMrinmay Sarkar };
2026a05b6d51SMrinmay Sarkar 
2027a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl[] = {
2028a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_POWER_STATE_CONFIG2, 0x1d),
2029a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1),
2030a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00),
2031a05b6d51SMrinmay Sarkar };
2032a05b6d51SMrinmay Sarkar 
2033a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl[] = {
2034a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG4, 0x16),
2035a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG5, 0x22),
2036a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00),
2037a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00),
2038a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_G3S2_PRE_GAIN, 0x2e),
2039a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_RX_SIGDET_LVL, 0x66),
2040a05b6d51SMrinmay Sarkar };
2041a05b6d51SMrinmay Sarkar 
2042a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x4_pcie_rx_alt_tbl[] = {
2043a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_0_1, 0x3f),
2044a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_AUX_DATA_THRESH_BIN_RATE_2_3, 0x37),
2045a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_3, 0x00),
2046a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_CTLE_POST_CAL_OFFSET, 0x38),
2047a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_DFE_DAC_ENABLE1, 0x00),
2048a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_GM_CAL, 0x05),
2049a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_PHPRE_CTRL, 0x20),
2050a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQU_ADAPTOR_CNTRL4, 0x0b),
2051a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_EQ_OFFSET_ADAPTOR_CNTRL1, 0x7c),
2052a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_IDAC_SAOFFSET, 0x10),
2053a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE210, 0x1f),
2054a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH1_RATE3, 0x1f),
2055a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE210, 0x1f),
2056a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH2_RATE3, 0x1f),
2057a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE210, 0x1f),
2058a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH3_RATE3, 0x1f),
2059a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH4_RATE3, 0x1f),
2060a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH5_RATE3, 0x1f),
2061a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MARG_COARSE_THRESH6_RATE3, 0x1f),
2062a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_Q_PI_INTRINSIC_BIAS_RATE32, 0x09),
2063a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B0, 0x99),
2064a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B1, 0xb0),
2065a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B2, 0x92),
2066a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B3, 0xf0),
2067a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B4, 0x42),
2068a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B5, 0x00),
2069a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE_0_1_B6, 0x20),
2070a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B0, 0x9a),
2071a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B1, 0xb6),
2072a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B2, 0x92),
2073a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B3, 0xf0),
2074a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B4, 0x43),
2075a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B5, 0xdd),
2076a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE2_B6, 0x0d),
2077a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B0, 0xf3),
2078a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B1, 0xf6),
2079a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B2, 0xee),
2080a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B3, 0xd2),
2081a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B4, 0x83),
2082a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B5, 0xf9),
2083a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_RX_MODE_RATE3_B6, 0x3d),
2084a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH1, 0x00),
2085a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_TX_ADAPT_POST_THRESH2, 0x1f),
2086a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE2, 0x0c),
2087a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_FO_GAIN_RATE3, 0x08),
2088a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_SO_GAIN_RATE3, 0x04),
2089a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_UCDR_PI_CONTROLS, 0x16),
2090a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_CNTRL1, 0x04),
2091a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_20_RX_VGA_CAL_MAN_VAL, 0x08),
2092a05b6d51SMrinmay Sarkar };
2093a05b6d51SMrinmay Sarkar 
2094a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x4_pcie_pcs_alt_tbl[] = {
2095a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG4, 0x16),
2096a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG5, 0x22),
2097a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_G3S2_PRE_GAIN, 0x2e),
2098a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_RX_SIGDET_LVL, 0x66),
2099a05b6d51SMrinmay Sarkar };
2100a05b6d51SMrinmay Sarkar 
2101a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x4_pcie_serdes_alt_tbl[] = {
2102a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_IVCO, 0x0f),
2103a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE0, 0x36),
2104a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_CCTRL_MODE1, 0x36),
2105a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_EN, 0x46),
2106a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP_CFG, 0x04),
2107a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_TUNE_MAP, 0x02),
2108a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_SEL, 0x12),
2109a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_HSCLK_HS_SWITCH_SEL, 0x00),
2110a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE0, 0x0a),
2111a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORECLK_DIV_MODE1, 0x04),
2112a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MISC1, 0x88),
2113a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CORE_CLK_EN, 0x60),
2114a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_CONFIG, 0x06),
2115a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CMN_MODE, 0x14),
2116a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_VCO_DC_LEVEL_CTRL, 0x0f),
2117a05b6d51SMrinmay Sarkar };
2118a05b6d51SMrinmay Sarkar 
2119a05b6d51SMrinmay Sarkar 
2120a05b6d51SMrinmay Sarkar static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x4_pcie_rc_serdes_alt_tbl[] = {
2121a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_EN_CENTER, 0x00),
2122a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER1, 0x31),
2123a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_PER2, 0x01),
2124a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE0, 0xde),
2125a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE0, 0x07),
2126a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE1_MODE1, 0x97),
2127a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SSC_STEP_SIZE2_MODE1, 0x0c),
2128a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_BIAS_EN_CLKBUFLR_EN, 0x1c),
2129a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_ENABLE1, 0x90),
2130a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE0, 0x06),
2131a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CP_CTRL_MODE1, 0x06),
2132a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE0, 0x16),
2133a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_PLL_RCTRL_MODE1, 0x16),
2134a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_SYSCLK_EN_SEL, 0x08),
2135a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE0, 0x0a),
2136a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE0, 0x1a),
2137a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP1_MODE1, 0x14),
2138a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_LOCK_CMP2_MODE1, 0x34),
2139a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE0, 0x82),
2140a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DEC_START_MODE1, 0xd0),
2141a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE0, 0x55),
2142a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE0, 0x55),
2143a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE0, 0x03),
2144a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START1_MODE1, 0x55),
2145a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START2_MODE1, 0x55),
2146a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_DIV_FRAC_START3_MODE1, 0x05),
2147a05b6d51SMrinmay Sarkar 	QMP_PHY_INIT_CFG(QSERDES_V5_COM_CLK_SELECT, 0x34),
2148a05b6d51SMrinmay Sarkar };
2149a05b6d51SMrinmay Sarkar 
2150d0a846baSJohan Hovold struct qmp_pcie_offsets {
2151d0a846baSJohan Hovold 	u16 serdes;
2152d0a846baSJohan Hovold 	u16 pcs;
2153d0a846baSJohan Hovold 	u16 pcs_misc;
2154d0a846baSJohan Hovold 	u16 tx;
2155d0a846baSJohan Hovold 	u16 rx;
2156d0a846baSJohan Hovold 	u16 tx2;
2157d0a846baSJohan Hovold 	u16 rx2;
2158269b70e8SAbel Vesa 	u16 ln_shrd;
2159d0a846baSJohan Hovold };
2160d0a846baSJohan Hovold 
2161d8c9a1e9SJohan Hovold struct qmp_phy_cfg_tbls {
21622566ad8eSDmitry Baryshkov 	const struct qmp_phy_init_tbl *serdes;
21632566ad8eSDmitry Baryshkov 	int serdes_num;
21642566ad8eSDmitry Baryshkov 	const struct qmp_phy_init_tbl *tx;
21652566ad8eSDmitry Baryshkov 	int tx_num;
21662566ad8eSDmitry Baryshkov 	const struct qmp_phy_init_tbl *rx;
21672566ad8eSDmitry Baryshkov 	int rx_num;
21682566ad8eSDmitry Baryshkov 	const struct qmp_phy_init_tbl *pcs;
21692566ad8eSDmitry Baryshkov 	int pcs_num;
21702566ad8eSDmitry Baryshkov 	const struct qmp_phy_init_tbl *pcs_misc;
21712566ad8eSDmitry Baryshkov 	int pcs_misc_num;
2172269b70e8SAbel Vesa 	const struct qmp_phy_init_tbl *ln_shrd;
2173269b70e8SAbel Vesa 	int ln_shrd_num;
21742566ad8eSDmitry Baryshkov };
21752566ad8eSDmitry Baryshkov 
217694a407ccSDmitry Baryshkov /* struct qmp_phy_cfg - per-PHY initialization config */
217794a407ccSDmitry Baryshkov struct qmp_phy_cfg {
2178f02543faSJohan Hovold 	int lanes;
217994a407ccSDmitry Baryshkov 
2180d0a846baSJohan Hovold 	const struct qmp_pcie_offsets *offsets;
2181d0a846baSJohan Hovold 
21822566ad8eSDmitry Baryshkov 	/* Main init sequence for PHY blocks - serdes, tx, rx, pcs */
2183d8c9a1e9SJohan Hovold 	const struct qmp_phy_cfg_tbls tbls;
21842566ad8eSDmitry Baryshkov 	/*
218511bf53a3SDmitry Baryshkov 	 * Additional init sequences for PHY blocks, providing additional
218611bf53a3SDmitry Baryshkov 	 * register programming. They are used for providing separate sequences
218711bf53a3SDmitry Baryshkov 	 * for the Root Complex and End Point use cases.
218811bf53a3SDmitry Baryshkov 	 *
218911bf53a3SDmitry Baryshkov 	 * If EP mode is not supported, both tables can be left unset.
21902566ad8eSDmitry Baryshkov 	 */
2191d8c9a1e9SJohan Hovold 	const struct qmp_phy_cfg_tbls *tbls_rc;
2192d8c9a1e9SJohan Hovold 	const struct qmp_phy_cfg_tbls *tbls_ep;
219394a407ccSDmitry Baryshkov 
21946c37a02bSJohan Hovold 	const struct qmp_phy_init_tbl *serdes_4ln_tbl;
21956c37a02bSJohan Hovold 	int serdes_4ln_num;
21966c37a02bSJohan Hovold 
219794a407ccSDmitry Baryshkov 	/* resets to be requested */
219894a407ccSDmitry Baryshkov 	const char * const *reset_list;
219994a407ccSDmitry Baryshkov 	int num_resets;
220094a407ccSDmitry Baryshkov 	/* regulators to be requested */
220194a407ccSDmitry Baryshkov 	const char * const *vreg_list;
220294a407ccSDmitry Baryshkov 	int num_vregs;
220394a407ccSDmitry Baryshkov 
220494a407ccSDmitry Baryshkov 	/* array of registers with different offsets */
220594a407ccSDmitry Baryshkov 	const unsigned int *regs;
220694a407ccSDmitry Baryshkov 
220794a407ccSDmitry Baryshkov 	unsigned int pwrdn_ctrl;
220894a407ccSDmitry Baryshkov 	/* bit offset of PHYSTATUS in QPHY_PCS_STATUS register */
220994a407ccSDmitry Baryshkov 	unsigned int phy_status;
221094a407ccSDmitry Baryshkov 
221151bd3306SJohan Hovold 	bool skip_start_delay;
221294a407ccSDmitry Baryshkov 
2213269b70e8SAbel Vesa 	bool has_nocsr_reset;
2214269b70e8SAbel Vesa 
22152ec9bc8dSRobert Marko 	/* QMP PHY pipe clock interface rate */
22162ec9bc8dSRobert Marko 	unsigned long pipe_clock_rate;
221794a407ccSDmitry Baryshkov };
221894a407ccSDmitry Baryshkov 
22192fdedef3SJohan Hovold struct qmp_pcie {
222094a407ccSDmitry Baryshkov 	struct device *dev;
222194a407ccSDmitry Baryshkov 
22222fdedef3SJohan Hovold 	const struct qmp_phy_cfg *cfg;
22236c37a02bSJohan Hovold 	bool tcsr_4ln_config;
22242fdedef3SJohan Hovold 
22252fdedef3SJohan Hovold 	void __iomem *serdes;
22262fdedef3SJohan Hovold 	void __iomem *pcs;
22272fdedef3SJohan Hovold 	void __iomem *pcs_misc;
22282fdedef3SJohan Hovold 	void __iomem *tx;
22292fdedef3SJohan Hovold 	void __iomem *rx;
22302fdedef3SJohan Hovold 	void __iomem *tx2;
22312fdedef3SJohan Hovold 	void __iomem *rx2;
2232269b70e8SAbel Vesa 	void __iomem *ln_shrd;
22332fdedef3SJohan Hovold 
22346c37a02bSJohan Hovold 	void __iomem *port_b;
22356c37a02bSJohan Hovold 
223694a407ccSDmitry Baryshkov 	struct clk_bulk_data *clks;
22379e420f1eSJohan Hovold 	struct clk_bulk_data pipe_clks[2];
22389e420f1eSJohan Hovold 	int num_pipe_clks;
22399e420f1eSJohan Hovold 
2240189ac6b8SDmitry Baryshkov 	struct reset_control_bulk_data *resets;
2241269b70e8SAbel Vesa 	struct reset_control *nocsr_reset;
224294a407ccSDmitry Baryshkov 	struct regulator_bulk_data *vregs;
224394a407ccSDmitry Baryshkov 
22442fdedef3SJohan Hovold 	struct phy *phy;
22452fdedef3SJohan Hovold 	int mode;
2246e8511f40SJohan Hovold 
2247e8511f40SJohan Hovold 	struct clk_fixed_rate pipe_clk_fixed;
224894a407ccSDmitry Baryshkov };
224994a407ccSDmitry Baryshkov 
qphy_setbits(void __iomem * base,u32 offset,u32 val)225094a407ccSDmitry Baryshkov static inline void qphy_setbits(void __iomem *base, u32 offset, u32 val)
225194a407ccSDmitry Baryshkov {
225294a407ccSDmitry Baryshkov 	u32 reg;
225394a407ccSDmitry Baryshkov 
225494a407ccSDmitry Baryshkov 	reg = readl(base + offset);
225594a407ccSDmitry Baryshkov 	reg |= val;
225694a407ccSDmitry Baryshkov 	writel(reg, base + offset);
225794a407ccSDmitry Baryshkov 
225894a407ccSDmitry Baryshkov 	/* ensure that above write is through */
225994a407ccSDmitry Baryshkov 	readl(base + offset);
226094a407ccSDmitry Baryshkov }
226194a407ccSDmitry Baryshkov 
qphy_clrbits(void __iomem * base,u32 offset,u32 val)226294a407ccSDmitry Baryshkov static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val)
226394a407ccSDmitry Baryshkov {
226494a407ccSDmitry Baryshkov 	u32 reg;
226594a407ccSDmitry Baryshkov 
226694a407ccSDmitry Baryshkov 	reg = readl(base + offset);
226794a407ccSDmitry Baryshkov 	reg &= ~val;
226894a407ccSDmitry Baryshkov 	writel(reg, base + offset);
226994a407ccSDmitry Baryshkov 
227094a407ccSDmitry Baryshkov 	/* ensure that above write is through */
227194a407ccSDmitry Baryshkov 	readl(base + offset);
227294a407ccSDmitry Baryshkov }
227394a407ccSDmitry Baryshkov 
227494a407ccSDmitry Baryshkov /* list of clocks required by phy */
2275067832dcSDmitry Baryshkov static const char * const qmp_pciephy_clk_l[] = {
2276067832dcSDmitry Baryshkov 	"aux", "cfg_ahb", "ref", "refgen", "rchng", "phy_aux",
2277a05b6d51SMrinmay Sarkar };
2278a05b6d51SMrinmay Sarkar 
227994a407ccSDmitry Baryshkov /* list of regulators */
228094a407ccSDmitry Baryshkov static const char * const qmp_phy_vreg_l[] = {
228194a407ccSDmitry Baryshkov 	"vdda-phy", "vdda-pll",
228294a407ccSDmitry Baryshkov };
228394a407ccSDmitry Baryshkov 
2284269b70e8SAbel Vesa static const char * const sm8550_qmp_phy_vreg_l[] = {
2285269b70e8SAbel Vesa 	"vdda-phy", "vdda-pll", "vdda-qref",
2286269b70e8SAbel Vesa };
2287269b70e8SAbel Vesa 
228894a407ccSDmitry Baryshkov /* list of resets */
228994a407ccSDmitry Baryshkov static const char * const ipq8074_pciephy_reset_l[] = {
229094a407ccSDmitry Baryshkov 	"phy", "common",
229194a407ccSDmitry Baryshkov };
229294a407ccSDmitry Baryshkov 
2293b35a5311SDmitry Baryshkov static const char * const sdm845_pciephy_reset_l[] = {
2294b35a5311SDmitry Baryshkov 	"phy",
2295b35a5311SDmitry Baryshkov };
2296b35a5311SDmitry Baryshkov 
2297bf46fa1dSDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_qhp = {
2298bf46fa1dSDmitry Baryshkov 	.serdes		= 0,
2299bf46fa1dSDmitry Baryshkov 	.pcs		= 0x1800,
2300bf46fa1dSDmitry Baryshkov 	.tx		= 0x0800,
2301bf46fa1dSDmitry Baryshkov 	/* no .rx for QHP */
2302bf46fa1dSDmitry Baryshkov };
2303bf46fa1dSDmitry Baryshkov 
2304bf46fa1dSDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_v2 = {
2305bf46fa1dSDmitry Baryshkov 	.serdes		= 0,
2306bf46fa1dSDmitry Baryshkov 	.pcs		= 0x0800,
2307bf46fa1dSDmitry Baryshkov 	.tx		= 0x0200,
2308bf46fa1dSDmitry Baryshkov 	.rx		= 0x0400,
2309bf46fa1dSDmitry Baryshkov };
2310bf46fa1dSDmitry Baryshkov 
2311bf46fa1dSDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_v3 = {
2312bf46fa1dSDmitry Baryshkov 	.serdes		= 0,
2313bf46fa1dSDmitry Baryshkov 	.pcs		= 0x0800,
2314bf46fa1dSDmitry Baryshkov 	.pcs_misc	= 0x0600,
2315bf46fa1dSDmitry Baryshkov 	.tx		= 0x0200,
2316bf46fa1dSDmitry Baryshkov 	.rx		= 0x0400,
2317bf46fa1dSDmitry Baryshkov };
2318bf46fa1dSDmitry Baryshkov 
2319bf46fa1dSDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_v4x1 = {
2320bf46fa1dSDmitry Baryshkov 	.serdes		= 0,
2321bf46fa1dSDmitry Baryshkov 	.pcs		= 0x0800,
2322bf46fa1dSDmitry Baryshkov 	.pcs_misc	= 0x0c00,
2323bf46fa1dSDmitry Baryshkov 	.tx		= 0x0200,
2324bf46fa1dSDmitry Baryshkov 	.rx		= 0x0400,
2325bf46fa1dSDmitry Baryshkov };
2326bf46fa1dSDmitry Baryshkov 
2327bf46fa1dSDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_v4x2 = {
2328bf46fa1dSDmitry Baryshkov 	.serdes		= 0,
2329bf46fa1dSDmitry Baryshkov 	.pcs		= 0x0a00,
2330bf46fa1dSDmitry Baryshkov 	.pcs_misc	= 0x0e00,
2331bf46fa1dSDmitry Baryshkov 	.tx		= 0x0200,
2332bf46fa1dSDmitry Baryshkov 	.rx		= 0x0400,
2333bf46fa1dSDmitry Baryshkov 	.tx2		= 0x0600,
2334bf46fa1dSDmitry Baryshkov 	.rx2		= 0x0800,
2335bf46fa1dSDmitry Baryshkov };
2336bf46fa1dSDmitry Baryshkov 
2337bf46fa1dSDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_v4_20 = {
2338bf46fa1dSDmitry Baryshkov 	.serdes		= 0x1000,
2339bf46fa1dSDmitry Baryshkov 	.pcs		= 0x1200,
2340bf46fa1dSDmitry Baryshkov 	.pcs_misc	= 0x1600,
2341bf46fa1dSDmitry Baryshkov 	.tx		= 0x0000,
2342bf46fa1dSDmitry Baryshkov 	.rx		= 0x0200,
2343bf46fa1dSDmitry Baryshkov 	.tx2		= 0x0800,
2344bf46fa1dSDmitry Baryshkov 	.rx2		= 0x0a00,
2345bf46fa1dSDmitry Baryshkov };
2346bf46fa1dSDmitry Baryshkov 
2347d0a846baSJohan Hovold static const struct qmp_pcie_offsets qmp_pcie_offsets_v5 = {
2348d0a846baSJohan Hovold 	.serdes		= 0,
2349d0a846baSJohan Hovold 	.pcs		= 0x0200,
2350d0a846baSJohan Hovold 	.pcs_misc	= 0x0600,
2351d0a846baSJohan Hovold 	.tx		= 0x0e00,
2352d0a846baSJohan Hovold 	.rx		= 0x1000,
2353d0a846baSJohan Hovold 	.tx2		= 0x1600,
2354d0a846baSJohan Hovold 	.rx2		= 0x1800,
2355d0a846baSJohan Hovold };
2356d0a846baSJohan Hovold 
2357a05b6d51SMrinmay Sarkar static const struct qmp_pcie_offsets qmp_pcie_offsets_v5_20 = {
2358a05b6d51SMrinmay Sarkar 	.serdes		= 0x1000,
2359a05b6d51SMrinmay Sarkar 	.pcs		= 0x1200,
2360a05b6d51SMrinmay Sarkar 	.pcs_misc	= 0x1400,
2361a05b6d51SMrinmay Sarkar 	.tx		= 0x0000,
2362a05b6d51SMrinmay Sarkar 	.rx		= 0x0200,
2363a05b6d51SMrinmay Sarkar 	.tx2		= 0x0800,
2364a05b6d51SMrinmay Sarkar 	.rx2		= 0x0a00,
2365a05b6d51SMrinmay Sarkar };
2366a05b6d51SMrinmay Sarkar 
2367a05b6d51SMrinmay Sarkar static const struct qmp_pcie_offsets qmp_pcie_offsets_v5_30 = {
2368a05b6d51SMrinmay Sarkar 	.serdes		= 0x2000,
2369a05b6d51SMrinmay Sarkar 	.pcs		= 0x2200,
2370a05b6d51SMrinmay Sarkar 	.pcs_misc	= 0x2400,
2371a05b6d51SMrinmay Sarkar 	.tx		= 0x0,
2372a05b6d51SMrinmay Sarkar 	.rx		= 0x0200,
2373a05b6d51SMrinmay Sarkar 	.tx2		= 0x3800,
2374a05b6d51SMrinmay Sarkar 	.rx2		= 0x3a00,
2375a05b6d51SMrinmay Sarkar };
2376a05b6d51SMrinmay Sarkar 
237786f70376SDmitry Baryshkov static const struct qmp_pcie_offsets qmp_pcie_offsets_v6_20 = {
237886f70376SDmitry Baryshkov 	.serdes		= 0x1000,
237986f70376SDmitry Baryshkov 	.pcs		= 0x1200,
238086f70376SDmitry Baryshkov 	.pcs_misc	= 0x1400,
238186f70376SDmitry Baryshkov 	.tx		= 0x0000,
238286f70376SDmitry Baryshkov 	.rx		= 0x0200,
238386f70376SDmitry Baryshkov 	.tx2		= 0x0800,
238486f70376SDmitry Baryshkov 	.rx2		= 0x0a00,
238586f70376SDmitry Baryshkov 	.ln_shrd	= 0x0e00,
238686f70376SDmitry Baryshkov };
238786f70376SDmitry Baryshkov 
238894a407ccSDmitry Baryshkov static const struct qmp_phy_cfg ipq8074_pciephy_cfg = {
2389f02543faSJohan Hovold 	.lanes			= 1,
239094a407ccSDmitry Baryshkov 
2391bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v2,
2392bf46fa1dSDmitry Baryshkov 
2393d8c9a1e9SJohan Hovold 	.tbls = {
23942566ad8eSDmitry Baryshkov 		.serdes		= ipq8074_pcie_serdes_tbl,
23952566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(ipq8074_pcie_serdes_tbl),
23962566ad8eSDmitry Baryshkov 		.tx		= ipq8074_pcie_tx_tbl,
23972566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(ipq8074_pcie_tx_tbl),
23982566ad8eSDmitry Baryshkov 		.rx		= ipq8074_pcie_rx_tbl,
23992566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(ipq8074_pcie_rx_tbl),
24002566ad8eSDmitry Baryshkov 		.pcs		= ipq8074_pcie_pcs_tbl,
24012566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(ipq8074_pcie_pcs_tbl),
24022566ad8eSDmitry Baryshkov 	},
240394a407ccSDmitry Baryshkov 	.reset_list		= ipq8074_pciephy_reset_l,
240494a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(ipq8074_pciephy_reset_l),
240594a407ccSDmitry Baryshkov 	.vreg_list		= NULL,
240694a407ccSDmitry Baryshkov 	.num_vregs		= 0,
2407bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v2_regs_layout,
240894a407ccSDmitry Baryshkov 
240994a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
241094a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
241194a407ccSDmitry Baryshkov };
241294a407ccSDmitry Baryshkov 
2413334fad18SRobert Marko static const struct qmp_phy_cfg ipq8074_pciephy_gen3_cfg = {
2414f02543faSJohan Hovold 	.lanes			= 1,
2415334fad18SRobert Marko 
2416bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v4x1,
2417bf46fa1dSDmitry Baryshkov 
2418d8c9a1e9SJohan Hovold 	.tbls = {
24192566ad8eSDmitry Baryshkov 		.serdes		= ipq8074_pcie_gen3_serdes_tbl,
24202566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(ipq8074_pcie_gen3_serdes_tbl),
24212566ad8eSDmitry Baryshkov 		.tx		= ipq8074_pcie_gen3_tx_tbl,
24222566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(ipq8074_pcie_gen3_tx_tbl),
24232566ad8eSDmitry Baryshkov 		.rx		= ipq8074_pcie_gen3_rx_tbl,
24242566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(ipq8074_pcie_gen3_rx_tbl),
24252566ad8eSDmitry Baryshkov 		.pcs		= ipq8074_pcie_gen3_pcs_tbl,
24262566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(ipq8074_pcie_gen3_pcs_tbl),
24272584068aSChristian Marangi 		.pcs_misc	= ipq8074_pcie_gen3_pcs_misc_tbl,
24282584068aSChristian Marangi 		.pcs_misc_num	= ARRAY_SIZE(ipq8074_pcie_gen3_pcs_misc_tbl),
24292566ad8eSDmitry Baryshkov 	},
2430334fad18SRobert Marko 	.reset_list		= ipq8074_pciephy_reset_l,
2431334fad18SRobert Marko 	.num_resets		= ARRAY_SIZE(ipq8074_pciephy_reset_l),
2432334fad18SRobert Marko 	.vreg_list		= NULL,
2433334fad18SRobert Marko 	.num_vregs		= 0,
2434bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v4_regs_layout,
2435334fad18SRobert Marko 
2436334fad18SRobert Marko 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
243794b7288eSJohan Hovold 	.phy_status		= PHYSTATUS,
2438334fad18SRobert Marko 
2439334fad18SRobert Marko 	.pipe_clock_rate	= 250000000,
2440334fad18SRobert Marko };
2441334fad18SRobert Marko 
244294a407ccSDmitry Baryshkov static const struct qmp_phy_cfg ipq6018_pciephy_cfg = {
2443f02543faSJohan Hovold 	.lanes			= 1,
244494a407ccSDmitry Baryshkov 
2445bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v4x1,
2446bf46fa1dSDmitry Baryshkov 
2447d8c9a1e9SJohan Hovold 	.tbls = {
24482566ad8eSDmitry Baryshkov 		.serdes		= ipq6018_pcie_serdes_tbl,
24492566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(ipq6018_pcie_serdes_tbl),
24502566ad8eSDmitry Baryshkov 		.tx		= ipq6018_pcie_tx_tbl,
24512566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(ipq6018_pcie_tx_tbl),
24522566ad8eSDmitry Baryshkov 		.rx		= ipq6018_pcie_rx_tbl,
24532566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(ipq6018_pcie_rx_tbl),
24542566ad8eSDmitry Baryshkov 		.pcs		= ipq6018_pcie_pcs_tbl,
24552566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(ipq6018_pcie_pcs_tbl),
24562566ad8eSDmitry Baryshkov 		.pcs_misc	= ipq6018_pcie_pcs_misc_tbl,
24572566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(ipq6018_pcie_pcs_misc_tbl),
24582566ad8eSDmitry Baryshkov 	},
245994a407ccSDmitry Baryshkov 	.reset_list		= ipq8074_pciephy_reset_l,
246094a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(ipq8074_pciephy_reset_l),
246194a407ccSDmitry Baryshkov 	.vreg_list		= NULL,
246294a407ccSDmitry Baryshkov 	.num_vregs		= 0,
2463bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v4_regs_layout,
246494a407ccSDmitry Baryshkov 
246594a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
246630518b19SJohan Hovold 	.phy_status		= PHYSTATUS,
246794a407ccSDmitry Baryshkov };
246894a407ccSDmitry Baryshkov 
246994a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sdm845_qmp_pciephy_cfg = {
2470f02543faSJohan Hovold 	.lanes			= 1,
247194a407ccSDmitry Baryshkov 
2472bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v3,
2473bf46fa1dSDmitry Baryshkov 
2474d8c9a1e9SJohan Hovold 	.tbls = {
24752566ad8eSDmitry Baryshkov 		.serdes		= sdm845_qmp_pcie_serdes_tbl,
24762566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sdm845_qmp_pcie_serdes_tbl),
24772566ad8eSDmitry Baryshkov 		.tx		= sdm845_qmp_pcie_tx_tbl,
24782566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sdm845_qmp_pcie_tx_tbl),
24792566ad8eSDmitry Baryshkov 		.rx		= sdm845_qmp_pcie_rx_tbl,
24802566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sdm845_qmp_pcie_rx_tbl),
24812566ad8eSDmitry Baryshkov 		.pcs		= sdm845_qmp_pcie_pcs_tbl,
24822566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sdm845_qmp_pcie_pcs_tbl),
24832566ad8eSDmitry Baryshkov 		.pcs_misc	= sdm845_qmp_pcie_pcs_misc_tbl,
24842566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sdm845_qmp_pcie_pcs_misc_tbl),
24852566ad8eSDmitry Baryshkov 	},
248694a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
248794a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
248894a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
248994a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2490bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v3_regs_layout,
249194a407ccSDmitry Baryshkov 
249294a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
249394a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
249494a407ccSDmitry Baryshkov };
249594a407ccSDmitry Baryshkov 
249694a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sdm845_qhp_pciephy_cfg = {
2497f02543faSJohan Hovold 	.lanes			= 1,
249894a407ccSDmitry Baryshkov 
2499bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_qhp,
2500bf46fa1dSDmitry Baryshkov 
2501d8c9a1e9SJohan Hovold 	.tbls = {
25022566ad8eSDmitry Baryshkov 		.serdes		= sdm845_qhp_pcie_serdes_tbl,
25032566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sdm845_qhp_pcie_serdes_tbl),
25042566ad8eSDmitry Baryshkov 		.tx		= sdm845_qhp_pcie_tx_tbl,
25052566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sdm845_qhp_pcie_tx_tbl),
25062566ad8eSDmitry Baryshkov 		.pcs		= sdm845_qhp_pcie_pcs_tbl,
25072566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sdm845_qhp_pcie_pcs_tbl),
25082566ad8eSDmitry Baryshkov 	},
250994a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
251094a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
251194a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
251294a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
251394a407ccSDmitry Baryshkov 	.regs			= sdm845_qhp_pciephy_regs_layout,
251494a407ccSDmitry Baryshkov 
251594a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
251694a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
251794a407ccSDmitry Baryshkov };
251894a407ccSDmitry Baryshkov 
251994a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8250_qmp_gen3x1_pciephy_cfg = {
2520f02543faSJohan Hovold 	.lanes			= 1,
252194a407ccSDmitry Baryshkov 
2522bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v4x1,
2523bf46fa1dSDmitry Baryshkov 
2524d8c9a1e9SJohan Hovold 	.tbls = {
25252566ad8eSDmitry Baryshkov 		.serdes		= sm8250_qmp_pcie_serdes_tbl,
25262566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl),
25272566ad8eSDmitry Baryshkov 		.tx		= sm8250_qmp_pcie_tx_tbl,
25282566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8250_qmp_pcie_tx_tbl),
25292566ad8eSDmitry Baryshkov 		.rx		= sm8250_qmp_pcie_rx_tbl,
25302566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8250_qmp_pcie_rx_tbl),
25312566ad8eSDmitry Baryshkov 		.pcs		= sm8250_qmp_pcie_pcs_tbl,
25322566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8250_qmp_pcie_pcs_tbl),
25332566ad8eSDmitry Baryshkov 		.pcs_misc	= sm8250_qmp_pcie_pcs_misc_tbl,
25342566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8250_qmp_pcie_pcs_misc_tbl),
25352566ad8eSDmitry Baryshkov 	},
2536d8c9a1e9SJohan Hovold 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
25372566ad8eSDmitry Baryshkov 		.serdes		= sm8250_qmp_gen3x1_pcie_serdes_tbl,
25382566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_serdes_tbl),
25392566ad8eSDmitry Baryshkov 		.rx		= sm8250_qmp_gen3x1_pcie_rx_tbl,
25402566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_rx_tbl),
25412566ad8eSDmitry Baryshkov 		.pcs		= sm8250_qmp_gen3x1_pcie_pcs_tbl,
25422566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_pcs_tbl),
25432566ad8eSDmitry Baryshkov 		.pcs_misc	= sm8250_qmp_gen3x1_pcie_pcs_misc_tbl,
25442566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8250_qmp_gen3x1_pcie_pcs_misc_tbl),
25452566ad8eSDmitry Baryshkov 	},
254694a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
254794a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
254894a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
254994a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2550bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v4_regs_layout,
255194a407ccSDmitry Baryshkov 
255294a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
255394a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
255494a407ccSDmitry Baryshkov };
255594a407ccSDmitry Baryshkov 
255694a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8250_qmp_gen3x2_pciephy_cfg = {
2557f02543faSJohan Hovold 	.lanes			= 2,
255894a407ccSDmitry Baryshkov 
2559bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v4x2,
2560bf46fa1dSDmitry Baryshkov 
2561d8c9a1e9SJohan Hovold 	.tbls = {
25622566ad8eSDmitry Baryshkov 		.serdes		= sm8250_qmp_pcie_serdes_tbl,
25632566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8250_qmp_pcie_serdes_tbl),
25642566ad8eSDmitry Baryshkov 		.tx		= sm8250_qmp_pcie_tx_tbl,
25652566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8250_qmp_pcie_tx_tbl),
25662566ad8eSDmitry Baryshkov 		.rx		= sm8250_qmp_pcie_rx_tbl,
25672566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8250_qmp_pcie_rx_tbl),
25682566ad8eSDmitry Baryshkov 		.pcs		= sm8250_qmp_pcie_pcs_tbl,
25692566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8250_qmp_pcie_pcs_tbl),
25702566ad8eSDmitry Baryshkov 		.pcs_misc	= sm8250_qmp_pcie_pcs_misc_tbl,
25712566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8250_qmp_pcie_pcs_misc_tbl),
25722566ad8eSDmitry Baryshkov 	},
2573d8c9a1e9SJohan Hovold 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
25742566ad8eSDmitry Baryshkov 		.tx		= sm8250_qmp_gen3x2_pcie_tx_tbl,
25752566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_tx_tbl),
25762566ad8eSDmitry Baryshkov 		.rx		= sm8250_qmp_gen3x2_pcie_rx_tbl,
25772566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_rx_tbl),
25782566ad8eSDmitry Baryshkov 		.pcs		= sm8250_qmp_gen3x2_pcie_pcs_tbl,
25792566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_pcs_tbl),
25802566ad8eSDmitry Baryshkov 		.pcs_misc	= sm8250_qmp_gen3x2_pcie_pcs_misc_tbl,
25812566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8250_qmp_gen3x2_pcie_pcs_misc_tbl),
25822566ad8eSDmitry Baryshkov 	},
258394a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
258494a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
258594a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
258694a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2587bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v4_regs_layout,
258894a407ccSDmitry Baryshkov 
258994a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
259094a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
259194a407ccSDmitry Baryshkov };
259294a407ccSDmitry Baryshkov 
259394a407ccSDmitry Baryshkov static const struct qmp_phy_cfg msm8998_pciephy_cfg = {
2594f02543faSJohan Hovold 	.lanes			= 1,
259594a407ccSDmitry Baryshkov 
2596bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v3,
2597bf46fa1dSDmitry Baryshkov 
2598d8c9a1e9SJohan Hovold 	.tbls = {
25992566ad8eSDmitry Baryshkov 		.serdes		= msm8998_pcie_serdes_tbl,
26002566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(msm8998_pcie_serdes_tbl),
26012566ad8eSDmitry Baryshkov 		.tx		= msm8998_pcie_tx_tbl,
26022566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(msm8998_pcie_tx_tbl),
26032566ad8eSDmitry Baryshkov 		.rx		= msm8998_pcie_rx_tbl,
26042566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(msm8998_pcie_rx_tbl),
26052566ad8eSDmitry Baryshkov 		.pcs		= msm8998_pcie_pcs_tbl,
26062566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(msm8998_pcie_pcs_tbl),
26072566ad8eSDmitry Baryshkov 	},
260894a407ccSDmitry Baryshkov 	.reset_list		= ipq8074_pciephy_reset_l,
260994a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(ipq8074_pciephy_reset_l),
261094a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
261194a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2612bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v3_regs_layout,
261394a407ccSDmitry Baryshkov 
261494a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
261594a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
261651bd3306SJohan Hovold 
261751bd3306SJohan Hovold 	.skip_start_delay	= true,
261894a407ccSDmitry Baryshkov };
261994a407ccSDmitry Baryshkov 
262094a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sc8180x_pciephy_cfg = {
26211db6b0a4SDmitry Baryshkov 	.lanes			= 2,
262294a407ccSDmitry Baryshkov 
2623bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v4x2,
2624bf46fa1dSDmitry Baryshkov 
2625d8c9a1e9SJohan Hovold 	.tbls = {
26262566ad8eSDmitry Baryshkov 		.serdes		= sc8180x_qmp_pcie_serdes_tbl,
26272566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sc8180x_qmp_pcie_serdes_tbl),
26282566ad8eSDmitry Baryshkov 		.tx		= sc8180x_qmp_pcie_tx_tbl,
26292566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sc8180x_qmp_pcie_tx_tbl),
26302566ad8eSDmitry Baryshkov 		.rx		= sc8180x_qmp_pcie_rx_tbl,
26312566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sc8180x_qmp_pcie_rx_tbl),
26322566ad8eSDmitry Baryshkov 		.pcs		= sc8180x_qmp_pcie_pcs_tbl,
26332566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sc8180x_qmp_pcie_pcs_tbl),
26342566ad8eSDmitry Baryshkov 		.pcs_misc	= sc8180x_qmp_pcie_pcs_misc_tbl,
26352566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sc8180x_qmp_pcie_pcs_misc_tbl),
26362566ad8eSDmitry Baryshkov 	},
263794a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
263894a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
263994a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
264094a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2641bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v4_regs_layout,
264294a407ccSDmitry Baryshkov 
264394a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
26444a9eac5aSJohan Hovold 	.phy_status		= PHYSTATUS,
264594a407ccSDmitry Baryshkov };
264694a407ccSDmitry Baryshkov 
2647d0a846baSJohan Hovold static const struct qmp_phy_cfg sc8280xp_qmp_gen3x1_pciephy_cfg = {
2648d0a846baSJohan Hovold 	.lanes			= 1,
2649d0a846baSJohan Hovold 
2650d0a846baSJohan Hovold 	.offsets		= &qmp_pcie_offsets_v5,
2651d0a846baSJohan Hovold 
2652d0a846baSJohan Hovold 	.tbls = {
2653d0a846baSJohan Hovold 		.serdes		= sc8280xp_qmp_pcie_serdes_tbl,
2654d0a846baSJohan Hovold 		.serdes_num	= ARRAY_SIZE(sc8280xp_qmp_pcie_serdes_tbl),
2655d0a846baSJohan Hovold 		.tx		= sc8280xp_qmp_gen3x1_pcie_tx_tbl,
2656d0a846baSJohan Hovold 		.tx_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x1_pcie_tx_tbl),
2657d0a846baSJohan Hovold 		.rx		= sc8280xp_qmp_gen3x1_pcie_rx_tbl,
2658d0a846baSJohan Hovold 		.rx_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x1_pcie_rx_tbl),
2659d0a846baSJohan Hovold 		.pcs		= sc8280xp_qmp_gen3x1_pcie_pcs_tbl,
2660d0a846baSJohan Hovold 		.pcs_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x1_pcie_pcs_tbl),
2661d0a846baSJohan Hovold 		.pcs_misc	= sc8280xp_qmp_gen3x1_pcie_pcs_misc_tbl,
2662d0a846baSJohan Hovold 		.pcs_misc_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x1_pcie_pcs_misc_tbl),
2663d0a846baSJohan Hovold 	},
2664d0a846baSJohan Hovold 
2665d0a846baSJohan Hovold 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2666d0a846baSJohan Hovold 		.serdes		= sc8280xp_qmp_gen3x1_pcie_rc_serdes_tbl,
2667d0a846baSJohan Hovold 		.serdes_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x1_pcie_rc_serdes_tbl),
2668d0a846baSJohan Hovold 	},
2669d0a846baSJohan Hovold 
2670d0a846baSJohan Hovold 	.reset_list		= sdm845_pciephy_reset_l,
2671d0a846baSJohan Hovold 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
2672d0a846baSJohan Hovold 	.vreg_list		= qmp_phy_vreg_l,
2673d0a846baSJohan Hovold 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2674bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
2675d0a846baSJohan Hovold 
2676d0a846baSJohan Hovold 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
2677d0a846baSJohan Hovold 	.phy_status		= PHYSTATUS,
2678d0a846baSJohan Hovold };
2679d0a846baSJohan Hovold 
2680d0a846baSJohan Hovold static const struct qmp_phy_cfg sc8280xp_qmp_gen3x2_pciephy_cfg = {
2681d0a846baSJohan Hovold 	.lanes			= 2,
2682d0a846baSJohan Hovold 
2683d0a846baSJohan Hovold 	.offsets		= &qmp_pcie_offsets_v5,
2684d0a846baSJohan Hovold 
2685d0a846baSJohan Hovold 	.tbls = {
2686d0a846baSJohan Hovold 		.serdes		= sc8280xp_qmp_pcie_serdes_tbl,
2687d0a846baSJohan Hovold 		.serdes_num	= ARRAY_SIZE(sc8280xp_qmp_pcie_serdes_tbl),
2688d0a846baSJohan Hovold 		.tx		= sc8280xp_qmp_gen3x2_pcie_tx_tbl,
2689d0a846baSJohan Hovold 		.tx_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_tx_tbl),
2690d0a846baSJohan Hovold 		.rx		= sc8280xp_qmp_gen3x2_pcie_rx_tbl,
2691d0a846baSJohan Hovold 		.rx_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_rx_tbl),
2692d0a846baSJohan Hovold 		.pcs		= sc8280xp_qmp_gen3x2_pcie_pcs_tbl,
2693d0a846baSJohan Hovold 		.pcs_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_pcs_tbl),
2694d0a846baSJohan Hovold 		.pcs_misc	= sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl,
2695d0a846baSJohan Hovold 		.pcs_misc_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl),
2696d0a846baSJohan Hovold 	},
2697d0a846baSJohan Hovold 
2698d0a846baSJohan Hovold 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2699d0a846baSJohan Hovold 		.serdes		= sc8280xp_qmp_gen3x2_pcie_rc_serdes_tbl,
2700d0a846baSJohan Hovold 		.serdes_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_rc_serdes_tbl),
2701d0a846baSJohan Hovold 	},
2702d0a846baSJohan Hovold 
2703d0a846baSJohan Hovold 	.reset_list		= sdm845_pciephy_reset_l,
2704d0a846baSJohan Hovold 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
2705d0a846baSJohan Hovold 	.vreg_list		= qmp_phy_vreg_l,
2706d0a846baSJohan Hovold 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2707bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
2708d0a846baSJohan Hovold 
2709d0a846baSJohan Hovold 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
2710d0a846baSJohan Hovold 	.phy_status		= PHYSTATUS,
2711d0a846baSJohan Hovold };
2712d0a846baSJohan Hovold 
27136c37a02bSJohan Hovold static const struct qmp_phy_cfg sc8280xp_qmp_gen3x4_pciephy_cfg = {
27146c37a02bSJohan Hovold 	.lanes			= 4,
27156c37a02bSJohan Hovold 
27166c37a02bSJohan Hovold 	.offsets		= &qmp_pcie_offsets_v5,
27176c37a02bSJohan Hovold 
27186c37a02bSJohan Hovold 	.tbls = {
27196c37a02bSJohan Hovold 		.serdes		= sc8280xp_qmp_pcie_serdes_tbl,
27206c37a02bSJohan Hovold 		.serdes_num	= ARRAY_SIZE(sc8280xp_qmp_pcie_serdes_tbl),
27216c37a02bSJohan Hovold 		.tx		= sc8280xp_qmp_gen3x2_pcie_tx_tbl,
27226c37a02bSJohan Hovold 		.tx_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_tx_tbl),
27236c37a02bSJohan Hovold 		.rx		= sc8280xp_qmp_gen3x2_pcie_rx_tbl,
27246c37a02bSJohan Hovold 		.rx_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_rx_tbl),
27256c37a02bSJohan Hovold 		.pcs		= sc8280xp_qmp_gen3x2_pcie_pcs_tbl,
27266c37a02bSJohan Hovold 		.pcs_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_pcs_tbl),
27276c37a02bSJohan Hovold 		.pcs_misc	= sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl,
27286c37a02bSJohan Hovold 		.pcs_misc_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl),
27296c37a02bSJohan Hovold 	},
27306c37a02bSJohan Hovold 
27316c37a02bSJohan Hovold 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
27326c37a02bSJohan Hovold 		.serdes		= sc8280xp_qmp_gen3x2_pcie_rc_serdes_tbl,
27336c37a02bSJohan Hovold 		.serdes_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_rc_serdes_tbl),
27346c37a02bSJohan Hovold 	},
27356c37a02bSJohan Hovold 
27366c37a02bSJohan Hovold 	.serdes_4ln_tbl		= sc8280xp_qmp_gen3x4_pcie_serdes_4ln_tbl,
27376c37a02bSJohan Hovold 	.serdes_4ln_num		= ARRAY_SIZE(sc8280xp_qmp_gen3x4_pcie_serdes_4ln_tbl),
27386c37a02bSJohan Hovold 
27396c37a02bSJohan Hovold 	.reset_list		= sdm845_pciephy_reset_l,
27406c37a02bSJohan Hovold 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
27416c37a02bSJohan Hovold 	.vreg_list		= qmp_phy_vreg_l,
27426c37a02bSJohan Hovold 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2743bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
27446c37a02bSJohan Hovold 
27456c37a02bSJohan Hovold 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
27466c37a02bSJohan Hovold 	.phy_status		= PHYSTATUS,
27476c37a02bSJohan Hovold };
27486c37a02bSJohan Hovold 
274994a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sdx55_qmp_pciephy_cfg = {
2750f02543faSJohan Hovold 	.lanes			= 2,
275194a407ccSDmitry Baryshkov 
2752bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v4_20,
2753bf46fa1dSDmitry Baryshkov 
2754d8c9a1e9SJohan Hovold 	.tbls = {
27552566ad8eSDmitry Baryshkov 		.serdes		= sdx55_qmp_pcie_serdes_tbl,
27562566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sdx55_qmp_pcie_serdes_tbl),
27572566ad8eSDmitry Baryshkov 		.tx		= sdx55_qmp_pcie_tx_tbl,
27582566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sdx55_qmp_pcie_tx_tbl),
27592566ad8eSDmitry Baryshkov 		.rx		= sdx55_qmp_pcie_rx_tbl,
27602566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sdx55_qmp_pcie_rx_tbl),
27612566ad8eSDmitry Baryshkov 		.pcs		= sdx55_qmp_pcie_pcs_tbl,
27622566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sdx55_qmp_pcie_pcs_tbl),
27632566ad8eSDmitry Baryshkov 		.pcs_misc	= sdx55_qmp_pcie_pcs_misc_tbl,
27642566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sdx55_qmp_pcie_pcs_misc_tbl),
27652566ad8eSDmitry Baryshkov 	},
2766458aa820SManivannan Sadhasivam 
2767364c748dSManivannan Sadhasivam 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2768364c748dSManivannan Sadhasivam 		.serdes		= sdx55_qmp_pcie_rc_serdes_tbl,
2769364c748dSManivannan Sadhasivam 		.serdes_num	= ARRAY_SIZE(sdx55_qmp_pcie_rc_serdes_tbl),
2770364c748dSManivannan Sadhasivam 		.pcs_misc	= sdx55_qmp_pcie_rc_pcs_misc_tbl,
2771364c748dSManivannan Sadhasivam 		.pcs_misc_num	= ARRAY_SIZE(sdx55_qmp_pcie_rc_pcs_misc_tbl),
2772364c748dSManivannan Sadhasivam 	},
2773364c748dSManivannan Sadhasivam 
2774458aa820SManivannan Sadhasivam 	.tbls_ep = &(const struct qmp_phy_cfg_tbls) {
2775458aa820SManivannan Sadhasivam 		.serdes		= sdx55_qmp_pcie_ep_serdes_tbl,
2776458aa820SManivannan Sadhasivam 		.serdes_num	= ARRAY_SIZE(sdx55_qmp_pcie_ep_serdes_tbl),
2777458aa820SManivannan Sadhasivam 		.pcs_misc	= sdx55_qmp_pcie_ep_pcs_misc_tbl,
2778458aa820SManivannan Sadhasivam 		.pcs_misc_num	= ARRAY_SIZE(sdx55_qmp_pcie_ep_pcs_misc_tbl),
2779458aa820SManivannan Sadhasivam 	},
2780458aa820SManivannan Sadhasivam 
278194a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
278294a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
278394a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
278494a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2785bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v4_regs_layout,
278694a407ccSDmitry Baryshkov 
2787364c748dSManivannan Sadhasivam 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
278894a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS_4_20,
278994a407ccSDmitry Baryshkov };
279094a407ccSDmitry Baryshkov 
2791c7005273SDmitry Baryshkov static const struct qmp_phy_cfg sm8350_qmp_gen3x1_pciephy_cfg = {
2792c7005273SDmitry Baryshkov 	.lanes			= 1,
2793c7005273SDmitry Baryshkov 
2794c7005273SDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v5,
2795c7005273SDmitry Baryshkov 
2796c7005273SDmitry Baryshkov 	.tbls = {
2797c7005273SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen3_pcie_serdes_tbl,
2798c7005273SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen3_pcie_serdes_tbl),
2799c7005273SDmitry Baryshkov 		.tx		= sm8350_qmp_gen3x1_pcie_tx_tbl,
2800c7005273SDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8350_qmp_gen3x1_pcie_tx_tbl),
2801c7005273SDmitry Baryshkov 		.rx		= sm8450_qmp_gen3_pcie_rx_tbl,
2802c7005273SDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8450_qmp_gen3_pcie_rx_tbl),
2803c7005273SDmitry Baryshkov 		.pcs		= sm8450_qmp_gen3_pcie_pcs_tbl,
2804c7005273SDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8450_qmp_gen3_pcie_pcs_tbl),
2805c7005273SDmitry Baryshkov 		.pcs_misc	= sm8450_qmp_gen3x1_pcie_pcs_misc_tbl,
2806c7005273SDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_pcs_misc_tbl),
2807c7005273SDmitry Baryshkov 	},
2808c7005273SDmitry Baryshkov 
2809c7005273SDmitry Baryshkov 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2810c7005273SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen3x1_pcie_rc_serdes_tbl,
2811c7005273SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_rc_serdes_tbl),
2812c7005273SDmitry Baryshkov 		.rx		= sm8350_qmp_gen3x1_pcie_rc_rx_tbl,
2813c7005273SDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8350_qmp_gen3x1_pcie_rc_rx_tbl),
2814c7005273SDmitry Baryshkov 	},
2815c7005273SDmitry Baryshkov 
2816c7005273SDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
2817c7005273SDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
2818c7005273SDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
2819c7005273SDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2820bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
2821c7005273SDmitry Baryshkov 
2822c7005273SDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
2823c7005273SDmitry Baryshkov 	.phy_status		= PHYSTATUS,
2824c7005273SDmitry Baryshkov };
2825c7005273SDmitry Baryshkov 
2826c7005273SDmitry Baryshkov static const struct qmp_phy_cfg sm8350_qmp_gen3x2_pciephy_cfg = {
2827c7005273SDmitry Baryshkov 	.lanes			= 2,
2828c7005273SDmitry Baryshkov 
2829c7005273SDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v5,
2830c7005273SDmitry Baryshkov 
2831c7005273SDmitry Baryshkov 	.tbls = {
2832c7005273SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen3_pcie_serdes_tbl,
2833c7005273SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen3_pcie_serdes_tbl),
2834c7005273SDmitry Baryshkov 		.tx		= sm8350_qmp_gen3x2_pcie_tx_tbl,
2835c7005273SDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8350_qmp_gen3x2_pcie_tx_tbl),
2836c7005273SDmitry Baryshkov 		.rx		= sm8450_qmp_gen3_pcie_rx_tbl,
2837c7005273SDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8450_qmp_gen3_pcie_rx_tbl),
2838c7005273SDmitry Baryshkov 		.pcs		= sm8450_qmp_gen3_pcie_pcs_tbl,
2839c7005273SDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8450_qmp_gen3_pcie_pcs_tbl),
2840c7005273SDmitry Baryshkov 		.pcs_misc	= sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl,
2841c7005273SDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sc8280xp_qmp_gen3x2_pcie_pcs_misc_tbl),
2842c7005273SDmitry Baryshkov 	},
2843c7005273SDmitry Baryshkov 
2844c7005273SDmitry Baryshkov 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2845c7005273SDmitry Baryshkov 		.rx		= sm8350_qmp_gen3x2_pcie_rc_rx_tbl,
2846c7005273SDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8350_qmp_gen3x2_pcie_rc_rx_tbl),
2847c7005273SDmitry Baryshkov 		.pcs		= sm8350_qmp_gen3x2_pcie_rc_pcs_tbl,
2848c7005273SDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8350_qmp_gen3x2_pcie_rc_pcs_tbl),
2849c7005273SDmitry Baryshkov 	},
2850c7005273SDmitry Baryshkov 
2851c7005273SDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
2852c7005273SDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
2853c7005273SDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
2854c7005273SDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2855bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
2856c7005273SDmitry Baryshkov 
2857c7005273SDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
2858c7005273SDmitry Baryshkov 	.phy_status		= PHYSTATUS,
2859c7005273SDmitry Baryshkov };
2860c7005273SDmitry Baryshkov 
286192bd868fSRohit Agarwal static const struct qmp_phy_cfg sdx65_qmp_pciephy_cfg = {
286292bd868fSRohit Agarwal 	.lanes                  = 2,
286392bd868fSRohit Agarwal 
286492bd868fSRohit Agarwal 	.offsets		= &qmp_pcie_offsets_v6_20,
286592bd868fSRohit Agarwal 
286692bd868fSRohit Agarwal 	.tbls = {
286792bd868fSRohit Agarwal 			.serdes         = sdx65_qmp_pcie_serdes_tbl,
286892bd868fSRohit Agarwal 			.serdes_num     = ARRAY_SIZE(sdx65_qmp_pcie_serdes_tbl),
286992bd868fSRohit Agarwal 			.tx             = sdx65_qmp_pcie_tx_tbl,
287092bd868fSRohit Agarwal 			.tx_num         = ARRAY_SIZE(sdx65_qmp_pcie_tx_tbl),
287192bd868fSRohit Agarwal 			.rx             = sdx65_qmp_pcie_rx_tbl,
287292bd868fSRohit Agarwal 			.rx_num         = ARRAY_SIZE(sdx65_qmp_pcie_rx_tbl),
287392bd868fSRohit Agarwal 			.pcs            = sdx65_qmp_pcie_pcs_tbl,
287492bd868fSRohit Agarwal 			.pcs_num        = ARRAY_SIZE(sdx65_qmp_pcie_pcs_tbl),
287592bd868fSRohit Agarwal 			.pcs_misc       = sdx65_qmp_pcie_pcs_misc_tbl,
287692bd868fSRohit Agarwal 			.pcs_misc_num   = ARRAY_SIZE(sdx65_qmp_pcie_pcs_misc_tbl),
287792bd868fSRohit Agarwal 		},
287892bd868fSRohit Agarwal 	.reset_list             = sdm845_pciephy_reset_l,
287992bd868fSRohit Agarwal 	.num_resets             = ARRAY_SIZE(sdm845_pciephy_reset_l),
288092bd868fSRohit Agarwal 	.vreg_list              = qmp_phy_vreg_l,
288192bd868fSRohit Agarwal 	.num_vregs              = ARRAY_SIZE(qmp_phy_vreg_l),
288292bd868fSRohit Agarwal 	.regs                   = pciephy_v5_regs_layout,
288392bd868fSRohit Agarwal 
288492bd868fSRohit Agarwal 	.pwrdn_ctrl             = SW_PWRDN,
288592bd868fSRohit Agarwal 	.phy_status             = PHYSTATUS_4_20,
288692bd868fSRohit Agarwal };
288792bd868fSRohit Agarwal 
288894a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8450_qmp_gen3x1_pciephy_cfg = {
2889f02543faSJohan Hovold 	.lanes			= 1,
289094a407ccSDmitry Baryshkov 
2891bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v5,
2892bf46fa1dSDmitry Baryshkov 
2893d8c9a1e9SJohan Hovold 	.tbls = {
2894c99649c3SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen3_pcie_serdes_tbl,
2895c99649c3SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen3_pcie_serdes_tbl),
28962566ad8eSDmitry Baryshkov 		.tx		= sm8450_qmp_gen3x1_pcie_tx_tbl,
28972566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_tx_tbl),
2898c99649c3SDmitry Baryshkov 		.rx		= sm8450_qmp_gen3_pcie_rx_tbl,
2899c99649c3SDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8450_qmp_gen3_pcie_rx_tbl),
2900c99649c3SDmitry Baryshkov 		.pcs		= sm8450_qmp_gen3_pcie_pcs_tbl,
2901c99649c3SDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8450_qmp_gen3_pcie_pcs_tbl),
29022566ad8eSDmitry Baryshkov 		.pcs_misc	= sm8450_qmp_gen3x1_pcie_pcs_misc_tbl,
29032566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_pcs_misc_tbl),
29042566ad8eSDmitry Baryshkov 	},
2905d8de49e9SDmitry Baryshkov 
2906d8de49e9SDmitry Baryshkov 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2907d8de49e9SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen3x1_pcie_rc_serdes_tbl,
2908d8de49e9SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_rc_serdes_tbl),
2909d8de49e9SDmitry Baryshkov 		.rx		= sm8450_qmp_gen3x1_pcie_rc_rx_tbl,
2910d8de49e9SDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8450_qmp_gen3x1_pcie_rc_rx_tbl),
2911d8de49e9SDmitry Baryshkov 	},
2912d8de49e9SDmitry Baryshkov 
291394a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
291494a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
291594a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
291694a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2917c08436c1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
291894a407ccSDmitry Baryshkov 
291994a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
292094a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS,
292194a407ccSDmitry Baryshkov };
292294a407ccSDmitry Baryshkov 
292394a407ccSDmitry Baryshkov static const struct qmp_phy_cfg sm8450_qmp_gen4x2_pciephy_cfg = {
2924f02543faSJohan Hovold 	.lanes			= 2,
292594a407ccSDmitry Baryshkov 
2926bf46fa1dSDmitry Baryshkov 	.offsets		= &qmp_pcie_offsets_v5_20,
2927bf46fa1dSDmitry Baryshkov 
2928d8c9a1e9SJohan Hovold 	.tbls = {
29292566ad8eSDmitry Baryshkov 		.serdes		= sm8450_qmp_gen4x2_pcie_serdes_tbl,
29302566ad8eSDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_serdes_tbl),
29312566ad8eSDmitry Baryshkov 		.tx		= sm8450_qmp_gen4x2_pcie_tx_tbl,
29322566ad8eSDmitry Baryshkov 		.tx_num		= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_tx_tbl),
29332566ad8eSDmitry Baryshkov 		.rx		= sm8450_qmp_gen4x2_pcie_rx_tbl,
29342566ad8eSDmitry Baryshkov 		.rx_num		= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_rx_tbl),
29352566ad8eSDmitry Baryshkov 		.pcs		= sm8450_qmp_gen4x2_pcie_pcs_tbl,
29362566ad8eSDmitry Baryshkov 		.pcs_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_pcs_tbl),
29372566ad8eSDmitry Baryshkov 		.pcs_misc	= sm8450_qmp_gen4x2_pcie_pcs_misc_tbl,
29382566ad8eSDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_pcs_misc_tbl),
29392566ad8eSDmitry Baryshkov 	},
2940f5682f13SDmitry Baryshkov 
2941d8c9a1e9SJohan Hovold 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
2942f5682f13SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen4x2_pcie_rc_serdes_tbl,
2943f5682f13SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_rc_serdes_tbl),
2944f5682f13SDmitry Baryshkov 		.pcs_misc	= sm8450_qmp_gen4x2_pcie_rc_pcs_misc_tbl,
2945f5682f13SDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_rc_pcs_misc_tbl),
2946f5682f13SDmitry Baryshkov 	},
2947f5682f13SDmitry Baryshkov 
2948d8c9a1e9SJohan Hovold 	.tbls_ep = &(const struct qmp_phy_cfg_tbls) {
2949f5682f13SDmitry Baryshkov 		.serdes		= sm8450_qmp_gen4x2_pcie_ep_serdes_tbl,
2950f5682f13SDmitry Baryshkov 		.serdes_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_ep_serdes_tbl),
2951f5682f13SDmitry Baryshkov 		.pcs_misc	= sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl,
2952f5682f13SDmitry Baryshkov 		.pcs_misc_num	= ARRAY_SIZE(sm8450_qmp_gen4x2_pcie_ep_pcs_misc_tbl),
2953f5682f13SDmitry Baryshkov 	},
2954f5682f13SDmitry Baryshkov 
295594a407ccSDmitry Baryshkov 	.reset_list		= sdm845_pciephy_reset_l,
295694a407ccSDmitry Baryshkov 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
295794a407ccSDmitry Baryshkov 	.vreg_list		= qmp_phy_vreg_l,
295894a407ccSDmitry Baryshkov 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2959bbe207a1SDmitry Baryshkov 	.regs			= pciephy_v5_regs_layout,
296094a407ccSDmitry Baryshkov 
296194a407ccSDmitry Baryshkov 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
296294a407ccSDmitry Baryshkov 	.phy_status		= PHYSTATUS_4_20,
296394a407ccSDmitry Baryshkov };
296494a407ccSDmitry Baryshkov 
2965269b70e8SAbel Vesa static const struct qmp_phy_cfg sm8550_qmp_gen3x2_pciephy_cfg = {
2966269b70e8SAbel Vesa 	.lanes = 2,
2967269b70e8SAbel Vesa 
2968269b70e8SAbel Vesa 	.offsets		= &qmp_pcie_offsets_v5,
2969269b70e8SAbel Vesa 
2970269b70e8SAbel Vesa 	.tbls = {
2971269b70e8SAbel Vesa 		.serdes		= sm8550_qmp_gen3x2_pcie_serdes_tbl,
2972269b70e8SAbel Vesa 		.serdes_num	= ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_serdes_tbl),
2973269b70e8SAbel Vesa 		.tx		= sm8550_qmp_gen3x2_pcie_tx_tbl,
2974269b70e8SAbel Vesa 		.tx_num		= ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_tx_tbl),
2975269b70e8SAbel Vesa 		.rx		= sm8550_qmp_gen3x2_pcie_rx_tbl,
2976269b70e8SAbel Vesa 		.rx_num		= ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_rx_tbl),
2977269b70e8SAbel Vesa 		.pcs		= sm8550_qmp_gen3x2_pcie_pcs_tbl,
2978269b70e8SAbel Vesa 		.pcs_num	= ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_pcs_tbl),
2979269b70e8SAbel Vesa 		.pcs_misc	= sm8550_qmp_gen3x2_pcie_pcs_misc_tbl,
2980269b70e8SAbel Vesa 		.pcs_misc_num	= ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_pcs_misc_tbl),
2981269b70e8SAbel Vesa 	},
2982269b70e8SAbel Vesa 	.reset_list		= sdm845_pciephy_reset_l,
2983269b70e8SAbel Vesa 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
2984269b70e8SAbel Vesa 	.vreg_list		= qmp_phy_vreg_l,
2985269b70e8SAbel Vesa 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
2986269b70e8SAbel Vesa 	.regs			= pciephy_v5_regs_layout,
2987269b70e8SAbel Vesa 
2988269b70e8SAbel Vesa 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
2989269b70e8SAbel Vesa 	.phy_status		= PHYSTATUS,
2990269b70e8SAbel Vesa };
2991269b70e8SAbel Vesa 
2992269b70e8SAbel Vesa static const struct qmp_phy_cfg sm8550_qmp_gen4x2_pciephy_cfg = {
2993269b70e8SAbel Vesa 	.lanes = 2,
2994269b70e8SAbel Vesa 
2995269b70e8SAbel Vesa 	.offsets		= &qmp_pcie_offsets_v6_20,
2996269b70e8SAbel Vesa 
2997269b70e8SAbel Vesa 	.tbls = {
2998269b70e8SAbel Vesa 		.serdes			= sm8550_qmp_gen4x2_pcie_serdes_tbl,
2999269b70e8SAbel Vesa 		.serdes_num		= ARRAY_SIZE(sm8550_qmp_gen4x2_pcie_serdes_tbl),
3000269b70e8SAbel Vesa 		.tx			= sm8550_qmp_gen4x2_pcie_tx_tbl,
3001269b70e8SAbel Vesa 		.tx_num			= ARRAY_SIZE(sm8550_qmp_gen4x2_pcie_tx_tbl),
3002269b70e8SAbel Vesa 		.rx			= sm8550_qmp_gen4x2_pcie_rx_tbl,
3003269b70e8SAbel Vesa 		.rx_num			= ARRAY_SIZE(sm8550_qmp_gen4x2_pcie_rx_tbl),
3004269b70e8SAbel Vesa 		.pcs			= sm8550_qmp_gen4x2_pcie_pcs_tbl,
3005269b70e8SAbel Vesa 		.pcs_num		= ARRAY_SIZE(sm8550_qmp_gen4x2_pcie_pcs_tbl),
3006269b70e8SAbel Vesa 		.pcs_misc		= sm8550_qmp_gen4x2_pcie_pcs_misc_tbl,
3007269b70e8SAbel Vesa 		.pcs_misc_num		= ARRAY_SIZE(sm8550_qmp_gen4x2_pcie_pcs_misc_tbl),
3008269b70e8SAbel Vesa 		.ln_shrd		= sm8550_qmp_gen4x2_pcie_ln_shrd_tbl,
3009269b70e8SAbel Vesa 		.ln_shrd_num		= ARRAY_SIZE(sm8550_qmp_gen4x2_pcie_ln_shrd_tbl),
3010269b70e8SAbel Vesa 	},
3011269b70e8SAbel Vesa 	.reset_list		= sdm845_pciephy_reset_l,
3012269b70e8SAbel Vesa 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
3013269b70e8SAbel Vesa 	.vreg_list		= sm8550_qmp_phy_vreg_l,
3014269b70e8SAbel Vesa 	.num_vregs		= ARRAY_SIZE(sm8550_qmp_phy_vreg_l),
3015269b70e8SAbel Vesa 	.regs			= pciephy_v5_regs_layout,
3016269b70e8SAbel Vesa 
3017269b70e8SAbel Vesa 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
3018269b70e8SAbel Vesa 	.phy_status		= PHYSTATUS_4_20,
3019269b70e8SAbel Vesa 	.has_nocsr_reset	= true,
3020269b70e8SAbel Vesa };
3021269b70e8SAbel Vesa 
3022a05b6d51SMrinmay Sarkar static const struct qmp_phy_cfg sa8775p_qmp_gen4x2_pciephy_cfg = {
3023a05b6d51SMrinmay Sarkar 	.lanes			= 2,
3024a05b6d51SMrinmay Sarkar 	.offsets		= &qmp_pcie_offsets_v5_20,
3025a05b6d51SMrinmay Sarkar 
3026a05b6d51SMrinmay Sarkar 	.tbls = {
3027a05b6d51SMrinmay Sarkar 		.serdes		= sa8775p_qmp_gen4x2_pcie_serdes_alt_tbl,
3028a05b6d51SMrinmay Sarkar 		.serdes_num		= ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_serdes_alt_tbl),
3029a05b6d51SMrinmay Sarkar 		.tx		= sa8775p_qmp_gen4_pcie_tx_tbl,
3030a05b6d51SMrinmay Sarkar 		.tx_num		= ARRAY_SIZE(sa8775p_qmp_gen4_pcie_tx_tbl),
3031a05b6d51SMrinmay Sarkar 		.rx		= sa8775p_qmp_gen4x2_pcie_rx_alt_tbl,
3032a05b6d51SMrinmay Sarkar 		.rx_num		= ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_rx_alt_tbl),
3033a05b6d51SMrinmay Sarkar 		.pcs		= sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl,
3034a05b6d51SMrinmay Sarkar 		.pcs_num		= ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl),
3035a05b6d51SMrinmay Sarkar 		.pcs_misc		= sa8775p_qmp_gen4_pcie_pcs_misc_tbl,
3036a05b6d51SMrinmay Sarkar 		.pcs_misc_num	= ARRAY_SIZE(sa8775p_qmp_gen4_pcie_pcs_misc_tbl),
3037a05b6d51SMrinmay Sarkar 	},
3038a05b6d51SMrinmay Sarkar 
3039a05b6d51SMrinmay Sarkar 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
3040a05b6d51SMrinmay Sarkar 		.serdes		= sa8775p_qmp_gen4x2_pcie_rc_serdes_alt_tbl,
3041a05b6d51SMrinmay Sarkar 		.serdes_num	= ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_rc_serdes_alt_tbl),
3042a05b6d51SMrinmay Sarkar 		.pcs_misc	= sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl,
3043a05b6d51SMrinmay Sarkar 		.pcs_misc_num	= ARRAY_SIZE(sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl),
3044a05b6d51SMrinmay Sarkar 	},
3045a05b6d51SMrinmay Sarkar 
3046a05b6d51SMrinmay Sarkar 	.reset_list		= sdm845_pciephy_reset_l,
3047a05b6d51SMrinmay Sarkar 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
3048a05b6d51SMrinmay Sarkar 	.vreg_list		= qmp_phy_vreg_l,
3049a05b6d51SMrinmay Sarkar 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
3050a05b6d51SMrinmay Sarkar 	.regs			= pciephy_v5_regs_layout,
3051a05b6d51SMrinmay Sarkar 
3052a05b6d51SMrinmay Sarkar 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
3053a05b6d51SMrinmay Sarkar 	.phy_status		= PHYSTATUS_4_20,
3054a05b6d51SMrinmay Sarkar };
3055a05b6d51SMrinmay Sarkar 
3056a05b6d51SMrinmay Sarkar static const struct qmp_phy_cfg sa8775p_qmp_gen4x4_pciephy_cfg = {
3057a05b6d51SMrinmay Sarkar 	.lanes = 4,
3058a05b6d51SMrinmay Sarkar 	.offsets		= &qmp_pcie_offsets_v5_30,
3059a05b6d51SMrinmay Sarkar 
3060a05b6d51SMrinmay Sarkar 	.tbls = {
3061a05b6d51SMrinmay Sarkar 		.serdes		= sa8775p_qmp_gen4x4_pcie_serdes_alt_tbl,
3062a05b6d51SMrinmay Sarkar 		.serdes_num		= ARRAY_SIZE(sa8775p_qmp_gen4x4_pcie_serdes_alt_tbl),
3063a05b6d51SMrinmay Sarkar 		.tx		= sa8775p_qmp_gen4_pcie_tx_tbl,
3064a05b6d51SMrinmay Sarkar 		.tx_num		= ARRAY_SIZE(sa8775p_qmp_gen4_pcie_tx_tbl),
3065a05b6d51SMrinmay Sarkar 		.rx			= sa8775p_qmp_gen4x4_pcie_rx_alt_tbl,
3066a05b6d51SMrinmay Sarkar 		.rx_num		= ARRAY_SIZE(sa8775p_qmp_gen4x4_pcie_rx_alt_tbl),
3067a05b6d51SMrinmay Sarkar 		.pcs		= sa8775p_qmp_gen4x4_pcie_pcs_alt_tbl,
3068a05b6d51SMrinmay Sarkar 		.pcs_num		= ARRAY_SIZE(sa8775p_qmp_gen4x4_pcie_pcs_alt_tbl),
3069a05b6d51SMrinmay Sarkar 		.pcs_misc		= sa8775p_qmp_gen4_pcie_pcs_misc_tbl,
3070a05b6d51SMrinmay Sarkar 		.pcs_misc_num	= ARRAY_SIZE(sa8775p_qmp_gen4_pcie_pcs_misc_tbl),
3071a05b6d51SMrinmay Sarkar 	},
3072a05b6d51SMrinmay Sarkar 
3073a05b6d51SMrinmay Sarkar 	.tbls_rc = &(const struct qmp_phy_cfg_tbls) {
3074a05b6d51SMrinmay Sarkar 		.serdes		= sa8775p_qmp_gen4x4_pcie_rc_serdes_alt_tbl,
3075a05b6d51SMrinmay Sarkar 		.serdes_num	= ARRAY_SIZE(sa8775p_qmp_gen4x4_pcie_rc_serdes_alt_tbl),
3076a05b6d51SMrinmay Sarkar 		.pcs_misc	= sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl,
3077a05b6d51SMrinmay Sarkar 		.pcs_misc_num	= ARRAY_SIZE(sa8775p_qmp_gen4_pcie_rc_pcs_misc_tbl),
3078a05b6d51SMrinmay Sarkar 	},
3079a05b6d51SMrinmay Sarkar 
3080a05b6d51SMrinmay Sarkar 	.reset_list		= sdm845_pciephy_reset_l,
3081a05b6d51SMrinmay Sarkar 	.num_resets		= ARRAY_SIZE(sdm845_pciephy_reset_l),
3082a05b6d51SMrinmay Sarkar 	.vreg_list		= qmp_phy_vreg_l,
3083a05b6d51SMrinmay Sarkar 	.num_vregs		= ARRAY_SIZE(qmp_phy_vreg_l),
3084a05b6d51SMrinmay Sarkar 	.regs			= pciephy_v5_regs_layout,
3085a05b6d51SMrinmay Sarkar 
3086a05b6d51SMrinmay Sarkar 	.pwrdn_ctrl		= SW_PWRDN | REFCLK_DRV_DSBL,
3087a05b6d51SMrinmay Sarkar 	.phy_status		= PHYSTATUS_4_20,
3088a05b6d51SMrinmay Sarkar };
3089a05b6d51SMrinmay Sarkar 
qmp_pcie_configure_lane(void __iomem * base,const struct qmp_phy_init_tbl tbl[],int num,u8 lane_mask)309027878615SJohan Hovold static void qmp_pcie_configure_lane(void __iomem *base,
309194a407ccSDmitry Baryshkov 					const struct qmp_phy_init_tbl tbl[],
309294a407ccSDmitry Baryshkov 					int num,
309394a407ccSDmitry Baryshkov 					u8 lane_mask)
309494a407ccSDmitry Baryshkov {
309594a407ccSDmitry Baryshkov 	int i;
309694a407ccSDmitry Baryshkov 	const struct qmp_phy_init_tbl *t = tbl;
309794a407ccSDmitry Baryshkov 
309894a407ccSDmitry Baryshkov 	if (!t)
309994a407ccSDmitry Baryshkov 		return;
310094a407ccSDmitry Baryshkov 
310194a407ccSDmitry Baryshkov 	for (i = 0; i < num; i++, t++) {
310294a407ccSDmitry Baryshkov 		if (!(t->lane_mask & lane_mask))
310394a407ccSDmitry Baryshkov 			continue;
310494a407ccSDmitry Baryshkov 
310594a407ccSDmitry Baryshkov 		writel(t->val, base + t->offset);
310694a407ccSDmitry Baryshkov 	}
310794a407ccSDmitry Baryshkov }
310894a407ccSDmitry Baryshkov 
qmp_pcie_configure(void __iomem * base,const struct qmp_phy_init_tbl tbl[],int num)310927878615SJohan Hovold static void qmp_pcie_configure(void __iomem *base,
311094a407ccSDmitry Baryshkov 					const struct qmp_phy_init_tbl tbl[],
311194a407ccSDmitry Baryshkov 					int num)
311294a407ccSDmitry Baryshkov {
3113f2175762SJohan Hovold 	qmp_pcie_configure_lane(base, tbl, num, 0xff);
311494a407ccSDmitry Baryshkov }
311594a407ccSDmitry Baryshkov 
qmp_pcie_init_port_b(struct qmp_pcie * qmp,const struct qmp_phy_cfg_tbls * tbls)31166c37a02bSJohan Hovold static void qmp_pcie_init_port_b(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls)
31176c37a02bSJohan Hovold {
31186c37a02bSJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
31196c37a02bSJohan Hovold 	const struct qmp_pcie_offsets *offs = cfg->offsets;
31206c37a02bSJohan Hovold 	void __iomem *tx3, *rx3, *tx4, *rx4;
31216c37a02bSJohan Hovold 
31226c37a02bSJohan Hovold 	tx3 = qmp->port_b + offs->tx;
31236c37a02bSJohan Hovold 	rx3 = qmp->port_b + offs->rx;
31246c37a02bSJohan Hovold 	tx4 = qmp->port_b + offs->tx2;
31256c37a02bSJohan Hovold 	rx4 = qmp->port_b + offs->rx2;
31266c37a02bSJohan Hovold 
31276c37a02bSJohan Hovold 	qmp_pcie_configure_lane(tx3, tbls->tx, tbls->tx_num, 1);
31286c37a02bSJohan Hovold 	qmp_pcie_configure_lane(rx3, tbls->rx, tbls->rx_num, 1);
31296c37a02bSJohan Hovold 
31306c37a02bSJohan Hovold 	qmp_pcie_configure_lane(tx4, tbls->tx, tbls->tx_num, 2);
31316c37a02bSJohan Hovold 	qmp_pcie_configure_lane(rx4, tbls->rx, tbls->rx_num, 2);
31326c37a02bSJohan Hovold }
31336c37a02bSJohan Hovold 
qmp_pcie_init_registers(struct qmp_pcie * qmp,const struct qmp_phy_cfg_tbls * tbls)3134ec7bc1b4SJohan Hovold static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_cfg_tbls *tbls)
313594a407ccSDmitry Baryshkov {
3136ec7bc1b4SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
31372fdedef3SJohan Hovold 	void __iomem *serdes = qmp->serdes;
3138ec7bc1b4SJohan Hovold 	void __iomem *tx = qmp->tx;
3139ec7bc1b4SJohan Hovold 	void __iomem *rx = qmp->rx;
3140ec7bc1b4SJohan Hovold 	void __iomem *tx2 = qmp->tx2;
3141ec7bc1b4SJohan Hovold 	void __iomem *rx2 = qmp->rx2;
3142ec7bc1b4SJohan Hovold 	void __iomem *pcs = qmp->pcs;
3143ec7bc1b4SJohan Hovold 	void __iomem *pcs_misc = qmp->pcs_misc;
3144269b70e8SAbel Vesa 	void __iomem *ln_shrd = qmp->ln_shrd;
314594a407ccSDmitry Baryshkov 
3146d8c9a1e9SJohan Hovold 	if (!tbls)
31472566ad8eSDmitry Baryshkov 		return;
314894a407ccSDmitry Baryshkov 
3149d8c9a1e9SJohan Hovold 	qmp_pcie_configure(serdes, tbls->serdes, tbls->serdes_num);
31502566ad8eSDmitry Baryshkov 
3151d8c9a1e9SJohan Hovold 	qmp_pcie_configure_lane(tx, tbls->tx, tbls->tx_num, 1);
3152d8c9a1e9SJohan Hovold 	qmp_pcie_configure_lane(rx, tbls->rx, tbls->rx_num, 1);
3153f8b64114SJohan Hovold 
3154f8b64114SJohan Hovold 	if (cfg->lanes >= 2) {
3155d8c9a1e9SJohan Hovold 		qmp_pcie_configure_lane(tx2, tbls->tx, tbls->tx_num, 2);
3156d8c9a1e9SJohan Hovold 		qmp_pcie_configure_lane(rx2, tbls->rx, tbls->rx_num, 2);
3157f8b64114SJohan Hovold 	}
31582566ad8eSDmitry Baryshkov 
3159d8c9a1e9SJohan Hovold 	qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num);
3160d8c9a1e9SJohan Hovold 	qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num);
31616c37a02bSJohan Hovold 
31626c37a02bSJohan Hovold 	if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) {
31636c37a02bSJohan Hovold 		qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num);
31646c37a02bSJohan Hovold 		qmp_pcie_init_port_b(qmp, tbls);
31656c37a02bSJohan Hovold 	}
3166269b70e8SAbel Vesa 
3167269b70e8SAbel Vesa 	qmp_pcie_configure(ln_shrd, tbls->ln_shrd, tbls->ln_shrd_num);
316894a407ccSDmitry Baryshkov }
316994a407ccSDmitry Baryshkov 
qmp_pcie_init(struct phy * phy)317091174e2cSJohan Hovold static int qmp_pcie_init(struct phy *phy)
317194a407ccSDmitry Baryshkov {
31722fdedef3SJohan Hovold 	struct qmp_pcie *qmp = phy_get_drvdata(phy);
31732fdedef3SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
3174189ac6b8SDmitry Baryshkov 	int ret;
317594a407ccSDmitry Baryshkov 
317694a407ccSDmitry Baryshkov 	ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
317794a407ccSDmitry Baryshkov 	if (ret) {
317894a407ccSDmitry Baryshkov 		dev_err(qmp->dev, "failed to enable regulators, err=%d\n", ret);
31791239fd71SDmitry Baryshkov 		return ret;
318094a407ccSDmitry Baryshkov 	}
318194a407ccSDmitry Baryshkov 
3182189ac6b8SDmitry Baryshkov 	ret = reset_control_bulk_assert(cfg->num_resets, qmp->resets);
318394a407ccSDmitry Baryshkov 	if (ret) {
3184189ac6b8SDmitry Baryshkov 		dev_err(qmp->dev, "reset assert failed\n");
318594a407ccSDmitry Baryshkov 		goto err_disable_regulators;
318694a407ccSDmitry Baryshkov 	}
318794a407ccSDmitry Baryshkov 
3188269b70e8SAbel Vesa 	ret = reset_control_assert(qmp->nocsr_reset);
3189269b70e8SAbel Vesa 	if (ret) {
3190269b70e8SAbel Vesa 		dev_err(qmp->dev, "no-csr reset assert failed\n");
3191269b70e8SAbel Vesa 		goto err_assert_reset;
3192269b70e8SAbel Vesa 	}
3193269b70e8SAbel Vesa 
3194fffdeaf8SJohan Hovold 	usleep_range(200, 300);
3195fffdeaf8SJohan Hovold 
3196189ac6b8SDmitry Baryshkov 	ret = reset_control_bulk_deassert(cfg->num_resets, qmp->resets);
319794a407ccSDmitry Baryshkov 	if (ret) {
3198189ac6b8SDmitry Baryshkov 		dev_err(qmp->dev, "reset deassert failed\n");
3199269b70e8SAbel Vesa 		goto err_assert_reset;
320094a407ccSDmitry Baryshkov 	}
320194a407ccSDmitry Baryshkov 
3202067832dcSDmitry Baryshkov 	ret = clk_bulk_prepare_enable(ARRAY_SIZE(qmp_pciephy_clk_l), qmp->clks);
320394a407ccSDmitry Baryshkov 	if (ret)
320494a407ccSDmitry Baryshkov 		goto err_assert_reset;
320594a407ccSDmitry Baryshkov 
320694a407ccSDmitry Baryshkov 	return 0;
320794a407ccSDmitry Baryshkov 
320894a407ccSDmitry Baryshkov err_assert_reset:
3209189ac6b8SDmitry Baryshkov 	reset_control_bulk_assert(cfg->num_resets, qmp->resets);
321094a407ccSDmitry Baryshkov err_disable_regulators:
321194a407ccSDmitry Baryshkov 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
321294a407ccSDmitry Baryshkov 
321394a407ccSDmitry Baryshkov 	return ret;
321494a407ccSDmitry Baryshkov }
321594a407ccSDmitry Baryshkov 
qmp_pcie_exit(struct phy * phy)321691174e2cSJohan Hovold static int qmp_pcie_exit(struct phy *phy)
321794a407ccSDmitry Baryshkov {
32182fdedef3SJohan Hovold 	struct qmp_pcie *qmp = phy_get_drvdata(phy);
32192fdedef3SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
322094a407ccSDmitry Baryshkov 
3221189ac6b8SDmitry Baryshkov 	reset_control_bulk_assert(cfg->num_resets, qmp->resets);
322294a407ccSDmitry Baryshkov 
3223067832dcSDmitry Baryshkov 	clk_bulk_disable_unprepare(ARRAY_SIZE(qmp_pciephy_clk_l), qmp->clks);
322494a407ccSDmitry Baryshkov 
322594a407ccSDmitry Baryshkov 	regulator_bulk_disable(cfg->num_vregs, qmp->vregs);
322694a407ccSDmitry Baryshkov 
322794a407ccSDmitry Baryshkov 	return 0;
322894a407ccSDmitry Baryshkov }
322994a407ccSDmitry Baryshkov 
qmp_pcie_power_on(struct phy * phy)323027878615SJohan Hovold static int qmp_pcie_power_on(struct phy *phy)
323194a407ccSDmitry Baryshkov {
32322fdedef3SJohan Hovold 	struct qmp_pcie *qmp = phy_get_drvdata(phy);
32332fdedef3SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
3234d8c9a1e9SJohan Hovold 	const struct qmp_phy_cfg_tbls *mode_tbls;
32352fdedef3SJohan Hovold 	void __iomem *pcs = qmp->pcs;
323694a407ccSDmitry Baryshkov 	void __iomem *status;
32372577ba8cSJohan Hovold 	unsigned int mask, val;
323894a407ccSDmitry Baryshkov 	int ret;
323994a407ccSDmitry Baryshkov 
32405b68d95cSJohan Hovold 	qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
32415b68d95cSJohan Hovold 			cfg->pwrdn_ctrl);
32425b68d95cSJohan Hovold 
32432fdedef3SJohan Hovold 	if (qmp->mode == PHY_MODE_PCIE_RC)
3244d8c9a1e9SJohan Hovold 		mode_tbls = cfg->tbls_rc;
324511bf53a3SDmitry Baryshkov 	else
3246d8c9a1e9SJohan Hovold 		mode_tbls = cfg->tbls_ep;
324711bf53a3SDmitry Baryshkov 
3248ec7bc1b4SJohan Hovold 	qmp_pcie_init_registers(qmp, &cfg->tbls);
3249ec7bc1b4SJohan Hovold 	qmp_pcie_init_registers(qmp, mode_tbls);
325094a407ccSDmitry Baryshkov 
32519e420f1eSJohan Hovold 	ret = clk_bulk_prepare_enable(qmp->num_pipe_clks, qmp->pipe_clks);
32529e420f1eSJohan Hovold 	if (ret)
3253fd926994SDmitry Baryshkov 		return ret;
325494a407ccSDmitry Baryshkov 
3255269b70e8SAbel Vesa 	ret = reset_control_deassert(qmp->nocsr_reset);
3256269b70e8SAbel Vesa 	if (ret) {
3257269b70e8SAbel Vesa 		dev_err(qmp->dev, "no-csr reset deassert failed\n");
3258269b70e8SAbel Vesa 		goto err_disable_pipe_clk;
3259269b70e8SAbel Vesa 	}
3260269b70e8SAbel Vesa 
326194a407ccSDmitry Baryshkov 	/* Pull PHY out of reset state */
326294a407ccSDmitry Baryshkov 	qphy_clrbits(pcs, cfg->regs[QPHY_SW_RESET], SW_RESET);
3263fd926994SDmitry Baryshkov 
326494a407ccSDmitry Baryshkov 	/* start SerDes and Phy-Coding-Sublayer */
32655806b87dSJohan Hovold 	qphy_setbits(pcs, cfg->regs[QPHY_START_CTRL], SERDES_START | PCS_START);
326694a407ccSDmitry Baryshkov 
326751bd3306SJohan Hovold 	if (!cfg->skip_start_delay)
326851bd3306SJohan Hovold 		usleep_range(1000, 1200);
326951bd3306SJohan Hovold 
327094a407ccSDmitry Baryshkov 	status = pcs + cfg->regs[QPHY_PCS_STATUS];
327194a407ccSDmitry Baryshkov 	mask = cfg->phy_status;
32725cbeb75aSJohan Hovold 	ret = readl_poll_timeout(status, val, !(val & mask), 200,
327394a407ccSDmitry Baryshkov 				 PHY_INIT_COMPLETE_TIMEOUT);
327494a407ccSDmitry Baryshkov 	if (ret) {
327594a407ccSDmitry Baryshkov 		dev_err(qmp->dev, "phy initialization timed-out\n");
327694a407ccSDmitry Baryshkov 		goto err_disable_pipe_clk;
327794a407ccSDmitry Baryshkov 	}
3278da07a06bSDmitry Baryshkov 
327994a407ccSDmitry Baryshkov 	return 0;
328094a407ccSDmitry Baryshkov 
328194a407ccSDmitry Baryshkov err_disable_pipe_clk:
32829e420f1eSJohan Hovold 	clk_bulk_disable_unprepare(qmp->num_pipe_clks, qmp->pipe_clks);
328394a407ccSDmitry Baryshkov 
328494a407ccSDmitry Baryshkov 	return ret;
328594a407ccSDmitry Baryshkov }
328694a407ccSDmitry Baryshkov 
qmp_pcie_power_off(struct phy * phy)328727878615SJohan Hovold static int qmp_pcie_power_off(struct phy *phy)
328894a407ccSDmitry Baryshkov {
32892fdedef3SJohan Hovold 	struct qmp_pcie *qmp = phy_get_drvdata(phy);
32902fdedef3SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
329194a407ccSDmitry Baryshkov 
32929e420f1eSJohan Hovold 	clk_bulk_disable_unprepare(qmp->num_pipe_clks, qmp->pipe_clks);
329394a407ccSDmitry Baryshkov 
329494a407ccSDmitry Baryshkov 	/* PHY reset */
32952fdedef3SJohan Hovold 	qphy_setbits(qmp->pcs, cfg->regs[QPHY_SW_RESET], SW_RESET);
329694a407ccSDmitry Baryshkov 
329794a407ccSDmitry Baryshkov 	/* stop SerDes and Phy-Coding-Sublayer */
32982fdedef3SJohan Hovold 	qphy_clrbits(qmp->pcs, cfg->regs[QPHY_START_CTRL],
32995806b87dSJohan Hovold 			SERDES_START | PCS_START);
330094a407ccSDmitry Baryshkov 
330194a407ccSDmitry Baryshkov 	/* Put PHY into POWER DOWN state: active low */
33022fdedef3SJohan Hovold 	qphy_clrbits(qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
330394a407ccSDmitry Baryshkov 			cfg->pwrdn_ctrl);
330494a407ccSDmitry Baryshkov 
330594a407ccSDmitry Baryshkov 	return 0;
330694a407ccSDmitry Baryshkov }
330794a407ccSDmitry Baryshkov 
qmp_pcie_enable(struct phy * phy)330827878615SJohan Hovold static int qmp_pcie_enable(struct phy *phy)
330994a407ccSDmitry Baryshkov {
331094a407ccSDmitry Baryshkov 	int ret;
331194a407ccSDmitry Baryshkov 
331227878615SJohan Hovold 	ret = qmp_pcie_init(phy);
331394a407ccSDmitry Baryshkov 	if (ret)
331494a407ccSDmitry Baryshkov 		return ret;
331594a407ccSDmitry Baryshkov 
331627878615SJohan Hovold 	ret = qmp_pcie_power_on(phy);
331794a407ccSDmitry Baryshkov 	if (ret)
331827878615SJohan Hovold 		qmp_pcie_exit(phy);
331994a407ccSDmitry Baryshkov 
332094a407ccSDmitry Baryshkov 	return ret;
332194a407ccSDmitry Baryshkov }
332294a407ccSDmitry Baryshkov 
qmp_pcie_disable(struct phy * phy)332327878615SJohan Hovold static int qmp_pcie_disable(struct phy *phy)
332494a407ccSDmitry Baryshkov {
332594a407ccSDmitry Baryshkov 	int ret;
332694a407ccSDmitry Baryshkov 
332727878615SJohan Hovold 	ret = qmp_pcie_power_off(phy);
332894a407ccSDmitry Baryshkov 	if (ret)
332994a407ccSDmitry Baryshkov 		return ret;
333027878615SJohan Hovold 
333127878615SJohan Hovold 	return qmp_pcie_exit(phy);
333294a407ccSDmitry Baryshkov }
333394a407ccSDmitry Baryshkov 
qmp_pcie_set_mode(struct phy * phy,enum phy_mode mode,int submode)333411bf53a3SDmitry Baryshkov static int qmp_pcie_set_mode(struct phy *phy, enum phy_mode mode, int submode)
333511bf53a3SDmitry Baryshkov {
33362fdedef3SJohan Hovold 	struct qmp_pcie *qmp = phy_get_drvdata(phy);
333711bf53a3SDmitry Baryshkov 
333811bf53a3SDmitry Baryshkov 	switch (submode) {
333911bf53a3SDmitry Baryshkov 	case PHY_MODE_PCIE_RC:
334011bf53a3SDmitry Baryshkov 	case PHY_MODE_PCIE_EP:
33412fdedef3SJohan Hovold 		qmp->mode = submode;
334211bf53a3SDmitry Baryshkov 		break;
334311bf53a3SDmitry Baryshkov 	default:
334411bf53a3SDmitry Baryshkov 		dev_err(&phy->dev, "Unsupported submode %d\n", submode);
334511bf53a3SDmitry Baryshkov 		return -EINVAL;
334611bf53a3SDmitry Baryshkov 	}
334711bf53a3SDmitry Baryshkov 
334811bf53a3SDmitry Baryshkov 	return 0;
334911bf53a3SDmitry Baryshkov }
335011bf53a3SDmitry Baryshkov 
335163bf101aSJohan Hovold static const struct phy_ops qmp_pcie_phy_ops = {
335263bf101aSJohan Hovold 	.power_on	= qmp_pcie_enable,
335363bf101aSJohan Hovold 	.power_off	= qmp_pcie_disable,
335463bf101aSJohan Hovold 	.set_mode	= qmp_pcie_set_mode,
335563bf101aSJohan Hovold 	.owner		= THIS_MODULE,
335663bf101aSJohan Hovold };
335763bf101aSJohan Hovold 
qmp_pcie_vreg_init(struct qmp_pcie * qmp)335852b99773SJohan Hovold static int qmp_pcie_vreg_init(struct qmp_pcie *qmp)
335994a407ccSDmitry Baryshkov {
336052b99773SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
336152b99773SJohan Hovold 	struct device *dev = qmp->dev;
336294a407ccSDmitry Baryshkov 	int num = cfg->num_vregs;
336394a407ccSDmitry Baryshkov 	int i;
336494a407ccSDmitry Baryshkov 
336594a407ccSDmitry Baryshkov 	qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
336694a407ccSDmitry Baryshkov 	if (!qmp->vregs)
336794a407ccSDmitry Baryshkov 		return -ENOMEM;
336894a407ccSDmitry Baryshkov 
336994a407ccSDmitry Baryshkov 	for (i = 0; i < num; i++)
337094a407ccSDmitry Baryshkov 		qmp->vregs[i].supply = cfg->vreg_list[i];
337194a407ccSDmitry Baryshkov 
337294a407ccSDmitry Baryshkov 	return devm_regulator_bulk_get(dev, num, qmp->vregs);
337394a407ccSDmitry Baryshkov }
337494a407ccSDmitry Baryshkov 
qmp_pcie_reset_init(struct qmp_pcie * qmp)337552b99773SJohan Hovold static int qmp_pcie_reset_init(struct qmp_pcie *qmp)
337694a407ccSDmitry Baryshkov {
337752b99773SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
337852b99773SJohan Hovold 	struct device *dev = qmp->dev;
337994a407ccSDmitry Baryshkov 	int i;
3380189ac6b8SDmitry Baryshkov 	int ret;
338194a407ccSDmitry Baryshkov 
338294a407ccSDmitry Baryshkov 	qmp->resets = devm_kcalloc(dev, cfg->num_resets,
338394a407ccSDmitry Baryshkov 				   sizeof(*qmp->resets), GFP_KERNEL);
338494a407ccSDmitry Baryshkov 	if (!qmp->resets)
338594a407ccSDmitry Baryshkov 		return -ENOMEM;
338694a407ccSDmitry Baryshkov 
3387189ac6b8SDmitry Baryshkov 	for (i = 0; i < cfg->num_resets; i++)
3388189ac6b8SDmitry Baryshkov 		qmp->resets[i].id = cfg->reset_list[i];
338994a407ccSDmitry Baryshkov 
3390189ac6b8SDmitry Baryshkov 	ret = devm_reset_control_bulk_get_exclusive(dev, cfg->num_resets, qmp->resets);
3391189ac6b8SDmitry Baryshkov 	if (ret)
3392189ac6b8SDmitry Baryshkov 		return dev_err_probe(dev, ret, "failed to get resets\n");
339394a407ccSDmitry Baryshkov 
3394269b70e8SAbel Vesa 	if (cfg->has_nocsr_reset) {
3395269b70e8SAbel Vesa 		qmp->nocsr_reset = devm_reset_control_get_exclusive(dev, "phy_nocsr");
3396269b70e8SAbel Vesa 		if (IS_ERR(qmp->nocsr_reset))
3397269b70e8SAbel Vesa 			return dev_err_probe(dev, PTR_ERR(qmp->nocsr_reset),
3398269b70e8SAbel Vesa 						"failed to get no-csr reset\n");
3399269b70e8SAbel Vesa 	}
3400269b70e8SAbel Vesa 
340194a407ccSDmitry Baryshkov 	return 0;
340294a407ccSDmitry Baryshkov }
340394a407ccSDmitry Baryshkov 
qmp_pcie_clk_init(struct qmp_pcie * qmp)340452b99773SJohan Hovold static int qmp_pcie_clk_init(struct qmp_pcie *qmp)
340594a407ccSDmitry Baryshkov {
340652b99773SJohan Hovold 	struct device *dev = qmp->dev;
3407067832dcSDmitry Baryshkov 	int num = ARRAY_SIZE(qmp_pciephy_clk_l);
340894a407ccSDmitry Baryshkov 	int i;
340994a407ccSDmitry Baryshkov 
341094a407ccSDmitry Baryshkov 	qmp->clks = devm_kcalloc(dev, num, sizeof(*qmp->clks), GFP_KERNEL);
341194a407ccSDmitry Baryshkov 	if (!qmp->clks)
341294a407ccSDmitry Baryshkov 		return -ENOMEM;
341394a407ccSDmitry Baryshkov 
341494a407ccSDmitry Baryshkov 	for (i = 0; i < num; i++)
3415067832dcSDmitry Baryshkov 		qmp->clks[i].id = qmp_pciephy_clk_l[i];
341694a407ccSDmitry Baryshkov 
3417067832dcSDmitry Baryshkov 	return devm_clk_bulk_get_optional(dev, num, qmp->clks);
341894a407ccSDmitry Baryshkov }
341994a407ccSDmitry Baryshkov 
phy_clk_release_provider(void * res)342094a407ccSDmitry Baryshkov static void phy_clk_release_provider(void *res)
342194a407ccSDmitry Baryshkov {
342294a407ccSDmitry Baryshkov 	of_clk_del_provider(res);
342394a407ccSDmitry Baryshkov }
342494a407ccSDmitry Baryshkov 
342594a407ccSDmitry Baryshkov /*
342694a407ccSDmitry Baryshkov  * Register a fixed rate pipe clock.
342794a407ccSDmitry Baryshkov  *
342894a407ccSDmitry Baryshkov  * The <s>_pipe_clksrc generated by PHY goes to the GCC that gate
342994a407ccSDmitry Baryshkov  * controls it. The <s>_pipe_clk coming out of the GCC is requested
343094a407ccSDmitry Baryshkov  * by the PHY driver for its operations.
343194a407ccSDmitry Baryshkov  * We register the <s>_pipe_clksrc here. The gcc driver takes care
343294a407ccSDmitry Baryshkov  * of assigning this <s>_pipe_clksrc as parent to <s>_pipe_clk.
343394a407ccSDmitry Baryshkov  * Below picture shows this relationship.
343494a407ccSDmitry Baryshkov  *
343594a407ccSDmitry Baryshkov  *         +---------------+
343694a407ccSDmitry Baryshkov  *         |   PHY block   |<<---------------------------------------+
343794a407ccSDmitry Baryshkov  *         |               |                                         |
343894a407ccSDmitry Baryshkov  *         |   +-------+   |                   +-----+               |
343994a407ccSDmitry Baryshkov  *   I/P---^-->|  PLL  |---^--->pipe_clksrc--->| GCC |--->pipe_clk---+
344094a407ccSDmitry Baryshkov  *    clk  |   +-------+   |                   +-----+
344194a407ccSDmitry Baryshkov  *         +---------------+
344294a407ccSDmitry Baryshkov  */
phy_pipe_clk_register(struct qmp_pcie * qmp,struct device_node * np)34432fdedef3SJohan Hovold static int phy_pipe_clk_register(struct qmp_pcie *qmp, struct device_node *np)
344494a407ccSDmitry Baryshkov {
3445e8511f40SJohan Hovold 	struct clk_fixed_rate *fixed = &qmp->pipe_clk_fixed;
344694a407ccSDmitry Baryshkov 	struct clk_init_data init = { };
344794a407ccSDmitry Baryshkov 	int ret;
344894a407ccSDmitry Baryshkov 
344994a407ccSDmitry Baryshkov 	ret = of_property_read_string(np, "clock-output-names", &init.name);
345094a407ccSDmitry Baryshkov 	if (ret) {
345194a407ccSDmitry Baryshkov 		dev_err(qmp->dev, "%pOFn: No clock-output-names\n", np);
345294a407ccSDmitry Baryshkov 		return ret;
345394a407ccSDmitry Baryshkov 	}
345494a407ccSDmitry Baryshkov 
345594a407ccSDmitry Baryshkov 	init.ops = &clk_fixed_rate_ops;
345694a407ccSDmitry Baryshkov 
34572ec9bc8dSRobert Marko 	/*
34582ec9bc8dSRobert Marko 	 * Controllers using QMP PHY-s use 125MHz pipe clock interface
34592ec9bc8dSRobert Marko 	 * unless other frequency is specified in the PHY config.
34602ec9bc8dSRobert Marko 	 */
34612fdedef3SJohan Hovold 	if (qmp->cfg->pipe_clock_rate)
34622fdedef3SJohan Hovold 		fixed->fixed_rate = qmp->cfg->pipe_clock_rate;
34632ec9bc8dSRobert Marko 	else
346494a407ccSDmitry Baryshkov 		fixed->fixed_rate = 125000000;
34652ec9bc8dSRobert Marko 
346694a407ccSDmitry Baryshkov 	fixed->hw.init = &init;
346794a407ccSDmitry Baryshkov 
346894a407ccSDmitry Baryshkov 	ret = devm_clk_hw_register(qmp->dev, &fixed->hw);
346994a407ccSDmitry Baryshkov 	if (ret)
347094a407ccSDmitry Baryshkov 		return ret;
347194a407ccSDmitry Baryshkov 
347294a407ccSDmitry Baryshkov 	ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, &fixed->hw);
347394a407ccSDmitry Baryshkov 	if (ret)
347494a407ccSDmitry Baryshkov 		return ret;
347594a407ccSDmitry Baryshkov 
347694a407ccSDmitry Baryshkov 	/*
347794a407ccSDmitry Baryshkov 	 * Roll a devm action because the clock provider is the child node, but
347894a407ccSDmitry Baryshkov 	 * the child node is not actually a device.
347994a407ccSDmitry Baryshkov 	 */
348094a407ccSDmitry Baryshkov 	return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, np);
348194a407ccSDmitry Baryshkov }
348294a407ccSDmitry Baryshkov 
qmp_pcie_parse_dt_legacy(struct qmp_pcie * qmp,struct device_node * np)34837bc609e3SJohan Hovold static int qmp_pcie_parse_dt_legacy(struct qmp_pcie *qmp, struct device_node *np)
348494a407ccSDmitry Baryshkov {
34857bc609e3SJohan Hovold 	struct platform_device *pdev = to_platform_device(qmp->dev);
348652b99773SJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
348752b99773SJohan Hovold 	struct device *dev = qmp->dev;
34889e420f1eSJohan Hovold 	struct clk *clk;
348994a407ccSDmitry Baryshkov 
34907bc609e3SJohan Hovold 	qmp->serdes = devm_platform_ioremap_resource(pdev, 0);
34917bc609e3SJohan Hovold 	if (IS_ERR(qmp->serdes))
34927bc609e3SJohan Hovold 		return PTR_ERR(qmp->serdes);
349394a407ccSDmitry Baryshkov 
349494a407ccSDmitry Baryshkov 	/*
34958d3bf724SJohan Hovold 	 * Get memory resources for the PHY:
349694a407ccSDmitry Baryshkov 	 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
349794a407ccSDmitry Baryshkov 	 * For dual lane PHYs: tx2 -> 3, rx2 -> 4, pcs_misc (optional) -> 5
349894a407ccSDmitry Baryshkov 	 * For single lane PHYs: pcs_misc (optional) -> 3.
349994a407ccSDmitry Baryshkov 	 */
35002fdedef3SJohan Hovold 	qmp->tx = devm_of_iomap(dev, np, 0, NULL);
35012fdedef3SJohan Hovold 	if (IS_ERR(qmp->tx))
35022fdedef3SJohan Hovold 		return PTR_ERR(qmp->tx);
350394a407ccSDmitry Baryshkov 
35040a40891bSDmitry Baryshkov 	if (of_device_is_compatible(dev->of_node, "qcom,sdm845-qhp-pcie-phy"))
35052fdedef3SJohan Hovold 		qmp->rx = qmp->tx;
35060a40891bSDmitry Baryshkov 	else
35072fdedef3SJohan Hovold 		qmp->rx = devm_of_iomap(dev, np, 1, NULL);
35082fdedef3SJohan Hovold 	if (IS_ERR(qmp->rx))
35092fdedef3SJohan Hovold 		return PTR_ERR(qmp->rx);
351094a407ccSDmitry Baryshkov 
35112fdedef3SJohan Hovold 	qmp->pcs = devm_of_iomap(dev, np, 2, NULL);
35122fdedef3SJohan Hovold 	if (IS_ERR(qmp->pcs))
35132fdedef3SJohan Hovold 		return PTR_ERR(qmp->pcs);
351494a407ccSDmitry Baryshkov 
3515f02543faSJohan Hovold 	if (cfg->lanes >= 2) {
35162fdedef3SJohan Hovold 		qmp->tx2 = devm_of_iomap(dev, np, 3, NULL);
35172fdedef3SJohan Hovold 		if (IS_ERR(qmp->tx2))
35182fdedef3SJohan Hovold 			return PTR_ERR(qmp->tx2);
351969c90cb5SJohan Hovold 
35202fdedef3SJohan Hovold 		qmp->rx2 = devm_of_iomap(dev, np, 4, NULL);
35212fdedef3SJohan Hovold 		if (IS_ERR(qmp->rx2))
35222fdedef3SJohan Hovold 			return PTR_ERR(qmp->rx2);
352394a407ccSDmitry Baryshkov 
35242fdedef3SJohan Hovold 		qmp->pcs_misc = devm_of_iomap(dev, np, 5, NULL);
352594a407ccSDmitry Baryshkov 	} else {
35262fdedef3SJohan Hovold 		qmp->pcs_misc = devm_of_iomap(dev, np, 3, NULL);
352794a407ccSDmitry Baryshkov 	}
352894a407ccSDmitry Baryshkov 
35292fdedef3SJohan Hovold 	if (IS_ERR(qmp->pcs_misc) &&
3530af664324SDmitry Baryshkov 	    of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy"))
35312fdedef3SJohan Hovold 		qmp->pcs_misc = qmp->pcs + 0x400;
3532af664324SDmitry Baryshkov 
35332fdedef3SJohan Hovold 	if (IS_ERR(qmp->pcs_misc)) {
3534d8c9a1e9SJohan Hovold 		if (cfg->tbls.pcs_misc ||
3535d8c9a1e9SJohan Hovold 		    (cfg->tbls_rc && cfg->tbls_rc->pcs_misc) ||
3536d8c9a1e9SJohan Hovold 		    (cfg->tbls_ep && cfg->tbls_ep->pcs_misc)) {
35372fdedef3SJohan Hovold 			return PTR_ERR(qmp->pcs_misc);
35382fdedef3SJohan Hovold 		}
3539ecd5507eSJohan Hovold 	}
354094a407ccSDmitry Baryshkov 
35419e420f1eSJohan Hovold 	clk = devm_get_clk_from_child(dev, np, NULL);
35429e420f1eSJohan Hovold 	if (IS_ERR(clk)) {
35439e420f1eSJohan Hovold 		return dev_err_probe(dev, PTR_ERR(clk),
35442fdedef3SJohan Hovold 				     "failed to get pipe clock\n");
354594a407ccSDmitry Baryshkov 	}
354694a407ccSDmitry Baryshkov 
35479e420f1eSJohan Hovold 	qmp->num_pipe_clks = 1;
35489e420f1eSJohan Hovold 	qmp->pipe_clks[0].id = "pipe";
35499e420f1eSJohan Hovold 	qmp->pipe_clks[0].clk = clk;
35509e420f1eSJohan Hovold 
355194a407ccSDmitry Baryshkov 	return 0;
355294a407ccSDmitry Baryshkov }
355394a407ccSDmitry Baryshkov 
qmp_pcie_get_4ln_config(struct qmp_pcie * qmp)35546c37a02bSJohan Hovold static int qmp_pcie_get_4ln_config(struct qmp_pcie *qmp)
35556c37a02bSJohan Hovold {
35566c37a02bSJohan Hovold 	struct regmap *tcsr;
35576c37a02bSJohan Hovold 	unsigned int args[2];
35586c37a02bSJohan Hovold 	int ret;
35596c37a02bSJohan Hovold 
35606c37a02bSJohan Hovold 	tcsr = syscon_regmap_lookup_by_phandle_args(qmp->dev->of_node,
35616c37a02bSJohan Hovold 						    "qcom,4ln-config-sel",
35626c37a02bSJohan Hovold 						    ARRAY_SIZE(args), args);
35636c37a02bSJohan Hovold 	if (IS_ERR(tcsr)) {
35646c37a02bSJohan Hovold 		ret = PTR_ERR(tcsr);
35656c37a02bSJohan Hovold 		if (ret == -ENOENT)
35666c37a02bSJohan Hovold 			return 0;
35676c37a02bSJohan Hovold 
35686c37a02bSJohan Hovold 		dev_err(qmp->dev, "failed to lookup syscon: %d\n", ret);
35696c37a02bSJohan Hovold 		return ret;
35706c37a02bSJohan Hovold 	}
35716c37a02bSJohan Hovold 
35726c37a02bSJohan Hovold 	ret = regmap_test_bits(tcsr, args[0], BIT(args[1]));
35736c37a02bSJohan Hovold 	if (ret < 0) {
35746c37a02bSJohan Hovold 		dev_err(qmp->dev, "failed to read tcsr: %d\n", ret);
35756c37a02bSJohan Hovold 		return ret;
35766c37a02bSJohan Hovold 	}
35776c37a02bSJohan Hovold 
35786c37a02bSJohan Hovold 	qmp->tcsr_4ln_config = ret;
35796c37a02bSJohan Hovold 
35806c37a02bSJohan Hovold 	dev_dbg(qmp->dev, "4ln_config_sel = %d\n", qmp->tcsr_4ln_config);
35816c37a02bSJohan Hovold 
35826c37a02bSJohan Hovold 	return 0;
35836c37a02bSJohan Hovold }
35846c37a02bSJohan Hovold 
qmp_pcie_parse_dt(struct qmp_pcie * qmp)3585d0a846baSJohan Hovold static int qmp_pcie_parse_dt(struct qmp_pcie *qmp)
3586d0a846baSJohan Hovold {
3587d0a846baSJohan Hovold 	struct platform_device *pdev = to_platform_device(qmp->dev);
3588d0a846baSJohan Hovold 	const struct qmp_phy_cfg *cfg = qmp->cfg;
3589d0a846baSJohan Hovold 	const struct qmp_pcie_offsets *offs = cfg->offsets;
3590d0a846baSJohan Hovold 	struct device *dev = qmp->dev;
3591d0a846baSJohan Hovold 	void __iomem *base;
3592d0a846baSJohan Hovold 	int ret;
3593d0a846baSJohan Hovold 
3594d0a846baSJohan Hovold 	if (!offs)
3595d0a846baSJohan Hovold 		return -EINVAL;
3596d0a846baSJohan Hovold 
35976c37a02bSJohan Hovold 	ret = qmp_pcie_get_4ln_config(qmp);
35986c37a02bSJohan Hovold 	if (ret)
35996c37a02bSJohan Hovold 		return ret;
36006c37a02bSJohan Hovold 
3601d0a846baSJohan Hovold 	base = devm_platform_ioremap_resource(pdev, 0);
3602d0a846baSJohan Hovold 	if (IS_ERR(base))
3603d0a846baSJohan Hovold 		return PTR_ERR(base);
3604d0a846baSJohan Hovold 
3605d0a846baSJohan Hovold 	qmp->serdes = base + offs->serdes;
3606d0a846baSJohan Hovold 	qmp->pcs = base + offs->pcs;
3607d0a846baSJohan Hovold 	qmp->pcs_misc = base + offs->pcs_misc;
3608d0a846baSJohan Hovold 	qmp->tx = base + offs->tx;
3609d0a846baSJohan Hovold 	qmp->rx = base + offs->rx;
3610d0a846baSJohan Hovold 
3611d0a846baSJohan Hovold 	if (cfg->lanes >= 2) {
3612d0a846baSJohan Hovold 		qmp->tx2 = base + offs->tx2;
3613d0a846baSJohan Hovold 		qmp->rx2 = base + offs->rx2;
3614d0a846baSJohan Hovold 	}
3615d0a846baSJohan Hovold 
36166c37a02bSJohan Hovold 	if (qmp->cfg->lanes >= 4 && qmp->tcsr_4ln_config) {
36176c37a02bSJohan Hovold 		qmp->port_b = devm_platform_ioremap_resource(pdev, 1);
36186c37a02bSJohan Hovold 		if (IS_ERR(qmp->port_b))
36196c37a02bSJohan Hovold 			return PTR_ERR(qmp->port_b);
36206c37a02bSJohan Hovold 	}
36216c37a02bSJohan Hovold 
3622269b70e8SAbel Vesa 	if (cfg->tbls.ln_shrd)
3623269b70e8SAbel Vesa 		qmp->ln_shrd = base + offs->ln_shrd;
3624269b70e8SAbel Vesa 
3625d0a846baSJohan Hovold 	qmp->num_pipe_clks = 2;
3626d0a846baSJohan Hovold 	qmp->pipe_clks[0].id = "pipe";
3627d0a846baSJohan Hovold 	qmp->pipe_clks[1].id = "pipediv2";
3628d0a846baSJohan Hovold 
3629c7005273SDmitry Baryshkov 	ret = devm_clk_bulk_get(dev, 1, qmp->pipe_clks);
3630c7005273SDmitry Baryshkov 	if (ret)
3631c7005273SDmitry Baryshkov 		return ret;
3632c7005273SDmitry Baryshkov 
3633c7005273SDmitry Baryshkov 	ret = devm_clk_bulk_get_optional(dev, qmp->num_pipe_clks - 1, qmp->pipe_clks + 1);
3634d0a846baSJohan Hovold 	if (ret)
3635d0a846baSJohan Hovold 		return ret;
3636d0a846baSJohan Hovold 
3637d0a846baSJohan Hovold 	return 0;
3638d0a846baSJohan Hovold }
3639d0a846baSJohan Hovold 
qmp_pcie_probe(struct platform_device * pdev)364027878615SJohan Hovold static int qmp_pcie_probe(struct platform_device *pdev)
364194a407ccSDmitry Baryshkov {
364294a407ccSDmitry Baryshkov 	struct device *dev = &pdev->dev;
364394a407ccSDmitry Baryshkov 	struct phy_provider *phy_provider;
3644d0a846baSJohan Hovold 	struct device_node *np;
36452fdedef3SJohan Hovold 	struct qmp_pcie *qmp;
364694a407ccSDmitry Baryshkov 	int ret;
364794a407ccSDmitry Baryshkov 
364894a407ccSDmitry Baryshkov 	qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL);
364994a407ccSDmitry Baryshkov 	if (!qmp)
365094a407ccSDmitry Baryshkov 		return -ENOMEM;
365194a407ccSDmitry Baryshkov 
365294a407ccSDmitry Baryshkov 	qmp->dev = dev;
365394a407ccSDmitry Baryshkov 
365452b99773SJohan Hovold 	qmp->cfg = of_device_get_match_data(dev);
365552b99773SJohan Hovold 	if (!qmp->cfg)
365694a407ccSDmitry Baryshkov 		return -EINVAL;
365794a407ccSDmitry Baryshkov 
365852b99773SJohan Hovold 	WARN_ON_ONCE(!qmp->cfg->pwrdn_ctrl);
365952b99773SJohan Hovold 	WARN_ON_ONCE(!qmp->cfg->phy_status);
366073ad6a9dSJohan Hovold 
366152b99773SJohan Hovold 	ret = qmp_pcie_clk_init(qmp);
366294a407ccSDmitry Baryshkov 	if (ret)
366394a407ccSDmitry Baryshkov 		return ret;
366494a407ccSDmitry Baryshkov 
366552b99773SJohan Hovold 	ret = qmp_pcie_reset_init(qmp);
366694a407ccSDmitry Baryshkov 	if (ret)
366794a407ccSDmitry Baryshkov 		return ret;
366894a407ccSDmitry Baryshkov 
366952b99773SJohan Hovold 	ret = qmp_pcie_vreg_init(qmp);
3670a548b6b4SYuan Can 	if (ret)
367128d74fc3SJohan Hovold 		return ret;
367294a407ccSDmitry Baryshkov 
3673d0a846baSJohan Hovold 	/* Check for legacy binding with child node. */
3674d0a846baSJohan Hovold 	np = of_get_next_available_child(dev->of_node, NULL);
3675d0a846baSJohan Hovold 	if (np) {
3676d0a846baSJohan Hovold 		ret = qmp_pcie_parse_dt_legacy(qmp, np);
3677d0a846baSJohan Hovold 	} else {
3678d0a846baSJohan Hovold 		np = of_node_get(dev->of_node);
3679d0a846baSJohan Hovold 		ret = qmp_pcie_parse_dt(qmp);
3680d0a846baSJohan Hovold 	}
3681393ed5d5SJohan Hovold 	if (ret)
368294a407ccSDmitry Baryshkov 		goto err_node_put;
368394a407ccSDmitry Baryshkov 
3684d0a846baSJohan Hovold 	ret = phy_pipe_clk_register(qmp, np);
3685393ed5d5SJohan Hovold 	if (ret)
368694a407ccSDmitry Baryshkov 		goto err_node_put;
3687da07a06bSDmitry Baryshkov 
36887bc609e3SJohan Hovold 	qmp->mode = PHY_MODE_PCIE_RC;
36897bc609e3SJohan Hovold 
3690d0a846baSJohan Hovold 	qmp->phy = devm_phy_create(dev, np, &qmp_pcie_phy_ops);
36917bc609e3SJohan Hovold 	if (IS_ERR(qmp->phy)) {
36927bc609e3SJohan Hovold 		ret = PTR_ERR(qmp->phy);
36937bc609e3SJohan Hovold 		dev_err(dev, "failed to create PHY: %d\n", ret);
36947bc609e3SJohan Hovold 		goto err_node_put;
36957bc609e3SJohan Hovold 	}
36967bc609e3SJohan Hovold 
36977bc609e3SJohan Hovold 	phy_set_drvdata(qmp->phy, qmp);
36987bc609e3SJohan Hovold 
3699d0a846baSJohan Hovold 	of_node_put(np);
370094a407ccSDmitry Baryshkov 
370194a407ccSDmitry Baryshkov 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
370294a407ccSDmitry Baryshkov 
370394a407ccSDmitry Baryshkov 	return PTR_ERR_OR_ZERO(phy_provider);
370494a407ccSDmitry Baryshkov 
370594a407ccSDmitry Baryshkov err_node_put:
3706d0a846baSJohan Hovold 	of_node_put(np);
370794a407ccSDmitry Baryshkov 	return ret;
370894a407ccSDmitry Baryshkov }
370994a407ccSDmitry Baryshkov 
3710cebc6ca7SJohan Hovold static const struct of_device_id qmp_pcie_of_match_table[] = {
3711cebc6ca7SJohan Hovold 	{
3712cebc6ca7SJohan Hovold 		.compatible = "qcom,ipq6018-qmp-pcie-phy",
3713cebc6ca7SJohan Hovold 		.data = &ipq6018_pciephy_cfg,
3714cebc6ca7SJohan Hovold 	}, {
3715cebc6ca7SJohan Hovold 		.compatible = "qcom,ipq8074-qmp-gen3-pcie-phy",
3716cebc6ca7SJohan Hovold 		.data = &ipq8074_pciephy_gen3_cfg,
3717cebc6ca7SJohan Hovold 	}, {
3718cebc6ca7SJohan Hovold 		.compatible = "qcom,ipq8074-qmp-pcie-phy",
3719cebc6ca7SJohan Hovold 		.data = &ipq8074_pciephy_cfg,
3720cebc6ca7SJohan Hovold 	}, {
3721cebc6ca7SJohan Hovold 		.compatible = "qcom,msm8998-qmp-pcie-phy",
3722cebc6ca7SJohan Hovold 		.data = &msm8998_pciephy_cfg,
3723cebc6ca7SJohan Hovold 	}, {
3724a05b6d51SMrinmay Sarkar 		.compatible = "qcom,sa8775p-qmp-gen4x2-pcie-phy",
3725a05b6d51SMrinmay Sarkar 		.data = &sa8775p_qmp_gen4x2_pciephy_cfg,
3726a05b6d51SMrinmay Sarkar 	}, {
3727a05b6d51SMrinmay Sarkar 		.compatible = "qcom,sa8775p-qmp-gen4x4-pcie-phy",
3728a05b6d51SMrinmay Sarkar 		.data = &sa8775p_qmp_gen4x4_pciephy_cfg,
3729a05b6d51SMrinmay Sarkar 	}, {
3730cebc6ca7SJohan Hovold 		.compatible = "qcom,sc8180x-qmp-pcie-phy",
3731cebc6ca7SJohan Hovold 		.data = &sc8180x_pciephy_cfg,
3732cebc6ca7SJohan Hovold 	}, {
3733d0a846baSJohan Hovold 		.compatible = "qcom,sc8280xp-qmp-gen3x1-pcie-phy",
3734d0a846baSJohan Hovold 		.data = &sc8280xp_qmp_gen3x1_pciephy_cfg,
3735d0a846baSJohan Hovold 	}, {
3736d0a846baSJohan Hovold 		.compatible = "qcom,sc8280xp-qmp-gen3x2-pcie-phy",
3737d0a846baSJohan Hovold 		.data = &sc8280xp_qmp_gen3x2_pciephy_cfg,
3738d0a846baSJohan Hovold 	}, {
37396c37a02bSJohan Hovold 		.compatible = "qcom,sc8280xp-qmp-gen3x4-pcie-phy",
37406c37a02bSJohan Hovold 		.data = &sc8280xp_qmp_gen3x4_pciephy_cfg,
37416c37a02bSJohan Hovold 	}, {
3742cebc6ca7SJohan Hovold 		.compatible = "qcom,sdm845-qhp-pcie-phy",
3743cebc6ca7SJohan Hovold 		.data = &sdm845_qhp_pciephy_cfg,
3744cebc6ca7SJohan Hovold 	}, {
3745cebc6ca7SJohan Hovold 		.compatible = "qcom,sdm845-qmp-pcie-phy",
3746cebc6ca7SJohan Hovold 		.data = &sdm845_qmp_pciephy_cfg,
3747cebc6ca7SJohan Hovold 	}, {
3748cebc6ca7SJohan Hovold 		.compatible = "qcom,sdx55-qmp-pcie-phy",
3749cebc6ca7SJohan Hovold 		.data = &sdx55_qmp_pciephy_cfg,
3750cebc6ca7SJohan Hovold 	}, {
375192bd868fSRohit Agarwal 		.compatible = "qcom,sdx65-qmp-gen4x2-pcie-phy",
375292bd868fSRohit Agarwal 		.data = &sdx65_qmp_pciephy_cfg,
375392bd868fSRohit Agarwal 	}, {
3754*4807ff70SDmitry Baryshkov 		.compatible = "qcom,sm8150-qmp-gen3x1-pcie-phy",
3755*4807ff70SDmitry Baryshkov 		.data = &sm8250_qmp_gen3x1_pciephy_cfg,
3756*4807ff70SDmitry Baryshkov 	}, {
3757*4807ff70SDmitry Baryshkov 		.compatible = "qcom,sm8150-qmp-gen3x2-pcie-phy",
3758*4807ff70SDmitry Baryshkov 		.data = &sm8250_qmp_gen3x2_pciephy_cfg,
3759*4807ff70SDmitry Baryshkov 	}, {
3760cebc6ca7SJohan Hovold 		.compatible = "qcom,sm8250-qmp-gen3x1-pcie-phy",
3761cebc6ca7SJohan Hovold 		.data = &sm8250_qmp_gen3x1_pciephy_cfg,
3762cebc6ca7SJohan Hovold 	}, {
3763cebc6ca7SJohan Hovold 		.compatible = "qcom,sm8250-qmp-gen3x2-pcie-phy",
3764cebc6ca7SJohan Hovold 		.data = &sm8250_qmp_gen3x2_pciephy_cfg,
3765cebc6ca7SJohan Hovold 	}, {
3766cebc6ca7SJohan Hovold 		.compatible = "qcom,sm8250-qmp-modem-pcie-phy",
3767cebc6ca7SJohan Hovold 		.data = &sm8250_qmp_gen3x2_pciephy_cfg,
3768cebc6ca7SJohan Hovold 	}, {
3769c7005273SDmitry Baryshkov 		.compatible = "qcom,sm8350-qmp-gen3x1-pcie-phy",
3770c7005273SDmitry Baryshkov 		.data = &sm8350_qmp_gen3x1_pciephy_cfg,
3771c7005273SDmitry Baryshkov 	}, {
3772c7005273SDmitry Baryshkov 		.compatible = "qcom,sm8350-qmp-gen3x2-pcie-phy",
3773c7005273SDmitry Baryshkov 		.data = &sm8350_qmp_gen3x2_pciephy_cfg,
3774c7005273SDmitry Baryshkov 	}, {
3775cebc6ca7SJohan Hovold 		.compatible = "qcom,sm8450-qmp-gen3x1-pcie-phy",
3776cebc6ca7SJohan Hovold 		.data = &sm8450_qmp_gen3x1_pciephy_cfg,
3777cebc6ca7SJohan Hovold 	}, {
3778cebc6ca7SJohan Hovold 		.compatible = "qcom,sm8450-qmp-gen4x2-pcie-phy",
3779cebc6ca7SJohan Hovold 		.data = &sm8450_qmp_gen4x2_pciephy_cfg,
3780269b70e8SAbel Vesa 	}, {
3781269b70e8SAbel Vesa 		.compatible = "qcom,sm8550-qmp-gen3x2-pcie-phy",
3782269b70e8SAbel Vesa 		.data = &sm8550_qmp_gen3x2_pciephy_cfg,
3783269b70e8SAbel Vesa 	}, {
3784269b70e8SAbel Vesa 		.compatible = "qcom,sm8550-qmp-gen4x2-pcie-phy",
3785269b70e8SAbel Vesa 		.data = &sm8550_qmp_gen4x2_pciephy_cfg,
3786cebc6ca7SJohan Hovold 	},
3787cebc6ca7SJohan Hovold 	{ },
3788cebc6ca7SJohan Hovold };
3789cebc6ca7SJohan Hovold MODULE_DEVICE_TABLE(of, qmp_pcie_of_match_table);
3790cebc6ca7SJohan Hovold 
379127878615SJohan Hovold static struct platform_driver qmp_pcie_driver = {
379227878615SJohan Hovold 	.probe		= qmp_pcie_probe,
379394a407ccSDmitry Baryshkov 	.driver = {
3794b35a5311SDmitry Baryshkov 		.name	= "qcom-qmp-pcie-phy",
379527878615SJohan Hovold 		.of_match_table = qmp_pcie_of_match_table,
379694a407ccSDmitry Baryshkov 	},
379794a407ccSDmitry Baryshkov };
379894a407ccSDmitry Baryshkov 
379927878615SJohan Hovold module_platform_driver(qmp_pcie_driver);
380094a407ccSDmitry Baryshkov 
380194a407ccSDmitry Baryshkov MODULE_AUTHOR("Vivek Gautam <vivek.gautam@codeaurora.org>");
3802b35a5311SDmitry Baryshkov MODULE_DESCRIPTION("Qualcomm QMP PCIe PHY driver");
380394a407ccSDmitry Baryshkov MODULE_LICENSE("GPL v2");
3804