blob: e2b0530ca04ce91bd2cfce511f0368575eaad126 [file] [log] [blame]
Alan Douglas44d30d62018-11-12 16:42:16 +00001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Cadence Sierra PHY Driver
4 *
5 * Copyright (c) 2018 Cadence Design Systems
6 * Author: Alan Douglas <adouglas@cadence.com>
7 *
8 */
9#include <linux/clk.h>
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +053010#include <linux/clk-provider.h>
Alan Douglas44d30d62018-11-12 16:42:16 +000011#include <linux/delay.h>
12#include <linux/err.h>
13#include <linux/io.h>
14#include <linux/module.h>
15#include <linux/phy/phy.h>
16#include <linux/platform_device.h>
17#include <linux/pm_runtime.h>
18#include <linux/regmap.h>
19#include <linux/reset.h>
20#include <linux/slab.h>
21#include <linux/of.h>
22#include <linux/of_platform.h>
23#include <dt-bindings/phy/phy.h>
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +053024#include <dt-bindings/phy/phy-cadence.h>
Alan Douglas44d30d62018-11-12 16:42:16 +000025
Swapnil Jakhade078e9e92021-12-23 07:01:24 +010026#define NUM_SSC_MODE 3
Swapnil Jakhade6b81f052021-12-23 07:01:34 +010027#define NUM_PHY_TYPE 4
Swapnil Jakhade078e9e92021-12-23 07:01:24 +010028
Alan Douglas44d30d62018-11-12 16:42:16 +000029/* PHY register offsets */
Anil Varughese871002d2019-12-16 15:27:05 +053030#define SIERRA_COMMON_CDB_OFFSET 0x0
31#define SIERRA_MACRO_ID_REG 0x0
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +053032#define SIERRA_CMN_PLLLC_GEN_PREG 0x42
Anil Varughese871002d2019-12-16 15:27:05 +053033#define SIERRA_CMN_PLLLC_MODE_PREG 0x48
34#define SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG 0x49
35#define SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG 0x4A
36#define SIERRA_CMN_PLLLC_LOCK_CNTSTART_PREG 0x4B
37#define SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG 0x4F
38#define SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG 0x50
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +010039#define SIERRA_CMN_PLLLC_DSMCORR_PREG 0x51
40#define SIERRA_CMN_PLLLC_SS_PREG 0x52
41#define SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG 0x53
42#define SIERRA_CMN_PLLLC_SSTWOPT_PREG 0x54
Anil Varughese871002d2019-12-16 15:27:05 +053043#define SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG 0x62
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +010044#define SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG 0x63
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +053045#define SIERRA_CMN_REFRCV_PREG 0x98
46#define SIERRA_CMN_REFRCV1_PREG 0xB8
47#define SIERRA_CMN_PLLLC1_GEN_PREG 0xC2
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +010048#define SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG 0xCA
49#define SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG 0xD0
50#define SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG 0xE2
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +053051
52#define SIERRA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
53 ((0x4000 << (block_offset)) + \
54 (((ln) << 9) << (reg_offset)))
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +053055
Anil Varughese871002d2019-12-16 15:27:05 +053056#define SIERRA_DET_STANDEC_A_PREG 0x000
57#define SIERRA_DET_STANDEC_B_PREG 0x001
58#define SIERRA_DET_STANDEC_C_PREG 0x002
59#define SIERRA_DET_STANDEC_D_PREG 0x003
60#define SIERRA_DET_STANDEC_E_PREG 0x004
61#define SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG 0x008
62#define SIERRA_PSM_A0IN_TMR_PREG 0x009
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +010063#define SIERRA_PSM_A3IN_TMR_PREG 0x00C
Anil Varughese871002d2019-12-16 15:27:05 +053064#define SIERRA_PSM_DIAG_PREG 0x015
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +010065#define SIERRA_PSC_LN_A3_PREG 0x023
66#define SIERRA_PSC_LN_A4_PREG 0x024
67#define SIERRA_PSC_LN_IDLE_PREG 0x026
Anil Varughese871002d2019-12-16 15:27:05 +053068#define SIERRA_PSC_TX_A0_PREG 0x028
69#define SIERRA_PSC_TX_A1_PREG 0x029
70#define SIERRA_PSC_TX_A2_PREG 0x02A
71#define SIERRA_PSC_TX_A3_PREG 0x02B
72#define SIERRA_PSC_RX_A0_PREG 0x030
73#define SIERRA_PSC_RX_A1_PREG 0x031
74#define SIERRA_PSC_RX_A2_PREG 0x032
75#define SIERRA_PSC_RX_A3_PREG 0x033
76#define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +010077#define SIERRA_PLLCTRL_GEN_A_PREG 0x03B
Anil Varughese871002d2019-12-16 15:27:05 +053078#define SIERRA_PLLCTRL_GEN_D_PREG 0x03E
79#define SIERRA_PLLCTRL_CPGAIN_MODE_PREG 0x03F
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +053080#define SIERRA_PLLCTRL_STATUS_PREG 0x044
Anil Varughese871002d2019-12-16 15:27:05 +053081#define SIERRA_CLKPATH_BIASTRIM_PREG 0x04B
82#define SIERRA_DFE_BIASTRIM_PREG 0x04C
83#define SIERRA_DRVCTRL_ATTEN_PREG 0x06A
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +010084#define SIERRA_DRVCTRL_BOOST_PREG 0x06F
Anil Varughese871002d2019-12-16 15:27:05 +053085#define SIERRA_CLKPATHCTRL_TMR_PREG 0x081
86#define SIERRA_RX_CREQ_FLTR_A_MODE3_PREG 0x085
87#define SIERRA_RX_CREQ_FLTR_A_MODE2_PREG 0x086
88#define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG 0x087
89#define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG 0x088
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +010090#define SIERRA_CREQ_DCBIASATTEN_OVR_PREG 0x08C
Anil Varughese871002d2019-12-16 15:27:05 +053091#define SIERRA_CREQ_CCLKDET_MODE01_PREG 0x08E
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +010092#define SIERRA_RX_CTLE_CAL_PREG 0x08F
Anil Varughese871002d2019-12-16 15:27:05 +053093#define SIERRA_RX_CTLE_MAINTENANCE_PREG 0x091
94#define SIERRA_CREQ_FSMCLK_SEL_PREG 0x092
95#define SIERRA_CREQ_EQ_CTRL_PREG 0x093
96#define SIERRA_CREQ_SPARE_PREG 0x096
97#define SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG 0x097
98#define SIERRA_CTLELUT_CTRL_PREG 0x098
99#define SIERRA_DFE_ECMP_RATESEL_PREG 0x0C0
100#define SIERRA_DFE_SMP_RATESEL_PREG 0x0C1
101#define SIERRA_DEQ_PHALIGN_CTRL 0x0C4
102#define SIERRA_DEQ_CONCUR_CTRL1_PREG 0x0C8
103#define SIERRA_DEQ_CONCUR_CTRL2_PREG 0x0C9
104#define SIERRA_DEQ_EPIPWR_CTRL2_PREG 0x0CD
105#define SIERRA_DEQ_FAST_MAINT_CYCLES_PREG 0x0CE
106#define SIERRA_DEQ_ERRCMP_CTRL_PREG 0x0D0
107#define SIERRA_DEQ_OFFSET_CTRL_PREG 0x0D8
108#define SIERRA_DEQ_GAIN_CTRL_PREG 0x0E0
109#define SIERRA_DEQ_VGATUNE_CTRL_PREG 0x0E1
110#define SIERRA_DEQ_GLUT0 0x0E8
111#define SIERRA_DEQ_GLUT1 0x0E9
112#define SIERRA_DEQ_GLUT2 0x0EA
113#define SIERRA_DEQ_GLUT3 0x0EB
114#define SIERRA_DEQ_GLUT4 0x0EC
115#define SIERRA_DEQ_GLUT5 0x0ED
116#define SIERRA_DEQ_GLUT6 0x0EE
117#define SIERRA_DEQ_GLUT7 0x0EF
118#define SIERRA_DEQ_GLUT8 0x0F0
119#define SIERRA_DEQ_GLUT9 0x0F1
120#define SIERRA_DEQ_GLUT10 0x0F2
121#define SIERRA_DEQ_GLUT11 0x0F3
122#define SIERRA_DEQ_GLUT12 0x0F4
123#define SIERRA_DEQ_GLUT13 0x0F5
124#define SIERRA_DEQ_GLUT14 0x0F6
125#define SIERRA_DEQ_GLUT15 0x0F7
126#define SIERRA_DEQ_GLUT16 0x0F8
127#define SIERRA_DEQ_ALUT0 0x108
128#define SIERRA_DEQ_ALUT1 0x109
129#define SIERRA_DEQ_ALUT2 0x10A
130#define SIERRA_DEQ_ALUT3 0x10B
131#define SIERRA_DEQ_ALUT4 0x10C
132#define SIERRA_DEQ_ALUT5 0x10D
133#define SIERRA_DEQ_ALUT6 0x10E
134#define SIERRA_DEQ_ALUT7 0x10F
135#define SIERRA_DEQ_ALUT8 0x110
136#define SIERRA_DEQ_ALUT9 0x111
137#define SIERRA_DEQ_ALUT10 0x112
138#define SIERRA_DEQ_ALUT11 0x113
139#define SIERRA_DEQ_ALUT12 0x114
140#define SIERRA_DEQ_ALUT13 0x115
141#define SIERRA_DEQ_DFETAP_CTRL_PREG 0x128
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +0100142#define SIERRA_DEQ_DFETAP0 0x129
143#define SIERRA_DEQ_DFETAP1 0x12B
144#define SIERRA_DEQ_DFETAP2 0x12D
145#define SIERRA_DEQ_DFETAP3 0x12F
146#define SIERRA_DEQ_DFETAP4 0x131
Anil Varughese871002d2019-12-16 15:27:05 +0530147#define SIERRA_DFE_EN_1010_IGNORE_PREG 0x134
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +0100148#define SIERRA_DEQ_PRECUR_PREG 0x138
149#define SIERRA_DEQ_POSTCUR_PREG 0x140
150#define SIERRA_DEQ_POSTCUR_DECR_PREG 0x142
Anil Varughese871002d2019-12-16 15:27:05 +0530151#define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150
152#define SIERRA_DEQ_TAU_CTRL2_PREG 0x151
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +0100153#define SIERRA_DEQ_TAU_CTRL3_PREG 0x152
154#define SIERRA_DEQ_OPENEYE_CTRL_PREG 0x158
Anil Varughese871002d2019-12-16 15:27:05 +0530155#define SIERRA_DEQ_PICTRL_PREG 0x161
156#define SIERRA_CPICAL_TMRVAL_MODE1_PREG 0x170
157#define SIERRA_CPICAL_TMRVAL_MODE0_PREG 0x171
158#define SIERRA_CPICAL_PICNT_MODE1_PREG 0x174
159#define SIERRA_CPI_OUTBUF_RATESEL_PREG 0x17C
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +0100160#define SIERRA_CPI_RESBIAS_BIN_PREG 0x17E
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +0100161#define SIERRA_CPI_TRIM_PREG 0x17F
Anil Varughese871002d2019-12-16 15:27:05 +0530162#define SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG 0x183
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +0100163#define SIERRA_EPI_CTRL_PREG 0x187
Anil Varughese871002d2019-12-16 15:27:05 +0530164#define SIERRA_LFPSDET_SUPPORT_PREG 0x188
165#define SIERRA_LFPSFILT_NS_PREG 0x18A
166#define SIERRA_LFPSFILT_RD_PREG 0x18B
167#define SIERRA_LFPSFILT_MP_PREG 0x18C
168#define SIERRA_SIGDET_SUPPORT_PREG 0x190
169#define SIERRA_SDFILT_H2L_A_PREG 0x191
170#define SIERRA_SDFILT_L2H_PREG 0x193
171#define SIERRA_RXBUFFER_CTLECTRL_PREG 0x19E
172#define SIERRA_RXBUFFER_RCDFECTRL_PREG 0x19F
173#define SIERRA_RXBUFFER_DFECTRL_PREG 0x1A0
174#define SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG 0x14F
175#define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530176
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100177/* PHY PCS common registers */
178#define SIERRA_PHY_PCS_COMMON_OFFSET(block_offset) \
179 (0xc000 << (block_offset))
Swapnil Jakhadefa105172021-12-23 07:01:29 +0100180#define SIERRA_PHY_PIPE_CMN_CTRL1 0x0
Anil Varughese871002d2019-12-16 15:27:05 +0530181#define SIERRA_PHY_PLL_CFG 0xe
Alan Douglas44d30d62018-11-12 16:42:16 +0000182
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100183/* PHY PCS lane registers */
184#define SIERRA_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
185 ((0xD000 << (block_offset)) + \
186 (((ln) << 8) << (reg_offset)))
187
188#define SIERRA_PHY_ISO_LINK_CTRL 0xB
189
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100190/* PHY PMA common registers */
191#define SIERRA_PHY_PMA_COMMON_OFFSET(block_offset) \
192 (0xE000 << (block_offset))
193#define SIERRA_PHY_PMA_CMN_CTRL 0x000
194
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100195/* PHY PMA lane registers */
196#define SIERRA_PHY_PMA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
197 ((0xF000 << (block_offset)) + \
198 (((ln) << 8) << (reg_offset)))
199
200#define SIERRA_PHY_PMA_XCVR_CTRL 0x000
201
Anil Varughese871002d2019-12-16 15:27:05 +0530202#define SIERRA_MACRO_ID 0x00007364
Kishon Vijay Abraham Ia43f72a2019-12-16 15:27:08 +0530203#define SIERRA_MAX_LANES 16
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530204#define PLL_LOCK_TIME 100000
Alan Douglas44d30d62018-11-12 16:42:16 +0000205
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530206#define CDNS_SIERRA_OUTPUT_CLOCKS 2
207#define CDNS_SIERRA_INPUT_CLOCKS 5
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +0530208enum cdns_sierra_clock_input {
209 PHY_CLK,
210 CMN_REFCLK_DIG_DIV,
211 CMN_REFCLK1_DIG_DIV,
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530212 PLL0_REFCLK,
213 PLL1_REFCLK,
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +0530214};
215
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530216#define SIERRA_NUM_CMN_PLLC 2
217#define SIERRA_NUM_CMN_PLLC_PARENTS 2
218
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530219static const struct reg_field macro_id_type =
220 REG_FIELD(SIERRA_MACRO_ID_REG, 0, 15);
221static const struct reg_field phy_pll_cfg_1 =
222 REG_FIELD(SIERRA_PHY_PLL_CFG, 1, 1);
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100223static const struct reg_field pma_cmn_ready =
224 REG_FIELD(SIERRA_PHY_PMA_CMN_CTRL, 0, 0);
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530225static const struct reg_field pllctrl_lock =
226 REG_FIELD(SIERRA_PLLCTRL_STATUS_PREG, 0, 0);
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100227static const struct reg_field phy_iso_link_ctrl_1 =
228 REG_FIELD(SIERRA_PHY_ISO_LINK_CTRL, 1, 1);
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530229
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530230static const char * const clk_names[] = {
231 [CDNS_SIERRA_PLL_CMNLC] = "pll_cmnlc",
232 [CDNS_SIERRA_PLL_CMNLC1] = "pll_cmnlc1",
233};
234
235enum cdns_sierra_cmn_plllc {
236 CMN_PLLLC,
237 CMN_PLLLC1,
238};
239
240struct cdns_sierra_pll_mux_reg_fields {
241 struct reg_field pfdclk_sel_preg;
242 struct reg_field plllc1en_field;
243 struct reg_field termen_field;
244};
245
246static const struct cdns_sierra_pll_mux_reg_fields cmn_plllc_pfdclk1_sel_preg[] = {
247 [CMN_PLLLC] = {
248 .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC_GEN_PREG, 1, 1),
249 .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 8, 8),
250 .termen_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 0, 0),
251 },
252 [CMN_PLLLC1] = {
253 .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC1_GEN_PREG, 1, 1),
254 .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 8, 8),
255 .termen_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 0, 0),
256 },
257};
258
259struct cdns_sierra_pll_mux {
260 struct clk_hw hw;
261 struct regmap_field *pfdclk_sel_preg;
262 struct regmap_field *plllc1en_field;
263 struct regmap_field *termen_field;
264 struct clk_init_data clk_data;
265};
266
267#define to_cdns_sierra_pll_mux(_hw) \
268 container_of(_hw, struct cdns_sierra_pll_mux, hw)
269
270static const int pll_mux_parent_index[][SIERRA_NUM_CMN_PLLC_PARENTS] = {
271 [CMN_PLLLC] = { PLL0_REFCLK, PLL1_REFCLK },
272 [CMN_PLLLC1] = { PLL1_REFCLK, PLL0_REFCLK },
273};
274
Swapnil Jakhadeda08aab2021-12-23 07:01:33 +0100275static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS] = {
276 [CMN_PLLLC] = { 0, 1 },
277 [CMN_PLLLC1] = { 1, 0 },
278};
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530279
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100280enum cdns_sierra_phy_type {
281 TYPE_NONE,
282 TYPE_PCIE,
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +0100283 TYPE_USB,
284 TYPE_QSGMII
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100285};
286
287enum cdns_sierra_ssc_mode {
288 NO_SSC,
289 EXTERNAL_SSC,
290 INTERNAL_SSC
291};
292
Alan Douglas44d30d62018-11-12 16:42:16 +0000293struct cdns_sierra_inst {
294 struct phy *phy;
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100295 enum cdns_sierra_phy_type phy_type;
Alan Douglas44d30d62018-11-12 16:42:16 +0000296 u32 num_lanes;
297 u32 mlane;
298 struct reset_control *lnk_rst;
Swapnil Jakhade1e902b22021-12-23 07:01:27 +0100299 enum cdns_sierra_ssc_mode ssc_mode;
Alan Douglas44d30d62018-11-12 16:42:16 +0000300};
301
302struct cdns_reg_pairs {
303 u16 val;
304 u32 off;
305};
306
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100307struct cdns_sierra_vals {
308 const struct cdns_reg_pairs *reg_pairs;
309 u32 num_regs;
310};
311
Alan Douglas44d30d62018-11-12 16:42:16 +0000312struct cdns_sierra_data {
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100313 u32 id_value;
314 u8 block_offset_shift;
315 u8 reg_offset_shift;
Swapnil Jakhadefa105172021-12-23 07:01:29 +0100316 struct cdns_sierra_vals *pcs_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
317 [NUM_SSC_MODE];
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100318 struct cdns_sierra_vals *phy_pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
319 [NUM_SSC_MODE];
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100320 struct cdns_sierra_vals *pma_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
321 [NUM_SSC_MODE];
322 struct cdns_sierra_vals *pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE]
323 [NUM_SSC_MODE];
Alan Douglas44d30d62018-11-12 16:42:16 +0000324};
325
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530326struct cdns_regmap_cdb_context {
Alan Douglas44d30d62018-11-12 16:42:16 +0000327 struct device *dev;
328 void __iomem *base;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530329 u8 reg_offset_shift;
330};
331
332struct cdns_sierra_phy {
333 struct device *dev;
334 struct regmap *regmap;
Swapnil Jakhadec3c11d52021-12-23 07:01:23 +0100335 const struct cdns_sierra_data *init_data;
Alan Douglas44d30d62018-11-12 16:42:16 +0000336 struct cdns_sierra_inst phys[SIERRA_MAX_LANES];
337 struct reset_control *phy_rst;
338 struct reset_control *apb_rst;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530339 struct regmap *regmap_lane_cdb[SIERRA_MAX_LANES];
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100340 struct regmap *regmap_phy_pcs_common_cdb;
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100341 struct regmap *regmap_phy_pcs_lane_cdb[SIERRA_MAX_LANES];
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100342 struct regmap *regmap_phy_pma_common_cdb;
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100343 struct regmap *regmap_phy_pma_lane_cdb[SIERRA_MAX_LANES];
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530344 struct regmap *regmap_common_cdb;
345 struct regmap_field *macro_id_type;
346 struct regmap_field *phy_pll_cfg_1;
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100347 struct regmap_field *pma_cmn_ready;
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530348 struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES];
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100349 struct regmap_field *phy_iso_link_ctrl_1[SIERRA_MAX_LANES];
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530350 struct regmap_field *cmn_refrcv_refclk_plllc1en_preg[SIERRA_NUM_CMN_PLLC];
351 struct regmap_field *cmn_refrcv_refclk_termen_preg[SIERRA_NUM_CMN_PLLC];
352 struct regmap_field *cmn_plllc_pfdclk1_sel_preg[SIERRA_NUM_CMN_PLLC];
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +0530353 struct clk *input_clks[CDNS_SIERRA_INPUT_CLOCKS];
Alan Douglas44d30d62018-11-12 16:42:16 +0000354 int nsubnodes;
Kishon Vijay Abraham Ia43f72a2019-12-16 15:27:08 +0530355 u32 num_lanes;
Alan Douglas44d30d62018-11-12 16:42:16 +0000356 bool autoconf;
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530357 struct clk_onecell_data clk_data;
358 struct clk *output_clks[CDNS_SIERRA_OUTPUT_CLOCKS];
Alan Douglas44d30d62018-11-12 16:42:16 +0000359};
360
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530361static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val)
362{
363 struct cdns_regmap_cdb_context *ctx = context;
364 u32 offset = reg << ctx->reg_offset_shift;
365
366 writew(val, ctx->base + offset);
367
368 return 0;
369}
370
371static int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val)
372{
373 struct cdns_regmap_cdb_context *ctx = context;
374 u32 offset = reg << ctx->reg_offset_shift;
375
376 *val = readw(ctx->base + offset);
377 return 0;
378}
379
380#define SIERRA_LANE_CDB_REGMAP_CONF(n) \
381{ \
382 .name = "sierra_lane" n "_cdb", \
383 .reg_stride = 1, \
384 .fast_io = true, \
385 .reg_write = cdns_regmap_write, \
386 .reg_read = cdns_regmap_read, \
387}
388
Rikard Falkeborn3cfb0e82020-09-12 22:46:37 +0200389static const struct regmap_config cdns_sierra_lane_cdb_config[] = {
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530390 SIERRA_LANE_CDB_REGMAP_CONF("0"),
391 SIERRA_LANE_CDB_REGMAP_CONF("1"),
392 SIERRA_LANE_CDB_REGMAP_CONF("2"),
393 SIERRA_LANE_CDB_REGMAP_CONF("3"),
Kishon Vijay Abraham Ia43f72a2019-12-16 15:27:08 +0530394 SIERRA_LANE_CDB_REGMAP_CONF("4"),
395 SIERRA_LANE_CDB_REGMAP_CONF("5"),
396 SIERRA_LANE_CDB_REGMAP_CONF("6"),
397 SIERRA_LANE_CDB_REGMAP_CONF("7"),
398 SIERRA_LANE_CDB_REGMAP_CONF("8"),
399 SIERRA_LANE_CDB_REGMAP_CONF("9"),
400 SIERRA_LANE_CDB_REGMAP_CONF("10"),
401 SIERRA_LANE_CDB_REGMAP_CONF("11"),
402 SIERRA_LANE_CDB_REGMAP_CONF("12"),
403 SIERRA_LANE_CDB_REGMAP_CONF("13"),
404 SIERRA_LANE_CDB_REGMAP_CONF("14"),
405 SIERRA_LANE_CDB_REGMAP_CONF("15"),
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530406};
407
Rikard Falkeborn3cfb0e82020-09-12 22:46:37 +0200408static const struct regmap_config cdns_sierra_common_cdb_config = {
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530409 .name = "sierra_common_cdb",
410 .reg_stride = 1,
411 .fast_io = true,
412 .reg_write = cdns_regmap_write,
413 .reg_read = cdns_regmap_read,
414};
415
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100416static const struct regmap_config cdns_sierra_phy_pcs_cmn_cdb_config = {
417 .name = "sierra_phy_pcs_cmn_cdb",
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530418 .reg_stride = 1,
419 .fast_io = true,
420 .reg_write = cdns_regmap_write,
421 .reg_read = cdns_regmap_read,
422};
423
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100424#define SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \
425{ \
426 .name = "sierra_phy_pcs_lane" n "_cdb", \
427 .reg_stride = 1, \
428 .fast_io = true, \
429 .reg_write = cdns_regmap_write, \
430 .reg_read = cdns_regmap_read, \
431}
432
433static const struct regmap_config cdns_sierra_phy_pcs_lane_cdb_config[] = {
434 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("0"),
435 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("1"),
436 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("2"),
437 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("3"),
438 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("4"),
439 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("5"),
440 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("6"),
441 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("7"),
442 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("8"),
443 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("9"),
444 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("10"),
445 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("11"),
446 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("12"),
447 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("13"),
448 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("14"),
449 SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("15"),
450};
451
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100452static const struct regmap_config cdns_sierra_phy_pma_cmn_cdb_config = {
453 .name = "sierra_phy_pma_cmn_cdb",
454 .reg_stride = 1,
455 .fast_io = true,
456 .reg_write = cdns_regmap_write,
457 .reg_read = cdns_regmap_read,
458};
459
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100460#define SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF(n) \
461{ \
462 .name = "sierra_phy_pma_lane" n "_cdb", \
463 .reg_stride = 1, \
464 .fast_io = true, \
465 .reg_write = cdns_regmap_write, \
466 .reg_read = cdns_regmap_read, \
467}
468
469static const struct regmap_config cdns_sierra_phy_pma_lane_cdb_config[] = {
470 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("0"),
471 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("1"),
472 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("2"),
473 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("3"),
474 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("4"),
475 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("5"),
476 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("6"),
477 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("7"),
478 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("8"),
479 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("9"),
480 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("10"),
481 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("11"),
482 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("12"),
483 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("13"),
484 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("14"),
485 SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("15"),
486};
487
Kishon Vijay Abraham Icedcc2e2019-12-16 15:27:03 +0530488static int cdns_sierra_phy_init(struct phy *gphy)
Alan Douglas44d30d62018-11-12 16:42:16 +0000489{
490 struct cdns_sierra_inst *ins = phy_get_drvdata(gphy);
491 struct cdns_sierra_phy *phy = dev_get_drvdata(gphy->dev.parent);
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100492 const struct cdns_sierra_data *init_data = phy->init_data;
493 struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals;
494 enum cdns_sierra_phy_type phy_type = ins->phy_type;
Swapnil Jakhade1e902b22021-12-23 07:01:27 +0100495 enum cdns_sierra_ssc_mode ssc = ins->ssc_mode;
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100496 struct cdns_sierra_vals *phy_pma_ln_vals;
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100497 const struct cdns_reg_pairs *reg_pairs;
Swapnil Jakhadefa105172021-12-23 07:01:29 +0100498 struct cdns_sierra_vals *pcs_cmn_vals;
Colin Ian King80f96fb2020-01-08 11:59:36 +0530499 struct regmap *regmap;
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100500 u32 num_regs;
Alan Douglas44d30d62018-11-12 16:42:16 +0000501 int i, j;
Alan Douglas44d30d62018-11-12 16:42:16 +0000502
Kishon Vijay Abraham Icedcc2e2019-12-16 15:27:03 +0530503 /* Initialise the PHY registers, unless auto configured */
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100504 if (phy->autoconf || phy->nsubnodes > 1)
Kishon Vijay Abraham Icedcc2e2019-12-16 15:27:03 +0530505 return 0;
506
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +0530507 clk_set_rate(phy->input_clks[CMN_REFCLK_DIG_DIV], 25000000);
508 clk_set_rate(phy->input_clks[CMN_REFCLK1_DIG_DIV], 25000000);
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100509
Swapnil Jakhadefa105172021-12-23 07:01:29 +0100510 /* PHY PCS common registers configurations */
511 pcs_cmn_vals = init_data->pcs_cmn_vals[phy_type][TYPE_NONE][ssc];
512 if (pcs_cmn_vals) {
513 reg_pairs = pcs_cmn_vals->reg_pairs;
514 num_regs = pcs_cmn_vals->num_regs;
515 regmap = phy->regmap_phy_pcs_common_cdb;
516 for (i = 0; i < num_regs; i++)
517 regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
518 }
519
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100520 /* PHY PMA lane registers configurations */
521 phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_type][TYPE_NONE][ssc];
522 if (phy_pma_ln_vals) {
523 reg_pairs = phy_pma_ln_vals->reg_pairs;
524 num_regs = phy_pma_ln_vals->num_regs;
525 for (i = 0; i < ins->num_lanes; i++) {
526 regmap = phy->regmap_phy_pma_lane_cdb[i + ins->mlane];
527 for (j = 0; j < num_regs; j++)
528 regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
529 }
530 }
531
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100532 /* PMA common registers configurations */
533 pma_cmn_vals = init_data->pma_cmn_vals[phy_type][TYPE_NONE][ssc];
534 if (pma_cmn_vals) {
535 reg_pairs = pma_cmn_vals->reg_pairs;
536 num_regs = pma_cmn_vals->num_regs;
537 regmap = phy->regmap_common_cdb;
538 for (i = 0; i < num_regs; i++)
539 regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
Alan Douglas44d30d62018-11-12 16:42:16 +0000540 }
Anil Varughese871002d2019-12-16 15:27:05 +0530541
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100542 /* PMA lane registers configurations */
543 pma_ln_vals = init_data->pma_ln_vals[phy_type][TYPE_NONE][ssc];
544 if (pma_ln_vals) {
545 reg_pairs = pma_ln_vals->reg_pairs;
546 num_regs = pma_ln_vals->num_regs;
547 for (i = 0; i < ins->num_lanes; i++) {
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530548 regmap = phy->regmap_lane_cdb[i + ins->mlane];
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100549 for (j = 0; j < num_regs; j++)
550 regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530551 }
552 }
Kishon Vijay Abraham Icedcc2e2019-12-16 15:27:03 +0530553
554 return 0;
Alan Douglas44d30d62018-11-12 16:42:16 +0000555}
556
557static int cdns_sierra_phy_on(struct phy *gphy)
558{
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530559 struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent);
Alan Douglas44d30d62018-11-12 16:42:16 +0000560 struct cdns_sierra_inst *ins = phy_get_drvdata(gphy);
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530561 struct device *dev = sp->dev;
562 u32 val;
563 int ret;
Alan Douglas44d30d62018-11-12 16:42:16 +0000564
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100565 if (sp->nsubnodes == 1) {
566 /* Take the PHY out of reset */
567 ret = reset_control_deassert(sp->phy_rst);
568 if (ret) {
569 dev_err(dev, "Failed to take the PHY out of reset\n");
570 return ret;
571 }
Kishon Vijay Abraham I5b4f5752021-03-19 18:11:16 +0530572 }
573
Alan Douglas44d30d62018-11-12 16:42:16 +0000574 /* Take the PHY lane group out of reset */
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530575 ret = reset_control_deassert(ins->lnk_rst);
576 if (ret) {
577 dev_err(dev, "Failed to take the PHY lane out of reset\n");
578 return ret;
579 }
580
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100581 if (ins->phy_type == TYPE_PCIE || ins->phy_type == TYPE_USB) {
582 ret = regmap_field_read_poll_timeout(sp->phy_iso_link_ctrl_1[ins->mlane],
583 val, !val, 1000, PLL_LOCK_TIME);
584 if (ret) {
585 dev_err(dev, "Timeout waiting for PHY status ready\n");
586 return ret;
587 }
588 }
589
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100590 /*
591 * Wait for cmn_ready assertion
592 * PHY_PMA_CMN_CTRL[0] == 1
593 */
594 ret = regmap_field_read_poll_timeout(sp->pma_cmn_ready, val, val,
595 1000, PLL_LOCK_TIME);
596 if (ret) {
597 dev_err(dev, "Timeout waiting for CMN ready\n");
598 return ret;
599 }
600
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530601 ret = regmap_field_read_poll_timeout(sp->pllctrl_lock[ins->mlane],
602 val, val, 1000, PLL_LOCK_TIME);
603 if (ret < 0)
604 dev_err(dev, "PLL lock of lane failed\n");
605
606 return ret;
Alan Douglas44d30d62018-11-12 16:42:16 +0000607}
608
609static int cdns_sierra_phy_off(struct phy *gphy)
610{
611 struct cdns_sierra_inst *ins = phy_get_drvdata(gphy);
612
613 return reset_control_assert(ins->lnk_rst);
614}
615
Roger Quadros7904e152020-01-06 15:06:20 +0200616static int cdns_sierra_phy_reset(struct phy *gphy)
617{
618 struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent);
619
620 reset_control_assert(sp->phy_rst);
621 reset_control_deassert(sp->phy_rst);
622 return 0;
623};
624
Alan Douglas44d30d62018-11-12 16:42:16 +0000625static const struct phy_ops ops = {
Kishon Vijay Abraham Icedcc2e2019-12-16 15:27:03 +0530626 .init = cdns_sierra_phy_init,
Alan Douglas44d30d62018-11-12 16:42:16 +0000627 .power_on = cdns_sierra_phy_on,
628 .power_off = cdns_sierra_phy_off,
Roger Quadros7904e152020-01-06 15:06:20 +0200629 .reset = cdns_sierra_phy_reset,
Alan Douglas44d30d62018-11-12 16:42:16 +0000630 .owner = THIS_MODULE,
631};
632
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530633static u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw)
634{
635 struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw);
Swapnil Jakhadeda08aab2021-12-23 07:01:33 +0100636 struct regmap_field *plllc1en_field = mux->plllc1en_field;
637 struct regmap_field *termen_field = mux->termen_field;
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530638 struct regmap_field *field = mux->pfdclk_sel_preg;
639 unsigned int val;
Swapnil Jakhadeda08aab2021-12-23 07:01:33 +0100640 int index;
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530641
642 regmap_field_read(field, &val);
Swapnil Jakhadeda08aab2021-12-23 07:01:33 +0100643
644 if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) {
645 index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC1], 0, val);
646 if (index == 1) {
647 regmap_field_write(plllc1en_field, 1);
648 regmap_field_write(termen_field, 1);
649 }
650 } else {
651 index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC], 0, val);
652 }
653
654 return index;
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530655}
656
657static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index)
658{
659 struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw);
660 struct regmap_field *plllc1en_field = mux->plllc1en_field;
661 struct regmap_field *termen_field = mux->termen_field;
662 struct regmap_field *field = mux->pfdclk_sel_preg;
663 int val, ret;
664
665 ret = regmap_field_write(plllc1en_field, 0);
666 ret |= regmap_field_write(termen_field, 0);
667 if (index == 1) {
668 ret |= regmap_field_write(plllc1en_field, 1);
669 ret |= regmap_field_write(termen_field, 1);
670 }
671
Swapnil Jakhadeda08aab2021-12-23 07:01:33 +0100672 if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1]))
673 val = cdns_sierra_pll_mux_table[CMN_PLLLC1][index];
674 else
675 val = cdns_sierra_pll_mux_table[CMN_PLLLC][index];
676
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530677 ret |= regmap_field_write(field, val);
678
679 return ret;
680}
681
682static const struct clk_ops cdns_sierra_pll_mux_ops = {
683 .set_parent = cdns_sierra_pll_mux_set_parent,
684 .get_parent = cdns_sierra_pll_mux_get_parent,
685};
686
687static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp,
688 struct regmap_field *pfdclk1_sel_field,
689 struct regmap_field *plllc1en_field,
690 struct regmap_field *termen_field,
691 int clk_index)
692{
693 struct cdns_sierra_pll_mux *mux;
694 struct device *dev = sp->dev;
695 struct clk_init_data *init;
696 const char **parent_names;
697 unsigned int num_parents;
698 char clk_name[100];
699 struct clk *clk;
700 int i;
701
702 mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL);
703 if (!mux)
704 return -ENOMEM;
705
706 num_parents = SIERRA_NUM_CMN_PLLC_PARENTS;
707 parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL);
708 if (!parent_names)
709 return -ENOMEM;
710
711 for (i = 0; i < num_parents; i++) {
712 clk = sp->input_clks[pll_mux_parent_index[clk_index][i]];
713 if (IS_ERR_OR_NULL(clk)) {
Swapnil Jakhadeda08aab2021-12-23 07:01:33 +0100714 dev_err(dev, "No parent clock for PLL mux clocks\n");
715 return IS_ERR(clk) ? PTR_ERR(clk) : -ENOENT;
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530716 }
717 parent_names[i] = __clk_get_name(clk);
718 }
719
720 snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), clk_names[clk_index]);
721
722 init = &mux->clk_data;
723
724 init->ops = &cdns_sierra_pll_mux_ops;
725 init->flags = CLK_SET_RATE_NO_REPARENT;
726 init->parent_names = parent_names;
727 init->num_parents = num_parents;
728 init->name = clk_name;
729
730 mux->pfdclk_sel_preg = pfdclk1_sel_field;
731 mux->plllc1en_field = plllc1en_field;
732 mux->termen_field = termen_field;
733 mux->hw.init = init;
734
735 clk = devm_clk_register(dev, &mux->hw);
736 if (IS_ERR(clk))
737 return PTR_ERR(clk);
738
739 sp->output_clks[clk_index] = clk;
740
741 return 0;
742}
743
744static int cdns_sierra_phy_register_pll_mux(struct cdns_sierra_phy *sp)
745{
746 struct regmap_field *pfdclk1_sel_field;
747 struct regmap_field *plllc1en_field;
748 struct regmap_field *termen_field;
749 struct device *dev = sp->dev;
750 int ret = 0, i, clk_index;
751
752 clk_index = CDNS_SIERRA_PLL_CMNLC;
753 for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++, clk_index++) {
754 pfdclk1_sel_field = sp->cmn_plllc_pfdclk1_sel_preg[i];
755 plllc1en_field = sp->cmn_refrcv_refclk_plllc1en_preg[i];
756 termen_field = sp->cmn_refrcv_refclk_termen_preg[i];
757
758 ret = cdns_sierra_pll_mux_register(sp, pfdclk1_sel_field, plllc1en_field,
759 termen_field, clk_index);
760 if (ret) {
761 dev_err(dev, "Fail to register cmn plllc mux\n");
762 return ret;
763 }
764 }
765
766 return 0;
767}
768
769static void cdns_sierra_clk_unregister(struct cdns_sierra_phy *sp)
770{
771 struct device *dev = sp->dev;
772 struct device_node *node = dev->of_node;
773
774 of_clk_del_provider(node);
775}
776
777static int cdns_sierra_clk_register(struct cdns_sierra_phy *sp)
778{
779 struct device *dev = sp->dev;
780 struct device_node *node = dev->of_node;
781 int ret;
782
783 ret = cdns_sierra_phy_register_pll_mux(sp);
784 if (ret) {
785 dev_err(dev, "Failed to pll mux clocks\n");
786 return ret;
787 }
788
789 sp->clk_data.clks = sp->output_clks;
790 sp->clk_data.clk_num = CDNS_SIERRA_OUTPUT_CLOCKS;
791 ret = of_clk_add_provider(node, of_clk_src_onecell_get, &sp->clk_data);
792 if (ret)
793 dev_err(dev, "Failed to add clock provider: %s\n", node->name);
794
795 return ret;
796}
797
Alan Douglas44d30d62018-11-12 16:42:16 +0000798static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst,
799 struct device_node *child)
800{
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100801 u32 phy_type;
802
Alan Douglas44d30d62018-11-12 16:42:16 +0000803 if (of_property_read_u32(child, "reg", &inst->mlane))
804 return -EINVAL;
805
806 if (of_property_read_u32(child, "cdns,num-lanes", &inst->num_lanes))
807 return -EINVAL;
808
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100809 if (of_property_read_u32(child, "cdns,phy-type", &phy_type))
Alan Douglas44d30d62018-11-12 16:42:16 +0000810 return -EINVAL;
811
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100812 switch (phy_type) {
813 case PHY_TYPE_PCIE:
814 inst->phy_type = TYPE_PCIE;
815 break;
816 case PHY_TYPE_USB3:
817 inst->phy_type = TYPE_USB;
818 break;
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +0100819 case PHY_TYPE_QSGMII:
820 inst->phy_type = TYPE_QSGMII;
821 break;
Swapnil Jakhade078e9e92021-12-23 07:01:24 +0100822 default:
823 return -EINVAL;
824 }
825
Swapnil Jakhade1e902b22021-12-23 07:01:27 +0100826 inst->ssc_mode = EXTERNAL_SSC;
827 of_property_read_u32(child, "cdns,ssc-mode", &inst->ssc_mode);
828
Alan Douglas44d30d62018-11-12 16:42:16 +0000829 return 0;
830}
831
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530832static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base,
833 u32 block_offset, u8 reg_offset_shift,
834 const struct regmap_config *config)
835{
836 struct cdns_regmap_cdb_context *ctx;
837
838 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
839 if (!ctx)
840 return ERR_PTR(-ENOMEM);
841
842 ctx->dev = dev;
843 ctx->base = base + block_offset;
844 ctx->reg_offset_shift = reg_offset_shift;
845
846 return devm_regmap_init(dev, NULL, ctx, config);
847}
848
849static int cdns_regfield_init(struct cdns_sierra_phy *sp)
850{
851 struct device *dev = sp->dev;
852 struct regmap_field *field;
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530853 struct reg_field reg_field;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530854 struct regmap *regmap;
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530855 int i;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530856
857 regmap = sp->regmap_common_cdb;
858 field = devm_regmap_field_alloc(dev, regmap, macro_id_type);
859 if (IS_ERR(field)) {
860 dev_err(dev, "MACRO_ID_TYPE reg field init failed\n");
861 return PTR_ERR(field);
862 }
863 sp->macro_id_type = field;
864
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +0530865 for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++) {
866 reg_field = cmn_plllc_pfdclk1_sel_preg[i].pfdclk_sel_preg;
867 field = devm_regmap_field_alloc(dev, regmap, reg_field);
868 if (IS_ERR(field)) {
869 dev_err(dev, "PLLLC%d_PFDCLK1_SEL failed\n", i);
870 return PTR_ERR(field);
871 }
872 sp->cmn_plllc_pfdclk1_sel_preg[i] = field;
873
874 reg_field = cmn_plllc_pfdclk1_sel_preg[i].plllc1en_field;
875 field = devm_regmap_field_alloc(dev, regmap, reg_field);
876 if (IS_ERR(field)) {
877 dev_err(dev, "REFRCV%d_REFCLK_PLLLC1EN failed\n", i);
878 return PTR_ERR(field);
879 }
880 sp->cmn_refrcv_refclk_plllc1en_preg[i] = field;
881
882 reg_field = cmn_plllc_pfdclk1_sel_preg[i].termen_field;
883 field = devm_regmap_field_alloc(dev, regmap, reg_field);
884 if (IS_ERR(field)) {
885 dev_err(dev, "REFRCV%d_REFCLK_TERMEN failed\n", i);
886 return PTR_ERR(field);
887 }
888 sp->cmn_refrcv_refclk_termen_preg[i] = field;
889 }
890
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100891 regmap = sp->regmap_phy_pcs_common_cdb;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530892 field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg_1);
893 if (IS_ERR(field)) {
894 dev_err(dev, "PHY_PLL_CFG_1 reg field init failed\n");
895 return PTR_ERR(field);
896 }
897 sp->phy_pll_cfg_1 = field;
898
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100899 regmap = sp->regmap_phy_pma_common_cdb;
900 field = devm_regmap_field_alloc(dev, regmap, pma_cmn_ready);
901 if (IS_ERR(field)) {
902 dev_err(dev, "PHY_PMA_CMN_CTRL reg field init failed\n");
903 return PTR_ERR(field);
904 }
905 sp->pma_cmn_ready = field;
906
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530907 for (i = 0; i < SIERRA_MAX_LANES; i++) {
908 regmap = sp->regmap_lane_cdb[i];
909 field = devm_regmap_field_alloc(dev, regmap, pllctrl_lock);
910 if (IS_ERR(field)) {
911 dev_err(dev, "P%d_ENABLE reg field init failed\n", i);
912 return PTR_ERR(field);
913 }
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100914 sp->pllctrl_lock[i] = field;
915 }
916
917 for (i = 0; i < SIERRA_MAX_LANES; i++) {
918 regmap = sp->regmap_phy_pcs_lane_cdb[i];
919 field = devm_regmap_field_alloc(dev, regmap, phy_iso_link_ctrl_1);
920 if (IS_ERR(field)) {
921 dev_err(dev, "PHY_ISO_LINK_CTRL reg field init for lane %d failed\n", i);
922 return PTR_ERR(field);
923 }
924 sp->phy_iso_link_ctrl_1[i] = field;
Kishon Vijay Abraham Iadc4bd62019-12-16 15:27:07 +0530925 }
926
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530927 return 0;
928}
929
930static int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp,
931 void __iomem *base, u8 block_offset_shift,
932 u8 reg_offset_shift)
933{
934 struct device *dev = sp->dev;
935 struct regmap *regmap;
936 u32 block_offset;
937 int i;
938
939 for (i = 0; i < SIERRA_MAX_LANES; i++) {
940 block_offset = SIERRA_LANE_CDB_OFFSET(i, block_offset_shift,
941 reg_offset_shift);
942 regmap = cdns_regmap_init(dev, base, block_offset,
943 reg_offset_shift,
944 &cdns_sierra_lane_cdb_config[i]);
945 if (IS_ERR(regmap)) {
946 dev_err(dev, "Failed to init lane CDB regmap\n");
947 return PTR_ERR(regmap);
948 }
949 sp->regmap_lane_cdb[i] = regmap;
950 }
951
952 regmap = cdns_regmap_init(dev, base, SIERRA_COMMON_CDB_OFFSET,
953 reg_offset_shift,
954 &cdns_sierra_common_cdb_config);
955 if (IS_ERR(regmap)) {
956 dev_err(dev, "Failed to init common CDB regmap\n");
957 return PTR_ERR(regmap);
958 }
959 sp->regmap_common_cdb = regmap;
960
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100961 block_offset = SIERRA_PHY_PCS_COMMON_OFFSET(block_offset_shift);
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530962 regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift,
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100963 &cdns_sierra_phy_pcs_cmn_cdb_config);
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530964 if (IS_ERR(regmap)) {
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100965 dev_err(dev, "Failed to init PHY PCS common CDB regmap\n");
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530966 return PTR_ERR(regmap);
967 }
Swapnil Jakhade8c95e172021-12-23 07:01:28 +0100968 sp->regmap_phy_pcs_common_cdb = regmap;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +0530969
Swapnil Jakhade36ce4162021-12-23 07:01:31 +0100970 for (i = 0; i < SIERRA_MAX_LANES; i++) {
971 block_offset = SIERRA_PHY_PCS_LANE_CDB_OFFSET(i, block_offset_shift,
972 reg_offset_shift);
973 regmap = cdns_regmap_init(dev, base, block_offset,
974 reg_offset_shift,
975 &cdns_sierra_phy_pcs_lane_cdb_config[i]);
976 if (IS_ERR(regmap)) {
977 dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n");
978 return PTR_ERR(regmap);
979 }
980 sp->regmap_phy_pcs_lane_cdb[i] = regmap;
981 }
982
Swapnil Jakhadef1cc6c32021-12-23 07:01:30 +0100983 block_offset = SIERRA_PHY_PMA_COMMON_OFFSET(block_offset_shift);
984 regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift,
985 &cdns_sierra_phy_pma_cmn_cdb_config);
986 if (IS_ERR(regmap)) {
987 dev_err(dev, "Failed to init PHY PMA common CDB regmap\n");
988 return PTR_ERR(regmap);
989 }
990 sp->regmap_phy_pma_common_cdb = regmap;
991
Swapnil Jakhade6b81f052021-12-23 07:01:34 +0100992 for (i = 0; i < SIERRA_MAX_LANES; i++) {
993 block_offset = SIERRA_PHY_PMA_LANE_CDB_OFFSET(i, block_offset_shift,
994 reg_offset_shift);
995 regmap = cdns_regmap_init(dev, base, block_offset,
996 reg_offset_shift,
997 &cdns_sierra_phy_pma_lane_cdb_config[i]);
998 if (IS_ERR(regmap)) {
999 dev_err(dev, "Failed to init PHY PMA lane CDB regmap\n");
1000 return PTR_ERR(regmap);
1001 }
1002 sp->regmap_phy_pma_lane_cdb[i] = regmap;
1003 }
1004
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301005 return 0;
1006}
1007
Kishon Vijay Abraham I7e016cb2021-03-19 18:11:20 +05301008static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp,
1009 struct device *dev)
1010{
1011 struct clk *clk;
1012 int ret;
1013
1014 clk = devm_clk_get_optional(dev, "phy_clk");
1015 if (IS_ERR(clk)) {
1016 dev_err(dev, "failed to get clock phy_clk\n");
1017 return PTR_ERR(clk);
1018 }
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +05301019 sp->input_clks[PHY_CLK] = clk;
Kishon Vijay Abraham I7e016cb2021-03-19 18:11:20 +05301020
1021 clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div");
1022 if (IS_ERR(clk)) {
1023 dev_err(dev, "cmn_refclk_dig_div clock not found\n");
1024 ret = PTR_ERR(clk);
1025 return ret;
1026 }
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +05301027 sp->input_clks[CMN_REFCLK_DIG_DIV] = clk;
Kishon Vijay Abraham I7e016cb2021-03-19 18:11:20 +05301028
1029 clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div");
1030 if (IS_ERR(clk)) {
1031 dev_err(dev, "cmn_refclk1_dig_div clock not found\n");
1032 ret = PTR_ERR(clk);
1033 return ret;
1034 }
Kishon Vijay Abraham Ia0c30cd2021-03-19 18:11:24 +05301035 sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk;
Kishon Vijay Abraham I7e016cb2021-03-19 18:11:20 +05301036
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +05301037 clk = devm_clk_get_optional(dev, "pll0_refclk");
1038 if (IS_ERR(clk)) {
1039 dev_err(dev, "pll0_refclk clock not found\n");
1040 ret = PTR_ERR(clk);
1041 return ret;
1042 }
1043 sp->input_clks[PLL0_REFCLK] = clk;
1044
1045 clk = devm_clk_get_optional(dev, "pll1_refclk");
1046 if (IS_ERR(clk)) {
1047 dev_err(dev, "pll1_refclk clock not found\n");
1048 ret = PTR_ERR(clk);
1049 return ret;
1050 }
1051 sp->input_clks[PLL1_REFCLK] = clk;
1052
Kishon Vijay Abraham I7e016cb2021-03-19 18:11:20 +05301053 return 0;
1054}
1055
Kishon Vijay Abraham I1436ec32021-03-19 18:11:28 +05301056static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp)
1057{
1058 int ret;
1059
1060 ret = clk_prepare_enable(sp->input_clks[PHY_CLK]);
1061 if (ret)
1062 return ret;
1063
1064 ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
1065 if (ret)
1066 goto err_pll_cmnlc;
1067
1068 ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]);
1069 if (ret)
1070 goto err_pll_cmnlc1;
1071
1072 return 0;
1073
1074err_pll_cmnlc1:
1075 clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
1076
1077err_pll_cmnlc:
1078 clk_disable_unprepare(sp->input_clks[PHY_CLK]);
1079
1080 return ret;
1081}
1082
1083static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp)
1084{
1085 clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]);
1086 clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
1087 clk_disable_unprepare(sp->input_clks[PHY_CLK]);
1088}
1089
Kishon Vijay Abraham I1d5f40e2021-03-19 18:11:21 +05301090static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp,
1091 struct device *dev)
1092{
1093 struct reset_control *rst;
1094
Kishon Vijay Abraham I15b0b822021-03-19 18:11:22 +05301095 rst = devm_reset_control_get_exclusive(dev, "sierra_reset");
Kishon Vijay Abraham I1d5f40e2021-03-19 18:11:21 +05301096 if (IS_ERR(rst)) {
1097 dev_err(dev, "failed to get reset\n");
1098 return PTR_ERR(rst);
1099 }
1100 sp->phy_rst = rst;
1101
Kishon Vijay Abraham I15b0b822021-03-19 18:11:22 +05301102 rst = devm_reset_control_get_optional_exclusive(dev, "sierra_apb");
Kishon Vijay Abraham I1d5f40e2021-03-19 18:11:21 +05301103 if (IS_ERR(rst)) {
1104 dev_err(dev, "failed to get apb reset\n");
1105 return PTR_ERR(rst);
1106 }
1107 sp->apb_rst = rst;
1108
1109 return 0;
1110}
1111
Swapnil Jakhade6b81f052021-12-23 07:01:34 +01001112static int cdns_sierra_phy_configure_multilink(struct cdns_sierra_phy *sp)
1113{
1114 const struct cdns_sierra_data *init_data = sp->init_data;
1115 struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals;
1116 enum cdns_sierra_phy_type phy_t1, phy_t2;
1117 struct cdns_sierra_vals *phy_pma_ln_vals;
1118 const struct cdns_reg_pairs *reg_pairs;
1119 struct cdns_sierra_vals *pcs_cmn_vals;
1120 int i, j, node, mlane, num_lanes, ret;
1121 enum cdns_sierra_ssc_mode ssc;
1122 struct regmap *regmap;
1123 u32 num_regs;
1124
1125 /* Maximum 2 links (subnodes) are supported */
1126 if (sp->nsubnodes != 2)
1127 return -EINVAL;
1128
1129 clk_set_rate(sp->input_clks[CMN_REFCLK_DIG_DIV], 25000000);
1130 clk_set_rate(sp->input_clks[CMN_REFCLK1_DIG_DIV], 25000000);
1131
1132 /* PHY configured to use both PLL LC and LC1 */
1133 regmap_field_write(sp->phy_pll_cfg_1, 0x1);
1134
1135 phy_t1 = sp->phys[0].phy_type;
1136 phy_t2 = sp->phys[1].phy_type;
1137
1138 /*
1139 * PHY configuration for multi-link operation is done in two steps.
1140 * e.g. Consider a case for a 4 lane PHY with PCIe using 2 lanes and QSGMII other 2 lanes.
1141 * Sierra PHY has 2 PLLs, viz. PLLLC and PLLLC1. So in this case, PLLLC is used for PCIe
1142 * and PLLLC1 is used for QSGMII. PHY is configured in two steps as described below.
1143 *
1144 * [1] For first step, phy_t1 = TYPE_PCIE and phy_t2 = TYPE_QSGMII
1145 * So the register values are selected as [TYPE_PCIE][TYPE_QSGMII][ssc].
1146 * This will configure PHY registers associated for PCIe (i.e. first protocol)
1147 * involving PLLLC registers and registers for first 2 lanes of PHY.
1148 * [2] In second step, the variables phy_t1 and phy_t2 are swapped. So now,
1149 * phy_t1 = TYPE_QSGMII and phy_t2 = TYPE_PCIE. And the register values are selected as
1150 * [TYPE_QSGMII][TYPE_PCIE][ssc].
1151 * This will configure PHY registers associated for QSGMII (i.e. second protocol)
1152 * involving PLLLC1 registers and registers for other 2 lanes of PHY.
1153 *
1154 * This completes the PHY configuration for multilink operation. This approach enables
1155 * dividing the large number of PHY register configurations into protocol specific
1156 * smaller groups.
1157 */
1158 for (node = 0; node < sp->nsubnodes; node++) {
1159 if (node == 1) {
1160 /*
1161 * If first link with phy_t1 is configured, then configure the PHY for
1162 * second link with phy_t2. Get the array values as [phy_t2][phy_t1][ssc].
1163 */
1164 swap(phy_t1, phy_t2);
1165 }
1166
1167 mlane = sp->phys[node].mlane;
1168 ssc = sp->phys[node].ssc_mode;
1169 num_lanes = sp->phys[node].num_lanes;
1170
1171 /* PHY PCS common registers configurations */
1172 pcs_cmn_vals = init_data->pcs_cmn_vals[phy_t1][phy_t2][ssc];
1173 if (pcs_cmn_vals) {
1174 reg_pairs = pcs_cmn_vals->reg_pairs;
1175 num_regs = pcs_cmn_vals->num_regs;
1176 regmap = sp->regmap_phy_pcs_common_cdb;
1177 for (i = 0; i < num_regs; i++)
1178 regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
1179 }
1180
1181 /* PHY PMA lane registers configurations */
1182 phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_t1][phy_t2][ssc];
1183 if (phy_pma_ln_vals) {
1184 reg_pairs = phy_pma_ln_vals->reg_pairs;
1185 num_regs = phy_pma_ln_vals->num_regs;
1186 for (i = 0; i < num_lanes; i++) {
1187 regmap = sp->regmap_phy_pma_lane_cdb[i + mlane];
1188 for (j = 0; j < num_regs; j++)
1189 regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
1190 }
1191 }
1192
1193 /* PMA common registers configurations */
1194 pma_cmn_vals = init_data->pma_cmn_vals[phy_t1][phy_t2][ssc];
1195 if (pma_cmn_vals) {
1196 reg_pairs = pma_cmn_vals->reg_pairs;
1197 num_regs = pma_cmn_vals->num_regs;
1198 regmap = sp->regmap_common_cdb;
1199 for (i = 0; i < num_regs; i++)
1200 regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val);
1201 }
1202
1203 /* PMA lane registers configurations */
1204 pma_ln_vals = init_data->pma_ln_vals[phy_t1][phy_t2][ssc];
1205 if (pma_ln_vals) {
1206 reg_pairs = pma_ln_vals->reg_pairs;
1207 num_regs = pma_ln_vals->num_regs;
1208 for (i = 0; i < num_lanes; i++) {
1209 regmap = sp->regmap_lane_cdb[i + mlane];
1210 for (j = 0; j < num_regs; j++)
1211 regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val);
1212 }
1213 }
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01001214
1215 if (phy_t1 == TYPE_QSGMII)
1216 reset_control_deassert(sp->phys[node].lnk_rst);
Swapnil Jakhade6b81f052021-12-23 07:01:34 +01001217 }
1218
1219 /* Take the PHY out of reset */
1220 ret = reset_control_deassert(sp->phy_rst);
1221 if (ret)
1222 return ret;
1223
1224 return 0;
1225}
1226
Alan Douglas44d30d62018-11-12 16:42:16 +00001227static int cdns_sierra_phy_probe(struct platform_device *pdev)
1228{
1229 struct cdns_sierra_phy *sp;
1230 struct phy_provider *phy_provider;
1231 struct device *dev = &pdev->dev;
Swapnil Jakhadec3c11d52021-12-23 07:01:23 +01001232 const struct cdns_sierra_data *data;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301233 unsigned int id_value;
Alan Douglas44d30d62018-11-12 16:42:16 +00001234 int i, ret, node = 0;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301235 void __iomem *base;
Alan Douglas44d30d62018-11-12 16:42:16 +00001236 struct device_node *dn = dev->of_node, *child;
1237
1238 if (of_get_child_count(dn) == 0)
1239 return -ENODEV;
1240
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301241 /* Get init data for this PHY */
Swapnil Jakhadec3c11d52021-12-23 07:01:23 +01001242 data = of_device_get_match_data(dev);
1243 if (!data)
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301244 return -EINVAL;
1245
Alan Douglas44d30d62018-11-12 16:42:16 +00001246 sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL);
1247 if (!sp)
1248 return -ENOMEM;
1249 dev_set_drvdata(dev, sp);
1250 sp->dev = dev;
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301251 sp->init_data = data;
Alan Douglas44d30d62018-11-12 16:42:16 +00001252
Chunfeng Yunfa629092020-11-06 14:08:37 +08001253 base = devm_platform_ioremap_resource(pdev, 0);
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301254 if (IS_ERR(base)) {
Alan Douglas44d30d62018-11-12 16:42:16 +00001255 dev_err(dev, "missing \"reg\"\n");
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301256 return PTR_ERR(base);
Alan Douglas44d30d62018-11-12 16:42:16 +00001257 }
1258
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301259 ret = cdns_regmap_init_blocks(sp, base, data->block_offset_shift,
1260 data->reg_offset_shift);
1261 if (ret)
1262 return ret;
1263
1264 ret = cdns_regfield_init(sp);
1265 if (ret)
1266 return ret;
Alan Douglas44d30d62018-11-12 16:42:16 +00001267
1268 platform_set_drvdata(pdev, sp);
1269
Kishon Vijay Abraham I7e016cb2021-03-19 18:11:20 +05301270 ret = cdns_sierra_phy_get_clocks(sp, dev);
1271 if (ret)
1272 return ret;
Alan Douglas44d30d62018-11-12 16:42:16 +00001273
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +05301274 ret = cdns_sierra_clk_register(sp);
Kishon Vijay Abraham I1d5f40e2021-03-19 18:11:21 +05301275 if (ret)
1276 return ret;
Alan Douglas44d30d62018-11-12 16:42:16 +00001277
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +05301278 ret = cdns_sierra_phy_get_resets(sp, dev);
1279 if (ret)
1280 goto unregister_clk;
1281
Kishon Vijay Abraham I1436ec32021-03-19 18:11:28 +05301282 ret = cdns_sierra_phy_enable_clocks(sp);
Alan Douglas44d30d62018-11-12 16:42:16 +00001283 if (ret)
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +05301284 goto unregister_clk;
Alan Douglas44d30d62018-11-12 16:42:16 +00001285
1286 /* Enable APB */
1287 reset_control_deassert(sp->apb_rst);
1288
1289 /* Check that PHY is present */
Kishon Vijay Abraham I380f5702019-12-16 15:27:01 +05301290 regmap_field_read(sp->macro_id_type, &id_value);
1291 if (sp->init_data->id_value != id_value) {
Alan Douglas44d30d62018-11-12 16:42:16 +00001292 ret = -EINVAL;
1293 goto clk_disable;
1294 }
1295
1296 sp->autoconf = of_property_read_bool(dn, "cdns,autoconf");
1297
1298 for_each_available_child_of_node(dn, child) {
1299 struct phy *gphy;
1300
Kishon Vijay Abraham I03ada5a32021-03-19 18:11:18 +05301301 if (!(of_node_name_eq(child, "phy") ||
1302 of_node_name_eq(child, "link")))
1303 continue;
1304
Alan Douglas44d30d62018-11-12 16:42:16 +00001305 sp->phys[node].lnk_rst =
Kishon Vijay Abraham Ib8729362019-12-16 15:27:06 +05301306 of_reset_control_array_get_exclusive(child);
Alan Douglas44d30d62018-11-12 16:42:16 +00001307
1308 if (IS_ERR(sp->phys[node].lnk_rst)) {
1309 dev_err(dev, "failed to get reset %s\n",
1310 child->full_name);
1311 ret = PTR_ERR(sp->phys[node].lnk_rst);
1312 goto put_child2;
1313 }
1314
1315 if (!sp->autoconf) {
1316 ret = cdns_sierra_get_optional(&sp->phys[node], child);
1317 if (ret) {
1318 dev_err(dev, "missing property in node %s\n",
1319 child->name);
1320 goto put_child;
1321 }
1322 }
1323
Kishon Vijay Abraham Ia43f72a2019-12-16 15:27:08 +05301324 sp->num_lanes += sp->phys[node].num_lanes;
1325
Alan Douglas44d30d62018-11-12 16:42:16 +00001326 gphy = devm_phy_create(dev, child, &ops);
1327
1328 if (IS_ERR(gphy)) {
1329 ret = PTR_ERR(gphy);
1330 goto put_child;
1331 }
1332 sp->phys[node].phy = gphy;
1333 phy_set_drvdata(gphy, &sp->phys[node]);
1334
Alan Douglas44d30d62018-11-12 16:42:16 +00001335 node++;
1336 }
1337 sp->nsubnodes = node;
1338
Kishon Vijay Abraham Ia43f72a2019-12-16 15:27:08 +05301339 if (sp->num_lanes > SIERRA_MAX_LANES) {
Wang Wensheng6411e382021-05-17 01:57:49 +00001340 ret = -EINVAL;
Kishon Vijay Abraham Ia43f72a2019-12-16 15:27:08 +05301341 dev_err(dev, "Invalid lane configuration\n");
1342 goto put_child2;
1343 }
1344
Alan Douglas44d30d62018-11-12 16:42:16 +00001345 /* If more than one subnode, configure the PHY as multilink */
Swapnil Jakhade6b81f052021-12-23 07:01:34 +01001346 if (!sp->autoconf && sp->nsubnodes > 1) {
1347 ret = cdns_sierra_phy_configure_multilink(sp);
1348 if (ret)
1349 goto put_child2;
1350 }
Alan Douglas44d30d62018-11-12 16:42:16 +00001351
1352 pm_runtime_enable(dev);
1353 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
Alan Douglas44d30d62018-11-12 16:42:16 +00001354 return PTR_ERR_OR_ZERO(phy_provider);
1355
1356put_child:
1357 node++;
1358put_child2:
1359 for (i = 0; i < node; i++)
1360 reset_control_put(sp->phys[i].lnk_rst);
1361 of_node_put(child);
1362clk_disable:
Kishon Vijay Abraham I1436ec32021-03-19 18:11:28 +05301363 cdns_sierra_phy_disable_clocks(sp);
Alan Douglas44d30d62018-11-12 16:42:16 +00001364 reset_control_assert(sp->apb_rst);
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +05301365unregister_clk:
1366 cdns_sierra_clk_unregister(sp);
Alan Douglas44d30d62018-11-12 16:42:16 +00001367 return ret;
1368}
1369
1370static int cdns_sierra_phy_remove(struct platform_device *pdev)
1371{
Kishon Vijay Abraham I748e3452019-12-16 15:27:10 +05301372 struct cdns_sierra_phy *phy = platform_get_drvdata(pdev);
Alan Douglas44d30d62018-11-12 16:42:16 +00001373 int i;
1374
1375 reset_control_assert(phy->phy_rst);
1376 reset_control_assert(phy->apb_rst);
1377 pm_runtime_disable(&pdev->dev);
1378
Kishon Vijay Abraham I1436ec32021-03-19 18:11:28 +05301379 cdns_sierra_phy_disable_clocks(phy);
Alan Douglas44d30d62018-11-12 16:42:16 +00001380 /*
1381 * The device level resets will be put automatically.
1382 * Need to put the subnode resets here though.
1383 */
1384 for (i = 0; i < phy->nsubnodes; i++) {
1385 reset_control_assert(phy->phys[i].lnk_rst);
1386 reset_control_put(phy->phys[i].lnk_rst);
1387 }
Kishon Vijay Abraham I29c2d022021-03-19 18:11:25 +05301388
Kishon Vijay Abraham I28081b72021-03-19 18:11:27 +05301389 cdns_sierra_clk_unregister(phy);
Kishon Vijay Abraham I29c2d022021-03-19 18:11:25 +05301390
Alan Douglas44d30d62018-11-12 16:42:16 +00001391 return 0;
1392}
1393
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01001394/* QSGMII PHY PMA lane configuration */
1395static struct cdns_reg_pairs qsgmii_phy_pma_ln_regs[] = {
1396 {0x9010, SIERRA_PHY_PMA_XCVR_CTRL}
1397};
1398
1399static struct cdns_sierra_vals qsgmii_phy_pma_ln_vals = {
1400 .reg_pairs = qsgmii_phy_pma_ln_regs,
1401 .num_regs = ARRAY_SIZE(qsgmii_phy_pma_ln_regs),
1402};
1403
1404/* QSGMII refclk 100MHz, 20b, opt1, No BW cal, no ssc, PLL LC1 */
1405static const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_cmn_regs[] = {
1406 {0x2085, SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG},
1407 {0x0000, SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG},
1408 {0x0000, SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG}
1409};
1410
1411static const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_ln_regs[] = {
1412 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1413 {0x0252, SIERRA_DET_STANDEC_E_PREG},
1414 {0x0004, SIERRA_PSC_LN_IDLE_PREG},
1415 {0x0FFE, SIERRA_PSC_RX_A0_PREG},
1416 {0x0011, SIERRA_PLLCTRL_SUBRATE_PREG},
1417 {0x0001, SIERRA_PLLCTRL_GEN_A_PREG},
1418 {0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG},
1419 {0x0000, SIERRA_DRVCTRL_ATTEN_PREG},
1420 {0x0089, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
1421 {0x3C3C, SIERRA_CREQ_CCLKDET_MODE01_PREG},
1422 {0x3222, SIERRA_CREQ_FSMCLK_SEL_PREG},
1423 {0x0000, SIERRA_CREQ_EQ_CTRL_PREG},
1424 {0x8422, SIERRA_CTLELUT_CTRL_PREG},
1425 {0x4111, SIERRA_DFE_ECMP_RATESEL_PREG},
1426 {0x4111, SIERRA_DFE_SMP_RATESEL_PREG},
1427 {0x0002, SIERRA_DEQ_PHALIGN_CTRL},
1428 {0x9595, SIERRA_DEQ_VGATUNE_CTRL_PREG},
1429 {0x0186, SIERRA_DEQ_GLUT0},
1430 {0x0186, SIERRA_DEQ_GLUT1},
1431 {0x0186, SIERRA_DEQ_GLUT2},
1432 {0x0186, SIERRA_DEQ_GLUT3},
1433 {0x0186, SIERRA_DEQ_GLUT4},
1434 {0x0861, SIERRA_DEQ_ALUT0},
1435 {0x07E0, SIERRA_DEQ_ALUT1},
1436 {0x079E, SIERRA_DEQ_ALUT2},
1437 {0x071D, SIERRA_DEQ_ALUT3},
1438 {0x03F5, SIERRA_DEQ_DFETAP_CTRL_PREG},
1439 {0x0C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG},
1440 {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1441 {0x1C04, SIERRA_DEQ_TAU_CTRL2_PREG},
1442 {0x0033, SIERRA_DEQ_PICTRL_PREG},
1443 {0x0660, SIERRA_CPICAL_TMRVAL_MODE0_PREG},
1444 {0x00D5, SIERRA_CPI_OUTBUF_RATESEL_PREG},
1445 {0x0B6D, SIERRA_CPI_RESBIAS_BIN_PREG},
1446 {0x0102, SIERRA_RXBUFFER_CTLECTRL_PREG},
1447 {0x0002, SIERRA_RXBUFFER_RCDFECTRL_PREG}
1448};
1449
1450static struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_cmn_vals = {
1451 .reg_pairs = qsgmii_100_no_ssc_plllc1_cmn_regs,
1452 .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_cmn_regs),
1453};
1454
1455static struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_ln_vals = {
1456 .reg_pairs = qsgmii_100_no_ssc_plllc1_ln_regs,
1457 .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_ln_regs),
1458};
1459
Swapnil Jakhadefa105172021-12-23 07:01:29 +01001460/* PCIE PHY PCS common configuration */
1461static struct cdns_reg_pairs pcie_phy_pcs_cmn_regs[] = {
1462 {0x0430, SIERRA_PHY_PIPE_CMN_CTRL1}
1463};
1464
1465static struct cdns_sierra_vals pcie_phy_pcs_cmn_vals = {
1466 .reg_pairs = pcie_phy_pcs_cmn_regs,
1467 .num_regs = ARRAY_SIZE(pcie_phy_pcs_cmn_regs),
1468};
1469
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01001470/* refclk100MHz_32b_PCIe_cmn_pll_no_ssc, pcie_links_using_plllc, pipe_bw_3 */
1471static const struct cdns_reg_pairs pcie_100_no_ssc_plllc_cmn_regs[] = {
1472 {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1473 {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1474 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1475 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}
1476};
1477
1478/*
1479 * refclk100MHz_32b_PCIe_ln_no_ssc, multilink, using_plllc,
1480 * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz
1481 */
1482static const struct cdns_reg_pairs ml_pcie_100_no_ssc_ln_regs[] = {
1483 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1484 {0x001D, SIERRA_PSM_A3IN_TMR_PREG},
1485 {0x0004, SIERRA_PSC_LN_A3_PREG},
1486 {0x0004, SIERRA_PSC_LN_A4_PREG},
1487 {0x0004, SIERRA_PSC_LN_IDLE_PREG},
1488 {0x1555, SIERRA_DFE_BIASTRIM_PREG},
1489 {0x9703, SIERRA_DRVCTRL_BOOST_PREG},
1490 {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
1491 {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
1492 {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1493 {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
1494 {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
1495 {0x9800, SIERRA_RX_CTLE_CAL_PREG},
1496 {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1497 {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1498 {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1499 {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1500 {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
1501 {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
1502 {0x0041, SIERRA_DEQ_GLUT0},
1503 {0x0082, SIERRA_DEQ_GLUT1},
1504 {0x00C3, SIERRA_DEQ_GLUT2},
1505 {0x0145, SIERRA_DEQ_GLUT3},
1506 {0x0186, SIERRA_DEQ_GLUT4},
1507 {0x09E7, SIERRA_DEQ_ALUT0},
1508 {0x09A6, SIERRA_DEQ_ALUT1},
1509 {0x0965, SIERRA_DEQ_ALUT2},
1510 {0x08E3, SIERRA_DEQ_ALUT3},
1511 {0x00FA, SIERRA_DEQ_DFETAP0},
1512 {0x00FA, SIERRA_DEQ_DFETAP1},
1513 {0x00FA, SIERRA_DEQ_DFETAP2},
1514 {0x00FA, SIERRA_DEQ_DFETAP3},
1515 {0x00FA, SIERRA_DEQ_DFETAP4},
1516 {0x000F, SIERRA_DEQ_PRECUR_PREG},
1517 {0x0280, SIERRA_DEQ_POSTCUR_PREG},
1518 {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
1519 {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1520 {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
1521 {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
1522 {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
1523 {0x002B, SIERRA_CPI_TRIM_PREG},
1524 {0x0003, SIERRA_EPI_CTRL_PREG},
1525 {0x803F, SIERRA_SDFILT_H2L_A_PREG},
1526 {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
1527 {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
1528 {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
1529};
1530
1531static struct cdns_sierra_vals pcie_100_no_ssc_plllc_cmn_vals = {
1532 .reg_pairs = pcie_100_no_ssc_plllc_cmn_regs,
1533 .num_regs = ARRAY_SIZE(pcie_100_no_ssc_plllc_cmn_regs),
1534};
1535
1536static struct cdns_sierra_vals ml_pcie_100_no_ssc_ln_vals = {
1537 .reg_pairs = ml_pcie_100_no_ssc_ln_regs,
1538 .num_regs = ARRAY_SIZE(ml_pcie_100_no_ssc_ln_regs),
1539};
1540
1541/* refclk100MHz_32b_PCIe_cmn_pll_int_ssc, pcie_links_using_plllc, pipe_bw_3 */
1542static const struct cdns_reg_pairs pcie_100_int_ssc_plllc_cmn_regs[] = {
1543 {0x000E, SIERRA_CMN_PLLLC_MODE_PREG},
1544 {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1545 {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1546 {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1547 {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
1548 {0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG},
1549 {0x7F80, SIERRA_CMN_PLLLC_SS_PREG},
1550 {0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG},
1551 {0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG},
1552 {0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG},
1553 {0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG}
1554};
1555
1556/*
1557 * refclk100MHz_32b_PCIe_ln_int_ssc, multilink, using_plllc,
1558 * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz
1559 */
1560static const struct cdns_reg_pairs ml_pcie_100_int_ssc_ln_regs[] = {
1561 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1562 {0x001D, SIERRA_PSM_A3IN_TMR_PREG},
1563 {0x0004, SIERRA_PSC_LN_A3_PREG},
1564 {0x0004, SIERRA_PSC_LN_A4_PREG},
1565 {0x0004, SIERRA_PSC_LN_IDLE_PREG},
1566 {0x1555, SIERRA_DFE_BIASTRIM_PREG},
1567 {0x9703, SIERRA_DRVCTRL_BOOST_PREG},
1568 {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
1569 {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
1570 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
1571 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1572 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
1573 {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
1574 {0x9800, SIERRA_RX_CTLE_CAL_PREG},
1575 {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
1576 {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
1577 {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1578 {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1579 {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1580 {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1581 {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
1582 {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
1583 {0x0041, SIERRA_DEQ_GLUT0},
1584 {0x0082, SIERRA_DEQ_GLUT1},
1585 {0x00C3, SIERRA_DEQ_GLUT2},
1586 {0x0145, SIERRA_DEQ_GLUT3},
1587 {0x0186, SIERRA_DEQ_GLUT4},
1588 {0x09E7, SIERRA_DEQ_ALUT0},
1589 {0x09A6, SIERRA_DEQ_ALUT1},
1590 {0x0965, SIERRA_DEQ_ALUT2},
1591 {0x08E3, SIERRA_DEQ_ALUT3},
1592 {0x00FA, SIERRA_DEQ_DFETAP0},
1593 {0x00FA, SIERRA_DEQ_DFETAP1},
1594 {0x00FA, SIERRA_DEQ_DFETAP2},
1595 {0x00FA, SIERRA_DEQ_DFETAP3},
1596 {0x00FA, SIERRA_DEQ_DFETAP4},
1597 {0x000F, SIERRA_DEQ_PRECUR_PREG},
1598 {0x0280, SIERRA_DEQ_POSTCUR_PREG},
1599 {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
1600 {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1601 {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
1602 {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
1603 {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
1604 {0x002B, SIERRA_CPI_TRIM_PREG},
1605 {0x0003, SIERRA_EPI_CTRL_PREG},
1606 {0x803F, SIERRA_SDFILT_H2L_A_PREG},
1607 {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
1608 {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
1609 {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
1610};
1611
1612static struct cdns_sierra_vals pcie_100_int_ssc_plllc_cmn_vals = {
1613 .reg_pairs = pcie_100_int_ssc_plllc_cmn_regs,
1614 .num_regs = ARRAY_SIZE(pcie_100_int_ssc_plllc_cmn_regs),
1615};
1616
1617static struct cdns_sierra_vals ml_pcie_100_int_ssc_ln_vals = {
1618 .reg_pairs = ml_pcie_100_int_ssc_ln_regs,
1619 .num_regs = ARRAY_SIZE(ml_pcie_100_int_ssc_ln_regs),
1620};
1621
1622/* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc, pcie_links_using_plllc, pipe_bw_3 */
1623static const struct cdns_reg_pairs pcie_100_ext_ssc_plllc_cmn_regs[] = {
1624 {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1625 {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1626 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1627 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
1628 {0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}
1629};
1630
1631/*
1632 * refclk100MHz_32b_PCIe_ln_ext_ssc, multilink, using_plllc,
1633 * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz
1634 */
1635static const struct cdns_reg_pairs ml_pcie_100_ext_ssc_ln_regs[] = {
1636 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1637 {0x001D, SIERRA_PSM_A3IN_TMR_PREG},
1638 {0x0004, SIERRA_PSC_LN_A3_PREG},
1639 {0x0004, SIERRA_PSC_LN_A4_PREG},
1640 {0x0004, SIERRA_PSC_LN_IDLE_PREG},
1641 {0x1555, SIERRA_DFE_BIASTRIM_PREG},
1642 {0x9703, SIERRA_DRVCTRL_BOOST_PREG},
1643 {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
1644 {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
1645 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
1646 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1647 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
1648 {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
1649 {0x9800, SIERRA_RX_CTLE_CAL_PREG},
1650 {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
1651 {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
1652 {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1653 {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1654 {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1655 {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1656 {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
1657 {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
1658 {0x0041, SIERRA_DEQ_GLUT0},
1659 {0x0082, SIERRA_DEQ_GLUT1},
1660 {0x00C3, SIERRA_DEQ_GLUT2},
1661 {0x0145, SIERRA_DEQ_GLUT3},
1662 {0x0186, SIERRA_DEQ_GLUT4},
1663 {0x09E7, SIERRA_DEQ_ALUT0},
1664 {0x09A6, SIERRA_DEQ_ALUT1},
1665 {0x0965, SIERRA_DEQ_ALUT2},
1666 {0x08E3, SIERRA_DEQ_ALUT3},
1667 {0x00FA, SIERRA_DEQ_DFETAP0},
1668 {0x00FA, SIERRA_DEQ_DFETAP1},
1669 {0x00FA, SIERRA_DEQ_DFETAP2},
1670 {0x00FA, SIERRA_DEQ_DFETAP3},
1671 {0x00FA, SIERRA_DEQ_DFETAP4},
1672 {0x000F, SIERRA_DEQ_PRECUR_PREG},
1673 {0x0280, SIERRA_DEQ_POSTCUR_PREG},
1674 {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
1675 {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1676 {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
1677 {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
1678 {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
1679 {0x002B, SIERRA_CPI_TRIM_PREG},
1680 {0x0003, SIERRA_EPI_CTRL_PREG},
1681 {0x803F, SIERRA_SDFILT_H2L_A_PREG},
1682 {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
1683 {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
1684 {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
1685};
1686
1687static struct cdns_sierra_vals pcie_100_ext_ssc_plllc_cmn_vals = {
1688 .reg_pairs = pcie_100_ext_ssc_plllc_cmn_regs,
1689 .num_regs = ARRAY_SIZE(pcie_100_ext_ssc_plllc_cmn_regs),
1690};
1691
1692static struct cdns_sierra_vals ml_pcie_100_ext_ssc_ln_vals = {
1693 .reg_pairs = ml_pcie_100_ext_ssc_ln_regs,
1694 .num_regs = ARRAY_SIZE(ml_pcie_100_ext_ssc_ln_regs),
1695};
1696
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01001697/* refclk100MHz_32b_PCIe_cmn_pll_no_ssc */
1698static const struct cdns_reg_pairs cdns_pcie_cmn_regs_no_ssc[] = {
1699 {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1700 {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1701 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1702 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}
1703};
1704
1705/* refclk100MHz_32b_PCIe_ln_no_ssc */
1706static const struct cdns_reg_pairs cdns_pcie_ln_regs_no_ssc[] = {
1707 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1708 {0x001D, SIERRA_PSM_A3IN_TMR_PREG},
1709 {0x1555, SIERRA_DFE_BIASTRIM_PREG},
1710 {0x9703, SIERRA_DRVCTRL_BOOST_PREG},
1711 {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
1712 {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
1713 {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1714 {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
1715 {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
1716 {0x9800, SIERRA_RX_CTLE_CAL_PREG},
1717 {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1718 {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1719 {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1720 {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1721 {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
1722 {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
1723 {0x0041, SIERRA_DEQ_GLUT0},
1724 {0x0082, SIERRA_DEQ_GLUT1},
1725 {0x00C3, SIERRA_DEQ_GLUT2},
1726 {0x0145, SIERRA_DEQ_GLUT3},
1727 {0x0186, SIERRA_DEQ_GLUT4},
1728 {0x09E7, SIERRA_DEQ_ALUT0},
1729 {0x09A6, SIERRA_DEQ_ALUT1},
1730 {0x0965, SIERRA_DEQ_ALUT2},
1731 {0x08E3, SIERRA_DEQ_ALUT3},
1732 {0x00FA, SIERRA_DEQ_DFETAP0},
1733 {0x00FA, SIERRA_DEQ_DFETAP1},
1734 {0x00FA, SIERRA_DEQ_DFETAP2},
1735 {0x00FA, SIERRA_DEQ_DFETAP3},
1736 {0x00FA, SIERRA_DEQ_DFETAP4},
1737 {0x000F, SIERRA_DEQ_PRECUR_PREG},
1738 {0x0280, SIERRA_DEQ_POSTCUR_PREG},
1739 {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
1740 {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1741 {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
1742 {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
1743 {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
1744 {0x002B, SIERRA_CPI_TRIM_PREG},
1745 {0x0003, SIERRA_EPI_CTRL_PREG},
1746 {0x803F, SIERRA_SDFILT_H2L_A_PREG},
1747 {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
1748 {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
1749 {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
1750};
1751
1752static struct cdns_sierra_vals pcie_100_no_ssc_cmn_vals = {
1753 .reg_pairs = cdns_pcie_cmn_regs_no_ssc,
1754 .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_no_ssc),
1755};
1756
1757static struct cdns_sierra_vals pcie_100_no_ssc_ln_vals = {
1758 .reg_pairs = cdns_pcie_ln_regs_no_ssc,
1759 .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_no_ssc),
1760};
1761
1762/* refclk100MHz_32b_PCIe_cmn_pll_int_ssc */
1763static const struct cdns_reg_pairs cdns_pcie_cmn_regs_int_ssc[] = {
1764 {0x000E, SIERRA_CMN_PLLLC_MODE_PREG},
1765 {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1766 {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1767 {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1768 {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
1769 {0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG},
1770 {0x7F80, SIERRA_CMN_PLLLC_SS_PREG},
1771 {0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG},
1772 {0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG},
1773 {0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG},
1774 {0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG}
1775};
1776
1777/* refclk100MHz_32b_PCIe_ln_int_ssc */
1778static const struct cdns_reg_pairs cdns_pcie_ln_regs_int_ssc[] = {
1779 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1780 {0x001D, SIERRA_PSM_A3IN_TMR_PREG},
1781 {0x1555, SIERRA_DFE_BIASTRIM_PREG},
1782 {0x9703, SIERRA_DRVCTRL_BOOST_PREG},
1783 {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
1784 {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
1785 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
1786 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1787 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
1788 {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
1789 {0x9800, SIERRA_RX_CTLE_CAL_PREG},
1790 {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
1791 {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
1792 {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1793 {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1794 {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1795 {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1796 {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
1797 {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
1798 {0x0041, SIERRA_DEQ_GLUT0},
1799 {0x0082, SIERRA_DEQ_GLUT1},
1800 {0x00C3, SIERRA_DEQ_GLUT2},
1801 {0x0145, SIERRA_DEQ_GLUT3},
1802 {0x0186, SIERRA_DEQ_GLUT4},
1803 {0x09E7, SIERRA_DEQ_ALUT0},
1804 {0x09A6, SIERRA_DEQ_ALUT1},
1805 {0x0965, SIERRA_DEQ_ALUT2},
1806 {0x08E3, SIERRA_DEQ_ALUT3},
1807 {0x00FA, SIERRA_DEQ_DFETAP0},
1808 {0x00FA, SIERRA_DEQ_DFETAP1},
1809 {0x00FA, SIERRA_DEQ_DFETAP2},
1810 {0x00FA, SIERRA_DEQ_DFETAP3},
1811 {0x00FA, SIERRA_DEQ_DFETAP4},
1812 {0x000F, SIERRA_DEQ_PRECUR_PREG},
1813 {0x0280, SIERRA_DEQ_POSTCUR_PREG},
1814 {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
1815 {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1816 {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
1817 {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
1818 {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
1819 {0x002B, SIERRA_CPI_TRIM_PREG},
1820 {0x0003, SIERRA_EPI_CTRL_PREG},
1821 {0x803F, SIERRA_SDFILT_H2L_A_PREG},
1822 {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
1823 {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
1824 {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
1825};
1826
1827static struct cdns_sierra_vals pcie_100_int_ssc_cmn_vals = {
1828 .reg_pairs = cdns_pcie_cmn_regs_int_ssc,
1829 .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_int_ssc),
1830};
1831
1832static struct cdns_sierra_vals pcie_100_int_ssc_ln_vals = {
1833 .reg_pairs = cdns_pcie_ln_regs_int_ssc,
1834 .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_int_ssc),
1835};
1836
Anil Varughese871002d2019-12-16 15:27:05 +05301837/* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc */
Rikard Falkeborn3cfb0e82020-09-12 22:46:37 +02001838static const struct cdns_reg_pairs cdns_pcie_cmn_regs_ext_ssc[] = {
Anil Varughese871002d2019-12-16 15:27:05 +05301839 {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1840 {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1841 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG},
1842 {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
1843 {0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}
1844};
1845
1846/* refclk100MHz_32b_PCIe_ln_ext_ssc */
Rikard Falkeborn3cfb0e82020-09-12 22:46:37 +02001847static const struct cdns_reg_pairs cdns_pcie_ln_regs_ext_ssc[] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01001848 {0xFC08, SIERRA_DET_STANDEC_A_PREG},
1849 {0x001D, SIERRA_PSM_A3IN_TMR_PREG},
1850 {0x1555, SIERRA_DFE_BIASTRIM_PREG},
1851 {0x9703, SIERRA_DRVCTRL_BOOST_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301852 {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG},
1853 {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG},
1854 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG},
1855 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1856 {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01001857 {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG},
1858 {0x9800, SIERRA_RX_CTLE_CAL_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301859 {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01001860 {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
1861 {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1862 {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1863 {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1864 {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1865 {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG},
1866 {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG},
1867 {0x0041, SIERRA_DEQ_GLUT0},
1868 {0x0082, SIERRA_DEQ_GLUT1},
1869 {0x00C3, SIERRA_DEQ_GLUT2},
1870 {0x0145, SIERRA_DEQ_GLUT3},
1871 {0x0186, SIERRA_DEQ_GLUT4},
1872 {0x09E7, SIERRA_DEQ_ALUT0},
1873 {0x09A6, SIERRA_DEQ_ALUT1},
1874 {0x0965, SIERRA_DEQ_ALUT2},
1875 {0x08E3, SIERRA_DEQ_ALUT3},
1876 {0x00FA, SIERRA_DEQ_DFETAP0},
1877 {0x00FA, SIERRA_DEQ_DFETAP1},
1878 {0x00FA, SIERRA_DEQ_DFETAP2},
1879 {0x00FA, SIERRA_DEQ_DFETAP3},
1880 {0x00FA, SIERRA_DEQ_DFETAP4},
1881 {0x000F, SIERRA_DEQ_PRECUR_PREG},
1882 {0x0280, SIERRA_DEQ_POSTCUR_PREG},
1883 {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG},
1884 {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1885 {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG},
1886 {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG},
1887 {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG},
1888 {0x002B, SIERRA_CPI_TRIM_PREG},
1889 {0x0003, SIERRA_EPI_CTRL_PREG},
1890 {0x803F, SIERRA_SDFILT_H2L_A_PREG},
1891 {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG},
1892 {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG},
1893 {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}
Anil Varughese871002d2019-12-16 15:27:05 +05301894};
1895
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01001896static struct cdns_sierra_vals pcie_100_ext_ssc_cmn_vals = {
1897 .reg_pairs = cdns_pcie_cmn_regs_ext_ssc,
1898 .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_ext_ssc),
1899};
1900
1901static struct cdns_sierra_vals pcie_100_ext_ssc_ln_vals = {
1902 .reg_pairs = cdns_pcie_ln_regs_ext_ssc,
1903 .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_ext_ssc),
1904};
1905
Anil Varughese871002d2019-12-16 15:27:05 +05301906/* refclk100MHz_20b_USB_cmn_pll_ext_ssc */
Rikard Falkeborn3cfb0e82020-09-12 22:46:37 +02001907static const struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = {
Anil Varughese871002d2019-12-16 15:27:05 +05301908 {0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG},
1909 {0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG},
1910 {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG},
1911 {0x0000, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}
1912};
1913
1914/* refclk100MHz_20b_USB_ln_ext_ssc */
Rikard Falkeborn3cfb0e82020-09-12 22:46:37 +02001915static const struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = {
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301916 {0xFE0A, SIERRA_DET_STANDEC_A_PREG},
1917 {0x000F, SIERRA_DET_STANDEC_B_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001918 {0x55A5, SIERRA_DET_STANDEC_C_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301919 {0x69ad, SIERRA_DET_STANDEC_D_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301920 {0x0241, SIERRA_DET_STANDEC_E_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001921 {0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301922 {0x0014, SIERRA_PSM_A0IN_TMR_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301923 {0xCF00, SIERRA_PSM_DIAG_PREG},
1924 {0x001F, SIERRA_PSC_TX_A0_PREG},
1925 {0x0007, SIERRA_PSC_TX_A1_PREG},
1926 {0x0003, SIERRA_PSC_TX_A2_PREG},
1927 {0x0003, SIERRA_PSC_TX_A3_PREG},
1928 {0x0FFF, SIERRA_PSC_RX_A0_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001929 {0x0003, SIERRA_PSC_RX_A1_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301930 {0x0003, SIERRA_PSC_RX_A2_PREG},
1931 {0x0001, SIERRA_PSC_RX_A3_PREG},
1932 {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG},
1933 {0x0406, SIERRA_PLLCTRL_GEN_D_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301934 {0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG},
1935 {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG},
1936 {0x2512, SIERRA_DFE_BIASTRIM_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301937 {0x0000, SIERRA_DRVCTRL_ATTEN_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001938 {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG},
1939 {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG},
1940 {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301941 {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001942 {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301943 {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301944 {0x0000, SIERRA_CREQ_EQ_CTRL_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001945 {0x0000, SIERRA_CREQ_SPARE_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301946 {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001947 {0x8452, SIERRA_CTLELUT_CTRL_PREG},
1948 {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG},
1949 {0x4121, SIERRA_DFE_SMP_RATESEL_PREG},
1950 {0x0003, SIERRA_DEQ_PHALIGN_CTRL},
Anil Varughese871002d2019-12-16 15:27:05 +05301951 {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG},
1952 {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG},
1953 {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
1954 {0x0048, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG},
1955 {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG},
1956 {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG},
1957 {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02001958 {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05301959 {0x0014, SIERRA_DEQ_GLUT0},
1960 {0x0014, SIERRA_DEQ_GLUT1},
1961 {0x0014, SIERRA_DEQ_GLUT2},
1962 {0x0014, SIERRA_DEQ_GLUT3},
1963 {0x0014, SIERRA_DEQ_GLUT4},
1964 {0x0014, SIERRA_DEQ_GLUT5},
1965 {0x0014, SIERRA_DEQ_GLUT6},
1966 {0x0014, SIERRA_DEQ_GLUT7},
1967 {0x0014, SIERRA_DEQ_GLUT8},
1968 {0x0014, SIERRA_DEQ_GLUT9},
1969 {0x0014, SIERRA_DEQ_GLUT10},
1970 {0x0014, SIERRA_DEQ_GLUT11},
1971 {0x0014, SIERRA_DEQ_GLUT12},
1972 {0x0014, SIERRA_DEQ_GLUT13},
1973 {0x0014, SIERRA_DEQ_GLUT14},
1974 {0x0014, SIERRA_DEQ_GLUT15},
1975 {0x0014, SIERRA_DEQ_GLUT16},
1976 {0x0BAE, SIERRA_DEQ_ALUT0},
1977 {0x0AEB, SIERRA_DEQ_ALUT1},
1978 {0x0A28, SIERRA_DEQ_ALUT2},
1979 {0x0965, SIERRA_DEQ_ALUT3},
1980 {0x08A2, SIERRA_DEQ_ALUT4},
1981 {0x07DF, SIERRA_DEQ_ALUT5},
1982 {0x071C, SIERRA_DEQ_ALUT6},
1983 {0x0659, SIERRA_DEQ_ALUT7},
1984 {0x0596, SIERRA_DEQ_ALUT8},
1985 {0x0514, SIERRA_DEQ_ALUT9},
1986 {0x0492, SIERRA_DEQ_ALUT10},
1987 {0x0410, SIERRA_DEQ_ALUT11},
1988 {0x038E, SIERRA_DEQ_ALUT12},
1989 {0x030C, SIERRA_DEQ_ALUT13},
1990 {0x03F4, SIERRA_DEQ_DFETAP_CTRL_PREG},
1991 {0x0001, SIERRA_DFE_EN_1010_IGNORE_PREG},
1992 {0x3C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG},
1993 {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG},
1994 {0x1C08, SIERRA_DEQ_TAU_CTRL2_PREG},
1995 {0x0033, SIERRA_DEQ_PICTRL_PREG},
1996 {0x0400, SIERRA_CPICAL_TMRVAL_MODE1_PREG},
1997 {0x0330, SIERRA_CPICAL_TMRVAL_MODE0_PREG},
1998 {0x01FF, SIERRA_CPICAL_PICNT_MODE1_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05301999 {0x0009, SIERRA_CPI_OUTBUF_RATESEL_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05302000 {0x3232, SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG},
2001 {0x0005, SIERRA_LFPSDET_SUPPORT_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05302002 {0x000F, SIERRA_LFPSFILT_NS_PREG},
2003 {0x0009, SIERRA_LFPSFILT_RD_PREG},
2004 {0x0001, SIERRA_LFPSFILT_MP_PREG},
Sanket Parmar2bcf14c2020-05-18 14:14:13 +02002005 {0x6013, SIERRA_SIGDET_SUPPORT_PREG},
Kishon Vijay Abraham Iaead5fd2019-12-16 15:27:04 +05302006 {0x8013, SIERRA_SDFILT_H2L_A_PREG},
Anil Varughese871002d2019-12-16 15:27:05 +05302007 {0x8009, SIERRA_SDFILT_L2H_PREG},
2008 {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG},
2009 {0x0020, SIERRA_RXBUFFER_RCDFECTRL_PREG},
2010 {0x4243, SIERRA_RXBUFFER_DFECTRL_PREG}
Alan Douglas44d30d62018-11-12 16:42:16 +00002011};
2012
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002013static struct cdns_sierra_vals usb_100_ext_ssc_cmn_vals = {
2014 .reg_pairs = cdns_usb_cmn_regs_ext_ssc,
2015 .num_regs = ARRAY_SIZE(cdns_usb_cmn_regs_ext_ssc),
2016};
2017
2018static struct cdns_sierra_vals usb_100_ext_ssc_ln_vals = {
2019 .reg_pairs = cdns_usb_ln_regs_ext_ssc,
2020 .num_regs = ARRAY_SIZE(cdns_usb_ln_regs_ext_ssc),
2021};
2022
Alan Douglas44d30d62018-11-12 16:42:16 +00002023static const struct cdns_sierra_data cdns_map_sierra = {
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002024 .id_value = SIERRA_MACRO_ID,
2025 .block_offset_shift = 0x2,
2026 .reg_offset_shift = 0x2,
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002027 .pcs_cmn_vals = {
2028 [TYPE_PCIE] = {
2029 [TYPE_NONE] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002030 [NO_SSC] = &pcie_phy_pcs_cmn_vals,
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002031 [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002032 [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002033 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002034 [TYPE_QSGMII] = {
2035 [NO_SSC] = &pcie_phy_pcs_cmn_vals,
2036 [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
2037 [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
2038 },
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002039 },
2040 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002041 .pma_cmn_vals = {
2042 [TYPE_PCIE] = {
2043 [TYPE_NONE] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002044 [NO_SSC] = &pcie_100_no_ssc_cmn_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002045 [EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals,
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002046 [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002047 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002048 [TYPE_QSGMII] = {
2049 [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals,
2050 [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals,
2051 [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals,
2052 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002053 },
2054 [TYPE_USB] = {
2055 [TYPE_NONE] = {
2056 [EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals,
2057 },
2058 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002059 [TYPE_QSGMII] = {
2060 [TYPE_PCIE] = {
2061 [NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
2062 [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
2063 [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
2064 },
2065 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002066 },
2067 .pma_ln_vals = {
2068 [TYPE_PCIE] = {
2069 [TYPE_NONE] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002070 [NO_SSC] = &pcie_100_no_ssc_ln_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002071 [EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals,
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002072 [INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002073 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002074 [TYPE_QSGMII] = {
2075 [NO_SSC] = &ml_pcie_100_no_ssc_ln_vals,
2076 [EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals,
2077 [INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals,
2078 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002079 },
2080 [TYPE_USB] = {
2081 [TYPE_NONE] = {
2082 [EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals,
2083 },
2084 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002085 [TYPE_QSGMII] = {
2086 [TYPE_PCIE] = {
2087 [NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
2088 [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
2089 [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
2090 },
2091 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002092 },
Alan Douglas44d30d62018-11-12 16:42:16 +00002093};
2094
Kishon Vijay Abraham I367da972019-12-16 15:27:02 +05302095static const struct cdns_sierra_data cdns_ti_map_sierra = {
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002096 .id_value = SIERRA_MACRO_ID,
2097 .block_offset_shift = 0x0,
2098 .reg_offset_shift = 0x1,
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002099 .pcs_cmn_vals = {
2100 [TYPE_PCIE] = {
2101 [TYPE_NONE] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002102 [NO_SSC] = &pcie_phy_pcs_cmn_vals,
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002103 [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002104 [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002105 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002106 [TYPE_QSGMII] = {
2107 [NO_SSC] = &pcie_phy_pcs_cmn_vals,
2108 [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
2109 [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals,
2110 },
2111 },
2112 },
2113 .phy_pma_ln_vals = {
2114 [TYPE_QSGMII] = {
2115 [TYPE_PCIE] = {
2116 [NO_SSC] = &qsgmii_phy_pma_ln_vals,
2117 [EXTERNAL_SSC] = &qsgmii_phy_pma_ln_vals,
2118 [INTERNAL_SSC] = &qsgmii_phy_pma_ln_vals,
2119 },
Swapnil Jakhadefa105172021-12-23 07:01:29 +01002120 },
2121 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002122 .pma_cmn_vals = {
2123 [TYPE_PCIE] = {
2124 [TYPE_NONE] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002125 [NO_SSC] = &pcie_100_no_ssc_cmn_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002126 [EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals,
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002127 [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002128 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002129 [TYPE_QSGMII] = {
2130 [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals,
2131 [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals,
2132 [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals,
2133 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002134 },
2135 [TYPE_USB] = {
2136 [TYPE_NONE] = {
2137 [EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals,
2138 },
2139 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002140 [TYPE_QSGMII] = {
2141 [TYPE_PCIE] = {
2142 [NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
2143 [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
2144 [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals,
2145 },
2146 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002147 },
2148 .pma_ln_vals = {
2149 [TYPE_PCIE] = {
2150 [TYPE_NONE] = {
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002151 [NO_SSC] = &pcie_100_no_ssc_ln_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002152 [EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals,
Swapnil Jakhade7a5ad9b2021-12-23 07:01:32 +01002153 [INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals,
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002154 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002155 [TYPE_QSGMII] = {
2156 [NO_SSC] = &ml_pcie_100_no_ssc_ln_vals,
2157 [EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals,
2158 [INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals,
2159 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002160 },
2161 [TYPE_USB] = {
2162 [TYPE_NONE] = {
2163 [EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals,
2164 },
2165 },
Swapnil Jakhade8a1b82d2021-12-23 07:01:35 +01002166 [TYPE_QSGMII] = {
2167 [TYPE_PCIE] = {
2168 [NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
2169 [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
2170 [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals,
2171 },
2172 },
Swapnil Jakhade078e9e92021-12-23 07:01:24 +01002173 },
Kishon Vijay Abraham I367da972019-12-16 15:27:02 +05302174};
2175
Alan Douglas44d30d62018-11-12 16:42:16 +00002176static const struct of_device_id cdns_sierra_id_table[] = {
2177 {
2178 .compatible = "cdns,sierra-phy-t0",
2179 .data = &cdns_map_sierra,
2180 },
Kishon Vijay Abraham I367da972019-12-16 15:27:02 +05302181 {
2182 .compatible = "ti,sierra-phy-t0",
2183 .data = &cdns_ti_map_sierra,
2184 },
Alan Douglas44d30d62018-11-12 16:42:16 +00002185 {}
2186};
2187MODULE_DEVICE_TABLE(of, cdns_sierra_id_table);
2188
2189static struct platform_driver cdns_sierra_driver = {
2190 .probe = cdns_sierra_phy_probe,
2191 .remove = cdns_sierra_phy_remove,
2192 .driver = {
2193 .name = "cdns-sierra-phy",
2194 .of_match_table = cdns_sierra_id_table,
2195 },
2196};
2197module_platform_driver(cdns_sierra_driver);
2198
2199MODULE_ALIAS("platform:cdns_sierra");
2200MODULE_AUTHOR("Cadence Design Systems");
2201MODULE_DESCRIPTION("CDNS sierra phy driver");
2202MODULE_LICENSE("GPL v2");