xref: /linux/drivers/phy/cadence/phy-cadence-sierra.c (revision d88ca22d6f0c9245086fe4cfca4cbe84382bdaa1)
144d30d62SAlan Douglas // SPDX-License-Identifier: GPL-2.0
244d30d62SAlan Douglas /*
344d30d62SAlan Douglas  * Cadence Sierra PHY Driver
444d30d62SAlan Douglas  *
544d30d62SAlan Douglas  * Copyright (c) 2018 Cadence Design Systems
644d30d62SAlan Douglas  * Author: Alan Douglas <adouglas@cadence.com>
744d30d62SAlan Douglas  *
844d30d62SAlan Douglas  */
944d30d62SAlan Douglas #include <linux/clk.h>
1028081b72SKishon Vijay Abraham I #include <linux/clk-provider.h>
1144d30d62SAlan Douglas #include <linux/delay.h>
1244d30d62SAlan Douglas #include <linux/err.h>
1344d30d62SAlan Douglas #include <linux/io.h>
1444d30d62SAlan Douglas #include <linux/module.h>
1544d30d62SAlan Douglas #include <linux/phy/phy.h>
1644d30d62SAlan Douglas #include <linux/platform_device.h>
1744d30d62SAlan Douglas #include <linux/pm_runtime.h>
1844d30d62SAlan Douglas #include <linux/regmap.h>
1944d30d62SAlan Douglas #include <linux/reset.h>
2044d30d62SAlan Douglas #include <linux/slab.h>
2144d30d62SAlan Douglas #include <linux/of.h>
2244d30d62SAlan Douglas #include <linux/of_platform.h>
2344d30d62SAlan Douglas #include <dt-bindings/phy/phy.h>
2428081b72SKishon Vijay Abraham I #include <dt-bindings/phy/phy-cadence.h>
2544d30d62SAlan Douglas 
26078e9e92SSwapnil Jakhade #define NUM_SSC_MODE		3
276b81f05aSSwapnil Jakhade #define NUM_PHY_TYPE		4
28078e9e92SSwapnil Jakhade 
2944d30d62SAlan Douglas /* PHY register offsets */
30380f5708SKishon Vijay Abraham I #define SIERRA_COMMON_CDB_OFFSET			0x0
31380f5708SKishon Vijay Abraham I #define SIERRA_MACRO_ID_REG				0x0
3228081b72SKishon Vijay Abraham I #define SIERRA_CMN_PLLLC_GEN_PREG			0x42
33871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_MODE_PREG			0x48
34871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG		0x49
35871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG		0x4A
36871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_LOCK_CNTSTART_PREG		0x4B
3709d976b3SSwapnil Jakhade #define SIERRA_CMN_PLLLC_CLK1_PREG			0x4D
38871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG		0x4F
39871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG		0x50
407a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_DSMCORR_PREG			0x51
417a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_SS_PREG			0x52
427a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG		0x53
437a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_SSTWOPT_PREG			0x54
44871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG	0x62
457a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG		0x63
4628081b72SKishon Vijay Abraham I #define SIERRA_CMN_REFRCV_PREG				0x98
4728081b72SKishon Vijay Abraham I #define SIERRA_CMN_REFRCV1_PREG				0xB8
4828081b72SKishon Vijay Abraham I #define SIERRA_CMN_PLLLC1_GEN_PREG			0xC2
498a1b82d7SSwapnil Jakhade #define SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG		0xCA
508a1b82d7SSwapnil Jakhade #define SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG		0xD0
518a1b82d7SSwapnil Jakhade #define SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG	0xE2
52380f5708SKishon Vijay Abraham I 
53380f5708SKishon Vijay Abraham I #define SIERRA_LANE_CDB_OFFSET(ln, block_offset, reg_offset)	\
54380f5708SKishon Vijay Abraham I 				((0x4000 << (block_offset)) + \
55380f5708SKishon Vijay Abraham I 				 (((ln) << 9) << (reg_offset)))
56aead5fd6SKishon Vijay Abraham I 
57aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_A_PREG			0x000
58aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_B_PREG			0x001
59aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_C_PREG			0x002
60aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_D_PREG			0x003
61aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_E_PREG			0x004
62871002d7SAnil Varughese #define SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG		0x008
63871002d7SAnil Varughese #define SIERRA_PSM_A0IN_TMR_PREG			0x009
647a5ad9b4SSwapnil Jakhade #define SIERRA_PSM_A3IN_TMR_PREG			0x00C
65aead5fd6SKishon Vijay Abraham I #define SIERRA_PSM_DIAG_PREG				0x015
668a1b82d7SSwapnil Jakhade #define SIERRA_PSC_LN_A3_PREG				0x023
678a1b82d7SSwapnil Jakhade #define SIERRA_PSC_LN_A4_PREG				0x024
688a1b82d7SSwapnil Jakhade #define SIERRA_PSC_LN_IDLE_PREG				0x026
69aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A0_PREG				0x028
70aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A1_PREG				0x029
71aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A2_PREG				0x02A
72aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A3_PREG				0x02B
73aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A0_PREG				0x030
74aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A1_PREG				0x031
75aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A2_PREG				0x032
76aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A3_PREG				0x033
77aead5fd6SKishon Vijay Abraham I #define SIERRA_PLLCTRL_SUBRATE_PREG			0x03A
788a1b82d7SSwapnil Jakhade #define SIERRA_PLLCTRL_GEN_A_PREG			0x03B
79aead5fd6SKishon Vijay Abraham I #define SIERRA_PLLCTRL_GEN_D_PREG			0x03E
80871002d7SAnil Varughese #define SIERRA_PLLCTRL_CPGAIN_MODE_PREG			0x03F
81adc4bd6fSKishon Vijay Abraham I #define SIERRA_PLLCTRL_STATUS_PREG			0x044
82871002d7SAnil Varughese #define SIERRA_CLKPATH_BIASTRIM_PREG			0x04B
83871002d7SAnil Varughese #define SIERRA_DFE_BIASTRIM_PREG			0x04C
84aead5fd6SKishon Vijay Abraham I #define SIERRA_DRVCTRL_ATTEN_PREG			0x06A
857a5ad9b4SSwapnil Jakhade #define SIERRA_DRVCTRL_BOOST_PREG			0x06F
86aead5fd6SKishon Vijay Abraham I #define SIERRA_CLKPATHCTRL_TMR_PREG			0x081
87871002d7SAnil Varughese #define SIERRA_RX_CREQ_FLTR_A_MODE3_PREG		0x085
88871002d7SAnil Varughese #define SIERRA_RX_CREQ_FLTR_A_MODE2_PREG		0x086
89aead5fd6SKishon Vijay Abraham I #define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG		0x087
90aead5fd6SKishon Vijay Abraham I #define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG		0x088
917a5ad9b4SSwapnil Jakhade #define SIERRA_CREQ_DCBIASATTEN_OVR_PREG		0x08C
92aead5fd6SKishon Vijay Abraham I #define SIERRA_CREQ_CCLKDET_MODE01_PREG			0x08E
937a5ad9b4SSwapnil Jakhade #define SIERRA_RX_CTLE_CAL_PREG				0x08F
94aead5fd6SKishon Vijay Abraham I #define SIERRA_RX_CTLE_MAINTENANCE_PREG			0x091
95aead5fd6SKishon Vijay Abraham I #define SIERRA_CREQ_FSMCLK_SEL_PREG			0x092
96871002d7SAnil Varughese #define SIERRA_CREQ_EQ_CTRL_PREG			0x093
97871002d7SAnil Varughese #define SIERRA_CREQ_SPARE_PREG				0x096
98871002d7SAnil Varughese #define SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG		0x097
99aead5fd6SKishon Vijay Abraham I #define SIERRA_CTLELUT_CTRL_PREG			0x098
100aead5fd6SKishon Vijay Abraham I #define SIERRA_DFE_ECMP_RATESEL_PREG			0x0C0
101aead5fd6SKishon Vijay Abraham I #define SIERRA_DFE_SMP_RATESEL_PREG			0x0C1
102871002d7SAnil Varughese #define SIERRA_DEQ_PHALIGN_CTRL				0x0C4
103871002d7SAnil Varughese #define SIERRA_DEQ_CONCUR_CTRL1_PREG			0x0C8
104871002d7SAnil Varughese #define SIERRA_DEQ_CONCUR_CTRL2_PREG			0x0C9
105871002d7SAnil Varughese #define SIERRA_DEQ_EPIPWR_CTRL2_PREG			0x0CD
106871002d7SAnil Varughese #define SIERRA_DEQ_FAST_MAINT_CYCLES_PREG		0x0CE
107871002d7SAnil Varughese #define SIERRA_DEQ_ERRCMP_CTRL_PREG			0x0D0
108871002d7SAnil Varughese #define SIERRA_DEQ_OFFSET_CTRL_PREG			0x0D8
109871002d7SAnil Varughese #define SIERRA_DEQ_GAIN_CTRL_PREG			0x0E0
110aead5fd6SKishon Vijay Abraham I #define SIERRA_DEQ_VGATUNE_CTRL_PREG			0x0E1
111871002d7SAnil Varughese #define SIERRA_DEQ_GLUT0				0x0E8
112871002d7SAnil Varughese #define SIERRA_DEQ_GLUT1				0x0E9
113871002d7SAnil Varughese #define SIERRA_DEQ_GLUT2				0x0EA
114871002d7SAnil Varughese #define SIERRA_DEQ_GLUT3				0x0EB
115871002d7SAnil Varughese #define SIERRA_DEQ_GLUT4				0x0EC
116871002d7SAnil Varughese #define SIERRA_DEQ_GLUT5				0x0ED
117871002d7SAnil Varughese #define SIERRA_DEQ_GLUT6				0x0EE
118871002d7SAnil Varughese #define SIERRA_DEQ_GLUT7				0x0EF
119871002d7SAnil Varughese #define SIERRA_DEQ_GLUT8				0x0F0
120871002d7SAnil Varughese #define SIERRA_DEQ_GLUT9				0x0F1
121871002d7SAnil Varughese #define SIERRA_DEQ_GLUT10				0x0F2
122871002d7SAnil Varughese #define SIERRA_DEQ_GLUT11				0x0F3
123871002d7SAnil Varughese #define SIERRA_DEQ_GLUT12				0x0F4
124871002d7SAnil Varughese #define SIERRA_DEQ_GLUT13				0x0F5
125871002d7SAnil Varughese #define SIERRA_DEQ_GLUT14				0x0F6
126871002d7SAnil Varughese #define SIERRA_DEQ_GLUT15				0x0F7
127871002d7SAnil Varughese #define SIERRA_DEQ_GLUT16				0x0F8
128871002d7SAnil Varughese #define SIERRA_DEQ_ALUT0				0x108
129871002d7SAnil Varughese #define SIERRA_DEQ_ALUT1				0x109
130871002d7SAnil Varughese #define SIERRA_DEQ_ALUT2				0x10A
131871002d7SAnil Varughese #define SIERRA_DEQ_ALUT3				0x10B
132871002d7SAnil Varughese #define SIERRA_DEQ_ALUT4				0x10C
133871002d7SAnil Varughese #define SIERRA_DEQ_ALUT5				0x10D
134871002d7SAnil Varughese #define SIERRA_DEQ_ALUT6				0x10E
135871002d7SAnil Varughese #define SIERRA_DEQ_ALUT7				0x10F
136871002d7SAnil Varughese #define SIERRA_DEQ_ALUT8				0x110
137871002d7SAnil Varughese #define SIERRA_DEQ_ALUT9				0x111
138871002d7SAnil Varughese #define SIERRA_DEQ_ALUT10				0x112
139871002d7SAnil Varughese #define SIERRA_DEQ_ALUT11				0x113
140871002d7SAnil Varughese #define SIERRA_DEQ_ALUT12				0x114
141871002d7SAnil Varughese #define SIERRA_DEQ_ALUT13				0x115
142871002d7SAnil Varughese #define SIERRA_DEQ_DFETAP_CTRL_PREG			0x128
1437a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP0				0x129
1447a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP1				0x12B
1457a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP2				0x12D
1467a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP3				0x12F
1477a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP4				0x131
148871002d7SAnil Varughese #define SIERRA_DFE_EN_1010_IGNORE_PREG			0x134
1497a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_PRECUR_PREG				0x138
1507a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_POSTCUR_PREG				0x140
1517a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_POSTCUR_DECR_PREG			0x142
152871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG		0x150
153871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL2_PREG			0x151
1547a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_TAU_CTRL3_PREG			0x152
1557a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_OPENEYE_CTRL_PREG			0x158
156871002d7SAnil Varughese #define SIERRA_DEQ_PICTRL_PREG				0x161
157871002d7SAnil Varughese #define SIERRA_CPICAL_TMRVAL_MODE1_PREG			0x170
158871002d7SAnil Varughese #define SIERRA_CPICAL_TMRVAL_MODE0_PREG			0x171
159871002d7SAnil Varughese #define SIERRA_CPICAL_PICNT_MODE1_PREG			0x174
160aead5fd6SKishon Vijay Abraham I #define SIERRA_CPI_OUTBUF_RATESEL_PREG			0x17C
1618a1b82d7SSwapnil Jakhade #define SIERRA_CPI_RESBIAS_BIN_PREG			0x17E
1627a5ad9b4SSwapnil Jakhade #define SIERRA_CPI_TRIM_PREG				0x17F
163871002d7SAnil Varughese #define SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG		0x183
1647a5ad9b4SSwapnil Jakhade #define SIERRA_EPI_CTRL_PREG				0x187
165871002d7SAnil Varughese #define SIERRA_LFPSDET_SUPPORT_PREG			0x188
166aead5fd6SKishon Vijay Abraham I #define SIERRA_LFPSFILT_NS_PREG				0x18A
167aead5fd6SKishon Vijay Abraham I #define SIERRA_LFPSFILT_RD_PREG				0x18B
168aead5fd6SKishon Vijay Abraham I #define SIERRA_LFPSFILT_MP_PREG				0x18C
169871002d7SAnil Varughese #define SIERRA_SIGDET_SUPPORT_PREG			0x190
170aead5fd6SKishon Vijay Abraham I #define SIERRA_SDFILT_H2L_A_PREG			0x191
171871002d7SAnil Varughese #define SIERRA_SDFILT_L2H_PREG				0x193
172871002d7SAnil Varughese #define SIERRA_RXBUFFER_CTLECTRL_PREG			0x19E
173871002d7SAnil Varughese #define SIERRA_RXBUFFER_RCDFECTRL_PREG			0x19F
174871002d7SAnil Varughese #define SIERRA_RXBUFFER_DFECTRL_PREG			0x1A0
175871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG		0x14F
176871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG		0x150
177380f5708SKishon Vijay Abraham I 
1788c95e172SSwapnil Jakhade /* PHY PCS common registers */
1798c95e172SSwapnil Jakhade #define SIERRA_PHY_PCS_COMMON_OFFSET(block_offset)	\
180380f5708SKishon Vijay Abraham I 				     (0xc000 << (block_offset))
181fa105172SSwapnil Jakhade #define SIERRA_PHY_PIPE_CMN_CTRL1			0x0
182380f5708SKishon Vijay Abraham I #define SIERRA_PHY_PLL_CFG				0xe
18344d30d62SAlan Douglas 
18436ce4163SSwapnil Jakhade /* PHY PCS lane registers */
18536ce4163SSwapnil Jakhade #define SIERRA_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset)	\
18636ce4163SSwapnil Jakhade 				       ((0xD000 << (block_offset)) +	\
18736ce4163SSwapnil Jakhade 				       (((ln) << 8) << (reg_offset)))
18836ce4163SSwapnil Jakhade 
18936ce4163SSwapnil Jakhade #define SIERRA_PHY_ISO_LINK_CTRL			0xB
19036ce4163SSwapnil Jakhade 
191f1cc6c3fSSwapnil Jakhade /* PHY PMA common registers */
192f1cc6c3fSSwapnil Jakhade #define SIERRA_PHY_PMA_COMMON_OFFSET(block_offset)	\
193f1cc6c3fSSwapnil Jakhade 				     (0xE000 << (block_offset))
194f1cc6c3fSSwapnil Jakhade #define SIERRA_PHY_PMA_CMN_CTRL				0x000
195f1cc6c3fSSwapnil Jakhade 
1966b81f05aSSwapnil Jakhade /* PHY PMA lane registers */
1976b81f05aSSwapnil Jakhade #define SIERRA_PHY_PMA_LANE_CDB_OFFSET(ln, block_offset, reg_offset)	\
1986b81f05aSSwapnil Jakhade 				       ((0xF000 << (block_offset)) +	\
1996b81f05aSSwapnil Jakhade 				       (((ln) << 8) << (reg_offset)))
2006b81f05aSSwapnil Jakhade 
2016b81f05aSSwapnil Jakhade #define SIERRA_PHY_PMA_XCVR_CTRL			0x000
2026b81f05aSSwapnil Jakhade 
20344d30d62SAlan Douglas #define SIERRA_MACRO_ID					0x00007364
204a43f72aeSKishon Vijay Abraham I #define SIERRA_MAX_LANES				16
205adc4bd6fSKishon Vijay Abraham I #define PLL_LOCK_TIME					100000
20644d30d62SAlan Douglas 
20709d976b3SSwapnil Jakhade #define CDNS_SIERRA_OUTPUT_CLOCKS			3
20828081b72SKishon Vijay Abraham I #define CDNS_SIERRA_INPUT_CLOCKS			5
209a0c30cd7SKishon Vijay Abraham I enum cdns_sierra_clock_input {
210a0c30cd7SKishon Vijay Abraham I 	PHY_CLK,
211a0c30cd7SKishon Vijay Abraham I 	CMN_REFCLK_DIG_DIV,
212a0c30cd7SKishon Vijay Abraham I 	CMN_REFCLK1_DIG_DIV,
21328081b72SKishon Vijay Abraham I 	PLL0_REFCLK,
21428081b72SKishon Vijay Abraham I 	PLL1_REFCLK,
215a0c30cd7SKishon Vijay Abraham I };
216a0c30cd7SKishon Vijay Abraham I 
21728081b72SKishon Vijay Abraham I #define SIERRA_NUM_CMN_PLLC				2
21828081b72SKishon Vijay Abraham I #define SIERRA_NUM_CMN_PLLC_PARENTS			2
21928081b72SKishon Vijay Abraham I 
220380f5708SKishon Vijay Abraham I static const struct reg_field macro_id_type =
221380f5708SKishon Vijay Abraham I 				REG_FIELD(SIERRA_MACRO_ID_REG, 0, 15);
222380f5708SKishon Vijay Abraham I static const struct reg_field phy_pll_cfg_1 =
223380f5708SKishon Vijay Abraham I 				REG_FIELD(SIERRA_PHY_PLL_CFG, 1, 1);
224f1cc6c3fSSwapnil Jakhade static const struct reg_field pma_cmn_ready =
225f1cc6c3fSSwapnil Jakhade 				REG_FIELD(SIERRA_PHY_PMA_CMN_CTRL, 0, 0);
226adc4bd6fSKishon Vijay Abraham I static const struct reg_field pllctrl_lock =
227adc4bd6fSKishon Vijay Abraham I 				REG_FIELD(SIERRA_PLLCTRL_STATUS_PREG, 0, 0);
22836ce4163SSwapnil Jakhade static const struct reg_field phy_iso_link_ctrl_1 =
22936ce4163SSwapnil Jakhade 				REG_FIELD(SIERRA_PHY_ISO_LINK_CTRL, 1, 1);
23009d976b3SSwapnil Jakhade static const struct reg_field cmn_plllc_clk1outdiv_preg =
23109d976b3SSwapnil Jakhade 				REG_FIELD(SIERRA_CMN_PLLLC_CLK1_PREG, 0, 6);
23209d976b3SSwapnil Jakhade static const struct reg_field cmn_plllc_clk1_en_preg =
23309d976b3SSwapnil Jakhade 				REG_FIELD(SIERRA_CMN_PLLLC_CLK1_PREG, 12, 12);
234380f5708SKishon Vijay Abraham I 
23528081b72SKishon Vijay Abraham I static const char * const clk_names[] = {
23628081b72SKishon Vijay Abraham I 	[CDNS_SIERRA_PLL_CMNLC] = "pll_cmnlc",
23728081b72SKishon Vijay Abraham I 	[CDNS_SIERRA_PLL_CMNLC1] = "pll_cmnlc1",
23809d976b3SSwapnil Jakhade 	[CDNS_SIERRA_DERIVED_REFCLK] = "refclk_der",
23928081b72SKishon Vijay Abraham I };
24028081b72SKishon Vijay Abraham I 
24128081b72SKishon Vijay Abraham I enum cdns_sierra_cmn_plllc {
24228081b72SKishon Vijay Abraham I 	CMN_PLLLC,
24328081b72SKishon Vijay Abraham I 	CMN_PLLLC1,
24428081b72SKishon Vijay Abraham I };
24528081b72SKishon Vijay Abraham I 
24628081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux_reg_fields {
24728081b72SKishon Vijay Abraham I 	struct reg_field	pfdclk_sel_preg;
24828081b72SKishon Vijay Abraham I 	struct reg_field	plllc1en_field;
24928081b72SKishon Vijay Abraham I 	struct reg_field	termen_field;
25028081b72SKishon Vijay Abraham I };
25128081b72SKishon Vijay Abraham I 
25228081b72SKishon Vijay Abraham I static const struct cdns_sierra_pll_mux_reg_fields cmn_plllc_pfdclk1_sel_preg[] = {
25328081b72SKishon Vijay Abraham I 	[CMN_PLLLC] = {
25428081b72SKishon Vijay Abraham I 		.pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC_GEN_PREG, 1, 1),
25528081b72SKishon Vijay Abraham I 		.plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 8, 8),
25628081b72SKishon Vijay Abraham I 		.termen_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 0, 0),
25728081b72SKishon Vijay Abraham I 	},
25828081b72SKishon Vijay Abraham I 	[CMN_PLLLC1] = {
25928081b72SKishon Vijay Abraham I 		.pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC1_GEN_PREG, 1, 1),
26028081b72SKishon Vijay Abraham I 		.plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 8, 8),
26128081b72SKishon Vijay Abraham I 		.termen_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 0, 0),
26228081b72SKishon Vijay Abraham I 	},
26328081b72SKishon Vijay Abraham I };
26428081b72SKishon Vijay Abraham I 
26528081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux {
26628081b72SKishon Vijay Abraham I 	struct clk_hw		hw;
26728081b72SKishon Vijay Abraham I 	struct regmap_field	*pfdclk_sel_preg;
26828081b72SKishon Vijay Abraham I 	struct regmap_field	*plllc1en_field;
26928081b72SKishon Vijay Abraham I 	struct regmap_field	*termen_field;
27028081b72SKishon Vijay Abraham I 	struct clk_init_data	clk_data;
27128081b72SKishon Vijay Abraham I };
27228081b72SKishon Vijay Abraham I 
27328081b72SKishon Vijay Abraham I #define to_cdns_sierra_pll_mux(_hw)	\
27428081b72SKishon Vijay Abraham I 			container_of(_hw, struct cdns_sierra_pll_mux, hw)
27528081b72SKishon Vijay Abraham I 
27628081b72SKishon Vijay Abraham I static const int pll_mux_parent_index[][SIERRA_NUM_CMN_PLLC_PARENTS] = {
27728081b72SKishon Vijay Abraham I 	[CMN_PLLLC] = { PLL0_REFCLK, PLL1_REFCLK },
27828081b72SKishon Vijay Abraham I 	[CMN_PLLLC1] = { PLL1_REFCLK, PLL0_REFCLK },
27928081b72SKishon Vijay Abraham I };
28028081b72SKishon Vijay Abraham I 
281da08aab9SSwapnil Jakhade static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS] = {
282da08aab9SSwapnil Jakhade 	[CMN_PLLLC] = { 0, 1 },
283da08aab9SSwapnil Jakhade 	[CMN_PLLLC1] = { 1, 0 },
284da08aab9SSwapnil Jakhade };
28528081b72SKishon Vijay Abraham I 
28609d976b3SSwapnil Jakhade struct cdns_sierra_derived_refclk {
28709d976b3SSwapnil Jakhade 	struct clk_hw           hw;
28809d976b3SSwapnil Jakhade 	struct regmap_field     *cmn_plllc_clk1outdiv_preg;
28909d976b3SSwapnil Jakhade 	struct regmap_field     *cmn_plllc_clk1_en_preg;
29009d976b3SSwapnil Jakhade 	struct clk_init_data	clk_data;
29109d976b3SSwapnil Jakhade };
29209d976b3SSwapnil Jakhade 
29309d976b3SSwapnil Jakhade #define to_cdns_sierra_derived_refclk(_hw)	\
29409d976b3SSwapnil Jakhade 			container_of(_hw, struct cdns_sierra_derived_refclk, hw)
29509d976b3SSwapnil Jakhade 
296078e9e92SSwapnil Jakhade enum cdns_sierra_phy_type {
297078e9e92SSwapnil Jakhade 	TYPE_NONE,
298078e9e92SSwapnil Jakhade 	TYPE_PCIE,
2998a1b82d7SSwapnil Jakhade 	TYPE_USB,
3008a1b82d7SSwapnil Jakhade 	TYPE_QSGMII
301078e9e92SSwapnil Jakhade };
302078e9e92SSwapnil Jakhade 
303078e9e92SSwapnil Jakhade enum cdns_sierra_ssc_mode {
304078e9e92SSwapnil Jakhade 	NO_SSC,
305078e9e92SSwapnil Jakhade 	EXTERNAL_SSC,
306078e9e92SSwapnil Jakhade 	INTERNAL_SSC
307078e9e92SSwapnil Jakhade };
308078e9e92SSwapnil Jakhade 
30944d30d62SAlan Douglas struct cdns_sierra_inst {
31044d30d62SAlan Douglas 	struct phy *phy;
311078e9e92SSwapnil Jakhade 	enum cdns_sierra_phy_type phy_type;
31244d30d62SAlan Douglas 	u32 num_lanes;
31344d30d62SAlan Douglas 	u32 mlane;
31444d30d62SAlan Douglas 	struct reset_control *lnk_rst;
3151e902b2aSSwapnil Jakhade 	enum cdns_sierra_ssc_mode ssc_mode;
31644d30d62SAlan Douglas };
31744d30d62SAlan Douglas 
31844d30d62SAlan Douglas struct cdns_reg_pairs {
31944d30d62SAlan Douglas 	u16 val;
32044d30d62SAlan Douglas 	u32 off;
32144d30d62SAlan Douglas };
32244d30d62SAlan Douglas 
323078e9e92SSwapnil Jakhade struct cdns_sierra_vals {
324078e9e92SSwapnil Jakhade 	const struct cdns_reg_pairs *reg_pairs;
325078e9e92SSwapnil Jakhade 	u32 num_regs;
326078e9e92SSwapnil Jakhade };
327078e9e92SSwapnil Jakhade 
32844d30d62SAlan Douglas struct cdns_sierra_data {
32944d30d62SAlan Douglas 	u32 id_value;
330380f5708SKishon Vijay Abraham I 	u8 block_offset_shift;
331380f5708SKishon Vijay Abraham I 	u8 reg_offset_shift;
332fa105172SSwapnil Jakhade 	struct cdns_sierra_vals *pcs_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
333fa105172SSwapnil Jakhade 					     [NUM_SSC_MODE];
3346b81f05aSSwapnil Jakhade 	struct cdns_sierra_vals *phy_pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
3356b81f05aSSwapnil Jakhade 						[NUM_SSC_MODE];
336078e9e92SSwapnil Jakhade 	struct cdns_sierra_vals *pma_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
337078e9e92SSwapnil Jakhade 					     [NUM_SSC_MODE];
338078e9e92SSwapnil Jakhade 	struct cdns_sierra_vals *pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
339078e9e92SSwapnil Jakhade 					    [NUM_SSC_MODE];
34044d30d62SAlan Douglas };
34144d30d62SAlan Douglas 
342380f5708SKishon Vijay Abraham I struct cdns_regmap_cdb_context {
34344d30d62SAlan Douglas 	struct device *dev;
34444d30d62SAlan Douglas 	void __iomem *base;
345380f5708SKishon Vijay Abraham I 	u8 reg_offset_shift;
346380f5708SKishon Vijay Abraham I };
347380f5708SKishon Vijay Abraham I 
348380f5708SKishon Vijay Abraham I struct cdns_sierra_phy {
349380f5708SKishon Vijay Abraham I 	struct device *dev;
350380f5708SKishon Vijay Abraham I 	struct regmap *regmap;
351c3c11d55SSwapnil Jakhade 	const struct cdns_sierra_data *init_data;
35244d30d62SAlan Douglas 	struct cdns_sierra_inst phys[SIERRA_MAX_LANES];
35344d30d62SAlan Douglas 	struct reset_control *phy_rst;
35444d30d62SAlan Douglas 	struct reset_control *apb_rst;
355380f5708SKishon Vijay Abraham I 	struct regmap *regmap_lane_cdb[SIERRA_MAX_LANES];
3568c95e172SSwapnil Jakhade 	struct regmap *regmap_phy_pcs_common_cdb;
35736ce4163SSwapnil Jakhade 	struct regmap *regmap_phy_pcs_lane_cdb[SIERRA_MAX_LANES];
358f1cc6c3fSSwapnil Jakhade 	struct regmap *regmap_phy_pma_common_cdb;
3596b81f05aSSwapnil Jakhade 	struct regmap *regmap_phy_pma_lane_cdb[SIERRA_MAX_LANES];
360380f5708SKishon Vijay Abraham I 	struct regmap *regmap_common_cdb;
361380f5708SKishon Vijay Abraham I 	struct regmap_field *macro_id_type;
362380f5708SKishon Vijay Abraham I 	struct regmap_field *phy_pll_cfg_1;
363f1cc6c3fSSwapnil Jakhade 	struct regmap_field *pma_cmn_ready;
364adc4bd6fSKishon Vijay Abraham I 	struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES];
36536ce4163SSwapnil Jakhade 	struct regmap_field *phy_iso_link_ctrl_1[SIERRA_MAX_LANES];
36628081b72SKishon Vijay Abraham I 	struct regmap_field *cmn_refrcv_refclk_plllc1en_preg[SIERRA_NUM_CMN_PLLC];
36728081b72SKishon Vijay Abraham I 	struct regmap_field *cmn_refrcv_refclk_termen_preg[SIERRA_NUM_CMN_PLLC];
36828081b72SKishon Vijay Abraham I 	struct regmap_field *cmn_plllc_pfdclk1_sel_preg[SIERRA_NUM_CMN_PLLC];
369a0c30cd7SKishon Vijay Abraham I 	struct clk *input_clks[CDNS_SIERRA_INPUT_CLOCKS];
37044d30d62SAlan Douglas 	int nsubnodes;
371a43f72aeSKishon Vijay Abraham I 	u32 num_lanes;
37244d30d62SAlan Douglas 	bool autoconf;
373*d88ca22dSAswath Govindraju 	int already_configured;
37428081b72SKishon Vijay Abraham I 	struct clk_onecell_data clk_data;
37528081b72SKishon Vijay Abraham I 	struct clk *output_clks[CDNS_SIERRA_OUTPUT_CLOCKS];
37644d30d62SAlan Douglas };
37744d30d62SAlan Douglas 
378380f5708SKishon Vijay Abraham I static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val)
379380f5708SKishon Vijay Abraham I {
380380f5708SKishon Vijay Abraham I 	struct cdns_regmap_cdb_context *ctx = context;
381380f5708SKishon Vijay Abraham I 	u32 offset = reg << ctx->reg_offset_shift;
382380f5708SKishon Vijay Abraham I 
383380f5708SKishon Vijay Abraham I 	writew(val, ctx->base + offset);
384380f5708SKishon Vijay Abraham I 
385380f5708SKishon Vijay Abraham I 	return 0;
386380f5708SKishon Vijay Abraham I }
387380f5708SKishon Vijay Abraham I 
388380f5708SKishon Vijay Abraham I static int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val)
389380f5708SKishon Vijay Abraham I {
390380f5708SKishon Vijay Abraham I 	struct cdns_regmap_cdb_context *ctx = context;
391380f5708SKishon Vijay Abraham I 	u32 offset = reg << ctx->reg_offset_shift;
392380f5708SKishon Vijay Abraham I 
393380f5708SKishon Vijay Abraham I 	*val = readw(ctx->base + offset);
394380f5708SKishon Vijay Abraham I 	return 0;
395380f5708SKishon Vijay Abraham I }
396380f5708SKishon Vijay Abraham I 
397380f5708SKishon Vijay Abraham I #define SIERRA_LANE_CDB_REGMAP_CONF(n) \
398380f5708SKishon Vijay Abraham I { \
399380f5708SKishon Vijay Abraham I 	.name = "sierra_lane" n "_cdb", \
400380f5708SKishon Vijay Abraham I 	.reg_stride = 1, \
401380f5708SKishon Vijay Abraham I 	.fast_io = true, \
402380f5708SKishon Vijay Abraham I 	.reg_write = cdns_regmap_write, \
403380f5708SKishon Vijay Abraham I 	.reg_read = cdns_regmap_read, \
404380f5708SKishon Vijay Abraham I }
405380f5708SKishon Vijay Abraham I 
4063cfb0e8eSRikard Falkeborn static const struct regmap_config cdns_sierra_lane_cdb_config[] = {
407380f5708SKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("0"),
408380f5708SKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("1"),
409380f5708SKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("2"),
410380f5708SKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("3"),
411a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("4"),
412a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("5"),
413a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("6"),
414a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("7"),
415a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("8"),
416a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("9"),
417a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("10"),
418a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("11"),
419a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("12"),
420a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("13"),
421a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("14"),
422a43f72aeSKishon Vijay Abraham I 	SIERRA_LANE_CDB_REGMAP_CONF("15"),
423380f5708SKishon Vijay Abraham I };
424380f5708SKishon Vijay Abraham I 
4253cfb0e8eSRikard Falkeborn static const struct regmap_config cdns_sierra_common_cdb_config = {
426380f5708SKishon Vijay Abraham I 	.name = "sierra_common_cdb",
427380f5708SKishon Vijay Abraham I 	.reg_stride = 1,
428380f5708SKishon Vijay Abraham I 	.fast_io = true,
429380f5708SKishon Vijay Abraham I 	.reg_write = cdns_regmap_write,
430380f5708SKishon Vijay Abraham I 	.reg_read = cdns_regmap_read,
431380f5708SKishon Vijay Abraham I };
432380f5708SKishon Vijay Abraham I 
4338c95e172SSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pcs_cmn_cdb_config = {
4348c95e172SSwapnil Jakhade 	.name = "sierra_phy_pcs_cmn_cdb",
435380f5708SKishon Vijay Abraham I 	.reg_stride = 1,
436380f5708SKishon Vijay Abraham I 	.fast_io = true,
437380f5708SKishon Vijay Abraham I 	.reg_write = cdns_regmap_write,
438380f5708SKishon Vijay Abraham I 	.reg_read = cdns_regmap_read,
439380f5708SKishon Vijay Abraham I };
440380f5708SKishon Vijay Abraham I 
44136ce4163SSwapnil Jakhade #define SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \
44236ce4163SSwapnil Jakhade { \
44336ce4163SSwapnil Jakhade 	.name = "sierra_phy_pcs_lane" n "_cdb", \
44436ce4163SSwapnil Jakhade 	.reg_stride = 1, \
44536ce4163SSwapnil Jakhade 	.fast_io = true, \
44636ce4163SSwapnil Jakhade 	.reg_write = cdns_regmap_write, \
44736ce4163SSwapnil Jakhade 	.reg_read = cdns_regmap_read, \
44836ce4163SSwapnil Jakhade }
44936ce4163SSwapnil Jakhade 
45036ce4163SSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pcs_lane_cdb_config[] = {
45136ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("0"),
45236ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("1"),
45336ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("2"),
45436ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("3"),
45536ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("4"),
45636ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("5"),
45736ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("6"),
45836ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("7"),
45936ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("8"),
46036ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("9"),
46136ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("10"),
46236ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("11"),
46336ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("12"),
46436ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("13"),
46536ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("14"),
46636ce4163SSwapnil Jakhade 	SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("15"),
46736ce4163SSwapnil Jakhade };
46836ce4163SSwapnil Jakhade 
469f1cc6c3fSSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pma_cmn_cdb_config = {
470f1cc6c3fSSwapnil Jakhade 	.name = "sierra_phy_pma_cmn_cdb",
471f1cc6c3fSSwapnil Jakhade 	.reg_stride = 1,
472f1cc6c3fSSwapnil Jakhade 	.fast_io = true,
473f1cc6c3fSSwapnil Jakhade 	.reg_write = cdns_regmap_write,
474f1cc6c3fSSwapnil Jakhade 	.reg_read = cdns_regmap_read,
475f1cc6c3fSSwapnil Jakhade };
476f1cc6c3fSSwapnil Jakhade 
4776b81f05aSSwapnil Jakhade #define SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF(n) \
4786b81f05aSSwapnil Jakhade { \
4796b81f05aSSwapnil Jakhade 	.name = "sierra_phy_pma_lane" n "_cdb", \
4806b81f05aSSwapnil Jakhade 	.reg_stride = 1, \
4816b81f05aSSwapnil Jakhade 	.fast_io = true, \
4826b81f05aSSwapnil Jakhade 	.reg_write = cdns_regmap_write, \
4836b81f05aSSwapnil Jakhade 	.reg_read = cdns_regmap_read, \
4846b81f05aSSwapnil Jakhade }
4856b81f05aSSwapnil Jakhade 
4866b81f05aSSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pma_lane_cdb_config[] = {
4876b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("0"),
4886b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("1"),
4896b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("2"),
4906b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("3"),
4916b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("4"),
4926b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("5"),
4936b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("6"),
4946b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("7"),
4956b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("8"),
4966b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("9"),
4976b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("10"),
4986b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("11"),
4996b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("12"),
5006b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("13"),
5016b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("14"),
5026b81f05aSSwapnil Jakhade 	SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("15"),
5036b81f05aSSwapnil Jakhade };
5046b81f05aSSwapnil Jakhade 
505cedcc2e2SKishon Vijay Abraham I static int cdns_sierra_phy_init(struct phy *gphy)
50644d30d62SAlan Douglas {
50744d30d62SAlan Douglas 	struct cdns_sierra_inst *ins = phy_get_drvdata(gphy);
50844d30d62SAlan Douglas 	struct cdns_sierra_phy *phy = dev_get_drvdata(gphy->dev.parent);
509078e9e92SSwapnil Jakhade 	const struct cdns_sierra_data *init_data = phy->init_data;
510078e9e92SSwapnil Jakhade 	struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals;
511078e9e92SSwapnil Jakhade 	enum cdns_sierra_phy_type phy_type = ins->phy_type;
5121e902b2aSSwapnil Jakhade 	enum cdns_sierra_ssc_mode ssc = ins->ssc_mode;
5136b81f05aSSwapnil Jakhade 	struct cdns_sierra_vals *phy_pma_ln_vals;
514078e9e92SSwapnil Jakhade 	const struct cdns_reg_pairs *reg_pairs;
515fa105172SSwapnil Jakhade 	struct cdns_sierra_vals *pcs_cmn_vals;
51680f96fb1SColin Ian King 	struct regmap *regmap;
517078e9e92SSwapnil Jakhade 	u32 num_regs;
51844d30d62SAlan Douglas 	int i, j;
51944d30d62SAlan Douglas 
520cedcc2e2SKishon Vijay Abraham I 	/* Initialise the PHY registers, unless auto configured */
521*d88ca22dSAswath Govindraju 	if (phy->autoconf || phy->already_configured || phy->nsubnodes > 1)
522cedcc2e2SKishon Vijay Abraham I 		return 0;
523cedcc2e2SKishon Vijay Abraham I 
524a0c30cd7SKishon Vijay Abraham I 	clk_set_rate(phy->input_clks[CMN_REFCLK_DIG_DIV], 25000000);
525a0c30cd7SKishon Vijay Abraham I 	clk_set_rate(phy->input_clks[CMN_REFCLK1_DIG_DIV], 25000000);
526078e9e92SSwapnil Jakhade 
527fa105172SSwapnil Jakhade 	/* PHY PCS common registers configurations */
528fa105172SSwapnil Jakhade 	pcs_cmn_vals = init_data->pcs_cmn_vals[phy_type][TYPE_NONE][ssc];
529fa105172SSwapnil Jakhade 	if (pcs_cmn_vals) {
530fa105172SSwapnil Jakhade 		reg_pairs = pcs_cmn_vals->reg_pairs;
531fa105172SSwapnil Jakhade 		num_regs = pcs_cmn_vals->num_regs;
532fa105172SSwapnil Jakhade 		regmap = phy->regmap_phy_pcs_common_cdb;
533fa105172SSwapnil Jakhade 		for (i = 0; i < num_regs; i++)
534fa105172SSwapnil Jakhade 			regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
535fa105172SSwapnil Jakhade 	}
536fa105172SSwapnil Jakhade 
5376b81f05aSSwapnil Jakhade 	/* PHY PMA lane registers configurations */
5386b81f05aSSwapnil Jakhade 	phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_type][TYPE_NONE][ssc];
5396b81f05aSSwapnil Jakhade 	if (phy_pma_ln_vals) {
5406b81f05aSSwapnil Jakhade 		reg_pairs = phy_pma_ln_vals->reg_pairs;
5416b81f05aSSwapnil Jakhade 		num_regs = phy_pma_ln_vals->num_regs;
5426b81f05aSSwapnil Jakhade 		for (i = 0; i < ins->num_lanes; i++) {
5436b81f05aSSwapnil Jakhade 			regmap = phy->regmap_phy_pma_lane_cdb[i + ins->mlane];
5446b81f05aSSwapnil Jakhade 			for (j = 0; j < num_regs; j++)
5456b81f05aSSwapnil Jakhade 				regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
5466b81f05aSSwapnil Jakhade 		}
5476b81f05aSSwapnil Jakhade 	}
5486b81f05aSSwapnil Jakhade 
549078e9e92SSwapnil Jakhade 	/* PMA common registers configurations */
550078e9e92SSwapnil Jakhade 	pma_cmn_vals = init_data->pma_cmn_vals[phy_type][TYPE_NONE][ssc];
551078e9e92SSwapnil Jakhade 	if (pma_cmn_vals) {
552078e9e92SSwapnil Jakhade 		reg_pairs = pma_cmn_vals->reg_pairs;
553078e9e92SSwapnil Jakhade 		num_regs = pma_cmn_vals->num_regs;
554078e9e92SSwapnil Jakhade 		regmap = phy->regmap_common_cdb;
555078e9e92SSwapnil Jakhade 		for (i = 0; i < num_regs; i++)
556078e9e92SSwapnil Jakhade 			regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
55744d30d62SAlan Douglas 	}
558871002d7SAnil Varughese 
559078e9e92SSwapnil Jakhade 	/* PMA lane registers configurations */
560078e9e92SSwapnil Jakhade 	pma_ln_vals = init_data->pma_ln_vals[phy_type][TYPE_NONE][ssc];
561078e9e92SSwapnil Jakhade 	if (pma_ln_vals) {
562078e9e92SSwapnil Jakhade 		reg_pairs = pma_ln_vals->reg_pairs;
563078e9e92SSwapnil Jakhade 		num_regs = pma_ln_vals->num_regs;
564380f5708SKishon Vijay Abraham I 		for (i = 0; i < ins->num_lanes; i++) {
565380f5708SKishon Vijay Abraham I 			regmap = phy->regmap_lane_cdb[i + ins->mlane];
566078e9e92SSwapnil Jakhade 			for (j = 0; j < num_regs; j++)
567078e9e92SSwapnil Jakhade 				regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
568380f5708SKishon Vijay Abraham I 		}
569380f5708SKishon Vijay Abraham I 	}
570cedcc2e2SKishon Vijay Abraham I 
571cedcc2e2SKishon Vijay Abraham I 	return 0;
57244d30d62SAlan Douglas }
57344d30d62SAlan Douglas 
57444d30d62SAlan Douglas static int cdns_sierra_phy_on(struct phy *gphy)
57544d30d62SAlan Douglas {
576adc4bd6fSKishon Vijay Abraham I 	struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent);
57744d30d62SAlan Douglas 	struct cdns_sierra_inst *ins = phy_get_drvdata(gphy);
578adc4bd6fSKishon Vijay Abraham I 	struct device *dev = sp->dev;
579adc4bd6fSKishon Vijay Abraham I 	u32 val;
580adc4bd6fSKishon Vijay Abraham I 	int ret;
58144d30d62SAlan Douglas 
5826b81f05aSSwapnil Jakhade 	if (sp->nsubnodes == 1) {
5836b81f05aSSwapnil Jakhade 		/* Take the PHY out of reset */
5845b4f5757SKishon Vijay Abraham I 		ret = reset_control_deassert(sp->phy_rst);
5855b4f5757SKishon Vijay Abraham I 		if (ret) {
5865b4f5757SKishon Vijay Abraham I 			dev_err(dev, "Failed to take the PHY out of reset\n");
5875b4f5757SKishon Vijay Abraham I 			return ret;
5885b4f5757SKishon Vijay Abraham I 		}
5896b81f05aSSwapnil Jakhade 	}
5905b4f5757SKishon Vijay Abraham I 
59144d30d62SAlan Douglas 	/* Take the PHY lane group out of reset */
592adc4bd6fSKishon Vijay Abraham I 	ret = reset_control_deassert(ins->lnk_rst);
593adc4bd6fSKishon Vijay Abraham I 	if (ret) {
594adc4bd6fSKishon Vijay Abraham I 		dev_err(dev, "Failed to take the PHY lane out of reset\n");
595adc4bd6fSKishon Vijay Abraham I 		return ret;
596adc4bd6fSKishon Vijay Abraham I 	}
597adc4bd6fSKishon Vijay Abraham I 
59836ce4163SSwapnil Jakhade 	if (ins->phy_type == TYPE_PCIE || ins->phy_type == TYPE_USB) {
59936ce4163SSwapnil Jakhade 		ret = regmap_field_read_poll_timeout(sp->phy_iso_link_ctrl_1[ins->mlane],
60036ce4163SSwapnil Jakhade 						     val, !val, 1000, PLL_LOCK_TIME);
60136ce4163SSwapnil Jakhade 		if (ret) {
60236ce4163SSwapnil Jakhade 			dev_err(dev, "Timeout waiting for PHY status ready\n");
60336ce4163SSwapnil Jakhade 			return ret;
60436ce4163SSwapnil Jakhade 		}
60536ce4163SSwapnil Jakhade 	}
60636ce4163SSwapnil Jakhade 
607f1cc6c3fSSwapnil Jakhade 	/*
608f1cc6c3fSSwapnil Jakhade 	 * Wait for cmn_ready assertion
609f1cc6c3fSSwapnil Jakhade 	 * PHY_PMA_CMN_CTRL[0] == 1
610f1cc6c3fSSwapnil Jakhade 	 */
611f1cc6c3fSSwapnil Jakhade 	ret = regmap_field_read_poll_timeout(sp->pma_cmn_ready, val, val,
612f1cc6c3fSSwapnil Jakhade 					     1000, PLL_LOCK_TIME);
613f1cc6c3fSSwapnil Jakhade 	if (ret) {
614f1cc6c3fSSwapnil Jakhade 		dev_err(dev, "Timeout waiting for CMN ready\n");
615f1cc6c3fSSwapnil Jakhade 		return ret;
616f1cc6c3fSSwapnil Jakhade 	}
617f1cc6c3fSSwapnil Jakhade 
618adc4bd6fSKishon Vijay Abraham I 	ret = regmap_field_read_poll_timeout(sp->pllctrl_lock[ins->mlane],
619adc4bd6fSKishon Vijay Abraham I 					     val, val, 1000, PLL_LOCK_TIME);
620adc4bd6fSKishon Vijay Abraham I 	if (ret < 0)
621adc4bd6fSKishon Vijay Abraham I 		dev_err(dev, "PLL lock of lane failed\n");
622adc4bd6fSKishon Vijay Abraham I 
623adc4bd6fSKishon Vijay Abraham I 	return ret;
62444d30d62SAlan Douglas }
62544d30d62SAlan Douglas 
62644d30d62SAlan Douglas static int cdns_sierra_phy_off(struct phy *gphy)
62744d30d62SAlan Douglas {
62844d30d62SAlan Douglas 	struct cdns_sierra_inst *ins = phy_get_drvdata(gphy);
62944d30d62SAlan Douglas 
63044d30d62SAlan Douglas 	return reset_control_assert(ins->lnk_rst);
63144d30d62SAlan Douglas }
63244d30d62SAlan Douglas 
6337904e15bSRoger Quadros static int cdns_sierra_phy_reset(struct phy *gphy)
6347904e15bSRoger Quadros {
6357904e15bSRoger Quadros 	struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent);
6367904e15bSRoger Quadros 
6377904e15bSRoger Quadros 	reset_control_assert(sp->phy_rst);
6387904e15bSRoger Quadros 	reset_control_deassert(sp->phy_rst);
6397904e15bSRoger Quadros 	return 0;
6407904e15bSRoger Quadros };
6417904e15bSRoger Quadros 
64244d30d62SAlan Douglas static const struct phy_ops ops = {
643cedcc2e2SKishon Vijay Abraham I 	.init		= cdns_sierra_phy_init,
64444d30d62SAlan Douglas 	.power_on	= cdns_sierra_phy_on,
64544d30d62SAlan Douglas 	.power_off	= cdns_sierra_phy_off,
6467904e15bSRoger Quadros 	.reset		= cdns_sierra_phy_reset,
64744d30d62SAlan Douglas 	.owner		= THIS_MODULE,
64844d30d62SAlan Douglas };
64944d30d62SAlan Douglas 
650*d88ca22dSAswath Govindraju static int cdns_sierra_noop_phy_on(struct phy *gphy)
651*d88ca22dSAswath Govindraju {
652*d88ca22dSAswath Govindraju 	usleep_range(5000, 10000);
653*d88ca22dSAswath Govindraju 
654*d88ca22dSAswath Govindraju 	return 0;
655*d88ca22dSAswath Govindraju }
656*d88ca22dSAswath Govindraju 
657*d88ca22dSAswath Govindraju static const struct phy_ops noop_ops = {
658*d88ca22dSAswath Govindraju 	.power_on	= cdns_sierra_noop_phy_on,
659*d88ca22dSAswath Govindraju 	.owner		= THIS_MODULE,
660*d88ca22dSAswath Govindraju };
661*d88ca22dSAswath Govindraju 
66228081b72SKishon Vijay Abraham I static u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw)
66328081b72SKishon Vijay Abraham I {
66428081b72SKishon Vijay Abraham I 	struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw);
665da08aab9SSwapnil Jakhade 	struct regmap_field *plllc1en_field = mux->plllc1en_field;
666da08aab9SSwapnil Jakhade 	struct regmap_field *termen_field = mux->termen_field;
66728081b72SKishon Vijay Abraham I 	struct regmap_field *field = mux->pfdclk_sel_preg;
66828081b72SKishon Vijay Abraham I 	unsigned int val;
669da08aab9SSwapnil Jakhade 	int index;
67028081b72SKishon Vijay Abraham I 
67128081b72SKishon Vijay Abraham I 	regmap_field_read(field, &val);
672da08aab9SSwapnil Jakhade 
673da08aab9SSwapnil Jakhade 	if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) {
674da08aab9SSwapnil Jakhade 		index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC1], 0, val);
675da08aab9SSwapnil Jakhade 		if (index == 1) {
676da08aab9SSwapnil Jakhade 			regmap_field_write(plllc1en_field, 1);
677da08aab9SSwapnil Jakhade 			regmap_field_write(termen_field, 1);
678da08aab9SSwapnil Jakhade 		}
679da08aab9SSwapnil Jakhade 	} else {
680da08aab9SSwapnil Jakhade 		index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC], 0, val);
681da08aab9SSwapnil Jakhade 	}
682da08aab9SSwapnil Jakhade 
683da08aab9SSwapnil Jakhade 	return index;
68428081b72SKishon Vijay Abraham I }
68528081b72SKishon Vijay Abraham I 
68628081b72SKishon Vijay Abraham I static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index)
68728081b72SKishon Vijay Abraham I {
68828081b72SKishon Vijay Abraham I 	struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw);
68928081b72SKishon Vijay Abraham I 	struct regmap_field *plllc1en_field = mux->plllc1en_field;
69028081b72SKishon Vijay Abraham I 	struct regmap_field *termen_field = mux->termen_field;
69128081b72SKishon Vijay Abraham I 	struct regmap_field *field = mux->pfdclk_sel_preg;
69228081b72SKishon Vijay Abraham I 	int val, ret;
69328081b72SKishon Vijay Abraham I 
69428081b72SKishon Vijay Abraham I 	ret = regmap_field_write(plllc1en_field, 0);
69528081b72SKishon Vijay Abraham I 	ret |= regmap_field_write(termen_field, 0);
69628081b72SKishon Vijay Abraham I 	if (index == 1) {
69728081b72SKishon Vijay Abraham I 		ret |= regmap_field_write(plllc1en_field, 1);
69828081b72SKishon Vijay Abraham I 		ret |= regmap_field_write(termen_field, 1);
69928081b72SKishon Vijay Abraham I 	}
70028081b72SKishon Vijay Abraham I 
701da08aab9SSwapnil Jakhade 	if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1]))
702da08aab9SSwapnil Jakhade 		val = cdns_sierra_pll_mux_table[CMN_PLLLC1][index];
703da08aab9SSwapnil Jakhade 	else
704da08aab9SSwapnil Jakhade 		val = cdns_sierra_pll_mux_table[CMN_PLLLC][index];
705da08aab9SSwapnil Jakhade 
70628081b72SKishon Vijay Abraham I 	ret |= regmap_field_write(field, val);
70728081b72SKishon Vijay Abraham I 
70828081b72SKishon Vijay Abraham I 	return ret;
70928081b72SKishon Vijay Abraham I }
71028081b72SKishon Vijay Abraham I 
71128081b72SKishon Vijay Abraham I static const struct clk_ops cdns_sierra_pll_mux_ops = {
71228081b72SKishon Vijay Abraham I 	.set_parent = cdns_sierra_pll_mux_set_parent,
71328081b72SKishon Vijay Abraham I 	.get_parent = cdns_sierra_pll_mux_get_parent,
71428081b72SKishon Vijay Abraham I };
71528081b72SKishon Vijay Abraham I 
71628081b72SKishon Vijay Abraham I static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp,
71728081b72SKishon Vijay Abraham I 					struct regmap_field *pfdclk1_sel_field,
71828081b72SKishon Vijay Abraham I 					struct regmap_field *plllc1en_field,
71928081b72SKishon Vijay Abraham I 					struct regmap_field *termen_field,
72028081b72SKishon Vijay Abraham I 					int clk_index)
72128081b72SKishon Vijay Abraham I {
72228081b72SKishon Vijay Abraham I 	struct cdns_sierra_pll_mux *mux;
72328081b72SKishon Vijay Abraham I 	struct device *dev = sp->dev;
72428081b72SKishon Vijay Abraham I 	struct clk_init_data *init;
72528081b72SKishon Vijay Abraham I 	const char **parent_names;
72628081b72SKishon Vijay Abraham I 	unsigned int num_parents;
72728081b72SKishon Vijay Abraham I 	char clk_name[100];
72828081b72SKishon Vijay Abraham I 	struct clk *clk;
72928081b72SKishon Vijay Abraham I 	int i;
73028081b72SKishon Vijay Abraham I 
73128081b72SKishon Vijay Abraham I 	mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL);
73228081b72SKishon Vijay Abraham I 	if (!mux)
73328081b72SKishon Vijay Abraham I 		return -ENOMEM;
73428081b72SKishon Vijay Abraham I 
73528081b72SKishon Vijay Abraham I 	num_parents = SIERRA_NUM_CMN_PLLC_PARENTS;
73628081b72SKishon Vijay Abraham I 	parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL);
73728081b72SKishon Vijay Abraham I 	if (!parent_names)
73828081b72SKishon Vijay Abraham I 		return -ENOMEM;
73928081b72SKishon Vijay Abraham I 
74028081b72SKishon Vijay Abraham I 	for (i = 0; i < num_parents; i++) {
74128081b72SKishon Vijay Abraham I 		clk = sp->input_clks[pll_mux_parent_index[clk_index][i]];
74228081b72SKishon Vijay Abraham I 		if (IS_ERR_OR_NULL(clk)) {
743da08aab9SSwapnil Jakhade 			dev_err(dev, "No parent clock for PLL mux clocks\n");
744da08aab9SSwapnil Jakhade 			return IS_ERR(clk) ? PTR_ERR(clk) : -ENOENT;
74528081b72SKishon Vijay Abraham I 		}
74628081b72SKishon Vijay Abraham I 		parent_names[i] = __clk_get_name(clk);
74728081b72SKishon Vijay Abraham I 	}
74828081b72SKishon Vijay Abraham I 
74928081b72SKishon Vijay Abraham I 	snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), clk_names[clk_index]);
75028081b72SKishon Vijay Abraham I 
75128081b72SKishon Vijay Abraham I 	init = &mux->clk_data;
75228081b72SKishon Vijay Abraham I 
75328081b72SKishon Vijay Abraham I 	init->ops = &cdns_sierra_pll_mux_ops;
75428081b72SKishon Vijay Abraham I 	init->flags = CLK_SET_RATE_NO_REPARENT;
75528081b72SKishon Vijay Abraham I 	init->parent_names = parent_names;
75628081b72SKishon Vijay Abraham I 	init->num_parents = num_parents;
75728081b72SKishon Vijay Abraham I 	init->name = clk_name;
75828081b72SKishon Vijay Abraham I 
75928081b72SKishon Vijay Abraham I 	mux->pfdclk_sel_preg = pfdclk1_sel_field;
76028081b72SKishon Vijay Abraham I 	mux->plllc1en_field = plllc1en_field;
76128081b72SKishon Vijay Abraham I 	mux->termen_field = termen_field;
76228081b72SKishon Vijay Abraham I 	mux->hw.init = init;
76328081b72SKishon Vijay Abraham I 
76428081b72SKishon Vijay Abraham I 	clk = devm_clk_register(dev, &mux->hw);
76528081b72SKishon Vijay Abraham I 	if (IS_ERR(clk))
76628081b72SKishon Vijay Abraham I 		return PTR_ERR(clk);
76728081b72SKishon Vijay Abraham I 
76828081b72SKishon Vijay Abraham I 	sp->output_clks[clk_index] = clk;
76928081b72SKishon Vijay Abraham I 
77028081b72SKishon Vijay Abraham I 	return 0;
77128081b72SKishon Vijay Abraham I }
77228081b72SKishon Vijay Abraham I 
77328081b72SKishon Vijay Abraham I static int cdns_sierra_phy_register_pll_mux(struct cdns_sierra_phy *sp)
77428081b72SKishon Vijay Abraham I {
77528081b72SKishon Vijay Abraham I 	struct regmap_field *pfdclk1_sel_field;
77628081b72SKishon Vijay Abraham I 	struct regmap_field *plllc1en_field;
77728081b72SKishon Vijay Abraham I 	struct regmap_field *termen_field;
77828081b72SKishon Vijay Abraham I 	struct device *dev = sp->dev;
77928081b72SKishon Vijay Abraham I 	int ret = 0, i, clk_index;
78028081b72SKishon Vijay Abraham I 
78128081b72SKishon Vijay Abraham I 	clk_index = CDNS_SIERRA_PLL_CMNLC;
78228081b72SKishon Vijay Abraham I 	for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++, clk_index++) {
78328081b72SKishon Vijay Abraham I 		pfdclk1_sel_field = sp->cmn_plllc_pfdclk1_sel_preg[i];
78428081b72SKishon Vijay Abraham I 		plllc1en_field = sp->cmn_refrcv_refclk_plllc1en_preg[i];
78528081b72SKishon Vijay Abraham I 		termen_field = sp->cmn_refrcv_refclk_termen_preg[i];
78628081b72SKishon Vijay Abraham I 
78728081b72SKishon Vijay Abraham I 		ret = cdns_sierra_pll_mux_register(sp, pfdclk1_sel_field, plllc1en_field,
78828081b72SKishon Vijay Abraham I 						   termen_field, clk_index);
78928081b72SKishon Vijay Abraham I 		if (ret) {
79028081b72SKishon Vijay Abraham I 			dev_err(dev, "Fail to register cmn plllc mux\n");
79128081b72SKishon Vijay Abraham I 			return ret;
79228081b72SKishon Vijay Abraham I 		}
79328081b72SKishon Vijay Abraham I 	}
79428081b72SKishon Vijay Abraham I 
79528081b72SKishon Vijay Abraham I 	return 0;
79628081b72SKishon Vijay Abraham I }
79728081b72SKishon Vijay Abraham I 
79809d976b3SSwapnil Jakhade static int cdns_sierra_derived_refclk_enable(struct clk_hw *hw)
79909d976b3SSwapnil Jakhade {
80009d976b3SSwapnil Jakhade 	struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw);
80109d976b3SSwapnil Jakhade 
80209d976b3SSwapnil Jakhade 	regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0x1);
80309d976b3SSwapnil Jakhade 
80409d976b3SSwapnil Jakhade 	/* Programming to get 100Mhz clock output in ref_der_clk_out 5GHz VCO/50 = 100MHz */
80509d976b3SSwapnil Jakhade 	regmap_field_write(derived_refclk->cmn_plllc_clk1outdiv_preg, 0x2E);
80609d976b3SSwapnil Jakhade 
80709d976b3SSwapnil Jakhade 	return 0;
80809d976b3SSwapnil Jakhade }
80909d976b3SSwapnil Jakhade 
81009d976b3SSwapnil Jakhade static void cdns_sierra_derived_refclk_disable(struct clk_hw *hw)
81109d976b3SSwapnil Jakhade {
81209d976b3SSwapnil Jakhade 	struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw);
81309d976b3SSwapnil Jakhade 
81409d976b3SSwapnil Jakhade 	regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0);
81509d976b3SSwapnil Jakhade }
81609d976b3SSwapnil Jakhade 
81709d976b3SSwapnil Jakhade static int cdns_sierra_derived_refclk_is_enabled(struct clk_hw *hw)
81809d976b3SSwapnil Jakhade {
81909d976b3SSwapnil Jakhade 	struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw);
82009d976b3SSwapnil Jakhade 	int val;
82109d976b3SSwapnil Jakhade 
82209d976b3SSwapnil Jakhade 	regmap_field_read(derived_refclk->cmn_plllc_clk1_en_preg, &val);
82309d976b3SSwapnil Jakhade 
82409d976b3SSwapnil Jakhade 	return !!val;
82509d976b3SSwapnil Jakhade }
82609d976b3SSwapnil Jakhade 
82709d976b3SSwapnil Jakhade static const struct clk_ops cdns_sierra_derived_refclk_ops = {
82809d976b3SSwapnil Jakhade 	.enable = cdns_sierra_derived_refclk_enable,
82909d976b3SSwapnil Jakhade 	.disable = cdns_sierra_derived_refclk_disable,
83009d976b3SSwapnil Jakhade 	.is_enabled = cdns_sierra_derived_refclk_is_enabled,
83109d976b3SSwapnil Jakhade };
83209d976b3SSwapnil Jakhade 
83309d976b3SSwapnil Jakhade static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp)
83409d976b3SSwapnil Jakhade {
83509d976b3SSwapnil Jakhade 	struct cdns_sierra_derived_refclk *derived_refclk;
83609d976b3SSwapnil Jakhade 	struct device *dev = sp->dev;
83709d976b3SSwapnil Jakhade 	struct regmap_field *field;
83809d976b3SSwapnil Jakhade 	struct clk_init_data *init;
83909d976b3SSwapnil Jakhade 	struct regmap *regmap;
84009d976b3SSwapnil Jakhade 	char clk_name[100];
84109d976b3SSwapnil Jakhade 	struct clk *clk;
84209d976b3SSwapnil Jakhade 
84309d976b3SSwapnil Jakhade 	derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL);
84409d976b3SSwapnil Jakhade 	if (!derived_refclk)
84509d976b3SSwapnil Jakhade 		return -ENOMEM;
84609d976b3SSwapnil Jakhade 
84709d976b3SSwapnil Jakhade 	snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev),
84809d976b3SSwapnil Jakhade 		 clk_names[CDNS_SIERRA_DERIVED_REFCLK]);
84909d976b3SSwapnil Jakhade 
85009d976b3SSwapnil Jakhade 	init = &derived_refclk->clk_data;
85109d976b3SSwapnil Jakhade 
85209d976b3SSwapnil Jakhade 	init->ops = &cdns_sierra_derived_refclk_ops;
85309d976b3SSwapnil Jakhade 	init->flags = 0;
85409d976b3SSwapnil Jakhade 	init->name = clk_name;
85509d976b3SSwapnil Jakhade 
85609d976b3SSwapnil Jakhade 	regmap = sp->regmap_common_cdb;
85709d976b3SSwapnil Jakhade 
85809d976b3SSwapnil Jakhade 	field = devm_regmap_field_alloc(dev, regmap, cmn_plllc_clk1outdiv_preg);
85909d976b3SSwapnil Jakhade 	if (IS_ERR(field)) {
86009d976b3SSwapnil Jakhade 		dev_err(dev, "cmn_plllc_clk1outdiv_preg reg field init failed\n");
86109d976b3SSwapnil Jakhade 		return PTR_ERR(field);
86209d976b3SSwapnil Jakhade 	}
86309d976b3SSwapnil Jakhade 	derived_refclk->cmn_plllc_clk1outdiv_preg = field;
86409d976b3SSwapnil Jakhade 
86509d976b3SSwapnil Jakhade 	field = devm_regmap_field_alloc(dev, regmap, cmn_plllc_clk1_en_preg);
86609d976b3SSwapnil Jakhade 	if (IS_ERR(field)) {
86709d976b3SSwapnil Jakhade 		dev_err(dev, "cmn_plllc_clk1_en_preg reg field init failed\n");
86809d976b3SSwapnil Jakhade 		return PTR_ERR(field);
86909d976b3SSwapnil Jakhade 	}
87009d976b3SSwapnil Jakhade 	derived_refclk->cmn_plllc_clk1_en_preg = field;
87109d976b3SSwapnil Jakhade 
87209d976b3SSwapnil Jakhade 	derived_refclk->hw.init = init;
87309d976b3SSwapnil Jakhade 
87409d976b3SSwapnil Jakhade 	clk = devm_clk_register(dev, &derived_refclk->hw);
87509d976b3SSwapnil Jakhade 	if (IS_ERR(clk))
87609d976b3SSwapnil Jakhade 		return PTR_ERR(clk);
87709d976b3SSwapnil Jakhade 
87809d976b3SSwapnil Jakhade 	sp->output_clks[CDNS_SIERRA_DERIVED_REFCLK] = clk;
87909d976b3SSwapnil Jakhade 
88009d976b3SSwapnil Jakhade 	return 0;
88109d976b3SSwapnil Jakhade }
88209d976b3SSwapnil Jakhade 
88328081b72SKishon Vijay Abraham I static void cdns_sierra_clk_unregister(struct cdns_sierra_phy *sp)
88428081b72SKishon Vijay Abraham I {
88528081b72SKishon Vijay Abraham I 	struct device *dev = sp->dev;
88628081b72SKishon Vijay Abraham I 	struct device_node *node = dev->of_node;
88728081b72SKishon Vijay Abraham I 
88828081b72SKishon Vijay Abraham I 	of_clk_del_provider(node);
88928081b72SKishon Vijay Abraham I }
89028081b72SKishon Vijay Abraham I 
89128081b72SKishon Vijay Abraham I static int cdns_sierra_clk_register(struct cdns_sierra_phy *sp)
89228081b72SKishon Vijay Abraham I {
89328081b72SKishon Vijay Abraham I 	struct device *dev = sp->dev;
89428081b72SKishon Vijay Abraham I 	struct device_node *node = dev->of_node;
89528081b72SKishon Vijay Abraham I 	int ret;
89628081b72SKishon Vijay Abraham I 
89728081b72SKishon Vijay Abraham I 	ret = cdns_sierra_phy_register_pll_mux(sp);
89828081b72SKishon Vijay Abraham I 	if (ret) {
89928081b72SKishon Vijay Abraham I 		dev_err(dev, "Failed to pll mux clocks\n");
90028081b72SKishon Vijay Abraham I 		return ret;
90128081b72SKishon Vijay Abraham I 	}
90228081b72SKishon Vijay Abraham I 
90309d976b3SSwapnil Jakhade 	ret = cdns_sierra_derived_refclk_register(sp);
90409d976b3SSwapnil Jakhade 	if (ret) {
90509d976b3SSwapnil Jakhade 		dev_err(dev, "Failed to register derived refclk\n");
90609d976b3SSwapnil Jakhade 		return ret;
90709d976b3SSwapnil Jakhade 	}
90809d976b3SSwapnil Jakhade 
90928081b72SKishon Vijay Abraham I 	sp->clk_data.clks = sp->output_clks;
91028081b72SKishon Vijay Abraham I 	sp->clk_data.clk_num = CDNS_SIERRA_OUTPUT_CLOCKS;
91128081b72SKishon Vijay Abraham I 	ret = of_clk_add_provider(node, of_clk_src_onecell_get, &sp->clk_data);
91228081b72SKishon Vijay Abraham I 	if (ret)
91328081b72SKishon Vijay Abraham I 		dev_err(dev, "Failed to add clock provider: %s\n", node->name);
91428081b72SKishon Vijay Abraham I 
91528081b72SKishon Vijay Abraham I 	return ret;
91628081b72SKishon Vijay Abraham I }
91728081b72SKishon Vijay Abraham I 
91844d30d62SAlan Douglas static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst,
91944d30d62SAlan Douglas 				    struct device_node *child)
92044d30d62SAlan Douglas {
921078e9e92SSwapnil Jakhade 	u32 phy_type;
922078e9e92SSwapnil Jakhade 
92344d30d62SAlan Douglas 	if (of_property_read_u32(child, "reg", &inst->mlane))
92444d30d62SAlan Douglas 		return -EINVAL;
92544d30d62SAlan Douglas 
92644d30d62SAlan Douglas 	if (of_property_read_u32(child, "cdns,num-lanes", &inst->num_lanes))
92744d30d62SAlan Douglas 		return -EINVAL;
92844d30d62SAlan Douglas 
929078e9e92SSwapnil Jakhade 	if (of_property_read_u32(child, "cdns,phy-type", &phy_type))
93044d30d62SAlan Douglas 		return -EINVAL;
93144d30d62SAlan Douglas 
932078e9e92SSwapnil Jakhade 	switch (phy_type) {
933078e9e92SSwapnil Jakhade 	case PHY_TYPE_PCIE:
934078e9e92SSwapnil Jakhade 		inst->phy_type = TYPE_PCIE;
935078e9e92SSwapnil Jakhade 		break;
936078e9e92SSwapnil Jakhade 	case PHY_TYPE_USB3:
937078e9e92SSwapnil Jakhade 		inst->phy_type = TYPE_USB;
938078e9e92SSwapnil Jakhade 		break;
9398a1b82d7SSwapnil Jakhade 	case PHY_TYPE_QSGMII:
9408a1b82d7SSwapnil Jakhade 		inst->phy_type = TYPE_QSGMII;
9418a1b82d7SSwapnil Jakhade 		break;
942078e9e92SSwapnil Jakhade 	default:
943078e9e92SSwapnil Jakhade 		return -EINVAL;
944078e9e92SSwapnil Jakhade 	}
945078e9e92SSwapnil Jakhade 
9461e902b2aSSwapnil Jakhade 	inst->ssc_mode = EXTERNAL_SSC;
9471e902b2aSSwapnil Jakhade 	of_property_read_u32(child, "cdns,ssc-mode", &inst->ssc_mode);
9481e902b2aSSwapnil Jakhade 
94944d30d62SAlan Douglas 	return 0;
95044d30d62SAlan Douglas }
95144d30d62SAlan Douglas 
952380f5708SKishon Vijay Abraham I static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base,
953380f5708SKishon Vijay Abraham I 				       u32 block_offset, u8 reg_offset_shift,
954380f5708SKishon Vijay Abraham I 				       const struct regmap_config *config)
955380f5708SKishon Vijay Abraham I {
956380f5708SKishon Vijay Abraham I 	struct cdns_regmap_cdb_context *ctx;
957380f5708SKishon Vijay Abraham I 
958380f5708SKishon Vijay Abraham I 	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
959380f5708SKishon Vijay Abraham I 	if (!ctx)
960380f5708SKishon Vijay Abraham I 		return ERR_PTR(-ENOMEM);
961380f5708SKishon Vijay Abraham I 
962380f5708SKishon Vijay Abraham I 	ctx->dev = dev;
963380f5708SKishon Vijay Abraham I 	ctx->base = base + block_offset;
964380f5708SKishon Vijay Abraham I 	ctx->reg_offset_shift = reg_offset_shift;
965380f5708SKishon Vijay Abraham I 
966380f5708SKishon Vijay Abraham I 	return devm_regmap_init(dev, NULL, ctx, config);
967380f5708SKishon Vijay Abraham I }
968380f5708SKishon Vijay Abraham I 
969380f5708SKishon Vijay Abraham I static int cdns_regfield_init(struct cdns_sierra_phy *sp)
970380f5708SKishon Vijay Abraham I {
971380f5708SKishon Vijay Abraham I 	struct device *dev = sp->dev;
972380f5708SKishon Vijay Abraham I 	struct regmap_field *field;
97328081b72SKishon Vijay Abraham I 	struct reg_field reg_field;
974380f5708SKishon Vijay Abraham I 	struct regmap *regmap;
975adc4bd6fSKishon Vijay Abraham I 	int i;
976380f5708SKishon Vijay Abraham I 
977380f5708SKishon Vijay Abraham I 	regmap = sp->regmap_common_cdb;
978380f5708SKishon Vijay Abraham I 	field = devm_regmap_field_alloc(dev, regmap, macro_id_type);
979380f5708SKishon Vijay Abraham I 	if (IS_ERR(field)) {
980380f5708SKishon Vijay Abraham I 		dev_err(dev, "MACRO_ID_TYPE reg field init failed\n");
981380f5708SKishon Vijay Abraham I 		return PTR_ERR(field);
982380f5708SKishon Vijay Abraham I 	}
983380f5708SKishon Vijay Abraham I 	sp->macro_id_type = field;
984380f5708SKishon Vijay Abraham I 
98528081b72SKishon Vijay Abraham I 	for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++) {
98628081b72SKishon Vijay Abraham I 		reg_field = cmn_plllc_pfdclk1_sel_preg[i].pfdclk_sel_preg;
98728081b72SKishon Vijay Abraham I 		field = devm_regmap_field_alloc(dev, regmap, reg_field);
98828081b72SKishon Vijay Abraham I 		if (IS_ERR(field)) {
98928081b72SKishon Vijay Abraham I 			dev_err(dev, "PLLLC%d_PFDCLK1_SEL failed\n", i);
99028081b72SKishon Vijay Abraham I 			return PTR_ERR(field);
99128081b72SKishon Vijay Abraham I 		}
99228081b72SKishon Vijay Abraham I 		sp->cmn_plllc_pfdclk1_sel_preg[i] = field;
99328081b72SKishon Vijay Abraham I 
99428081b72SKishon Vijay Abraham I 		reg_field = cmn_plllc_pfdclk1_sel_preg[i].plllc1en_field;
99528081b72SKishon Vijay Abraham I 		field = devm_regmap_field_alloc(dev, regmap, reg_field);
99628081b72SKishon Vijay Abraham I 		if (IS_ERR(field)) {
99728081b72SKishon Vijay Abraham I 			dev_err(dev, "REFRCV%d_REFCLK_PLLLC1EN failed\n", i);
99828081b72SKishon Vijay Abraham I 			return PTR_ERR(field);
99928081b72SKishon Vijay Abraham I 		}
100028081b72SKishon Vijay Abraham I 		sp->cmn_refrcv_refclk_plllc1en_preg[i] = field;
100128081b72SKishon Vijay Abraham I 
100228081b72SKishon Vijay Abraham I 		reg_field = cmn_plllc_pfdclk1_sel_preg[i].termen_field;
100328081b72SKishon Vijay Abraham I 		field = devm_regmap_field_alloc(dev, regmap, reg_field);
100428081b72SKishon Vijay Abraham I 		if (IS_ERR(field)) {
100528081b72SKishon Vijay Abraham I 			dev_err(dev, "REFRCV%d_REFCLK_TERMEN failed\n", i);
100628081b72SKishon Vijay Abraham I 			return PTR_ERR(field);
100728081b72SKishon Vijay Abraham I 		}
100828081b72SKishon Vijay Abraham I 		sp->cmn_refrcv_refclk_termen_preg[i] = field;
100928081b72SKishon Vijay Abraham I 	}
101028081b72SKishon Vijay Abraham I 
10118c95e172SSwapnil Jakhade 	regmap = sp->regmap_phy_pcs_common_cdb;
1012380f5708SKishon Vijay Abraham I 	field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg_1);
1013380f5708SKishon Vijay Abraham I 	if (IS_ERR(field)) {
1014380f5708SKishon Vijay Abraham I 		dev_err(dev, "PHY_PLL_CFG_1 reg field init failed\n");
1015380f5708SKishon Vijay Abraham I 		return PTR_ERR(field);
1016380f5708SKishon Vijay Abraham I 	}
1017380f5708SKishon Vijay Abraham I 	sp->phy_pll_cfg_1 = field;
1018380f5708SKishon Vijay Abraham I 
1019f1cc6c3fSSwapnil Jakhade 	regmap = sp->regmap_phy_pma_common_cdb;
1020f1cc6c3fSSwapnil Jakhade 	field = devm_regmap_field_alloc(dev, regmap, pma_cmn_ready);
1021f1cc6c3fSSwapnil Jakhade 	if (IS_ERR(field)) {
1022f1cc6c3fSSwapnil Jakhade 		dev_err(dev, "PHY_PMA_CMN_CTRL reg field init failed\n");
1023f1cc6c3fSSwapnil Jakhade 		return PTR_ERR(field);
1024f1cc6c3fSSwapnil Jakhade 	}
1025f1cc6c3fSSwapnil Jakhade 	sp->pma_cmn_ready = field;
1026f1cc6c3fSSwapnil Jakhade 
1027adc4bd6fSKishon Vijay Abraham I 	for (i = 0; i < SIERRA_MAX_LANES; i++) {
1028adc4bd6fSKishon Vijay Abraham I 		regmap = sp->regmap_lane_cdb[i];
1029adc4bd6fSKishon Vijay Abraham I 		field = devm_regmap_field_alloc(dev, regmap, pllctrl_lock);
1030adc4bd6fSKishon Vijay Abraham I 		if (IS_ERR(field)) {
1031adc4bd6fSKishon Vijay Abraham I 			dev_err(dev, "P%d_ENABLE reg field init failed\n", i);
1032adc4bd6fSKishon Vijay Abraham I 			return PTR_ERR(field);
1033adc4bd6fSKishon Vijay Abraham I 		}
1034adc4bd6fSKishon Vijay Abraham I 		sp->pllctrl_lock[i] = field;
1035adc4bd6fSKishon Vijay Abraham I 	}
1036adc4bd6fSKishon Vijay Abraham I 
103736ce4163SSwapnil Jakhade 	for (i = 0; i < SIERRA_MAX_LANES; i++) {
103836ce4163SSwapnil Jakhade 		regmap = sp->regmap_phy_pcs_lane_cdb[i];
103936ce4163SSwapnil Jakhade 		field = devm_regmap_field_alloc(dev, regmap, phy_iso_link_ctrl_1);
104036ce4163SSwapnil Jakhade 		if (IS_ERR(field)) {
104136ce4163SSwapnil Jakhade 			dev_err(dev, "PHY_ISO_LINK_CTRL reg field init for lane %d failed\n", i);
104236ce4163SSwapnil Jakhade 			return PTR_ERR(field);
104336ce4163SSwapnil Jakhade 		}
104436ce4163SSwapnil Jakhade 		sp->phy_iso_link_ctrl_1[i] = field;
104536ce4163SSwapnil Jakhade 	}
104636ce4163SSwapnil Jakhade 
1047380f5708SKishon Vijay Abraham I 	return 0;
1048380f5708SKishon Vijay Abraham I }
1049380f5708SKishon Vijay Abraham I 
1050380f5708SKishon Vijay Abraham I static int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp,
1051380f5708SKishon Vijay Abraham I 				   void __iomem *base, u8 block_offset_shift,
1052380f5708SKishon Vijay Abraham I 				   u8 reg_offset_shift)
1053380f5708SKishon Vijay Abraham I {
1054380f5708SKishon Vijay Abraham I 	struct device *dev = sp->dev;
1055380f5708SKishon Vijay Abraham I 	struct regmap *regmap;
1056380f5708SKishon Vijay Abraham I 	u32 block_offset;
1057380f5708SKishon Vijay Abraham I 	int i;
1058380f5708SKishon Vijay Abraham I 
1059380f5708SKishon Vijay Abraham I 	for (i = 0; i < SIERRA_MAX_LANES; i++) {
1060380f5708SKishon Vijay Abraham I 		block_offset = SIERRA_LANE_CDB_OFFSET(i, block_offset_shift,
1061380f5708SKishon Vijay Abraham I 						      reg_offset_shift);
1062380f5708SKishon Vijay Abraham I 		regmap = cdns_regmap_init(dev, base, block_offset,
1063380f5708SKishon Vijay Abraham I 					  reg_offset_shift,
1064380f5708SKishon Vijay Abraham I 					  &cdns_sierra_lane_cdb_config[i]);
1065380f5708SKishon Vijay Abraham I 		if (IS_ERR(regmap)) {
1066380f5708SKishon Vijay Abraham I 			dev_err(dev, "Failed to init lane CDB regmap\n");
1067380f5708SKishon Vijay Abraham I 			return PTR_ERR(regmap);
1068380f5708SKishon Vijay Abraham I 		}
1069380f5708SKishon Vijay Abraham I 		sp->regmap_lane_cdb[i] = regmap;
1070380f5708SKishon Vijay Abraham I 	}
1071380f5708SKishon Vijay Abraham I 
1072380f5708SKishon Vijay Abraham I 	regmap = cdns_regmap_init(dev, base, SIERRA_COMMON_CDB_OFFSET,
1073380f5708SKishon Vijay Abraham I 				  reg_offset_shift,
1074380f5708SKishon Vijay Abraham I 				  &cdns_sierra_common_cdb_config);
1075380f5708SKishon Vijay Abraham I 	if (IS_ERR(regmap)) {
1076380f5708SKishon Vijay Abraham I 		dev_err(dev, "Failed to init common CDB regmap\n");
1077380f5708SKishon Vijay Abraham I 		return PTR_ERR(regmap);
1078380f5708SKishon Vijay Abraham I 	}
1079380f5708SKishon Vijay Abraham I 	sp->regmap_common_cdb = regmap;
1080380f5708SKishon Vijay Abraham I 
10818c95e172SSwapnil Jakhade 	block_offset = SIERRA_PHY_PCS_COMMON_OFFSET(block_offset_shift);
1082380f5708SKishon Vijay Abraham I 	regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift,
10838c95e172SSwapnil Jakhade 				  &cdns_sierra_phy_pcs_cmn_cdb_config);
1084380f5708SKishon Vijay Abraham I 	if (IS_ERR(regmap)) {
10858c95e172SSwapnil Jakhade 		dev_err(dev, "Failed to init PHY PCS common CDB regmap\n");
1086380f5708SKishon Vijay Abraham I 		return PTR_ERR(regmap);
1087380f5708SKishon Vijay Abraham I 	}
10888c95e172SSwapnil Jakhade 	sp->regmap_phy_pcs_common_cdb = regmap;
1089380f5708SKishon Vijay Abraham I 
109036ce4163SSwapnil Jakhade 	for (i = 0; i < SIERRA_MAX_LANES; i++) {
109136ce4163SSwapnil Jakhade 		block_offset = SIERRA_PHY_PCS_LANE_CDB_OFFSET(i, block_offset_shift,
109236ce4163SSwapnil Jakhade 							      reg_offset_shift);
109336ce4163SSwapnil Jakhade 		regmap = cdns_regmap_init(dev, base, block_offset,
109436ce4163SSwapnil Jakhade 					  reg_offset_shift,
109536ce4163SSwapnil Jakhade 					  &cdns_sierra_phy_pcs_lane_cdb_config[i]);
109636ce4163SSwapnil Jakhade 		if (IS_ERR(regmap)) {
109736ce4163SSwapnil Jakhade 			dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n");
109836ce4163SSwapnil Jakhade 			return PTR_ERR(regmap);
109936ce4163SSwapnil Jakhade 		}
110036ce4163SSwapnil Jakhade 		sp->regmap_phy_pcs_lane_cdb[i] = regmap;
110136ce4163SSwapnil Jakhade 	}
110236ce4163SSwapnil Jakhade 
1103f1cc6c3fSSwapnil Jakhade 	block_offset = SIERRA_PHY_PMA_COMMON_OFFSET(block_offset_shift);
1104f1cc6c3fSSwapnil Jakhade 	regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift,
1105f1cc6c3fSSwapnil Jakhade 				  &cdns_sierra_phy_pma_cmn_cdb_config);
1106f1cc6c3fSSwapnil Jakhade 	if (IS_ERR(regmap)) {
1107f1cc6c3fSSwapnil Jakhade 		dev_err(dev, "Failed to init PHY PMA common CDB regmap\n");
1108f1cc6c3fSSwapnil Jakhade 		return PTR_ERR(regmap);
1109f1cc6c3fSSwapnil Jakhade 	}
1110f1cc6c3fSSwapnil Jakhade 	sp->regmap_phy_pma_common_cdb = regmap;
1111f1cc6c3fSSwapnil Jakhade 
11126b81f05aSSwapnil Jakhade 	for (i = 0; i < SIERRA_MAX_LANES; i++) {
11136b81f05aSSwapnil Jakhade 		block_offset = SIERRA_PHY_PMA_LANE_CDB_OFFSET(i, block_offset_shift,
11146b81f05aSSwapnil Jakhade 							      reg_offset_shift);
11156b81f05aSSwapnil Jakhade 		regmap = cdns_regmap_init(dev, base, block_offset,
11166b81f05aSSwapnil Jakhade 					  reg_offset_shift,
11176b81f05aSSwapnil Jakhade 					  &cdns_sierra_phy_pma_lane_cdb_config[i]);
11186b81f05aSSwapnil Jakhade 		if (IS_ERR(regmap)) {
11196b81f05aSSwapnil Jakhade 			dev_err(dev, "Failed to init PHY PMA lane CDB regmap\n");
11206b81f05aSSwapnil Jakhade 			return PTR_ERR(regmap);
11216b81f05aSSwapnil Jakhade 		}
11226b81f05aSSwapnil Jakhade 		sp->regmap_phy_pma_lane_cdb[i] = regmap;
11236b81f05aSSwapnil Jakhade 	}
11246b81f05aSSwapnil Jakhade 
1125380f5708SKishon Vijay Abraham I 	return 0;
1126380f5708SKishon Vijay Abraham I }
1127380f5708SKishon Vijay Abraham I 
11287e016cbcSKishon Vijay Abraham I static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp,
11297e016cbcSKishon Vijay Abraham I 				      struct device *dev)
11307e016cbcSKishon Vijay Abraham I {
11317e016cbcSKishon Vijay Abraham I 	struct clk *clk;
11327e016cbcSKishon Vijay Abraham I 	int ret;
11337e016cbcSKishon Vijay Abraham I 
11347e016cbcSKishon Vijay Abraham I 	clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div");
11357e016cbcSKishon Vijay Abraham I 	if (IS_ERR(clk)) {
11367e016cbcSKishon Vijay Abraham I 		dev_err(dev, "cmn_refclk_dig_div clock not found\n");
11377e016cbcSKishon Vijay Abraham I 		ret = PTR_ERR(clk);
11387e016cbcSKishon Vijay Abraham I 		return ret;
11397e016cbcSKishon Vijay Abraham I 	}
1140a0c30cd7SKishon Vijay Abraham I 	sp->input_clks[CMN_REFCLK_DIG_DIV] = clk;
11417e016cbcSKishon Vijay Abraham I 
11427e016cbcSKishon Vijay Abraham I 	clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div");
11437e016cbcSKishon Vijay Abraham I 	if (IS_ERR(clk)) {
11447e016cbcSKishon Vijay Abraham I 		dev_err(dev, "cmn_refclk1_dig_div clock not found\n");
11457e016cbcSKishon Vijay Abraham I 		ret = PTR_ERR(clk);
11467e016cbcSKishon Vijay Abraham I 		return ret;
11477e016cbcSKishon Vijay Abraham I 	}
1148a0c30cd7SKishon Vijay Abraham I 	sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk;
11497e016cbcSKishon Vijay Abraham I 
115028081b72SKishon Vijay Abraham I 	clk = devm_clk_get_optional(dev, "pll0_refclk");
115128081b72SKishon Vijay Abraham I 	if (IS_ERR(clk)) {
115228081b72SKishon Vijay Abraham I 		dev_err(dev, "pll0_refclk clock not found\n");
115328081b72SKishon Vijay Abraham I 		ret = PTR_ERR(clk);
115428081b72SKishon Vijay Abraham I 		return ret;
115528081b72SKishon Vijay Abraham I 	}
115628081b72SKishon Vijay Abraham I 	sp->input_clks[PLL0_REFCLK] = clk;
115728081b72SKishon Vijay Abraham I 
115828081b72SKishon Vijay Abraham I 	clk = devm_clk_get_optional(dev, "pll1_refclk");
115928081b72SKishon Vijay Abraham I 	if (IS_ERR(clk)) {
116028081b72SKishon Vijay Abraham I 		dev_err(dev, "pll1_refclk clock not found\n");
116128081b72SKishon Vijay Abraham I 		ret = PTR_ERR(clk);
116228081b72SKishon Vijay Abraham I 		return ret;
116328081b72SKishon Vijay Abraham I 	}
116428081b72SKishon Vijay Abraham I 	sp->input_clks[PLL1_REFCLK] = clk;
116528081b72SKishon Vijay Abraham I 
11667e016cbcSKishon Vijay Abraham I 	return 0;
11677e016cbcSKishon Vijay Abraham I }
11687e016cbcSKishon Vijay Abraham I 
1169*d88ca22dSAswath Govindraju static int cdns_sierra_phy_clk(struct cdns_sierra_phy *sp)
11701436ec30SKishon Vijay Abraham I {
1171*d88ca22dSAswath Govindraju 	struct device *dev = sp->dev;
1172*d88ca22dSAswath Govindraju 	struct clk *clk;
11731436ec30SKishon Vijay Abraham I 	int ret;
11741436ec30SKishon Vijay Abraham I 
1175*d88ca22dSAswath Govindraju 	clk = devm_clk_get_optional(dev, "phy_clk");
1176*d88ca22dSAswath Govindraju 	if (IS_ERR(clk)) {
1177*d88ca22dSAswath Govindraju 		dev_err(dev, "failed to get clock phy_clk\n");
1178*d88ca22dSAswath Govindraju 		return PTR_ERR(clk);
1179*d88ca22dSAswath Govindraju 	}
1180*d88ca22dSAswath Govindraju 	sp->input_clks[PHY_CLK] = clk;
1181*d88ca22dSAswath Govindraju 
11821436ec30SKishon Vijay Abraham I 	ret = clk_prepare_enable(sp->input_clks[PHY_CLK]);
11831436ec30SKishon Vijay Abraham I 	if (ret)
11841436ec30SKishon Vijay Abraham I 		return ret;
11851436ec30SKishon Vijay Abraham I 
1186*d88ca22dSAswath Govindraju 	return 0;
1187*d88ca22dSAswath Govindraju }
1188*d88ca22dSAswath Govindraju 
1189*d88ca22dSAswath Govindraju static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp)
1190*d88ca22dSAswath Govindraju {
1191*d88ca22dSAswath Govindraju 	int ret;
1192*d88ca22dSAswath Govindraju 
11931436ec30SKishon Vijay Abraham I 	ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
11941436ec30SKishon Vijay Abraham I 	if (ret)
1195*d88ca22dSAswath Govindraju 		return ret;
11961436ec30SKishon Vijay Abraham I 
11971436ec30SKishon Vijay Abraham I 	ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]);
11981436ec30SKishon Vijay Abraham I 	if (ret)
11991436ec30SKishon Vijay Abraham I 		goto err_pll_cmnlc1;
12001436ec30SKishon Vijay Abraham I 
12011436ec30SKishon Vijay Abraham I 	return 0;
12021436ec30SKishon Vijay Abraham I 
12031436ec30SKishon Vijay Abraham I err_pll_cmnlc1:
12041436ec30SKishon Vijay Abraham I 	clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
12051436ec30SKishon Vijay Abraham I 
12061436ec30SKishon Vijay Abraham I 	return ret;
12071436ec30SKishon Vijay Abraham I }
12081436ec30SKishon Vijay Abraham I 
12091436ec30SKishon Vijay Abraham I static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp)
12101436ec30SKishon Vijay Abraham I {
12111436ec30SKishon Vijay Abraham I 	clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]);
12121436ec30SKishon Vijay Abraham I 	clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
1213*d88ca22dSAswath Govindraju 	if (!sp->already_configured)
12141436ec30SKishon Vijay Abraham I 		clk_disable_unprepare(sp->input_clks[PHY_CLK]);
12151436ec30SKishon Vijay Abraham I }
12161436ec30SKishon Vijay Abraham I 
12171d5f40e0SKishon Vijay Abraham I static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp,
12181d5f40e0SKishon Vijay Abraham I 				      struct device *dev)
12191d5f40e0SKishon Vijay Abraham I {
12201d5f40e0SKishon Vijay Abraham I 	struct reset_control *rst;
12211d5f40e0SKishon Vijay Abraham I 
122215b0b82dSKishon Vijay Abraham I 	rst = devm_reset_control_get_exclusive(dev, "sierra_reset");
12231d5f40e0SKishon Vijay Abraham I 	if (IS_ERR(rst)) {
12241d5f40e0SKishon Vijay Abraham I 		dev_err(dev, "failed to get reset\n");
12251d5f40e0SKishon Vijay Abraham I 		return PTR_ERR(rst);
12261d5f40e0SKishon Vijay Abraham I 	}
12271d5f40e0SKishon Vijay Abraham I 	sp->phy_rst = rst;
12281d5f40e0SKishon Vijay Abraham I 
122915b0b82dSKishon Vijay Abraham I 	rst = devm_reset_control_get_optional_exclusive(dev, "sierra_apb");
12301d5f40e0SKishon Vijay Abraham I 	if (IS_ERR(rst)) {
12311d5f40e0SKishon Vijay Abraham I 		dev_err(dev, "failed to get apb reset\n");
12321d5f40e0SKishon Vijay Abraham I 		return PTR_ERR(rst);
12331d5f40e0SKishon Vijay Abraham I 	}
12341d5f40e0SKishon Vijay Abraham I 	sp->apb_rst = rst;
12351d5f40e0SKishon Vijay Abraham I 
12361d5f40e0SKishon Vijay Abraham I 	return 0;
12371d5f40e0SKishon Vijay Abraham I }
12381d5f40e0SKishon Vijay Abraham I 
12396b81f05aSSwapnil Jakhade static int cdns_sierra_phy_configure_multilink(struct cdns_sierra_phy *sp)
12406b81f05aSSwapnil Jakhade {
12416b81f05aSSwapnil Jakhade 	const struct cdns_sierra_data *init_data = sp->init_data;
12426b81f05aSSwapnil Jakhade 	struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals;
12436b81f05aSSwapnil Jakhade 	enum cdns_sierra_phy_type phy_t1, phy_t2;
12446b81f05aSSwapnil Jakhade 	struct cdns_sierra_vals *phy_pma_ln_vals;
12456b81f05aSSwapnil Jakhade 	const struct cdns_reg_pairs *reg_pairs;
12466b81f05aSSwapnil Jakhade 	struct cdns_sierra_vals *pcs_cmn_vals;
12476b81f05aSSwapnil Jakhade 	int i, j, node, mlane, num_lanes, ret;
12486b81f05aSSwapnil Jakhade 	enum cdns_sierra_ssc_mode ssc;
12496b81f05aSSwapnil Jakhade 	struct regmap *regmap;
12506b81f05aSSwapnil Jakhade 	u32 num_regs;
12516b81f05aSSwapnil Jakhade 
12526b81f05aSSwapnil Jakhade 	/* Maximum 2 links (subnodes) are supported */
12536b81f05aSSwapnil Jakhade 	if (sp->nsubnodes != 2)
12546b81f05aSSwapnil Jakhade 		return -EINVAL;
12556b81f05aSSwapnil Jakhade 
12566b81f05aSSwapnil Jakhade 	clk_set_rate(sp->input_clks[CMN_REFCLK_DIG_DIV], 25000000);
12576b81f05aSSwapnil Jakhade 	clk_set_rate(sp->input_clks[CMN_REFCLK1_DIG_DIV], 25000000);
12586b81f05aSSwapnil Jakhade 
12596b81f05aSSwapnil Jakhade 	/* PHY configured to use both PLL LC and LC1 */
12606b81f05aSSwapnil Jakhade 	regmap_field_write(sp->phy_pll_cfg_1, 0x1);
12616b81f05aSSwapnil Jakhade 
12626b81f05aSSwapnil Jakhade 	phy_t1 = sp->phys[0].phy_type;
12636b81f05aSSwapnil Jakhade 	phy_t2 = sp->phys[1].phy_type;
12646b81f05aSSwapnil Jakhade 
12656b81f05aSSwapnil Jakhade 	/*
12666b81f05aSSwapnil Jakhade 	 * PHY configuration for multi-link operation is done in two steps.
12676b81f05aSSwapnil Jakhade 	 * e.g. Consider a case for a 4 lane PHY with PCIe using 2 lanes and QSGMII other 2 lanes.
12686b81f05aSSwapnil Jakhade 	 * Sierra PHY has 2 PLLs, viz. PLLLC and PLLLC1. So in this case, PLLLC is used for PCIe
12696b81f05aSSwapnil Jakhade 	 * and PLLLC1 is used for QSGMII. PHY is configured in two steps as described below.
12706b81f05aSSwapnil Jakhade 	 *
12716b81f05aSSwapnil Jakhade 	 * [1] For first step, phy_t1 = TYPE_PCIE and phy_t2 = TYPE_QSGMII
12726b81f05aSSwapnil Jakhade 	 *     So the register values are selected as [TYPE_PCIE][TYPE_QSGMII][ssc].
12736b81f05aSSwapnil Jakhade 	 *     This will configure PHY registers associated for PCIe (i.e. first protocol)
12746b81f05aSSwapnil Jakhade 	 *     involving PLLLC registers and registers for first 2 lanes of PHY.
12756b81f05aSSwapnil Jakhade 	 * [2] In second step, the variables phy_t1 and phy_t2 are swapped. So now,
12766b81f05aSSwapnil Jakhade 	 *     phy_t1 = TYPE_QSGMII and phy_t2 = TYPE_PCIE. And the register values are selected as
12776b81f05aSSwapnil Jakhade 	 *     [TYPE_QSGMII][TYPE_PCIE][ssc].
12786b81f05aSSwapnil Jakhade 	 *     This will configure PHY registers associated for QSGMII (i.e. second protocol)
12796b81f05aSSwapnil Jakhade 	 *     involving PLLLC1 registers and registers for other 2 lanes of PHY.
12806b81f05aSSwapnil Jakhade 	 *
12816b81f05aSSwapnil Jakhade 	 * This completes the PHY configuration for multilink operation. This approach enables
12826b81f05aSSwapnil Jakhade 	 * dividing the large number of PHY register configurations into protocol specific
12836b81f05aSSwapnil Jakhade 	 * smaller groups.
12846b81f05aSSwapnil Jakhade 	 */
12856b81f05aSSwapnil Jakhade 	for (node = 0; node < sp->nsubnodes; node++) {
12866b81f05aSSwapnil Jakhade 		if (node == 1) {
12876b81f05aSSwapnil Jakhade 			/*
12886b81f05aSSwapnil Jakhade 			 * If first link with phy_t1 is configured, then configure the PHY for
12896b81f05aSSwapnil Jakhade 			 * second link with phy_t2. Get the array values as [phy_t2][phy_t1][ssc].
12906b81f05aSSwapnil Jakhade 			 */
12916b81f05aSSwapnil Jakhade 			swap(phy_t1, phy_t2);
12926b81f05aSSwapnil Jakhade 		}
12936b81f05aSSwapnil Jakhade 
12946b81f05aSSwapnil Jakhade 		mlane = sp->phys[node].mlane;
12956b81f05aSSwapnil Jakhade 		ssc = sp->phys[node].ssc_mode;
12966b81f05aSSwapnil Jakhade 		num_lanes = sp->phys[node].num_lanes;
12976b81f05aSSwapnil Jakhade 
12986b81f05aSSwapnil Jakhade 		/* PHY PCS common registers configurations */
12996b81f05aSSwapnil Jakhade 		pcs_cmn_vals = init_data->pcs_cmn_vals[phy_t1][phy_t2][ssc];
13006b81f05aSSwapnil Jakhade 		if (pcs_cmn_vals) {
13016b81f05aSSwapnil Jakhade 			reg_pairs = pcs_cmn_vals->reg_pairs;
13026b81f05aSSwapnil Jakhade 			num_regs = pcs_cmn_vals->num_regs;
13036b81f05aSSwapnil Jakhade 			regmap = sp->regmap_phy_pcs_common_cdb;
13046b81f05aSSwapnil Jakhade 			for (i = 0; i < num_regs; i++)
13056b81f05aSSwapnil Jakhade 				regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
13066b81f05aSSwapnil Jakhade 		}
13076b81f05aSSwapnil Jakhade 
13086b81f05aSSwapnil Jakhade 		/* PHY PMA lane registers configurations */
13096b81f05aSSwapnil Jakhade 		phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_t1][phy_t2][ssc];
13106b81f05aSSwapnil Jakhade 		if (phy_pma_ln_vals) {
13116b81f05aSSwapnil Jakhade 			reg_pairs = phy_pma_ln_vals->reg_pairs;
13126b81f05aSSwapnil Jakhade 			num_regs = phy_pma_ln_vals->num_regs;
13136b81f05aSSwapnil Jakhade 			for (i = 0; i < num_lanes; i++) {
13146b81f05aSSwapnil Jakhade 				regmap = sp->regmap_phy_pma_lane_cdb[i + mlane];
13156b81f05aSSwapnil Jakhade 				for (j = 0; j < num_regs; j++)
13166b81f05aSSwapnil Jakhade 					regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
13176b81f05aSSwapnil Jakhade 			}
13186b81f05aSSwapnil Jakhade 		}
13196b81f05aSSwapnil Jakhade 
13206b81f05aSSwapnil Jakhade 		/* PMA common registers configurations */
13216b81f05aSSwapnil Jakhade 		pma_cmn_vals = init_data->pma_cmn_vals[phy_t1][phy_t2][ssc];
13226b81f05aSSwapnil Jakhade 		if (pma_cmn_vals) {
13236b81f05aSSwapnil Jakhade 			reg_pairs = pma_cmn_vals->reg_pairs;
13246b81f05aSSwapnil Jakhade 			num_regs = pma_cmn_vals->num_regs;
13256b81f05aSSwapnil Jakhade 			regmap = sp->regmap_common_cdb;
13266b81f05aSSwapnil Jakhade 			for (i = 0; i < num_regs; i++)
13276b81f05aSSwapnil Jakhade 				regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
13286b81f05aSSwapnil Jakhade 		}
13296b81f05aSSwapnil Jakhade 
13306b81f05aSSwapnil Jakhade 		/* PMA lane registers configurations */
13316b81f05aSSwapnil Jakhade 		pma_ln_vals = init_data->pma_ln_vals[phy_t1][phy_t2][ssc];
13326b81f05aSSwapnil Jakhade 		if (pma_ln_vals) {
13336b81f05aSSwapnil Jakhade 			reg_pairs = pma_ln_vals->reg_pairs;
13346b81f05aSSwapnil Jakhade 			num_regs = pma_ln_vals->num_regs;
13356b81f05aSSwapnil Jakhade 			for (i = 0; i < num_lanes; i++) {
13366b81f05aSSwapnil Jakhade 				regmap = sp->regmap_lane_cdb[i + mlane];
13376b81f05aSSwapnil Jakhade 				for (j = 0; j < num_regs; j++)
13386b81f05aSSwapnil Jakhade 					regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
13396b81f05aSSwapnil Jakhade 			}
13406b81f05aSSwapnil Jakhade 		}
13418a1b82d7SSwapnil Jakhade 
13428a1b82d7SSwapnil Jakhade 		if (phy_t1 == TYPE_QSGMII)
13438a1b82d7SSwapnil Jakhade 			reset_control_deassert(sp->phys[node].lnk_rst);
13446b81f05aSSwapnil Jakhade 	}
13456b81f05aSSwapnil Jakhade 
13466b81f05aSSwapnil Jakhade 	/* Take the PHY out of reset */
13476b81f05aSSwapnil Jakhade 	ret = reset_control_deassert(sp->phy_rst);
13486b81f05aSSwapnil Jakhade 	if (ret)
13496b81f05aSSwapnil Jakhade 		return ret;
13506b81f05aSSwapnil Jakhade 
13516b81f05aSSwapnil Jakhade 	return 0;
13526b81f05aSSwapnil Jakhade }
13536b81f05aSSwapnil Jakhade 
135444d30d62SAlan Douglas static int cdns_sierra_phy_probe(struct platform_device *pdev)
135544d30d62SAlan Douglas {
135644d30d62SAlan Douglas 	struct cdns_sierra_phy *sp;
135744d30d62SAlan Douglas 	struct phy_provider *phy_provider;
135844d30d62SAlan Douglas 	struct device *dev = &pdev->dev;
1359c3c11d55SSwapnil Jakhade 	const struct cdns_sierra_data *data;
1360380f5708SKishon Vijay Abraham I 	unsigned int id_value;
136129afbd76SDan Carpenter 	int ret, node = 0;
1362380f5708SKishon Vijay Abraham I 	void __iomem *base;
136344d30d62SAlan Douglas 	struct device_node *dn = dev->of_node, *child;
136444d30d62SAlan Douglas 
136544d30d62SAlan Douglas 	if (of_get_child_count(dn) == 0)
136644d30d62SAlan Douglas 		return -ENODEV;
136744d30d62SAlan Douglas 
1368380f5708SKishon Vijay Abraham I 	/* Get init data for this PHY */
1369c3c11d55SSwapnil Jakhade 	data = of_device_get_match_data(dev);
1370c3c11d55SSwapnil Jakhade 	if (!data)
1371380f5708SKishon Vijay Abraham I 		return -EINVAL;
1372380f5708SKishon Vijay Abraham I 
137344d30d62SAlan Douglas 	sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL);
137444d30d62SAlan Douglas 	if (!sp)
137544d30d62SAlan Douglas 		return -ENOMEM;
137644d30d62SAlan Douglas 	dev_set_drvdata(dev, sp);
137744d30d62SAlan Douglas 	sp->dev = dev;
1378380f5708SKishon Vijay Abraham I 	sp->init_data = data;
137944d30d62SAlan Douglas 
1380fa629094SChunfeng Yun 	base = devm_platform_ioremap_resource(pdev, 0);
1381380f5708SKishon Vijay Abraham I 	if (IS_ERR(base)) {
138244d30d62SAlan Douglas 		dev_err(dev, "missing \"reg\"\n");
1383380f5708SKishon Vijay Abraham I 		return PTR_ERR(base);
138444d30d62SAlan Douglas 	}
138544d30d62SAlan Douglas 
1386380f5708SKishon Vijay Abraham I 	ret = cdns_regmap_init_blocks(sp, base, data->block_offset_shift,
1387380f5708SKishon Vijay Abraham I 				      data->reg_offset_shift);
1388380f5708SKishon Vijay Abraham I 	if (ret)
1389380f5708SKishon Vijay Abraham I 		return ret;
1390380f5708SKishon Vijay Abraham I 
1391380f5708SKishon Vijay Abraham I 	ret = cdns_regfield_init(sp);
1392380f5708SKishon Vijay Abraham I 	if (ret)
1393380f5708SKishon Vijay Abraham I 		return ret;
139444d30d62SAlan Douglas 
139544d30d62SAlan Douglas 	platform_set_drvdata(pdev, sp);
139644d30d62SAlan Douglas 
13977e016cbcSKishon Vijay Abraham I 	ret = cdns_sierra_phy_get_clocks(sp, dev);
13987e016cbcSKishon Vijay Abraham I 	if (ret)
13997e016cbcSKishon Vijay Abraham I 		return ret;
140044d30d62SAlan Douglas 
140128081b72SKishon Vijay Abraham I 	ret = cdns_sierra_clk_register(sp);
14021d5f40e0SKishon Vijay Abraham I 	if (ret)
14031d5f40e0SKishon Vijay Abraham I 		return ret;
140444d30d62SAlan Douglas 
14051436ec30SKishon Vijay Abraham I 	ret = cdns_sierra_phy_enable_clocks(sp);
140644d30d62SAlan Douglas 	if (ret)
140728081b72SKishon Vijay Abraham I 		goto unregister_clk;
140844d30d62SAlan Douglas 
1409*d88ca22dSAswath Govindraju 	regmap_field_read(sp->pma_cmn_ready, &sp->already_configured);
1410*d88ca22dSAswath Govindraju 
1411*d88ca22dSAswath Govindraju 	if (!sp->already_configured) {
1412*d88ca22dSAswath Govindraju 		ret = cdns_sierra_phy_clk(sp);
1413*d88ca22dSAswath Govindraju 		if (ret)
1414*d88ca22dSAswath Govindraju 			goto clk_disable;
1415*d88ca22dSAswath Govindraju 
1416*d88ca22dSAswath Govindraju 		ret = cdns_sierra_phy_get_resets(sp, dev);
1417*d88ca22dSAswath Govindraju 		if (ret)
1418*d88ca22dSAswath Govindraju 			goto clk_disable;
1419*d88ca22dSAswath Govindraju 
142044d30d62SAlan Douglas 		/* Enable APB */
142144d30d62SAlan Douglas 		reset_control_deassert(sp->apb_rst);
1422*d88ca22dSAswath Govindraju 	}
142344d30d62SAlan Douglas 
142444d30d62SAlan Douglas 	/* Check that PHY is present */
1425380f5708SKishon Vijay Abraham I 	regmap_field_read(sp->macro_id_type, &id_value);
1426380f5708SKishon Vijay Abraham I 	if  (sp->init_data->id_value != id_value) {
142744d30d62SAlan Douglas 		ret = -EINVAL;
1428*d88ca22dSAswath Govindraju 		goto ctrl_assert;
142944d30d62SAlan Douglas 	}
143044d30d62SAlan Douglas 
143144d30d62SAlan Douglas 	sp->autoconf = of_property_read_bool(dn, "cdns,autoconf");
143244d30d62SAlan Douglas 
143344d30d62SAlan Douglas 	for_each_available_child_of_node(dn, child) {
143444d30d62SAlan Douglas 		struct phy *gphy;
143544d30d62SAlan Douglas 
143603ada5a3SKishon Vijay Abraham I 		if (!(of_node_name_eq(child, "phy") ||
143703ada5a3SKishon Vijay Abraham I 		      of_node_name_eq(child, "link")))
143803ada5a3SKishon Vijay Abraham I 			continue;
143903ada5a3SKishon Vijay Abraham I 
144044d30d62SAlan Douglas 		sp->phys[node].lnk_rst =
1441b872936fSKishon Vijay Abraham I 			of_reset_control_array_get_exclusive(child);
144244d30d62SAlan Douglas 
144344d30d62SAlan Douglas 		if (IS_ERR(sp->phys[node].lnk_rst)) {
144444d30d62SAlan Douglas 			dev_err(dev, "failed to get reset %s\n",
144544d30d62SAlan Douglas 				child->full_name);
144644d30d62SAlan Douglas 			ret = PTR_ERR(sp->phys[node].lnk_rst);
144729afbd76SDan Carpenter 			of_node_put(child);
144829afbd76SDan Carpenter 			goto put_control;
144944d30d62SAlan Douglas 		}
145044d30d62SAlan Douglas 
145144d30d62SAlan Douglas 		if (!sp->autoconf) {
145244d30d62SAlan Douglas 			ret = cdns_sierra_get_optional(&sp->phys[node], child);
145344d30d62SAlan Douglas 			if (ret) {
145444d30d62SAlan Douglas 				dev_err(dev, "missing property in node %s\n",
145544d30d62SAlan Douglas 					child->name);
145629afbd76SDan Carpenter 				of_node_put(child);
145729afbd76SDan Carpenter 				reset_control_put(sp->phys[node].lnk_rst);
145829afbd76SDan Carpenter 				goto put_control;
145944d30d62SAlan Douglas 			}
146044d30d62SAlan Douglas 		}
146144d30d62SAlan Douglas 
1462a43f72aeSKishon Vijay Abraham I 		sp->num_lanes += sp->phys[node].num_lanes;
1463a43f72aeSKishon Vijay Abraham I 
1464*d88ca22dSAswath Govindraju 		if (!sp->already_configured)
146544d30d62SAlan Douglas 			gphy = devm_phy_create(dev, child, &ops);
1466*d88ca22dSAswath Govindraju 		else
1467*d88ca22dSAswath Govindraju 			gphy = devm_phy_create(dev, child, &noop_ops);
146844d30d62SAlan Douglas 		if (IS_ERR(gphy)) {
146944d30d62SAlan Douglas 			ret = PTR_ERR(gphy);
147029afbd76SDan Carpenter 			of_node_put(child);
147129afbd76SDan Carpenter 			reset_control_put(sp->phys[node].lnk_rst);
147229afbd76SDan Carpenter 			goto put_control;
147344d30d62SAlan Douglas 		}
147444d30d62SAlan Douglas 		sp->phys[node].phy = gphy;
147544d30d62SAlan Douglas 		phy_set_drvdata(gphy, &sp->phys[node]);
147644d30d62SAlan Douglas 
147744d30d62SAlan Douglas 		node++;
147844d30d62SAlan Douglas 	}
147944d30d62SAlan Douglas 	sp->nsubnodes = node;
148044d30d62SAlan Douglas 
1481a43f72aeSKishon Vijay Abraham I 	if (sp->num_lanes > SIERRA_MAX_LANES) {
14826411e386SWang Wensheng 		ret = -EINVAL;
1483a43f72aeSKishon Vijay Abraham I 		dev_err(dev, "Invalid lane configuration\n");
148429afbd76SDan Carpenter 		goto put_control;
1485a43f72aeSKishon Vijay Abraham I 	}
1486a43f72aeSKishon Vijay Abraham I 
148744d30d62SAlan Douglas 	/* If more than one subnode, configure the PHY as multilink */
1488*d88ca22dSAswath Govindraju 	if (!sp->already_configured && !sp->autoconf && sp->nsubnodes > 1) {
14896b81f05aSSwapnil Jakhade 		ret = cdns_sierra_phy_configure_multilink(sp);
14906b81f05aSSwapnil Jakhade 		if (ret)
149129afbd76SDan Carpenter 			goto put_control;
14926b81f05aSSwapnil Jakhade 	}
149344d30d62SAlan Douglas 
149444d30d62SAlan Douglas 	pm_runtime_enable(dev);
149544d30d62SAlan Douglas 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
149629afbd76SDan Carpenter 	if (IS_ERR(phy_provider)) {
149729afbd76SDan Carpenter 		ret = PTR_ERR(phy_provider);
149829afbd76SDan Carpenter 		goto put_control;
149929afbd76SDan Carpenter 	}
150044d30d62SAlan Douglas 
150129afbd76SDan Carpenter 	return 0;
150229afbd76SDan Carpenter 
150329afbd76SDan Carpenter put_control:
150429afbd76SDan Carpenter 	while (--node >= 0)
150529afbd76SDan Carpenter 		reset_control_put(sp->phys[node].lnk_rst);
1506*d88ca22dSAswath Govindraju ctrl_assert:
1507*d88ca22dSAswath Govindraju 	if (!sp->already_configured)
1508*d88ca22dSAswath Govindraju 		reset_control_assert(sp->apb_rst);
150944d30d62SAlan Douglas clk_disable:
15101436ec30SKishon Vijay Abraham I 	cdns_sierra_phy_disable_clocks(sp);
151128081b72SKishon Vijay Abraham I unregister_clk:
151228081b72SKishon Vijay Abraham I 	cdns_sierra_clk_unregister(sp);
151344d30d62SAlan Douglas 	return ret;
151444d30d62SAlan Douglas }
151544d30d62SAlan Douglas 
151644d30d62SAlan Douglas static int cdns_sierra_phy_remove(struct platform_device *pdev)
151744d30d62SAlan Douglas {
1518748e3456SKishon Vijay Abraham I 	struct cdns_sierra_phy *phy = platform_get_drvdata(pdev);
151944d30d62SAlan Douglas 	int i;
152044d30d62SAlan Douglas 
152144d30d62SAlan Douglas 	reset_control_assert(phy->phy_rst);
152244d30d62SAlan Douglas 	reset_control_assert(phy->apb_rst);
152344d30d62SAlan Douglas 	pm_runtime_disable(&pdev->dev);
152444d30d62SAlan Douglas 
15251436ec30SKishon Vijay Abraham I 	cdns_sierra_phy_disable_clocks(phy);
152644d30d62SAlan Douglas 	/*
152744d30d62SAlan Douglas 	 * The device level resets will be put automatically.
152844d30d62SAlan Douglas 	 * Need to put the subnode resets here though.
152944d30d62SAlan Douglas 	 */
153044d30d62SAlan Douglas 	for (i = 0; i < phy->nsubnodes; i++) {
153144d30d62SAlan Douglas 		reset_control_assert(phy->phys[i].lnk_rst);
153244d30d62SAlan Douglas 		reset_control_put(phy->phys[i].lnk_rst);
153344d30d62SAlan Douglas 	}
153429c2d02aSKishon Vijay Abraham I 
153528081b72SKishon Vijay Abraham I 	cdns_sierra_clk_unregister(phy);
153629c2d02aSKishon Vijay Abraham I 
153744d30d62SAlan Douglas 	return 0;
153844d30d62SAlan Douglas }
153944d30d62SAlan Douglas 
15408a1b82d7SSwapnil Jakhade /* QSGMII PHY PMA lane configuration */
15418a1b82d7SSwapnil Jakhade static struct cdns_reg_pairs qsgmii_phy_pma_ln_regs[] = {
15428a1b82d7SSwapnil Jakhade 	{0x9010, SIERRA_PHY_PMA_XCVR_CTRL}
15438a1b82d7SSwapnil Jakhade };
15448a1b82d7SSwapnil Jakhade 
15458a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals qsgmii_phy_pma_ln_vals = {
15468a1b82d7SSwapnil Jakhade 	.reg_pairs = qsgmii_phy_pma_ln_regs,
15478a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(qsgmii_phy_pma_ln_regs),
15488a1b82d7SSwapnil Jakhade };
15498a1b82d7SSwapnil Jakhade 
15508a1b82d7SSwapnil Jakhade /* QSGMII refclk 100MHz, 20b, opt1, No BW cal, no ssc, PLL LC1 */
15518a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_cmn_regs[] = {
15528a1b82d7SSwapnil Jakhade 	{0x2085, SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG},
15538a1b82d7SSwapnil Jakhade 	{0x0000, SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG},
15548a1b82d7SSwapnil Jakhade 	{0x0000, SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG}
15558a1b82d7SSwapnil Jakhade };
15568a1b82d7SSwapnil Jakhade 
15578a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_ln_regs[] = {
15588a1b82d7SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
15598a1b82d7SSwapnil Jakhade 	{0x0252, SIERRA_DET_STANDEC_E_PREG},
15608a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_IDLE_PREG},
15618a1b82d7SSwapnil Jakhade 	{0x0FFE, SIERRA_PSC_RX_A0_PREG},
15628a1b82d7SSwapnil Jakhade 	{0x0011, SIERRA_PLLCTRL_SUBRATE_PREG},
15638a1b82d7SSwapnil Jakhade 	{0x0001, SIERRA_PLLCTRL_GEN_A_PREG},
15648a1b82d7SSwapnil Jakhade 	{0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG},
15658a1b82d7SSwapnil Jakhade 	{0x0000, SIERRA_DRVCTRL_ATTEN_PREG},
15668a1b82d7SSwapnil Jakhade 	{0x0089, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
15678a1b82d7SSwapnil Jakhade 	{0x3C3C, SIERRA_CREQ_CCLKDET_MODE01_PREG},
15688a1b82d7SSwapnil Jakhade 	{0x3222, SIERRA_CREQ_FSMCLK_SEL_PREG},
15698a1b82d7SSwapnil Jakhade 	{0x0000, SIERRA_CREQ_EQ_CTRL_PREG},
15708a1b82d7SSwapnil Jakhade 	{0x8422, SIERRA_CTLELUT_CTRL_PREG},
15718a1b82d7SSwapnil Jakhade 	{0x4111, SIERRA_DFE_ECMP_RATESEL_PREG},
15728a1b82d7SSwapnil Jakhade 	{0x4111, SIERRA_DFE_SMP_RATESEL_PREG},
15738a1b82d7SSwapnil Jakhade 	{0x0002, SIERRA_DEQ_PHALIGN_CTRL},
15748a1b82d7SSwapnil Jakhade 	{0x9595, SIERRA_DEQ_VGATUNE_CTRL_PREG},
15758a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT0},
15768a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT1},
15778a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT2},
15788a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT3},
15798a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
15808a1b82d7SSwapnil Jakhade 	{0x0861, SIERRA_DEQ_ALUT0},
15818a1b82d7SSwapnil Jakhade 	{0x07E0, SIERRA_DEQ_ALUT1},
15828a1b82d7SSwapnil Jakhade 	{0x079E, SIERRA_DEQ_ALUT2},
15838a1b82d7SSwapnil Jakhade 	{0x071D, SIERRA_DEQ_ALUT3},
15848a1b82d7SSwapnil Jakhade 	{0x03F5, SIERRA_DEQ_DFETAP_CTRL_PREG},
15858a1b82d7SSwapnil Jakhade 	{0x0C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG},
15868a1b82d7SSwapnil Jakhade 	{0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
15878a1b82d7SSwapnil Jakhade 	{0x1C04, SIERRA_DEQ_TAU_CTRL2_PREG},
15888a1b82d7SSwapnil Jakhade 	{0x0033, SIERRA_DEQ_PICTRL_PREG},
15898a1b82d7SSwapnil Jakhade 	{0x0660, SIERRA_CPICAL_TMRVAL_MODE0_PREG},
15908a1b82d7SSwapnil Jakhade 	{0x00D5, SIERRA_CPI_OUTBUF_RATESEL_PREG},
15918a1b82d7SSwapnil Jakhade 	{0x0B6D, SIERRA_CPI_RESBIAS_BIN_PREG},
15928a1b82d7SSwapnil Jakhade 	{0x0102, SIERRA_RXBUFFER_CTLECTRL_PREG},
15938a1b82d7SSwapnil Jakhade 	{0x0002, SIERRA_RXBUFFER_RCDFECTRL_PREG}
15948a1b82d7SSwapnil Jakhade };
15958a1b82d7SSwapnil Jakhade 
15968a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_cmn_vals = {
15978a1b82d7SSwapnil Jakhade 	.reg_pairs = qsgmii_100_no_ssc_plllc1_cmn_regs,
15988a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_cmn_regs),
15998a1b82d7SSwapnil Jakhade };
16008a1b82d7SSwapnil Jakhade 
16018a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_ln_vals = {
16028a1b82d7SSwapnil Jakhade 	.reg_pairs = qsgmii_100_no_ssc_plllc1_ln_regs,
16038a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_ln_regs),
16048a1b82d7SSwapnil Jakhade };
16058a1b82d7SSwapnil Jakhade 
1606fa105172SSwapnil Jakhade /* PCIE PHY PCS common configuration */
1607fa105172SSwapnil Jakhade static struct cdns_reg_pairs pcie_phy_pcs_cmn_regs[] = {
1608fa105172SSwapnil Jakhade 	{0x0430, SIERRA_PHY_PIPE_CMN_CTRL1}
1609fa105172SSwapnil Jakhade };
1610fa105172SSwapnil Jakhade 
1611fa105172SSwapnil Jakhade static struct cdns_sierra_vals pcie_phy_pcs_cmn_vals = {
1612fa105172SSwapnil Jakhade 	.reg_pairs = pcie_phy_pcs_cmn_regs,
1613fa105172SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(pcie_phy_pcs_cmn_regs),
1614fa105172SSwapnil Jakhade };
1615fa105172SSwapnil Jakhade 
16168a1b82d7SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_no_ssc, pcie_links_using_plllc, pipe_bw_3 */
16178a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs pcie_100_no_ssc_plllc_cmn_regs[] = {
16188a1b82d7SSwapnil Jakhade 	{0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
16198a1b82d7SSwapnil Jakhade 	{0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
16208a1b82d7SSwapnil Jakhade 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
16218a1b82d7SSwapnil Jakhade 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}
16228a1b82d7SSwapnil Jakhade };
16238a1b82d7SSwapnil Jakhade 
16248a1b82d7SSwapnil Jakhade /*
16258a1b82d7SSwapnil Jakhade  * refclk100MHz_32b_PCIe_ln_no_ssc, multilink, using_plllc,
16268a1b82d7SSwapnil Jakhade  * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz
16278a1b82d7SSwapnil Jakhade  */
16288a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs ml_pcie_100_no_ssc_ln_regs[] = {
16298a1b82d7SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
16308a1b82d7SSwapnil Jakhade 	{0x001D, SIERRA_PSM_A3IN_TMR_PREG},
16318a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_A3_PREG},
16328a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_A4_PREG},
16338a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_IDLE_PREG},
16348a1b82d7SSwapnil Jakhade 	{0x1555, SIERRA_DFE_BIASTRIM_PREG},
16358a1b82d7SSwapnil Jakhade 	{0x9703, SIERRA_DRVCTRL_BOOST_PREG},
16368a1b82d7SSwapnil Jakhade 	{0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
16378a1b82d7SSwapnil Jakhade 	{0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
16388a1b82d7SSwapnil Jakhade 	{0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
16398a1b82d7SSwapnil Jakhade 	{0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
16408a1b82d7SSwapnil Jakhade 	{0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
16418a1b82d7SSwapnil Jakhade 	{0x9800, SIERRA_RX_CTLE_CAL_PREG},
16428a1b82d7SSwapnil Jakhade 	{0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
16438a1b82d7SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
16448a1b82d7SSwapnil Jakhade 	{0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
16458a1b82d7SSwapnil Jakhade 	{0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
16468a1b82d7SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
16478a1b82d7SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
16488a1b82d7SSwapnil Jakhade 	{0x0041, SIERRA_DEQ_GLUT0},
16498a1b82d7SSwapnil Jakhade 	{0x0082, SIERRA_DEQ_GLUT1},
16508a1b82d7SSwapnil Jakhade 	{0x00C3, SIERRA_DEQ_GLUT2},
16518a1b82d7SSwapnil Jakhade 	{0x0145, SIERRA_DEQ_GLUT3},
16528a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
16538a1b82d7SSwapnil Jakhade 	{0x09E7, SIERRA_DEQ_ALUT0},
16548a1b82d7SSwapnil Jakhade 	{0x09A6, SIERRA_DEQ_ALUT1},
16558a1b82d7SSwapnil Jakhade 	{0x0965, SIERRA_DEQ_ALUT2},
16568a1b82d7SSwapnil Jakhade 	{0x08E3, SIERRA_DEQ_ALUT3},
16578a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP0},
16588a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP1},
16598a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP2},
16608a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP3},
16618a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP4},
16628a1b82d7SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_PRECUR_PREG},
16638a1b82d7SSwapnil Jakhade 	{0x0280, SIERRA_DEQ_POSTCUR_PREG},
16648a1b82d7SSwapnil Jakhade 	{0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
16658a1b82d7SSwapnil Jakhade 	{0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
16668a1b82d7SSwapnil Jakhade 	{0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
16678a1b82d7SSwapnil Jakhade 	{0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
16688a1b82d7SSwapnil Jakhade 	{0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
16698a1b82d7SSwapnil Jakhade 	{0x002B, SIERRA_CPI_TRIM_PREG},
16708a1b82d7SSwapnil Jakhade 	{0x0003, SIERRA_EPI_CTRL_PREG},
16718a1b82d7SSwapnil Jakhade 	{0x803F, SIERRA_SDFILT_H2L_A_PREG},
16728a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
16738a1b82d7SSwapnil Jakhade 	{0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
16748a1b82d7SSwapnil Jakhade 	{0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
16758a1b82d7SSwapnil Jakhade };
16768a1b82d7SSwapnil Jakhade 
16778a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_no_ssc_plllc_cmn_vals = {
16788a1b82d7SSwapnil Jakhade 	.reg_pairs = pcie_100_no_ssc_plllc_cmn_regs,
16798a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(pcie_100_no_ssc_plllc_cmn_regs),
16808a1b82d7SSwapnil Jakhade };
16818a1b82d7SSwapnil Jakhade 
16828a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals ml_pcie_100_no_ssc_ln_vals = {
16838a1b82d7SSwapnil Jakhade 	.reg_pairs = ml_pcie_100_no_ssc_ln_regs,
16848a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(ml_pcie_100_no_ssc_ln_regs),
16858a1b82d7SSwapnil Jakhade };
16868a1b82d7SSwapnil Jakhade 
16878a1b82d7SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_int_ssc, pcie_links_using_plllc, pipe_bw_3 */
16888a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs pcie_100_int_ssc_plllc_cmn_regs[] = {
16898a1b82d7SSwapnil Jakhade 	{0x000E, SIERRA_CMN_PLLLC_MODE_PREG},
16908a1b82d7SSwapnil Jakhade 	{0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
16918a1b82d7SSwapnil Jakhade 	{0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
16928a1b82d7SSwapnil Jakhade 	{0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
16938a1b82d7SSwapnil Jakhade 	{0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
16948a1b82d7SSwapnil Jakhade 	{0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG},
16958a1b82d7SSwapnil Jakhade 	{0x7F80, SIERRA_CMN_PLLLC_SS_PREG},
16968a1b82d7SSwapnil Jakhade 	{0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG},
16978a1b82d7SSwapnil Jakhade 	{0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG},
16988a1b82d7SSwapnil Jakhade 	{0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG},
16998a1b82d7SSwapnil Jakhade 	{0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG}
17008a1b82d7SSwapnil Jakhade };
17018a1b82d7SSwapnil Jakhade 
17028a1b82d7SSwapnil Jakhade /*
17038a1b82d7SSwapnil Jakhade  * refclk100MHz_32b_PCIe_ln_int_ssc, multilink, using_plllc,
17048a1b82d7SSwapnil Jakhade  * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz
17058a1b82d7SSwapnil Jakhade  */
17068a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs ml_pcie_100_int_ssc_ln_regs[] = {
17078a1b82d7SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
17088a1b82d7SSwapnil Jakhade 	{0x001D, SIERRA_PSM_A3IN_TMR_PREG},
17098a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_A3_PREG},
17108a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_A4_PREG},
17118a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_IDLE_PREG},
17128a1b82d7SSwapnil Jakhade 	{0x1555, SIERRA_DFE_BIASTRIM_PREG},
17138a1b82d7SSwapnil Jakhade 	{0x9703, SIERRA_DRVCTRL_BOOST_PREG},
17148a1b82d7SSwapnil Jakhade 	{0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
17158a1b82d7SSwapnil Jakhade 	{0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
17168a1b82d7SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
17178a1b82d7SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
17188a1b82d7SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
17198a1b82d7SSwapnil Jakhade 	{0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
17208a1b82d7SSwapnil Jakhade 	{0x9800, SIERRA_RX_CTLE_CAL_PREG},
17218a1b82d7SSwapnil Jakhade 	{0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
17228a1b82d7SSwapnil Jakhade 	{0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
17238a1b82d7SSwapnil Jakhade 	{0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
17248a1b82d7SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
17258a1b82d7SSwapnil Jakhade 	{0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
17268a1b82d7SSwapnil Jakhade 	{0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
17278a1b82d7SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
17288a1b82d7SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
17298a1b82d7SSwapnil Jakhade 	{0x0041, SIERRA_DEQ_GLUT0},
17308a1b82d7SSwapnil Jakhade 	{0x0082, SIERRA_DEQ_GLUT1},
17318a1b82d7SSwapnil Jakhade 	{0x00C3, SIERRA_DEQ_GLUT2},
17328a1b82d7SSwapnil Jakhade 	{0x0145, SIERRA_DEQ_GLUT3},
17338a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
17348a1b82d7SSwapnil Jakhade 	{0x09E7, SIERRA_DEQ_ALUT0},
17358a1b82d7SSwapnil Jakhade 	{0x09A6, SIERRA_DEQ_ALUT1},
17368a1b82d7SSwapnil Jakhade 	{0x0965, SIERRA_DEQ_ALUT2},
17378a1b82d7SSwapnil Jakhade 	{0x08E3, SIERRA_DEQ_ALUT3},
17388a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP0},
17398a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP1},
17408a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP2},
17418a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP3},
17428a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP4},
17438a1b82d7SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_PRECUR_PREG},
17448a1b82d7SSwapnil Jakhade 	{0x0280, SIERRA_DEQ_POSTCUR_PREG},
17458a1b82d7SSwapnil Jakhade 	{0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
17468a1b82d7SSwapnil Jakhade 	{0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
17478a1b82d7SSwapnil Jakhade 	{0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
17488a1b82d7SSwapnil Jakhade 	{0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
17498a1b82d7SSwapnil Jakhade 	{0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
17508a1b82d7SSwapnil Jakhade 	{0x002B, SIERRA_CPI_TRIM_PREG},
17518a1b82d7SSwapnil Jakhade 	{0x0003, SIERRA_EPI_CTRL_PREG},
17528a1b82d7SSwapnil Jakhade 	{0x803F, SIERRA_SDFILT_H2L_A_PREG},
17538a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
17548a1b82d7SSwapnil Jakhade 	{0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
17558a1b82d7SSwapnil Jakhade 	{0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
17568a1b82d7SSwapnil Jakhade };
17578a1b82d7SSwapnil Jakhade 
17588a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_int_ssc_plllc_cmn_vals = {
17598a1b82d7SSwapnil Jakhade 	.reg_pairs = pcie_100_int_ssc_plllc_cmn_regs,
17608a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(pcie_100_int_ssc_plllc_cmn_regs),
17618a1b82d7SSwapnil Jakhade };
17628a1b82d7SSwapnil Jakhade 
17638a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals ml_pcie_100_int_ssc_ln_vals = {
17648a1b82d7SSwapnil Jakhade 	.reg_pairs = ml_pcie_100_int_ssc_ln_regs,
17658a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(ml_pcie_100_int_ssc_ln_regs),
17668a1b82d7SSwapnil Jakhade };
17678a1b82d7SSwapnil Jakhade 
17688a1b82d7SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc, pcie_links_using_plllc, pipe_bw_3 */
17698a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs pcie_100_ext_ssc_plllc_cmn_regs[] = {
17708a1b82d7SSwapnil Jakhade 	{0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
17718a1b82d7SSwapnil Jakhade 	{0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
17728a1b82d7SSwapnil Jakhade 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
17738a1b82d7SSwapnil Jakhade 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
17748a1b82d7SSwapnil Jakhade 	{0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}
17758a1b82d7SSwapnil Jakhade };
17768a1b82d7SSwapnil Jakhade 
17778a1b82d7SSwapnil Jakhade /*
17788a1b82d7SSwapnil Jakhade  * refclk100MHz_32b_PCIe_ln_ext_ssc, multilink, using_plllc,
17798a1b82d7SSwapnil Jakhade  * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz
17808a1b82d7SSwapnil Jakhade  */
17818a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs ml_pcie_100_ext_ssc_ln_regs[] = {
17828a1b82d7SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
17838a1b82d7SSwapnil Jakhade 	{0x001D, SIERRA_PSM_A3IN_TMR_PREG},
17848a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_A3_PREG},
17858a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_A4_PREG},
17868a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_PSC_LN_IDLE_PREG},
17878a1b82d7SSwapnil Jakhade 	{0x1555, SIERRA_DFE_BIASTRIM_PREG},
17888a1b82d7SSwapnil Jakhade 	{0x9703, SIERRA_DRVCTRL_BOOST_PREG},
17898a1b82d7SSwapnil Jakhade 	{0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
17908a1b82d7SSwapnil Jakhade 	{0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
17918a1b82d7SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
17928a1b82d7SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
17938a1b82d7SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
17948a1b82d7SSwapnil Jakhade 	{0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
17958a1b82d7SSwapnil Jakhade 	{0x9800, SIERRA_RX_CTLE_CAL_PREG},
17968a1b82d7SSwapnil Jakhade 	{0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
17978a1b82d7SSwapnil Jakhade 	{0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
17988a1b82d7SSwapnil Jakhade 	{0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
17998a1b82d7SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
18008a1b82d7SSwapnil Jakhade 	{0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
18018a1b82d7SSwapnil Jakhade 	{0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
18028a1b82d7SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
18038a1b82d7SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
18048a1b82d7SSwapnil Jakhade 	{0x0041, SIERRA_DEQ_GLUT0},
18058a1b82d7SSwapnil Jakhade 	{0x0082, SIERRA_DEQ_GLUT1},
18068a1b82d7SSwapnil Jakhade 	{0x00C3, SIERRA_DEQ_GLUT2},
18078a1b82d7SSwapnil Jakhade 	{0x0145, SIERRA_DEQ_GLUT3},
18088a1b82d7SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
18098a1b82d7SSwapnil Jakhade 	{0x09E7, SIERRA_DEQ_ALUT0},
18108a1b82d7SSwapnil Jakhade 	{0x09A6, SIERRA_DEQ_ALUT1},
18118a1b82d7SSwapnil Jakhade 	{0x0965, SIERRA_DEQ_ALUT2},
18128a1b82d7SSwapnil Jakhade 	{0x08E3, SIERRA_DEQ_ALUT3},
18138a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP0},
18148a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP1},
18158a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP2},
18168a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP3},
18178a1b82d7SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP4},
18188a1b82d7SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_PRECUR_PREG},
18198a1b82d7SSwapnil Jakhade 	{0x0280, SIERRA_DEQ_POSTCUR_PREG},
18208a1b82d7SSwapnil Jakhade 	{0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
18218a1b82d7SSwapnil Jakhade 	{0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
18228a1b82d7SSwapnil Jakhade 	{0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
18238a1b82d7SSwapnil Jakhade 	{0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
18248a1b82d7SSwapnil Jakhade 	{0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
18258a1b82d7SSwapnil Jakhade 	{0x002B, SIERRA_CPI_TRIM_PREG},
18268a1b82d7SSwapnil Jakhade 	{0x0003, SIERRA_EPI_CTRL_PREG},
18278a1b82d7SSwapnil Jakhade 	{0x803F, SIERRA_SDFILT_H2L_A_PREG},
18288a1b82d7SSwapnil Jakhade 	{0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
18298a1b82d7SSwapnil Jakhade 	{0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
18308a1b82d7SSwapnil Jakhade 	{0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
18318a1b82d7SSwapnil Jakhade };
18328a1b82d7SSwapnil Jakhade 
18338a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_ext_ssc_plllc_cmn_vals = {
18348a1b82d7SSwapnil Jakhade 	.reg_pairs = pcie_100_ext_ssc_plllc_cmn_regs,
18358a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(pcie_100_ext_ssc_plllc_cmn_regs),
18368a1b82d7SSwapnil Jakhade };
18378a1b82d7SSwapnil Jakhade 
18388a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals ml_pcie_100_ext_ssc_ln_vals = {
18398a1b82d7SSwapnil Jakhade 	.reg_pairs = ml_pcie_100_ext_ssc_ln_regs,
18408a1b82d7SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(ml_pcie_100_ext_ssc_ln_regs),
18418a1b82d7SSwapnil Jakhade };
18428a1b82d7SSwapnil Jakhade 
18437a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_no_ssc */
18447a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_cmn_regs_no_ssc[] = {
18457a5ad9b4SSwapnil Jakhade 	{0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
18467a5ad9b4SSwapnil Jakhade 	{0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
18477a5ad9b4SSwapnil Jakhade 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
18487a5ad9b4SSwapnil Jakhade 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}
18497a5ad9b4SSwapnil Jakhade };
18507a5ad9b4SSwapnil Jakhade 
18517a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_ln_no_ssc */
18527a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_ln_regs_no_ssc[] = {
18537a5ad9b4SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
18547a5ad9b4SSwapnil Jakhade 	{0x001D, SIERRA_PSM_A3IN_TMR_PREG},
18557a5ad9b4SSwapnil Jakhade 	{0x1555, SIERRA_DFE_BIASTRIM_PREG},
18567a5ad9b4SSwapnil Jakhade 	{0x9703, SIERRA_DRVCTRL_BOOST_PREG},
18577a5ad9b4SSwapnil Jakhade 	{0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
18587a5ad9b4SSwapnil Jakhade 	{0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
18597a5ad9b4SSwapnil Jakhade 	{0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
18607a5ad9b4SSwapnil Jakhade 	{0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
18617a5ad9b4SSwapnil Jakhade 	{0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
18627a5ad9b4SSwapnil Jakhade 	{0x9800, SIERRA_RX_CTLE_CAL_PREG},
18637a5ad9b4SSwapnil Jakhade 	{0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
18647a5ad9b4SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
18657a5ad9b4SSwapnil Jakhade 	{0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
18667a5ad9b4SSwapnil Jakhade 	{0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
18677a5ad9b4SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
18687a5ad9b4SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
18697a5ad9b4SSwapnil Jakhade 	{0x0041, SIERRA_DEQ_GLUT0},
18707a5ad9b4SSwapnil Jakhade 	{0x0082, SIERRA_DEQ_GLUT1},
18717a5ad9b4SSwapnil Jakhade 	{0x00C3, SIERRA_DEQ_GLUT2},
18727a5ad9b4SSwapnil Jakhade 	{0x0145, SIERRA_DEQ_GLUT3},
18737a5ad9b4SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
18747a5ad9b4SSwapnil Jakhade 	{0x09E7, SIERRA_DEQ_ALUT0},
18757a5ad9b4SSwapnil Jakhade 	{0x09A6, SIERRA_DEQ_ALUT1},
18767a5ad9b4SSwapnil Jakhade 	{0x0965, SIERRA_DEQ_ALUT2},
18777a5ad9b4SSwapnil Jakhade 	{0x08E3, SIERRA_DEQ_ALUT3},
18787a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP0},
18797a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP1},
18807a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP2},
18817a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP3},
18827a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP4},
18837a5ad9b4SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_PRECUR_PREG},
18847a5ad9b4SSwapnil Jakhade 	{0x0280, SIERRA_DEQ_POSTCUR_PREG},
18857a5ad9b4SSwapnil Jakhade 	{0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
18867a5ad9b4SSwapnil Jakhade 	{0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
18877a5ad9b4SSwapnil Jakhade 	{0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
18887a5ad9b4SSwapnil Jakhade 	{0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
18897a5ad9b4SSwapnil Jakhade 	{0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
18907a5ad9b4SSwapnil Jakhade 	{0x002B, SIERRA_CPI_TRIM_PREG},
18917a5ad9b4SSwapnil Jakhade 	{0x0003, SIERRA_EPI_CTRL_PREG},
18927a5ad9b4SSwapnil Jakhade 	{0x803F, SIERRA_SDFILT_H2L_A_PREG},
18937a5ad9b4SSwapnil Jakhade 	{0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
18947a5ad9b4SSwapnil Jakhade 	{0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
18957a5ad9b4SSwapnil Jakhade 	{0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
18967a5ad9b4SSwapnil Jakhade };
18977a5ad9b4SSwapnil Jakhade 
18987a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_no_ssc_cmn_vals = {
18997a5ad9b4SSwapnil Jakhade 	.reg_pairs = cdns_pcie_cmn_regs_no_ssc,
19007a5ad9b4SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_no_ssc),
19017a5ad9b4SSwapnil Jakhade };
19027a5ad9b4SSwapnil Jakhade 
19037a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_no_ssc_ln_vals = {
19047a5ad9b4SSwapnil Jakhade 	.reg_pairs = cdns_pcie_ln_regs_no_ssc,
19057a5ad9b4SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_no_ssc),
19067a5ad9b4SSwapnil Jakhade };
19077a5ad9b4SSwapnil Jakhade 
19087a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_int_ssc */
19097a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_cmn_regs_int_ssc[] = {
19107a5ad9b4SSwapnil Jakhade 	{0x000E, SIERRA_CMN_PLLLC_MODE_PREG},
19117a5ad9b4SSwapnil Jakhade 	{0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
19127a5ad9b4SSwapnil Jakhade 	{0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
19137a5ad9b4SSwapnil Jakhade 	{0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
19147a5ad9b4SSwapnil Jakhade 	{0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
19157a5ad9b4SSwapnil Jakhade 	{0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG},
19167a5ad9b4SSwapnil Jakhade 	{0x7F80, SIERRA_CMN_PLLLC_SS_PREG},
19177a5ad9b4SSwapnil Jakhade 	{0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG},
19187a5ad9b4SSwapnil Jakhade 	{0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG},
19197a5ad9b4SSwapnil Jakhade 	{0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG},
19207a5ad9b4SSwapnil Jakhade 	{0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG}
19217a5ad9b4SSwapnil Jakhade };
19227a5ad9b4SSwapnil Jakhade 
19237a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_ln_int_ssc */
19247a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_ln_regs_int_ssc[] = {
19257a5ad9b4SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
19267a5ad9b4SSwapnil Jakhade 	{0x001D, SIERRA_PSM_A3IN_TMR_PREG},
19277a5ad9b4SSwapnil Jakhade 	{0x1555, SIERRA_DFE_BIASTRIM_PREG},
19287a5ad9b4SSwapnil Jakhade 	{0x9703, SIERRA_DRVCTRL_BOOST_PREG},
19297a5ad9b4SSwapnil Jakhade 	{0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
19307a5ad9b4SSwapnil Jakhade 	{0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
19317a5ad9b4SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
19327a5ad9b4SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
19337a5ad9b4SSwapnil Jakhade 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
19347a5ad9b4SSwapnil Jakhade 	{0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
19357a5ad9b4SSwapnil Jakhade 	{0x9800, SIERRA_RX_CTLE_CAL_PREG},
19367a5ad9b4SSwapnil Jakhade 	{0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
19377a5ad9b4SSwapnil Jakhade 	{0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
19387a5ad9b4SSwapnil Jakhade 	{0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
19397a5ad9b4SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
19407a5ad9b4SSwapnil Jakhade 	{0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
19417a5ad9b4SSwapnil Jakhade 	{0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
19427a5ad9b4SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
19437a5ad9b4SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
19447a5ad9b4SSwapnil Jakhade 	{0x0041, SIERRA_DEQ_GLUT0},
19457a5ad9b4SSwapnil Jakhade 	{0x0082, SIERRA_DEQ_GLUT1},
19467a5ad9b4SSwapnil Jakhade 	{0x00C3, SIERRA_DEQ_GLUT2},
19477a5ad9b4SSwapnil Jakhade 	{0x0145, SIERRA_DEQ_GLUT3},
19487a5ad9b4SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
19497a5ad9b4SSwapnil Jakhade 	{0x09E7, SIERRA_DEQ_ALUT0},
19507a5ad9b4SSwapnil Jakhade 	{0x09A6, SIERRA_DEQ_ALUT1},
19517a5ad9b4SSwapnil Jakhade 	{0x0965, SIERRA_DEQ_ALUT2},
19527a5ad9b4SSwapnil Jakhade 	{0x08E3, SIERRA_DEQ_ALUT3},
19537a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP0},
19547a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP1},
19557a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP2},
19567a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP3},
19577a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP4},
19587a5ad9b4SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_PRECUR_PREG},
19597a5ad9b4SSwapnil Jakhade 	{0x0280, SIERRA_DEQ_POSTCUR_PREG},
19607a5ad9b4SSwapnil Jakhade 	{0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
19617a5ad9b4SSwapnil Jakhade 	{0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
19627a5ad9b4SSwapnil Jakhade 	{0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
19637a5ad9b4SSwapnil Jakhade 	{0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
19647a5ad9b4SSwapnil Jakhade 	{0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
19657a5ad9b4SSwapnil Jakhade 	{0x002B, SIERRA_CPI_TRIM_PREG},
19667a5ad9b4SSwapnil Jakhade 	{0x0003, SIERRA_EPI_CTRL_PREG},
19677a5ad9b4SSwapnil Jakhade 	{0x803F, SIERRA_SDFILT_H2L_A_PREG},
19687a5ad9b4SSwapnil Jakhade 	{0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
19697a5ad9b4SSwapnil Jakhade 	{0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
19707a5ad9b4SSwapnil Jakhade 	{0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
19717a5ad9b4SSwapnil Jakhade };
19727a5ad9b4SSwapnil Jakhade 
19737a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_int_ssc_cmn_vals = {
19747a5ad9b4SSwapnil Jakhade 	.reg_pairs = cdns_pcie_cmn_regs_int_ssc,
19757a5ad9b4SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_int_ssc),
19767a5ad9b4SSwapnil Jakhade };
19777a5ad9b4SSwapnil Jakhade 
19787a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_int_ssc_ln_vals = {
19797a5ad9b4SSwapnil Jakhade 	.reg_pairs = cdns_pcie_ln_regs_int_ssc,
19807a5ad9b4SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_int_ssc),
19817a5ad9b4SSwapnil Jakhade };
19827a5ad9b4SSwapnil Jakhade 
1983871002d7SAnil Varughese /* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc */
19843cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_pcie_cmn_regs_ext_ssc[] = {
1985871002d7SAnil Varughese 	{0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1986871002d7SAnil Varughese 	{0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1987871002d7SAnil Varughese 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1988871002d7SAnil Varughese 	{0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
1989871002d7SAnil Varughese 	{0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}
1990871002d7SAnil Varughese };
1991871002d7SAnil Varughese 
1992871002d7SAnil Varughese /* refclk100MHz_32b_PCIe_ln_ext_ssc */
19933cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_pcie_ln_regs_ext_ssc[] = {
19947a5ad9b4SSwapnil Jakhade 	{0xFC08, SIERRA_DET_STANDEC_A_PREG},
19957a5ad9b4SSwapnil Jakhade 	{0x001D, SIERRA_PSM_A3IN_TMR_PREG},
19967a5ad9b4SSwapnil Jakhade 	{0x1555, SIERRA_DFE_BIASTRIM_PREG},
19977a5ad9b4SSwapnil Jakhade 	{0x9703, SIERRA_DRVCTRL_BOOST_PREG},
1998871002d7SAnil Varughese 	{0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
1999871002d7SAnil Varughese 	{0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
2000871002d7SAnil Varughese 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
2001871002d7SAnil Varughese 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
2002871002d7SAnil Varughese 	{0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
20037a5ad9b4SSwapnil Jakhade 	{0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
20047a5ad9b4SSwapnil Jakhade 	{0x9800, SIERRA_RX_CTLE_CAL_PREG},
2005871002d7SAnil Varughese 	{0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
20067a5ad9b4SSwapnil Jakhade 	{0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
20077a5ad9b4SSwapnil Jakhade 	{0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
20087a5ad9b4SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
20097a5ad9b4SSwapnil Jakhade 	{0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
20107a5ad9b4SSwapnil Jakhade 	{0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
20117a5ad9b4SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
20127a5ad9b4SSwapnil Jakhade 	{0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
20137a5ad9b4SSwapnil Jakhade 	{0x0041, SIERRA_DEQ_GLUT0},
20147a5ad9b4SSwapnil Jakhade 	{0x0082, SIERRA_DEQ_GLUT1},
20157a5ad9b4SSwapnil Jakhade 	{0x00C3, SIERRA_DEQ_GLUT2},
20167a5ad9b4SSwapnil Jakhade 	{0x0145, SIERRA_DEQ_GLUT3},
20177a5ad9b4SSwapnil Jakhade 	{0x0186, SIERRA_DEQ_GLUT4},
20187a5ad9b4SSwapnil Jakhade 	{0x09E7, SIERRA_DEQ_ALUT0},
20197a5ad9b4SSwapnil Jakhade 	{0x09A6, SIERRA_DEQ_ALUT1},
20207a5ad9b4SSwapnil Jakhade 	{0x0965, SIERRA_DEQ_ALUT2},
20217a5ad9b4SSwapnil Jakhade 	{0x08E3, SIERRA_DEQ_ALUT3},
20227a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP0},
20237a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP1},
20247a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP2},
20257a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP3},
20267a5ad9b4SSwapnil Jakhade 	{0x00FA, SIERRA_DEQ_DFETAP4},
20277a5ad9b4SSwapnil Jakhade 	{0x000F, SIERRA_DEQ_PRECUR_PREG},
20287a5ad9b4SSwapnil Jakhade 	{0x0280, SIERRA_DEQ_POSTCUR_PREG},
20297a5ad9b4SSwapnil Jakhade 	{0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
20307a5ad9b4SSwapnil Jakhade 	{0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
20317a5ad9b4SSwapnil Jakhade 	{0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
20327a5ad9b4SSwapnil Jakhade 	{0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
20337a5ad9b4SSwapnil Jakhade 	{0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
20347a5ad9b4SSwapnil Jakhade 	{0x002B, SIERRA_CPI_TRIM_PREG},
20357a5ad9b4SSwapnil Jakhade 	{0x0003, SIERRA_EPI_CTRL_PREG},
20367a5ad9b4SSwapnil Jakhade 	{0x803F, SIERRA_SDFILT_H2L_A_PREG},
20377a5ad9b4SSwapnil Jakhade 	{0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
20387a5ad9b4SSwapnil Jakhade 	{0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
20397a5ad9b4SSwapnil Jakhade 	{0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
2040871002d7SAnil Varughese };
2041871002d7SAnil Varughese 
2042078e9e92SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_ext_ssc_cmn_vals = {
2043078e9e92SSwapnil Jakhade 	.reg_pairs = cdns_pcie_cmn_regs_ext_ssc,
2044078e9e92SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_ext_ssc),
2045078e9e92SSwapnil Jakhade };
2046078e9e92SSwapnil Jakhade 
2047078e9e92SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_ext_ssc_ln_vals = {
2048078e9e92SSwapnil Jakhade 	.reg_pairs = cdns_pcie_ln_regs_ext_ssc,
2049078e9e92SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_ext_ssc),
2050078e9e92SSwapnil Jakhade };
2051078e9e92SSwapnil Jakhade 
2052871002d7SAnil Varughese /* refclk100MHz_20b_USB_cmn_pll_ext_ssc */
20533cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = {
2054871002d7SAnil Varughese 	{0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
2055871002d7SAnil Varughese 	{0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
2056871002d7SAnil Varughese 	{0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
2057871002d7SAnil Varughese 	{0x0000, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}
2058871002d7SAnil Varughese };
2059871002d7SAnil Varughese 
2060871002d7SAnil Varughese /* refclk100MHz_20b_USB_ln_ext_ssc */
20613cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = {
2062aead5fd6SKishon Vijay Abraham I 	{0xFE0A, SIERRA_DET_STANDEC_A_PREG},
2063aead5fd6SKishon Vijay Abraham I 	{0x000F, SIERRA_DET_STANDEC_B_PREG},
20642bcf14caSSanket Parmar 	{0x55A5, SIERRA_DET_STANDEC_C_PREG},
2065871002d7SAnil Varughese 	{0x69ad, SIERRA_DET_STANDEC_D_PREG},
2066aead5fd6SKishon Vijay Abraham I 	{0x0241, SIERRA_DET_STANDEC_E_PREG},
20672bcf14caSSanket Parmar 	{0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG},
2068871002d7SAnil Varughese 	{0x0014, SIERRA_PSM_A0IN_TMR_PREG},
2069aead5fd6SKishon Vijay Abraham I 	{0xCF00, SIERRA_PSM_DIAG_PREG},
2070aead5fd6SKishon Vijay Abraham I 	{0x001F, SIERRA_PSC_TX_A0_PREG},
2071aead5fd6SKishon Vijay Abraham I 	{0x0007, SIERRA_PSC_TX_A1_PREG},
2072aead5fd6SKishon Vijay Abraham I 	{0x0003, SIERRA_PSC_TX_A2_PREG},
2073aead5fd6SKishon Vijay Abraham I 	{0x0003, SIERRA_PSC_TX_A3_PREG},
2074aead5fd6SKishon Vijay Abraham I 	{0x0FFF, SIERRA_PSC_RX_A0_PREG},
20752bcf14caSSanket Parmar 	{0x0003, SIERRA_PSC_RX_A1_PREG},
2076aead5fd6SKishon Vijay Abraham I 	{0x0003, SIERRA_PSC_RX_A2_PREG},
2077aead5fd6SKishon Vijay Abraham I 	{0x0001, SIERRA_PSC_RX_A3_PREG},
2078aead5fd6SKishon Vijay Abraham I 	{0x0001, SIERRA_PLLCTRL_SUBRATE_PREG},
2079aead5fd6SKishon Vijay Abraham I 	{0x0406, SIERRA_PLLCTRL_GEN_D_PREG},
2080871002d7SAnil Varughese 	{0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG},
2081871002d7SAnil Varughese 	{0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG},
2082871002d7SAnil Varughese 	{0x2512, SIERRA_DFE_BIASTRIM_PREG},
2083aead5fd6SKishon Vijay Abraham I 	{0x0000, SIERRA_DRVCTRL_ATTEN_PREG},
20842bcf14caSSanket Parmar 	{0x823E, SIERRA_CLKPATHCTRL_TMR_PREG},
20852bcf14caSSanket Parmar 	{0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
20862bcf14caSSanket Parmar 	{0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
2087aead5fd6SKishon Vijay Abraham I 	{0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG},
20882bcf14caSSanket Parmar 	{0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
2089aead5fd6SKishon Vijay Abraham I 	{0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG},
2090871002d7SAnil Varughese 	{0x0000, SIERRA_CREQ_EQ_CTRL_PREG},
20912bcf14caSSanket Parmar 	{0x0000, SIERRA_CREQ_SPARE_PREG},
2092871002d7SAnil Varughese 	{0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
20932bcf14caSSanket Parmar 	{0x8452, SIERRA_CTLELUT_CTRL_PREG},
20942bcf14caSSanket Parmar 	{0x4121, SIERRA_DFE_ECMP_RATESEL_PREG},
20952bcf14caSSanket Parmar 	{0x4121, SIERRA_DFE_SMP_RATESEL_PREG},
20962bcf14caSSanket Parmar 	{0x0003, SIERRA_DEQ_PHALIGN_CTRL},
2097871002d7SAnil Varughese 	{0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG},
2098871002d7SAnil Varughese 	{0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG},
2099871002d7SAnil Varughese 	{0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
2100871002d7SAnil Varughese 	{0x0048, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
2101871002d7SAnil Varughese 	{0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG},
2102871002d7SAnil Varughese 	{0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG},
2103871002d7SAnil Varughese 	{0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG},
21042bcf14caSSanket Parmar 	{0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG},
2105871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT0},
2106871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT1},
2107871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT2},
2108871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT3},
2109871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT4},
2110871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT5},
2111871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT6},
2112871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT7},
2113871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT8},
2114871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT9},
2115871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT10},
2116871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT11},
2117871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT12},
2118871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT13},
2119871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT14},
2120871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT15},
2121871002d7SAnil Varughese 	{0x0014, SIERRA_DEQ_GLUT16},
2122871002d7SAnil Varughese 	{0x0BAE, SIERRA_DEQ_ALUT0},
2123871002d7SAnil Varughese 	{0x0AEB, SIERRA_DEQ_ALUT1},
2124871002d7SAnil Varughese 	{0x0A28, SIERRA_DEQ_ALUT2},
2125871002d7SAnil Varughese 	{0x0965, SIERRA_DEQ_ALUT3},
2126871002d7SAnil Varughese 	{0x08A2, SIERRA_DEQ_ALUT4},
2127871002d7SAnil Varughese 	{0x07DF, SIERRA_DEQ_ALUT5},
2128871002d7SAnil Varughese 	{0x071C, SIERRA_DEQ_ALUT6},
2129871002d7SAnil Varughese 	{0x0659, SIERRA_DEQ_ALUT7},
2130871002d7SAnil Varughese 	{0x0596, SIERRA_DEQ_ALUT8},
2131871002d7SAnil Varughese 	{0x0514, SIERRA_DEQ_ALUT9},
2132871002d7SAnil Varughese 	{0x0492, SIERRA_DEQ_ALUT10},
2133871002d7SAnil Varughese 	{0x0410, SIERRA_DEQ_ALUT11},
2134871002d7SAnil Varughese 	{0x038E, SIERRA_DEQ_ALUT12},
2135871002d7SAnil Varughese 	{0x030C, SIERRA_DEQ_ALUT13},
2136871002d7SAnil Varughese 	{0x03F4, SIERRA_DEQ_DFETAP_CTRL_PREG},
2137871002d7SAnil Varughese 	{0x0001, SIERRA_DFE_EN_1010_IGNORE_PREG},
2138871002d7SAnil Varughese 	{0x3C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG},
2139871002d7SAnil Varughese 	{0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
2140871002d7SAnil Varughese 	{0x1C08, SIERRA_DEQ_TAU_CTRL2_PREG},
2141871002d7SAnil Varughese 	{0x0033, SIERRA_DEQ_PICTRL_PREG},
2142871002d7SAnil Varughese 	{0x0400, SIERRA_CPICAL_TMRVAL_MODE1_PREG},
2143871002d7SAnil Varughese 	{0x0330, SIERRA_CPICAL_TMRVAL_MODE0_PREG},
2144871002d7SAnil Varughese 	{0x01FF, SIERRA_CPICAL_PICNT_MODE1_PREG},
2145aead5fd6SKishon Vijay Abraham I 	{0x0009, SIERRA_CPI_OUTBUF_RATESEL_PREG},
2146871002d7SAnil Varughese 	{0x3232, SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG},
2147871002d7SAnil Varughese 	{0x0005, SIERRA_LFPSDET_SUPPORT_PREG},
2148aead5fd6SKishon Vijay Abraham I 	{0x000F, SIERRA_LFPSFILT_NS_PREG},
2149aead5fd6SKishon Vijay Abraham I 	{0x0009, SIERRA_LFPSFILT_RD_PREG},
2150aead5fd6SKishon Vijay Abraham I 	{0x0001, SIERRA_LFPSFILT_MP_PREG},
21512bcf14caSSanket Parmar 	{0x6013, SIERRA_SIGDET_SUPPORT_PREG},
2152aead5fd6SKishon Vijay Abraham I 	{0x8013, SIERRA_SDFILT_H2L_A_PREG},
2153871002d7SAnil Varughese 	{0x8009, SIERRA_SDFILT_L2H_PREG},
2154871002d7SAnil Varughese 	{0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG},
2155871002d7SAnil Varughese 	{0x0020, SIERRA_RXBUFFER_RCDFECTRL_PREG},
2156871002d7SAnil Varughese 	{0x4243, SIERRA_RXBUFFER_DFECTRL_PREG}
215744d30d62SAlan Douglas };
215844d30d62SAlan Douglas 
2159078e9e92SSwapnil Jakhade static struct cdns_sierra_vals usb_100_ext_ssc_cmn_vals = {
2160078e9e92SSwapnil Jakhade 	.reg_pairs = cdns_usb_cmn_regs_ext_ssc,
2161078e9e92SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_usb_cmn_regs_ext_ssc),
2162078e9e92SSwapnil Jakhade };
2163078e9e92SSwapnil Jakhade 
2164078e9e92SSwapnil Jakhade static struct cdns_sierra_vals usb_100_ext_ssc_ln_vals = {
2165078e9e92SSwapnil Jakhade 	.reg_pairs = cdns_usb_ln_regs_ext_ssc,
2166078e9e92SSwapnil Jakhade 	.num_regs = ARRAY_SIZE(cdns_usb_ln_regs_ext_ssc),
2167078e9e92SSwapnil Jakhade };
2168078e9e92SSwapnil Jakhade 
216944d30d62SAlan Douglas static const struct cdns_sierra_data cdns_map_sierra = {
2170078e9e92SSwapnil Jakhade 	.id_value = SIERRA_MACRO_ID,
2171078e9e92SSwapnil Jakhade 	.block_offset_shift = 0x2,
2172078e9e92SSwapnil Jakhade 	.reg_offset_shift = 0x2,
2173fa105172SSwapnil Jakhade 	.pcs_cmn_vals = {
2174fa105172SSwapnil Jakhade 		[TYPE_PCIE] = {
2175fa105172SSwapnil Jakhade 			[TYPE_NONE] = {
21767a5ad9b4SSwapnil Jakhade 				[NO_SSC] = &pcie_phy_pcs_cmn_vals,
2177fa105172SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
21787a5ad9b4SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
2179fa105172SSwapnil Jakhade 			},
21808a1b82d7SSwapnil Jakhade 			[TYPE_QSGMII] = {
21818a1b82d7SSwapnil Jakhade 				[NO_SSC] = &pcie_phy_pcs_cmn_vals,
21828a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
21838a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
21848a1b82d7SSwapnil Jakhade 			},
2185fa105172SSwapnil Jakhade 		},
2186fa105172SSwapnil Jakhade 	},
2187078e9e92SSwapnil Jakhade 	.pma_cmn_vals = {
2188078e9e92SSwapnil Jakhade 		[TYPE_PCIE] = {
2189078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
21907a5ad9b4SSwapnil Jakhade 				[NO_SSC] = &pcie_100_no_ssc_cmn_vals,
2191078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals,
21927a5ad9b4SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals,
2193078e9e92SSwapnil Jakhade 			},
21948a1b82d7SSwapnil Jakhade 			[TYPE_QSGMII] = {
21958a1b82d7SSwapnil Jakhade 				[NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals,
21968a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals,
21978a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals,
21988a1b82d7SSwapnil Jakhade 			},
2199078e9e92SSwapnil Jakhade 		},
2200078e9e92SSwapnil Jakhade 		[TYPE_USB] = {
2201078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
2202078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals,
2203078e9e92SSwapnil Jakhade 			},
2204078e9e92SSwapnil Jakhade 		},
22058a1b82d7SSwapnil Jakhade 		[TYPE_QSGMII] = {
22068a1b82d7SSwapnil Jakhade 			[TYPE_PCIE] = {
22078a1b82d7SSwapnil Jakhade 				[NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
22088a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
22098a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
22108a1b82d7SSwapnil Jakhade 			},
22118a1b82d7SSwapnil Jakhade 		},
2212078e9e92SSwapnil Jakhade 	},
2213078e9e92SSwapnil Jakhade 	.pma_ln_vals = {
2214078e9e92SSwapnil Jakhade 		[TYPE_PCIE] = {
2215078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
22167a5ad9b4SSwapnil Jakhade 				[NO_SSC] = &pcie_100_no_ssc_ln_vals,
2217078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals,
22187a5ad9b4SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals,
2219078e9e92SSwapnil Jakhade 			},
22208a1b82d7SSwapnil Jakhade 			[TYPE_QSGMII] = {
22218a1b82d7SSwapnil Jakhade 				[NO_SSC] = &ml_pcie_100_no_ssc_ln_vals,
22228a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals,
22238a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals,
22248a1b82d7SSwapnil Jakhade 			},
2225078e9e92SSwapnil Jakhade 		},
2226078e9e92SSwapnil Jakhade 		[TYPE_USB] = {
2227078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
2228078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals,
2229078e9e92SSwapnil Jakhade 			},
2230078e9e92SSwapnil Jakhade 		},
22318a1b82d7SSwapnil Jakhade 		[TYPE_QSGMII] = {
22328a1b82d7SSwapnil Jakhade 			[TYPE_PCIE] = {
22338a1b82d7SSwapnil Jakhade 				[NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
22348a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
22358a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
22368a1b82d7SSwapnil Jakhade 			},
22378a1b82d7SSwapnil Jakhade 		},
2238078e9e92SSwapnil Jakhade 	},
223944d30d62SAlan Douglas };
224044d30d62SAlan Douglas 
2241367da978SKishon Vijay Abraham I static const struct cdns_sierra_data cdns_ti_map_sierra = {
2242078e9e92SSwapnil Jakhade 	.id_value = SIERRA_MACRO_ID,
2243078e9e92SSwapnil Jakhade 	.block_offset_shift = 0x0,
2244078e9e92SSwapnil Jakhade 	.reg_offset_shift = 0x1,
2245fa105172SSwapnil Jakhade 	.pcs_cmn_vals = {
2246fa105172SSwapnil Jakhade 		[TYPE_PCIE] = {
2247fa105172SSwapnil Jakhade 			[TYPE_NONE] = {
22487a5ad9b4SSwapnil Jakhade 				[NO_SSC] = &pcie_phy_pcs_cmn_vals,
2249fa105172SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
22507a5ad9b4SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
2251fa105172SSwapnil Jakhade 			},
22528a1b82d7SSwapnil Jakhade 			[TYPE_QSGMII] = {
22538a1b82d7SSwapnil Jakhade 				[NO_SSC] = &pcie_phy_pcs_cmn_vals,
22548a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
22558a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
22568a1b82d7SSwapnil Jakhade 			},
22578a1b82d7SSwapnil Jakhade 		},
22588a1b82d7SSwapnil Jakhade 	},
22598a1b82d7SSwapnil Jakhade 	.phy_pma_ln_vals = {
22608a1b82d7SSwapnil Jakhade 		[TYPE_QSGMII] = {
22618a1b82d7SSwapnil Jakhade 			[TYPE_PCIE] = {
22628a1b82d7SSwapnil Jakhade 				[NO_SSC] = &qsgmii_phy_pma_ln_vals,
22638a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &qsgmii_phy_pma_ln_vals,
22648a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &qsgmii_phy_pma_ln_vals,
22658a1b82d7SSwapnil Jakhade 			},
2266fa105172SSwapnil Jakhade 		},
2267fa105172SSwapnil Jakhade 	},
2268078e9e92SSwapnil Jakhade 	.pma_cmn_vals = {
2269078e9e92SSwapnil Jakhade 		[TYPE_PCIE] = {
2270078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
22717a5ad9b4SSwapnil Jakhade 				[NO_SSC] = &pcie_100_no_ssc_cmn_vals,
2272078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals,
22737a5ad9b4SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals,
2274078e9e92SSwapnil Jakhade 			},
22758a1b82d7SSwapnil Jakhade 			[TYPE_QSGMII] = {
22768a1b82d7SSwapnil Jakhade 				[NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals,
22778a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals,
22788a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals,
22798a1b82d7SSwapnil Jakhade 			},
2280078e9e92SSwapnil Jakhade 		},
2281078e9e92SSwapnil Jakhade 		[TYPE_USB] = {
2282078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
2283078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals,
2284078e9e92SSwapnil Jakhade 			},
2285078e9e92SSwapnil Jakhade 		},
22868a1b82d7SSwapnil Jakhade 		[TYPE_QSGMII] = {
22878a1b82d7SSwapnil Jakhade 			[TYPE_PCIE] = {
22888a1b82d7SSwapnil Jakhade 				[NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
22898a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
22908a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
22918a1b82d7SSwapnil Jakhade 			},
22928a1b82d7SSwapnil Jakhade 		},
2293078e9e92SSwapnil Jakhade 	},
2294078e9e92SSwapnil Jakhade 	.pma_ln_vals = {
2295078e9e92SSwapnil Jakhade 		[TYPE_PCIE] = {
2296078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
22977a5ad9b4SSwapnil Jakhade 				[NO_SSC] = &pcie_100_no_ssc_ln_vals,
2298078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals,
22997a5ad9b4SSwapnil Jakhade 				[INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals,
2300078e9e92SSwapnil Jakhade 			},
23018a1b82d7SSwapnil Jakhade 			[TYPE_QSGMII] = {
23028a1b82d7SSwapnil Jakhade 				[NO_SSC] = &ml_pcie_100_no_ssc_ln_vals,
23038a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals,
23048a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals,
23058a1b82d7SSwapnil Jakhade 			},
2306078e9e92SSwapnil Jakhade 		},
2307078e9e92SSwapnil Jakhade 		[TYPE_USB] = {
2308078e9e92SSwapnil Jakhade 			[TYPE_NONE] = {
2309078e9e92SSwapnil Jakhade 				[EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals,
2310078e9e92SSwapnil Jakhade 			},
2311078e9e92SSwapnil Jakhade 		},
23128a1b82d7SSwapnil Jakhade 		[TYPE_QSGMII] = {
23138a1b82d7SSwapnil Jakhade 			[TYPE_PCIE] = {
23148a1b82d7SSwapnil Jakhade 				[NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
23158a1b82d7SSwapnil Jakhade 				[EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
23168a1b82d7SSwapnil Jakhade 				[INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
23178a1b82d7SSwapnil Jakhade 			},
23188a1b82d7SSwapnil Jakhade 		},
2319078e9e92SSwapnil Jakhade 	},
2320367da978SKishon Vijay Abraham I };
2321367da978SKishon Vijay Abraham I 
232244d30d62SAlan Douglas static const struct of_device_id cdns_sierra_id_table[] = {
232344d30d62SAlan Douglas 	{
232444d30d62SAlan Douglas 		.compatible = "cdns,sierra-phy-t0",
232544d30d62SAlan Douglas 		.data = &cdns_map_sierra,
232644d30d62SAlan Douglas 	},
2327367da978SKishon Vijay Abraham I 	{
2328367da978SKishon Vijay Abraham I 		.compatible = "ti,sierra-phy-t0",
2329367da978SKishon Vijay Abraham I 		.data = &cdns_ti_map_sierra,
2330367da978SKishon Vijay Abraham I 	},
233144d30d62SAlan Douglas 	{}
233244d30d62SAlan Douglas };
233344d30d62SAlan Douglas MODULE_DEVICE_TABLE(of, cdns_sierra_id_table);
233444d30d62SAlan Douglas 
233544d30d62SAlan Douglas static struct platform_driver cdns_sierra_driver = {
233644d30d62SAlan Douglas 	.probe		= cdns_sierra_phy_probe,
233744d30d62SAlan Douglas 	.remove		= cdns_sierra_phy_remove,
233844d30d62SAlan Douglas 	.driver		= {
233944d30d62SAlan Douglas 		.name	= "cdns-sierra-phy",
234044d30d62SAlan Douglas 		.of_match_table = cdns_sierra_id_table,
234144d30d62SAlan Douglas 	},
234244d30d62SAlan Douglas };
234344d30d62SAlan Douglas module_platform_driver(cdns_sierra_driver);
234444d30d62SAlan Douglas 
234544d30d62SAlan Douglas MODULE_ALIAS("platform:cdns_sierra");
234644d30d62SAlan Douglas MODULE_AUTHOR("Cadence Design Systems");
234744d30d62SAlan Douglas MODULE_DESCRIPTION("CDNS sierra phy driver");
234844d30d62SAlan Douglas MODULE_LICENSE("GPL v2");
2349