1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Cadence Torrent SD0801 PHY driver.
4 *
5 * Copyright 2018 Cadence Design Systems, Inc.
6 *
7 */
8
9 #include <dt-bindings/phy/phy.h>
10 #include <dt-bindings/phy/phy-cadence.h>
11 #include <linux/clk.h>
12 #include <linux/clk-provider.h>
13 #include <linux/delay.h>
14 #include <linux/err.h>
15 #include <linux/io.h>
16 #include <linux/iopoll.h>
17 #include <linux/kernel.h>
18 #include <linux/module.h>
19 #include <linux/of.h>
20 #include <linux/phy/phy.h>
21 #include <linux/platform_device.h>
22 #include <linux/reset.h>
23 #include <linux/regmap.h>
24
25 #define REF_CLK_19_2MHZ 19200000
26 #define REF_CLK_25MHZ 25000000
27 #define REF_CLK_100MHZ 100000000
28 #define REF_CLK_156_25MHZ 156250000
29
30 #define MAX_NUM_LANES 4
31 #define DEFAULT_MAX_BIT_RATE 8100 /* in Mbps */
32
33 #define POLL_TIMEOUT_US 5000
34 #define PLL_LOCK_TIMEOUT 100000
35
36 #define DP_PLL0 BIT(0)
37 #define DP_PLL1 BIT(1)
38
39 #define TORRENT_COMMON_CDB_OFFSET 0x0
40
41 #define TORRENT_TX_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
42 ((0x4000 << (block_offset)) + \
43 (((ln) << 9) << (reg_offset)))
44
45 #define TORRENT_RX_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
46 ((0x8000 << (block_offset)) + \
47 (((ln) << 9) << (reg_offset)))
48
49 #define TORRENT_PHY_PCS_COMMON_OFFSET(block_offset) \
50 (0xC000 << (block_offset))
51
52 #define TORRENT_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \
53 ((0xD000 << (block_offset)) + \
54 (((ln) << 8) << (reg_offset)))
55
56 #define TORRENT_PHY_PMA_COMMON_OFFSET(block_offset) \
57 (0xE000 << (block_offset))
58
59 #define TORRENT_DPTX_PHY_OFFSET 0x0
60
61 /*
62 * register offsets from DPTX PHY register block base (i.e MHDP
63 * register base + 0x30a00)
64 */
65 #define PHY_AUX_CTRL 0x04
66 #define PHY_RESET 0x20
67 #define PMA_TX_ELEC_IDLE_SHIFT 4
68 #define PHY_PMA_XCVR_PLLCLK_EN 0x24
69 #define PHY_PMA_XCVR_PLLCLK_EN_ACK 0x28
70 #define PHY_PMA_XCVR_POWER_STATE_REQ 0x2c
71 #define PHY_POWER_STATE_LN(ln) ((ln) * 8)
72 #define PMA_XCVR_POWER_STATE_REQ_LN_MASK 0x3FU
73 #define PHY_PMA_XCVR_POWER_STATE_ACK 0x30
74 #define PHY_PMA_CMN_READY 0x34
75
76 /*
77 * register offsets from SD0801 PHY register block base (i.e MHDP
78 * register base + 0x500000)
79 */
80 #define CMN_SSM_BANDGAP_TMR 0x0021U
81 #define CMN_SSM_BIAS_TMR 0x0022U
82 #define CMN_PLLSM0_PLLPRE_TMR 0x002AU
83 #define CMN_PLLSM0_PLLLOCK_TMR 0x002CU
84 #define CMN_PLLSM1_PLLPRE_TMR 0x0032U
85 #define CMN_PLLSM1_PLLLOCK_TMR 0x0034U
86 #define CMN_CDIAG_CDB_PWRI_OVRD 0x0041U
87 #define CMN_CDIAG_XCVRC_PWRI_OVRD 0x0047U
88 #define CMN_CDIAG_REFCLK_OVRD 0x004CU
89 #define CMN_CDIAG_REFCLK_DRV0_CTRL 0x0050U
90 #define CMN_BGCAL_INIT_TMR 0x0064U
91 #define CMN_BGCAL_ITER_TMR 0x0065U
92 #define CMN_IBCAL_INIT_TMR 0x0074U
93 #define CMN_PLL0_VCOCAL_TCTRL 0x0082U
94 #define CMN_PLL0_VCOCAL_INIT_TMR 0x0084U
95 #define CMN_PLL0_VCOCAL_ITER_TMR 0x0085U
96 #define CMN_PLL0_VCOCAL_REFTIM_START 0x0086U
97 #define CMN_PLL0_VCOCAL_PLLCNT_START 0x0088U
98 #define CMN_PLL0_INTDIV_M0 0x0090U
99 #define CMN_PLL0_FRACDIVL_M0 0x0091U
100 #define CMN_PLL0_FRACDIVH_M0 0x0092U
101 #define CMN_PLL0_HIGH_THR_M0 0x0093U
102 #define CMN_PLL0_DSM_DIAG_M0 0x0094U
103 #define CMN_PLL0_DSM_FBH_OVRD_M0 0x0095U
104 #define CMN_PLL0_DSM_FBL_OVRD_M0 0x0096U
105 #define CMN_PLL0_SS_CTRL1_M0 0x0098U
106 #define CMN_PLL0_SS_CTRL2_M0 0x0099U
107 #define CMN_PLL0_SS_CTRL3_M0 0x009AU
108 #define CMN_PLL0_SS_CTRL4_M0 0x009BU
109 #define CMN_PLL0_LOCK_REFCNT_START 0x009CU
110 #define CMN_PLL0_LOCK_PLLCNT_START 0x009EU
111 #define CMN_PLL0_LOCK_PLLCNT_THR 0x009FU
112 #define CMN_PLL0_INTDIV_M1 0x00A0U
113 #define CMN_PLL0_FRACDIVH_M1 0x00A2U
114 #define CMN_PLL0_HIGH_THR_M1 0x00A3U
115 #define CMN_PLL0_DSM_DIAG_M1 0x00A4U
116 #define CMN_PLL0_SS_CTRL1_M1 0x00A8U
117 #define CMN_PLL0_SS_CTRL2_M1 0x00A9U
118 #define CMN_PLL0_SS_CTRL3_M1 0x00AAU
119 #define CMN_PLL0_SS_CTRL4_M1 0x00ABU
120 #define CMN_PLL1_VCOCAL_TCTRL 0x00C2U
121 #define CMN_PLL1_VCOCAL_INIT_TMR 0x00C4U
122 #define CMN_PLL1_VCOCAL_ITER_TMR 0x00C5U
123 #define CMN_PLL1_VCOCAL_REFTIM_START 0x00C6U
124 #define CMN_PLL1_VCOCAL_PLLCNT_START 0x00C8U
125 #define CMN_PLL1_INTDIV_M0 0x00D0U
126 #define CMN_PLL1_FRACDIVL_M0 0x00D1U
127 #define CMN_PLL1_FRACDIVH_M0 0x00D2U
128 #define CMN_PLL1_HIGH_THR_M0 0x00D3U
129 #define CMN_PLL1_DSM_DIAG_M0 0x00D4U
130 #define CMN_PLL1_DSM_FBH_OVRD_M0 0x00D5U
131 #define CMN_PLL1_DSM_FBL_OVRD_M0 0x00D6U
132 #define CMN_PLL1_SS_CTRL1_M0 0x00D8U
133 #define CMN_PLL1_SS_CTRL2_M0 0x00D9U
134 #define CMN_PLL1_SS_CTRL3_M0 0x00DAU
135 #define CMN_PLL1_SS_CTRL4_M0 0x00DBU
136 #define CMN_PLL1_LOCK_REFCNT_START 0x00DCU
137 #define CMN_PLL1_LOCK_PLLCNT_START 0x00DEU
138 #define CMN_PLL1_LOCK_PLLCNT_THR 0x00DFU
139 #define CMN_TXPUCAL_TUNE 0x0103U
140 #define CMN_TXPUCAL_INIT_TMR 0x0104U
141 #define CMN_TXPUCAL_ITER_TMR 0x0105U
142 #define CMN_TXPDCAL_TUNE 0x010BU
143 #define CMN_TXPDCAL_INIT_TMR 0x010CU
144 #define CMN_TXPDCAL_ITER_TMR 0x010DU
145 #define CMN_RXCAL_INIT_TMR 0x0114U
146 #define CMN_RXCAL_ITER_TMR 0x0115U
147 #define CMN_SD_CAL_INIT_TMR 0x0124U
148 #define CMN_SD_CAL_ITER_TMR 0x0125U
149 #define CMN_SD_CAL_REFTIM_START 0x0126U
150 #define CMN_SD_CAL_PLLCNT_START 0x0128U
151 #define CMN_PDIAG_PLL0_CTRL_M0 0x01A0U
152 #define CMN_PDIAG_PLL0_CLK_SEL_M0 0x01A1U
153 #define CMN_PDIAG_PLL0_CP_PADJ_M0 0x01A4U
154 #define CMN_PDIAG_PLL0_CP_IADJ_M0 0x01A5U
155 #define CMN_PDIAG_PLL0_FILT_PADJ_M0 0x01A6U
156 #define CMN_PDIAG_PLL0_CTRL_M1 0x01B0U
157 #define CMN_PDIAG_PLL0_CLK_SEL_M1 0x01B1U
158 #define CMN_PDIAG_PLL0_CP_PADJ_M1 0x01B4U
159 #define CMN_PDIAG_PLL0_CP_IADJ_M1 0x01B5U
160 #define CMN_PDIAG_PLL0_FILT_PADJ_M1 0x01B6U
161 #define CMN_PDIAG_PLL1_CTRL_M0 0x01C0U
162 #define CMN_PDIAG_PLL1_CLK_SEL_M0 0x01C1U
163 #define CMN_PDIAG_PLL1_CP_PADJ_M0 0x01C4U
164 #define CMN_PDIAG_PLL1_CP_IADJ_M0 0x01C5U
165 #define CMN_PDIAG_PLL1_FILT_PADJ_M0 0x01C6U
166 #define CMN_DIAG_BIAS_OVRD1 0x01E1U
167
168 /* PMA TX Lane registers */
169 #define TX_TXCC_CTRL 0x0040U
170 #define TX_TXCC_CPOST_MULT_00 0x004CU
171 #define TX_TXCC_CPOST_MULT_01 0x004DU
172 #define TX_TXCC_MGNFS_MULT_000 0x0050U
173 #define TX_TXCC_MGNFS_MULT_100 0x0054U
174 #define DRV_DIAG_TX_DRV 0x00C6U
175 #define XCVR_DIAG_PLLDRC_CTRL 0x00E5U
176 #define XCVR_DIAG_HSCLK_SEL 0x00E6U
177 #define XCVR_DIAG_HSCLK_DIV 0x00E7U
178 #define XCVR_DIAG_RXCLK_CTRL 0x00E9U
179 #define XCVR_DIAG_BIDI_CTRL 0x00EAU
180 #define XCVR_DIAG_PSC_OVRD 0x00EBU
181 #define TX_PSC_A0 0x0100U
182 #define TX_PSC_A1 0x0101U
183 #define TX_PSC_A2 0x0102U
184 #define TX_PSC_A3 0x0103U
185 #define TX_RCVDET_ST_TMR 0x0123U
186 #define TX_DIAG_ACYA 0x01E7U
187 #define TX_DIAG_ACYA_HBDC_MASK 0x0001U
188
189 /* PMA RX Lane registers */
190 #define RX_PSC_A0 0x0000U
191 #define RX_PSC_A1 0x0001U
192 #define RX_PSC_A2 0x0002U
193 #define RX_PSC_A3 0x0003U
194 #define RX_PSC_CAL 0x0006U
195 #define RX_SDCAL0_INIT_TMR 0x0044U
196 #define RX_SDCAL0_ITER_TMR 0x0045U
197 #define RX_SDCAL1_INIT_TMR 0x004CU
198 #define RX_SDCAL1_ITER_TMR 0x004DU
199 #define RX_CDRLF_CNFG 0x0080U
200 #define RX_CDRLF_CNFG2 0x0081U
201 #define RX_CDRLF_CNFG3 0x0082U
202 #define RX_SIGDET_HL_FILT_TMR 0x0090U
203 #define RX_REE_GCSM1_CTRL 0x0108U
204 #define RX_REE_GCSM1_EQENM_PH1 0x0109U
205 #define RX_REE_GCSM1_EQENM_PH2 0x010AU
206 #define RX_REE_GCSM2_CTRL 0x0110U
207 #define RX_REE_PERGCSM_CTRL 0x0118U
208 #define RX_REE_PEAK_UTHR 0x0142U
209 #define RX_REE_PEAK_LTHR 0x0143U
210 #define RX_REE_ATTEN_THR 0x0149U
211 #define RX_REE_TAP1_CLIP 0x0171U
212 #define RX_REE_TAP2TON_CLIP 0x0172U
213 #define RX_REE_SMGM_CTRL1 0x0177U
214 #define RX_REE_SMGM_CTRL2 0x0178U
215 #define RX_DIAG_DFE_CTRL 0x01E0U
216 #define RX_DIAG_DFE_AMP_TUNE_2 0x01E2U
217 #define RX_DIAG_DFE_AMP_TUNE_3 0x01E3U
218 #define RX_DIAG_REE_DAC_CTRL 0x01E4U
219 #define RX_DIAG_NQST_CTRL 0x01E5U
220 #define RX_DIAG_SIGDET_TUNE 0x01E8U
221 #define RX_DIAG_PI_RATE 0x01F4U
222 #define RX_DIAG_PI_CAP 0x01F5U
223 #define RX_DIAG_ACYA 0x01FFU
224
225 /* PHY PCS common registers */
226 #define PHY_PIPE_CMN_CTRL1 0x0000U
227 #define PHY_PLL_CFG 0x000EU
228 #define PHY_PIPE_USB3_GEN2_PRE_CFG0 0x0020U
229 #define PHY_PIPE_USB3_GEN2_POST_CFG0 0x0022U
230 #define PHY_PIPE_USB3_GEN2_POST_CFG1 0x0023U
231
232 /* PHY PCS lane registers */
233 #define PHY_PCS_ISO_LINK_CTRL 0x000BU
234
235 /* PHY PMA common registers */
236 #define PHY_PMA_CMN_CTRL1 0x0000U
237 #define PHY_PMA_CMN_CTRL2 0x0001U
238 #define PHY_PMA_PLL_RAW_CTRL 0x0003U
239
240 #define CDNS_TORRENT_OUTPUT_CLOCKS 3
241
242 static const char * const clk_names[] = {
243 [CDNS_TORRENT_REFCLK_DRIVER] = "refclk-driver",
244 [CDNS_TORRENT_DERIVED_REFCLK] = "refclk-der",
245 [CDNS_TORRENT_RECEIVED_REFCLK] = "refclk-rec",
246 };
247
248 static const struct reg_field phy_pll_cfg =
249 REG_FIELD(PHY_PLL_CFG, 0, 1);
250
251 static const struct reg_field phy_pma_cmn_ctrl_1 =
252 REG_FIELD(PHY_PMA_CMN_CTRL1, 0, 0);
253
254 static const struct reg_field phy_pma_cmn_ctrl_2 =
255 REG_FIELD(PHY_PMA_CMN_CTRL2, 0, 7);
256
257 static const struct reg_field phy_pma_pll_raw_ctrl =
258 REG_FIELD(PHY_PMA_PLL_RAW_CTRL, 0, 1);
259
260 static const struct reg_field phy_reset_ctrl =
261 REG_FIELD(PHY_RESET, 8, 8);
262
263 static const struct reg_field phy_pcs_iso_link_ctrl_1 =
264 REG_FIELD(PHY_PCS_ISO_LINK_CTRL, 1, 1);
265
266 static const struct reg_field phy_pipe_cmn_ctrl1_0 = REG_FIELD(PHY_PIPE_CMN_CTRL1, 0, 0);
267
268 static const struct reg_field cmn_cdiag_refclk_ovrd_4 =
269 REG_FIELD(CMN_CDIAG_REFCLK_OVRD, 4, 4);
270
271 #define REFCLK_OUT_NUM_CMN_CONFIG 4
272
273 enum cdns_torrent_refclk_out_cmn {
274 CMN_CDIAG_REFCLK_DRV0_CTRL_1,
275 CMN_CDIAG_REFCLK_DRV0_CTRL_4,
276 CMN_CDIAG_REFCLK_DRV0_CTRL_5,
277 CMN_CDIAG_REFCLK_DRV0_CTRL_6,
278 };
279
280 static const struct reg_field refclk_out_cmn_cfg[] = {
281 [CMN_CDIAG_REFCLK_DRV0_CTRL_1] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 1, 1),
282 [CMN_CDIAG_REFCLK_DRV0_CTRL_4] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 4, 4),
283 [CMN_CDIAG_REFCLK_DRV0_CTRL_5] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 5, 5),
284 [CMN_CDIAG_REFCLK_DRV0_CTRL_6] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 6, 6),
285 };
286
287 static const int refclk_driver_parent_index[] = {
288 CDNS_TORRENT_DERIVED_REFCLK,
289 CDNS_TORRENT_RECEIVED_REFCLK
290 };
291
292 static const u32 cdns_torrent_refclk_driver_mux_table[] = { 1, 0 };
293
294 enum cdns_torrent_phy_type {
295 TYPE_NONE,
296 TYPE_DP,
297 TYPE_PCIE,
298 TYPE_SGMII,
299 TYPE_QSGMII,
300 TYPE_USB,
301 TYPE_USXGMII,
302 TYPE_PCIE_ML,
303 TYPE_XAUI,
304 };
305
306 enum cdns_torrent_ref_clk {
307 CLK_19_2_MHZ,
308 CLK_25_MHZ,
309 CLK_100_MHZ,
310 CLK_156_25_MHZ,
311 CLK_ANY,
312 };
313
314 enum cdns_torrent_ssc_mode {
315 NO_SSC,
316 EXTERNAL_SSC,
317 INTERNAL_SSC,
318 ANY_SSC,
319 };
320
321 /* Unique key id for vals table entry
322 * REFCLK0_RATE | REFCLK1_RATE | LINK0_TYPE | LINK1_TYPE | SSC_TYPE
323 */
324 #define REFCLK0_SHIFT 15
325 #define REFCLK0_MASK GENMASK(18, 15)
326 #define REFCLK1_SHIFT 11
327 #define REFCLK1_MASK GENMASK(14, 11)
328 #define LINK0_SHIFT 7
329 #define LINK0_MASK GENMASK(10, 7)
330 #define LINK1_SHIFT 3
331 #define LINK1_MASK GENMASK(6, 3)
332 #define SSC_SHIFT 0
333 #define SSC_MASK GENMASK(2, 0)
334
335 #define CDNS_TORRENT_KEY(refclk0, refclk1, link0, link1, ssc) \
336 ((((refclk0) << REFCLK0_SHIFT) & REFCLK0_MASK) | \
337 (((refclk1) << REFCLK1_SHIFT) & REFCLK1_MASK) | \
338 (((link0) << LINK0_SHIFT) & LINK0_MASK) | \
339 (((link1) << LINK1_SHIFT) & LINK1_MASK) | \
340 (((ssc) << SSC_SHIFT) & SSC_MASK))
341
342 #define CDNS_TORRENT_KEY_ANYCLK(link0, link1) \
343 CDNS_TORRENT_KEY(CLK_ANY, CLK_ANY, \
344 (link0), (link1), ANY_SSC)
345
346 struct cdns_torrent_inst {
347 struct phy *phy;
348 u32 mlane;
349 enum cdns_torrent_phy_type phy_type;
350 u32 num_lanes;
351 struct reset_control *lnk_rst;
352 enum cdns_torrent_ssc_mode ssc_mode;
353 };
354
355 struct cdns_torrent_phy {
356 void __iomem *base; /* DPTX registers base */
357 void __iomem *sd_base; /* SD0801 registers base */
358 u32 max_bit_rate; /* Maximum link bit rate to use (in Mbps) */
359 u32 dp_pll;
360 u32 protocol_bitmask;
361 struct reset_control *phy_rst;
362 struct reset_control *apb_rst;
363 struct device *dev;
364 struct clk *clk;
365 struct clk *clk1;
366 enum cdns_torrent_ref_clk ref_clk_rate;
367 enum cdns_torrent_ref_clk ref_clk1_rate;
368 struct cdns_torrent_inst phys[MAX_NUM_LANES];
369 int nsubnodes;
370 int already_configured;
371 const struct cdns_torrent_data *init_data;
372 struct regmap *regmap_common_cdb;
373 struct regmap *regmap_phy_pcs_common_cdb;
374 struct regmap *regmap_phy_pma_common_cdb;
375 struct regmap *regmap_tx_lane_cdb[MAX_NUM_LANES];
376 struct regmap *regmap_rx_lane_cdb[MAX_NUM_LANES];
377 struct regmap *regmap_phy_pcs_lane_cdb[MAX_NUM_LANES];
378 struct regmap *regmap_dptx_phy_reg;
379 struct regmap_field *phy_pll_cfg;
380 struct regmap_field *phy_pipe_cmn_ctrl1_0;
381 struct regmap_field *cmn_cdiag_refclk_ovrd_4;
382 struct regmap_field *phy_pma_cmn_ctrl_1;
383 struct regmap_field *phy_pma_cmn_ctrl_2;
384 struct regmap_field *phy_pma_pll_raw_ctrl;
385 struct regmap_field *phy_reset_ctrl;
386 struct regmap_field *phy_pcs_iso_link_ctrl_1[MAX_NUM_LANES];
387 struct clk_hw_onecell_data *clk_hw_data;
388 };
389
390 enum phy_powerstate {
391 POWERSTATE_A0 = 0,
392 /* Powerstate A1 is unused */
393 POWERSTATE_A2 = 2,
394 POWERSTATE_A3 = 3,
395 };
396
397 struct cdns_torrent_refclk_driver {
398 struct clk_hw hw;
399 struct regmap_field *cmn_fields[REFCLK_OUT_NUM_CMN_CONFIG];
400 struct clk_init_data clk_data;
401 u8 parent_index;
402 };
403
404 #define to_cdns_torrent_refclk_driver(_hw) \
405 container_of(_hw, struct cdns_torrent_refclk_driver, hw)
406
407 struct cdns_torrent_derived_refclk {
408 struct clk_hw hw;
409 struct regmap_field *phy_pipe_cmn_ctrl1_0;
410 struct regmap_field *cmn_cdiag_refclk_ovrd_4;
411 struct clk_init_data clk_data;
412 };
413
414 #define to_cdns_torrent_derived_refclk(_hw) \
415 container_of(_hw, struct cdns_torrent_derived_refclk, hw)
416
417 struct cdns_torrent_received_refclk {
418 struct clk_hw hw;
419 struct regmap_field *phy_pipe_cmn_ctrl1_0;
420 struct regmap_field *cmn_cdiag_refclk_ovrd_4;
421 struct clk_init_data clk_data;
422 };
423
424 #define to_cdns_torrent_received_refclk(_hw) \
425 container_of(_hw, struct cdns_torrent_received_refclk, hw)
426
427 struct cdns_reg_pairs {
428 u32 val;
429 u32 off;
430 };
431
432 struct cdns_torrent_vals {
433 const struct cdns_reg_pairs *reg_pairs;
434 u32 num_regs;
435 };
436
437 struct cdns_torrent_vals_entry {
438 u32 key;
439 const struct cdns_torrent_vals *vals;
440 };
441
442 struct cdns_torrent_vals_table {
443 const struct cdns_torrent_vals_entry *entries;
444 u32 num_entries;
445 };
446
447 struct cdns_torrent_data {
448 u8 block_offset_shift;
449 u8 reg_offset_shift;
450 struct cdns_torrent_vals_table link_cmn_vals_tbl;
451 struct cdns_torrent_vals_table xcvr_diag_vals_tbl;
452 struct cdns_torrent_vals_table pcs_cmn_vals_tbl;
453 struct cdns_torrent_vals_table phy_pma_cmn_vals_tbl;
454 struct cdns_torrent_vals_table cmn_vals_tbl;
455 struct cdns_torrent_vals_table tx_ln_vals_tbl;
456 struct cdns_torrent_vals_table rx_ln_vals_tbl;
457 };
458
459 struct cdns_regmap_cdb_context {
460 struct device *dev;
461 void __iomem *base;
462 u8 reg_offset_shift;
463 };
464
cdns_torrent_get_tbl_vals(const struct cdns_torrent_vals_table * tbl,enum cdns_torrent_ref_clk refclk0,enum cdns_torrent_ref_clk refclk1,enum cdns_torrent_phy_type link0,enum cdns_torrent_phy_type link1,enum cdns_torrent_ssc_mode ssc)465 static const struct cdns_torrent_vals *cdns_torrent_get_tbl_vals(const struct cdns_torrent_vals_table *tbl,
466 enum cdns_torrent_ref_clk refclk0,
467 enum cdns_torrent_ref_clk refclk1,
468 enum cdns_torrent_phy_type link0,
469 enum cdns_torrent_phy_type link1,
470 enum cdns_torrent_ssc_mode ssc)
471 {
472 int i;
473 u32 key = CDNS_TORRENT_KEY(refclk0, refclk1, link0, link1, ssc);
474
475 for (i = 0; i < tbl->num_entries; i++) {
476 if (tbl->entries[i].key == key)
477 return tbl->entries[i].vals;
478 }
479
480 return NULL;
481 }
482
cdns_regmap_write(void * context,unsigned int reg,unsigned int val)483 static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val)
484 {
485 struct cdns_regmap_cdb_context *ctx = context;
486 u32 offset = reg << ctx->reg_offset_shift;
487
488 writew(val, ctx->base + offset);
489
490 return 0;
491 }
492
cdns_regmap_read(void * context,unsigned int reg,unsigned int * val)493 static int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val)
494 {
495 struct cdns_regmap_cdb_context *ctx = context;
496 u32 offset = reg << ctx->reg_offset_shift;
497
498 *val = readw(ctx->base + offset);
499 return 0;
500 }
501
cdns_regmap_dptx_write(void * context,unsigned int reg,unsigned int val)502 static int cdns_regmap_dptx_write(void *context, unsigned int reg,
503 unsigned int val)
504 {
505 struct cdns_regmap_cdb_context *ctx = context;
506 u32 offset = reg;
507
508 writel(val, ctx->base + offset);
509
510 return 0;
511 }
512
cdns_regmap_dptx_read(void * context,unsigned int reg,unsigned int * val)513 static int cdns_regmap_dptx_read(void *context, unsigned int reg,
514 unsigned int *val)
515 {
516 struct cdns_regmap_cdb_context *ctx = context;
517 u32 offset = reg;
518
519 *val = readl(ctx->base + offset);
520 return 0;
521 }
522
523 #define TORRENT_TX_LANE_CDB_REGMAP_CONF(n) \
524 { \
525 .name = "torrent_tx_lane" n "_cdb", \
526 .reg_stride = 1, \
527 .fast_io = true, \
528 .reg_write = cdns_regmap_write, \
529 .reg_read = cdns_regmap_read, \
530 }
531
532 #define TORRENT_RX_LANE_CDB_REGMAP_CONF(n) \
533 { \
534 .name = "torrent_rx_lane" n "_cdb", \
535 .reg_stride = 1, \
536 .fast_io = true, \
537 .reg_write = cdns_regmap_write, \
538 .reg_read = cdns_regmap_read, \
539 }
540
541 static const struct regmap_config cdns_torrent_tx_lane_cdb_config[] = {
542 TORRENT_TX_LANE_CDB_REGMAP_CONF("0"),
543 TORRENT_TX_LANE_CDB_REGMAP_CONF("1"),
544 TORRENT_TX_LANE_CDB_REGMAP_CONF("2"),
545 TORRENT_TX_LANE_CDB_REGMAP_CONF("3"),
546 };
547
548 static const struct regmap_config cdns_torrent_rx_lane_cdb_config[] = {
549 TORRENT_RX_LANE_CDB_REGMAP_CONF("0"),
550 TORRENT_RX_LANE_CDB_REGMAP_CONF("1"),
551 TORRENT_RX_LANE_CDB_REGMAP_CONF("2"),
552 TORRENT_RX_LANE_CDB_REGMAP_CONF("3"),
553 };
554
555 static const struct regmap_config cdns_torrent_common_cdb_config = {
556 .name = "torrent_common_cdb",
557 .reg_stride = 1,
558 .fast_io = true,
559 .reg_write = cdns_regmap_write,
560 .reg_read = cdns_regmap_read,
561 };
562
563 #define TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \
564 { \
565 .name = "torrent_phy_pcs_lane" n "_cdb", \
566 .reg_stride = 1, \
567 .fast_io = true, \
568 .reg_write = cdns_regmap_write, \
569 .reg_read = cdns_regmap_read, \
570 }
571
572 static const struct regmap_config cdns_torrent_phy_pcs_lane_cdb_config[] = {
573 TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("0"),
574 TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("1"),
575 TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("2"),
576 TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("3"),
577 };
578
579 static const struct regmap_config cdns_torrent_phy_pcs_cmn_cdb_config = {
580 .name = "torrent_phy_pcs_cmn_cdb",
581 .reg_stride = 1,
582 .fast_io = true,
583 .reg_write = cdns_regmap_write,
584 .reg_read = cdns_regmap_read,
585 };
586
587 static const struct regmap_config cdns_torrent_phy_pma_cmn_cdb_config = {
588 .name = "torrent_phy_pma_cmn_cdb",
589 .reg_stride = 1,
590 .fast_io = true,
591 .reg_write = cdns_regmap_write,
592 .reg_read = cdns_regmap_read,
593 };
594
595 static const struct regmap_config cdns_torrent_dptx_phy_config = {
596 .name = "torrent_dptx_phy",
597 .reg_stride = 1,
598 .fast_io = true,
599 .reg_write = cdns_regmap_dptx_write,
600 .reg_read = cdns_regmap_dptx_read,
601 };
602
603 /* PHY mmr access functions */
604
cdns_torrent_phy_write(struct regmap * regmap,u32 offset,u32 val)605 static void cdns_torrent_phy_write(struct regmap *regmap, u32 offset, u32 val)
606 {
607 regmap_write(regmap, offset, val);
608 }
609
cdns_torrent_phy_read(struct regmap * regmap,u32 offset)610 static u32 cdns_torrent_phy_read(struct regmap *regmap, u32 offset)
611 {
612 unsigned int val;
613
614 regmap_read(regmap, offset, &val);
615 return val;
616 }
617
618 /* DPTX mmr access functions */
619
cdns_torrent_dp_write(struct regmap * regmap,u32 offset,u32 val)620 static void cdns_torrent_dp_write(struct regmap *regmap, u32 offset, u32 val)
621 {
622 regmap_write(regmap, offset, val);
623 }
624
cdns_torrent_dp_read(struct regmap * regmap,u32 offset)625 static u32 cdns_torrent_dp_read(struct regmap *regmap, u32 offset)
626 {
627 u32 val;
628
629 regmap_read(regmap, offset, &val);
630 return val;
631 }
632
633 /*
634 * Structure used to store values of PHY registers for voltage-related
635 * coefficients, for particular voltage swing and pre-emphasis level. Values
636 * are shared across all physical lanes.
637 */
638 struct coefficients {
639 /* Value of DRV_DIAG_TX_DRV register to use */
640 u16 diag_tx_drv;
641 /* Value of TX_TXCC_MGNFS_MULT_000 register to use */
642 u16 mgnfs_mult;
643 /* Value of TX_TXCC_CPOST_MULT_00 register to use */
644 u16 cpost_mult;
645 };
646
647 /*
648 * Array consists of values of voltage-related registers for sd0801 PHY. A value
649 * of 0xFFFF is a placeholder for invalid combination, and will never be used.
650 */
651 static const struct coefficients vltg_coeff[4][4] = {
652 /* voltage swing 0, pre-emphasis 0->3 */
653 { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x002A,
654 .cpost_mult = 0x0000},
655 {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F,
656 .cpost_mult = 0x0014},
657 {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0012,
658 .cpost_mult = 0x0020},
659 {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000,
660 .cpost_mult = 0x002A}
661 },
662
663 /* voltage swing 1, pre-emphasis 0->3 */
664 { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F,
665 .cpost_mult = 0x0000},
666 {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013,
667 .cpost_mult = 0x0012},
668 {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000,
669 .cpost_mult = 0x001F},
670 {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
671 .cpost_mult = 0xFFFF}
672 },
673
674 /* voltage swing 2, pre-emphasis 0->3 */
675 { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013,
676 .cpost_mult = 0x0000},
677 {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000,
678 .cpost_mult = 0x0013},
679 {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
680 .cpost_mult = 0xFFFF},
681 {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
682 .cpost_mult = 0xFFFF}
683 },
684
685 /* voltage swing 3, pre-emphasis 0->3 */
686 { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000,
687 .cpost_mult = 0x0000},
688 {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
689 .cpost_mult = 0xFFFF},
690 {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
691 .cpost_mult = 0xFFFF},
692 {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF,
693 .cpost_mult = 0xFFFF}
694 }
695 };
696
cdns_torrent_get_phy_type(enum cdns_torrent_phy_type phy_type)697 static const char *cdns_torrent_get_phy_type(enum cdns_torrent_phy_type phy_type)
698 {
699 switch (phy_type) {
700 case TYPE_DP:
701 return "DisplayPort";
702 case TYPE_PCIE:
703 case TYPE_PCIE_ML:
704 return "PCIe";
705 case TYPE_SGMII:
706 return "SGMII";
707 case TYPE_QSGMII:
708 return "QSGMII";
709 case TYPE_USB:
710 return "USB";
711 case TYPE_USXGMII:
712 return "USXGMII";
713 case TYPE_XAUI:
714 return "XAUI";
715 default:
716 return "None";
717 }
718 }
719
720 /*
721 * Set registers responsible for enabling and configuring SSC, with second and
722 * third register values provided by parameters.
723 */
724 static
cdns_torrent_dp_enable_ssc_19_2mhz(struct cdns_torrent_phy * cdns_phy,u32 ctrl2_val,u32 ctrl3_val)725 void cdns_torrent_dp_enable_ssc_19_2mhz(struct cdns_torrent_phy *cdns_phy,
726 u32 ctrl2_val, u32 ctrl3_val)
727 {
728 struct regmap *regmap = cdns_phy->regmap_common_cdb;
729
730 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0001);
731 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl2_val);
732 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl3_val);
733 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0003);
734 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0001);
735 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl2_val);
736 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl3_val);
737 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0003);
738 }
739
740 static
cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy * cdns_phy,u32 rate,bool ssc)741 void cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy,
742 u32 rate, bool ssc)
743 {
744 struct regmap *regmap = cdns_phy->regmap_common_cdb;
745
746 /* Assumes 19.2 MHz refclock */
747 switch (rate) {
748 /* Setting VCO for 10.8GHz */
749 case 2700:
750 case 5400:
751 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0119);
752 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x4000);
753 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
754 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00BC);
755 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0012);
756 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0119);
757 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x4000);
758 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
759 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00BC);
760 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0012);
761 if (ssc)
762 cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x033A, 0x006A);
763 break;
764 /* Setting VCO for 9.72GHz */
765 case 1620:
766 case 2430:
767 case 3240:
768 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01FA);
769 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x4000);
770 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
771 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0152);
772 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
773 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01FA);
774 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x4000);
775 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
776 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0152);
777 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
778 if (ssc)
779 cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x05DD, 0x0069);
780 break;
781 /* Setting VCO for 8.64GHz */
782 case 2160:
783 case 4320:
784 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01C2);
785 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000);
786 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
787 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x012C);
788 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
789 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01C2);
790 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000);
791 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
792 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x012C);
793 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
794 if (ssc)
795 cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x0536, 0x0069);
796 break;
797 /* Setting VCO for 8.1GHz */
798 case 8100:
799 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01A5);
800 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0xE000);
801 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
802 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x011A);
803 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
804 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01A5);
805 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0xE000);
806 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
807 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x011A);
808 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
809 if (ssc)
810 cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x04D7, 0x006A);
811 break;
812 }
813
814 if (ssc) {
815 cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_PLLCNT_START, 0x025E);
816 cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_THR, 0x0005);
817 cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_PLLCNT_START, 0x025E);
818 cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_THR, 0x0005);
819 } else {
820 cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_PLLCNT_START, 0x0260);
821 cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_PLLCNT_START, 0x0260);
822 /* Set reset register values to disable SSC */
823 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0002);
824 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL2_M0, 0x0000);
825 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL3_M0, 0x0000);
826 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0000);
827 cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_THR, 0x0003);
828 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0002);
829 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL2_M0, 0x0000);
830 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL3_M0, 0x0000);
831 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0000);
832 cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_THR, 0x0003);
833 }
834
835 cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_REFCNT_START, 0x0099);
836 cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_START, 0x0099);
837 cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_REFCNT_START, 0x0099);
838 cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_START, 0x0099);
839 }
840
841 /*
842 * Set registers responsible for enabling and configuring SSC, with second
843 * register value provided by a parameter.
844 */
cdns_torrent_dp_enable_ssc_25mhz(struct cdns_torrent_phy * cdns_phy,u32 ctrl2_val)845 static void cdns_torrent_dp_enable_ssc_25mhz(struct cdns_torrent_phy *cdns_phy,
846 u32 ctrl2_val)
847 {
848 struct regmap *regmap = cdns_phy->regmap_common_cdb;
849
850 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0001);
851 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl2_val);
852 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x007F);
853 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0003);
854 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0001);
855 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl2_val);
856 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x007F);
857 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0003);
858 }
859
860 static
cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy * cdns_phy,u32 rate,bool ssc)861 void cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy *cdns_phy,
862 u32 rate, bool ssc)
863 {
864 struct regmap *regmap = cdns_phy->regmap_common_cdb;
865
866 /* Assumes 25 MHz refclock */
867 switch (rate) {
868 /* Setting VCO for 10.8GHz */
869 case 2700:
870 case 5400:
871 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01B0);
872 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000);
873 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
874 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0120);
875 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01B0);
876 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000);
877 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
878 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0120);
879 if (ssc)
880 cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x0423);
881 break;
882 /* Setting VCO for 9.72GHz */
883 case 1620:
884 case 2430:
885 case 3240:
886 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0184);
887 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0xCCCD);
888 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
889 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0104);
890 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0184);
891 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0xCCCD);
892 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
893 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0104);
894 if (ssc)
895 cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x03B9);
896 break;
897 /* Setting VCO for 8.64GHz */
898 case 2160:
899 case 4320:
900 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0159);
901 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x999A);
902 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
903 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00E7);
904 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0159);
905 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x999A);
906 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
907 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00E7);
908 if (ssc)
909 cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x034F);
910 break;
911 /* Setting VCO for 8.1GHz */
912 case 8100:
913 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0144);
914 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000);
915 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
916 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00D8);
917 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0144);
918 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000);
919 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
920 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00D8);
921 if (ssc)
922 cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x031A);
923 break;
924 }
925
926 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
927 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
928
929 if (ssc) {
930 cdns_torrent_phy_write(regmap,
931 CMN_PLL0_VCOCAL_PLLCNT_START, 0x0315);
932 cdns_torrent_phy_write(regmap,
933 CMN_PLL0_LOCK_PLLCNT_THR, 0x0005);
934 cdns_torrent_phy_write(regmap,
935 CMN_PLL1_VCOCAL_PLLCNT_START, 0x0315);
936 cdns_torrent_phy_write(regmap,
937 CMN_PLL1_LOCK_PLLCNT_THR, 0x0005);
938 } else {
939 cdns_torrent_phy_write(regmap,
940 CMN_PLL0_VCOCAL_PLLCNT_START, 0x0317);
941 cdns_torrent_phy_write(regmap,
942 CMN_PLL1_VCOCAL_PLLCNT_START, 0x0317);
943 /* Set reset register values to disable SSC */
944 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0002);
945 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL2_M0, 0x0000);
946 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL3_M0, 0x0000);
947 cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0000);
948 cdns_torrent_phy_write(regmap,
949 CMN_PLL0_LOCK_PLLCNT_THR, 0x0003);
950 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0002);
951 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL2_M0, 0x0000);
952 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL3_M0, 0x0000);
953 cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0000);
954 cdns_torrent_phy_write(regmap,
955 CMN_PLL1_LOCK_PLLCNT_THR, 0x0003);
956 }
957
958 cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_REFCNT_START, 0x00C7);
959 cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_START, 0x00C7);
960 cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_REFCNT_START, 0x00C7);
961 cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_START, 0x00C7);
962 }
963
964 static
cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(struct cdns_torrent_phy * cdns_phy,u32 rate,bool ssc)965 void cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(struct cdns_torrent_phy *cdns_phy,
966 u32 rate, bool ssc)
967 {
968 struct regmap *regmap = cdns_phy->regmap_common_cdb;
969
970 /* Assumes 100 MHz refclock */
971 switch (rate) {
972 /* Setting VCO for 10.8GHz */
973 case 2700:
974 case 5400:
975 if (cdns_phy->dp_pll & DP_PLL0)
976 cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_FBH_OVRD_M0, 0x0022);
977
978 if (cdns_phy->dp_pll & DP_PLL1) {
979 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0028);
980 cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_FBH_OVRD_M0, 0x0022);
981 cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_FBL_OVRD_M0, 0x000C);
982 }
983 break;
984 /* Setting VCO for 9.72GHz */
985 case 1620:
986 case 2430:
987 case 3240:
988 if (cdns_phy->dp_pll & DP_PLL0) {
989 cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004);
990 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509);
991 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00);
992 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08);
993 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0061);
994 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x3333);
995 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
996 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0042);
997 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
998 }
999 if (cdns_phy->dp_pll & DP_PLL1) {
1000 cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004);
1001 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509);
1002 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00);
1003 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08);
1004 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0061);
1005 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x3333);
1006 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
1007 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0042);
1008 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
1009 }
1010 break;
1011 /* Setting VCO for 8.64GHz */
1012 case 2160:
1013 case 4320:
1014 if (cdns_phy->dp_pll & DP_PLL0) {
1015 cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004);
1016 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509);
1017 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00);
1018 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08);
1019 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0056);
1020 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x6666);
1021 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
1022 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x003A);
1023 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
1024 }
1025 if (cdns_phy->dp_pll & DP_PLL1) {
1026 cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004);
1027 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509);
1028 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00);
1029 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08);
1030 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0056);
1031 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x6666);
1032 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
1033 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x003A);
1034 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
1035 }
1036 break;
1037 /* Setting VCO for 8.1GHz */
1038 case 8100:
1039 if (cdns_phy->dp_pll & DP_PLL0) {
1040 cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004);
1041 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509);
1042 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00);
1043 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08);
1044 cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0051);
1045 cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002);
1046 cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0036);
1047 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002);
1048 }
1049 if (cdns_phy->dp_pll & DP_PLL1) {
1050 cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004);
1051 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509);
1052 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00);
1053 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08);
1054 cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0051);
1055 cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002);
1056 cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0036);
1057 cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
1058 }
1059 break;
1060 }
1061 }
1062
1063 /* Set PLL used for DP configuration */
cdns_torrent_dp_get_pll(struct cdns_torrent_phy * cdns_phy,enum cdns_torrent_phy_type phy_t2)1064 static int cdns_torrent_dp_get_pll(struct cdns_torrent_phy *cdns_phy,
1065 enum cdns_torrent_phy_type phy_t2)
1066 {
1067 switch (phy_t2) {
1068 case TYPE_PCIE:
1069 case TYPE_USB:
1070 cdns_phy->dp_pll = DP_PLL1;
1071 break;
1072 case TYPE_SGMII:
1073 case TYPE_QSGMII:
1074 cdns_phy->dp_pll = DP_PLL0;
1075 break;
1076 case TYPE_NONE:
1077 cdns_phy->dp_pll = DP_PLL0 | DP_PLL1;
1078 break;
1079 default:
1080 dev_err(cdns_phy->dev, "Unsupported PHY configuration\n");
1081 return -EINVAL;
1082 }
1083
1084 return 0;
1085 }
1086
1087 /*
1088 * Enable or disable PLL for selected lanes.
1089 */
cdns_torrent_dp_set_pll_en(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy_configure_opts_dp * dp,bool enable)1090 static int cdns_torrent_dp_set_pll_en(struct cdns_torrent_phy *cdns_phy,
1091 struct cdns_torrent_inst *inst,
1092 struct phy_configure_opts_dp *dp,
1093 bool enable)
1094 {
1095 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1096 u32 rd_val, pll_ack_val;
1097 int ret;
1098
1099 /*
1100 * Used to determine, which bits to check for or enable in
1101 * PHY_PMA_XCVR_PLLCLK_EN register.
1102 */
1103 u32 pll_bits;
1104 /* Used to enable or disable lanes. */
1105 u32 pll_val;
1106
1107 /* Select values of registers and mask, depending on enabled lane count. */
1108 pll_val = cdns_torrent_dp_read(regmap, PHY_PMA_XCVR_PLLCLK_EN);
1109
1110 if (enable) {
1111 pll_bits = ((1 << dp->lanes) - 1);
1112 pll_val |= pll_bits;
1113 pll_ack_val = pll_bits;
1114 } else {
1115 pll_bits = ((1 << inst->num_lanes) - 1);
1116 pll_val &= (~pll_bits);
1117 pll_ack_val = 0;
1118 }
1119
1120 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, pll_val);
1121
1122 /* Wait for acknowledgment from PHY. */
1123 ret = regmap_read_poll_timeout(regmap,
1124 PHY_PMA_XCVR_PLLCLK_EN_ACK,
1125 rd_val,
1126 (rd_val & pll_bits) == pll_ack_val,
1127 0, POLL_TIMEOUT_US);
1128 ndelay(100);
1129 return ret;
1130 }
1131
cdns_torrent_dp_set_power_state(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,u32 num_lanes,enum phy_powerstate powerstate)1132 static int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy,
1133 struct cdns_torrent_inst *inst,
1134 u32 num_lanes,
1135 enum phy_powerstate powerstate)
1136 {
1137 /* Register value for power state for a single byte. */
1138 u32 value_part, i;
1139 u32 value = 0;
1140 u32 mask = 0;
1141 u32 read_val;
1142 int ret;
1143 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1144
1145 switch (powerstate) {
1146 case (POWERSTATE_A0):
1147 value_part = 0x01U;
1148 break;
1149 case (POWERSTATE_A2):
1150 value_part = 0x04U;
1151 break;
1152 default:
1153 /* Powerstate A3 */
1154 value_part = 0x08U;
1155 break;
1156 }
1157
1158 /* Select values of registers and mask, depending on enabled lane count. */
1159
1160 for (i = 0; i < num_lanes; i++) {
1161 value |= (value_part << PHY_POWER_STATE_LN(i));
1162 mask |= (PMA_XCVR_POWER_STATE_REQ_LN_MASK << PHY_POWER_STATE_LN(i));
1163 }
1164
1165 /* Set power state A<n>. */
1166 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, value);
1167 /* Wait, until PHY acknowledges power state completion. */
1168 ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_POWER_STATE_ACK,
1169 read_val, (read_val & mask) == value, 0,
1170 POLL_TIMEOUT_US);
1171 if (ret)
1172 return ret;
1173
1174 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, 0x00000000);
1175 ndelay(100);
1176
1177 return ret;
1178 }
1179
cdns_torrent_dp_run(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,u32 num_lanes)1180 static int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy,
1181 struct cdns_torrent_inst *inst, u32 num_lanes)
1182 {
1183 unsigned int read_val;
1184 int ret;
1185 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1186
1187 /*
1188 * waiting for ACK of pma_xcvr_pllclk_en_ln_*, only for the
1189 * master lane
1190 */
1191 ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_PLLCLK_EN_ACK,
1192 read_val, read_val & 1,
1193 0, POLL_TIMEOUT_US);
1194 if (ret == -ETIMEDOUT) {
1195 dev_err(cdns_phy->dev,
1196 "timeout waiting for link PLL clock enable ack\n");
1197 return ret;
1198 }
1199
1200 ndelay(100);
1201
1202 ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, num_lanes,
1203 POWERSTATE_A2);
1204 if (ret)
1205 return ret;
1206
1207 ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, num_lanes,
1208 POWERSTATE_A0);
1209
1210 return ret;
1211 }
1212
cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy * cdns_phy)1213 static int cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy)
1214 {
1215 unsigned int reg;
1216 int ret;
1217 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1218
1219 ret = regmap_read_poll_timeout(regmap, PHY_PMA_CMN_READY, reg,
1220 reg & 1, 0, POLL_TIMEOUT_US);
1221 if (ret == -ETIMEDOUT) {
1222 dev_err(cdns_phy->dev,
1223 "timeout waiting for PMA common ready\n");
1224 return -ETIMEDOUT;
1225 }
1226
1227 return 0;
1228 }
1229
cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,u32 rate,u32 num_lanes)1230 static void cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy *cdns_phy,
1231 struct cdns_torrent_inst *inst,
1232 u32 rate, u32 num_lanes)
1233 {
1234 unsigned int clk_sel_val = 0;
1235 unsigned int hsclk_div_val = 0;
1236 unsigned int i;
1237
1238 switch (rate) {
1239 case 1620:
1240 clk_sel_val = 0x0f01;
1241 hsclk_div_val = 2;
1242 break;
1243 case 2160:
1244 case 2430:
1245 case 2700:
1246 clk_sel_val = 0x0701;
1247 hsclk_div_val = 1;
1248 break;
1249 case 3240:
1250 clk_sel_val = 0x0b00;
1251 hsclk_div_val = 2;
1252 break;
1253 case 4320:
1254 case 5400:
1255 clk_sel_val = 0x0301;
1256 hsclk_div_val = 0;
1257 break;
1258 case 8100:
1259 clk_sel_val = 0x0200;
1260 hsclk_div_val = 0;
1261 break;
1262 }
1263
1264 if (cdns_phy->dp_pll & DP_PLL0)
1265 cdns_torrent_phy_write(cdns_phy->regmap_common_cdb,
1266 CMN_PDIAG_PLL0_CLK_SEL_M0, clk_sel_val);
1267
1268 if (cdns_phy->dp_pll & DP_PLL1)
1269 cdns_torrent_phy_write(cdns_phy->regmap_common_cdb,
1270 CMN_PDIAG_PLL1_CLK_SEL_M0, clk_sel_val);
1271
1272 /* PMA lane configuration to deal with multi-link operation */
1273 for (i = 0; i < num_lanes; i++)
1274 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + i],
1275 XCVR_DIAG_HSCLK_DIV, hsclk_div_val);
1276 }
1277
1278 /*
1279 * Perform register operations related to setting link rate, once powerstate is
1280 * set and PLL disable request was processed.
1281 */
cdns_torrent_dp_configure_rate(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy_configure_opts_dp * dp)1282 static int cdns_torrent_dp_configure_rate(struct cdns_torrent_phy *cdns_phy,
1283 struct cdns_torrent_inst *inst,
1284 struct phy_configure_opts_dp *dp)
1285 {
1286 u32 read_val, field_val;
1287 int ret;
1288
1289 /*
1290 * Disable the associated PLL (cmn_pll0_en or cmn_pll1_en) before
1291 * re-programming the new data rate.
1292 */
1293 ret = regmap_field_read(cdns_phy->phy_pma_pll_raw_ctrl, &field_val);
1294 if (ret)
1295 return ret;
1296 field_val &= ~(cdns_phy->dp_pll);
1297 regmap_field_write(cdns_phy->phy_pma_pll_raw_ctrl, field_val);
1298
1299 /*
1300 * Wait for PLL ready de-assertion.
1301 * For PLL0 - PHY_PMA_CMN_CTRL2[2] == 1
1302 * For PLL1 - PHY_PMA_CMN_CTRL2[3] == 1
1303 */
1304 if (cdns_phy->dp_pll & DP_PLL0) {
1305 ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2,
1306 read_val,
1307 ((read_val >> 2) & 0x01) != 0,
1308 0, POLL_TIMEOUT_US);
1309 if (ret)
1310 return ret;
1311 }
1312
1313 if ((cdns_phy->dp_pll & DP_PLL1) && cdns_phy->nsubnodes != 1) {
1314 ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2,
1315 read_val,
1316 ((read_val >> 3) & 0x01) != 0,
1317 0, POLL_TIMEOUT_US);
1318 if (ret)
1319 return ret;
1320 }
1321 ndelay(200);
1322
1323 /* DP Rate Change - VCO Output settings. */
1324 if (cdns_phy->ref_clk_rate == CLK_19_2_MHZ)
1325 /* PMA common configuration 19.2MHz */
1326 cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, dp->link_rate, dp->ssc);
1327 else if (cdns_phy->ref_clk_rate == CLK_25_MHZ)
1328 /* PMA common configuration 25MHz */
1329 cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, dp->link_rate, dp->ssc);
1330 else if (cdns_phy->ref_clk_rate == CLK_100_MHZ)
1331 /* PMA common configuration 100MHz */
1332 cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(cdns_phy, dp->link_rate, dp->ssc);
1333
1334 cdns_torrent_dp_pma_cmn_rate(cdns_phy, inst, dp->link_rate, dp->lanes);
1335
1336 /* Enable the associated PLL (cmn_pll0_en or cmn_pll1_en) */
1337 ret = regmap_field_read(cdns_phy->phy_pma_pll_raw_ctrl, &field_val);
1338 if (ret)
1339 return ret;
1340 field_val |= cdns_phy->dp_pll;
1341 regmap_field_write(cdns_phy->phy_pma_pll_raw_ctrl, field_val);
1342
1343 /*
1344 * Wait for PLL ready assertion.
1345 * For PLL0 - PHY_PMA_CMN_CTRL2[0] == 1
1346 * For PLL1 - PHY_PMA_CMN_CTRL2[1] == 1
1347 */
1348 if (cdns_phy->dp_pll & DP_PLL0) {
1349 ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2,
1350 read_val,
1351 (read_val & 0x01) != 0,
1352 0, POLL_TIMEOUT_US);
1353 if (ret)
1354 return ret;
1355 }
1356
1357 if ((cdns_phy->dp_pll & DP_PLL1) && cdns_phy->nsubnodes != 1)
1358 ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2,
1359 read_val,
1360 ((read_val >> 1) & 0x01) != 0,
1361 0, POLL_TIMEOUT_US);
1362
1363 return ret;
1364 }
1365
1366 /*
1367 * Verify, that parameters to configure PHY with are correct.
1368 */
cdns_torrent_dp_verify_config(struct cdns_torrent_inst * inst,struct phy_configure_opts_dp * dp)1369 static int cdns_torrent_dp_verify_config(struct cdns_torrent_inst *inst,
1370 struct phy_configure_opts_dp *dp)
1371 {
1372 u8 i;
1373
1374 /* If changing link rate was required, verify it's supported. */
1375 if (dp->set_rate) {
1376 switch (dp->link_rate) {
1377 case 1620:
1378 case 2160:
1379 case 2430:
1380 case 2700:
1381 case 3240:
1382 case 4320:
1383 case 5400:
1384 case 8100:
1385 /* valid bit rate */
1386 break;
1387 default:
1388 return -EINVAL;
1389 }
1390 }
1391
1392 /* Verify lane count. */
1393 switch (dp->lanes) {
1394 case 1:
1395 case 2:
1396 case 4:
1397 /* valid lane count. */
1398 break;
1399 default:
1400 return -EINVAL;
1401 }
1402
1403 /* Check against actual number of PHY's lanes. */
1404 if (dp->lanes > inst->num_lanes)
1405 return -EINVAL;
1406
1407 /*
1408 * If changing voltages is required, check swing and pre-emphasis
1409 * levels, per-lane.
1410 */
1411 if (dp->set_voltages) {
1412 /* Lane count verified previously. */
1413 for (i = 0; i < dp->lanes; i++) {
1414 if (dp->voltage[i] > 3 || dp->pre[i] > 3)
1415 return -EINVAL;
1416
1417 /* Sum of voltage swing and pre-emphasis levels cannot
1418 * exceed 3.
1419 */
1420 if (dp->voltage[i] + dp->pre[i] > 3)
1421 return -EINVAL;
1422 }
1423 }
1424
1425 return 0;
1426 }
1427
1428 /* Set power state A0 and PLL clock enable to 0 on enabled lanes. */
cdns_torrent_dp_set_a0_pll(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,u32 num_lanes)1429 static void cdns_torrent_dp_set_a0_pll(struct cdns_torrent_phy *cdns_phy,
1430 struct cdns_torrent_inst *inst,
1431 u32 num_lanes)
1432 {
1433 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1434 u32 pwr_state = cdns_torrent_dp_read(regmap,
1435 PHY_PMA_XCVR_POWER_STATE_REQ);
1436 u32 pll_clk_en = cdns_torrent_dp_read(regmap,
1437 PHY_PMA_XCVR_PLLCLK_EN);
1438 u32 i;
1439
1440 for (i = 0; i < num_lanes; i++) {
1441 pwr_state &= ~(PMA_XCVR_POWER_STATE_REQ_LN_MASK
1442 << PHY_POWER_STATE_LN(inst->mlane + i));
1443
1444 pll_clk_en &= ~(0x01U << (inst->mlane + i));
1445 }
1446
1447 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, pwr_state);
1448 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, pll_clk_en);
1449 }
1450
1451 /* Configure lane count as required. */
cdns_torrent_dp_set_lanes(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy_configure_opts_dp * dp)1452 static int cdns_torrent_dp_set_lanes(struct cdns_torrent_phy *cdns_phy,
1453 struct cdns_torrent_inst *inst,
1454 struct phy_configure_opts_dp *dp)
1455 {
1456 u32 value, i;
1457 int ret;
1458 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1459 u8 lane_mask = (1 << dp->lanes) - 1;
1460 u8 pma_tx_elec_idle_mask = 0;
1461 u32 clane = inst->mlane;
1462
1463 lane_mask <<= clane;
1464
1465 value = cdns_torrent_dp_read(regmap, PHY_RESET);
1466 /* clear pma_tx_elec_idle_ln_* bits. */
1467 pma_tx_elec_idle_mask = ((1 << inst->num_lanes) - 1) << clane;
1468
1469 pma_tx_elec_idle_mask <<= PMA_TX_ELEC_IDLE_SHIFT;
1470
1471 value &= ~pma_tx_elec_idle_mask;
1472
1473 /* Assert pma_tx_elec_idle_ln_* for disabled lanes. */
1474 value |= ((~lane_mask) << PMA_TX_ELEC_IDLE_SHIFT) &
1475 pma_tx_elec_idle_mask;
1476
1477 cdns_torrent_dp_write(regmap, PHY_RESET, value);
1478
1479 /* reset the link by asserting master lane phy_l0*_reset_n low */
1480 cdns_torrent_dp_write(regmap, PHY_RESET,
1481 value & (~(1 << clane)));
1482
1483 /*
1484 * Assert lane reset on unused lanes and master lane so they remain in reset
1485 * and powered down when re-enabling the link
1486 */
1487 for (i = 0; i < inst->num_lanes; i++)
1488 value &= (~(1 << (clane + i)));
1489
1490 for (i = 1; i < inst->num_lanes; i++)
1491 value |= ((1 << (clane + i)) & lane_mask);
1492
1493 cdns_torrent_dp_write(regmap, PHY_RESET, value);
1494
1495 cdns_torrent_dp_set_a0_pll(cdns_phy, inst, dp->lanes);
1496
1497 /* release phy_l0*_reset_n based on used laneCount */
1498 for (i = 0; i < inst->num_lanes; i++)
1499 value &= (~(1 << (clane + i)));
1500
1501 for (i = 0; i < inst->num_lanes; i++)
1502 value |= ((1 << (clane + i)) & lane_mask);
1503
1504 cdns_torrent_dp_write(regmap, PHY_RESET, value);
1505
1506 /* Wait, until PHY gets ready after releasing PHY reset signal. */
1507 ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy);
1508 if (ret)
1509 return ret;
1510
1511 ndelay(100);
1512
1513 /* release pma_xcvr_pllclk_en_ln_*, only for the master lane */
1514 value = cdns_torrent_dp_read(regmap, PHY_PMA_XCVR_PLLCLK_EN);
1515 value |= (1 << clane);
1516 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, value);
1517
1518 ret = cdns_torrent_dp_run(cdns_phy, inst, dp->lanes);
1519
1520 return ret;
1521 }
1522
1523 /* Configure link rate as required. */
cdns_torrent_dp_set_rate(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy_configure_opts_dp * dp)1524 static int cdns_torrent_dp_set_rate(struct cdns_torrent_phy *cdns_phy,
1525 struct cdns_torrent_inst *inst,
1526 struct phy_configure_opts_dp *dp)
1527 {
1528 int ret;
1529
1530 ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, dp->lanes,
1531 POWERSTATE_A3);
1532 if (ret)
1533 return ret;
1534 ret = cdns_torrent_dp_set_pll_en(cdns_phy, inst, dp, false);
1535 if (ret)
1536 return ret;
1537 ndelay(200);
1538
1539 ret = cdns_torrent_dp_configure_rate(cdns_phy, inst, dp);
1540 if (ret)
1541 return ret;
1542 ndelay(200);
1543
1544 ret = cdns_torrent_dp_set_pll_en(cdns_phy, inst, dp, true);
1545 if (ret)
1546 return ret;
1547 ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, dp->lanes,
1548 POWERSTATE_A2);
1549 if (ret)
1550 return ret;
1551 ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, dp->lanes,
1552 POWERSTATE_A0);
1553 if (ret)
1554 return ret;
1555 ndelay(900);
1556
1557 return ret;
1558 }
1559
1560 /* Configure voltage swing and pre-emphasis for all enabled lanes. */
cdns_torrent_dp_set_voltages(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy_configure_opts_dp * dp)1561 static void cdns_torrent_dp_set_voltages(struct cdns_torrent_phy *cdns_phy,
1562 struct cdns_torrent_inst *inst,
1563 struct phy_configure_opts_dp *dp)
1564 {
1565 u8 lane;
1566 u16 val;
1567
1568 for (lane = 0; lane < dp->lanes; lane++) {
1569 val = cdns_torrent_phy_read(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1570 TX_DIAG_ACYA);
1571 /*
1572 * Write 1 to register bit TX_DIAG_ACYA[0] to freeze the
1573 * current state of the analog TX driver.
1574 */
1575 val |= TX_DIAG_ACYA_HBDC_MASK;
1576 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1577 TX_DIAG_ACYA, val);
1578
1579 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1580 TX_TXCC_CTRL, 0x08A4);
1581 val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].diag_tx_drv;
1582 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1583 DRV_DIAG_TX_DRV, val);
1584 val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].mgnfs_mult;
1585 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1586 TX_TXCC_MGNFS_MULT_000,
1587 val);
1588 val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].cpost_mult;
1589 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1590 TX_TXCC_CPOST_MULT_00,
1591 val);
1592
1593 val = cdns_torrent_phy_read(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1594 TX_DIAG_ACYA);
1595 /*
1596 * Write 0 to register bit TX_DIAG_ACYA[0] to allow the state of
1597 * analog TX driver to reflect the new programmed one.
1598 */
1599 val &= ~TX_DIAG_ACYA_HBDC_MASK;
1600 cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane],
1601 TX_DIAG_ACYA, val);
1602 }
1603 };
1604
cdns_torrent_dp_configure(struct phy * phy,union phy_configure_opts * opts)1605 static int cdns_torrent_dp_configure(struct phy *phy,
1606 union phy_configure_opts *opts)
1607 {
1608 struct cdns_torrent_inst *inst = phy_get_drvdata(phy);
1609 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent);
1610 int ret;
1611
1612 if (cdns_phy->already_configured)
1613 return 0;
1614
1615 ret = cdns_torrent_dp_verify_config(inst, &opts->dp);
1616 if (ret) {
1617 dev_err(&phy->dev, "invalid params for phy configure\n");
1618 return ret;
1619 }
1620
1621 if (opts->dp.set_lanes) {
1622 ret = cdns_torrent_dp_set_lanes(cdns_phy, inst, &opts->dp);
1623 if (ret) {
1624 dev_err(&phy->dev, "cdns_torrent_dp_set_lanes failed\n");
1625 return ret;
1626 }
1627 }
1628
1629 if (opts->dp.set_rate) {
1630 ret = cdns_torrent_dp_set_rate(cdns_phy, inst, &opts->dp);
1631 if (ret) {
1632 dev_err(&phy->dev, "cdns_torrent_dp_set_rate failed\n");
1633 return ret;
1634 }
1635 }
1636
1637 if (opts->dp.set_voltages)
1638 cdns_torrent_dp_set_voltages(cdns_phy, inst, &opts->dp);
1639
1640 return ret;
1641 }
1642
cdns_torrent_phy_on(struct phy * phy)1643 static int cdns_torrent_phy_on(struct phy *phy)
1644 {
1645 struct cdns_torrent_inst *inst = phy_get_drvdata(phy);
1646 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent);
1647 u32 read_val;
1648 int ret;
1649
1650 if (cdns_phy->already_configured) {
1651 /* Give 5ms to 10ms delay for the PIPE clock to be stable */
1652 usleep_range(5000, 10000);
1653 return 0;
1654 }
1655
1656 if (cdns_phy->nsubnodes == 1) {
1657 /* Take the PHY lane group out of reset */
1658 reset_control_deassert(inst->lnk_rst);
1659
1660 /* Take the PHY out of reset */
1661 ret = reset_control_deassert(cdns_phy->phy_rst);
1662 if (ret)
1663 return ret;
1664 }
1665
1666 /*
1667 * Wait for cmn_ready assertion
1668 * PHY_PMA_CMN_CTRL1[0] == 1
1669 */
1670 ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_1,
1671 read_val, read_val, 1000,
1672 PLL_LOCK_TIMEOUT);
1673 if (ret) {
1674 dev_err(cdns_phy->dev, "Timeout waiting for CMN ready\n");
1675 return ret;
1676 }
1677
1678 if (inst->phy_type == TYPE_PCIE || inst->phy_type == TYPE_USB) {
1679 ret = regmap_field_read_poll_timeout(cdns_phy->phy_pcs_iso_link_ctrl_1[inst->mlane],
1680 read_val, !read_val, 1000,
1681 PLL_LOCK_TIMEOUT);
1682 if (ret == -ETIMEDOUT) {
1683 dev_err(cdns_phy->dev, "Timeout waiting for PHY status ready\n");
1684 return ret;
1685 }
1686 }
1687
1688 return 0;
1689 }
1690
cdns_torrent_phy_off(struct phy * phy)1691 static int cdns_torrent_phy_off(struct phy *phy)
1692 {
1693 struct cdns_torrent_inst *inst = phy_get_drvdata(phy);
1694 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent);
1695 int ret;
1696
1697 if (cdns_phy->nsubnodes != 1)
1698 return 0;
1699
1700 ret = reset_control_assert(cdns_phy->phy_rst);
1701 if (ret)
1702 return ret;
1703
1704 return reset_control_assert(inst->lnk_rst);
1705 }
1706
cdns_torrent_dp_common_init(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst)1707 static void cdns_torrent_dp_common_init(struct cdns_torrent_phy *cdns_phy,
1708 struct cdns_torrent_inst *inst)
1709 {
1710 struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg;
1711 unsigned char lane_bits;
1712 u32 val;
1713
1714 cdns_torrent_dp_write(regmap, PHY_AUX_CTRL, 0x0003); /* enable AUX */
1715
1716 /*
1717 * Set lines power state to A0
1718 * Set lines pll clk enable to 0
1719 */
1720 cdns_torrent_dp_set_a0_pll(cdns_phy, inst, inst->num_lanes);
1721
1722 /*
1723 * release phy_l0*_reset_n and pma_tx_elec_idle_ln_* based on
1724 * used lanes
1725 */
1726 lane_bits = (1 << inst->num_lanes) - 1;
1727
1728 val = cdns_torrent_dp_read(regmap, PHY_RESET);
1729 val |= (0xF & lane_bits);
1730 val &= ~(lane_bits << 4);
1731 cdns_torrent_dp_write(regmap, PHY_RESET, val);
1732
1733 /* release pma_xcvr_pllclk_en_ln_*, only for the master lane */
1734 val = cdns_torrent_dp_read(regmap, PHY_PMA_XCVR_PLLCLK_EN);
1735 val |= 1;
1736 cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, val);
1737
1738 /*
1739 * PHY PMA registers configuration functions
1740 * Initialize PHY with max supported link rate, without SSC.
1741 */
1742 if (cdns_phy->ref_clk_rate == CLK_19_2_MHZ)
1743 cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy,
1744 cdns_phy->max_bit_rate,
1745 false);
1746 else if (cdns_phy->ref_clk_rate == CLK_25_MHZ)
1747 cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy,
1748 cdns_phy->max_bit_rate,
1749 false);
1750 else if (cdns_phy->ref_clk_rate == CLK_100_MHZ)
1751 cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(cdns_phy,
1752 cdns_phy->max_bit_rate,
1753 false);
1754
1755 cdns_torrent_dp_pma_cmn_rate(cdns_phy, inst, cdns_phy->max_bit_rate,
1756 inst->num_lanes);
1757
1758 /* take out of reset */
1759 regmap_field_write(cdns_phy->phy_reset_ctrl, 0x1);
1760 }
1761
cdns_torrent_dp_start(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy * phy)1762 static int cdns_torrent_dp_start(struct cdns_torrent_phy *cdns_phy,
1763 struct cdns_torrent_inst *inst,
1764 struct phy *phy)
1765 {
1766 int ret;
1767
1768 ret = cdns_torrent_phy_on(phy);
1769 if (ret)
1770 return ret;
1771
1772 ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy);
1773 if (ret)
1774 return ret;
1775
1776 ret = cdns_torrent_dp_run(cdns_phy, inst, inst->num_lanes);
1777
1778 return ret;
1779 }
1780
cdns_torrent_dp_init(struct phy * phy)1781 static int cdns_torrent_dp_init(struct phy *phy)
1782 {
1783 struct cdns_torrent_inst *inst = phy_get_drvdata(phy);
1784 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent);
1785 int ret;
1786
1787 switch (cdns_phy->ref_clk_rate) {
1788 case CLK_19_2_MHZ:
1789 case CLK_25_MHZ:
1790 case CLK_100_MHZ:
1791 /* Valid Ref Clock Rate */
1792 break;
1793 default:
1794 dev_err(cdns_phy->dev, "Unsupported Ref Clock Rate\n");
1795 return -EINVAL;
1796 }
1797
1798 ret = cdns_torrent_dp_get_pll(cdns_phy, TYPE_NONE);
1799 if (ret)
1800 return ret;
1801
1802 cdns_torrent_dp_common_init(cdns_phy, inst);
1803
1804 return cdns_torrent_dp_start(cdns_phy, inst, phy);
1805 }
1806
cdns_torrent_dp_multilink_init(struct cdns_torrent_phy * cdns_phy,struct cdns_torrent_inst * inst,struct phy * phy)1807 static int cdns_torrent_dp_multilink_init(struct cdns_torrent_phy *cdns_phy,
1808 struct cdns_torrent_inst *inst,
1809 struct phy *phy)
1810 {
1811 if (cdns_phy->ref_clk_rate != CLK_100_MHZ) {
1812 dev_err(cdns_phy->dev, "Unsupported Ref Clock Rate\n");
1813 return -EINVAL;
1814 }
1815
1816 cdns_torrent_dp_common_init(cdns_phy, inst);
1817
1818 return cdns_torrent_dp_start(cdns_phy, inst, phy);
1819 }
1820
cdns_torrent_derived_refclk_enable(struct clk_hw * hw)1821 static int cdns_torrent_derived_refclk_enable(struct clk_hw *hw)
1822 {
1823 struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw);
1824
1825 regmap_field_write(derived_refclk->cmn_cdiag_refclk_ovrd_4, 1);
1826 regmap_field_write(derived_refclk->phy_pipe_cmn_ctrl1_0, 1);
1827
1828 return 0;
1829 }
1830
cdns_torrent_derived_refclk_disable(struct clk_hw * hw)1831 static void cdns_torrent_derived_refclk_disable(struct clk_hw *hw)
1832 {
1833 struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw);
1834
1835 regmap_field_write(derived_refclk->phy_pipe_cmn_ctrl1_0, 0);
1836 regmap_field_write(derived_refclk->cmn_cdiag_refclk_ovrd_4, 0);
1837 }
1838
cdns_torrent_derived_refclk_is_enabled(struct clk_hw * hw)1839 static int cdns_torrent_derived_refclk_is_enabled(struct clk_hw *hw)
1840 {
1841 struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw);
1842 int val;
1843
1844 regmap_field_read(derived_refclk->cmn_cdiag_refclk_ovrd_4, &val);
1845
1846 return !!val;
1847 }
1848
1849 static const struct clk_ops cdns_torrent_derived_refclk_ops = {
1850 .enable = cdns_torrent_derived_refclk_enable,
1851 .disable = cdns_torrent_derived_refclk_disable,
1852 .is_enabled = cdns_torrent_derived_refclk_is_enabled,
1853 };
1854
cdns_torrent_derived_refclk_register(struct cdns_torrent_phy * cdns_phy)1855 static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_phy)
1856 {
1857 struct cdns_torrent_derived_refclk *derived_refclk;
1858 struct device *dev = cdns_phy->dev;
1859 struct clk_init_data *init;
1860 const char *parent_name;
1861 char clk_name[100];
1862 struct clk_hw *hw;
1863 struct clk *clk;
1864 int ret;
1865
1866 derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL);
1867 if (!derived_refclk)
1868 return -ENOMEM;
1869
1870 snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev),
1871 clk_names[CDNS_TORRENT_DERIVED_REFCLK]);
1872
1873 clk = devm_clk_get_optional(dev, "phy_en_refclk");
1874 if (IS_ERR(clk)) {
1875 dev_err(dev, "No parent clock for derived_refclk\n");
1876 return PTR_ERR(clk);
1877 }
1878
1879 init = &derived_refclk->clk_data;
1880
1881 if (clk) {
1882 parent_name = __clk_get_name(clk);
1883 init->parent_names = &parent_name;
1884 init->num_parents = 1;
1885 }
1886 init->ops = &cdns_torrent_derived_refclk_ops;
1887 init->flags = 0;
1888 init->name = clk_name;
1889
1890 derived_refclk->phy_pipe_cmn_ctrl1_0 = cdns_phy->phy_pipe_cmn_ctrl1_0;
1891 derived_refclk->cmn_cdiag_refclk_ovrd_4 = cdns_phy->cmn_cdiag_refclk_ovrd_4;
1892
1893 derived_refclk->hw.init = init;
1894
1895 hw = &derived_refclk->hw;
1896 ret = devm_clk_hw_register(dev, hw);
1897 if (ret)
1898 return ret;
1899
1900 cdns_phy->clk_hw_data->hws[CDNS_TORRENT_DERIVED_REFCLK] = hw;
1901
1902 return 0;
1903 }
1904
cdns_torrent_received_refclk_enable(struct clk_hw * hw)1905 static int cdns_torrent_received_refclk_enable(struct clk_hw *hw)
1906 {
1907 struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw);
1908
1909 regmap_field_write(received_refclk->phy_pipe_cmn_ctrl1_0, 1);
1910
1911 return 0;
1912 }
1913
cdns_torrent_received_refclk_disable(struct clk_hw * hw)1914 static void cdns_torrent_received_refclk_disable(struct clk_hw *hw)
1915 {
1916 struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw);
1917
1918 regmap_field_write(received_refclk->phy_pipe_cmn_ctrl1_0, 0);
1919 }
1920
cdns_torrent_received_refclk_is_enabled(struct clk_hw * hw)1921 static int cdns_torrent_received_refclk_is_enabled(struct clk_hw *hw)
1922 {
1923 struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw);
1924 int val, cmn_val;
1925
1926 regmap_field_read(received_refclk->phy_pipe_cmn_ctrl1_0, &val);
1927 regmap_field_read(received_refclk->cmn_cdiag_refclk_ovrd_4, &cmn_val);
1928
1929 return val && !cmn_val;
1930 }
1931
1932 static const struct clk_ops cdns_torrent_received_refclk_ops = {
1933 .enable = cdns_torrent_received_refclk_enable,
1934 .disable = cdns_torrent_received_refclk_disable,
1935 .is_enabled = cdns_torrent_received_refclk_is_enabled,
1936 };
1937
cdns_torrent_received_refclk_register(struct cdns_torrent_phy * cdns_phy)1938 static int cdns_torrent_received_refclk_register(struct cdns_torrent_phy *cdns_phy)
1939 {
1940 struct cdns_torrent_received_refclk *received_refclk;
1941 struct device *dev = cdns_phy->dev;
1942 struct clk_init_data *init;
1943 const char *parent_name;
1944 char clk_name[100];
1945 struct clk_hw *hw;
1946 struct clk *clk;
1947 int ret;
1948
1949 received_refclk = devm_kzalloc(dev, sizeof(*received_refclk), GFP_KERNEL);
1950 if (!received_refclk)
1951 return -ENOMEM;
1952
1953 snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev),
1954 clk_names[CDNS_TORRENT_RECEIVED_REFCLK]);
1955
1956 clk = devm_clk_get_optional(dev, "phy_en_refclk");
1957 if (IS_ERR(clk)) {
1958 dev_err(dev, "No parent clock for received_refclk\n");
1959 return PTR_ERR(clk);
1960 }
1961
1962 init = &received_refclk->clk_data;
1963
1964 if (clk) {
1965 parent_name = __clk_get_name(clk);
1966 init->parent_names = &parent_name;
1967 init->num_parents = 1;
1968 }
1969 init->ops = &cdns_torrent_received_refclk_ops;
1970 init->flags = 0;
1971 init->name = clk_name;
1972
1973 received_refclk->phy_pipe_cmn_ctrl1_0 = cdns_phy->phy_pipe_cmn_ctrl1_0;
1974 received_refclk->cmn_cdiag_refclk_ovrd_4 = cdns_phy->cmn_cdiag_refclk_ovrd_4;
1975
1976 received_refclk->hw.init = init;
1977
1978 hw = &received_refclk->hw;
1979 ret = devm_clk_hw_register(dev, hw);
1980 if (ret)
1981 return ret;
1982
1983 cdns_phy->clk_hw_data->hws[CDNS_TORRENT_RECEIVED_REFCLK] = hw;
1984
1985 return 0;
1986 }
1987
cdns_torrent_refclk_driver_enable(struct clk_hw * hw)1988 static int cdns_torrent_refclk_driver_enable(struct clk_hw *hw)
1989 {
1990 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
1991
1992 regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_6], 0);
1993 regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_5], 1);
1994 regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 0);
1995
1996 return 0;
1997 }
1998
cdns_torrent_refclk_driver_disable(struct clk_hw * hw)1999 static void cdns_torrent_refclk_driver_disable(struct clk_hw *hw)
2000 {
2001 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
2002
2003 regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 1);
2004 }
2005
cdns_torrent_refclk_driver_is_enabled(struct clk_hw * hw)2006 static int cdns_torrent_refclk_driver_is_enabled(struct clk_hw *hw)
2007 {
2008 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
2009 int val;
2010
2011 regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], &val);
2012
2013 return !val;
2014 }
2015
cdns_torrent_refclk_driver_get_parent(struct clk_hw * hw)2016 static u8 cdns_torrent_refclk_driver_get_parent(struct clk_hw *hw)
2017 {
2018 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
2019 unsigned int val;
2020
2021 regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], &val);
2022 return clk_mux_val_to_index(hw, cdns_torrent_refclk_driver_mux_table, 0, val);
2023 }
2024
cdns_torrent_refclk_driver_set_parent(struct clk_hw * hw,u8 index)2025 static int cdns_torrent_refclk_driver_set_parent(struct clk_hw *hw, u8 index)
2026 {
2027 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
2028 unsigned int val;
2029
2030 val = cdns_torrent_refclk_driver_mux_table[index];
2031 return regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], val);
2032 }
2033
2034 static const struct clk_ops cdns_torrent_refclk_driver_ops = {
2035 .enable = cdns_torrent_refclk_driver_enable,
2036 .disable = cdns_torrent_refclk_driver_disable,
2037 .is_enabled = cdns_torrent_refclk_driver_is_enabled,
2038 .determine_rate = __clk_mux_determine_rate,
2039 .set_parent = cdns_torrent_refclk_driver_set_parent,
2040 .get_parent = cdns_torrent_refclk_driver_get_parent,
2041 };
2042
cdns_torrent_refclk_driver_register(struct cdns_torrent_phy * cdns_phy)2043 static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy)
2044 {
2045 struct cdns_torrent_refclk_driver *refclk_driver;
2046 struct device *dev = cdns_phy->dev;
2047 struct regmap_field *field;
2048 struct clk_init_data *init;
2049 const char **parent_names;
2050 unsigned int num_parents;
2051 struct regmap *regmap;
2052 char clk_name[100];
2053 struct clk_hw *hw;
2054 int i, ret;
2055
2056 refclk_driver = devm_kzalloc(dev, sizeof(*refclk_driver), GFP_KERNEL);
2057 if (!refclk_driver)
2058 return -ENOMEM;
2059
2060 num_parents = ARRAY_SIZE(refclk_driver_parent_index);
2061 parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL);
2062 if (!parent_names)
2063 return -ENOMEM;
2064
2065 for (i = 0; i < num_parents; i++) {
2066 hw = cdns_phy->clk_hw_data->hws[refclk_driver_parent_index[i]];
2067 if (IS_ERR_OR_NULL(hw)) {
2068 dev_err(dev, "No parent clock for refclk driver clock\n");
2069 return IS_ERR(hw) ? PTR_ERR(hw) : -ENOENT;
2070 }
2071 parent_names[i] = clk_hw_get_name(hw);
2072 }
2073
2074 snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev),
2075 clk_names[CDNS_TORRENT_REFCLK_DRIVER]);
2076
2077 init = &refclk_driver->clk_data;
2078
2079 init->ops = &cdns_torrent_refclk_driver_ops;
2080 init->flags = CLK_SET_RATE_NO_REPARENT;
2081 init->parent_names = parent_names;
2082 init->num_parents = num_parents;
2083 init->name = clk_name;
2084
2085 regmap = cdns_phy->regmap_common_cdb;
2086
2087 for (i = 0; i < REFCLK_OUT_NUM_CMN_CONFIG; i++) {
2088 field = devm_regmap_field_alloc(dev, regmap, refclk_out_cmn_cfg[i]);
2089 if (IS_ERR(field)) {
2090 dev_err(dev, "Refclk driver CMN reg field init failed\n");
2091 return PTR_ERR(field);
2092 }
2093 refclk_driver->cmn_fields[i] = field;
2094 }
2095
2096 /* Enable Derived reference clock as default */
2097 regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], 1);
2098
2099 refclk_driver->hw.init = init;
2100
2101 hw = &refclk_driver->hw;
2102 ret = devm_clk_hw_register(dev, hw);
2103 if (ret)
2104 return ret;
2105
2106 cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER] = hw;
2107
2108 return 0;
2109 }
2110
cdns_regmap_init(struct device * dev,void __iomem * base,u32 block_offset,u8 reg_offset_shift,const struct regmap_config * config)2111 static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base,
2112 u32 block_offset,
2113 u8 reg_offset_shift,
2114 const struct regmap_config *config)
2115 {
2116 struct cdns_regmap_cdb_context *ctx;
2117
2118 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
2119 if (!ctx)
2120 return ERR_PTR(-ENOMEM);
2121
2122 ctx->dev = dev;
2123 ctx->base = base + block_offset;
2124 ctx->reg_offset_shift = reg_offset_shift;
2125
2126 return devm_regmap_init(dev, NULL, ctx, config);
2127 }
2128
cdns_torrent_dp_regfield_init(struct cdns_torrent_phy * cdns_phy)2129 static int cdns_torrent_dp_regfield_init(struct cdns_torrent_phy *cdns_phy)
2130 {
2131 struct device *dev = cdns_phy->dev;
2132 struct regmap_field *field;
2133 struct regmap *regmap;
2134
2135 regmap = cdns_phy->regmap_dptx_phy_reg;
2136 field = devm_regmap_field_alloc(dev, regmap, phy_reset_ctrl);
2137 if (IS_ERR(field)) {
2138 dev_err(dev, "PHY_RESET reg field init failed\n");
2139 return PTR_ERR(field);
2140 }
2141 cdns_phy->phy_reset_ctrl = field;
2142
2143 return 0;
2144 }
2145
cdns_torrent_regfield_init(struct cdns_torrent_phy * cdns_phy)2146 static int cdns_torrent_regfield_init(struct cdns_torrent_phy *cdns_phy)
2147 {
2148 struct device *dev = cdns_phy->dev;
2149 struct regmap_field *field;
2150 struct regmap *regmap;
2151 int i;
2152
2153 regmap = cdns_phy->regmap_phy_pcs_common_cdb;
2154 field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg);
2155 if (IS_ERR(field)) {
2156 dev_err(dev, "PHY_PLL_CFG reg field init failed\n");
2157 return PTR_ERR(field);
2158 }
2159 cdns_phy->phy_pll_cfg = field;
2160
2161 regmap = cdns_phy->regmap_phy_pcs_common_cdb;
2162 field = devm_regmap_field_alloc(dev, regmap, phy_pipe_cmn_ctrl1_0);
2163 if (IS_ERR(field)) {
2164 dev_err(dev, "phy_pipe_cmn_ctrl1_0 reg field init failed\n");
2165 return PTR_ERR(field);
2166 }
2167 cdns_phy->phy_pipe_cmn_ctrl1_0 = field;
2168
2169 regmap = cdns_phy->regmap_common_cdb;
2170 field = devm_regmap_field_alloc(dev, regmap, cmn_cdiag_refclk_ovrd_4);
2171 if (IS_ERR(field)) {
2172 dev_err(dev, "cmn_cdiag_refclk_ovrd_4 reg field init failed\n");
2173 return PTR_ERR(field);
2174 }
2175 cdns_phy->cmn_cdiag_refclk_ovrd_4 = field;
2176
2177 regmap = cdns_phy->regmap_phy_pma_common_cdb;
2178 field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_1);
2179 if (IS_ERR(field)) {
2180 dev_err(dev, "PHY_PMA_CMN_CTRL1 reg field init failed\n");
2181 return PTR_ERR(field);
2182 }
2183 cdns_phy->phy_pma_cmn_ctrl_1 = field;
2184
2185 regmap = cdns_phy->regmap_phy_pma_common_cdb;
2186 field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_2);
2187 if (IS_ERR(field)) {
2188 dev_err(dev, "PHY_PMA_CMN_CTRL2 reg field init failed\n");
2189 return PTR_ERR(field);
2190 }
2191 cdns_phy->phy_pma_cmn_ctrl_2 = field;
2192
2193 regmap = cdns_phy->regmap_phy_pma_common_cdb;
2194 field = devm_regmap_field_alloc(dev, regmap, phy_pma_pll_raw_ctrl);
2195 if (IS_ERR(field)) {
2196 dev_err(dev, "PHY_PMA_PLL_RAW_CTRL reg field init failed\n");
2197 return PTR_ERR(field);
2198 }
2199 cdns_phy->phy_pma_pll_raw_ctrl = field;
2200
2201 for (i = 0; i < MAX_NUM_LANES; i++) {
2202 regmap = cdns_phy->regmap_phy_pcs_lane_cdb[i];
2203 field = devm_regmap_field_alloc(dev, regmap, phy_pcs_iso_link_ctrl_1);
2204 if (IS_ERR(field)) {
2205 dev_err(dev, "PHY_PCS_ISO_LINK_CTRL reg field init for ln %d failed\n", i);
2206 return PTR_ERR(field);
2207 }
2208 cdns_phy->phy_pcs_iso_link_ctrl_1[i] = field;
2209 }
2210
2211 return 0;
2212 }
2213
cdns_torrent_dp_regmap_init(struct cdns_torrent_phy * cdns_phy)2214 static int cdns_torrent_dp_regmap_init(struct cdns_torrent_phy *cdns_phy)
2215 {
2216 void __iomem *base = cdns_phy->base;
2217 struct device *dev = cdns_phy->dev;
2218 struct regmap *regmap;
2219 u8 reg_offset_shift;
2220 u32 block_offset;
2221
2222 reg_offset_shift = cdns_phy->init_data->reg_offset_shift;
2223
2224 block_offset = TORRENT_DPTX_PHY_OFFSET;
2225 regmap = cdns_regmap_init(dev, base, block_offset,
2226 reg_offset_shift,
2227 &cdns_torrent_dptx_phy_config);
2228 if (IS_ERR(regmap)) {
2229 dev_err(dev, "Failed to init DPTX PHY regmap\n");
2230 return PTR_ERR(regmap);
2231 }
2232 cdns_phy->regmap_dptx_phy_reg = regmap;
2233
2234 return 0;
2235 }
2236
cdns_torrent_regmap_init(struct cdns_torrent_phy * cdns_phy)2237 static int cdns_torrent_regmap_init(struct cdns_torrent_phy *cdns_phy)
2238 {
2239 void __iomem *sd_base = cdns_phy->sd_base;
2240 u8 block_offset_shift, reg_offset_shift;
2241 struct device *dev = cdns_phy->dev;
2242 struct regmap *regmap;
2243 u32 block_offset;
2244 int i;
2245
2246 block_offset_shift = cdns_phy->init_data->block_offset_shift;
2247 reg_offset_shift = cdns_phy->init_data->reg_offset_shift;
2248
2249 for (i = 0; i < MAX_NUM_LANES; i++) {
2250 block_offset = TORRENT_TX_LANE_CDB_OFFSET(i, block_offset_shift,
2251 reg_offset_shift);
2252 regmap = cdns_regmap_init(dev, sd_base, block_offset,
2253 reg_offset_shift,
2254 &cdns_torrent_tx_lane_cdb_config[i]);
2255 if (IS_ERR(regmap)) {
2256 dev_err(dev, "Failed to init tx lane CDB regmap\n");
2257 return PTR_ERR(regmap);
2258 }
2259 cdns_phy->regmap_tx_lane_cdb[i] = regmap;
2260
2261 block_offset = TORRENT_RX_LANE_CDB_OFFSET(i, block_offset_shift,
2262 reg_offset_shift);
2263 regmap = cdns_regmap_init(dev, sd_base, block_offset,
2264 reg_offset_shift,
2265 &cdns_torrent_rx_lane_cdb_config[i]);
2266 if (IS_ERR(regmap)) {
2267 dev_err(dev, "Failed to init rx lane CDB regmap\n");
2268 return PTR_ERR(regmap);
2269 }
2270 cdns_phy->regmap_rx_lane_cdb[i] = regmap;
2271
2272 block_offset = TORRENT_PHY_PCS_LANE_CDB_OFFSET(i, block_offset_shift,
2273 reg_offset_shift);
2274 regmap = cdns_regmap_init(dev, sd_base, block_offset,
2275 reg_offset_shift,
2276 &cdns_torrent_phy_pcs_lane_cdb_config[i]);
2277 if (IS_ERR(regmap)) {
2278 dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n");
2279 return PTR_ERR(regmap);
2280 }
2281 cdns_phy->regmap_phy_pcs_lane_cdb[i] = regmap;
2282 }
2283
2284 block_offset = TORRENT_COMMON_CDB_OFFSET;
2285 regmap = cdns_regmap_init(dev, sd_base, block_offset,
2286 reg_offset_shift,
2287 &cdns_torrent_common_cdb_config);
2288 if (IS_ERR(regmap)) {
2289 dev_err(dev, "Failed to init common CDB regmap\n");
2290 return PTR_ERR(regmap);
2291 }
2292 cdns_phy->regmap_common_cdb = regmap;
2293
2294 block_offset = TORRENT_PHY_PCS_COMMON_OFFSET(block_offset_shift);
2295 regmap = cdns_regmap_init(dev, sd_base, block_offset,
2296 reg_offset_shift,
2297 &cdns_torrent_phy_pcs_cmn_cdb_config);
2298 if (IS_ERR(regmap)) {
2299 dev_err(dev, "Failed to init PHY PCS common CDB regmap\n");
2300 return PTR_ERR(regmap);
2301 }
2302 cdns_phy->regmap_phy_pcs_common_cdb = regmap;
2303
2304 block_offset = TORRENT_PHY_PMA_COMMON_OFFSET(block_offset_shift);
2305 regmap = cdns_regmap_init(dev, sd_base, block_offset,
2306 reg_offset_shift,
2307 &cdns_torrent_phy_pma_cmn_cdb_config);
2308 if (IS_ERR(regmap)) {
2309 dev_err(dev, "Failed to init PHY PMA common CDB regmap\n");
2310 return PTR_ERR(regmap);
2311 }
2312 cdns_phy->regmap_phy_pma_common_cdb = regmap;
2313
2314 return 0;
2315 }
2316
cdns_torrent_phy_init(struct phy * phy)2317 static int cdns_torrent_phy_init(struct phy *phy)
2318 {
2319 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent);
2320 const struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals;
2321 const struct cdns_torrent_data *init_data = cdns_phy->init_data;
2322 const struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals;
2323 enum cdns_torrent_ref_clk ref_clk = cdns_phy->ref_clk_rate;
2324 struct cdns_torrent_inst *inst = phy_get_drvdata(phy);
2325 enum cdns_torrent_phy_type phy_type = inst->phy_type;
2326 const struct cdns_torrent_vals *phy_pma_cmn_vals;
2327 enum cdns_torrent_ssc_mode ssc = inst->ssc_mode;
2328 const struct cdns_torrent_vals *pcs_cmn_vals;
2329 const struct cdns_reg_pairs *reg_pairs;
2330 struct regmap *regmap;
2331 u32 num_regs;
2332 int i, j;
2333
2334 if (cdns_phy->already_configured)
2335 return 0;
2336
2337 if (cdns_phy->nsubnodes > 1) {
2338 if (phy_type == TYPE_DP)
2339 return cdns_torrent_dp_multilink_init(cdns_phy, inst, phy);
2340 return 0;
2341 }
2342
2343 /**
2344 * Spread spectrum generation is not required or supported
2345 * for SGMII/QSGMII/USXGMII
2346 */
2347 if (phy_type == TYPE_SGMII || phy_type == TYPE_QSGMII || phy_type == TYPE_USXGMII)
2348 ssc = NO_SSC;
2349
2350 /* PHY configuration specific registers for single link */
2351 link_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->link_cmn_vals_tbl,
2352 CLK_ANY, CLK_ANY,
2353 phy_type, TYPE_NONE,
2354 ANY_SSC);
2355 if (link_cmn_vals) {
2356 reg_pairs = link_cmn_vals->reg_pairs;
2357 num_regs = link_cmn_vals->num_regs;
2358 regmap = cdns_phy->regmap_common_cdb;
2359
2360 /**
2361 * First array value in link_cmn_vals must be of
2362 * PHY_PLL_CFG register
2363 */
2364 regmap_field_write(cdns_phy->phy_pll_cfg, reg_pairs[0].val);
2365
2366 for (i = 1; i < num_regs; i++)
2367 regmap_write(regmap, reg_pairs[i].off,
2368 reg_pairs[i].val);
2369 }
2370
2371 xcvr_diag_vals = cdns_torrent_get_tbl_vals(&init_data->xcvr_diag_vals_tbl,
2372 CLK_ANY, CLK_ANY,
2373 phy_type, TYPE_NONE,
2374 ANY_SSC);
2375 if (xcvr_diag_vals) {
2376 reg_pairs = xcvr_diag_vals->reg_pairs;
2377 num_regs = xcvr_diag_vals->num_regs;
2378 for (i = 0; i < inst->num_lanes; i++) {
2379 regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane];
2380 for (j = 0; j < num_regs; j++)
2381 regmap_write(regmap, reg_pairs[j].off,
2382 reg_pairs[j].val);
2383 }
2384 }
2385
2386 /* PHY PCS common registers configurations */
2387 pcs_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->pcs_cmn_vals_tbl,
2388 CLK_ANY, CLK_ANY,
2389 phy_type, TYPE_NONE,
2390 ANY_SSC);
2391 if (pcs_cmn_vals) {
2392 reg_pairs = pcs_cmn_vals->reg_pairs;
2393 num_regs = pcs_cmn_vals->num_regs;
2394 regmap = cdns_phy->regmap_phy_pcs_common_cdb;
2395 for (i = 0; i < num_regs; i++)
2396 regmap_write(regmap, reg_pairs[i].off,
2397 reg_pairs[i].val);
2398 }
2399
2400 /* PHY PMA common registers configurations */
2401 phy_pma_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->phy_pma_cmn_vals_tbl,
2402 CLK_ANY, CLK_ANY,
2403 phy_type, TYPE_NONE,
2404 ANY_SSC);
2405 if (phy_pma_cmn_vals) {
2406 reg_pairs = phy_pma_cmn_vals->reg_pairs;
2407 num_regs = phy_pma_cmn_vals->num_regs;
2408 regmap = cdns_phy->regmap_phy_pma_common_cdb;
2409 for (i = 0; i < num_regs; i++)
2410 regmap_write(regmap, reg_pairs[i].off,
2411 reg_pairs[i].val);
2412 }
2413
2414 /* PMA common registers configurations */
2415 cmn_vals = cdns_torrent_get_tbl_vals(&init_data->cmn_vals_tbl,
2416 ref_clk, ref_clk,
2417 phy_type, TYPE_NONE,
2418 ssc);
2419 if (cmn_vals) {
2420 reg_pairs = cmn_vals->reg_pairs;
2421 num_regs = cmn_vals->num_regs;
2422 regmap = cdns_phy->regmap_common_cdb;
2423 for (i = 0; i < num_regs; i++)
2424 regmap_write(regmap, reg_pairs[i].off,
2425 reg_pairs[i].val);
2426 }
2427
2428 /* PMA TX lane registers configurations */
2429 tx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->tx_ln_vals_tbl,
2430 ref_clk, ref_clk,
2431 phy_type, TYPE_NONE,
2432 ssc);
2433 if (tx_ln_vals) {
2434 reg_pairs = tx_ln_vals->reg_pairs;
2435 num_regs = tx_ln_vals->num_regs;
2436 for (i = 0; i < inst->num_lanes; i++) {
2437 regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane];
2438 for (j = 0; j < num_regs; j++)
2439 regmap_write(regmap, reg_pairs[j].off,
2440 reg_pairs[j].val);
2441 }
2442 }
2443
2444 /* PMA RX lane registers configurations */
2445 rx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->rx_ln_vals_tbl,
2446 ref_clk, ref_clk,
2447 phy_type, TYPE_NONE,
2448 ssc);
2449 if (rx_ln_vals) {
2450 reg_pairs = rx_ln_vals->reg_pairs;
2451 num_regs = rx_ln_vals->num_regs;
2452 for (i = 0; i < inst->num_lanes; i++) {
2453 regmap = cdns_phy->regmap_rx_lane_cdb[i + inst->mlane];
2454 for (j = 0; j < num_regs; j++)
2455 regmap_write(regmap, reg_pairs[j].off,
2456 reg_pairs[j].val);
2457 }
2458 }
2459
2460 if (phy_type == TYPE_DP)
2461 return cdns_torrent_dp_init(phy);
2462
2463 return 0;
2464 }
2465
2466 static const struct phy_ops cdns_torrent_phy_ops = {
2467 .init = cdns_torrent_phy_init,
2468 .configure = cdns_torrent_dp_configure,
2469 .power_on = cdns_torrent_phy_on,
2470 .power_off = cdns_torrent_phy_off,
2471 .owner = THIS_MODULE,
2472 };
2473
2474 static
cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy * cdns_phy)2475 int cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy)
2476 {
2477 const struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals;
2478 const struct cdns_torrent_data *init_data = cdns_phy->init_data;
2479 const struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals;
2480 enum cdns_torrent_ref_clk ref_clk1 = cdns_phy->ref_clk1_rate;
2481 enum cdns_torrent_ref_clk ref_clk = cdns_phy->ref_clk_rate;
2482 const struct cdns_torrent_vals *phy_pma_cmn_vals;
2483 const struct cdns_torrent_vals *pcs_cmn_vals;
2484 enum cdns_torrent_phy_type phy_t1, phy_t2;
2485 const struct cdns_reg_pairs *reg_pairs;
2486 int i, j, node, mlane, num_lanes, ret;
2487 struct device *dev = cdns_phy->dev;
2488 enum cdns_torrent_ssc_mode ssc;
2489 struct regmap *regmap;
2490 u32 num_regs, num_protocols, protocol;
2491 u32 num_pcie_links = 0;
2492
2493 num_protocols = hweight32(cdns_phy->protocol_bitmask);
2494 /* Maximum 2 protocols are supported */
2495 if (num_protocols > 2) {
2496 dev_err(dev, "at most 2 protocols are supported\n");
2497 return -EINVAL;
2498 }
2499
2500
2501 /**
2502 * Get PHY types directly from subnodes if only 2 subnodes exist.
2503 * It is possible for phy_t1 to be the same as phy_t2 for special
2504 * configurations such as PCIe Multilink.
2505 */
2506 if (cdns_phy->nsubnodes == 2) {
2507 phy_t1 = cdns_phy->phys[0].phy_type;
2508 phy_t2 = cdns_phy->phys[1].phy_type;
2509 } else {
2510 /**
2511 * Both PHY types / protocols should be unique.
2512 * If they are the same, it should be expressed with either
2513 * a) Single-Link (1 Sub-node) - handled via PHY APIs
2514 * OR
2515 * b) Double-Link (2 Sub-nodes) - handled above
2516 */
2517 if (num_protocols != 2) {
2518 dev_err(dev, "incorrect representation of link\n");
2519 return -EINVAL;
2520 }
2521
2522 phy_t1 = fns(cdns_phy->protocol_bitmask, 0);
2523 phy_t2 = fns(cdns_phy->protocol_bitmask, 1);
2524
2525 /*
2526 * PCIe Multilink configuration can be supported along with a
2527 * non-PCIe protocol. The existing limitation associated with
2528 * the standalone PCIe Multilink configuration still remains,
2529 * implying that there can be only two links (subnodes) of the
2530 * PHY type PCIe which constitute the PCIe Multilink.
2531 *
2532 * Such configurations are handled by introducing a new protocol
2533 * namely TYPE_PCIE_ML. Both of the PCIe links which have the
2534 * protocol as TYPE_PCIE shall be treated as though the protocol
2535 * corresponding to them is TYPE_PCIE_ML only for the sake of
2536 * configuring the SERDES.
2537 *
2538 * PCIe Multilink configuration can be identified by checking if
2539 * there are exactly two links with phy_type set to TYPE_PCIE.
2540 * phy_t1 and phy_t2 are modified in such cases to support the
2541 * PCIe Multilink configuration with a non-PCIe protocol.
2542 */
2543 for (node = 0; node < cdns_phy->nsubnodes; node++) {
2544 if (cdns_phy->phys[node].phy_type == TYPE_PCIE)
2545 num_pcie_links++;
2546 }
2547
2548 if (num_pcie_links > 2) {
2549 dev_err(dev, "cannot support PCIe Multilink with %u PCIe links\n",
2550 num_pcie_links);
2551 return -EINVAL;
2552 } else if (num_pcie_links == 2) {
2553 phy_t1 = TYPE_PCIE_ML;
2554 for (node = 0; node < cdns_phy->nsubnodes; node++) {
2555 if (cdns_phy->phys[node].phy_type == TYPE_PCIE) {
2556 cdns_phy->phys[node].phy_type = TYPE_PCIE_ML;
2557 continue;
2558 }
2559 phy_t2 = cdns_phy->phys[node].phy_type;
2560 }
2561 }
2562 }
2563
2564 /**
2565 * Configure all links with the protocol phy_t1 first followed by
2566 * configuring all links with the protocol phy_t2.
2567 *
2568 * When phy_t1 = phy_t2, it is a single protocol and configuration
2569 * is performed with a single iteration of the protocol and multiple
2570 * iterations over the sub-nodes (links).
2571 *
2572 * When phy_t1 != phy_t2, there are two protocols and configuration
2573 * is performed by iterating over all sub-nodes matching the first
2574 * protocol and configuring them first, followed by iterating over
2575 * all sub-nodes matching the second protocol and configuring them
2576 * next.
2577 */
2578 for (protocol = 0; protocol < num_protocols; protocol++) {
2579 /**
2580 * For the case where num_protocols is 1,
2581 * phy_t1 = phy_t2 and the swap is unnecessary.
2582 *
2583 * Swapping phy_t1 and phy_t2 is only required when the
2584 * number of protocols is 2 and there are 2 or more links.
2585 */
2586 if (protocol == 1) {
2587 /**
2588 * If first protocol with phy_t1 is configured, then
2589 * configure the PHY for second protocol with phy_t2.
2590 * Get the array values as [phy_t2][phy_t1][ssc].
2591 */
2592 swap(phy_t1, phy_t2);
2593 swap(ref_clk, ref_clk1);
2594 }
2595
2596 for (node = 0; node < cdns_phy->nsubnodes; node++) {
2597 if (cdns_phy->phys[node].phy_type != phy_t1)
2598 continue;
2599
2600 mlane = cdns_phy->phys[node].mlane;
2601 ssc = cdns_phy->phys[node].ssc_mode;
2602 num_lanes = cdns_phy->phys[node].num_lanes;
2603
2604 /**
2605 * PHY configuration specific registers:
2606 * link_cmn_vals depend on combination of PHY types being
2607 * configured and are common for both PHY types, so array
2608 * values should be same for [phy_t1][phy_t2][ssc] and
2609 * [phy_t2][phy_t1][ssc].
2610 * xcvr_diag_vals also depend on combination of PHY types
2611 * being configured, but these can be different for particular
2612 * PHY type and are per lane.
2613 */
2614 link_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->link_cmn_vals_tbl,
2615 CLK_ANY, CLK_ANY,
2616 phy_t1, phy_t2, ANY_SSC);
2617 if (link_cmn_vals) {
2618 reg_pairs = link_cmn_vals->reg_pairs;
2619 num_regs = link_cmn_vals->num_regs;
2620 regmap = cdns_phy->regmap_common_cdb;
2621
2622 /**
2623 * First array value in link_cmn_vals must be of
2624 * PHY_PLL_CFG register
2625 */
2626 regmap_field_write(cdns_phy->phy_pll_cfg,
2627 reg_pairs[0].val);
2628
2629 for (i = 1; i < num_regs; i++)
2630 regmap_write(regmap, reg_pairs[i].off,
2631 reg_pairs[i].val);
2632 }
2633
2634 xcvr_diag_vals = cdns_torrent_get_tbl_vals(&init_data->xcvr_diag_vals_tbl,
2635 CLK_ANY, CLK_ANY,
2636 phy_t1, phy_t2, ANY_SSC);
2637 if (xcvr_diag_vals) {
2638 reg_pairs = xcvr_diag_vals->reg_pairs;
2639 num_regs = xcvr_diag_vals->num_regs;
2640 for (i = 0; i < num_lanes; i++) {
2641 regmap = cdns_phy->regmap_tx_lane_cdb[i + mlane];
2642 for (j = 0; j < num_regs; j++)
2643 regmap_write(regmap, reg_pairs[j].off,
2644 reg_pairs[j].val);
2645 }
2646 }
2647
2648 /* PHY PCS common registers configurations */
2649 pcs_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->pcs_cmn_vals_tbl,
2650 CLK_ANY, CLK_ANY,
2651 phy_t1, phy_t2, ANY_SSC);
2652 if (pcs_cmn_vals) {
2653 reg_pairs = pcs_cmn_vals->reg_pairs;
2654 num_regs = pcs_cmn_vals->num_regs;
2655 regmap = cdns_phy->regmap_phy_pcs_common_cdb;
2656 for (i = 0; i < num_regs; i++)
2657 regmap_write(regmap, reg_pairs[i].off,
2658 reg_pairs[i].val);
2659 }
2660
2661 /* PHY PMA common registers configurations */
2662 phy_pma_cmn_vals =
2663 cdns_torrent_get_tbl_vals(&init_data->phy_pma_cmn_vals_tbl,
2664 CLK_ANY, CLK_ANY, phy_t1, phy_t2,
2665 ANY_SSC);
2666 if (phy_pma_cmn_vals) {
2667 reg_pairs = phy_pma_cmn_vals->reg_pairs;
2668 num_regs = phy_pma_cmn_vals->num_regs;
2669 regmap = cdns_phy->regmap_phy_pma_common_cdb;
2670 for (i = 0; i < num_regs; i++)
2671 regmap_write(regmap, reg_pairs[i].off,
2672 reg_pairs[i].val);
2673 }
2674
2675 /* PMA common registers configurations */
2676 cmn_vals = cdns_torrent_get_tbl_vals(&init_data->cmn_vals_tbl,
2677 ref_clk, ref_clk1,
2678 phy_t1, phy_t2, ssc);
2679 if (cmn_vals) {
2680 reg_pairs = cmn_vals->reg_pairs;
2681 num_regs = cmn_vals->num_regs;
2682 regmap = cdns_phy->regmap_common_cdb;
2683 for (i = 0; i < num_regs; i++)
2684 regmap_write(regmap, reg_pairs[i].off,
2685 reg_pairs[i].val);
2686 }
2687
2688 /* PMA TX lane registers configurations */
2689 tx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->tx_ln_vals_tbl,
2690 ref_clk, ref_clk1,
2691 phy_t1, phy_t2, ssc);
2692 if (tx_ln_vals) {
2693 reg_pairs = tx_ln_vals->reg_pairs;
2694 num_regs = tx_ln_vals->num_regs;
2695 for (i = 0; i < num_lanes; i++) {
2696 regmap = cdns_phy->regmap_tx_lane_cdb[i + mlane];
2697 for (j = 0; j < num_regs; j++)
2698 regmap_write(regmap, reg_pairs[j].off,
2699 reg_pairs[j].val);
2700 }
2701 }
2702
2703 /* PMA RX lane registers configurations */
2704 rx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->rx_ln_vals_tbl,
2705 ref_clk, ref_clk1,
2706 phy_t1, phy_t2, ssc);
2707 if (rx_ln_vals) {
2708 reg_pairs = rx_ln_vals->reg_pairs;
2709 num_regs = rx_ln_vals->num_regs;
2710 for (i = 0; i < num_lanes; i++) {
2711 regmap = cdns_phy->regmap_rx_lane_cdb[i + mlane];
2712 for (j = 0; j < num_regs; j++)
2713 regmap_write(regmap, reg_pairs[j].off,
2714 reg_pairs[j].val);
2715 }
2716 }
2717
2718 if (phy_t1 == TYPE_DP) {
2719 ret = cdns_torrent_dp_get_pll(cdns_phy, phy_t2);
2720 if (ret)
2721 return ret;
2722 }
2723
2724 reset_control_deassert(cdns_phy->phys[node].lnk_rst);
2725 }
2726 }
2727
2728 /* Restore TYPE_PCIE_ML to TYPE_PCIE to be compatible with suspend-resume */
2729 for (node = 0; node < cdns_phy->nsubnodes; node++)
2730 if (cdns_phy->phys[node].phy_type == TYPE_PCIE_ML)
2731 cdns_phy->phys[node].phy_type = TYPE_PCIE;
2732
2733 /* Take the PHY out of reset */
2734 ret = reset_control_deassert(cdns_phy->phy_rst);
2735 if (ret)
2736 return ret;
2737
2738 return 0;
2739 }
2740
cdns_torrent_clk_cleanup(struct cdns_torrent_phy * cdns_phy)2741 static void cdns_torrent_clk_cleanup(struct cdns_torrent_phy *cdns_phy)
2742 {
2743 struct device *dev = cdns_phy->dev;
2744
2745 of_clk_del_provider(dev->of_node);
2746 }
2747
cdns_torrent_clk_register(struct cdns_torrent_phy * cdns_phy)2748 static int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy)
2749 {
2750 struct device *dev = cdns_phy->dev;
2751 struct device_node *node = dev->of_node;
2752 struct clk_hw_onecell_data *data;
2753 int ret;
2754
2755 data = devm_kzalloc(dev, struct_size(data, hws, CDNS_TORRENT_OUTPUT_CLOCKS), GFP_KERNEL);
2756 if (!data)
2757 return -ENOMEM;
2758
2759 data->num = CDNS_TORRENT_OUTPUT_CLOCKS;
2760 cdns_phy->clk_hw_data = data;
2761
2762 ret = cdns_torrent_derived_refclk_register(cdns_phy);
2763 if (ret) {
2764 dev_err(dev, "failed to register derived refclk\n");
2765 return ret;
2766 }
2767
2768 ret = cdns_torrent_received_refclk_register(cdns_phy);
2769 if (ret) {
2770 dev_err(dev, "failed to register received refclk\n");
2771 return ret;
2772 }
2773
2774 ret = cdns_torrent_refclk_driver_register(cdns_phy);
2775 if (ret) {
2776 dev_err(dev, "failed to register refclk driver\n");
2777 return ret;
2778 }
2779
2780 ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data);
2781 if (ret) {
2782 dev_err(dev, "Failed to add clock provider: %s\n", node->name);
2783 return ret;
2784 }
2785
2786 return 0;
2787 }
2788
cdns_torrent_of_get_reset(struct cdns_torrent_phy * cdns_phy)2789 static int cdns_torrent_of_get_reset(struct cdns_torrent_phy *cdns_phy)
2790 {
2791 struct device *dev = cdns_phy->dev;
2792
2793 cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0);
2794 if (IS_ERR(cdns_phy->phy_rst)) {
2795 dev_err(dev, "%s: failed to get reset\n",
2796 dev->of_node->full_name);
2797 return PTR_ERR(cdns_phy->phy_rst);
2798 }
2799
2800 cdns_phy->apb_rst = devm_reset_control_get_optional_exclusive(dev, "torrent_apb");
2801 if (IS_ERR(cdns_phy->apb_rst)) {
2802 dev_err(dev, "%s: failed to get apb reset\n",
2803 dev->of_node->full_name);
2804 return PTR_ERR(cdns_phy->apb_rst);
2805 }
2806
2807 return 0;
2808 }
2809
cdns_torrent_of_get_clk(struct cdns_torrent_phy * cdns_phy)2810 static int cdns_torrent_of_get_clk(struct cdns_torrent_phy *cdns_phy)
2811 {
2812 /* refclk: Input reference clock for PLL0 */
2813 cdns_phy->clk = devm_clk_get(cdns_phy->dev, "refclk");
2814 if (IS_ERR(cdns_phy->clk))
2815 return dev_err_probe(cdns_phy->dev, PTR_ERR(cdns_phy->clk),
2816 "phy ref clock not found\n");
2817
2818 /* refclk1: Input reference clock for PLL1 */
2819 cdns_phy->clk1 = devm_clk_get_optional(cdns_phy->dev, "pll1_refclk");
2820 if (IS_ERR(cdns_phy->clk1))
2821 return dev_err_probe(cdns_phy->dev, PTR_ERR(cdns_phy->clk1),
2822 "phy PLL1 ref clock not found\n");
2823
2824 return 0;
2825 }
2826
cdns_torrent_clk(struct cdns_torrent_phy * cdns_phy)2827 static int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy)
2828 {
2829 unsigned long ref_clk1_rate;
2830 unsigned long ref_clk_rate;
2831 int ret;
2832
2833 ret = clk_prepare_enable(cdns_phy->clk);
2834 if (ret) {
2835 dev_err(cdns_phy->dev, "Failed to prepare ref clock: %d\n", ret);
2836 return ret;
2837 }
2838
2839 ref_clk_rate = clk_get_rate(cdns_phy->clk);
2840 if (!ref_clk_rate) {
2841 dev_err(cdns_phy->dev, "Failed to get ref clock rate\n");
2842 ret = -EINVAL;
2843 goto disable_clk;
2844 }
2845
2846 switch (ref_clk_rate) {
2847 case REF_CLK_19_2MHZ:
2848 cdns_phy->ref_clk_rate = CLK_19_2_MHZ;
2849 break;
2850 case REF_CLK_25MHZ:
2851 cdns_phy->ref_clk_rate = CLK_25_MHZ;
2852 break;
2853 case REF_CLK_100MHZ:
2854 cdns_phy->ref_clk_rate = CLK_100_MHZ;
2855 break;
2856 case REF_CLK_156_25MHZ:
2857 cdns_phy->ref_clk_rate = CLK_156_25_MHZ;
2858 break;
2859 default:
2860 dev_err(cdns_phy->dev, "Invalid ref clock rate\n");
2861 ret = -EINVAL;
2862 goto disable_clk;
2863 }
2864
2865 if (cdns_phy->clk1) {
2866 ret = clk_prepare_enable(cdns_phy->clk1);
2867 if (ret) {
2868 dev_err(cdns_phy->dev, "Failed to prepare PLL1 ref clock: %d\n", ret);
2869 goto disable_clk;
2870 }
2871
2872 ref_clk1_rate = clk_get_rate(cdns_phy->clk1);
2873 if (!ref_clk1_rate) {
2874 dev_err(cdns_phy->dev, "Failed to get PLL1 ref clock rate\n");
2875 ret = -EINVAL;
2876 goto disable_clk1;
2877 }
2878
2879 switch (ref_clk1_rate) {
2880 case REF_CLK_19_2MHZ:
2881 cdns_phy->ref_clk1_rate = CLK_19_2_MHZ;
2882 break;
2883 case REF_CLK_25MHZ:
2884 cdns_phy->ref_clk1_rate = CLK_25_MHZ;
2885 break;
2886 case REF_CLK_100MHZ:
2887 cdns_phy->ref_clk1_rate = CLK_100_MHZ;
2888 break;
2889 case REF_CLK_156_25MHZ:
2890 cdns_phy->ref_clk1_rate = CLK_156_25_MHZ;
2891 break;
2892 default:
2893 dev_err(cdns_phy->dev, "Invalid PLL1 ref clock rate\n");
2894 ret = -EINVAL;
2895 goto disable_clk1;
2896 }
2897 } else {
2898 cdns_phy->ref_clk1_rate = cdns_phy->ref_clk_rate;
2899 }
2900
2901 return 0;
2902
2903 disable_clk1:
2904 clk_disable_unprepare(cdns_phy->clk1);
2905 disable_clk:
2906 clk_disable_unprepare(cdns_phy->clk);
2907 return ret;
2908 }
2909
cdns_torrent_phy_probe(struct platform_device * pdev)2910 static int cdns_torrent_phy_probe(struct platform_device *pdev)
2911 {
2912 struct cdns_torrent_phy *cdns_phy;
2913 struct device *dev = &pdev->dev;
2914 struct phy_provider *phy_provider;
2915 const struct cdns_torrent_data *data;
2916 struct device_node *child;
2917 int ret, subnodes, node = 0, i;
2918 u32 total_num_lanes = 0;
2919 u8 init_dp_regmap = 0;
2920 u32 phy_type;
2921
2922 /* Get init data for this PHY */
2923 data = of_device_get_match_data(dev);
2924 if (!data)
2925 return -EINVAL;
2926
2927 cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL);
2928 if (!cdns_phy)
2929 return -ENOMEM;
2930
2931 dev_set_drvdata(dev, cdns_phy);
2932 cdns_phy->dev = dev;
2933 cdns_phy->init_data = data;
2934 cdns_phy->protocol_bitmask = 0;
2935
2936 cdns_phy->sd_base = devm_platform_ioremap_resource(pdev, 0);
2937 if (IS_ERR(cdns_phy->sd_base))
2938 return PTR_ERR(cdns_phy->sd_base);
2939
2940 subnodes = of_get_available_child_count(dev->of_node);
2941 if (subnodes == 0) {
2942 dev_err(dev, "No available link subnodes found\n");
2943 return -EINVAL;
2944 }
2945
2946 ret = cdns_torrent_regmap_init(cdns_phy);
2947 if (ret)
2948 return ret;
2949
2950 ret = cdns_torrent_regfield_init(cdns_phy);
2951 if (ret)
2952 return ret;
2953
2954 ret = cdns_torrent_clk_register(cdns_phy);
2955 if (ret)
2956 return ret;
2957
2958 ret = cdns_torrent_of_get_reset(cdns_phy);
2959 if (ret)
2960 goto clk_cleanup;
2961
2962 ret = cdns_torrent_of_get_clk(cdns_phy);
2963 if (ret)
2964 goto clk_cleanup;
2965
2966 regmap_field_read(cdns_phy->phy_pma_cmn_ctrl_1, &cdns_phy->already_configured);
2967
2968 if (!cdns_phy->already_configured) {
2969 ret = cdns_torrent_clk(cdns_phy);
2970 if (ret)
2971 goto clk_cleanup;
2972
2973 /* Enable APB */
2974 reset_control_deassert(cdns_phy->apb_rst);
2975 }
2976
2977 for_each_available_child_of_node(dev->of_node, child) {
2978 struct phy *gphy;
2979
2980 /* PHY subnode name must be 'phy'. */
2981 if (!(of_node_name_eq(child, "phy")))
2982 continue;
2983
2984 cdns_phy->phys[node].lnk_rst =
2985 of_reset_control_array_get_exclusive(child);
2986 if (IS_ERR(cdns_phy->phys[node].lnk_rst)) {
2987 dev_err(dev, "%s: failed to get reset\n",
2988 child->full_name);
2989 ret = PTR_ERR(cdns_phy->phys[node].lnk_rst);
2990 goto put_lnk_rst;
2991 }
2992
2993 if (of_property_read_u32(child, "reg",
2994 &cdns_phy->phys[node].mlane)) {
2995 dev_err(dev, "%s: No \"reg\"-property.\n",
2996 child->full_name);
2997 ret = -EINVAL;
2998 goto put_child;
2999 }
3000
3001 if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) {
3002 dev_err(dev, "%s: No \"cdns,phy-type\"-property.\n",
3003 child->full_name);
3004 ret = -EINVAL;
3005 goto put_child;
3006 }
3007
3008 switch (phy_type) {
3009 case PHY_TYPE_PCIE:
3010 cdns_phy->phys[node].phy_type = TYPE_PCIE;
3011 break;
3012 case PHY_TYPE_DP:
3013 cdns_phy->phys[node].phy_type = TYPE_DP;
3014 break;
3015 case PHY_TYPE_SGMII:
3016 cdns_phy->phys[node].phy_type = TYPE_SGMII;
3017 break;
3018 case PHY_TYPE_QSGMII:
3019 cdns_phy->phys[node].phy_type = TYPE_QSGMII;
3020 break;
3021 case PHY_TYPE_USB3:
3022 cdns_phy->phys[node].phy_type = TYPE_USB;
3023 break;
3024 case PHY_TYPE_USXGMII:
3025 cdns_phy->phys[node].phy_type = TYPE_USXGMII;
3026 break;
3027 case PHY_TYPE_XAUI:
3028 cdns_phy->phys[node].phy_type = TYPE_XAUI;
3029 break;
3030 default:
3031 dev_err(dev, "Unsupported protocol\n");
3032 ret = -EINVAL;
3033 goto put_child;
3034 }
3035
3036 if (of_property_read_u32(child, "cdns,num-lanes",
3037 &cdns_phy->phys[node].num_lanes)) {
3038 dev_err(dev, "%s: No \"cdns,num-lanes\"-property.\n",
3039 child->full_name);
3040 ret = -EINVAL;
3041 goto put_child;
3042 }
3043
3044 total_num_lanes += cdns_phy->phys[node].num_lanes;
3045
3046 /* Get SSC mode */
3047 cdns_phy->phys[node].ssc_mode = NO_SSC;
3048 of_property_read_u32(child, "cdns,ssc-mode",
3049 &cdns_phy->phys[node].ssc_mode);
3050
3051 gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops);
3052 if (IS_ERR(gphy)) {
3053 ret = PTR_ERR(gphy);
3054 goto put_child;
3055 }
3056
3057 if (cdns_phy->phys[node].phy_type == TYPE_DP) {
3058 switch (cdns_phy->phys[node].num_lanes) {
3059 case 1:
3060 case 2:
3061 case 4:
3062 /* valid number of lanes */
3063 break;
3064 default:
3065 dev_err(dev, "unsupported number of lanes: %d\n",
3066 cdns_phy->phys[node].num_lanes);
3067 ret = -EINVAL;
3068 goto put_child;
3069 }
3070
3071 cdns_phy->max_bit_rate = DEFAULT_MAX_BIT_RATE;
3072 of_property_read_u32(child, "cdns,max-bit-rate",
3073 &cdns_phy->max_bit_rate);
3074
3075 switch (cdns_phy->max_bit_rate) {
3076 case 1620:
3077 case 2160:
3078 case 2430:
3079 case 2700:
3080 case 3240:
3081 case 4320:
3082 case 5400:
3083 case 8100:
3084 /* valid bit rate */
3085 break;
3086 default:
3087 dev_err(dev, "unsupported max bit rate: %dMbps\n",
3088 cdns_phy->max_bit_rate);
3089 ret = -EINVAL;
3090 goto put_child;
3091 }
3092
3093 /* DPTX registers */
3094 cdns_phy->base = devm_platform_ioremap_resource(pdev, 1);
3095 if (IS_ERR(cdns_phy->base)) {
3096 ret = PTR_ERR(cdns_phy->base);
3097 goto put_child;
3098 }
3099
3100 if (!init_dp_regmap) {
3101 ret = cdns_torrent_dp_regmap_init(cdns_phy);
3102 if (ret)
3103 goto put_child;
3104
3105 ret = cdns_torrent_dp_regfield_init(cdns_phy);
3106 if (ret)
3107 goto put_child;
3108
3109 init_dp_regmap++;
3110 }
3111
3112 dev_dbg(dev, "DP max bit rate %d.%03d Gbps\n",
3113 cdns_phy->max_bit_rate / 1000,
3114 cdns_phy->max_bit_rate % 1000);
3115
3116 gphy->attrs.bus_width = cdns_phy->phys[node].num_lanes;
3117 gphy->attrs.max_link_rate = cdns_phy->max_bit_rate;
3118 gphy->attrs.mode = PHY_MODE_DP;
3119 }
3120
3121 cdns_phy->phys[node].phy = gphy;
3122 cdns_phy->protocol_bitmask |= BIT(cdns_phy->phys[node].phy_type);
3123 phy_set_drvdata(gphy, &cdns_phy->phys[node]);
3124
3125 node++;
3126 }
3127 cdns_phy->nsubnodes = node;
3128
3129 if (total_num_lanes > MAX_NUM_LANES) {
3130 dev_err(dev, "Invalid lane configuration\n");
3131 ret = -EINVAL;
3132 goto put_lnk_rst;
3133 }
3134
3135 if (cdns_phy->nsubnodes > 1 && !cdns_phy->already_configured) {
3136 ret = cdns_torrent_phy_configure_multilink(cdns_phy);
3137 if (ret)
3138 goto put_lnk_rst;
3139 }
3140
3141 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
3142 if (IS_ERR(phy_provider)) {
3143 ret = PTR_ERR(phy_provider);
3144 goto put_lnk_rst;
3145 }
3146
3147 if (cdns_phy->nsubnodes > 1)
3148 dev_dbg(dev, "Multi link configuration:\n");
3149 else
3150 dev_dbg(dev, "Single link configuration:\n");
3151
3152 for (i = 0; i < cdns_phy->nsubnodes; i++)
3153 dev_dbg(dev, "%s (%d lanes)",
3154 cdns_torrent_get_phy_type(cdns_phy->phys[i].phy_type),
3155 cdns_phy->phys[i].num_lanes);
3156
3157 return 0;
3158
3159 put_child:
3160 node++;
3161 put_lnk_rst:
3162 for (i = 0; i < node; i++)
3163 reset_control_put(cdns_phy->phys[i].lnk_rst);
3164 of_node_put(child);
3165 reset_control_assert(cdns_phy->apb_rst);
3166 clk_disable_unprepare(cdns_phy->clk1);
3167 clk_disable_unprepare(cdns_phy->clk);
3168 clk_cleanup:
3169 cdns_torrent_clk_cleanup(cdns_phy);
3170 return ret;
3171 }
3172
cdns_torrent_phy_remove(struct platform_device * pdev)3173 static void cdns_torrent_phy_remove(struct platform_device *pdev)
3174 {
3175 struct cdns_torrent_phy *cdns_phy = platform_get_drvdata(pdev);
3176 int i;
3177
3178 reset_control_assert(cdns_phy->phy_rst);
3179 reset_control_assert(cdns_phy->apb_rst);
3180 for (i = 0; i < cdns_phy->nsubnodes; i++) {
3181 reset_control_assert(cdns_phy->phys[i].lnk_rst);
3182 reset_control_put(cdns_phy->phys[i].lnk_rst);
3183 }
3184
3185 clk_disable_unprepare(cdns_phy->clk1);
3186 clk_disable_unprepare(cdns_phy->clk);
3187 cdns_torrent_clk_cleanup(cdns_phy);
3188 }
3189
3190 /* Multilink PCIe and USB Same SSC link configuration */
3191 static const struct cdns_reg_pairs ml_pcie_usb_link_cmn_regs[] = {
3192 {0x0002, PHY_PLL_CFG},
3193 {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0}
3194 };
3195
3196 static const struct cdns_reg_pairs ml_pcie_usb_xcvr_diag_ln_regs[] = {
3197 {0x0100, XCVR_DIAG_HSCLK_SEL},
3198 {0x0013, XCVR_DIAG_HSCLK_DIV},
3199 {0x0812, XCVR_DIAG_PLLDRC_CTRL}
3200 };
3201
3202 static const struct cdns_reg_pairs usb_ml_pcie_xcvr_diag_ln_regs[] = {
3203 {0x0041, XCVR_DIAG_PLLDRC_CTRL},
3204 };
3205
3206 static const struct cdns_torrent_vals ml_pcie_usb_link_cmn_vals = {
3207 .reg_pairs = ml_pcie_usb_link_cmn_regs,
3208 .num_regs = ARRAY_SIZE(ml_pcie_usb_link_cmn_regs),
3209 };
3210
3211 static const struct cdns_torrent_vals ml_pcie_usb_xcvr_diag_ln_vals = {
3212 .reg_pairs = ml_pcie_usb_xcvr_diag_ln_regs,
3213 .num_regs = ARRAY_SIZE(ml_pcie_usb_xcvr_diag_ln_regs),
3214 };
3215
3216 static const struct cdns_torrent_vals usb_ml_pcie_xcvr_diag_ln_vals = {
3217 .reg_pairs = usb_ml_pcie_xcvr_diag_ln_regs,
3218 .num_regs = ARRAY_SIZE(usb_ml_pcie_xcvr_diag_ln_regs),
3219 };
3220
3221 /* Multi link PCIe configuration */
3222 static const struct cdns_reg_pairs ml_pcie_link_cmn_regs[] = {
3223 {0x0002, PHY_PLL_CFG},
3224 {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}
3225 };
3226
3227 static const struct cdns_reg_pairs ml_pcie_xcvr_diag_ln_regs[] = {
3228 {0x0100, XCVR_DIAG_HSCLK_SEL},
3229 {0x0001, XCVR_DIAG_HSCLK_DIV},
3230 {0x0812, XCVR_DIAG_PLLDRC_CTRL}
3231 };
3232
3233 static const struct cdns_torrent_vals ml_pcie_link_cmn_vals = {
3234 .reg_pairs = ml_pcie_link_cmn_regs,
3235 .num_regs = ARRAY_SIZE(ml_pcie_link_cmn_regs),
3236 };
3237
3238 static const struct cdns_torrent_vals ml_pcie_xcvr_diag_ln_vals = {
3239 .reg_pairs = ml_pcie_xcvr_diag_ln_regs,
3240 .num_regs = ARRAY_SIZE(ml_pcie_xcvr_diag_ln_regs),
3241 };
3242
3243 /* Multi link PCIe, 100 MHz Ref clk, no SSC */
3244 static const struct cdns_reg_pairs ml_pcie_100_no_ssc_cmn_regs[] = {
3245 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
3246 {0x0003, CMN_PLL1_VCOCAL_TCTRL}
3247 };
3248
3249 static const struct cdns_reg_pairs ml_pcie_100_no_ssc_rx_ln_regs[] = {
3250 {0x0019, RX_REE_TAP1_CLIP},
3251 {0x0019, RX_REE_TAP2TON_CLIP},
3252 {0x0008, RX_REE_PEAK_UTHR},
3253 {0x018E, RX_CDRLF_CNFG},
3254 {0x2E33, RX_CDRLF_CNFG2},
3255 {0x0001, RX_DIAG_ACYA},
3256 {0x0C21, RX_DIAG_DFE_AMP_TUNE_2},
3257 {0x0002, RX_DIAG_DFE_AMP_TUNE_3},
3258 {0x0005, RX_DIAG_REE_DAC_CTRL}
3259 };
3260
3261 static const struct cdns_torrent_vals ml_pcie_100_no_ssc_cmn_vals = {
3262 .reg_pairs = ml_pcie_100_no_ssc_cmn_regs,
3263 .num_regs = ARRAY_SIZE(ml_pcie_100_no_ssc_cmn_regs),
3264 };
3265
3266 static const struct cdns_torrent_vals ml_pcie_100_no_ssc_rx_ln_vals = {
3267 .reg_pairs = ml_pcie_100_no_ssc_rx_ln_regs,
3268 .num_regs = ARRAY_SIZE(ml_pcie_100_no_ssc_rx_ln_regs),
3269 };
3270
3271 /* Multi link PCIe, 100 MHz Ref clk, internal SSC */
3272 static const struct cdns_reg_pairs ml_pcie_100_int_ssc_cmn_regs[] = {
3273 {0x0004, CMN_PLL0_DSM_DIAG_M0},
3274 {0x0004, CMN_PLL1_DSM_DIAG_M0},
3275 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
3276 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
3277 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
3278 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
3279 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
3280 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
3281 {0x0064, CMN_PLL0_INTDIV_M0},
3282 {0x0050, CMN_PLL1_INTDIV_M0},
3283 {0x0002, CMN_PLL0_FRACDIVH_M0},
3284 {0x0002, CMN_PLL1_FRACDIVH_M0},
3285 {0x0044, CMN_PLL0_HIGH_THR_M0},
3286 {0x0036, CMN_PLL1_HIGH_THR_M0},
3287 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
3288 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
3289 {0x0001, CMN_PLL0_SS_CTRL1_M0},
3290 {0x0001, CMN_PLL1_SS_CTRL1_M0},
3291 {0x011B, CMN_PLL0_SS_CTRL2_M0},
3292 {0x011B, CMN_PLL1_SS_CTRL2_M0},
3293 {0x006E, CMN_PLL0_SS_CTRL3_M0},
3294 {0x0058, CMN_PLL1_SS_CTRL3_M0},
3295 {0x000E, CMN_PLL0_SS_CTRL4_M0},
3296 {0x0012, CMN_PLL1_SS_CTRL4_M0},
3297 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
3298 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
3299 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
3300 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
3301 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
3302 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
3303 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
3304 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
3305 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
3306 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
3307 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
3308 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}
3309 };
3310
3311 static const struct cdns_torrent_vals ml_pcie_100_int_ssc_cmn_vals = {
3312 .reg_pairs = ml_pcie_100_int_ssc_cmn_regs,
3313 .num_regs = ARRAY_SIZE(ml_pcie_100_int_ssc_cmn_regs),
3314 };
3315
3316 /* SGMII and QSGMII link configuration */
3317 static const struct cdns_reg_pairs sgmii_qsgmii_link_cmn_regs[] = {
3318 {0x0002, PHY_PLL_CFG}
3319 };
3320
3321 static const struct cdns_reg_pairs sgmii_qsgmii_xcvr_diag_ln_regs[] = {
3322 {0x0003, XCVR_DIAG_HSCLK_DIV},
3323 {0x0113, XCVR_DIAG_PLLDRC_CTRL}
3324 };
3325
3326 static const struct cdns_torrent_vals sgmii_qsgmii_link_cmn_vals = {
3327 .reg_pairs = sgmii_qsgmii_link_cmn_regs,
3328 .num_regs = ARRAY_SIZE(sgmii_qsgmii_link_cmn_regs),
3329 };
3330
3331 static const struct cdns_torrent_vals sgmii_qsgmii_xcvr_diag_ln_vals = {
3332 .reg_pairs = sgmii_qsgmii_xcvr_diag_ln_regs,
3333 .num_regs = ARRAY_SIZE(sgmii_qsgmii_xcvr_diag_ln_regs),
3334 };
3335
cdns_torrent_refclk_driver_suspend(struct cdns_torrent_phy * cdns_phy)3336 static void cdns_torrent_refclk_driver_suspend(struct cdns_torrent_phy *cdns_phy)
3337 {
3338 struct clk_hw *hw = cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER];
3339 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
3340
3341 refclk_driver->parent_index = cdns_torrent_refclk_driver_get_parent(hw);
3342 }
3343
cdns_torrent_refclk_driver_resume(struct cdns_torrent_phy * cdns_phy)3344 static int cdns_torrent_refclk_driver_resume(struct cdns_torrent_phy *cdns_phy)
3345 {
3346 struct clk_hw *hw = cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER];
3347 struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw);
3348
3349 return cdns_torrent_refclk_driver_set_parent(hw, refclk_driver->parent_index);
3350 }
3351
cdns_torrent_phy_suspend_noirq(struct device * dev)3352 static int cdns_torrent_phy_suspend_noirq(struct device *dev)
3353 {
3354 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev);
3355 int i;
3356
3357 cdns_torrent_refclk_driver_suspend(cdns_phy);
3358
3359 reset_control_assert(cdns_phy->phy_rst);
3360 reset_control_assert(cdns_phy->apb_rst);
3361 for (i = 0; i < cdns_phy->nsubnodes; i++)
3362 reset_control_assert(cdns_phy->phys[i].lnk_rst);
3363
3364 if (cdns_phy->already_configured)
3365 cdns_phy->already_configured = 0;
3366 else {
3367 clk_disable_unprepare(cdns_phy->clk1);
3368 clk_disable_unprepare(cdns_phy->clk);
3369 }
3370
3371 return 0;
3372 }
3373
cdns_torrent_phy_resume_noirq(struct device * dev)3374 static int cdns_torrent_phy_resume_noirq(struct device *dev)
3375 {
3376 struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev);
3377 int node = cdns_phy->nsubnodes;
3378 int ret, i;
3379
3380 ret = cdns_torrent_refclk_driver_resume(cdns_phy);
3381 if (ret)
3382 return ret;
3383
3384 ret = cdns_torrent_clk(cdns_phy);
3385 if (ret)
3386 return ret;
3387
3388 /* Enable APB */
3389 reset_control_deassert(cdns_phy->apb_rst);
3390
3391 if (cdns_phy->nsubnodes > 1) {
3392 ret = cdns_torrent_phy_configure_multilink(cdns_phy);
3393 if (ret)
3394 goto put_lnk_rst;
3395 }
3396
3397 return 0;
3398
3399 put_lnk_rst:
3400 for (i = 0; i < node; i++)
3401 reset_control_assert(cdns_phy->phys[i].lnk_rst);
3402 reset_control_assert(cdns_phy->apb_rst);
3403
3404 clk_disable_unprepare(cdns_phy->clk1);
3405 clk_disable_unprepare(cdns_phy->clk);
3406
3407 return ret;
3408 }
3409
3410 static DEFINE_NOIRQ_DEV_PM_OPS(cdns_torrent_phy_pm_ops,
3411 cdns_torrent_phy_suspend_noirq,
3412 cdns_torrent_phy_resume_noirq);
3413
3414 /* PCIe and XAUI link configuration */
3415 static const struct cdns_reg_pairs pcie_xaui_link_cmn_regs[] = {
3416 {0x0003, PHY_PLL_CFG},
3417 {0x0600, CMN_PDIAG_PLL1_CLK_SEL_M0}
3418 };
3419
3420 static const struct cdns_reg_pairs xaui_pcie_xcvr_diag_ln_regs[] = {
3421 {0x0011, XCVR_DIAG_HSCLK_SEL},
3422 {0x0089, XCVR_DIAG_PLLDRC_CTRL}
3423 };
3424
3425 static const struct cdns_torrent_vals pcie_xaui_link_cmn_vals = {
3426 .reg_pairs = pcie_xaui_link_cmn_regs,
3427 .num_regs = ARRAY_SIZE(pcie_xaui_link_cmn_regs),
3428 };
3429
3430 static const struct cdns_torrent_vals xaui_pcie_xcvr_diag_ln_vals = {
3431 .reg_pairs = xaui_pcie_xcvr_diag_ln_regs,
3432 .num_regs = ARRAY_SIZE(xaui_pcie_xcvr_diag_ln_regs),
3433 };
3434
3435 /* XAUI 100 MHz Ref clk, no SSC */
3436 static const struct cdns_reg_pairs xaui_100_no_ssc_cmn_regs[] = {
3437 {0x0004, CMN_PLL1_DSM_DIAG_M0},
3438 {0x0B17, CMN_PDIAG_PLL1_CP_PADJ_M0},
3439 {0x0E01, CMN_PDIAG_PLL1_CP_IADJ_M0},
3440 {0x0D05, CMN_PDIAG_PLL1_FILT_PADJ_M0},
3441 {0x003E, CMN_PLL1_INTDIV_M0},
3442 {0x8000, CMN_PLL1_FRACDIVL_M0},
3443 {0x0002, CMN_PLL1_FRACDIVH_M0},
3444 {0x002A, CMN_PLL1_HIGH_THR_M0},
3445 {0x3102, CMN_PDIAG_PLL1_CTRL_M0},
3446 {0x007F, CMN_TXPUCAL_TUNE},
3447 {0x007F, CMN_TXPDCAL_TUNE}
3448 };
3449
3450 static const struct cdns_reg_pairs xaui_100_no_ssc_tx_ln_regs[] = {
3451 {0x00F3, TX_PSC_A0},
3452 {0x04A2, TX_PSC_A2},
3453 {0x04A2, TX_PSC_A3 },
3454 {0x0000, TX_TXCC_CPOST_MULT_00}
3455 };
3456
3457 static const struct cdns_reg_pairs ti_xaui_100_no_ssc_tx_ln_regs[] = {
3458 {0x00F3, TX_PSC_A0},
3459 {0x04A2, TX_PSC_A2},
3460 {0x04A2, TX_PSC_A3 },
3461 {0x0000, TX_TXCC_CPOST_MULT_00},
3462 {0x4000, XCVR_DIAG_RXCLK_CTRL}
3463 };
3464
3465 static const struct cdns_reg_pairs xaui_100_no_ssc_rx_ln_regs[] = {
3466 {0x091D, RX_PSC_A0},
3467 {0x0900, RX_PSC_A2},
3468 {0x0100, RX_PSC_A3},
3469 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
3470 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
3471 {0x0000, RX_DIAG_DFE_CTRL},
3472 {0x0019, RX_REE_TAP1_CLIP},
3473 {0x0019, RX_REE_TAP2TON_CLIP},
3474 {0x0098, RX_DIAG_NQST_CTRL},
3475 {0x0C01, RX_DIAG_DFE_AMP_TUNE_2},
3476 {0x0000, RX_DIAG_DFE_AMP_TUNE_3},
3477 {0x0000, RX_DIAG_PI_CAP},
3478 {0x0031, RX_DIAG_PI_RATE},
3479 {0x0001, RX_DIAG_ACYA},
3480 {0x018C, RX_CDRLF_CNFG},
3481 };
3482
3483 static const struct cdns_torrent_vals xaui_100_no_ssc_cmn_vals = {
3484 .reg_pairs = xaui_100_no_ssc_cmn_regs,
3485 .num_regs = ARRAY_SIZE(xaui_100_no_ssc_cmn_regs),
3486 };
3487
3488 static const struct cdns_torrent_vals xaui_100_no_ssc_tx_ln_vals = {
3489 .reg_pairs = xaui_100_no_ssc_tx_ln_regs,
3490 .num_regs = ARRAY_SIZE(xaui_100_no_ssc_tx_ln_regs),
3491 };
3492
3493 static const struct cdns_torrent_vals ti_xaui_100_no_ssc_tx_ln_vals = {
3494 .reg_pairs = ti_xaui_100_no_ssc_tx_ln_regs,
3495 .num_regs = ARRAY_SIZE(ti_xaui_100_no_ssc_tx_ln_regs),
3496 };
3497
3498 static const struct cdns_torrent_vals xaui_100_no_ssc_rx_ln_vals = {
3499 .reg_pairs = xaui_100_no_ssc_rx_ln_regs,
3500 .num_regs = ARRAY_SIZE(xaui_100_no_ssc_rx_ln_regs),
3501 };
3502
3503 /* USB and DP link configuration */
3504 static const struct cdns_reg_pairs usb_dp_link_cmn_regs[] = {
3505 {0x0002, PHY_PLL_CFG},
3506 {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0}
3507 };
3508
3509 static const struct cdns_reg_pairs usb_dp_xcvr_diag_ln_regs[] = {
3510 {0x0000, XCVR_DIAG_HSCLK_SEL},
3511 {0x0001, XCVR_DIAG_HSCLK_DIV},
3512 {0x0041, XCVR_DIAG_PLLDRC_CTRL}
3513 };
3514
3515 static const struct cdns_reg_pairs dp_usb_xcvr_diag_ln_regs[] = {
3516 {0x0001, XCVR_DIAG_HSCLK_SEL},
3517 {0x0009, XCVR_DIAG_PLLDRC_CTRL}
3518 };
3519
3520 static const struct cdns_torrent_vals usb_dp_link_cmn_vals = {
3521 .reg_pairs = usb_dp_link_cmn_regs,
3522 .num_regs = ARRAY_SIZE(usb_dp_link_cmn_regs),
3523 };
3524
3525 static const struct cdns_torrent_vals usb_dp_xcvr_diag_ln_vals = {
3526 .reg_pairs = usb_dp_xcvr_diag_ln_regs,
3527 .num_regs = ARRAY_SIZE(usb_dp_xcvr_diag_ln_regs),
3528 };
3529
3530 static const struct cdns_torrent_vals dp_usb_xcvr_diag_ln_vals = {
3531 .reg_pairs = dp_usb_xcvr_diag_ln_regs,
3532 .num_regs = ARRAY_SIZE(dp_usb_xcvr_diag_ln_regs),
3533 };
3534
3535 /* USXGMII and SGMII/QSGMII link configuration */
3536 static const struct cdns_reg_pairs usxgmii_sgmii_link_cmn_regs[] = {
3537 {0x0002, PHY_PLL_CFG},
3538 {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M0},
3539 {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0}
3540 };
3541
3542 static const struct cdns_reg_pairs usxgmii_sgmii_xcvr_diag_ln_regs[] = {
3543 {0x0000, XCVR_DIAG_HSCLK_SEL},
3544 {0x0001, XCVR_DIAG_HSCLK_DIV},
3545 {0x0001, XCVR_DIAG_PLLDRC_CTRL}
3546 };
3547
3548 static const struct cdns_reg_pairs sgmii_usxgmii_xcvr_diag_ln_regs[] = {
3549 {0x0111, XCVR_DIAG_HSCLK_SEL},
3550 {0x0103, XCVR_DIAG_HSCLK_DIV},
3551 {0x0A9B, XCVR_DIAG_PLLDRC_CTRL}
3552 };
3553
3554 static const struct cdns_torrent_vals usxgmii_sgmii_link_cmn_vals = {
3555 .reg_pairs = usxgmii_sgmii_link_cmn_regs,
3556 .num_regs = ARRAY_SIZE(usxgmii_sgmii_link_cmn_regs),
3557 };
3558
3559 static const struct cdns_torrent_vals usxgmii_sgmii_xcvr_diag_ln_vals = {
3560 .reg_pairs = usxgmii_sgmii_xcvr_diag_ln_regs,
3561 .num_regs = ARRAY_SIZE(usxgmii_sgmii_xcvr_diag_ln_regs),
3562 };
3563
3564 static const struct cdns_torrent_vals sgmii_usxgmii_xcvr_diag_ln_vals = {
3565 .reg_pairs = sgmii_usxgmii_xcvr_diag_ln_regs,
3566 .num_regs = ARRAY_SIZE(sgmii_usxgmii_xcvr_diag_ln_regs),
3567 };
3568
3569 /* Multilink USXGMII, using PLL0, 156.25 MHz Ref clk, no SSC */
3570 static const struct cdns_reg_pairs ml_usxgmii_pll0_156_25_no_ssc_cmn_regs[] = {
3571 {0x0014, CMN_PLL0_DSM_FBH_OVRD_M0},
3572 {0x0005, CMN_PLL0_DSM_FBL_OVRD_M0},
3573 {0x061B, CMN_PLL0_VCOCAL_INIT_TMR},
3574 {0x0019, CMN_PLL0_VCOCAL_ITER_TMR},
3575 {0x1354, CMN_PLL0_VCOCAL_REFTIM_START},
3576 {0x1354, CMN_PLL0_VCOCAL_PLLCNT_START},
3577 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
3578 {0x0138, CMN_PLL0_LOCK_REFCNT_START},
3579 {0x0138, CMN_PLL0_LOCK_PLLCNT_START}
3580 };
3581
3582 static const struct cdns_torrent_vals ml_usxgmii_pll0_156_25_no_ssc_cmn_vals = {
3583 .reg_pairs = ml_usxgmii_pll0_156_25_no_ssc_cmn_regs,
3584 .num_regs = ARRAY_SIZE(ml_usxgmii_pll0_156_25_no_ssc_cmn_regs),
3585 };
3586
3587 /* Multilink SGMII/QSGMII, using PLL1, 100 MHz Ref clk, no SSC */
3588 static const struct cdns_reg_pairs ml_sgmii_pll1_100_no_ssc_cmn_regs[] = {
3589 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
3590 {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0},
3591 {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0},
3592 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
3593 {0x007F, CMN_TXPUCAL_TUNE},
3594 {0x007F, CMN_TXPDCAL_TUNE}
3595 };
3596
3597 static const struct cdns_torrent_vals ml_sgmii_pll1_100_no_ssc_cmn_vals = {
3598 .reg_pairs = ml_sgmii_pll1_100_no_ssc_cmn_regs,
3599 .num_regs = ARRAY_SIZE(ml_sgmii_pll1_100_no_ssc_cmn_regs),
3600 };
3601
3602 /* TI J7200, Multilink USXGMII, using PLL0, 156.25 MHz Ref clk, no SSC */
3603 static const struct cdns_reg_pairs j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_regs[] = {
3604 {0x0014, CMN_SSM_BIAS_TMR},
3605 {0x0028, CMN_PLLSM0_PLLPRE_TMR},
3606 {0x00A4, CMN_PLLSM0_PLLLOCK_TMR},
3607 {0x0062, CMN_BGCAL_INIT_TMR},
3608 {0x0062, CMN_BGCAL_ITER_TMR},
3609 {0x0014, CMN_IBCAL_INIT_TMR},
3610 {0x0018, CMN_TXPUCAL_INIT_TMR},
3611 {0x0005, CMN_TXPUCAL_ITER_TMR},
3612 {0x0018, CMN_TXPDCAL_INIT_TMR},
3613 {0x0005, CMN_TXPDCAL_ITER_TMR},
3614 {0x024A, CMN_RXCAL_INIT_TMR},
3615 {0x0005, CMN_RXCAL_ITER_TMR},
3616 {0x000B, CMN_SD_CAL_REFTIM_START},
3617 {0x0132, CMN_SD_CAL_PLLCNT_START},
3618 {0x0014, CMN_PLL0_DSM_FBH_OVRD_M0},
3619 {0x0005, CMN_PLL0_DSM_FBL_OVRD_M0},
3620 {0x061B, CMN_PLL0_VCOCAL_INIT_TMR},
3621 {0x0019, CMN_PLL0_VCOCAL_ITER_TMR},
3622 {0x1354, CMN_PLL0_VCOCAL_REFTIM_START},
3623 {0x1354, CMN_PLL0_VCOCAL_PLLCNT_START},
3624 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
3625 {0x0138, CMN_PLL0_LOCK_REFCNT_START},
3626 {0x0138, CMN_PLL0_LOCK_PLLCNT_START}
3627 };
3628
3629 static const struct cdns_torrent_vals j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_vals = {
3630 .reg_pairs = j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_regs,
3631 .num_regs = ARRAY_SIZE(j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_regs),
3632 };
3633
3634 /* TI J7200, Multilink SGMII/QSGMII, using PLL1, 100 MHz Ref clk, no SSC */
3635 static const struct cdns_reg_pairs j7200_ml_sgmii_pll1_100_no_ssc_cmn_regs[] = {
3636 {0x0028, CMN_PLLSM1_PLLPRE_TMR},
3637 {0x00A4, CMN_PLLSM1_PLLLOCK_TMR},
3638 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
3639 {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0},
3640 {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0},
3641 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
3642 {0x007F, CMN_TXPUCAL_TUNE},
3643 {0x007F, CMN_TXPDCAL_TUNE}
3644 };
3645
3646 static const struct cdns_torrent_vals j7200_ml_sgmii_pll1_100_no_ssc_cmn_vals = {
3647 .reg_pairs = j7200_ml_sgmii_pll1_100_no_ssc_cmn_regs,
3648 .num_regs = ARRAY_SIZE(j7200_ml_sgmii_pll1_100_no_ssc_cmn_regs),
3649 };
3650
3651 /* PCIe and USXGMII link configuration */
3652 static const struct cdns_reg_pairs pcie_usxgmii_link_cmn_regs[] = {
3653 {0x0003, PHY_PLL_CFG},
3654 {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0},
3655 {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1},
3656 {0x0400, CMN_PDIAG_PLL1_CLK_SEL_M0}
3657 };
3658
3659 static const struct cdns_reg_pairs pcie_usxgmii_xcvr_diag_ln_regs[] = {
3660 {0x0000, XCVR_DIAG_HSCLK_SEL},
3661 {0x0001, XCVR_DIAG_HSCLK_DIV},
3662 {0x0012, XCVR_DIAG_PLLDRC_CTRL}
3663 };
3664
3665 static const struct cdns_reg_pairs usxgmii_pcie_xcvr_diag_ln_regs[] = {
3666 {0x0011, XCVR_DIAG_HSCLK_SEL},
3667 {0x0001, XCVR_DIAG_HSCLK_DIV},
3668 {0x0089, XCVR_DIAG_PLLDRC_CTRL}
3669 };
3670
3671 static const struct cdns_torrent_vals pcie_usxgmii_link_cmn_vals = {
3672 .reg_pairs = pcie_usxgmii_link_cmn_regs,
3673 .num_regs = ARRAY_SIZE(pcie_usxgmii_link_cmn_regs),
3674 };
3675
3676 static const struct cdns_torrent_vals pcie_usxgmii_xcvr_diag_ln_vals = {
3677 .reg_pairs = pcie_usxgmii_xcvr_diag_ln_regs,
3678 .num_regs = ARRAY_SIZE(pcie_usxgmii_xcvr_diag_ln_regs),
3679 };
3680
3681 static const struct cdns_torrent_vals usxgmii_pcie_xcvr_diag_ln_vals = {
3682 .reg_pairs = usxgmii_pcie_xcvr_diag_ln_regs,
3683 .num_regs = ARRAY_SIZE(usxgmii_pcie_xcvr_diag_ln_regs),
3684 };
3685
3686 /*
3687 * Multilink USXGMII, using PLL1, 156.25 MHz Ref clk, no SSC
3688 */
3689 static const struct cdns_reg_pairs ml_usxgmii_pll1_156_25_no_ssc_cmn_regs[] = {
3690 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
3691 {0x0014, CMN_PLL1_DSM_FBH_OVRD_M0},
3692 {0x0005, CMN_PLL1_DSM_FBL_OVRD_M0},
3693 {0x061B, CMN_PLL1_VCOCAL_INIT_TMR},
3694 {0x0019, CMN_PLL1_VCOCAL_ITER_TMR},
3695 {0x1354, CMN_PLL1_VCOCAL_REFTIM_START},
3696 {0x1354, CMN_PLL1_VCOCAL_PLLCNT_START},
3697 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
3698 {0x0138, CMN_PLL1_LOCK_REFCNT_START},
3699 {0x0138, CMN_PLL1_LOCK_PLLCNT_START},
3700 {0x007F, CMN_TXPUCAL_TUNE},
3701 {0x007F, CMN_TXPDCAL_TUNE}
3702 };
3703
3704 static const struct cdns_reg_pairs ml_usxgmii_156_25_no_ssc_tx_ln_regs[] = {
3705 {0x00F3, TX_PSC_A0},
3706 {0x04A2, TX_PSC_A2},
3707 {0x04A2, TX_PSC_A3 },
3708 {0x0000, TX_TXCC_CPOST_MULT_00},
3709 {0x0000, XCVR_DIAG_PSC_OVRD}
3710 };
3711
3712 static const struct cdns_reg_pairs ml_usxgmii_156_25_no_ssc_rx_ln_regs[] = {
3713 {0x091D, RX_PSC_A0},
3714 {0x0900, RX_PSC_A2},
3715 {0x0100, RX_PSC_A3},
3716 {0x0030, RX_REE_SMGM_CTRL1},
3717 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
3718 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
3719 {0x0000, RX_DIAG_DFE_CTRL},
3720 {0x0019, RX_REE_TAP1_CLIP},
3721 {0x0019, RX_REE_TAP2TON_CLIP},
3722 {0x00B9, RX_DIAG_NQST_CTRL},
3723 {0x0C21, RX_DIAG_DFE_AMP_TUNE_2},
3724 {0x0002, RX_DIAG_DFE_AMP_TUNE_3},
3725 {0x0033, RX_DIAG_PI_RATE},
3726 {0x0001, RX_DIAG_ACYA},
3727 {0x018C, RX_CDRLF_CNFG}
3728 };
3729
3730 static const struct cdns_torrent_vals ml_usxgmii_pll1_156_25_no_ssc_cmn_vals = {
3731 .reg_pairs = ml_usxgmii_pll1_156_25_no_ssc_cmn_regs,
3732 .num_regs = ARRAY_SIZE(ml_usxgmii_pll1_156_25_no_ssc_cmn_regs),
3733 };
3734
3735 static const struct cdns_torrent_vals ml_usxgmii_156_25_no_ssc_tx_ln_vals = {
3736 .reg_pairs = ml_usxgmii_156_25_no_ssc_tx_ln_regs,
3737 .num_regs = ARRAY_SIZE(ml_usxgmii_156_25_no_ssc_tx_ln_regs),
3738 };
3739
3740 static const struct cdns_torrent_vals ml_usxgmii_156_25_no_ssc_rx_ln_vals = {
3741 .reg_pairs = ml_usxgmii_156_25_no_ssc_rx_ln_regs,
3742 .num_regs = ARRAY_SIZE(ml_usxgmii_156_25_no_ssc_rx_ln_regs),
3743 };
3744
3745 /* TI USXGMII configuration: Enable cmn_refclk_rcv_out_en */
3746 static const struct cdns_reg_pairs ti_usxgmii_phy_pma_cmn_regs[] = {
3747 {0x0040, PHY_PMA_CMN_CTRL1},
3748 };
3749
3750 static const struct cdns_torrent_vals ti_usxgmii_phy_pma_cmn_vals = {
3751 .reg_pairs = ti_usxgmii_phy_pma_cmn_regs,
3752 .num_regs = ARRAY_SIZE(ti_usxgmii_phy_pma_cmn_regs),
3753 };
3754
3755 /* Single USXGMII link configuration */
3756 static const struct cdns_reg_pairs sl_usxgmii_link_cmn_regs[] = {
3757 {0x0000, PHY_PLL_CFG},
3758 {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M0}
3759 };
3760
3761 static const struct cdns_reg_pairs sl_usxgmii_xcvr_diag_ln_regs[] = {
3762 {0x0000, XCVR_DIAG_HSCLK_SEL},
3763 {0x0001, XCVR_DIAG_HSCLK_DIV},
3764 {0x0001, XCVR_DIAG_PLLDRC_CTRL}
3765 };
3766
3767 static const struct cdns_torrent_vals sl_usxgmii_link_cmn_vals = {
3768 .reg_pairs = sl_usxgmii_link_cmn_regs,
3769 .num_regs = ARRAY_SIZE(sl_usxgmii_link_cmn_regs),
3770 };
3771
3772 static const struct cdns_torrent_vals sl_usxgmii_xcvr_diag_ln_vals = {
3773 .reg_pairs = sl_usxgmii_xcvr_diag_ln_regs,
3774 .num_regs = ARRAY_SIZE(sl_usxgmii_xcvr_diag_ln_regs),
3775 };
3776
3777 /* Single link USXGMII, 156.25 MHz Ref clk, no SSC */
3778 static const struct cdns_reg_pairs sl_usxgmii_156_25_no_ssc_cmn_regs[] = {
3779 {0x0014, CMN_SSM_BIAS_TMR},
3780 {0x0028, CMN_PLLSM0_PLLPRE_TMR},
3781 {0x00A4, CMN_PLLSM0_PLLLOCK_TMR},
3782 {0x0028, CMN_PLLSM1_PLLPRE_TMR},
3783 {0x00A4, CMN_PLLSM1_PLLLOCK_TMR},
3784 {0x0062, CMN_BGCAL_INIT_TMR},
3785 {0x0062, CMN_BGCAL_ITER_TMR},
3786 {0x0014, CMN_IBCAL_INIT_TMR},
3787 {0x0018, CMN_TXPUCAL_INIT_TMR},
3788 {0x0005, CMN_TXPUCAL_ITER_TMR},
3789 {0x0018, CMN_TXPDCAL_INIT_TMR},
3790 {0x0005, CMN_TXPDCAL_ITER_TMR},
3791 {0x024A, CMN_RXCAL_INIT_TMR},
3792 {0x0005, CMN_RXCAL_ITER_TMR},
3793 {0x000B, CMN_SD_CAL_REFTIM_START},
3794 {0x0132, CMN_SD_CAL_PLLCNT_START},
3795 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
3796 {0x0014, CMN_PLL0_DSM_FBH_OVRD_M0},
3797 {0x0014, CMN_PLL1_DSM_FBH_OVRD_M0},
3798 {0x0005, CMN_PLL0_DSM_FBL_OVRD_M0},
3799 {0x0005, CMN_PLL1_DSM_FBL_OVRD_M0},
3800 {0x061B, CMN_PLL0_VCOCAL_INIT_TMR},
3801 {0x061B, CMN_PLL1_VCOCAL_INIT_TMR},
3802 {0x0019, CMN_PLL0_VCOCAL_ITER_TMR},
3803 {0x0019, CMN_PLL1_VCOCAL_ITER_TMR},
3804 {0x1354, CMN_PLL0_VCOCAL_REFTIM_START},
3805 {0x1354, CMN_PLL1_VCOCAL_REFTIM_START},
3806 {0x1354, CMN_PLL0_VCOCAL_PLLCNT_START},
3807 {0x1354, CMN_PLL1_VCOCAL_PLLCNT_START},
3808 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
3809 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
3810 {0x0138, CMN_PLL0_LOCK_REFCNT_START},
3811 {0x0138, CMN_PLL1_LOCK_REFCNT_START},
3812 {0x0138, CMN_PLL0_LOCK_PLLCNT_START},
3813 {0x0138, CMN_PLL1_LOCK_PLLCNT_START}
3814 };
3815
3816 static const struct cdns_reg_pairs usxgmii_156_25_no_ssc_tx_ln_regs[] = {
3817 {0x07A2, TX_RCVDET_ST_TMR},
3818 {0x00F3, TX_PSC_A0},
3819 {0x04A2, TX_PSC_A2},
3820 {0x04A2, TX_PSC_A3},
3821 {0x0000, TX_TXCC_CPOST_MULT_00},
3822 {0x0000, XCVR_DIAG_PSC_OVRD}
3823 };
3824
3825 static const struct cdns_reg_pairs usxgmii_156_25_no_ssc_rx_ln_regs[] = {
3826 {0x0014, RX_SDCAL0_INIT_TMR},
3827 {0x0062, RX_SDCAL0_ITER_TMR},
3828 {0x0014, RX_SDCAL1_INIT_TMR},
3829 {0x0062, RX_SDCAL1_ITER_TMR},
3830 {0x091D, RX_PSC_A0},
3831 {0x0900, RX_PSC_A2},
3832 {0x0100, RX_PSC_A3},
3833 {0x0030, RX_REE_SMGM_CTRL1},
3834 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
3835 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
3836 {0x0000, RX_DIAG_DFE_CTRL},
3837 {0x0019, RX_REE_TAP1_CLIP},
3838 {0x0019, RX_REE_TAP2TON_CLIP},
3839 {0x00B9, RX_DIAG_NQST_CTRL},
3840 {0x0C21, RX_DIAG_DFE_AMP_TUNE_2},
3841 {0x0002, RX_DIAG_DFE_AMP_TUNE_3},
3842 {0x0033, RX_DIAG_PI_RATE},
3843 {0x0001, RX_DIAG_ACYA},
3844 {0x018C, RX_CDRLF_CNFG}
3845 };
3846
3847 static const struct cdns_torrent_vals sl_usxgmii_156_25_no_ssc_cmn_vals = {
3848 .reg_pairs = sl_usxgmii_156_25_no_ssc_cmn_regs,
3849 .num_regs = ARRAY_SIZE(sl_usxgmii_156_25_no_ssc_cmn_regs),
3850 };
3851
3852 static const struct cdns_torrent_vals usxgmii_156_25_no_ssc_tx_ln_vals = {
3853 .reg_pairs = usxgmii_156_25_no_ssc_tx_ln_regs,
3854 .num_regs = ARRAY_SIZE(usxgmii_156_25_no_ssc_tx_ln_regs),
3855 };
3856
3857 static const struct cdns_torrent_vals usxgmii_156_25_no_ssc_rx_ln_vals = {
3858 .reg_pairs = usxgmii_156_25_no_ssc_rx_ln_regs,
3859 .num_regs = ARRAY_SIZE(usxgmii_156_25_no_ssc_rx_ln_regs),
3860 };
3861
3862 /* PCIe and DP link configuration */
3863 static const struct cdns_reg_pairs pcie_dp_link_cmn_regs[] = {
3864 {0x0003, PHY_PLL_CFG},
3865 {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0},
3866 {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1}
3867 };
3868
3869 static const struct cdns_reg_pairs pcie_dp_xcvr_diag_ln_regs[] = {
3870 {0x0000, XCVR_DIAG_HSCLK_SEL},
3871 {0x0001, XCVR_DIAG_HSCLK_DIV},
3872 {0x0012, XCVR_DIAG_PLLDRC_CTRL}
3873 };
3874
3875 static const struct cdns_reg_pairs dp_pcie_xcvr_diag_ln_regs[] = {
3876 {0x0001, XCVR_DIAG_HSCLK_SEL},
3877 {0x0009, XCVR_DIAG_PLLDRC_CTRL}
3878 };
3879
3880 static const struct cdns_torrent_vals pcie_dp_link_cmn_vals = {
3881 .reg_pairs = pcie_dp_link_cmn_regs,
3882 .num_regs = ARRAY_SIZE(pcie_dp_link_cmn_regs),
3883 };
3884
3885 static const struct cdns_torrent_vals pcie_dp_xcvr_diag_ln_vals = {
3886 .reg_pairs = pcie_dp_xcvr_diag_ln_regs,
3887 .num_regs = ARRAY_SIZE(pcie_dp_xcvr_diag_ln_regs),
3888 };
3889
3890 static const struct cdns_torrent_vals dp_pcie_xcvr_diag_ln_vals = {
3891 .reg_pairs = dp_pcie_xcvr_diag_ln_regs,
3892 .num_regs = ARRAY_SIZE(dp_pcie_xcvr_diag_ln_regs),
3893 };
3894
3895 /* DP Multilink, 100 MHz Ref clk, no SSC */
3896 static const struct cdns_reg_pairs dp_100_no_ssc_cmn_regs[] = {
3897 {0x007F, CMN_TXPUCAL_TUNE},
3898 {0x007F, CMN_TXPDCAL_TUNE}
3899 };
3900
3901 static const struct cdns_reg_pairs dp_100_no_ssc_tx_ln_regs[] = {
3902 {0x00FB, TX_PSC_A0},
3903 {0x04AA, TX_PSC_A2},
3904 {0x04AA, TX_PSC_A3},
3905 {0x000F, XCVR_DIAG_BIDI_CTRL}
3906 };
3907
3908 static const struct cdns_reg_pairs dp_100_no_ssc_rx_ln_regs[] = {
3909 {0x0000, RX_PSC_A0},
3910 {0x0000, RX_PSC_A2},
3911 {0x0000, RX_PSC_A3},
3912 {0x0000, RX_PSC_CAL},
3913 {0x0000, RX_REE_GCSM1_CTRL},
3914 {0x0000, RX_REE_GCSM2_CTRL},
3915 {0x0000, RX_REE_PERGCSM_CTRL}
3916 };
3917
3918 static const struct cdns_torrent_vals dp_100_no_ssc_cmn_vals = {
3919 .reg_pairs = dp_100_no_ssc_cmn_regs,
3920 .num_regs = ARRAY_SIZE(dp_100_no_ssc_cmn_regs),
3921 };
3922
3923 static const struct cdns_torrent_vals dp_100_no_ssc_tx_ln_vals = {
3924 .reg_pairs = dp_100_no_ssc_tx_ln_regs,
3925 .num_regs = ARRAY_SIZE(dp_100_no_ssc_tx_ln_regs),
3926 };
3927
3928 static const struct cdns_torrent_vals dp_100_no_ssc_rx_ln_vals = {
3929 .reg_pairs = dp_100_no_ssc_rx_ln_regs,
3930 .num_regs = ARRAY_SIZE(dp_100_no_ssc_rx_ln_regs),
3931 };
3932
3933 /* Single DisplayPort(DP) link configuration */
3934 static const struct cdns_reg_pairs sl_dp_link_cmn_regs[] = {
3935 {0x0000, PHY_PLL_CFG},
3936 };
3937
3938 static const struct cdns_reg_pairs sl_dp_xcvr_diag_ln_regs[] = {
3939 {0x0000, XCVR_DIAG_HSCLK_SEL},
3940 {0x0001, XCVR_DIAG_PLLDRC_CTRL}
3941 };
3942
3943 static const struct cdns_torrent_vals sl_dp_link_cmn_vals = {
3944 .reg_pairs = sl_dp_link_cmn_regs,
3945 .num_regs = ARRAY_SIZE(sl_dp_link_cmn_regs),
3946 };
3947
3948 static const struct cdns_torrent_vals sl_dp_xcvr_diag_ln_vals = {
3949 .reg_pairs = sl_dp_xcvr_diag_ln_regs,
3950 .num_regs = ARRAY_SIZE(sl_dp_xcvr_diag_ln_regs),
3951 };
3952
3953 /* Single DP, 19.2 MHz Ref clk, no SSC */
3954 static const struct cdns_reg_pairs sl_dp_19_2_no_ssc_cmn_regs[] = {
3955 {0x0014, CMN_SSM_BIAS_TMR},
3956 {0x0027, CMN_PLLSM0_PLLPRE_TMR},
3957 {0x00A1, CMN_PLLSM0_PLLLOCK_TMR},
3958 {0x0027, CMN_PLLSM1_PLLPRE_TMR},
3959 {0x00A1, CMN_PLLSM1_PLLLOCK_TMR},
3960 {0x0060, CMN_BGCAL_INIT_TMR},
3961 {0x0060, CMN_BGCAL_ITER_TMR},
3962 {0x0014, CMN_IBCAL_INIT_TMR},
3963 {0x0018, CMN_TXPUCAL_INIT_TMR},
3964 {0x0005, CMN_TXPUCAL_ITER_TMR},
3965 {0x0018, CMN_TXPDCAL_INIT_TMR},
3966 {0x0005, CMN_TXPDCAL_ITER_TMR},
3967 {0x0240, CMN_RXCAL_INIT_TMR},
3968 {0x0005, CMN_RXCAL_ITER_TMR},
3969 {0x0002, CMN_SD_CAL_INIT_TMR},
3970 {0x0002, CMN_SD_CAL_ITER_TMR},
3971 {0x000B, CMN_SD_CAL_REFTIM_START},
3972 {0x0137, CMN_SD_CAL_PLLCNT_START},
3973 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
3974 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
3975 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
3976 {0x0004, CMN_PLL0_DSM_DIAG_M0},
3977 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
3978 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
3979 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
3980 {0x0004, CMN_PLL1_DSM_DIAG_M0},
3981 {0x00C0, CMN_PLL0_VCOCAL_INIT_TMR},
3982 {0x0004, CMN_PLL0_VCOCAL_ITER_TMR},
3983 {0x00C0, CMN_PLL1_VCOCAL_INIT_TMR},
3984 {0x0004, CMN_PLL1_VCOCAL_ITER_TMR},
3985 {0x0260, CMN_PLL0_VCOCAL_REFTIM_START},
3986 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
3987 {0x0260, CMN_PLL1_VCOCAL_REFTIM_START},
3988 {0x0003, CMN_PLL1_VCOCAL_TCTRL}
3989 };
3990
3991 static const struct cdns_reg_pairs sl_dp_19_2_no_ssc_tx_ln_regs[] = {
3992 {0x0780, TX_RCVDET_ST_TMR},
3993 {0x00FB, TX_PSC_A0},
3994 {0x04AA, TX_PSC_A2},
3995 {0x04AA, TX_PSC_A3},
3996 {0x000F, XCVR_DIAG_BIDI_CTRL}
3997 };
3998
3999 static const struct cdns_reg_pairs sl_dp_19_2_no_ssc_rx_ln_regs[] = {
4000 {0x0000, RX_PSC_A0},
4001 {0x0000, RX_PSC_A2},
4002 {0x0000, RX_PSC_A3},
4003 {0x0000, RX_PSC_CAL},
4004 {0x0000, RX_REE_GCSM1_CTRL},
4005 {0x0000, RX_REE_GCSM2_CTRL},
4006 {0x0000, RX_REE_PERGCSM_CTRL}
4007 };
4008
4009 static const struct cdns_torrent_vals sl_dp_19_2_no_ssc_cmn_vals = {
4010 .reg_pairs = sl_dp_19_2_no_ssc_cmn_regs,
4011 .num_regs = ARRAY_SIZE(sl_dp_19_2_no_ssc_cmn_regs),
4012 };
4013
4014 static const struct cdns_torrent_vals sl_dp_19_2_no_ssc_tx_ln_vals = {
4015 .reg_pairs = sl_dp_19_2_no_ssc_tx_ln_regs,
4016 .num_regs = ARRAY_SIZE(sl_dp_19_2_no_ssc_tx_ln_regs),
4017 };
4018
4019 static const struct cdns_torrent_vals sl_dp_19_2_no_ssc_rx_ln_vals = {
4020 .reg_pairs = sl_dp_19_2_no_ssc_rx_ln_regs,
4021 .num_regs = ARRAY_SIZE(sl_dp_19_2_no_ssc_rx_ln_regs),
4022 };
4023
4024 /* Single DP, 25 MHz Ref clk, no SSC */
4025 static const struct cdns_reg_pairs sl_dp_25_no_ssc_cmn_regs[] = {
4026 {0x0019, CMN_SSM_BIAS_TMR},
4027 {0x0032, CMN_PLLSM0_PLLPRE_TMR},
4028 {0x00D1, CMN_PLLSM0_PLLLOCK_TMR},
4029 {0x0032, CMN_PLLSM1_PLLPRE_TMR},
4030 {0x00D1, CMN_PLLSM1_PLLLOCK_TMR},
4031 {0x007D, CMN_BGCAL_INIT_TMR},
4032 {0x007D, CMN_BGCAL_ITER_TMR},
4033 {0x0019, CMN_IBCAL_INIT_TMR},
4034 {0x001E, CMN_TXPUCAL_INIT_TMR},
4035 {0x0006, CMN_TXPUCAL_ITER_TMR},
4036 {0x001E, CMN_TXPDCAL_INIT_TMR},
4037 {0x0006, CMN_TXPDCAL_ITER_TMR},
4038 {0x02EE, CMN_RXCAL_INIT_TMR},
4039 {0x0006, CMN_RXCAL_ITER_TMR},
4040 {0x0002, CMN_SD_CAL_INIT_TMR},
4041 {0x0002, CMN_SD_CAL_ITER_TMR},
4042 {0x000E, CMN_SD_CAL_REFTIM_START},
4043 {0x012B, CMN_SD_CAL_PLLCNT_START},
4044 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4045 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4046 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4047 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4048 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4049 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4050 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4051 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4052 {0x00FA, CMN_PLL0_VCOCAL_INIT_TMR},
4053 {0x0004, CMN_PLL0_VCOCAL_ITER_TMR},
4054 {0x00FA, CMN_PLL1_VCOCAL_INIT_TMR},
4055 {0x0004, CMN_PLL1_VCOCAL_ITER_TMR},
4056 {0x0317, CMN_PLL0_VCOCAL_REFTIM_START},
4057 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
4058 {0x0317, CMN_PLL1_VCOCAL_REFTIM_START},
4059 {0x0003, CMN_PLL1_VCOCAL_TCTRL}
4060 };
4061
4062 static const struct cdns_reg_pairs sl_dp_25_no_ssc_tx_ln_regs[] = {
4063 {0x09C4, TX_RCVDET_ST_TMR},
4064 {0x00FB, TX_PSC_A0},
4065 {0x04AA, TX_PSC_A2},
4066 {0x04AA, TX_PSC_A3},
4067 {0x000F, XCVR_DIAG_BIDI_CTRL}
4068 };
4069
4070 static const struct cdns_reg_pairs sl_dp_25_no_ssc_rx_ln_regs[] = {
4071 {0x0000, RX_PSC_A0},
4072 {0x0000, RX_PSC_A2},
4073 {0x0000, RX_PSC_A3},
4074 {0x0000, RX_PSC_CAL},
4075 {0x0000, RX_REE_GCSM1_CTRL},
4076 {0x0000, RX_REE_GCSM2_CTRL},
4077 {0x0000, RX_REE_PERGCSM_CTRL}
4078 };
4079
4080 static const struct cdns_torrent_vals sl_dp_25_no_ssc_cmn_vals = {
4081 .reg_pairs = sl_dp_25_no_ssc_cmn_regs,
4082 .num_regs = ARRAY_SIZE(sl_dp_25_no_ssc_cmn_regs),
4083 };
4084
4085 static const struct cdns_torrent_vals sl_dp_25_no_ssc_tx_ln_vals = {
4086 .reg_pairs = sl_dp_25_no_ssc_tx_ln_regs,
4087 .num_regs = ARRAY_SIZE(sl_dp_25_no_ssc_tx_ln_regs),
4088 };
4089
4090 static const struct cdns_torrent_vals sl_dp_25_no_ssc_rx_ln_vals = {
4091 .reg_pairs = sl_dp_25_no_ssc_rx_ln_regs,
4092 .num_regs = ARRAY_SIZE(sl_dp_25_no_ssc_rx_ln_regs),
4093 };
4094
4095 /* Single DP, 100 MHz Ref clk, no SSC */
4096 static const struct cdns_reg_pairs sl_dp_100_no_ssc_cmn_regs[] = {
4097 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
4098 {0x0003, CMN_PLL1_VCOCAL_TCTRL}
4099 };
4100
4101 static const struct cdns_reg_pairs sl_dp_100_no_ssc_tx_ln_regs[] = {
4102 {0x00FB, TX_PSC_A0},
4103 {0x04AA, TX_PSC_A2},
4104 {0x04AA, TX_PSC_A3},
4105 {0x000F, XCVR_DIAG_BIDI_CTRL}
4106 };
4107
4108 static const struct cdns_reg_pairs sl_dp_100_no_ssc_rx_ln_regs[] = {
4109 {0x0000, RX_PSC_A0},
4110 {0x0000, RX_PSC_A2},
4111 {0x0000, RX_PSC_A3},
4112 {0x0000, RX_PSC_CAL},
4113 {0x0000, RX_REE_GCSM1_CTRL},
4114 {0x0000, RX_REE_GCSM2_CTRL},
4115 {0x0000, RX_REE_PERGCSM_CTRL}
4116 };
4117
4118 static const struct cdns_torrent_vals sl_dp_100_no_ssc_cmn_vals = {
4119 .reg_pairs = sl_dp_100_no_ssc_cmn_regs,
4120 .num_regs = ARRAY_SIZE(sl_dp_100_no_ssc_cmn_regs),
4121 };
4122
4123 static const struct cdns_torrent_vals sl_dp_100_no_ssc_tx_ln_vals = {
4124 .reg_pairs = sl_dp_100_no_ssc_tx_ln_regs,
4125 .num_regs = ARRAY_SIZE(sl_dp_100_no_ssc_tx_ln_regs),
4126 };
4127
4128 static const struct cdns_torrent_vals sl_dp_100_no_ssc_rx_ln_vals = {
4129 .reg_pairs = sl_dp_100_no_ssc_rx_ln_regs,
4130 .num_regs = ARRAY_SIZE(sl_dp_100_no_ssc_rx_ln_regs),
4131 };
4132
4133 /* USB and SGMII/QSGMII link configuration */
4134 static const struct cdns_reg_pairs usb_sgmii_link_cmn_regs[] = {
4135 {0x0002, PHY_PLL_CFG},
4136 {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0},
4137 {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0}
4138 };
4139
4140 static const struct cdns_reg_pairs usb_sgmii_xcvr_diag_ln_regs[] = {
4141 {0x0000, XCVR_DIAG_HSCLK_SEL},
4142 {0x0001, XCVR_DIAG_HSCLK_DIV},
4143 {0x0041, XCVR_DIAG_PLLDRC_CTRL}
4144 };
4145
4146 static const struct cdns_reg_pairs sgmii_usb_xcvr_diag_ln_regs[] = {
4147 {0x0011, XCVR_DIAG_HSCLK_SEL},
4148 {0x0003, XCVR_DIAG_HSCLK_DIV},
4149 {0x009B, XCVR_DIAG_PLLDRC_CTRL}
4150 };
4151
4152 static const struct cdns_torrent_vals usb_sgmii_link_cmn_vals = {
4153 .reg_pairs = usb_sgmii_link_cmn_regs,
4154 .num_regs = ARRAY_SIZE(usb_sgmii_link_cmn_regs),
4155 };
4156
4157 static const struct cdns_torrent_vals usb_sgmii_xcvr_diag_ln_vals = {
4158 .reg_pairs = usb_sgmii_xcvr_diag_ln_regs,
4159 .num_regs = ARRAY_SIZE(usb_sgmii_xcvr_diag_ln_regs),
4160 };
4161
4162 static const struct cdns_torrent_vals sgmii_usb_xcvr_diag_ln_vals = {
4163 .reg_pairs = sgmii_usb_xcvr_diag_ln_regs,
4164 .num_regs = ARRAY_SIZE(sgmii_usb_xcvr_diag_ln_regs),
4165 };
4166
4167 /* PCIe and USB Unique SSC link configuration */
4168 static const struct cdns_reg_pairs pcie_usb_link_cmn_regs[] = {
4169 {0x0003, PHY_PLL_CFG},
4170 {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0},
4171 {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1},
4172 {0x8600, CMN_PDIAG_PLL1_CLK_SEL_M0}
4173 };
4174
4175 static const struct cdns_reg_pairs pcie_usb_xcvr_diag_ln_regs[] = {
4176 {0x0000, XCVR_DIAG_HSCLK_SEL},
4177 {0x0001, XCVR_DIAG_HSCLK_DIV},
4178 {0x0012, XCVR_DIAG_PLLDRC_CTRL}
4179 };
4180
4181 static const struct cdns_reg_pairs usb_pcie_xcvr_diag_ln_regs[] = {
4182 {0x0011, XCVR_DIAG_HSCLK_SEL},
4183 {0x0001, XCVR_DIAG_HSCLK_DIV},
4184 {0x00C9, XCVR_DIAG_PLLDRC_CTRL}
4185 };
4186
4187 static const struct cdns_torrent_vals pcie_usb_link_cmn_vals = {
4188 .reg_pairs = pcie_usb_link_cmn_regs,
4189 .num_regs = ARRAY_SIZE(pcie_usb_link_cmn_regs),
4190 };
4191
4192 static const struct cdns_torrent_vals pcie_usb_xcvr_diag_ln_vals = {
4193 .reg_pairs = pcie_usb_xcvr_diag_ln_regs,
4194 .num_regs = ARRAY_SIZE(pcie_usb_xcvr_diag_ln_regs),
4195 };
4196
4197 static const struct cdns_torrent_vals usb_pcie_xcvr_diag_ln_vals = {
4198 .reg_pairs = usb_pcie_xcvr_diag_ln_regs,
4199 .num_regs = ARRAY_SIZE(usb_pcie_xcvr_diag_ln_regs),
4200 };
4201
4202 /* USB 100 MHz Ref clk, internal SSC */
4203 static const struct cdns_reg_pairs usb_100_int_ssc_cmn_regs[] = {
4204 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4205 {0x0004, CMN_PLL0_DSM_DIAG_M1},
4206 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4207 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4208 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1},
4209 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4210 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4211 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1},
4212 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4213 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4214 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1},
4215 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4216 {0x0064, CMN_PLL0_INTDIV_M0},
4217 {0x0050, CMN_PLL0_INTDIV_M1},
4218 {0x0064, CMN_PLL1_INTDIV_M0},
4219 {0x0002, CMN_PLL0_FRACDIVH_M0},
4220 {0x0002, CMN_PLL0_FRACDIVH_M1},
4221 {0x0002, CMN_PLL1_FRACDIVH_M0},
4222 {0x0044, CMN_PLL0_HIGH_THR_M0},
4223 {0x0036, CMN_PLL0_HIGH_THR_M1},
4224 {0x0044, CMN_PLL1_HIGH_THR_M0},
4225 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
4226 {0x0002, CMN_PDIAG_PLL0_CTRL_M1},
4227 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
4228 {0x0001, CMN_PLL0_SS_CTRL1_M0},
4229 {0x0001, CMN_PLL0_SS_CTRL1_M1},
4230 {0x0001, CMN_PLL1_SS_CTRL1_M0},
4231 {0x011B, CMN_PLL0_SS_CTRL2_M0},
4232 {0x011B, CMN_PLL0_SS_CTRL2_M1},
4233 {0x011B, CMN_PLL1_SS_CTRL2_M0},
4234 {0x006E, CMN_PLL0_SS_CTRL3_M0},
4235 {0x0058, CMN_PLL0_SS_CTRL3_M1},
4236 {0x006E, CMN_PLL1_SS_CTRL3_M0},
4237 {0x000E, CMN_PLL0_SS_CTRL4_M0},
4238 {0x0012, CMN_PLL0_SS_CTRL4_M1},
4239 {0x000E, CMN_PLL1_SS_CTRL4_M0},
4240 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
4241 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
4242 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
4243 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
4244 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
4245 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
4246 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
4247 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
4248 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
4249 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR},
4250 {0x8200, CMN_CDIAG_CDB_PWRI_OVRD},
4251 {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD},
4252 {0x007F, CMN_TXPUCAL_TUNE},
4253 {0x007F, CMN_TXPDCAL_TUNE}
4254 };
4255
4256 static const struct cdns_torrent_vals usb_100_int_ssc_cmn_vals = {
4257 .reg_pairs = usb_100_int_ssc_cmn_regs,
4258 .num_regs = ARRAY_SIZE(usb_100_int_ssc_cmn_regs),
4259 };
4260
4261 /* Single USB link configuration */
4262 static const struct cdns_reg_pairs sl_usb_link_cmn_regs[] = {
4263 {0x0000, PHY_PLL_CFG},
4264 {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0}
4265 };
4266
4267 static const struct cdns_reg_pairs sl_usb_xcvr_diag_ln_regs[] = {
4268 {0x0000, XCVR_DIAG_HSCLK_SEL},
4269 {0x0001, XCVR_DIAG_HSCLK_DIV},
4270 {0x0041, XCVR_DIAG_PLLDRC_CTRL}
4271 };
4272
4273 static const struct cdns_torrent_vals sl_usb_link_cmn_vals = {
4274 .reg_pairs = sl_usb_link_cmn_regs,
4275 .num_regs = ARRAY_SIZE(sl_usb_link_cmn_regs),
4276 };
4277
4278 static const struct cdns_torrent_vals sl_usb_xcvr_diag_ln_vals = {
4279 .reg_pairs = sl_usb_xcvr_diag_ln_regs,
4280 .num_regs = ARRAY_SIZE(sl_usb_xcvr_diag_ln_regs),
4281 };
4282
4283 /* USB PHY PCS common configuration */
4284 static const struct cdns_reg_pairs usb_phy_pcs_cmn_regs[] = {
4285 {0x0A0A, PHY_PIPE_USB3_GEN2_PRE_CFG0},
4286 {0x1000, PHY_PIPE_USB3_GEN2_POST_CFG0},
4287 {0x0010, PHY_PIPE_USB3_GEN2_POST_CFG1}
4288 };
4289
4290 static const struct cdns_torrent_vals usb_phy_pcs_cmn_vals = {
4291 .reg_pairs = usb_phy_pcs_cmn_regs,
4292 .num_regs = ARRAY_SIZE(usb_phy_pcs_cmn_regs),
4293 };
4294
4295 /* USB 100 MHz Ref clk, no SSC */
4296 static const struct cdns_reg_pairs sl_usb_100_no_ssc_cmn_regs[] = {
4297 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
4298 {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0},
4299 {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0},
4300 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
4301 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
4302 {0x8200, CMN_CDIAG_CDB_PWRI_OVRD},
4303 {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD}
4304 };
4305
4306 static const struct cdns_torrent_vals sl_usb_100_no_ssc_cmn_vals = {
4307 .reg_pairs = sl_usb_100_no_ssc_cmn_regs,
4308 .num_regs = ARRAY_SIZE(sl_usb_100_no_ssc_cmn_regs),
4309 };
4310
4311 static const struct cdns_reg_pairs usb_100_no_ssc_cmn_regs[] = {
4312 {0x8200, CMN_CDIAG_CDB_PWRI_OVRD},
4313 {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD},
4314 {0x007F, CMN_TXPUCAL_TUNE},
4315 {0x007F, CMN_TXPDCAL_TUNE}
4316 };
4317
4318 static const struct cdns_reg_pairs usb_100_no_ssc_tx_ln_regs[] = {
4319 {0x02FF, TX_PSC_A0},
4320 {0x06AF, TX_PSC_A1},
4321 {0x06AE, TX_PSC_A2},
4322 {0x06AE, TX_PSC_A3},
4323 {0x2A82, TX_TXCC_CTRL},
4324 {0x0014, TX_TXCC_CPOST_MULT_01},
4325 {0x0003, XCVR_DIAG_PSC_OVRD}
4326 };
4327
4328 static const struct cdns_reg_pairs usb_100_no_ssc_rx_ln_regs[] = {
4329 {0x0D1D, RX_PSC_A0},
4330 {0x0D1D, RX_PSC_A1},
4331 {0x0D00, RX_PSC_A2},
4332 {0x0500, RX_PSC_A3},
4333 {0x0013, RX_SIGDET_HL_FILT_TMR},
4334 {0x0000, RX_REE_GCSM1_CTRL},
4335 {0x0C02, RX_REE_ATTEN_THR},
4336 {0x0330, RX_REE_SMGM_CTRL1},
4337 {0x0300, RX_REE_SMGM_CTRL2},
4338 {0x0000, RX_REE_PEAK_UTHR},
4339 {0x01F5, RX_REE_PEAK_LTHR},
4340 {0x0019, RX_REE_TAP1_CLIP},
4341 {0x0019, RX_REE_TAP2TON_CLIP},
4342 {0x1004, RX_DIAG_SIGDET_TUNE},
4343 {0x00F9, RX_DIAG_NQST_CTRL},
4344 {0x0C01, RX_DIAG_DFE_AMP_TUNE_2},
4345 {0x0002, RX_DIAG_DFE_AMP_TUNE_3},
4346 {0x0000, RX_DIAG_PI_CAP},
4347 {0x0031, RX_DIAG_PI_RATE},
4348 {0x0001, RX_DIAG_ACYA},
4349 {0x018C, RX_CDRLF_CNFG},
4350 {0x0003, RX_CDRLF_CNFG3}
4351 };
4352
4353 static const struct cdns_torrent_vals usb_100_no_ssc_cmn_vals = {
4354 .reg_pairs = usb_100_no_ssc_cmn_regs,
4355 .num_regs = ARRAY_SIZE(usb_100_no_ssc_cmn_regs),
4356 };
4357
4358 static const struct cdns_torrent_vals usb_100_no_ssc_tx_ln_vals = {
4359 .reg_pairs = usb_100_no_ssc_tx_ln_regs,
4360 .num_regs = ARRAY_SIZE(usb_100_no_ssc_tx_ln_regs),
4361 };
4362
4363 static const struct cdns_torrent_vals usb_100_no_ssc_rx_ln_vals = {
4364 .reg_pairs = usb_100_no_ssc_rx_ln_regs,
4365 .num_regs = ARRAY_SIZE(usb_100_no_ssc_rx_ln_regs),
4366 };
4367
4368 /* Single link USB, 100 MHz Ref clk, internal SSC */
4369 static const struct cdns_reg_pairs sl_usb_100_int_ssc_cmn_regs[] = {
4370 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4371 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4372 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4373 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4374 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4375 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4376 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4377 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4378 {0x0064, CMN_PLL0_INTDIV_M0},
4379 {0x0064, CMN_PLL1_INTDIV_M0},
4380 {0x0002, CMN_PLL0_FRACDIVH_M0},
4381 {0x0002, CMN_PLL1_FRACDIVH_M0},
4382 {0x0044, CMN_PLL0_HIGH_THR_M0},
4383 {0x0044, CMN_PLL1_HIGH_THR_M0},
4384 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
4385 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
4386 {0x0001, CMN_PLL0_SS_CTRL1_M0},
4387 {0x0001, CMN_PLL1_SS_CTRL1_M0},
4388 {0x011B, CMN_PLL0_SS_CTRL2_M0},
4389 {0x011B, CMN_PLL1_SS_CTRL2_M0},
4390 {0x006E, CMN_PLL0_SS_CTRL3_M0},
4391 {0x006E, CMN_PLL1_SS_CTRL3_M0},
4392 {0x000E, CMN_PLL0_SS_CTRL4_M0},
4393 {0x000E, CMN_PLL1_SS_CTRL4_M0},
4394 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
4395 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
4396 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
4397 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
4398 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
4399 {0x0003, CMN_PLL1_VCOCAL_TCTRL},
4400 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
4401 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
4402 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
4403 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
4404 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
4405 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR},
4406 {0x8200, CMN_CDIAG_CDB_PWRI_OVRD},
4407 {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD}
4408 };
4409
4410 static const struct cdns_torrent_vals sl_usb_100_int_ssc_cmn_vals = {
4411 .reg_pairs = sl_usb_100_int_ssc_cmn_regs,
4412 .num_regs = ARRAY_SIZE(sl_usb_100_int_ssc_cmn_regs),
4413 };
4414
4415 /* PCIe and SGMII/QSGMII Unique SSC link configuration */
4416 static const struct cdns_reg_pairs pcie_sgmii_link_cmn_regs[] = {
4417 {0x0003, PHY_PLL_CFG},
4418 {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0},
4419 {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1},
4420 {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0}
4421 };
4422
4423 static const struct cdns_reg_pairs pcie_sgmii_xcvr_diag_ln_regs[] = {
4424 {0x0000, XCVR_DIAG_HSCLK_SEL},
4425 {0x0001, XCVR_DIAG_HSCLK_DIV},
4426 {0x0012, XCVR_DIAG_PLLDRC_CTRL}
4427 };
4428
4429 static const struct cdns_reg_pairs sgmii_pcie_xcvr_diag_ln_regs[] = {
4430 {0x0011, XCVR_DIAG_HSCLK_SEL},
4431 {0x0003, XCVR_DIAG_HSCLK_DIV},
4432 {0x009B, XCVR_DIAG_PLLDRC_CTRL}
4433 };
4434
4435 static const struct cdns_torrent_vals pcie_sgmii_link_cmn_vals = {
4436 .reg_pairs = pcie_sgmii_link_cmn_regs,
4437 .num_regs = ARRAY_SIZE(pcie_sgmii_link_cmn_regs),
4438 };
4439
4440 static const struct cdns_torrent_vals pcie_sgmii_xcvr_diag_ln_vals = {
4441 .reg_pairs = pcie_sgmii_xcvr_diag_ln_regs,
4442 .num_regs = ARRAY_SIZE(pcie_sgmii_xcvr_diag_ln_regs),
4443 };
4444
4445 static const struct cdns_torrent_vals sgmii_pcie_xcvr_diag_ln_vals = {
4446 .reg_pairs = sgmii_pcie_xcvr_diag_ln_regs,
4447 .num_regs = ARRAY_SIZE(sgmii_pcie_xcvr_diag_ln_regs),
4448 };
4449
4450 /* SGMII 100 MHz Ref clk, no SSC */
4451 static const struct cdns_reg_pairs sl_sgmii_100_no_ssc_cmn_regs[] = {
4452 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
4453 {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0},
4454 {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0},
4455 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
4456 {0x0003, CMN_PLL1_VCOCAL_TCTRL}
4457 };
4458
4459 static const struct cdns_torrent_vals sl_sgmii_100_no_ssc_cmn_vals = {
4460 .reg_pairs = sl_sgmii_100_no_ssc_cmn_regs,
4461 .num_regs = ARRAY_SIZE(sl_sgmii_100_no_ssc_cmn_regs),
4462 };
4463
4464 static const struct cdns_reg_pairs sgmii_100_no_ssc_cmn_regs[] = {
4465 {0x007F, CMN_TXPUCAL_TUNE},
4466 {0x007F, CMN_TXPDCAL_TUNE}
4467 };
4468
4469 static const struct cdns_reg_pairs sgmii_100_no_ssc_tx_ln_regs[] = {
4470 {0x00F3, TX_PSC_A0},
4471 {0x04A2, TX_PSC_A2},
4472 {0x04A2, TX_PSC_A3},
4473 {0x0000, TX_TXCC_CPOST_MULT_00},
4474 {0x00B3, DRV_DIAG_TX_DRV},
4475 {0x0002, XCVR_DIAG_PSC_OVRD}
4476 };
4477
4478 static const struct cdns_reg_pairs ti_sgmii_100_no_ssc_tx_ln_regs[] = {
4479 {0x00F3, TX_PSC_A0},
4480 {0x04A2, TX_PSC_A2},
4481 {0x04A2, TX_PSC_A3},
4482 {0x0000, TX_TXCC_CPOST_MULT_00},
4483 {0x00B3, DRV_DIAG_TX_DRV},
4484 {0x0002, XCVR_DIAG_PSC_OVRD},
4485 {0x4000, XCVR_DIAG_RXCLK_CTRL}
4486 };
4487
4488 static const struct cdns_reg_pairs sgmii_100_no_ssc_rx_ln_regs[] = {
4489 {0x091D, RX_PSC_A0},
4490 {0x0900, RX_PSC_A2},
4491 {0x0100, RX_PSC_A3},
4492 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
4493 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
4494 {0x0000, RX_DIAG_DFE_CTRL},
4495 {0x0019, RX_REE_TAP1_CLIP},
4496 {0x0019, RX_REE_TAP2TON_CLIP},
4497 {0x0098, RX_DIAG_NQST_CTRL},
4498 {0x0C01, RX_DIAG_DFE_AMP_TUNE_2},
4499 {0x0000, RX_DIAG_DFE_AMP_TUNE_3},
4500 {0x0000, RX_DIAG_PI_CAP},
4501 {0x0010, RX_DIAG_PI_RATE},
4502 {0x0001, RX_DIAG_ACYA},
4503 {0x018C, RX_CDRLF_CNFG},
4504 };
4505
4506 static const struct cdns_torrent_vals sgmii_100_no_ssc_cmn_vals = {
4507 .reg_pairs = sgmii_100_no_ssc_cmn_regs,
4508 .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_cmn_regs),
4509 };
4510
4511 static const struct cdns_torrent_vals sgmii_100_no_ssc_tx_ln_vals = {
4512 .reg_pairs = sgmii_100_no_ssc_tx_ln_regs,
4513 .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_tx_ln_regs),
4514 };
4515
4516 static const struct cdns_torrent_vals ti_sgmii_100_no_ssc_tx_ln_vals = {
4517 .reg_pairs = ti_sgmii_100_no_ssc_tx_ln_regs,
4518 .num_regs = ARRAY_SIZE(ti_sgmii_100_no_ssc_tx_ln_regs),
4519 };
4520
4521 static const struct cdns_torrent_vals sgmii_100_no_ssc_rx_ln_vals = {
4522 .reg_pairs = sgmii_100_no_ssc_rx_ln_regs,
4523 .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_rx_ln_regs),
4524 };
4525
4526 /* TI J7200, multilink SGMII */
4527 static const struct cdns_reg_pairs j7200_sgmii_100_no_ssc_tx_ln_regs[] = {
4528 {0x07A2, TX_RCVDET_ST_TMR},
4529 {0x00F3, TX_PSC_A0},
4530 {0x04A2, TX_PSC_A2},
4531 {0x04A2, TX_PSC_A3 },
4532 {0x0000, TX_TXCC_CPOST_MULT_00},
4533 {0x00B3, DRV_DIAG_TX_DRV},
4534 {0x0002, XCVR_DIAG_PSC_OVRD},
4535 {0x4000, XCVR_DIAG_RXCLK_CTRL}
4536 };
4537
4538 static const struct cdns_torrent_vals j7200_sgmii_100_no_ssc_tx_ln_vals = {
4539 .reg_pairs = j7200_sgmii_100_no_ssc_tx_ln_regs,
4540 .num_regs = ARRAY_SIZE(j7200_sgmii_100_no_ssc_tx_ln_regs),
4541 };
4542
4543 static const struct cdns_reg_pairs j7200_sgmii_100_no_ssc_rx_ln_regs[] = {
4544 {0x0014, RX_SDCAL0_INIT_TMR},
4545 {0x0062, RX_SDCAL0_ITER_TMR},
4546 {0x0014, RX_SDCAL1_INIT_TMR},
4547 {0x0062, RX_SDCAL1_ITER_TMR},
4548 {0x091D, RX_PSC_A0},
4549 {0x0900, RX_PSC_A2},
4550 {0x0100, RX_PSC_A3},
4551 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
4552 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
4553 {0x0000, RX_DIAG_DFE_CTRL},
4554 {0x0019, RX_REE_TAP1_CLIP},
4555 {0x0019, RX_REE_TAP2TON_CLIP},
4556 {0x0098, RX_DIAG_NQST_CTRL},
4557 {0x0C01, RX_DIAG_DFE_AMP_TUNE_2},
4558 {0x0000, RX_DIAG_DFE_AMP_TUNE_3},
4559 {0x0000, RX_DIAG_PI_CAP},
4560 {0x0010, RX_DIAG_PI_RATE},
4561 {0x0001, RX_DIAG_ACYA},
4562 {0x018C, RX_CDRLF_CNFG}
4563 };
4564
4565 static const struct cdns_torrent_vals j7200_sgmii_100_no_ssc_rx_ln_vals = {
4566 .reg_pairs = j7200_sgmii_100_no_ssc_rx_ln_regs,
4567 .num_regs = ARRAY_SIZE(j7200_sgmii_100_no_ssc_rx_ln_regs),
4568 };
4569
4570 /* SGMII 100 MHz Ref clk, internal SSC */
4571 static const struct cdns_reg_pairs sgmii_100_int_ssc_cmn_regs[] = {
4572 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4573 {0x0004, CMN_PLL0_DSM_DIAG_M1},
4574 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4575 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4576 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1},
4577 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4578 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4579 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1},
4580 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4581 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4582 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1},
4583 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4584 {0x0064, CMN_PLL0_INTDIV_M0},
4585 {0x0050, CMN_PLL0_INTDIV_M1},
4586 {0x0064, CMN_PLL1_INTDIV_M0},
4587 {0x0002, CMN_PLL0_FRACDIVH_M0},
4588 {0x0002, CMN_PLL0_FRACDIVH_M1},
4589 {0x0002, CMN_PLL1_FRACDIVH_M0},
4590 {0x0044, CMN_PLL0_HIGH_THR_M0},
4591 {0x0036, CMN_PLL0_HIGH_THR_M1},
4592 {0x0044, CMN_PLL1_HIGH_THR_M0},
4593 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
4594 {0x0002, CMN_PDIAG_PLL0_CTRL_M1},
4595 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
4596 {0x0001, CMN_PLL0_SS_CTRL1_M0},
4597 {0x0001, CMN_PLL0_SS_CTRL1_M1},
4598 {0x0001, CMN_PLL1_SS_CTRL1_M0},
4599 {0x011B, CMN_PLL0_SS_CTRL2_M0},
4600 {0x011B, CMN_PLL0_SS_CTRL2_M1},
4601 {0x011B, CMN_PLL1_SS_CTRL2_M0},
4602 {0x006E, CMN_PLL0_SS_CTRL3_M0},
4603 {0x0058, CMN_PLL0_SS_CTRL3_M1},
4604 {0x006E, CMN_PLL1_SS_CTRL3_M0},
4605 {0x000E, CMN_PLL0_SS_CTRL4_M0},
4606 {0x0012, CMN_PLL0_SS_CTRL4_M1},
4607 {0x000E, CMN_PLL1_SS_CTRL4_M0},
4608 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
4609 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
4610 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
4611 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
4612 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
4613 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
4614 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
4615 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
4616 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
4617 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR},
4618 {0x007F, CMN_TXPUCAL_TUNE},
4619 {0x007F, CMN_TXPDCAL_TUNE}
4620 };
4621
4622 static const struct cdns_torrent_vals sgmii_100_int_ssc_cmn_vals = {
4623 .reg_pairs = sgmii_100_int_ssc_cmn_regs,
4624 .num_regs = ARRAY_SIZE(sgmii_100_int_ssc_cmn_regs),
4625 };
4626
4627 /* QSGMII 100 MHz Ref clk, no SSC */
4628 static const struct cdns_reg_pairs sl_qsgmii_100_no_ssc_cmn_regs[] = {
4629 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
4630 {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0},
4631 {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0},
4632 {0x0003, CMN_PLL0_VCOCAL_TCTRL},
4633 {0x0003, CMN_PLL1_VCOCAL_TCTRL}
4634 };
4635
4636 static const struct cdns_torrent_vals sl_qsgmii_100_no_ssc_cmn_vals = {
4637 .reg_pairs = sl_qsgmii_100_no_ssc_cmn_regs,
4638 .num_regs = ARRAY_SIZE(sl_qsgmii_100_no_ssc_cmn_regs),
4639 };
4640
4641 static const struct cdns_reg_pairs qsgmii_100_no_ssc_cmn_regs[] = {
4642 {0x007F, CMN_TXPUCAL_TUNE},
4643 {0x007F, CMN_TXPDCAL_TUNE}
4644 };
4645
4646 static const struct cdns_reg_pairs qsgmii_100_no_ssc_tx_ln_regs[] = {
4647 {0x00F3, TX_PSC_A0},
4648 {0x04A2, TX_PSC_A2},
4649 {0x04A2, TX_PSC_A3},
4650 {0x0000, TX_TXCC_CPOST_MULT_00},
4651 {0x0011, TX_TXCC_MGNFS_MULT_100},
4652 {0x0003, DRV_DIAG_TX_DRV},
4653 {0x0002, XCVR_DIAG_PSC_OVRD}
4654 };
4655
4656 static const struct cdns_reg_pairs ti_qsgmii_100_no_ssc_tx_ln_regs[] = {
4657 {0x00F3, TX_PSC_A0},
4658 {0x04A2, TX_PSC_A2},
4659 {0x04A2, TX_PSC_A3},
4660 {0x0000, TX_TXCC_CPOST_MULT_00},
4661 {0x0011, TX_TXCC_MGNFS_MULT_100},
4662 {0x0003, DRV_DIAG_TX_DRV},
4663 {0x0002, XCVR_DIAG_PSC_OVRD},
4664 {0x4000, XCVR_DIAG_RXCLK_CTRL}
4665 };
4666
4667 static const struct cdns_reg_pairs qsgmii_100_no_ssc_rx_ln_regs[] = {
4668 {0x091D, RX_PSC_A0},
4669 {0x0900, RX_PSC_A2},
4670 {0x0100, RX_PSC_A3},
4671 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
4672 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
4673 {0x0000, RX_DIAG_DFE_CTRL},
4674 {0x0019, RX_REE_TAP1_CLIP},
4675 {0x0019, RX_REE_TAP2TON_CLIP},
4676 {0x0098, RX_DIAG_NQST_CTRL},
4677 {0x0C01, RX_DIAG_DFE_AMP_TUNE_2},
4678 {0x0000, RX_DIAG_DFE_AMP_TUNE_3},
4679 {0x0000, RX_DIAG_PI_CAP},
4680 {0x0010, RX_DIAG_PI_RATE},
4681 {0x0001, RX_DIAG_ACYA},
4682 {0x018C, RX_CDRLF_CNFG},
4683 };
4684
4685 static const struct cdns_torrent_vals qsgmii_100_no_ssc_cmn_vals = {
4686 .reg_pairs = qsgmii_100_no_ssc_cmn_regs,
4687 .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_cmn_regs),
4688 };
4689
4690 static const struct cdns_torrent_vals qsgmii_100_no_ssc_tx_ln_vals = {
4691 .reg_pairs = qsgmii_100_no_ssc_tx_ln_regs,
4692 .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_tx_ln_regs),
4693 };
4694
4695 static const struct cdns_torrent_vals ti_qsgmii_100_no_ssc_tx_ln_vals = {
4696 .reg_pairs = ti_qsgmii_100_no_ssc_tx_ln_regs,
4697 .num_regs = ARRAY_SIZE(ti_qsgmii_100_no_ssc_tx_ln_regs),
4698 };
4699
4700 static const struct cdns_torrent_vals qsgmii_100_no_ssc_rx_ln_vals = {
4701 .reg_pairs = qsgmii_100_no_ssc_rx_ln_regs,
4702 .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_rx_ln_regs),
4703 };
4704
4705 /* TI J7200, multilink QSGMII */
4706 static const struct cdns_reg_pairs j7200_qsgmii_100_no_ssc_tx_ln_regs[] = {
4707 {0x07A2, TX_RCVDET_ST_TMR},
4708 {0x00F3, TX_PSC_A0},
4709 {0x04A2, TX_PSC_A2},
4710 {0x04A2, TX_PSC_A3 },
4711 {0x0000, TX_TXCC_CPOST_MULT_00},
4712 {0x0011, TX_TXCC_MGNFS_MULT_100},
4713 {0x0003, DRV_DIAG_TX_DRV},
4714 {0x0002, XCVR_DIAG_PSC_OVRD},
4715 {0x4000, XCVR_DIAG_RXCLK_CTRL}
4716 };
4717
4718 static const struct cdns_torrent_vals j7200_qsgmii_100_no_ssc_tx_ln_vals = {
4719 .reg_pairs = j7200_qsgmii_100_no_ssc_tx_ln_regs,
4720 .num_regs = ARRAY_SIZE(j7200_qsgmii_100_no_ssc_tx_ln_regs),
4721 };
4722
4723 static const struct cdns_reg_pairs j7200_qsgmii_100_no_ssc_rx_ln_regs[] = {
4724 {0x0014, RX_SDCAL0_INIT_TMR},
4725 {0x0062, RX_SDCAL0_ITER_TMR},
4726 {0x0014, RX_SDCAL1_INIT_TMR},
4727 {0x0062, RX_SDCAL1_ITER_TMR},
4728 {0x091D, RX_PSC_A0},
4729 {0x0900, RX_PSC_A2},
4730 {0x0100, RX_PSC_A3},
4731 {0x03C7, RX_REE_GCSM1_EQENM_PH1},
4732 {0x01C7, RX_REE_GCSM1_EQENM_PH2},
4733 {0x0000, RX_DIAG_DFE_CTRL},
4734 {0x0019, RX_REE_TAP1_CLIP},
4735 {0x0019, RX_REE_TAP2TON_CLIP},
4736 {0x0098, RX_DIAG_NQST_CTRL},
4737 {0x0C01, RX_DIAG_DFE_AMP_TUNE_2},
4738 {0x0000, RX_DIAG_DFE_AMP_TUNE_3},
4739 {0x0000, RX_DIAG_PI_CAP},
4740 {0x0010, RX_DIAG_PI_RATE},
4741 {0x0001, RX_DIAG_ACYA},
4742 {0x018C, RX_CDRLF_CNFG}
4743 };
4744
4745 static const struct cdns_torrent_vals j7200_qsgmii_100_no_ssc_rx_ln_vals = {
4746 .reg_pairs = j7200_qsgmii_100_no_ssc_rx_ln_regs,
4747 .num_regs = ARRAY_SIZE(j7200_qsgmii_100_no_ssc_rx_ln_regs),
4748 };
4749
4750 /* QSGMII 100 MHz Ref clk, internal SSC */
4751 static const struct cdns_reg_pairs qsgmii_100_int_ssc_cmn_regs[] = {
4752 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4753 {0x0004, CMN_PLL0_DSM_DIAG_M1},
4754 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4755 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4756 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1},
4757 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4758 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4759 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1},
4760 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4761 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4762 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1},
4763 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4764 {0x0064, CMN_PLL0_INTDIV_M0},
4765 {0x0050, CMN_PLL0_INTDIV_M1},
4766 {0x0064, CMN_PLL1_INTDIV_M0},
4767 {0x0002, CMN_PLL0_FRACDIVH_M0},
4768 {0x0002, CMN_PLL0_FRACDIVH_M1},
4769 {0x0002, CMN_PLL1_FRACDIVH_M0},
4770 {0x0044, CMN_PLL0_HIGH_THR_M0},
4771 {0x0036, CMN_PLL0_HIGH_THR_M1},
4772 {0x0044, CMN_PLL1_HIGH_THR_M0},
4773 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
4774 {0x0002, CMN_PDIAG_PLL0_CTRL_M1},
4775 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
4776 {0x0001, CMN_PLL0_SS_CTRL1_M0},
4777 {0x0001, CMN_PLL0_SS_CTRL1_M1},
4778 {0x0001, CMN_PLL1_SS_CTRL1_M0},
4779 {0x011B, CMN_PLL0_SS_CTRL2_M0},
4780 {0x011B, CMN_PLL0_SS_CTRL2_M1},
4781 {0x011B, CMN_PLL1_SS_CTRL2_M0},
4782 {0x006E, CMN_PLL0_SS_CTRL3_M0},
4783 {0x0058, CMN_PLL0_SS_CTRL3_M1},
4784 {0x006E, CMN_PLL1_SS_CTRL3_M0},
4785 {0x000E, CMN_PLL0_SS_CTRL4_M0},
4786 {0x0012, CMN_PLL0_SS_CTRL4_M1},
4787 {0x000E, CMN_PLL1_SS_CTRL4_M0},
4788 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
4789 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
4790 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
4791 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
4792 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
4793 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
4794 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
4795 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
4796 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
4797 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR},
4798 {0x007F, CMN_TXPUCAL_TUNE},
4799 {0x007F, CMN_TXPDCAL_TUNE}
4800 };
4801
4802 static const struct cdns_torrent_vals qsgmii_100_int_ssc_cmn_vals = {
4803 .reg_pairs = qsgmii_100_int_ssc_cmn_regs,
4804 .num_regs = ARRAY_SIZE(qsgmii_100_int_ssc_cmn_regs),
4805 };
4806
4807 /* Single SGMII/QSGMII link configuration */
4808 static const struct cdns_reg_pairs sl_sgmii_link_cmn_regs[] = {
4809 {0x0000, PHY_PLL_CFG},
4810 {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}
4811 };
4812
4813 static const struct cdns_reg_pairs sl_sgmii_xcvr_diag_ln_regs[] = {
4814 {0x0000, XCVR_DIAG_HSCLK_SEL},
4815 {0x0003, XCVR_DIAG_HSCLK_DIV},
4816 {0x0013, XCVR_DIAG_PLLDRC_CTRL}
4817 };
4818
4819 static const struct cdns_torrent_vals sl_sgmii_link_cmn_vals = {
4820 .reg_pairs = sl_sgmii_link_cmn_regs,
4821 .num_regs = ARRAY_SIZE(sl_sgmii_link_cmn_regs),
4822 };
4823
4824 static const struct cdns_torrent_vals sl_sgmii_xcvr_diag_ln_vals = {
4825 .reg_pairs = sl_sgmii_xcvr_diag_ln_regs,
4826 .num_regs = ARRAY_SIZE(sl_sgmii_xcvr_diag_ln_regs),
4827 };
4828
4829 /* For PCIe (with some other protocol), 100 MHz Ref clk, internal SSC */
4830 static const struct cdns_reg_pairs pcie_100_int_ssc_cmn_regs[] = {
4831 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4832 {0x0004, CMN_PLL0_DSM_DIAG_M1},
4833 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4834 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4835 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1},
4836 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4837 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4838 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1},
4839 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4840 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4841 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1},
4842 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4843 {0x0064, CMN_PLL0_INTDIV_M0},
4844 {0x0050, CMN_PLL0_INTDIV_M1},
4845 {0x0064, CMN_PLL1_INTDIV_M0},
4846 {0x0002, CMN_PLL0_FRACDIVH_M0},
4847 {0x0002, CMN_PLL0_FRACDIVH_M1},
4848 {0x0002, CMN_PLL1_FRACDIVH_M0},
4849 {0x0044, CMN_PLL0_HIGH_THR_M0},
4850 {0x0036, CMN_PLL0_HIGH_THR_M1},
4851 {0x0044, CMN_PLL1_HIGH_THR_M0},
4852 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
4853 {0x0002, CMN_PDIAG_PLL0_CTRL_M1},
4854 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
4855 {0x0001, CMN_PLL0_SS_CTRL1_M0},
4856 {0x0001, CMN_PLL0_SS_CTRL1_M1},
4857 {0x0001, CMN_PLL1_SS_CTRL1_M0},
4858 {0x011B, CMN_PLL0_SS_CTRL2_M0},
4859 {0x011B, CMN_PLL0_SS_CTRL2_M1},
4860 {0x011B, CMN_PLL1_SS_CTRL2_M0},
4861 {0x006E, CMN_PLL0_SS_CTRL3_M0},
4862 {0x0058, CMN_PLL0_SS_CTRL3_M1},
4863 {0x006E, CMN_PLL1_SS_CTRL3_M0},
4864 {0x000E, CMN_PLL0_SS_CTRL4_M0},
4865 {0x0012, CMN_PLL0_SS_CTRL4_M1},
4866 {0x000E, CMN_PLL1_SS_CTRL4_M0},
4867 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
4868 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
4869 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
4870 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
4871 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
4872 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
4873 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
4874 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
4875 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
4876 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}
4877 };
4878
4879 static const struct cdns_torrent_vals pcie_100_int_ssc_cmn_vals = {
4880 .reg_pairs = pcie_100_int_ssc_cmn_regs,
4881 .num_regs = ARRAY_SIZE(pcie_100_int_ssc_cmn_regs),
4882 };
4883
4884 /* Single link PCIe, 100 MHz Ref clk, internal SSC */
4885 static const struct cdns_reg_pairs sl_pcie_100_int_ssc_cmn_regs[] = {
4886 {0x0004, CMN_PLL0_DSM_DIAG_M0},
4887 {0x0004, CMN_PLL0_DSM_DIAG_M1},
4888 {0x0004, CMN_PLL1_DSM_DIAG_M0},
4889 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0},
4890 {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1},
4891 {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0},
4892 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0},
4893 {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1},
4894 {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0},
4895 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0},
4896 {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1},
4897 {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0},
4898 {0x0064, CMN_PLL0_INTDIV_M0},
4899 {0x0050, CMN_PLL0_INTDIV_M1},
4900 {0x0050, CMN_PLL1_INTDIV_M0},
4901 {0x0002, CMN_PLL0_FRACDIVH_M0},
4902 {0x0002, CMN_PLL0_FRACDIVH_M1},
4903 {0x0002, CMN_PLL1_FRACDIVH_M0},
4904 {0x0044, CMN_PLL0_HIGH_THR_M0},
4905 {0x0036, CMN_PLL0_HIGH_THR_M1},
4906 {0x0036, CMN_PLL1_HIGH_THR_M0},
4907 {0x0002, CMN_PDIAG_PLL0_CTRL_M0},
4908 {0x0002, CMN_PDIAG_PLL0_CTRL_M1},
4909 {0x0002, CMN_PDIAG_PLL1_CTRL_M0},
4910 {0x0001, CMN_PLL0_SS_CTRL1_M0},
4911 {0x0001, CMN_PLL0_SS_CTRL1_M1},
4912 {0x0001, CMN_PLL1_SS_CTRL1_M0},
4913 {0x011B, CMN_PLL0_SS_CTRL2_M0},
4914 {0x011B, CMN_PLL0_SS_CTRL2_M1},
4915 {0x011B, CMN_PLL1_SS_CTRL2_M0},
4916 {0x006E, CMN_PLL0_SS_CTRL3_M0},
4917 {0x0058, CMN_PLL0_SS_CTRL3_M1},
4918 {0x0058, CMN_PLL1_SS_CTRL3_M0},
4919 {0x000E, CMN_PLL0_SS_CTRL4_M0},
4920 {0x0012, CMN_PLL0_SS_CTRL4_M1},
4921 {0x0012, CMN_PLL1_SS_CTRL4_M0},
4922 {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START},
4923 {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START},
4924 {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START},
4925 {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START},
4926 {0x00C7, CMN_PLL0_LOCK_REFCNT_START},
4927 {0x00C7, CMN_PLL1_LOCK_REFCNT_START},
4928 {0x00C7, CMN_PLL0_LOCK_PLLCNT_START},
4929 {0x00C7, CMN_PLL1_LOCK_PLLCNT_START},
4930 {0x0005, CMN_PLL0_LOCK_PLLCNT_THR},
4931 {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}
4932 };
4933
4934 static const struct cdns_torrent_vals sl_pcie_100_int_ssc_cmn_vals = {
4935 .reg_pairs = sl_pcie_100_int_ssc_cmn_regs,
4936 .num_regs = ARRAY_SIZE(sl_pcie_100_int_ssc_cmn_regs),
4937 };
4938
4939 /* PCIe, 100 MHz Ref clk, no SSC & external SSC */
4940 static const struct cdns_reg_pairs pcie_100_ext_no_ssc_cmn_regs[] = {
4941 {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0},
4942 {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0},
4943 {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0}
4944 };
4945
4946 static const struct cdns_reg_pairs pcie_100_ext_no_ssc_rx_ln_regs[] = {
4947 {0x0019, RX_REE_TAP1_CLIP},
4948 {0x0019, RX_REE_TAP2TON_CLIP},
4949 {0x0001, RX_DIAG_ACYA}
4950 };
4951
4952 static const struct cdns_torrent_vals pcie_100_no_ssc_cmn_vals = {
4953 .reg_pairs = pcie_100_ext_no_ssc_cmn_regs,
4954 .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_cmn_regs),
4955 };
4956
4957 static const struct cdns_torrent_vals pcie_100_no_ssc_rx_ln_vals = {
4958 .reg_pairs = pcie_100_ext_no_ssc_rx_ln_regs,
4959 .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_rx_ln_regs),
4960 };
4961
4962 static const struct cdns_torrent_vals_entry link_cmn_vals_entries[] = {
4963 {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_NONE), &sl_dp_link_cmn_vals},
4964 {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_PCIE), &pcie_dp_link_cmn_vals},
4965 {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_USB), &usb_dp_link_cmn_vals},
4966
4967 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_NONE), NULL},
4968 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_PCIE), &ml_pcie_link_cmn_vals},
4969 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_SGMII), &pcie_sgmii_link_cmn_vals},
4970 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_QSGMII), &pcie_sgmii_link_cmn_vals},
4971 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_USB), &pcie_usb_link_cmn_vals},
4972 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_DP), &pcie_dp_link_cmn_vals},
4973 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_USXGMII), &pcie_usxgmii_link_cmn_vals},
4974 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_XAUI), &pcie_xaui_link_cmn_vals},
4975
4976 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE_ML, TYPE_USB), &ml_pcie_usb_link_cmn_vals},
4977
4978 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_NONE), &sl_sgmii_link_cmn_vals},
4979 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_PCIE), &pcie_sgmii_link_cmn_vals},
4980 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_QSGMII), &sgmii_qsgmii_link_cmn_vals},
4981 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_USB), &usb_sgmii_link_cmn_vals},
4982 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_USXGMII), &usxgmii_sgmii_link_cmn_vals},
4983
4984 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_NONE), &sl_sgmii_link_cmn_vals},
4985 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_PCIE), &pcie_sgmii_link_cmn_vals},
4986 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_SGMII), &sgmii_qsgmii_link_cmn_vals},
4987 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_USB), &usb_sgmii_link_cmn_vals},
4988 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_USXGMII), &usxgmii_sgmii_link_cmn_vals},
4989
4990 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &sl_usb_link_cmn_vals},
4991 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &pcie_usb_link_cmn_vals},
4992 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE_ML), &ml_pcie_usb_link_cmn_vals},
4993 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_sgmii_link_cmn_vals},
4994 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_sgmii_link_cmn_vals},
4995 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_dp_link_cmn_vals},
4996
4997 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &sl_usxgmii_link_cmn_vals},
4998 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_PCIE), &pcie_usxgmii_link_cmn_vals},
4999 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_SGMII), &usxgmii_sgmii_link_cmn_vals},
5000 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_QSGMII), &usxgmii_sgmii_link_cmn_vals},
5001
5002 {CDNS_TORRENT_KEY_ANYCLK(TYPE_XAUI, TYPE_PCIE), &pcie_xaui_link_cmn_vals},
5003 };
5004
5005 static const struct cdns_torrent_vals_entry xcvr_diag_vals_entries[] = {
5006 {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_NONE), &sl_dp_xcvr_diag_ln_vals},
5007 {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_PCIE), &dp_pcie_xcvr_diag_ln_vals},
5008 {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_USB), &dp_usb_xcvr_diag_ln_vals},
5009
5010 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_NONE), NULL},
5011 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_PCIE), &ml_pcie_xcvr_diag_ln_vals},
5012 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_SGMII), &pcie_sgmii_xcvr_diag_ln_vals},
5013 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_QSGMII), &pcie_sgmii_xcvr_diag_ln_vals},
5014 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_USB), &pcie_usb_xcvr_diag_ln_vals},
5015 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_DP), &pcie_dp_xcvr_diag_ln_vals},
5016 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_USXGMII), &pcie_usxgmii_xcvr_diag_ln_vals},
5017 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_XAUI), NULL},
5018
5019 {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE_ML, TYPE_USB), &ml_pcie_usb_xcvr_diag_ln_vals},
5020
5021 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_NONE), &sl_sgmii_xcvr_diag_ln_vals},
5022 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_PCIE), &sgmii_pcie_xcvr_diag_ln_vals},
5023 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_QSGMII), &sgmii_qsgmii_xcvr_diag_ln_vals},
5024 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_USB), &sgmii_usb_xcvr_diag_ln_vals},
5025 {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_USXGMII), &sgmii_usxgmii_xcvr_diag_ln_vals},
5026
5027 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_NONE), &sl_sgmii_xcvr_diag_ln_vals},
5028 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_PCIE), &sgmii_pcie_xcvr_diag_ln_vals},
5029 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_SGMII), &sgmii_qsgmii_xcvr_diag_ln_vals},
5030 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_USB), &sgmii_usb_xcvr_diag_ln_vals},
5031 {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_USXGMII), &sgmii_usxgmii_xcvr_diag_ln_vals},
5032
5033 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &sl_usb_xcvr_diag_ln_vals},
5034 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &usb_pcie_xcvr_diag_ln_vals},
5035 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE_ML), &usb_ml_pcie_xcvr_diag_ln_vals},
5036 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_sgmii_xcvr_diag_ln_vals},
5037 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_sgmii_xcvr_diag_ln_vals},
5038 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_dp_xcvr_diag_ln_vals},
5039
5040 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &sl_usxgmii_xcvr_diag_ln_vals},
5041 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_PCIE), &usxgmii_pcie_xcvr_diag_ln_vals},
5042 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_SGMII), &usxgmii_sgmii_xcvr_diag_ln_vals},
5043 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_QSGMII), &usxgmii_sgmii_xcvr_diag_ln_vals},
5044
5045 {CDNS_TORRENT_KEY_ANYCLK(TYPE_XAUI, TYPE_PCIE), &xaui_pcie_xcvr_diag_ln_vals},
5046 };
5047
5048 static const struct cdns_torrent_vals_entry pcs_cmn_vals_entries[] = {
5049 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &usb_phy_pcs_cmn_vals},
5050 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &usb_phy_pcs_cmn_vals},
5051 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE_ML), &usb_phy_pcs_cmn_vals},
5052 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_phy_pcs_cmn_vals},
5053 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_phy_pcs_cmn_vals},
5054 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_phy_pcs_cmn_vals},
5055 };
5056
5057 static const struct cdns_torrent_vals_entry cmn_vals_entries[] = {
5058 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_cmn_vals},
5059 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_cmn_vals},
5060
5061 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_cmn_vals},
5062 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_cmn_vals},
5063 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &sl_dp_100_no_ssc_cmn_vals},
5064
5065 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL},
5066 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL},
5067 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), &sl_pcie_100_int_ssc_cmn_vals},
5068
5069 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5070 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5071 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), &ml_pcie_100_int_ssc_cmn_vals},
5072
5073 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), &pcie_100_no_ssc_cmn_vals},
5074 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals},
5075 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals},
5076
5077 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), &pcie_100_no_ssc_cmn_vals},
5078 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals},
5079 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals},
5080
5081 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), &pcie_100_no_ssc_cmn_vals},
5082 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals},
5083 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals},
5084
5085 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL},
5086
5087 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), NULL},
5088
5089 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5090 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5091 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), &ml_pcie_100_int_ssc_cmn_vals},
5092
5093 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sl_sgmii_100_no_ssc_cmn_vals},
5094
5095 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_cmn_vals},
5096 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals},
5097 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_int_ssc_cmn_vals},
5098
5099 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &sl_sgmii_100_no_ssc_cmn_vals},
5100
5101 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_cmn_vals},
5102 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals},
5103 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals},
5104
5105 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &sl_qsgmii_100_no_ssc_cmn_vals},
5106
5107 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_cmn_vals},
5108 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals},
5109 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_int_ssc_cmn_vals},
5110
5111 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &sl_qsgmii_100_no_ssc_cmn_vals},
5112
5113 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_cmn_vals},
5114 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals},
5115 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals},
5116
5117 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &sl_usb_100_no_ssc_cmn_vals},
5118 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals},
5119 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals},
5120
5121 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_cmn_vals},
5122 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_cmn_vals},
5123 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_int_ssc_cmn_vals},
5124
5125 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_cmn_vals},
5126 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_cmn_vals},
5127 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_cmn_vals},
5128
5129 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &sl_usb_100_no_ssc_cmn_vals},
5130 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals},
5131 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals},
5132
5133 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &sl_usb_100_no_ssc_cmn_vals},
5134 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals},
5135 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals},
5136
5137 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_cmn_vals},
5138
5139 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &xaui_100_no_ssc_cmn_vals},
5140
5141 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &sl_usxgmii_156_25_no_ssc_cmn_vals},
5142
5143 /* Dual refclk */
5144 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), NULL},
5145
5146 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &ml_sgmii_pll1_100_no_ssc_cmn_vals},
5147
5148 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &ml_sgmii_pll1_100_no_ssc_cmn_vals},
5149
5150 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_pll1_156_25_no_ssc_cmn_vals},
5151 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &ml_usxgmii_pll0_156_25_no_ssc_cmn_vals},
5152 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &ml_usxgmii_pll0_156_25_no_ssc_cmn_vals},
5153 };
5154
5155 static const struct cdns_torrent_vals_entry cdns_tx_ln_vals_entries[] = {
5156 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals},
5157 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals},
5158
5159 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_tx_ln_vals},
5160 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_tx_ln_vals},
5161 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_tx_ln_vals},
5162
5163 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL},
5164 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL},
5165 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), NULL},
5166
5167 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), NULL},
5168 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), NULL},
5169 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), NULL},
5170
5171 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), NULL},
5172 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), NULL},
5173 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), NULL},
5174
5175 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), NULL},
5176 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), NULL},
5177 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), NULL},
5178
5179 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), NULL},
5180 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), NULL},
5181 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), NULL},
5182
5183 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL},
5184
5185 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), NULL},
5186
5187 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), NULL},
5188 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), NULL},
5189 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), NULL},
5190
5191 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5192
5193 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5194 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5195 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5196
5197 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5198
5199 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5200 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5201 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5202
5203 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5204
5205 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5206 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5207 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5208
5209 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5210
5211 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5212 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5213 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5214
5215 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5216 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5217 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5218
5219 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5220 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5221 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5222
5223 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5224 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5225 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5226
5227 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5228 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5229 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5230
5231 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5232 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5233 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5234
5235 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5236
5237 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &xaui_100_no_ssc_tx_ln_vals},
5238
5239 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals},
5240
5241 /* Dual refclk */
5242 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), NULL},
5243
5244 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals},
5245
5246 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals},
5247
5248 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5249 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5250 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5251 };
5252
5253 static const struct cdns_torrent_vals_entry cdns_rx_ln_vals_entries[] = {
5254 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_rx_ln_vals},
5255 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_rx_ln_vals},
5256
5257 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_rx_ln_vals},
5258 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_rx_ln_vals},
5259 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_rx_ln_vals},
5260
5261 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5262 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5263 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5264
5265 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5266 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5267 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5268
5269 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5270 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5271 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5272
5273 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5274 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5275 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5276
5277 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5278 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5279 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5280
5281 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5282
5283 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5284
5285 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5286 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5287 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), &ml_pcie_100_no_ssc_rx_ln_vals},
5288
5289 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5290
5291 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5292 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5293 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5294
5295 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5296
5297 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5298 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5299 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5300
5301 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5302
5303 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5304 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5305 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5306
5307 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5308
5309 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5310 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5311 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5312
5313 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5314 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5315 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5316
5317 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5318 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5319 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5320
5321 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5322 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5323 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5324
5325 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5326 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5327 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5328
5329 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5330 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5331 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5332
5333 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5334
5335 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &xaui_100_no_ssc_rx_ln_vals},
5336
5337 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_rx_ln_vals},
5338
5339 /* Dual refclk */
5340 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5341
5342 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5343
5344 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5345
5346 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_156_25_no_ssc_rx_ln_vals},
5347 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_rx_ln_vals},
5348 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_rx_ln_vals},
5349 };
5350
5351 static const struct cdns_torrent_data cdns_map_torrent = {
5352 .block_offset_shift = 0x2,
5353 .reg_offset_shift = 0x2,
5354 .link_cmn_vals_tbl = {
5355 .entries = link_cmn_vals_entries,
5356 .num_entries = ARRAY_SIZE(link_cmn_vals_entries),
5357 },
5358 .xcvr_diag_vals_tbl = {
5359 .entries = xcvr_diag_vals_entries,
5360 .num_entries = ARRAY_SIZE(xcvr_diag_vals_entries),
5361 },
5362 .pcs_cmn_vals_tbl = {
5363 .entries = pcs_cmn_vals_entries,
5364 .num_entries = ARRAY_SIZE(pcs_cmn_vals_entries),
5365 },
5366 .cmn_vals_tbl = {
5367 .entries = cmn_vals_entries,
5368 .num_entries = ARRAY_SIZE(cmn_vals_entries),
5369 },
5370 .tx_ln_vals_tbl = {
5371 .entries = cdns_tx_ln_vals_entries,
5372 .num_entries = ARRAY_SIZE(cdns_tx_ln_vals_entries),
5373 },
5374 .rx_ln_vals_tbl = {
5375 .entries = cdns_rx_ln_vals_entries,
5376 .num_entries = ARRAY_SIZE(cdns_rx_ln_vals_entries),
5377 },
5378 };
5379
5380 static const struct cdns_torrent_vals_entry j721e_phy_pma_cmn_vals_entries[] = {
5381 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &ti_usxgmii_phy_pma_cmn_vals},
5382 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_PCIE), &ti_usxgmii_phy_pma_cmn_vals},
5383 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_SGMII), &ti_usxgmii_phy_pma_cmn_vals},
5384 {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_QSGMII), &ti_usxgmii_phy_pma_cmn_vals},
5385 };
5386
5387 static const struct cdns_torrent_vals_entry ti_tx_ln_vals_entries[] = {
5388 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals},
5389 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals},
5390
5391 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_tx_ln_vals},
5392 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_tx_ln_vals},
5393 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_tx_ln_vals},
5394
5395 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL},
5396 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL},
5397 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), NULL},
5398
5399 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), NULL},
5400 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), NULL},
5401 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), NULL},
5402
5403 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), NULL},
5404 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), NULL},
5405 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), NULL},
5406
5407 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), NULL},
5408 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), NULL},
5409 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), NULL},
5410
5411 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), NULL},
5412 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), NULL},
5413 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), NULL},
5414
5415 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL},
5416
5417 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), NULL},
5418
5419 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), NULL},
5420 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), NULL},
5421 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), NULL},
5422
5423 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5424
5425 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5426 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5427 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5428
5429 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5430
5431 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5432 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5433 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5434
5435 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5436
5437 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5438 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5439 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5440
5441 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5442
5443 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5444 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5445 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5446
5447 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5448 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5449 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5450
5451 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5452 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5453 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5454
5455 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5456 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5457 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5458
5459 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5460 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5461 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5462
5463 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5464 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5465 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5466
5467 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5468
5469 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &ti_xaui_100_no_ssc_tx_ln_vals},
5470
5471 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals},
5472
5473 /* Dual refclk */
5474 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), NULL},
5475
5476 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5477
5478 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5479
5480 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5481 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5482 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5483 };
5484
5485 static const struct cdns_torrent_data ti_j721e_map_torrent = {
5486 .block_offset_shift = 0x0,
5487 .reg_offset_shift = 0x1,
5488 .link_cmn_vals_tbl = {
5489 .entries = link_cmn_vals_entries,
5490 .num_entries = ARRAY_SIZE(link_cmn_vals_entries),
5491 },
5492 .xcvr_diag_vals_tbl = {
5493 .entries = xcvr_diag_vals_entries,
5494 .num_entries = ARRAY_SIZE(xcvr_diag_vals_entries),
5495 },
5496 .pcs_cmn_vals_tbl = {
5497 .entries = pcs_cmn_vals_entries,
5498 .num_entries = ARRAY_SIZE(pcs_cmn_vals_entries),
5499 },
5500 .phy_pma_cmn_vals_tbl = {
5501 .entries = j721e_phy_pma_cmn_vals_entries,
5502 .num_entries = ARRAY_SIZE(j721e_phy_pma_cmn_vals_entries),
5503 },
5504 .cmn_vals_tbl = {
5505 .entries = cmn_vals_entries,
5506 .num_entries = ARRAY_SIZE(cmn_vals_entries),
5507 },
5508 .tx_ln_vals_tbl = {
5509 .entries = ti_tx_ln_vals_entries,
5510 .num_entries = ARRAY_SIZE(ti_tx_ln_vals_entries),
5511 },
5512 .rx_ln_vals_tbl = {
5513 .entries = cdns_rx_ln_vals_entries,
5514 .num_entries = ARRAY_SIZE(cdns_rx_ln_vals_entries),
5515 },
5516 };
5517
5518 /* TI J7200 (Torrent SD0805) */
5519 static const struct cdns_torrent_vals_entry ti_j7200_cmn_vals_entries[] = {
5520 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_cmn_vals},
5521 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_cmn_vals},
5522
5523 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_cmn_vals},
5524 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_cmn_vals},
5525 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &sl_dp_100_no_ssc_cmn_vals},
5526
5527 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL},
5528 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL},
5529 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), &sl_pcie_100_int_ssc_cmn_vals},
5530
5531 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5532 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5533 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), &ml_pcie_100_int_ssc_cmn_vals},
5534
5535 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), &pcie_100_no_ssc_cmn_vals},
5536 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals},
5537 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals},
5538
5539 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), &pcie_100_no_ssc_cmn_vals},
5540 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals},
5541 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals},
5542
5543 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), &pcie_100_no_ssc_cmn_vals},
5544 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals},
5545 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals},
5546
5547 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL},
5548
5549 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), NULL},
5550
5551 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5552 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), &ml_pcie_100_no_ssc_cmn_vals},
5553 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), &ml_pcie_100_int_ssc_cmn_vals},
5554
5555 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sl_sgmii_100_no_ssc_cmn_vals},
5556
5557 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_cmn_vals},
5558 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals},
5559 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_int_ssc_cmn_vals},
5560
5561 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &sl_sgmii_100_no_ssc_cmn_vals},
5562
5563 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_cmn_vals},
5564 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals},
5565 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals},
5566
5567 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &sl_qsgmii_100_no_ssc_cmn_vals},
5568
5569 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_cmn_vals},
5570 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals},
5571 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_int_ssc_cmn_vals},
5572
5573 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &sl_qsgmii_100_no_ssc_cmn_vals},
5574
5575 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_cmn_vals},
5576 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals},
5577 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals},
5578
5579 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &sl_usb_100_no_ssc_cmn_vals},
5580 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals},
5581 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals},
5582
5583 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_cmn_vals},
5584 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_cmn_vals},
5585 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_int_ssc_cmn_vals},
5586
5587 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_cmn_vals},
5588 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_cmn_vals},
5589 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_cmn_vals},
5590
5591 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &sl_usb_100_no_ssc_cmn_vals},
5592 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals},
5593 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals},
5594
5595 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &sl_usb_100_no_ssc_cmn_vals},
5596 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals},
5597 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals},
5598
5599 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_cmn_vals},
5600
5601 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &xaui_100_no_ssc_cmn_vals},
5602
5603 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &sl_usxgmii_156_25_no_ssc_cmn_vals},
5604
5605 /* Dual refclk */
5606 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), NULL},
5607
5608 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &j7200_ml_sgmii_pll1_100_no_ssc_cmn_vals},
5609
5610 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &j7200_ml_sgmii_pll1_100_no_ssc_cmn_vals},
5611
5612 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_pll1_156_25_no_ssc_cmn_vals},
5613 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_vals},
5614 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &j7200_ml_usxgmii_pll0_156_25_no_ssc_cmn_vals},
5615 };
5616
5617 static const struct cdns_torrent_vals_entry ti_j7200_tx_ln_vals_entries[] = {
5618 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals},
5619 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals},
5620
5621 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_tx_ln_vals},
5622 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_tx_ln_vals},
5623 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_tx_ln_vals},
5624
5625 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL},
5626 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL},
5627 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), NULL},
5628
5629 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), NULL},
5630 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), NULL},
5631 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), NULL},
5632
5633 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), NULL},
5634 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), NULL},
5635 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), NULL},
5636
5637 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), NULL},
5638 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), NULL},
5639 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), NULL},
5640
5641 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), NULL},
5642 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), NULL},
5643 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), NULL},
5644
5645 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL},
5646
5647 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), NULL},
5648
5649 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), NULL},
5650 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), NULL},
5651 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), NULL},
5652
5653 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5654
5655 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5656 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5657 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5658
5659 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5660
5661 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5662 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5663 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals},
5664
5665 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5666
5667 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5668 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5669 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5670
5671 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5672
5673 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5674 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5675 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals},
5676
5677 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5678 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5679 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5680
5681 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5682 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5683 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5684
5685 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5686 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5687 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5688
5689 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5690 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5691 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5692
5693 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5694 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5695 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals},
5696
5697 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_tx_ln_vals},
5698
5699 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &ti_xaui_100_no_ssc_tx_ln_vals},
5700
5701 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals},
5702
5703 /* Dual refclk */
5704 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), NULL},
5705
5706 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &j7200_sgmii_100_no_ssc_tx_ln_vals},
5707
5708 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &j7200_qsgmii_100_no_ssc_tx_ln_vals},
5709
5710 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_156_25_no_ssc_tx_ln_vals},
5711 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals},
5712 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals},
5713 };
5714
5715 static const struct cdns_torrent_vals_entry ti_j7200_rx_ln_vals_entries[] = {
5716 {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_rx_ln_vals},
5717 {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_rx_ln_vals},
5718
5719 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_rx_ln_vals},
5720 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_rx_ln_vals},
5721 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_rx_ln_vals},
5722
5723 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5724 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5725 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5726
5727 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5728 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5729 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_PCIE, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5730
5731 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5732 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5733 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5734
5735 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5736 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5737 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5738
5739 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5740 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5741 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5742
5743 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5744
5745 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_XAUI, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5746
5747 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5748 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5749 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE_ML, TYPE_USB, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals},
5750
5751 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5752
5753 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5754 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5755 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5756
5757 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_QSGMII, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5758
5759 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5760 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5761 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals},
5762
5763 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5764
5765 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5766 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5767 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5768
5769 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_SGMII, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5770
5771 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5772 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5773 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals},
5774
5775 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5776 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5777 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5778
5779 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5780 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5781 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5782
5783 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5784 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5785 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE_ML, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5786
5787 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5788 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5789 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5790
5791 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5792 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5793 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals},
5794
5795 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_rx_ln_vals},
5796
5797 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_XAUI, TYPE_PCIE, NO_SSC), &xaui_100_no_ssc_rx_ln_vals},
5798
5799 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_rx_ln_vals},
5800
5801 /* Dual refclk */
5802 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_PCIE, TYPE_USXGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals},
5803
5804 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_SGMII, TYPE_USXGMII, NO_SSC), &j7200_sgmii_100_no_ssc_rx_ln_vals},
5805
5806 {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_156_25_MHZ, TYPE_QSGMII, TYPE_USXGMII, NO_SSC), &j7200_qsgmii_100_no_ssc_rx_ln_vals},
5807
5808 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_PCIE, NO_SSC), &ml_usxgmii_156_25_no_ssc_rx_ln_vals},
5809 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_SGMII, NO_SSC), &usxgmii_156_25_no_ssc_rx_ln_vals},
5810 {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_100_MHZ, TYPE_USXGMII, TYPE_QSGMII, NO_SSC), &usxgmii_156_25_no_ssc_rx_ln_vals},
5811 };
5812
5813 static const struct cdns_torrent_data ti_j7200_map_torrent = {
5814 .block_offset_shift = 0x0,
5815 .reg_offset_shift = 0x1,
5816 .link_cmn_vals_tbl = {
5817 .entries = link_cmn_vals_entries,
5818 .num_entries = ARRAY_SIZE(link_cmn_vals_entries),
5819 },
5820 .xcvr_diag_vals_tbl = {
5821 .entries = xcvr_diag_vals_entries,
5822 .num_entries = ARRAY_SIZE(xcvr_diag_vals_entries),
5823 },
5824 .pcs_cmn_vals_tbl = {
5825 .entries = pcs_cmn_vals_entries,
5826 .num_entries = ARRAY_SIZE(pcs_cmn_vals_entries),
5827 },
5828 .phy_pma_cmn_vals_tbl = {
5829 .entries = j721e_phy_pma_cmn_vals_entries,
5830 .num_entries = ARRAY_SIZE(j721e_phy_pma_cmn_vals_entries),
5831 },
5832 .cmn_vals_tbl = {
5833 .entries = ti_j7200_cmn_vals_entries,
5834 .num_entries = ARRAY_SIZE(ti_j7200_cmn_vals_entries),
5835 },
5836 .tx_ln_vals_tbl = {
5837 .entries = ti_j7200_tx_ln_vals_entries,
5838 .num_entries = ARRAY_SIZE(ti_j7200_tx_ln_vals_entries),
5839 },
5840 .rx_ln_vals_tbl = {
5841 .entries = ti_j7200_rx_ln_vals_entries,
5842 .num_entries = ARRAY_SIZE(ti_j7200_rx_ln_vals_entries),
5843 },
5844 };
5845
5846 static const struct of_device_id cdns_torrent_phy_of_match[] = {
5847 {
5848 .compatible = "cdns,torrent-phy",
5849 .data = &cdns_map_torrent,
5850 },
5851 {
5852 .compatible = "ti,j721e-serdes-10g",
5853 .data = &ti_j721e_map_torrent,
5854 },
5855 {
5856 .compatible = "ti,j7200-serdes-10g",
5857 .data = &ti_j7200_map_torrent,
5858 },
5859 {}
5860 };
5861 MODULE_DEVICE_TABLE(of, cdns_torrent_phy_of_match);
5862
5863 static struct platform_driver cdns_torrent_phy_driver = {
5864 .probe = cdns_torrent_phy_probe,
5865 .remove = cdns_torrent_phy_remove,
5866 .driver = {
5867 .name = "cdns-torrent-phy",
5868 .of_match_table = cdns_torrent_phy_of_match,
5869 .pm = pm_sleep_ptr(&cdns_torrent_phy_pm_ops),
5870 }
5871 };
5872 module_platform_driver(cdns_torrent_phy_driver);
5873
5874 MODULE_AUTHOR("Cadence Design Systems, Inc.");
5875 MODULE_DESCRIPTION("Cadence Torrent PHY driver");
5876 MODULE_LICENSE("GPL v2");
5877