144d30d62SAlan Douglas // SPDX-License-Identifier: GPL-2.0 244d30d62SAlan Douglas /* 344d30d62SAlan Douglas * Cadence Sierra PHY Driver 444d30d62SAlan Douglas * 544d30d62SAlan Douglas * Copyright (c) 2018 Cadence Design Systems 644d30d62SAlan Douglas * Author: Alan Douglas <adouglas@cadence.com> 744d30d62SAlan Douglas * 844d30d62SAlan Douglas */ 944d30d62SAlan Douglas #include <linux/clk.h> 1028081b72SKishon Vijay Abraham I #include <linux/clk-provider.h> 1144d30d62SAlan Douglas #include <linux/delay.h> 1244d30d62SAlan Douglas #include <linux/err.h> 1344d30d62SAlan Douglas #include <linux/io.h> 1444d30d62SAlan Douglas #include <linux/module.h> 1544d30d62SAlan Douglas #include <linux/phy/phy.h> 1644d30d62SAlan Douglas #include <linux/platform_device.h> 1744d30d62SAlan Douglas #include <linux/pm_runtime.h> 1844d30d62SAlan Douglas #include <linux/regmap.h> 1944d30d62SAlan Douglas #include <linux/reset.h> 2044d30d62SAlan Douglas #include <linux/slab.h> 2144d30d62SAlan Douglas #include <linux/of.h> 2244d30d62SAlan Douglas #include <linux/of_platform.h> 2344d30d62SAlan Douglas #include <dt-bindings/phy/phy.h> 2428081b72SKishon Vijay Abraham I #include <dt-bindings/phy/phy-cadence.h> 2544d30d62SAlan Douglas 26078e9e92SSwapnil Jakhade #define NUM_SSC_MODE 3 276b81f05aSSwapnil Jakhade #define NUM_PHY_TYPE 4 28078e9e92SSwapnil Jakhade 2944d30d62SAlan Douglas /* PHY register offsets */ 30380f5708SKishon Vijay Abraham I #define SIERRA_COMMON_CDB_OFFSET 0x0 31380f5708SKishon Vijay Abraham I #define SIERRA_MACRO_ID_REG 0x0 3228081b72SKishon Vijay Abraham I #define SIERRA_CMN_PLLLC_GEN_PREG 0x42 33871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_MODE_PREG 0x48 34871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG 0x49 35871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG 0x4A 36871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_LOCK_CNTSTART_PREG 0x4B 3709d976b3SSwapnil Jakhade #define SIERRA_CMN_PLLLC_CLK1_PREG 0x4D 38871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG 0x4F 39871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG 0x50 407a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_DSMCORR_PREG 0x51 417a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_SS_PREG 0x52 427a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG 0x53 437a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_SSTWOPT_PREG 0x54 44871002d7SAnil Varughese #define SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG 0x62 457a5ad9b4SSwapnil Jakhade #define SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG 0x63 4628081b72SKishon Vijay Abraham I #define SIERRA_CMN_REFRCV_PREG 0x98 4728081b72SKishon Vijay Abraham I #define SIERRA_CMN_REFRCV1_PREG 0xB8 4828081b72SKishon Vijay Abraham I #define SIERRA_CMN_PLLLC1_GEN_PREG 0xC2 498a1b82d7SSwapnil Jakhade #define SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG 0xCA 508a1b82d7SSwapnil Jakhade #define SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG 0xD0 518a1b82d7SSwapnil Jakhade #define SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG 0xE2 52380f5708SKishon Vijay Abraham I 53380f5708SKishon Vijay Abraham I #define SIERRA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 54380f5708SKishon Vijay Abraham I ((0x4000 << (block_offset)) + \ 55380f5708SKishon Vijay Abraham I (((ln) << 9) << (reg_offset))) 56aead5fd6SKishon Vijay Abraham I 57aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_A_PREG 0x000 58aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_B_PREG 0x001 59aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_C_PREG 0x002 60aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_D_PREG 0x003 61aead5fd6SKishon Vijay Abraham I #define SIERRA_DET_STANDEC_E_PREG 0x004 62871002d7SAnil Varughese #define SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG 0x008 63871002d7SAnil Varughese #define SIERRA_PSM_A0IN_TMR_PREG 0x009 647a5ad9b4SSwapnil Jakhade #define SIERRA_PSM_A3IN_TMR_PREG 0x00C 65aead5fd6SKishon Vijay Abraham I #define SIERRA_PSM_DIAG_PREG 0x015 668a1b82d7SSwapnil Jakhade #define SIERRA_PSC_LN_A3_PREG 0x023 678a1b82d7SSwapnil Jakhade #define SIERRA_PSC_LN_A4_PREG 0x024 688a1b82d7SSwapnil Jakhade #define SIERRA_PSC_LN_IDLE_PREG 0x026 69aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A0_PREG 0x028 70aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A1_PREG 0x029 71aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A2_PREG 0x02A 72aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_TX_A3_PREG 0x02B 73aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A0_PREG 0x030 74aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A1_PREG 0x031 75aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A2_PREG 0x032 76aead5fd6SKishon Vijay Abraham I #define SIERRA_PSC_RX_A3_PREG 0x033 77aead5fd6SKishon Vijay Abraham I #define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A 788a1b82d7SSwapnil Jakhade #define SIERRA_PLLCTRL_GEN_A_PREG 0x03B 79aead5fd6SKishon Vijay Abraham I #define SIERRA_PLLCTRL_GEN_D_PREG 0x03E 80871002d7SAnil Varughese #define SIERRA_PLLCTRL_CPGAIN_MODE_PREG 0x03F 81adc4bd6fSKishon Vijay Abraham I #define SIERRA_PLLCTRL_STATUS_PREG 0x044 82871002d7SAnil Varughese #define SIERRA_CLKPATH_BIASTRIM_PREG 0x04B 83871002d7SAnil Varughese #define SIERRA_DFE_BIASTRIM_PREG 0x04C 84aead5fd6SKishon Vijay Abraham I #define SIERRA_DRVCTRL_ATTEN_PREG 0x06A 857a5ad9b4SSwapnil Jakhade #define SIERRA_DRVCTRL_BOOST_PREG 0x06F 86e72659b6SSwapnil Jakhade #define SIERRA_TX_RCVDET_OVRD_PREG 0x072 87aead5fd6SKishon Vijay Abraham I #define SIERRA_CLKPATHCTRL_TMR_PREG 0x081 88871002d7SAnil Varughese #define SIERRA_RX_CREQ_FLTR_A_MODE3_PREG 0x085 89871002d7SAnil Varughese #define SIERRA_RX_CREQ_FLTR_A_MODE2_PREG 0x086 90aead5fd6SKishon Vijay Abraham I #define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG 0x087 91aead5fd6SKishon Vijay Abraham I #define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG 0x088 927a5ad9b4SSwapnil Jakhade #define SIERRA_CREQ_DCBIASATTEN_OVR_PREG 0x08C 93aead5fd6SKishon Vijay Abraham I #define SIERRA_CREQ_CCLKDET_MODE01_PREG 0x08E 947a5ad9b4SSwapnil Jakhade #define SIERRA_RX_CTLE_CAL_PREG 0x08F 95aead5fd6SKishon Vijay Abraham I #define SIERRA_RX_CTLE_MAINTENANCE_PREG 0x091 96aead5fd6SKishon Vijay Abraham I #define SIERRA_CREQ_FSMCLK_SEL_PREG 0x092 97871002d7SAnil Varughese #define SIERRA_CREQ_EQ_CTRL_PREG 0x093 98871002d7SAnil Varughese #define SIERRA_CREQ_SPARE_PREG 0x096 99871002d7SAnil Varughese #define SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG 0x097 100aead5fd6SKishon Vijay Abraham I #define SIERRA_CTLELUT_CTRL_PREG 0x098 101aead5fd6SKishon Vijay Abraham I #define SIERRA_DFE_ECMP_RATESEL_PREG 0x0C0 102aead5fd6SKishon Vijay Abraham I #define SIERRA_DFE_SMP_RATESEL_PREG 0x0C1 103871002d7SAnil Varughese #define SIERRA_DEQ_PHALIGN_CTRL 0x0C4 104871002d7SAnil Varughese #define SIERRA_DEQ_CONCUR_CTRL1_PREG 0x0C8 105871002d7SAnil Varughese #define SIERRA_DEQ_CONCUR_CTRL2_PREG 0x0C9 106871002d7SAnil Varughese #define SIERRA_DEQ_EPIPWR_CTRL2_PREG 0x0CD 107871002d7SAnil Varughese #define SIERRA_DEQ_FAST_MAINT_CYCLES_PREG 0x0CE 108871002d7SAnil Varughese #define SIERRA_DEQ_ERRCMP_CTRL_PREG 0x0D0 109871002d7SAnil Varughese #define SIERRA_DEQ_OFFSET_CTRL_PREG 0x0D8 110871002d7SAnil Varughese #define SIERRA_DEQ_GAIN_CTRL_PREG 0x0E0 111aead5fd6SKishon Vijay Abraham I #define SIERRA_DEQ_VGATUNE_CTRL_PREG 0x0E1 112871002d7SAnil Varughese #define SIERRA_DEQ_GLUT0 0x0E8 113871002d7SAnil Varughese #define SIERRA_DEQ_GLUT1 0x0E9 114871002d7SAnil Varughese #define SIERRA_DEQ_GLUT2 0x0EA 115871002d7SAnil Varughese #define SIERRA_DEQ_GLUT3 0x0EB 116871002d7SAnil Varughese #define SIERRA_DEQ_GLUT4 0x0EC 117871002d7SAnil Varughese #define SIERRA_DEQ_GLUT5 0x0ED 118871002d7SAnil Varughese #define SIERRA_DEQ_GLUT6 0x0EE 119871002d7SAnil Varughese #define SIERRA_DEQ_GLUT7 0x0EF 120871002d7SAnil Varughese #define SIERRA_DEQ_GLUT8 0x0F0 121871002d7SAnil Varughese #define SIERRA_DEQ_GLUT9 0x0F1 122871002d7SAnil Varughese #define SIERRA_DEQ_GLUT10 0x0F2 123871002d7SAnil Varughese #define SIERRA_DEQ_GLUT11 0x0F3 124871002d7SAnil Varughese #define SIERRA_DEQ_GLUT12 0x0F4 125871002d7SAnil Varughese #define SIERRA_DEQ_GLUT13 0x0F5 126871002d7SAnil Varughese #define SIERRA_DEQ_GLUT14 0x0F6 127871002d7SAnil Varughese #define SIERRA_DEQ_GLUT15 0x0F7 128871002d7SAnil Varughese #define SIERRA_DEQ_GLUT16 0x0F8 129871002d7SAnil Varughese #define SIERRA_DEQ_ALUT0 0x108 130871002d7SAnil Varughese #define SIERRA_DEQ_ALUT1 0x109 131871002d7SAnil Varughese #define SIERRA_DEQ_ALUT2 0x10A 132871002d7SAnil Varughese #define SIERRA_DEQ_ALUT3 0x10B 133871002d7SAnil Varughese #define SIERRA_DEQ_ALUT4 0x10C 134871002d7SAnil Varughese #define SIERRA_DEQ_ALUT5 0x10D 135871002d7SAnil Varughese #define SIERRA_DEQ_ALUT6 0x10E 136871002d7SAnil Varughese #define SIERRA_DEQ_ALUT7 0x10F 137871002d7SAnil Varughese #define SIERRA_DEQ_ALUT8 0x110 138871002d7SAnil Varughese #define SIERRA_DEQ_ALUT9 0x111 139871002d7SAnil Varughese #define SIERRA_DEQ_ALUT10 0x112 140871002d7SAnil Varughese #define SIERRA_DEQ_ALUT11 0x113 141871002d7SAnil Varughese #define SIERRA_DEQ_ALUT12 0x114 142871002d7SAnil Varughese #define SIERRA_DEQ_ALUT13 0x115 143871002d7SAnil Varughese #define SIERRA_DEQ_DFETAP_CTRL_PREG 0x128 1447a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP0 0x129 1457a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP1 0x12B 1467a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP2 0x12D 1477a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP3 0x12F 1487a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_DFETAP4 0x131 149871002d7SAnil Varughese #define SIERRA_DFE_EN_1010_IGNORE_PREG 0x134 1507a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_PRECUR_PREG 0x138 1517a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_POSTCUR_PREG 0x140 1527a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_POSTCUR_DECR_PREG 0x142 153871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150 154871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL2_PREG 0x151 1557a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_TAU_CTRL3_PREG 0x152 1567a5ad9b4SSwapnil Jakhade #define SIERRA_DEQ_OPENEYE_CTRL_PREG 0x158 157871002d7SAnil Varughese #define SIERRA_DEQ_PICTRL_PREG 0x161 158871002d7SAnil Varughese #define SIERRA_CPICAL_TMRVAL_MODE1_PREG 0x170 159871002d7SAnil Varughese #define SIERRA_CPICAL_TMRVAL_MODE0_PREG 0x171 160871002d7SAnil Varughese #define SIERRA_CPICAL_PICNT_MODE1_PREG 0x174 161aead5fd6SKishon Vijay Abraham I #define SIERRA_CPI_OUTBUF_RATESEL_PREG 0x17C 1628a1b82d7SSwapnil Jakhade #define SIERRA_CPI_RESBIAS_BIN_PREG 0x17E 1637a5ad9b4SSwapnil Jakhade #define SIERRA_CPI_TRIM_PREG 0x17F 164871002d7SAnil Varughese #define SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG 0x183 1657a5ad9b4SSwapnil Jakhade #define SIERRA_EPI_CTRL_PREG 0x187 166871002d7SAnil Varughese #define SIERRA_LFPSDET_SUPPORT_PREG 0x188 167aead5fd6SKishon Vijay Abraham I #define SIERRA_LFPSFILT_NS_PREG 0x18A 168aead5fd6SKishon Vijay Abraham I #define SIERRA_LFPSFILT_RD_PREG 0x18B 169aead5fd6SKishon Vijay Abraham I #define SIERRA_LFPSFILT_MP_PREG 0x18C 170871002d7SAnil Varughese #define SIERRA_SIGDET_SUPPORT_PREG 0x190 171aead5fd6SKishon Vijay Abraham I #define SIERRA_SDFILT_H2L_A_PREG 0x191 172871002d7SAnil Varughese #define SIERRA_SDFILT_L2H_PREG 0x193 173871002d7SAnil Varughese #define SIERRA_RXBUFFER_CTLECTRL_PREG 0x19E 174871002d7SAnil Varughese #define SIERRA_RXBUFFER_RCDFECTRL_PREG 0x19F 175871002d7SAnil Varughese #define SIERRA_RXBUFFER_DFECTRL_PREG 0x1A0 176871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG 0x14F 177871002d7SAnil Varughese #define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150 178380f5708SKishon Vijay Abraham I 1798c95e172SSwapnil Jakhade /* PHY PCS common registers */ 1808c95e172SSwapnil Jakhade #define SIERRA_PHY_PCS_COMMON_OFFSET(block_offset) \ 181380f5708SKishon Vijay Abraham I (0xc000 << (block_offset)) 182fa105172SSwapnil Jakhade #define SIERRA_PHY_PIPE_CMN_CTRL1 0x0 183380f5708SKishon Vijay Abraham I #define SIERRA_PHY_PLL_CFG 0xe 18444d30d62SAlan Douglas 18536ce4163SSwapnil Jakhade /* PHY PCS lane registers */ 18636ce4163SSwapnil Jakhade #define SIERRA_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 18736ce4163SSwapnil Jakhade ((0xD000 << (block_offset)) + \ 18836ce4163SSwapnil Jakhade (((ln) << 8) << (reg_offset))) 18936ce4163SSwapnil Jakhade 19036ce4163SSwapnil Jakhade #define SIERRA_PHY_ISO_LINK_CTRL 0xB 19136ce4163SSwapnil Jakhade 192f1cc6c3fSSwapnil Jakhade /* PHY PMA common registers */ 193f1cc6c3fSSwapnil Jakhade #define SIERRA_PHY_PMA_COMMON_OFFSET(block_offset) \ 194f1cc6c3fSSwapnil Jakhade (0xE000 << (block_offset)) 195f1cc6c3fSSwapnil Jakhade #define SIERRA_PHY_PMA_CMN_CTRL 0x000 196f1cc6c3fSSwapnil Jakhade 1976b81f05aSSwapnil Jakhade /* PHY PMA lane registers */ 1986b81f05aSSwapnil Jakhade #define SIERRA_PHY_PMA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 1996b81f05aSSwapnil Jakhade ((0xF000 << (block_offset)) + \ 2006b81f05aSSwapnil Jakhade (((ln) << 8) << (reg_offset))) 2016b81f05aSSwapnil Jakhade 2026b81f05aSSwapnil Jakhade #define SIERRA_PHY_PMA_XCVR_CTRL 0x000 2036b81f05aSSwapnil Jakhade 20444d30d62SAlan Douglas #define SIERRA_MACRO_ID 0x00007364 205a43f72aeSKishon Vijay Abraham I #define SIERRA_MAX_LANES 16 206adc4bd6fSKishon Vijay Abraham I #define PLL_LOCK_TIME 100000 20744d30d62SAlan Douglas 20809d976b3SSwapnil Jakhade #define CDNS_SIERRA_OUTPUT_CLOCKS 3 209*a59f6006SLars-Peter Clausen #define CDNS_SIERRA_INPUT_CLOCKS 3 210a0c30cd7SKishon Vijay Abraham I enum cdns_sierra_clock_input { 211a0c30cd7SKishon Vijay Abraham I PHY_CLK, 212a0c30cd7SKishon Vijay Abraham I CMN_REFCLK_DIG_DIV, 213a0c30cd7SKishon Vijay Abraham I CMN_REFCLK1_DIG_DIV, 214a0c30cd7SKishon Vijay Abraham I }; 215a0c30cd7SKishon Vijay Abraham I 21628081b72SKishon Vijay Abraham I #define SIERRA_NUM_CMN_PLLC 2 21728081b72SKishon Vijay Abraham I #define SIERRA_NUM_CMN_PLLC_PARENTS 2 21828081b72SKishon Vijay Abraham I 219380f5708SKishon Vijay Abraham I static const struct reg_field macro_id_type = 220380f5708SKishon Vijay Abraham I REG_FIELD(SIERRA_MACRO_ID_REG, 0, 15); 221380f5708SKishon Vijay Abraham I static const struct reg_field phy_pll_cfg_1 = 222380f5708SKishon Vijay Abraham I REG_FIELD(SIERRA_PHY_PLL_CFG, 1, 1); 223f1cc6c3fSSwapnil Jakhade static const struct reg_field pma_cmn_ready = 224f1cc6c3fSSwapnil Jakhade REG_FIELD(SIERRA_PHY_PMA_CMN_CTRL, 0, 0); 225adc4bd6fSKishon Vijay Abraham I static const struct reg_field pllctrl_lock = 226adc4bd6fSKishon Vijay Abraham I REG_FIELD(SIERRA_PLLCTRL_STATUS_PREG, 0, 0); 22736ce4163SSwapnil Jakhade static const struct reg_field phy_iso_link_ctrl_1 = 22836ce4163SSwapnil Jakhade REG_FIELD(SIERRA_PHY_ISO_LINK_CTRL, 1, 1); 22909d976b3SSwapnil Jakhade static const struct reg_field cmn_plllc_clk1outdiv_preg = 23009d976b3SSwapnil Jakhade REG_FIELD(SIERRA_CMN_PLLLC_CLK1_PREG, 0, 6); 23109d976b3SSwapnil Jakhade static const struct reg_field cmn_plllc_clk1_en_preg = 23209d976b3SSwapnil Jakhade REG_FIELD(SIERRA_CMN_PLLLC_CLK1_PREG, 12, 12); 233380f5708SKishon Vijay Abraham I 23428081b72SKishon Vijay Abraham I static const char * const clk_names[] = { 23528081b72SKishon Vijay Abraham I [CDNS_SIERRA_PLL_CMNLC] = "pll_cmnlc", 23628081b72SKishon Vijay Abraham I [CDNS_SIERRA_PLL_CMNLC1] = "pll_cmnlc1", 23709d976b3SSwapnil Jakhade [CDNS_SIERRA_DERIVED_REFCLK] = "refclk_der", 23828081b72SKishon Vijay Abraham I }; 23928081b72SKishon Vijay Abraham I 24028081b72SKishon Vijay Abraham I enum cdns_sierra_cmn_plllc { 24128081b72SKishon Vijay Abraham I CMN_PLLLC, 24228081b72SKishon Vijay Abraham I CMN_PLLLC1, 24328081b72SKishon Vijay Abraham I }; 24428081b72SKishon Vijay Abraham I 24528081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux_reg_fields { 24628081b72SKishon Vijay Abraham I struct reg_field pfdclk_sel_preg; 24728081b72SKishon Vijay Abraham I struct reg_field plllc1en_field; 24828081b72SKishon Vijay Abraham I struct reg_field termen_field; 24928081b72SKishon Vijay Abraham I }; 25028081b72SKishon Vijay Abraham I 25128081b72SKishon Vijay Abraham I static const struct cdns_sierra_pll_mux_reg_fields cmn_plllc_pfdclk1_sel_preg[] = { 25228081b72SKishon Vijay Abraham I [CMN_PLLLC] = { 25328081b72SKishon Vijay Abraham I .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC_GEN_PREG, 1, 1), 25428081b72SKishon Vijay Abraham I .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 8, 8), 25528081b72SKishon Vijay Abraham I .termen_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 0, 0), 25628081b72SKishon Vijay Abraham I }, 25728081b72SKishon Vijay Abraham I [CMN_PLLLC1] = { 25828081b72SKishon Vijay Abraham I .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC1_GEN_PREG, 1, 1), 25928081b72SKishon Vijay Abraham I .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 8, 8), 26028081b72SKishon Vijay Abraham I .termen_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 0, 0), 26128081b72SKishon Vijay Abraham I }, 26228081b72SKishon Vijay Abraham I }; 26328081b72SKishon Vijay Abraham I 26428081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux { 26528081b72SKishon Vijay Abraham I struct clk_hw hw; 26628081b72SKishon Vijay Abraham I struct regmap_field *pfdclk_sel_preg; 26728081b72SKishon Vijay Abraham I struct regmap_field *plllc1en_field; 26828081b72SKishon Vijay Abraham I struct regmap_field *termen_field; 26928081b72SKishon Vijay Abraham I struct clk_init_data clk_data; 27028081b72SKishon Vijay Abraham I }; 27128081b72SKishon Vijay Abraham I 27228081b72SKishon Vijay Abraham I #define to_cdns_sierra_pll_mux(_hw) \ 27328081b72SKishon Vijay Abraham I container_of(_hw, struct cdns_sierra_pll_mux, hw) 27428081b72SKishon Vijay Abraham I 275*a59f6006SLars-Peter Clausen #define PLL0_REFCLK_NAME "pll0_refclk" 276*a59f6006SLars-Peter Clausen #define PLL1_REFCLK_NAME "pll1_refclk" 277*a59f6006SLars-Peter Clausen 278*a59f6006SLars-Peter Clausen static const struct clk_parent_data pll_mux_parent_data[][SIERRA_NUM_CMN_PLLC_PARENTS] = { 279*a59f6006SLars-Peter Clausen [CMN_PLLLC] = { 280*a59f6006SLars-Peter Clausen { .fw_name = PLL0_REFCLK_NAME }, 281*a59f6006SLars-Peter Clausen { .fw_name = PLL1_REFCLK_NAME } 282*a59f6006SLars-Peter Clausen }, 283*a59f6006SLars-Peter Clausen [CMN_PLLLC1] = { 284*a59f6006SLars-Peter Clausen { .fw_name = PLL1_REFCLK_NAME }, 285*a59f6006SLars-Peter Clausen { .fw_name = PLL0_REFCLK_NAME } 286*a59f6006SLars-Peter Clausen }, 28728081b72SKishon Vijay Abraham I }; 28828081b72SKishon Vijay Abraham I 289da08aab9SSwapnil Jakhade static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS] = { 290da08aab9SSwapnil Jakhade [CMN_PLLLC] = { 0, 1 }, 291da08aab9SSwapnil Jakhade [CMN_PLLLC1] = { 1, 0 }, 292da08aab9SSwapnil Jakhade }; 29328081b72SKishon Vijay Abraham I 29409d976b3SSwapnil Jakhade struct cdns_sierra_derived_refclk { 29509d976b3SSwapnil Jakhade struct clk_hw hw; 29609d976b3SSwapnil Jakhade struct regmap_field *cmn_plllc_clk1outdiv_preg; 29709d976b3SSwapnil Jakhade struct regmap_field *cmn_plllc_clk1_en_preg; 29809d976b3SSwapnil Jakhade struct clk_init_data clk_data; 29909d976b3SSwapnil Jakhade }; 30009d976b3SSwapnil Jakhade 30109d976b3SSwapnil Jakhade #define to_cdns_sierra_derived_refclk(_hw) \ 30209d976b3SSwapnil Jakhade container_of(_hw, struct cdns_sierra_derived_refclk, hw) 30309d976b3SSwapnil Jakhade 304078e9e92SSwapnil Jakhade enum cdns_sierra_phy_type { 305078e9e92SSwapnil Jakhade TYPE_NONE, 306078e9e92SSwapnil Jakhade TYPE_PCIE, 3078a1b82d7SSwapnil Jakhade TYPE_USB, 3088a1b82d7SSwapnil Jakhade TYPE_QSGMII 309078e9e92SSwapnil Jakhade }; 310078e9e92SSwapnil Jakhade 311078e9e92SSwapnil Jakhade enum cdns_sierra_ssc_mode { 312078e9e92SSwapnil Jakhade NO_SSC, 313078e9e92SSwapnil Jakhade EXTERNAL_SSC, 314078e9e92SSwapnil Jakhade INTERNAL_SSC 315078e9e92SSwapnil Jakhade }; 316078e9e92SSwapnil Jakhade 31744d30d62SAlan Douglas struct cdns_sierra_inst { 31844d30d62SAlan Douglas struct phy *phy; 319078e9e92SSwapnil Jakhade enum cdns_sierra_phy_type phy_type; 32044d30d62SAlan Douglas u32 num_lanes; 32144d30d62SAlan Douglas u32 mlane; 32244d30d62SAlan Douglas struct reset_control *lnk_rst; 3231e902b2aSSwapnil Jakhade enum cdns_sierra_ssc_mode ssc_mode; 32444d30d62SAlan Douglas }; 32544d30d62SAlan Douglas 32644d30d62SAlan Douglas struct cdns_reg_pairs { 32744d30d62SAlan Douglas u16 val; 32844d30d62SAlan Douglas u32 off; 32944d30d62SAlan Douglas }; 33044d30d62SAlan Douglas 331078e9e92SSwapnil Jakhade struct cdns_sierra_vals { 332078e9e92SSwapnil Jakhade const struct cdns_reg_pairs *reg_pairs; 333078e9e92SSwapnil Jakhade u32 num_regs; 334078e9e92SSwapnil Jakhade }; 335078e9e92SSwapnil Jakhade 33644d30d62SAlan Douglas struct cdns_sierra_data { 33744d30d62SAlan Douglas u32 id_value; 338380f5708SKishon Vijay Abraham I u8 block_offset_shift; 339380f5708SKishon Vijay Abraham I u8 reg_offset_shift; 340fa105172SSwapnil Jakhade struct cdns_sierra_vals *pcs_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 341fa105172SSwapnil Jakhade [NUM_SSC_MODE]; 3426b81f05aSSwapnil Jakhade struct cdns_sierra_vals *phy_pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3436b81f05aSSwapnil Jakhade [NUM_SSC_MODE]; 344078e9e92SSwapnil Jakhade struct cdns_sierra_vals *pma_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 345078e9e92SSwapnil Jakhade [NUM_SSC_MODE]; 346078e9e92SSwapnil Jakhade struct cdns_sierra_vals *pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 347078e9e92SSwapnil Jakhade [NUM_SSC_MODE]; 34844d30d62SAlan Douglas }; 34944d30d62SAlan Douglas 350380f5708SKishon Vijay Abraham I struct cdns_regmap_cdb_context { 35144d30d62SAlan Douglas struct device *dev; 35244d30d62SAlan Douglas void __iomem *base; 353380f5708SKishon Vijay Abraham I u8 reg_offset_shift; 354380f5708SKishon Vijay Abraham I }; 355380f5708SKishon Vijay Abraham I 356380f5708SKishon Vijay Abraham I struct cdns_sierra_phy { 357380f5708SKishon Vijay Abraham I struct device *dev; 358c3c11d55SSwapnil Jakhade const struct cdns_sierra_data *init_data; 35944d30d62SAlan Douglas struct cdns_sierra_inst phys[SIERRA_MAX_LANES]; 36044d30d62SAlan Douglas struct reset_control *phy_rst; 36144d30d62SAlan Douglas struct reset_control *apb_rst; 362380f5708SKishon Vijay Abraham I struct regmap *regmap_lane_cdb[SIERRA_MAX_LANES]; 3638c95e172SSwapnil Jakhade struct regmap *regmap_phy_pcs_common_cdb; 36436ce4163SSwapnil Jakhade struct regmap *regmap_phy_pcs_lane_cdb[SIERRA_MAX_LANES]; 365f1cc6c3fSSwapnil Jakhade struct regmap *regmap_phy_pma_common_cdb; 3666b81f05aSSwapnil Jakhade struct regmap *regmap_phy_pma_lane_cdb[SIERRA_MAX_LANES]; 367380f5708SKishon Vijay Abraham I struct regmap *regmap_common_cdb; 368380f5708SKishon Vijay Abraham I struct regmap_field *macro_id_type; 369380f5708SKishon Vijay Abraham I struct regmap_field *phy_pll_cfg_1; 370f1cc6c3fSSwapnil Jakhade struct regmap_field *pma_cmn_ready; 371adc4bd6fSKishon Vijay Abraham I struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES]; 37236ce4163SSwapnil Jakhade struct regmap_field *phy_iso_link_ctrl_1[SIERRA_MAX_LANES]; 37328081b72SKishon Vijay Abraham I struct regmap_field *cmn_refrcv_refclk_plllc1en_preg[SIERRA_NUM_CMN_PLLC]; 37428081b72SKishon Vijay Abraham I struct regmap_field *cmn_refrcv_refclk_termen_preg[SIERRA_NUM_CMN_PLLC]; 37528081b72SKishon Vijay Abraham I struct regmap_field *cmn_plllc_pfdclk1_sel_preg[SIERRA_NUM_CMN_PLLC]; 376a0c30cd7SKishon Vijay Abraham I struct clk *input_clks[CDNS_SIERRA_INPUT_CLOCKS]; 37744d30d62SAlan Douglas int nsubnodes; 378a43f72aeSKishon Vijay Abraham I u32 num_lanes; 37944d30d62SAlan Douglas bool autoconf; 380d88ca22dSAswath Govindraju int already_configured; 3816ef7aa32SLars-Peter Clausen struct clk *pll_clks[SIERRA_NUM_CMN_PLLC]; 3826ef7aa32SLars-Peter Clausen struct clk_hw_onecell_data clk_data; 38344d30d62SAlan Douglas }; 38444d30d62SAlan Douglas 385380f5708SKishon Vijay Abraham I static int cdns_regmap_write(void *context, unsigned int reg, unsigned int val) 386380f5708SKishon Vijay Abraham I { 387380f5708SKishon Vijay Abraham I struct cdns_regmap_cdb_context *ctx = context; 388380f5708SKishon Vijay Abraham I u32 offset = reg << ctx->reg_offset_shift; 389380f5708SKishon Vijay Abraham I 390380f5708SKishon Vijay Abraham I writew(val, ctx->base + offset); 391380f5708SKishon Vijay Abraham I 392380f5708SKishon Vijay Abraham I return 0; 393380f5708SKishon Vijay Abraham I } 394380f5708SKishon Vijay Abraham I 395380f5708SKishon Vijay Abraham I static int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val) 396380f5708SKishon Vijay Abraham I { 397380f5708SKishon Vijay Abraham I struct cdns_regmap_cdb_context *ctx = context; 398380f5708SKishon Vijay Abraham I u32 offset = reg << ctx->reg_offset_shift; 399380f5708SKishon Vijay Abraham I 400380f5708SKishon Vijay Abraham I *val = readw(ctx->base + offset); 401380f5708SKishon Vijay Abraham I return 0; 402380f5708SKishon Vijay Abraham I } 403380f5708SKishon Vijay Abraham I 404380f5708SKishon Vijay Abraham I #define SIERRA_LANE_CDB_REGMAP_CONF(n) \ 405380f5708SKishon Vijay Abraham I { \ 406380f5708SKishon Vijay Abraham I .name = "sierra_lane" n "_cdb", \ 407380f5708SKishon Vijay Abraham I .reg_stride = 1, \ 408380f5708SKishon Vijay Abraham I .fast_io = true, \ 409380f5708SKishon Vijay Abraham I .reg_write = cdns_regmap_write, \ 410380f5708SKishon Vijay Abraham I .reg_read = cdns_regmap_read, \ 411380f5708SKishon Vijay Abraham I } 412380f5708SKishon Vijay Abraham I 4133cfb0e8eSRikard Falkeborn static const struct regmap_config cdns_sierra_lane_cdb_config[] = { 414380f5708SKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("0"), 415380f5708SKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("1"), 416380f5708SKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("2"), 417380f5708SKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("3"), 418a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("4"), 419a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("5"), 420a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("6"), 421a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("7"), 422a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("8"), 423a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("9"), 424a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("10"), 425a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("11"), 426a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("12"), 427a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("13"), 428a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("14"), 429a43f72aeSKishon Vijay Abraham I SIERRA_LANE_CDB_REGMAP_CONF("15"), 430380f5708SKishon Vijay Abraham I }; 431380f5708SKishon Vijay Abraham I 4323cfb0e8eSRikard Falkeborn static const struct regmap_config cdns_sierra_common_cdb_config = { 433380f5708SKishon Vijay Abraham I .name = "sierra_common_cdb", 434380f5708SKishon Vijay Abraham I .reg_stride = 1, 435380f5708SKishon Vijay Abraham I .fast_io = true, 436380f5708SKishon Vijay Abraham I .reg_write = cdns_regmap_write, 437380f5708SKishon Vijay Abraham I .reg_read = cdns_regmap_read, 438380f5708SKishon Vijay Abraham I }; 439380f5708SKishon Vijay Abraham I 4408c95e172SSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pcs_cmn_cdb_config = { 4418c95e172SSwapnil Jakhade .name = "sierra_phy_pcs_cmn_cdb", 442380f5708SKishon Vijay Abraham I .reg_stride = 1, 443380f5708SKishon Vijay Abraham I .fast_io = true, 444380f5708SKishon Vijay Abraham I .reg_write = cdns_regmap_write, 445380f5708SKishon Vijay Abraham I .reg_read = cdns_regmap_read, 446380f5708SKishon Vijay Abraham I }; 447380f5708SKishon Vijay Abraham I 44836ce4163SSwapnil Jakhade #define SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \ 44936ce4163SSwapnil Jakhade { \ 45036ce4163SSwapnil Jakhade .name = "sierra_phy_pcs_lane" n "_cdb", \ 45136ce4163SSwapnil Jakhade .reg_stride = 1, \ 45236ce4163SSwapnil Jakhade .fast_io = true, \ 45336ce4163SSwapnil Jakhade .reg_write = cdns_regmap_write, \ 45436ce4163SSwapnil Jakhade .reg_read = cdns_regmap_read, \ 45536ce4163SSwapnil Jakhade } 45636ce4163SSwapnil Jakhade 45736ce4163SSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pcs_lane_cdb_config[] = { 45836ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("0"), 45936ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("1"), 46036ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("2"), 46136ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("3"), 46236ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("4"), 46336ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("5"), 46436ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("6"), 46536ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("7"), 46636ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("8"), 46736ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("9"), 46836ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("10"), 46936ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("11"), 47036ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("12"), 47136ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("13"), 47236ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("14"), 47336ce4163SSwapnil Jakhade SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("15"), 47436ce4163SSwapnil Jakhade }; 47536ce4163SSwapnil Jakhade 476f1cc6c3fSSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pma_cmn_cdb_config = { 477f1cc6c3fSSwapnil Jakhade .name = "sierra_phy_pma_cmn_cdb", 478f1cc6c3fSSwapnil Jakhade .reg_stride = 1, 479f1cc6c3fSSwapnil Jakhade .fast_io = true, 480f1cc6c3fSSwapnil Jakhade .reg_write = cdns_regmap_write, 481f1cc6c3fSSwapnil Jakhade .reg_read = cdns_regmap_read, 482f1cc6c3fSSwapnil Jakhade }; 483f1cc6c3fSSwapnil Jakhade 4846b81f05aSSwapnil Jakhade #define SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF(n) \ 4856b81f05aSSwapnil Jakhade { \ 4866b81f05aSSwapnil Jakhade .name = "sierra_phy_pma_lane" n "_cdb", \ 4876b81f05aSSwapnil Jakhade .reg_stride = 1, \ 4886b81f05aSSwapnil Jakhade .fast_io = true, \ 4896b81f05aSSwapnil Jakhade .reg_write = cdns_regmap_write, \ 4906b81f05aSSwapnil Jakhade .reg_read = cdns_regmap_read, \ 4916b81f05aSSwapnil Jakhade } 4926b81f05aSSwapnil Jakhade 4936b81f05aSSwapnil Jakhade static const struct regmap_config cdns_sierra_phy_pma_lane_cdb_config[] = { 4946b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("0"), 4956b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("1"), 4966b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("2"), 4976b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("3"), 4986b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("4"), 4996b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("5"), 5006b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("6"), 5016b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("7"), 5026b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("8"), 5036b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("9"), 5046b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("10"), 5056b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("11"), 5066b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("12"), 5076b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("13"), 5086b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("14"), 5096b81f05aSSwapnil Jakhade SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("15"), 5106b81f05aSSwapnil Jakhade }; 5116b81f05aSSwapnil Jakhade 512cedcc2e2SKishon Vijay Abraham I static int cdns_sierra_phy_init(struct phy *gphy) 51344d30d62SAlan Douglas { 51444d30d62SAlan Douglas struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); 51544d30d62SAlan Douglas struct cdns_sierra_phy *phy = dev_get_drvdata(gphy->dev.parent); 516078e9e92SSwapnil Jakhade const struct cdns_sierra_data *init_data = phy->init_data; 517078e9e92SSwapnil Jakhade struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals; 518078e9e92SSwapnil Jakhade enum cdns_sierra_phy_type phy_type = ins->phy_type; 5191e902b2aSSwapnil Jakhade enum cdns_sierra_ssc_mode ssc = ins->ssc_mode; 5206b81f05aSSwapnil Jakhade struct cdns_sierra_vals *phy_pma_ln_vals; 521078e9e92SSwapnil Jakhade const struct cdns_reg_pairs *reg_pairs; 522fa105172SSwapnil Jakhade struct cdns_sierra_vals *pcs_cmn_vals; 52380f96fb1SColin Ian King struct regmap *regmap; 524078e9e92SSwapnil Jakhade u32 num_regs; 52544d30d62SAlan Douglas int i, j; 52644d30d62SAlan Douglas 527cedcc2e2SKishon Vijay Abraham I /* Initialise the PHY registers, unless auto configured */ 528d88ca22dSAswath Govindraju if (phy->autoconf || phy->already_configured || phy->nsubnodes > 1) 529cedcc2e2SKishon Vijay Abraham I return 0; 530cedcc2e2SKishon Vijay Abraham I 531a0c30cd7SKishon Vijay Abraham I clk_set_rate(phy->input_clks[CMN_REFCLK_DIG_DIV], 25000000); 532a0c30cd7SKishon Vijay Abraham I clk_set_rate(phy->input_clks[CMN_REFCLK1_DIG_DIV], 25000000); 533078e9e92SSwapnil Jakhade 534fa105172SSwapnil Jakhade /* PHY PCS common registers configurations */ 535fa105172SSwapnil Jakhade pcs_cmn_vals = init_data->pcs_cmn_vals[phy_type][TYPE_NONE][ssc]; 536fa105172SSwapnil Jakhade if (pcs_cmn_vals) { 537fa105172SSwapnil Jakhade reg_pairs = pcs_cmn_vals->reg_pairs; 538fa105172SSwapnil Jakhade num_regs = pcs_cmn_vals->num_regs; 539fa105172SSwapnil Jakhade regmap = phy->regmap_phy_pcs_common_cdb; 540fa105172SSwapnil Jakhade for (i = 0; i < num_regs; i++) 541fa105172SSwapnil Jakhade regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 542fa105172SSwapnil Jakhade } 543fa105172SSwapnil Jakhade 5446b81f05aSSwapnil Jakhade /* PHY PMA lane registers configurations */ 5456b81f05aSSwapnil Jakhade phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_type][TYPE_NONE][ssc]; 5466b81f05aSSwapnil Jakhade if (phy_pma_ln_vals) { 5476b81f05aSSwapnil Jakhade reg_pairs = phy_pma_ln_vals->reg_pairs; 5486b81f05aSSwapnil Jakhade num_regs = phy_pma_ln_vals->num_regs; 5496b81f05aSSwapnil Jakhade for (i = 0; i < ins->num_lanes; i++) { 5506b81f05aSSwapnil Jakhade regmap = phy->regmap_phy_pma_lane_cdb[i + ins->mlane]; 5516b81f05aSSwapnil Jakhade for (j = 0; j < num_regs; j++) 5526b81f05aSSwapnil Jakhade regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 5536b81f05aSSwapnil Jakhade } 5546b81f05aSSwapnil Jakhade } 5556b81f05aSSwapnil Jakhade 556078e9e92SSwapnil Jakhade /* PMA common registers configurations */ 557078e9e92SSwapnil Jakhade pma_cmn_vals = init_data->pma_cmn_vals[phy_type][TYPE_NONE][ssc]; 558078e9e92SSwapnil Jakhade if (pma_cmn_vals) { 559078e9e92SSwapnil Jakhade reg_pairs = pma_cmn_vals->reg_pairs; 560078e9e92SSwapnil Jakhade num_regs = pma_cmn_vals->num_regs; 561078e9e92SSwapnil Jakhade regmap = phy->regmap_common_cdb; 562078e9e92SSwapnil Jakhade for (i = 0; i < num_regs; i++) 563078e9e92SSwapnil Jakhade regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 56444d30d62SAlan Douglas } 565871002d7SAnil Varughese 566078e9e92SSwapnil Jakhade /* PMA lane registers configurations */ 567078e9e92SSwapnil Jakhade pma_ln_vals = init_data->pma_ln_vals[phy_type][TYPE_NONE][ssc]; 568078e9e92SSwapnil Jakhade if (pma_ln_vals) { 569078e9e92SSwapnil Jakhade reg_pairs = pma_ln_vals->reg_pairs; 570078e9e92SSwapnil Jakhade num_regs = pma_ln_vals->num_regs; 571380f5708SKishon Vijay Abraham I for (i = 0; i < ins->num_lanes; i++) { 572380f5708SKishon Vijay Abraham I regmap = phy->regmap_lane_cdb[i + ins->mlane]; 573078e9e92SSwapnil Jakhade for (j = 0; j < num_regs; j++) 574078e9e92SSwapnil Jakhade regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 575380f5708SKishon Vijay Abraham I } 576380f5708SKishon Vijay Abraham I } 577cedcc2e2SKishon Vijay Abraham I 578cedcc2e2SKishon Vijay Abraham I return 0; 57944d30d62SAlan Douglas } 58044d30d62SAlan Douglas 58144d30d62SAlan Douglas static int cdns_sierra_phy_on(struct phy *gphy) 58244d30d62SAlan Douglas { 583adc4bd6fSKishon Vijay Abraham I struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent); 58444d30d62SAlan Douglas struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); 585adc4bd6fSKishon Vijay Abraham I struct device *dev = sp->dev; 586adc4bd6fSKishon Vijay Abraham I u32 val; 587adc4bd6fSKishon Vijay Abraham I int ret; 58844d30d62SAlan Douglas 5896b81f05aSSwapnil Jakhade if (sp->nsubnodes == 1) { 5906b81f05aSSwapnil Jakhade /* Take the PHY out of reset */ 5915b4f5757SKishon Vijay Abraham I ret = reset_control_deassert(sp->phy_rst); 5925b4f5757SKishon Vijay Abraham I if (ret) { 5935b4f5757SKishon Vijay Abraham I dev_err(dev, "Failed to take the PHY out of reset\n"); 5945b4f5757SKishon Vijay Abraham I return ret; 5955b4f5757SKishon Vijay Abraham I } 5966b81f05aSSwapnil Jakhade } 5975b4f5757SKishon Vijay Abraham I 59844d30d62SAlan Douglas /* Take the PHY lane group out of reset */ 599adc4bd6fSKishon Vijay Abraham I ret = reset_control_deassert(ins->lnk_rst); 600adc4bd6fSKishon Vijay Abraham I if (ret) { 601adc4bd6fSKishon Vijay Abraham I dev_err(dev, "Failed to take the PHY lane out of reset\n"); 602adc4bd6fSKishon Vijay Abraham I return ret; 603adc4bd6fSKishon Vijay Abraham I } 604adc4bd6fSKishon Vijay Abraham I 60536ce4163SSwapnil Jakhade if (ins->phy_type == TYPE_PCIE || ins->phy_type == TYPE_USB) { 60636ce4163SSwapnil Jakhade ret = regmap_field_read_poll_timeout(sp->phy_iso_link_ctrl_1[ins->mlane], 60736ce4163SSwapnil Jakhade val, !val, 1000, PLL_LOCK_TIME); 60836ce4163SSwapnil Jakhade if (ret) { 60936ce4163SSwapnil Jakhade dev_err(dev, "Timeout waiting for PHY status ready\n"); 61036ce4163SSwapnil Jakhade return ret; 61136ce4163SSwapnil Jakhade } 61236ce4163SSwapnil Jakhade } 61336ce4163SSwapnil Jakhade 614f1cc6c3fSSwapnil Jakhade /* 615f1cc6c3fSSwapnil Jakhade * Wait for cmn_ready assertion 616f1cc6c3fSSwapnil Jakhade * PHY_PMA_CMN_CTRL[0] == 1 617f1cc6c3fSSwapnil Jakhade */ 618f1cc6c3fSSwapnil Jakhade ret = regmap_field_read_poll_timeout(sp->pma_cmn_ready, val, val, 619f1cc6c3fSSwapnil Jakhade 1000, PLL_LOCK_TIME); 620f1cc6c3fSSwapnil Jakhade if (ret) { 621f1cc6c3fSSwapnil Jakhade dev_err(dev, "Timeout waiting for CMN ready\n"); 622f1cc6c3fSSwapnil Jakhade return ret; 623f1cc6c3fSSwapnil Jakhade } 624f1cc6c3fSSwapnil Jakhade 625adc4bd6fSKishon Vijay Abraham I ret = regmap_field_read_poll_timeout(sp->pllctrl_lock[ins->mlane], 626adc4bd6fSKishon Vijay Abraham I val, val, 1000, PLL_LOCK_TIME); 627adc4bd6fSKishon Vijay Abraham I if (ret < 0) 628adc4bd6fSKishon Vijay Abraham I dev_err(dev, "PLL lock of lane failed\n"); 629adc4bd6fSKishon Vijay Abraham I 630adc4bd6fSKishon Vijay Abraham I return ret; 63144d30d62SAlan Douglas } 63244d30d62SAlan Douglas 63344d30d62SAlan Douglas static int cdns_sierra_phy_off(struct phy *gphy) 63444d30d62SAlan Douglas { 63544d30d62SAlan Douglas struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); 63644d30d62SAlan Douglas 63744d30d62SAlan Douglas return reset_control_assert(ins->lnk_rst); 63844d30d62SAlan Douglas } 63944d30d62SAlan Douglas 6407904e15bSRoger Quadros static int cdns_sierra_phy_reset(struct phy *gphy) 6417904e15bSRoger Quadros { 6427904e15bSRoger Quadros struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent); 6437904e15bSRoger Quadros 6447904e15bSRoger Quadros reset_control_assert(sp->phy_rst); 6457904e15bSRoger Quadros reset_control_deassert(sp->phy_rst); 6467904e15bSRoger Quadros return 0; 6477904e15bSRoger Quadros }; 6487904e15bSRoger Quadros 64944d30d62SAlan Douglas static const struct phy_ops ops = { 650cedcc2e2SKishon Vijay Abraham I .init = cdns_sierra_phy_init, 65144d30d62SAlan Douglas .power_on = cdns_sierra_phy_on, 65244d30d62SAlan Douglas .power_off = cdns_sierra_phy_off, 6537904e15bSRoger Quadros .reset = cdns_sierra_phy_reset, 65444d30d62SAlan Douglas .owner = THIS_MODULE, 65544d30d62SAlan Douglas }; 65644d30d62SAlan Douglas 657d88ca22dSAswath Govindraju static int cdns_sierra_noop_phy_on(struct phy *gphy) 658d88ca22dSAswath Govindraju { 659d88ca22dSAswath Govindraju usleep_range(5000, 10000); 660d88ca22dSAswath Govindraju 661d88ca22dSAswath Govindraju return 0; 662d88ca22dSAswath Govindraju } 663d88ca22dSAswath Govindraju 664d88ca22dSAswath Govindraju static const struct phy_ops noop_ops = { 665d88ca22dSAswath Govindraju .power_on = cdns_sierra_noop_phy_on, 666d88ca22dSAswath Govindraju .owner = THIS_MODULE, 667d88ca22dSAswath Govindraju }; 668d88ca22dSAswath Govindraju 66928081b72SKishon Vijay Abraham I static u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw) 67028081b72SKishon Vijay Abraham I { 67128081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); 672da08aab9SSwapnil Jakhade struct regmap_field *plllc1en_field = mux->plllc1en_field; 673da08aab9SSwapnil Jakhade struct regmap_field *termen_field = mux->termen_field; 67428081b72SKishon Vijay Abraham I struct regmap_field *field = mux->pfdclk_sel_preg; 67528081b72SKishon Vijay Abraham I unsigned int val; 676da08aab9SSwapnil Jakhade int index; 67728081b72SKishon Vijay Abraham I 67828081b72SKishon Vijay Abraham I regmap_field_read(field, &val); 679da08aab9SSwapnil Jakhade 680da08aab9SSwapnil Jakhade if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) { 681da08aab9SSwapnil Jakhade index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC1], 0, val); 682da08aab9SSwapnil Jakhade if (index == 1) { 683da08aab9SSwapnil Jakhade regmap_field_write(plllc1en_field, 1); 684da08aab9SSwapnil Jakhade regmap_field_write(termen_field, 1); 685da08aab9SSwapnil Jakhade } 686da08aab9SSwapnil Jakhade } else { 687da08aab9SSwapnil Jakhade index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC], 0, val); 688da08aab9SSwapnil Jakhade } 689da08aab9SSwapnil Jakhade 690da08aab9SSwapnil Jakhade return index; 69128081b72SKishon Vijay Abraham I } 69228081b72SKishon Vijay Abraham I 69328081b72SKishon Vijay Abraham I static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) 69428081b72SKishon Vijay Abraham I { 69528081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); 69628081b72SKishon Vijay Abraham I struct regmap_field *plllc1en_field = mux->plllc1en_field; 69728081b72SKishon Vijay Abraham I struct regmap_field *termen_field = mux->termen_field; 69828081b72SKishon Vijay Abraham I struct regmap_field *field = mux->pfdclk_sel_preg; 69928081b72SKishon Vijay Abraham I int val, ret; 70028081b72SKishon Vijay Abraham I 70128081b72SKishon Vijay Abraham I ret = regmap_field_write(plllc1en_field, 0); 70228081b72SKishon Vijay Abraham I ret |= regmap_field_write(termen_field, 0); 70328081b72SKishon Vijay Abraham I if (index == 1) { 70428081b72SKishon Vijay Abraham I ret |= regmap_field_write(plllc1en_field, 1); 70528081b72SKishon Vijay Abraham I ret |= regmap_field_write(termen_field, 1); 70628081b72SKishon Vijay Abraham I } 70728081b72SKishon Vijay Abraham I 708da08aab9SSwapnil Jakhade if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) 709da08aab9SSwapnil Jakhade val = cdns_sierra_pll_mux_table[CMN_PLLLC1][index]; 710da08aab9SSwapnil Jakhade else 711da08aab9SSwapnil Jakhade val = cdns_sierra_pll_mux_table[CMN_PLLLC][index]; 712da08aab9SSwapnil Jakhade 71328081b72SKishon Vijay Abraham I ret |= regmap_field_write(field, val); 71428081b72SKishon Vijay Abraham I 71528081b72SKishon Vijay Abraham I return ret; 71628081b72SKishon Vijay Abraham I } 71728081b72SKishon Vijay Abraham I 71828081b72SKishon Vijay Abraham I static const struct clk_ops cdns_sierra_pll_mux_ops = { 71928081b72SKishon Vijay Abraham I .set_parent = cdns_sierra_pll_mux_set_parent, 72028081b72SKishon Vijay Abraham I .get_parent = cdns_sierra_pll_mux_get_parent, 72128081b72SKishon Vijay Abraham I }; 72228081b72SKishon Vijay Abraham I 72328081b72SKishon Vijay Abraham I static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp, 72428081b72SKishon Vijay Abraham I struct regmap_field *pfdclk1_sel_field, 72528081b72SKishon Vijay Abraham I struct regmap_field *plllc1en_field, 72628081b72SKishon Vijay Abraham I struct regmap_field *termen_field, 72728081b72SKishon Vijay Abraham I int clk_index) 72828081b72SKishon Vijay Abraham I { 72928081b72SKishon Vijay Abraham I struct cdns_sierra_pll_mux *mux; 73028081b72SKishon Vijay Abraham I struct device *dev = sp->dev; 73128081b72SKishon Vijay Abraham I struct clk_init_data *init; 73228081b72SKishon Vijay Abraham I char clk_name[100]; 7336ef7aa32SLars-Peter Clausen int ret; 73428081b72SKishon Vijay Abraham I 73528081b72SKishon Vijay Abraham I mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); 73628081b72SKishon Vijay Abraham I if (!mux) 73728081b72SKishon Vijay Abraham I return -ENOMEM; 73828081b72SKishon Vijay Abraham I 73928081b72SKishon Vijay Abraham I snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), clk_names[clk_index]); 74028081b72SKishon Vijay Abraham I 74128081b72SKishon Vijay Abraham I init = &mux->clk_data; 74228081b72SKishon Vijay Abraham I 74328081b72SKishon Vijay Abraham I init->ops = &cdns_sierra_pll_mux_ops; 74428081b72SKishon Vijay Abraham I init->flags = CLK_SET_RATE_NO_REPARENT; 745*a59f6006SLars-Peter Clausen init->parent_data = pll_mux_parent_data[clk_index]; 746*a59f6006SLars-Peter Clausen init->num_parents = SIERRA_NUM_CMN_PLLC_PARENTS; 74728081b72SKishon Vijay Abraham I init->name = clk_name; 74828081b72SKishon Vijay Abraham I 74928081b72SKishon Vijay Abraham I mux->pfdclk_sel_preg = pfdclk1_sel_field; 75028081b72SKishon Vijay Abraham I mux->plllc1en_field = plllc1en_field; 75128081b72SKishon Vijay Abraham I mux->termen_field = termen_field; 75228081b72SKishon Vijay Abraham I mux->hw.init = init; 75328081b72SKishon Vijay Abraham I 7546ef7aa32SLars-Peter Clausen ret = devm_clk_hw_register(dev, &mux->hw); 7556ef7aa32SLars-Peter Clausen if (ret) 7566ef7aa32SLars-Peter Clausen return ret; 75728081b72SKishon Vijay Abraham I 7586ef7aa32SLars-Peter Clausen sp->clk_data.hws[clk_index] = &mux->hw; 7596ef7aa32SLars-Peter Clausen 7606ef7aa32SLars-Peter Clausen sp->pll_clks[clk_index] = devm_clk_hw_get_clk(dev, &mux->hw, 7616ef7aa32SLars-Peter Clausen clk_names[clk_index]); 76228081b72SKishon Vijay Abraham I 76328081b72SKishon Vijay Abraham I return 0; 76428081b72SKishon Vijay Abraham I } 76528081b72SKishon Vijay Abraham I 76628081b72SKishon Vijay Abraham I static int cdns_sierra_phy_register_pll_mux(struct cdns_sierra_phy *sp) 76728081b72SKishon Vijay Abraham I { 76828081b72SKishon Vijay Abraham I struct regmap_field *pfdclk1_sel_field; 76928081b72SKishon Vijay Abraham I struct regmap_field *plllc1en_field; 77028081b72SKishon Vijay Abraham I struct regmap_field *termen_field; 77128081b72SKishon Vijay Abraham I struct device *dev = sp->dev; 77228081b72SKishon Vijay Abraham I int ret = 0, i, clk_index; 77328081b72SKishon Vijay Abraham I 77428081b72SKishon Vijay Abraham I clk_index = CDNS_SIERRA_PLL_CMNLC; 77528081b72SKishon Vijay Abraham I for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++, clk_index++) { 77628081b72SKishon Vijay Abraham I pfdclk1_sel_field = sp->cmn_plllc_pfdclk1_sel_preg[i]; 77728081b72SKishon Vijay Abraham I plllc1en_field = sp->cmn_refrcv_refclk_plllc1en_preg[i]; 77828081b72SKishon Vijay Abraham I termen_field = sp->cmn_refrcv_refclk_termen_preg[i]; 77928081b72SKishon Vijay Abraham I 78028081b72SKishon Vijay Abraham I ret = cdns_sierra_pll_mux_register(sp, pfdclk1_sel_field, plllc1en_field, 78128081b72SKishon Vijay Abraham I termen_field, clk_index); 78228081b72SKishon Vijay Abraham I if (ret) { 78328081b72SKishon Vijay Abraham I dev_err(dev, "Fail to register cmn plllc mux\n"); 78428081b72SKishon Vijay Abraham I return ret; 78528081b72SKishon Vijay Abraham I } 78628081b72SKishon Vijay Abraham I } 78728081b72SKishon Vijay Abraham I 78828081b72SKishon Vijay Abraham I return 0; 78928081b72SKishon Vijay Abraham I } 79028081b72SKishon Vijay Abraham I 79109d976b3SSwapnil Jakhade static int cdns_sierra_derived_refclk_enable(struct clk_hw *hw) 79209d976b3SSwapnil Jakhade { 79309d976b3SSwapnil Jakhade struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw); 79409d976b3SSwapnil Jakhade 79509d976b3SSwapnil Jakhade regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0x1); 79609d976b3SSwapnil Jakhade 79709d976b3SSwapnil Jakhade /* Programming to get 100Mhz clock output in ref_der_clk_out 5GHz VCO/50 = 100MHz */ 79809d976b3SSwapnil Jakhade regmap_field_write(derived_refclk->cmn_plllc_clk1outdiv_preg, 0x2E); 79909d976b3SSwapnil Jakhade 80009d976b3SSwapnil Jakhade return 0; 80109d976b3SSwapnil Jakhade } 80209d976b3SSwapnil Jakhade 80309d976b3SSwapnil Jakhade static void cdns_sierra_derived_refclk_disable(struct clk_hw *hw) 80409d976b3SSwapnil Jakhade { 80509d976b3SSwapnil Jakhade struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw); 80609d976b3SSwapnil Jakhade 80709d976b3SSwapnil Jakhade regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0); 80809d976b3SSwapnil Jakhade } 80909d976b3SSwapnil Jakhade 81009d976b3SSwapnil Jakhade static int cdns_sierra_derived_refclk_is_enabled(struct clk_hw *hw) 81109d976b3SSwapnil Jakhade { 81209d976b3SSwapnil Jakhade struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw); 81309d976b3SSwapnil Jakhade int val; 81409d976b3SSwapnil Jakhade 81509d976b3SSwapnil Jakhade regmap_field_read(derived_refclk->cmn_plllc_clk1_en_preg, &val); 81609d976b3SSwapnil Jakhade 81709d976b3SSwapnil Jakhade return !!val; 81809d976b3SSwapnil Jakhade } 81909d976b3SSwapnil Jakhade 82009d976b3SSwapnil Jakhade static const struct clk_ops cdns_sierra_derived_refclk_ops = { 82109d976b3SSwapnil Jakhade .enable = cdns_sierra_derived_refclk_enable, 82209d976b3SSwapnil Jakhade .disable = cdns_sierra_derived_refclk_disable, 82309d976b3SSwapnil Jakhade .is_enabled = cdns_sierra_derived_refclk_is_enabled, 82409d976b3SSwapnil Jakhade }; 82509d976b3SSwapnil Jakhade 82609d976b3SSwapnil Jakhade static int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp) 82709d976b3SSwapnil Jakhade { 82809d976b3SSwapnil Jakhade struct cdns_sierra_derived_refclk *derived_refclk; 82909d976b3SSwapnil Jakhade struct device *dev = sp->dev; 83009d976b3SSwapnil Jakhade struct regmap_field *field; 83109d976b3SSwapnil Jakhade struct clk_init_data *init; 83209d976b3SSwapnil Jakhade struct regmap *regmap; 83309d976b3SSwapnil Jakhade char clk_name[100]; 8346ef7aa32SLars-Peter Clausen int ret; 83509d976b3SSwapnil Jakhade 83609d976b3SSwapnil Jakhade derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); 83709d976b3SSwapnil Jakhade if (!derived_refclk) 83809d976b3SSwapnil Jakhade return -ENOMEM; 83909d976b3SSwapnil Jakhade 84009d976b3SSwapnil Jakhade snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), 84109d976b3SSwapnil Jakhade clk_names[CDNS_SIERRA_DERIVED_REFCLK]); 84209d976b3SSwapnil Jakhade 84309d976b3SSwapnil Jakhade init = &derived_refclk->clk_data; 84409d976b3SSwapnil Jakhade 84509d976b3SSwapnil Jakhade init->ops = &cdns_sierra_derived_refclk_ops; 84609d976b3SSwapnil Jakhade init->flags = 0; 84709d976b3SSwapnil Jakhade init->name = clk_name; 84809d976b3SSwapnil Jakhade 84909d976b3SSwapnil Jakhade regmap = sp->regmap_common_cdb; 85009d976b3SSwapnil Jakhade 85109d976b3SSwapnil Jakhade field = devm_regmap_field_alloc(dev, regmap, cmn_plllc_clk1outdiv_preg); 85209d976b3SSwapnil Jakhade if (IS_ERR(field)) { 85309d976b3SSwapnil Jakhade dev_err(dev, "cmn_plllc_clk1outdiv_preg reg field init failed\n"); 85409d976b3SSwapnil Jakhade return PTR_ERR(field); 85509d976b3SSwapnil Jakhade } 85609d976b3SSwapnil Jakhade derived_refclk->cmn_plllc_clk1outdiv_preg = field; 85709d976b3SSwapnil Jakhade 85809d976b3SSwapnil Jakhade field = devm_regmap_field_alloc(dev, regmap, cmn_plllc_clk1_en_preg); 85909d976b3SSwapnil Jakhade if (IS_ERR(field)) { 86009d976b3SSwapnil Jakhade dev_err(dev, "cmn_plllc_clk1_en_preg reg field init failed\n"); 86109d976b3SSwapnil Jakhade return PTR_ERR(field); 86209d976b3SSwapnil Jakhade } 86309d976b3SSwapnil Jakhade derived_refclk->cmn_plllc_clk1_en_preg = field; 86409d976b3SSwapnil Jakhade 86509d976b3SSwapnil Jakhade derived_refclk->hw.init = init; 86609d976b3SSwapnil Jakhade 8676ef7aa32SLars-Peter Clausen ret = devm_clk_hw_register(dev, &derived_refclk->hw); 8686ef7aa32SLars-Peter Clausen if (ret) 8696ef7aa32SLars-Peter Clausen return ret; 87009d976b3SSwapnil Jakhade 8716ef7aa32SLars-Peter Clausen sp->clk_data.hws[CDNS_SIERRA_DERIVED_REFCLK] = &derived_refclk->hw; 87209d976b3SSwapnil Jakhade 87309d976b3SSwapnil Jakhade return 0; 87409d976b3SSwapnil Jakhade } 87509d976b3SSwapnil Jakhade 87628081b72SKishon Vijay Abraham I static void cdns_sierra_clk_unregister(struct cdns_sierra_phy *sp) 87728081b72SKishon Vijay Abraham I { 87828081b72SKishon Vijay Abraham I struct device *dev = sp->dev; 87928081b72SKishon Vijay Abraham I struct device_node *node = dev->of_node; 88028081b72SKishon Vijay Abraham I 88128081b72SKishon Vijay Abraham I of_clk_del_provider(node); 88228081b72SKishon Vijay Abraham I } 88328081b72SKishon Vijay Abraham I 88428081b72SKishon Vijay Abraham I static int cdns_sierra_clk_register(struct cdns_sierra_phy *sp) 88528081b72SKishon Vijay Abraham I { 88628081b72SKishon Vijay Abraham I struct device *dev = sp->dev; 88728081b72SKishon Vijay Abraham I struct device_node *node = dev->of_node; 88828081b72SKishon Vijay Abraham I int ret; 88928081b72SKishon Vijay Abraham I 89028081b72SKishon Vijay Abraham I ret = cdns_sierra_phy_register_pll_mux(sp); 89128081b72SKishon Vijay Abraham I if (ret) { 89228081b72SKishon Vijay Abraham I dev_err(dev, "Failed to pll mux clocks\n"); 89328081b72SKishon Vijay Abraham I return ret; 89428081b72SKishon Vijay Abraham I } 89528081b72SKishon Vijay Abraham I 89609d976b3SSwapnil Jakhade ret = cdns_sierra_derived_refclk_register(sp); 89709d976b3SSwapnil Jakhade if (ret) { 89809d976b3SSwapnil Jakhade dev_err(dev, "Failed to register derived refclk\n"); 89909d976b3SSwapnil Jakhade return ret; 90009d976b3SSwapnil Jakhade } 90109d976b3SSwapnil Jakhade 9026ef7aa32SLars-Peter Clausen sp->clk_data.num = CDNS_SIERRA_OUTPUT_CLOCKS; 9036ef7aa32SLars-Peter Clausen ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, 9046ef7aa32SLars-Peter Clausen &sp->clk_data); 90528081b72SKishon Vijay Abraham I if (ret) 90628081b72SKishon Vijay Abraham I dev_err(dev, "Failed to add clock provider: %s\n", node->name); 90728081b72SKishon Vijay Abraham I 90828081b72SKishon Vijay Abraham I return ret; 90928081b72SKishon Vijay Abraham I } 91028081b72SKishon Vijay Abraham I 91144d30d62SAlan Douglas static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst, 91244d30d62SAlan Douglas struct device_node *child) 91344d30d62SAlan Douglas { 914078e9e92SSwapnil Jakhade u32 phy_type; 915078e9e92SSwapnil Jakhade 91644d30d62SAlan Douglas if (of_property_read_u32(child, "reg", &inst->mlane)) 91744d30d62SAlan Douglas return -EINVAL; 91844d30d62SAlan Douglas 91944d30d62SAlan Douglas if (of_property_read_u32(child, "cdns,num-lanes", &inst->num_lanes)) 92044d30d62SAlan Douglas return -EINVAL; 92144d30d62SAlan Douglas 922078e9e92SSwapnil Jakhade if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) 92344d30d62SAlan Douglas return -EINVAL; 92444d30d62SAlan Douglas 925078e9e92SSwapnil Jakhade switch (phy_type) { 926078e9e92SSwapnil Jakhade case PHY_TYPE_PCIE: 927078e9e92SSwapnil Jakhade inst->phy_type = TYPE_PCIE; 928078e9e92SSwapnil Jakhade break; 929078e9e92SSwapnil Jakhade case PHY_TYPE_USB3: 930078e9e92SSwapnil Jakhade inst->phy_type = TYPE_USB; 931078e9e92SSwapnil Jakhade break; 9328a1b82d7SSwapnil Jakhade case PHY_TYPE_QSGMII: 9338a1b82d7SSwapnil Jakhade inst->phy_type = TYPE_QSGMII; 9348a1b82d7SSwapnil Jakhade break; 935078e9e92SSwapnil Jakhade default: 936078e9e92SSwapnil Jakhade return -EINVAL; 937078e9e92SSwapnil Jakhade } 938078e9e92SSwapnil Jakhade 9391e902b2aSSwapnil Jakhade inst->ssc_mode = EXTERNAL_SSC; 9401e902b2aSSwapnil Jakhade of_property_read_u32(child, "cdns,ssc-mode", &inst->ssc_mode); 9411e902b2aSSwapnil Jakhade 94244d30d62SAlan Douglas return 0; 94344d30d62SAlan Douglas } 94444d30d62SAlan Douglas 945380f5708SKishon Vijay Abraham I static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, 946380f5708SKishon Vijay Abraham I u32 block_offset, u8 reg_offset_shift, 947380f5708SKishon Vijay Abraham I const struct regmap_config *config) 948380f5708SKishon Vijay Abraham I { 949380f5708SKishon Vijay Abraham I struct cdns_regmap_cdb_context *ctx; 950380f5708SKishon Vijay Abraham I 951380f5708SKishon Vijay Abraham I ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 952380f5708SKishon Vijay Abraham I if (!ctx) 953380f5708SKishon Vijay Abraham I return ERR_PTR(-ENOMEM); 954380f5708SKishon Vijay Abraham I 955380f5708SKishon Vijay Abraham I ctx->dev = dev; 956380f5708SKishon Vijay Abraham I ctx->base = base + block_offset; 957380f5708SKishon Vijay Abraham I ctx->reg_offset_shift = reg_offset_shift; 958380f5708SKishon Vijay Abraham I 959380f5708SKishon Vijay Abraham I return devm_regmap_init(dev, NULL, ctx, config); 960380f5708SKishon Vijay Abraham I } 961380f5708SKishon Vijay Abraham I 962380f5708SKishon Vijay Abraham I static int cdns_regfield_init(struct cdns_sierra_phy *sp) 963380f5708SKishon Vijay Abraham I { 964380f5708SKishon Vijay Abraham I struct device *dev = sp->dev; 965380f5708SKishon Vijay Abraham I struct regmap_field *field; 96628081b72SKishon Vijay Abraham I struct reg_field reg_field; 967380f5708SKishon Vijay Abraham I struct regmap *regmap; 968adc4bd6fSKishon Vijay Abraham I int i; 969380f5708SKishon Vijay Abraham I 970380f5708SKishon Vijay Abraham I regmap = sp->regmap_common_cdb; 971380f5708SKishon Vijay Abraham I field = devm_regmap_field_alloc(dev, regmap, macro_id_type); 972380f5708SKishon Vijay Abraham I if (IS_ERR(field)) { 973380f5708SKishon Vijay Abraham I dev_err(dev, "MACRO_ID_TYPE reg field init failed\n"); 974380f5708SKishon Vijay Abraham I return PTR_ERR(field); 975380f5708SKishon Vijay Abraham I } 976380f5708SKishon Vijay Abraham I sp->macro_id_type = field; 977380f5708SKishon Vijay Abraham I 97828081b72SKishon Vijay Abraham I for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++) { 97928081b72SKishon Vijay Abraham I reg_field = cmn_plllc_pfdclk1_sel_preg[i].pfdclk_sel_preg; 98028081b72SKishon Vijay Abraham I field = devm_regmap_field_alloc(dev, regmap, reg_field); 98128081b72SKishon Vijay Abraham I if (IS_ERR(field)) { 98228081b72SKishon Vijay Abraham I dev_err(dev, "PLLLC%d_PFDCLK1_SEL failed\n", i); 98328081b72SKishon Vijay Abraham I return PTR_ERR(field); 98428081b72SKishon Vijay Abraham I } 98528081b72SKishon Vijay Abraham I sp->cmn_plllc_pfdclk1_sel_preg[i] = field; 98628081b72SKishon Vijay Abraham I 98728081b72SKishon Vijay Abraham I reg_field = cmn_plllc_pfdclk1_sel_preg[i].plllc1en_field; 98828081b72SKishon Vijay Abraham I field = devm_regmap_field_alloc(dev, regmap, reg_field); 98928081b72SKishon Vijay Abraham I if (IS_ERR(field)) { 99028081b72SKishon Vijay Abraham I dev_err(dev, "REFRCV%d_REFCLK_PLLLC1EN failed\n", i); 99128081b72SKishon Vijay Abraham I return PTR_ERR(field); 99228081b72SKishon Vijay Abraham I } 99328081b72SKishon Vijay Abraham I sp->cmn_refrcv_refclk_plllc1en_preg[i] = field; 99428081b72SKishon Vijay Abraham I 99528081b72SKishon Vijay Abraham I reg_field = cmn_plllc_pfdclk1_sel_preg[i].termen_field; 99628081b72SKishon Vijay Abraham I field = devm_regmap_field_alloc(dev, regmap, reg_field); 99728081b72SKishon Vijay Abraham I if (IS_ERR(field)) { 99828081b72SKishon Vijay Abraham I dev_err(dev, "REFRCV%d_REFCLK_TERMEN failed\n", i); 99928081b72SKishon Vijay Abraham I return PTR_ERR(field); 100028081b72SKishon Vijay Abraham I } 100128081b72SKishon Vijay Abraham I sp->cmn_refrcv_refclk_termen_preg[i] = field; 100228081b72SKishon Vijay Abraham I } 100328081b72SKishon Vijay Abraham I 10048c95e172SSwapnil Jakhade regmap = sp->regmap_phy_pcs_common_cdb; 1005380f5708SKishon Vijay Abraham I field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg_1); 1006380f5708SKishon Vijay Abraham I if (IS_ERR(field)) { 1007380f5708SKishon Vijay Abraham I dev_err(dev, "PHY_PLL_CFG_1 reg field init failed\n"); 1008380f5708SKishon Vijay Abraham I return PTR_ERR(field); 1009380f5708SKishon Vijay Abraham I } 1010380f5708SKishon Vijay Abraham I sp->phy_pll_cfg_1 = field; 1011380f5708SKishon Vijay Abraham I 1012f1cc6c3fSSwapnil Jakhade regmap = sp->regmap_phy_pma_common_cdb; 1013f1cc6c3fSSwapnil Jakhade field = devm_regmap_field_alloc(dev, regmap, pma_cmn_ready); 1014f1cc6c3fSSwapnil Jakhade if (IS_ERR(field)) { 1015f1cc6c3fSSwapnil Jakhade dev_err(dev, "PHY_PMA_CMN_CTRL reg field init failed\n"); 1016f1cc6c3fSSwapnil Jakhade return PTR_ERR(field); 1017f1cc6c3fSSwapnil Jakhade } 1018f1cc6c3fSSwapnil Jakhade sp->pma_cmn_ready = field; 1019f1cc6c3fSSwapnil Jakhade 1020adc4bd6fSKishon Vijay Abraham I for (i = 0; i < SIERRA_MAX_LANES; i++) { 1021adc4bd6fSKishon Vijay Abraham I regmap = sp->regmap_lane_cdb[i]; 1022adc4bd6fSKishon Vijay Abraham I field = devm_regmap_field_alloc(dev, regmap, pllctrl_lock); 1023adc4bd6fSKishon Vijay Abraham I if (IS_ERR(field)) { 1024adc4bd6fSKishon Vijay Abraham I dev_err(dev, "P%d_ENABLE reg field init failed\n", i); 1025adc4bd6fSKishon Vijay Abraham I return PTR_ERR(field); 1026adc4bd6fSKishon Vijay Abraham I } 1027adc4bd6fSKishon Vijay Abraham I sp->pllctrl_lock[i] = field; 1028adc4bd6fSKishon Vijay Abraham I } 1029adc4bd6fSKishon Vijay Abraham I 103036ce4163SSwapnil Jakhade for (i = 0; i < SIERRA_MAX_LANES; i++) { 103136ce4163SSwapnil Jakhade regmap = sp->regmap_phy_pcs_lane_cdb[i]; 103236ce4163SSwapnil Jakhade field = devm_regmap_field_alloc(dev, regmap, phy_iso_link_ctrl_1); 103336ce4163SSwapnil Jakhade if (IS_ERR(field)) { 103436ce4163SSwapnil Jakhade dev_err(dev, "PHY_ISO_LINK_CTRL reg field init for lane %d failed\n", i); 103536ce4163SSwapnil Jakhade return PTR_ERR(field); 103636ce4163SSwapnil Jakhade } 103736ce4163SSwapnil Jakhade sp->phy_iso_link_ctrl_1[i] = field; 103836ce4163SSwapnil Jakhade } 103936ce4163SSwapnil Jakhade 1040380f5708SKishon Vijay Abraham I return 0; 1041380f5708SKishon Vijay Abraham I } 1042380f5708SKishon Vijay Abraham I 1043380f5708SKishon Vijay Abraham I static int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp, 1044380f5708SKishon Vijay Abraham I void __iomem *base, u8 block_offset_shift, 1045380f5708SKishon Vijay Abraham I u8 reg_offset_shift) 1046380f5708SKishon Vijay Abraham I { 1047380f5708SKishon Vijay Abraham I struct device *dev = sp->dev; 1048380f5708SKishon Vijay Abraham I struct regmap *regmap; 1049380f5708SKishon Vijay Abraham I u32 block_offset; 1050380f5708SKishon Vijay Abraham I int i; 1051380f5708SKishon Vijay Abraham I 1052380f5708SKishon Vijay Abraham I for (i = 0; i < SIERRA_MAX_LANES; i++) { 1053380f5708SKishon Vijay Abraham I block_offset = SIERRA_LANE_CDB_OFFSET(i, block_offset_shift, 1054380f5708SKishon Vijay Abraham I reg_offset_shift); 1055380f5708SKishon Vijay Abraham I regmap = cdns_regmap_init(dev, base, block_offset, 1056380f5708SKishon Vijay Abraham I reg_offset_shift, 1057380f5708SKishon Vijay Abraham I &cdns_sierra_lane_cdb_config[i]); 1058380f5708SKishon Vijay Abraham I if (IS_ERR(regmap)) { 1059380f5708SKishon Vijay Abraham I dev_err(dev, "Failed to init lane CDB regmap\n"); 1060380f5708SKishon Vijay Abraham I return PTR_ERR(regmap); 1061380f5708SKishon Vijay Abraham I } 1062380f5708SKishon Vijay Abraham I sp->regmap_lane_cdb[i] = regmap; 1063380f5708SKishon Vijay Abraham I } 1064380f5708SKishon Vijay Abraham I 1065380f5708SKishon Vijay Abraham I regmap = cdns_regmap_init(dev, base, SIERRA_COMMON_CDB_OFFSET, 1066380f5708SKishon Vijay Abraham I reg_offset_shift, 1067380f5708SKishon Vijay Abraham I &cdns_sierra_common_cdb_config); 1068380f5708SKishon Vijay Abraham I if (IS_ERR(regmap)) { 1069380f5708SKishon Vijay Abraham I dev_err(dev, "Failed to init common CDB regmap\n"); 1070380f5708SKishon Vijay Abraham I return PTR_ERR(regmap); 1071380f5708SKishon Vijay Abraham I } 1072380f5708SKishon Vijay Abraham I sp->regmap_common_cdb = regmap; 1073380f5708SKishon Vijay Abraham I 10748c95e172SSwapnil Jakhade block_offset = SIERRA_PHY_PCS_COMMON_OFFSET(block_offset_shift); 1075380f5708SKishon Vijay Abraham I regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift, 10768c95e172SSwapnil Jakhade &cdns_sierra_phy_pcs_cmn_cdb_config); 1077380f5708SKishon Vijay Abraham I if (IS_ERR(regmap)) { 10788c95e172SSwapnil Jakhade dev_err(dev, "Failed to init PHY PCS common CDB regmap\n"); 1079380f5708SKishon Vijay Abraham I return PTR_ERR(regmap); 1080380f5708SKishon Vijay Abraham I } 10818c95e172SSwapnil Jakhade sp->regmap_phy_pcs_common_cdb = regmap; 1082380f5708SKishon Vijay Abraham I 108336ce4163SSwapnil Jakhade for (i = 0; i < SIERRA_MAX_LANES; i++) { 108436ce4163SSwapnil Jakhade block_offset = SIERRA_PHY_PCS_LANE_CDB_OFFSET(i, block_offset_shift, 108536ce4163SSwapnil Jakhade reg_offset_shift); 108636ce4163SSwapnil Jakhade regmap = cdns_regmap_init(dev, base, block_offset, 108736ce4163SSwapnil Jakhade reg_offset_shift, 108836ce4163SSwapnil Jakhade &cdns_sierra_phy_pcs_lane_cdb_config[i]); 108936ce4163SSwapnil Jakhade if (IS_ERR(regmap)) { 109036ce4163SSwapnil Jakhade dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n"); 109136ce4163SSwapnil Jakhade return PTR_ERR(regmap); 109236ce4163SSwapnil Jakhade } 109336ce4163SSwapnil Jakhade sp->regmap_phy_pcs_lane_cdb[i] = regmap; 109436ce4163SSwapnil Jakhade } 109536ce4163SSwapnil Jakhade 1096f1cc6c3fSSwapnil Jakhade block_offset = SIERRA_PHY_PMA_COMMON_OFFSET(block_offset_shift); 1097f1cc6c3fSSwapnil Jakhade regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift, 1098f1cc6c3fSSwapnil Jakhade &cdns_sierra_phy_pma_cmn_cdb_config); 1099f1cc6c3fSSwapnil Jakhade if (IS_ERR(regmap)) { 1100f1cc6c3fSSwapnil Jakhade dev_err(dev, "Failed to init PHY PMA common CDB regmap\n"); 1101f1cc6c3fSSwapnil Jakhade return PTR_ERR(regmap); 1102f1cc6c3fSSwapnil Jakhade } 1103f1cc6c3fSSwapnil Jakhade sp->regmap_phy_pma_common_cdb = regmap; 1104f1cc6c3fSSwapnil Jakhade 11056b81f05aSSwapnil Jakhade for (i = 0; i < SIERRA_MAX_LANES; i++) { 11066b81f05aSSwapnil Jakhade block_offset = SIERRA_PHY_PMA_LANE_CDB_OFFSET(i, block_offset_shift, 11076b81f05aSSwapnil Jakhade reg_offset_shift); 11086b81f05aSSwapnil Jakhade regmap = cdns_regmap_init(dev, base, block_offset, 11096b81f05aSSwapnil Jakhade reg_offset_shift, 11106b81f05aSSwapnil Jakhade &cdns_sierra_phy_pma_lane_cdb_config[i]); 11116b81f05aSSwapnil Jakhade if (IS_ERR(regmap)) { 11126b81f05aSSwapnil Jakhade dev_err(dev, "Failed to init PHY PMA lane CDB regmap\n"); 11136b81f05aSSwapnil Jakhade return PTR_ERR(regmap); 11146b81f05aSSwapnil Jakhade } 11156b81f05aSSwapnil Jakhade sp->regmap_phy_pma_lane_cdb[i] = regmap; 11166b81f05aSSwapnil Jakhade } 11176b81f05aSSwapnil Jakhade 1118380f5708SKishon Vijay Abraham I return 0; 1119380f5708SKishon Vijay Abraham I } 1120380f5708SKishon Vijay Abraham I 11217e016cbcSKishon Vijay Abraham I static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, 11227e016cbcSKishon Vijay Abraham I struct device *dev) 11237e016cbcSKishon Vijay Abraham I { 11247e016cbcSKishon Vijay Abraham I struct clk *clk; 11257e016cbcSKishon Vijay Abraham I int ret; 11267e016cbcSKishon Vijay Abraham I 11277e016cbcSKishon Vijay Abraham I clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); 11287e016cbcSKishon Vijay Abraham I if (IS_ERR(clk)) { 11297e016cbcSKishon Vijay Abraham I dev_err(dev, "cmn_refclk_dig_div clock not found\n"); 11307e016cbcSKishon Vijay Abraham I ret = PTR_ERR(clk); 11317e016cbcSKishon Vijay Abraham I return ret; 11327e016cbcSKishon Vijay Abraham I } 1133a0c30cd7SKishon Vijay Abraham I sp->input_clks[CMN_REFCLK_DIG_DIV] = clk; 11347e016cbcSKishon Vijay Abraham I 11357e016cbcSKishon Vijay Abraham I clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); 11367e016cbcSKishon Vijay Abraham I if (IS_ERR(clk)) { 11377e016cbcSKishon Vijay Abraham I dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); 11387e016cbcSKishon Vijay Abraham I ret = PTR_ERR(clk); 11397e016cbcSKishon Vijay Abraham I return ret; 11407e016cbcSKishon Vijay Abraham I } 1141a0c30cd7SKishon Vijay Abraham I sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk; 11427e016cbcSKishon Vijay Abraham I 11437e016cbcSKishon Vijay Abraham I return 0; 11447e016cbcSKishon Vijay Abraham I } 11457e016cbcSKishon Vijay Abraham I 1146d88ca22dSAswath Govindraju static int cdns_sierra_phy_clk(struct cdns_sierra_phy *sp) 11471436ec30SKishon Vijay Abraham I { 1148d88ca22dSAswath Govindraju struct device *dev = sp->dev; 1149d88ca22dSAswath Govindraju struct clk *clk; 11501436ec30SKishon Vijay Abraham I int ret; 11511436ec30SKishon Vijay Abraham I 1152d88ca22dSAswath Govindraju clk = devm_clk_get_optional(dev, "phy_clk"); 1153d88ca22dSAswath Govindraju if (IS_ERR(clk)) { 1154d88ca22dSAswath Govindraju dev_err(dev, "failed to get clock phy_clk\n"); 1155d88ca22dSAswath Govindraju return PTR_ERR(clk); 1156d88ca22dSAswath Govindraju } 1157d88ca22dSAswath Govindraju sp->input_clks[PHY_CLK] = clk; 1158d88ca22dSAswath Govindraju 11591436ec30SKishon Vijay Abraham I ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); 11601436ec30SKishon Vijay Abraham I if (ret) 11611436ec30SKishon Vijay Abraham I return ret; 11621436ec30SKishon Vijay Abraham I 1163d88ca22dSAswath Govindraju return 0; 1164d88ca22dSAswath Govindraju } 1165d88ca22dSAswath Govindraju 1166d88ca22dSAswath Govindraju static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp) 1167d88ca22dSAswath Govindraju { 1168d88ca22dSAswath Govindraju int ret; 1169d88ca22dSAswath Govindraju 11706ef7aa32SLars-Peter Clausen ret = clk_prepare_enable(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]); 11711436ec30SKishon Vijay Abraham I if (ret) 1172d88ca22dSAswath Govindraju return ret; 11731436ec30SKishon Vijay Abraham I 11746ef7aa32SLars-Peter Clausen ret = clk_prepare_enable(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC1]); 11751436ec30SKishon Vijay Abraham I if (ret) 11761436ec30SKishon Vijay Abraham I goto err_pll_cmnlc1; 11771436ec30SKishon Vijay Abraham I 11781436ec30SKishon Vijay Abraham I return 0; 11791436ec30SKishon Vijay Abraham I 11801436ec30SKishon Vijay Abraham I err_pll_cmnlc1: 11816ef7aa32SLars-Peter Clausen clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]); 11821436ec30SKishon Vijay Abraham I 11831436ec30SKishon Vijay Abraham I return ret; 11841436ec30SKishon Vijay Abraham I } 11851436ec30SKishon Vijay Abraham I 11861436ec30SKishon Vijay Abraham I static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp) 11871436ec30SKishon Vijay Abraham I { 11886ef7aa32SLars-Peter Clausen clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC1]); 11896ef7aa32SLars-Peter Clausen clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]); 1190d88ca22dSAswath Govindraju if (!sp->already_configured) 11911436ec30SKishon Vijay Abraham I clk_disable_unprepare(sp->input_clks[PHY_CLK]); 11921436ec30SKishon Vijay Abraham I } 11931436ec30SKishon Vijay Abraham I 11941d5f40e0SKishon Vijay Abraham I static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, 11951d5f40e0SKishon Vijay Abraham I struct device *dev) 11961d5f40e0SKishon Vijay Abraham I { 11971d5f40e0SKishon Vijay Abraham I struct reset_control *rst; 11981d5f40e0SKishon Vijay Abraham I 119915b0b82dSKishon Vijay Abraham I rst = devm_reset_control_get_exclusive(dev, "sierra_reset"); 12001d5f40e0SKishon Vijay Abraham I if (IS_ERR(rst)) { 12011d5f40e0SKishon Vijay Abraham I dev_err(dev, "failed to get reset\n"); 12021d5f40e0SKishon Vijay Abraham I return PTR_ERR(rst); 12031d5f40e0SKishon Vijay Abraham I } 12041d5f40e0SKishon Vijay Abraham I sp->phy_rst = rst; 12051d5f40e0SKishon Vijay Abraham I 120615b0b82dSKishon Vijay Abraham I rst = devm_reset_control_get_optional_exclusive(dev, "sierra_apb"); 12071d5f40e0SKishon Vijay Abraham I if (IS_ERR(rst)) { 12081d5f40e0SKishon Vijay Abraham I dev_err(dev, "failed to get apb reset\n"); 12091d5f40e0SKishon Vijay Abraham I return PTR_ERR(rst); 12101d5f40e0SKishon Vijay Abraham I } 12111d5f40e0SKishon Vijay Abraham I sp->apb_rst = rst; 12121d5f40e0SKishon Vijay Abraham I 12131d5f40e0SKishon Vijay Abraham I return 0; 12141d5f40e0SKishon Vijay Abraham I } 12151d5f40e0SKishon Vijay Abraham I 12166b81f05aSSwapnil Jakhade static int cdns_sierra_phy_configure_multilink(struct cdns_sierra_phy *sp) 12176b81f05aSSwapnil Jakhade { 12186b81f05aSSwapnil Jakhade const struct cdns_sierra_data *init_data = sp->init_data; 12196b81f05aSSwapnil Jakhade struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals; 12206b81f05aSSwapnil Jakhade enum cdns_sierra_phy_type phy_t1, phy_t2; 12216b81f05aSSwapnil Jakhade struct cdns_sierra_vals *phy_pma_ln_vals; 12226b81f05aSSwapnil Jakhade const struct cdns_reg_pairs *reg_pairs; 12236b81f05aSSwapnil Jakhade struct cdns_sierra_vals *pcs_cmn_vals; 12246b81f05aSSwapnil Jakhade int i, j, node, mlane, num_lanes, ret; 12256b81f05aSSwapnil Jakhade enum cdns_sierra_ssc_mode ssc; 12266b81f05aSSwapnil Jakhade struct regmap *regmap; 12276b81f05aSSwapnil Jakhade u32 num_regs; 12286b81f05aSSwapnil Jakhade 12296b81f05aSSwapnil Jakhade /* Maximum 2 links (subnodes) are supported */ 12306b81f05aSSwapnil Jakhade if (sp->nsubnodes != 2) 12316b81f05aSSwapnil Jakhade return -EINVAL; 12326b81f05aSSwapnil Jakhade 12336b81f05aSSwapnil Jakhade clk_set_rate(sp->input_clks[CMN_REFCLK_DIG_DIV], 25000000); 12346b81f05aSSwapnil Jakhade clk_set_rate(sp->input_clks[CMN_REFCLK1_DIG_DIV], 25000000); 12356b81f05aSSwapnil Jakhade 12366b81f05aSSwapnil Jakhade /* PHY configured to use both PLL LC and LC1 */ 12376b81f05aSSwapnil Jakhade regmap_field_write(sp->phy_pll_cfg_1, 0x1); 12386b81f05aSSwapnil Jakhade 12396b81f05aSSwapnil Jakhade phy_t1 = sp->phys[0].phy_type; 12406b81f05aSSwapnil Jakhade phy_t2 = sp->phys[1].phy_type; 12416b81f05aSSwapnil Jakhade 12426b81f05aSSwapnil Jakhade /* 12436b81f05aSSwapnil Jakhade * PHY configuration for multi-link operation is done in two steps. 12446b81f05aSSwapnil Jakhade * e.g. Consider a case for a 4 lane PHY with PCIe using 2 lanes and QSGMII other 2 lanes. 12456b81f05aSSwapnil Jakhade * Sierra PHY has 2 PLLs, viz. PLLLC and PLLLC1. So in this case, PLLLC is used for PCIe 12466b81f05aSSwapnil Jakhade * and PLLLC1 is used for QSGMII. PHY is configured in two steps as described below. 12476b81f05aSSwapnil Jakhade * 12486b81f05aSSwapnil Jakhade * [1] For first step, phy_t1 = TYPE_PCIE and phy_t2 = TYPE_QSGMII 12496b81f05aSSwapnil Jakhade * So the register values are selected as [TYPE_PCIE][TYPE_QSGMII][ssc]. 12506b81f05aSSwapnil Jakhade * This will configure PHY registers associated for PCIe (i.e. first protocol) 12516b81f05aSSwapnil Jakhade * involving PLLLC registers and registers for first 2 lanes of PHY. 12526b81f05aSSwapnil Jakhade * [2] In second step, the variables phy_t1 and phy_t2 are swapped. So now, 12536b81f05aSSwapnil Jakhade * phy_t1 = TYPE_QSGMII and phy_t2 = TYPE_PCIE. And the register values are selected as 12546b81f05aSSwapnil Jakhade * [TYPE_QSGMII][TYPE_PCIE][ssc]. 12556b81f05aSSwapnil Jakhade * This will configure PHY registers associated for QSGMII (i.e. second protocol) 12566b81f05aSSwapnil Jakhade * involving PLLLC1 registers and registers for other 2 lanes of PHY. 12576b81f05aSSwapnil Jakhade * 12586b81f05aSSwapnil Jakhade * This completes the PHY configuration for multilink operation. This approach enables 12596b81f05aSSwapnil Jakhade * dividing the large number of PHY register configurations into protocol specific 12606b81f05aSSwapnil Jakhade * smaller groups. 12616b81f05aSSwapnil Jakhade */ 12626b81f05aSSwapnil Jakhade for (node = 0; node < sp->nsubnodes; node++) { 12636b81f05aSSwapnil Jakhade if (node == 1) { 12646b81f05aSSwapnil Jakhade /* 12656b81f05aSSwapnil Jakhade * If first link with phy_t1 is configured, then configure the PHY for 12666b81f05aSSwapnil Jakhade * second link with phy_t2. Get the array values as [phy_t2][phy_t1][ssc]. 12676b81f05aSSwapnil Jakhade */ 12686b81f05aSSwapnil Jakhade swap(phy_t1, phy_t2); 12696b81f05aSSwapnil Jakhade } 12706b81f05aSSwapnil Jakhade 12716b81f05aSSwapnil Jakhade mlane = sp->phys[node].mlane; 12726b81f05aSSwapnil Jakhade ssc = sp->phys[node].ssc_mode; 12736b81f05aSSwapnil Jakhade num_lanes = sp->phys[node].num_lanes; 12746b81f05aSSwapnil Jakhade 12756b81f05aSSwapnil Jakhade /* PHY PCS common registers configurations */ 12766b81f05aSSwapnil Jakhade pcs_cmn_vals = init_data->pcs_cmn_vals[phy_t1][phy_t2][ssc]; 12776b81f05aSSwapnil Jakhade if (pcs_cmn_vals) { 12786b81f05aSSwapnil Jakhade reg_pairs = pcs_cmn_vals->reg_pairs; 12796b81f05aSSwapnil Jakhade num_regs = pcs_cmn_vals->num_regs; 12806b81f05aSSwapnil Jakhade regmap = sp->regmap_phy_pcs_common_cdb; 12816b81f05aSSwapnil Jakhade for (i = 0; i < num_regs; i++) 12826b81f05aSSwapnil Jakhade regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 12836b81f05aSSwapnil Jakhade } 12846b81f05aSSwapnil Jakhade 12856b81f05aSSwapnil Jakhade /* PHY PMA lane registers configurations */ 12866b81f05aSSwapnil Jakhade phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_t1][phy_t2][ssc]; 12876b81f05aSSwapnil Jakhade if (phy_pma_ln_vals) { 12886b81f05aSSwapnil Jakhade reg_pairs = phy_pma_ln_vals->reg_pairs; 12896b81f05aSSwapnil Jakhade num_regs = phy_pma_ln_vals->num_regs; 12906b81f05aSSwapnil Jakhade for (i = 0; i < num_lanes; i++) { 12916b81f05aSSwapnil Jakhade regmap = sp->regmap_phy_pma_lane_cdb[i + mlane]; 12926b81f05aSSwapnil Jakhade for (j = 0; j < num_regs; j++) 12936b81f05aSSwapnil Jakhade regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 12946b81f05aSSwapnil Jakhade } 12956b81f05aSSwapnil Jakhade } 12966b81f05aSSwapnil Jakhade 12976b81f05aSSwapnil Jakhade /* PMA common registers configurations */ 12986b81f05aSSwapnil Jakhade pma_cmn_vals = init_data->pma_cmn_vals[phy_t1][phy_t2][ssc]; 12996b81f05aSSwapnil Jakhade if (pma_cmn_vals) { 13006b81f05aSSwapnil Jakhade reg_pairs = pma_cmn_vals->reg_pairs; 13016b81f05aSSwapnil Jakhade num_regs = pma_cmn_vals->num_regs; 13026b81f05aSSwapnil Jakhade regmap = sp->regmap_common_cdb; 13036b81f05aSSwapnil Jakhade for (i = 0; i < num_regs; i++) 13046b81f05aSSwapnil Jakhade regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 13056b81f05aSSwapnil Jakhade } 13066b81f05aSSwapnil Jakhade 13076b81f05aSSwapnil Jakhade /* PMA lane registers configurations */ 13086b81f05aSSwapnil Jakhade pma_ln_vals = init_data->pma_ln_vals[phy_t1][phy_t2][ssc]; 13096b81f05aSSwapnil Jakhade if (pma_ln_vals) { 13106b81f05aSSwapnil Jakhade reg_pairs = pma_ln_vals->reg_pairs; 13116b81f05aSSwapnil Jakhade num_regs = pma_ln_vals->num_regs; 13126b81f05aSSwapnil Jakhade for (i = 0; i < num_lanes; i++) { 13136b81f05aSSwapnil Jakhade regmap = sp->regmap_lane_cdb[i + mlane]; 13146b81f05aSSwapnil Jakhade for (j = 0; j < num_regs; j++) 13156b81f05aSSwapnil Jakhade regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 13166b81f05aSSwapnil Jakhade } 13176b81f05aSSwapnil Jakhade } 13188a1b82d7SSwapnil Jakhade 13198a1b82d7SSwapnil Jakhade if (phy_t1 == TYPE_QSGMII) 13208a1b82d7SSwapnil Jakhade reset_control_deassert(sp->phys[node].lnk_rst); 13216b81f05aSSwapnil Jakhade } 13226b81f05aSSwapnil Jakhade 13236b81f05aSSwapnil Jakhade /* Take the PHY out of reset */ 13246b81f05aSSwapnil Jakhade ret = reset_control_deassert(sp->phy_rst); 13256b81f05aSSwapnil Jakhade if (ret) 13266b81f05aSSwapnil Jakhade return ret; 13276b81f05aSSwapnil Jakhade 13286b81f05aSSwapnil Jakhade return 0; 13296b81f05aSSwapnil Jakhade } 13306b81f05aSSwapnil Jakhade 133144d30d62SAlan Douglas static int cdns_sierra_phy_probe(struct platform_device *pdev) 133244d30d62SAlan Douglas { 133344d30d62SAlan Douglas struct cdns_sierra_phy *sp; 133444d30d62SAlan Douglas struct phy_provider *phy_provider; 133544d30d62SAlan Douglas struct device *dev = &pdev->dev; 1336c3c11d55SSwapnil Jakhade const struct cdns_sierra_data *data; 1337380f5708SKishon Vijay Abraham I unsigned int id_value; 133829afbd76SDan Carpenter int ret, node = 0; 1339380f5708SKishon Vijay Abraham I void __iomem *base; 134044d30d62SAlan Douglas struct device_node *dn = dev->of_node, *child; 134144d30d62SAlan Douglas 134244d30d62SAlan Douglas if (of_get_child_count(dn) == 0) 134344d30d62SAlan Douglas return -ENODEV; 134444d30d62SAlan Douglas 1345380f5708SKishon Vijay Abraham I /* Get init data for this PHY */ 1346c3c11d55SSwapnil Jakhade data = of_device_get_match_data(dev); 1347c3c11d55SSwapnil Jakhade if (!data) 1348380f5708SKishon Vijay Abraham I return -EINVAL; 1349380f5708SKishon Vijay Abraham I 13506ef7aa32SLars-Peter Clausen sp = devm_kzalloc(dev, struct_size(sp, clk_data.hws, 13516ef7aa32SLars-Peter Clausen CDNS_SIERRA_OUTPUT_CLOCKS), 13526ef7aa32SLars-Peter Clausen GFP_KERNEL); 135344d30d62SAlan Douglas if (!sp) 135444d30d62SAlan Douglas return -ENOMEM; 135544d30d62SAlan Douglas dev_set_drvdata(dev, sp); 135644d30d62SAlan Douglas sp->dev = dev; 1357380f5708SKishon Vijay Abraham I sp->init_data = data; 135844d30d62SAlan Douglas 1359fa629094SChunfeng Yun base = devm_platform_ioremap_resource(pdev, 0); 1360380f5708SKishon Vijay Abraham I if (IS_ERR(base)) { 136144d30d62SAlan Douglas dev_err(dev, "missing \"reg\"\n"); 1362380f5708SKishon Vijay Abraham I return PTR_ERR(base); 136344d30d62SAlan Douglas } 136444d30d62SAlan Douglas 1365380f5708SKishon Vijay Abraham I ret = cdns_regmap_init_blocks(sp, base, data->block_offset_shift, 1366380f5708SKishon Vijay Abraham I data->reg_offset_shift); 1367380f5708SKishon Vijay Abraham I if (ret) 1368380f5708SKishon Vijay Abraham I return ret; 1369380f5708SKishon Vijay Abraham I 1370380f5708SKishon Vijay Abraham I ret = cdns_regfield_init(sp); 1371380f5708SKishon Vijay Abraham I if (ret) 1372380f5708SKishon Vijay Abraham I return ret; 137344d30d62SAlan Douglas 137444d30d62SAlan Douglas platform_set_drvdata(pdev, sp); 137544d30d62SAlan Douglas 13767e016cbcSKishon Vijay Abraham I ret = cdns_sierra_phy_get_clocks(sp, dev); 13777e016cbcSKishon Vijay Abraham I if (ret) 13787e016cbcSKishon Vijay Abraham I return ret; 137944d30d62SAlan Douglas 138028081b72SKishon Vijay Abraham I ret = cdns_sierra_clk_register(sp); 13811d5f40e0SKishon Vijay Abraham I if (ret) 13821d5f40e0SKishon Vijay Abraham I return ret; 138344d30d62SAlan Douglas 13841436ec30SKishon Vijay Abraham I ret = cdns_sierra_phy_enable_clocks(sp); 138544d30d62SAlan Douglas if (ret) 138628081b72SKishon Vijay Abraham I goto unregister_clk; 138744d30d62SAlan Douglas 1388d88ca22dSAswath Govindraju regmap_field_read(sp->pma_cmn_ready, &sp->already_configured); 1389d88ca22dSAswath Govindraju 1390d88ca22dSAswath Govindraju if (!sp->already_configured) { 1391d88ca22dSAswath Govindraju ret = cdns_sierra_phy_clk(sp); 1392d88ca22dSAswath Govindraju if (ret) 1393d88ca22dSAswath Govindraju goto clk_disable; 1394d88ca22dSAswath Govindraju 1395d88ca22dSAswath Govindraju ret = cdns_sierra_phy_get_resets(sp, dev); 1396d88ca22dSAswath Govindraju if (ret) 1397d88ca22dSAswath Govindraju goto clk_disable; 1398d88ca22dSAswath Govindraju 139944d30d62SAlan Douglas /* Enable APB */ 140044d30d62SAlan Douglas reset_control_deassert(sp->apb_rst); 1401d88ca22dSAswath Govindraju } 140244d30d62SAlan Douglas 140344d30d62SAlan Douglas /* Check that PHY is present */ 1404380f5708SKishon Vijay Abraham I regmap_field_read(sp->macro_id_type, &id_value); 1405380f5708SKishon Vijay Abraham I if (sp->init_data->id_value != id_value) { 140644d30d62SAlan Douglas ret = -EINVAL; 1407d88ca22dSAswath Govindraju goto ctrl_assert; 140844d30d62SAlan Douglas } 140944d30d62SAlan Douglas 141044d30d62SAlan Douglas sp->autoconf = of_property_read_bool(dn, "cdns,autoconf"); 141144d30d62SAlan Douglas 141244d30d62SAlan Douglas for_each_available_child_of_node(dn, child) { 141344d30d62SAlan Douglas struct phy *gphy; 141444d30d62SAlan Douglas 141503ada5a3SKishon Vijay Abraham I if (!(of_node_name_eq(child, "phy") || 141603ada5a3SKishon Vijay Abraham I of_node_name_eq(child, "link"))) 141703ada5a3SKishon Vijay Abraham I continue; 141803ada5a3SKishon Vijay Abraham I 141944d30d62SAlan Douglas sp->phys[node].lnk_rst = 1420b872936fSKishon Vijay Abraham I of_reset_control_array_get_exclusive(child); 142144d30d62SAlan Douglas 142244d30d62SAlan Douglas if (IS_ERR(sp->phys[node].lnk_rst)) { 142344d30d62SAlan Douglas dev_err(dev, "failed to get reset %s\n", 142444d30d62SAlan Douglas child->full_name); 142544d30d62SAlan Douglas ret = PTR_ERR(sp->phys[node].lnk_rst); 142629afbd76SDan Carpenter of_node_put(child); 142729afbd76SDan Carpenter goto put_control; 142844d30d62SAlan Douglas } 142944d30d62SAlan Douglas 143044d30d62SAlan Douglas if (!sp->autoconf) { 143144d30d62SAlan Douglas ret = cdns_sierra_get_optional(&sp->phys[node], child); 143244d30d62SAlan Douglas if (ret) { 143344d30d62SAlan Douglas dev_err(dev, "missing property in node %s\n", 143444d30d62SAlan Douglas child->name); 143529afbd76SDan Carpenter of_node_put(child); 143629afbd76SDan Carpenter reset_control_put(sp->phys[node].lnk_rst); 143729afbd76SDan Carpenter goto put_control; 143844d30d62SAlan Douglas } 143944d30d62SAlan Douglas } 144044d30d62SAlan Douglas 1441a43f72aeSKishon Vijay Abraham I sp->num_lanes += sp->phys[node].num_lanes; 1442a43f72aeSKishon Vijay Abraham I 1443d88ca22dSAswath Govindraju if (!sp->already_configured) 144444d30d62SAlan Douglas gphy = devm_phy_create(dev, child, &ops); 1445d88ca22dSAswath Govindraju else 1446d88ca22dSAswath Govindraju gphy = devm_phy_create(dev, child, &noop_ops); 144744d30d62SAlan Douglas if (IS_ERR(gphy)) { 144844d30d62SAlan Douglas ret = PTR_ERR(gphy); 144929afbd76SDan Carpenter of_node_put(child); 145029afbd76SDan Carpenter reset_control_put(sp->phys[node].lnk_rst); 145129afbd76SDan Carpenter goto put_control; 145244d30d62SAlan Douglas } 145344d30d62SAlan Douglas sp->phys[node].phy = gphy; 145444d30d62SAlan Douglas phy_set_drvdata(gphy, &sp->phys[node]); 145544d30d62SAlan Douglas 145644d30d62SAlan Douglas node++; 145744d30d62SAlan Douglas } 145844d30d62SAlan Douglas sp->nsubnodes = node; 145944d30d62SAlan Douglas 1460a43f72aeSKishon Vijay Abraham I if (sp->num_lanes > SIERRA_MAX_LANES) { 14616411e386SWang Wensheng ret = -EINVAL; 1462a43f72aeSKishon Vijay Abraham I dev_err(dev, "Invalid lane configuration\n"); 146329afbd76SDan Carpenter goto put_control; 1464a43f72aeSKishon Vijay Abraham I } 1465a43f72aeSKishon Vijay Abraham I 146644d30d62SAlan Douglas /* If more than one subnode, configure the PHY as multilink */ 1467d88ca22dSAswath Govindraju if (!sp->already_configured && !sp->autoconf && sp->nsubnodes > 1) { 14686b81f05aSSwapnil Jakhade ret = cdns_sierra_phy_configure_multilink(sp); 14696b81f05aSSwapnil Jakhade if (ret) 147029afbd76SDan Carpenter goto put_control; 14716b81f05aSSwapnil Jakhade } 147244d30d62SAlan Douglas 147344d30d62SAlan Douglas pm_runtime_enable(dev); 147444d30d62SAlan Douglas phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 147529afbd76SDan Carpenter if (IS_ERR(phy_provider)) { 147629afbd76SDan Carpenter ret = PTR_ERR(phy_provider); 147729afbd76SDan Carpenter goto put_control; 147829afbd76SDan Carpenter } 147944d30d62SAlan Douglas 148029afbd76SDan Carpenter return 0; 148129afbd76SDan Carpenter 148229afbd76SDan Carpenter put_control: 148329afbd76SDan Carpenter while (--node >= 0) 148429afbd76SDan Carpenter reset_control_put(sp->phys[node].lnk_rst); 1485d88ca22dSAswath Govindraju ctrl_assert: 1486d88ca22dSAswath Govindraju if (!sp->already_configured) 1487d88ca22dSAswath Govindraju reset_control_assert(sp->apb_rst); 148844d30d62SAlan Douglas clk_disable: 14891436ec30SKishon Vijay Abraham I cdns_sierra_phy_disable_clocks(sp); 149028081b72SKishon Vijay Abraham I unregister_clk: 149128081b72SKishon Vijay Abraham I cdns_sierra_clk_unregister(sp); 149244d30d62SAlan Douglas return ret; 149344d30d62SAlan Douglas } 149444d30d62SAlan Douglas 1495e9ddb1adSUwe Kleine-König static void cdns_sierra_phy_remove(struct platform_device *pdev) 149644d30d62SAlan Douglas { 1497748e3456SKishon Vijay Abraham I struct cdns_sierra_phy *phy = platform_get_drvdata(pdev); 149844d30d62SAlan Douglas int i; 149944d30d62SAlan Douglas 150044d30d62SAlan Douglas reset_control_assert(phy->phy_rst); 150144d30d62SAlan Douglas reset_control_assert(phy->apb_rst); 150244d30d62SAlan Douglas pm_runtime_disable(&pdev->dev); 150344d30d62SAlan Douglas 15041436ec30SKishon Vijay Abraham I cdns_sierra_phy_disable_clocks(phy); 150544d30d62SAlan Douglas /* 150644d30d62SAlan Douglas * The device level resets will be put automatically. 150744d30d62SAlan Douglas * Need to put the subnode resets here though. 150844d30d62SAlan Douglas */ 150944d30d62SAlan Douglas for (i = 0; i < phy->nsubnodes; i++) { 151044d30d62SAlan Douglas reset_control_assert(phy->phys[i].lnk_rst); 151144d30d62SAlan Douglas reset_control_put(phy->phys[i].lnk_rst); 151244d30d62SAlan Douglas } 151329c2d02aSKishon Vijay Abraham I 151428081b72SKishon Vijay Abraham I cdns_sierra_clk_unregister(phy); 151544d30d62SAlan Douglas } 151644d30d62SAlan Douglas 15178a1b82d7SSwapnil Jakhade /* QSGMII PHY PMA lane configuration */ 15188a1b82d7SSwapnil Jakhade static struct cdns_reg_pairs qsgmii_phy_pma_ln_regs[] = { 15198a1b82d7SSwapnil Jakhade {0x9010, SIERRA_PHY_PMA_XCVR_CTRL} 15208a1b82d7SSwapnil Jakhade }; 15218a1b82d7SSwapnil Jakhade 15228a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals qsgmii_phy_pma_ln_vals = { 15238a1b82d7SSwapnil Jakhade .reg_pairs = qsgmii_phy_pma_ln_regs, 15248a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(qsgmii_phy_pma_ln_regs), 15258a1b82d7SSwapnil Jakhade }; 15268a1b82d7SSwapnil Jakhade 15278a1b82d7SSwapnil Jakhade /* QSGMII refclk 100MHz, 20b, opt1, No BW cal, no ssc, PLL LC1 */ 15288a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_cmn_regs[] = { 15298a1b82d7SSwapnil Jakhade {0x2085, SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG}, 15308a1b82d7SSwapnil Jakhade {0x0000, SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG}, 15318a1b82d7SSwapnil Jakhade {0x0000, SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG} 15328a1b82d7SSwapnil Jakhade }; 15338a1b82d7SSwapnil Jakhade 15348a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_ln_regs[] = { 15358a1b82d7SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 15368a1b82d7SSwapnil Jakhade {0x0252, SIERRA_DET_STANDEC_E_PREG}, 15378a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 15388a1b82d7SSwapnil Jakhade {0x0FFE, SIERRA_PSC_RX_A0_PREG}, 15398a1b82d7SSwapnil Jakhade {0x0011, SIERRA_PLLCTRL_SUBRATE_PREG}, 15408a1b82d7SSwapnil Jakhade {0x0001, SIERRA_PLLCTRL_GEN_A_PREG}, 15418a1b82d7SSwapnil Jakhade {0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG}, 15428a1b82d7SSwapnil Jakhade {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 15438a1b82d7SSwapnil Jakhade {0x0089, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 15448a1b82d7SSwapnil Jakhade {0x3C3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 15458a1b82d7SSwapnil Jakhade {0x3222, SIERRA_CREQ_FSMCLK_SEL_PREG}, 15468a1b82d7SSwapnil Jakhade {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 15478a1b82d7SSwapnil Jakhade {0x8422, SIERRA_CTLELUT_CTRL_PREG}, 15488a1b82d7SSwapnil Jakhade {0x4111, SIERRA_DFE_ECMP_RATESEL_PREG}, 15498a1b82d7SSwapnil Jakhade {0x4111, SIERRA_DFE_SMP_RATESEL_PREG}, 15508a1b82d7SSwapnil Jakhade {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, 15518a1b82d7SSwapnil Jakhade {0x9595, SIERRA_DEQ_VGATUNE_CTRL_PREG}, 15528a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT0}, 15538a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT1}, 15548a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT2}, 15558a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT3}, 15568a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 15578a1b82d7SSwapnil Jakhade {0x0861, SIERRA_DEQ_ALUT0}, 15588a1b82d7SSwapnil Jakhade {0x07E0, SIERRA_DEQ_ALUT1}, 15598a1b82d7SSwapnil Jakhade {0x079E, SIERRA_DEQ_ALUT2}, 15608a1b82d7SSwapnil Jakhade {0x071D, SIERRA_DEQ_ALUT3}, 15618a1b82d7SSwapnil Jakhade {0x03F5, SIERRA_DEQ_DFETAP_CTRL_PREG}, 15628a1b82d7SSwapnil Jakhade {0x0C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG}, 15638a1b82d7SSwapnil Jakhade {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 15648a1b82d7SSwapnil Jakhade {0x1C04, SIERRA_DEQ_TAU_CTRL2_PREG}, 15658a1b82d7SSwapnil Jakhade {0x0033, SIERRA_DEQ_PICTRL_PREG}, 15668a1b82d7SSwapnil Jakhade {0x0660, SIERRA_CPICAL_TMRVAL_MODE0_PREG}, 15678a1b82d7SSwapnil Jakhade {0x00D5, SIERRA_CPI_OUTBUF_RATESEL_PREG}, 15688a1b82d7SSwapnil Jakhade {0x0B6D, SIERRA_CPI_RESBIAS_BIN_PREG}, 15698a1b82d7SSwapnil Jakhade {0x0102, SIERRA_RXBUFFER_CTLECTRL_PREG}, 15708a1b82d7SSwapnil Jakhade {0x0002, SIERRA_RXBUFFER_RCDFECTRL_PREG} 15718a1b82d7SSwapnil Jakhade }; 15728a1b82d7SSwapnil Jakhade 15738a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_cmn_vals = { 15748a1b82d7SSwapnil Jakhade .reg_pairs = qsgmii_100_no_ssc_plllc1_cmn_regs, 15758a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_cmn_regs), 15768a1b82d7SSwapnil Jakhade }; 15778a1b82d7SSwapnil Jakhade 15788a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_ln_vals = { 15798a1b82d7SSwapnil Jakhade .reg_pairs = qsgmii_100_no_ssc_plllc1_ln_regs, 15808a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_ln_regs), 15818a1b82d7SSwapnil Jakhade }; 15828a1b82d7SSwapnil Jakhade 1583fa105172SSwapnil Jakhade /* PCIE PHY PCS common configuration */ 1584fa105172SSwapnil Jakhade static struct cdns_reg_pairs pcie_phy_pcs_cmn_regs[] = { 1585fa105172SSwapnil Jakhade {0x0430, SIERRA_PHY_PIPE_CMN_CTRL1} 1586fa105172SSwapnil Jakhade }; 1587fa105172SSwapnil Jakhade 1588fa105172SSwapnil Jakhade static struct cdns_sierra_vals pcie_phy_pcs_cmn_vals = { 1589fa105172SSwapnil Jakhade .reg_pairs = pcie_phy_pcs_cmn_regs, 1590fa105172SSwapnil Jakhade .num_regs = ARRAY_SIZE(pcie_phy_pcs_cmn_regs), 1591fa105172SSwapnil Jakhade }; 1592fa105172SSwapnil Jakhade 15938a1b82d7SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_no_ssc, pcie_links_using_plllc, pipe_bw_3 */ 15948a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs pcie_100_no_ssc_plllc_cmn_regs[] = { 15958a1b82d7SSwapnil Jakhade {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 15968a1b82d7SSwapnil Jakhade {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 15978a1b82d7SSwapnil Jakhade {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 15988a1b82d7SSwapnil Jakhade {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG} 15998a1b82d7SSwapnil Jakhade }; 16008a1b82d7SSwapnil Jakhade 16018a1b82d7SSwapnil Jakhade /* 16028a1b82d7SSwapnil Jakhade * refclk100MHz_32b_PCIe_ln_no_ssc, multilink, using_plllc, 16038a1b82d7SSwapnil Jakhade * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 16048a1b82d7SSwapnil Jakhade */ 16058a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs ml_pcie_100_no_ssc_ln_regs[] = { 16068a1b82d7SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 16078a1b82d7SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 16088a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A3_PREG}, 16098a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A4_PREG}, 16108a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 16118a1b82d7SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 16128a1b82d7SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 16138a1b82d7SSwapnil Jakhade {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 16148a1b82d7SSwapnil Jakhade {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 16158a1b82d7SSwapnil Jakhade {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 16168a1b82d7SSwapnil Jakhade {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 16178a1b82d7SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 16188a1b82d7SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 16198a1b82d7SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 16208a1b82d7SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 16218a1b82d7SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 16228a1b82d7SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 16238a1b82d7SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 16248a1b82d7SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 16258a1b82d7SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 16268a1b82d7SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 16278a1b82d7SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 16288a1b82d7SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 16298a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 16308a1b82d7SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 16318a1b82d7SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 16328a1b82d7SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 16338a1b82d7SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 16348a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 16358a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 16368a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 16378a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 16388a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 16398a1b82d7SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 16408a1b82d7SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 16418a1b82d7SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 16428a1b82d7SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 16438a1b82d7SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 16448a1b82d7SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 16458a1b82d7SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 16468a1b82d7SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 16478a1b82d7SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 16488a1b82d7SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 16498a1b82d7SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 16508a1b82d7SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 16518a1b82d7SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 16528a1b82d7SSwapnil Jakhade }; 16538a1b82d7SSwapnil Jakhade 16548a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_no_ssc_plllc_cmn_vals = { 16558a1b82d7SSwapnil Jakhade .reg_pairs = pcie_100_no_ssc_plllc_cmn_regs, 16568a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(pcie_100_no_ssc_plllc_cmn_regs), 16578a1b82d7SSwapnil Jakhade }; 16588a1b82d7SSwapnil Jakhade 16598a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals ml_pcie_100_no_ssc_ln_vals = { 16608a1b82d7SSwapnil Jakhade .reg_pairs = ml_pcie_100_no_ssc_ln_regs, 16618a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(ml_pcie_100_no_ssc_ln_regs), 16628a1b82d7SSwapnil Jakhade }; 16638a1b82d7SSwapnil Jakhade 1664e72659b6SSwapnil Jakhade /* 1665e72659b6SSwapnil Jakhade * TI J721E: 1666e72659b6SSwapnil Jakhade * refclk100MHz_32b_PCIe_ln_no_ssc, multilink, using_plllc, 1667e72659b6SSwapnil Jakhade * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 1668e72659b6SSwapnil Jakhade */ 1669e72659b6SSwapnil Jakhade static const struct cdns_reg_pairs ti_ml_pcie_100_no_ssc_ln_regs[] = { 1670e72659b6SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 1671e72659b6SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 1672e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A3_PREG}, 1673e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A4_PREG}, 1674e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 1675e72659b6SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 1676e72659b6SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 1677e72659b6SSwapnil Jakhade {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 1678e72659b6SSwapnil Jakhade {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 1679e72659b6SSwapnil Jakhade {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 1680e72659b6SSwapnil Jakhade {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 1681e72659b6SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 1682e72659b6SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 1683e72659b6SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 1684e72659b6SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 1685e72659b6SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 1686e72659b6SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 1687e72659b6SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 1688e72659b6SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 1689e72659b6SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 1690e72659b6SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 1691e72659b6SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 1692e72659b6SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 1693e72659b6SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 1694e72659b6SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 1695e72659b6SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 1696e72659b6SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 1697e72659b6SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 1698e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 1699e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 1700e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 1701e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 1702e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 1703e72659b6SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 1704e72659b6SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 1705e72659b6SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 1706e72659b6SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 1707e72659b6SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 1708e72659b6SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 1709e72659b6SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 1710e72659b6SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 1711e72659b6SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 1712e72659b6SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 1713e72659b6SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 1714e72659b6SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 1715e72659b6SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}, 1716e72659b6SSwapnil Jakhade {0x0002, SIERRA_TX_RCVDET_OVRD_PREG} 1717e72659b6SSwapnil Jakhade }; 1718e72659b6SSwapnil Jakhade 1719e72659b6SSwapnil Jakhade static struct cdns_sierra_vals ti_ml_pcie_100_no_ssc_ln_vals = { 1720e72659b6SSwapnil Jakhade .reg_pairs = ti_ml_pcie_100_no_ssc_ln_regs, 1721e72659b6SSwapnil Jakhade .num_regs = ARRAY_SIZE(ti_ml_pcie_100_no_ssc_ln_regs), 1722e72659b6SSwapnil Jakhade }; 1723e72659b6SSwapnil Jakhade 17248a1b82d7SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_int_ssc, pcie_links_using_plllc, pipe_bw_3 */ 17258a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs pcie_100_int_ssc_plllc_cmn_regs[] = { 17268a1b82d7SSwapnil Jakhade {0x000E, SIERRA_CMN_PLLLC_MODE_PREG}, 17278a1b82d7SSwapnil Jakhade {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 17288a1b82d7SSwapnil Jakhade {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 17298a1b82d7SSwapnil Jakhade {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 17308a1b82d7SSwapnil Jakhade {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 17318a1b82d7SSwapnil Jakhade {0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG}, 17328a1b82d7SSwapnil Jakhade {0x7F80, SIERRA_CMN_PLLLC_SS_PREG}, 17338a1b82d7SSwapnil Jakhade {0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG}, 17348a1b82d7SSwapnil Jakhade {0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG}, 17358a1b82d7SSwapnil Jakhade {0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}, 17368a1b82d7SSwapnil Jakhade {0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG} 17378a1b82d7SSwapnil Jakhade }; 17388a1b82d7SSwapnil Jakhade 17398a1b82d7SSwapnil Jakhade /* 17408a1b82d7SSwapnil Jakhade * refclk100MHz_32b_PCIe_ln_int_ssc, multilink, using_plllc, 17418a1b82d7SSwapnil Jakhade * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 17428a1b82d7SSwapnil Jakhade */ 17438a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs ml_pcie_100_int_ssc_ln_regs[] = { 17448a1b82d7SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 17458a1b82d7SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 17468a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A3_PREG}, 17478a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A4_PREG}, 17488a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 17498a1b82d7SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 17508a1b82d7SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 17518a1b82d7SSwapnil Jakhade {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 17528a1b82d7SSwapnil Jakhade {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 17538a1b82d7SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 17548a1b82d7SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 17558a1b82d7SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 17568a1b82d7SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 17578a1b82d7SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 17588a1b82d7SSwapnil Jakhade {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 17598a1b82d7SSwapnil Jakhade {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 17608a1b82d7SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 17618a1b82d7SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 17628a1b82d7SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 17638a1b82d7SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 17648a1b82d7SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 17658a1b82d7SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 17668a1b82d7SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 17678a1b82d7SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 17688a1b82d7SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 17698a1b82d7SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 17708a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 17718a1b82d7SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 17728a1b82d7SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 17738a1b82d7SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 17748a1b82d7SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 17758a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 17768a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 17778a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 17788a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 17798a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 17808a1b82d7SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 17818a1b82d7SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 17828a1b82d7SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 17838a1b82d7SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 17848a1b82d7SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 17858a1b82d7SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 17868a1b82d7SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 17878a1b82d7SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 17888a1b82d7SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 17898a1b82d7SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 17908a1b82d7SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 17918a1b82d7SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 17928a1b82d7SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 17938a1b82d7SSwapnil Jakhade }; 17948a1b82d7SSwapnil Jakhade 17958a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_int_ssc_plllc_cmn_vals = { 17968a1b82d7SSwapnil Jakhade .reg_pairs = pcie_100_int_ssc_plllc_cmn_regs, 17978a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(pcie_100_int_ssc_plllc_cmn_regs), 17988a1b82d7SSwapnil Jakhade }; 17998a1b82d7SSwapnil Jakhade 18008a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals ml_pcie_100_int_ssc_ln_vals = { 18018a1b82d7SSwapnil Jakhade .reg_pairs = ml_pcie_100_int_ssc_ln_regs, 18028a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(ml_pcie_100_int_ssc_ln_regs), 18038a1b82d7SSwapnil Jakhade }; 18048a1b82d7SSwapnil Jakhade 1805e72659b6SSwapnil Jakhade /* 1806e72659b6SSwapnil Jakhade * TI J721E: 1807e72659b6SSwapnil Jakhade * refclk100MHz_32b_PCIe_ln_int_ssc, multilink, using_plllc, 1808e72659b6SSwapnil Jakhade * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 1809e72659b6SSwapnil Jakhade */ 1810e72659b6SSwapnil Jakhade static const struct cdns_reg_pairs ti_ml_pcie_100_int_ssc_ln_regs[] = { 1811e72659b6SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 1812e72659b6SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 1813e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A3_PREG}, 1814e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A4_PREG}, 1815e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 1816e72659b6SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 1817e72659b6SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 1818e72659b6SSwapnil Jakhade {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 1819e72659b6SSwapnil Jakhade {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 1820e72659b6SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 1821e72659b6SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 1822e72659b6SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 1823e72659b6SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 1824e72659b6SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 1825e72659b6SSwapnil Jakhade {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 1826e72659b6SSwapnil Jakhade {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 1827e72659b6SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 1828e72659b6SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 1829e72659b6SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 1830e72659b6SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 1831e72659b6SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 1832e72659b6SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 1833e72659b6SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 1834e72659b6SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 1835e72659b6SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 1836e72659b6SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 1837e72659b6SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 1838e72659b6SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 1839e72659b6SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 1840e72659b6SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 1841e72659b6SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 1842e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 1843e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 1844e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 1845e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 1846e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 1847e72659b6SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 1848e72659b6SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 1849e72659b6SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 1850e72659b6SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 1851e72659b6SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 1852e72659b6SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 1853e72659b6SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 1854e72659b6SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 1855e72659b6SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 1856e72659b6SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 1857e72659b6SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 1858e72659b6SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 1859e72659b6SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}, 1860e72659b6SSwapnil Jakhade {0x0002, SIERRA_TX_RCVDET_OVRD_PREG} 1861e72659b6SSwapnil Jakhade }; 1862e72659b6SSwapnil Jakhade 1863e72659b6SSwapnil Jakhade static struct cdns_sierra_vals ti_ml_pcie_100_int_ssc_ln_vals = { 1864e72659b6SSwapnil Jakhade .reg_pairs = ti_ml_pcie_100_int_ssc_ln_regs, 1865e72659b6SSwapnil Jakhade .num_regs = ARRAY_SIZE(ti_ml_pcie_100_int_ssc_ln_regs), 1866e72659b6SSwapnil Jakhade }; 1867e72659b6SSwapnil Jakhade 18688a1b82d7SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc, pcie_links_using_plllc, pipe_bw_3 */ 18698a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs pcie_100_ext_ssc_plllc_cmn_regs[] = { 18708a1b82d7SSwapnil Jakhade {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 18718a1b82d7SSwapnil Jakhade {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 18728a1b82d7SSwapnil Jakhade {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 18738a1b82d7SSwapnil Jakhade {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 18748a1b82d7SSwapnil Jakhade {0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG} 18758a1b82d7SSwapnil Jakhade }; 18768a1b82d7SSwapnil Jakhade 18778a1b82d7SSwapnil Jakhade /* 18788a1b82d7SSwapnil Jakhade * refclk100MHz_32b_PCIe_ln_ext_ssc, multilink, using_plllc, 18798a1b82d7SSwapnil Jakhade * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 18808a1b82d7SSwapnil Jakhade */ 18818a1b82d7SSwapnil Jakhade static const struct cdns_reg_pairs ml_pcie_100_ext_ssc_ln_regs[] = { 18828a1b82d7SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 18838a1b82d7SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 18848a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A3_PREG}, 18858a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A4_PREG}, 18868a1b82d7SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 18878a1b82d7SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 18888a1b82d7SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 18898a1b82d7SSwapnil Jakhade {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 18908a1b82d7SSwapnil Jakhade {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 18918a1b82d7SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 18928a1b82d7SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 18938a1b82d7SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 18948a1b82d7SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 18958a1b82d7SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 18968a1b82d7SSwapnil Jakhade {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 18978a1b82d7SSwapnil Jakhade {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 18988a1b82d7SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 18998a1b82d7SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 19008a1b82d7SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 19018a1b82d7SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 19028a1b82d7SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 19038a1b82d7SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 19048a1b82d7SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 19058a1b82d7SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 19068a1b82d7SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 19078a1b82d7SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 19088a1b82d7SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 19098a1b82d7SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 19108a1b82d7SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 19118a1b82d7SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 19128a1b82d7SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 19138a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 19148a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 19158a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 19168a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 19178a1b82d7SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 19188a1b82d7SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 19198a1b82d7SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 19208a1b82d7SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 19218a1b82d7SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 19228a1b82d7SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 19238a1b82d7SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 19248a1b82d7SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 19258a1b82d7SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 19268a1b82d7SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 19278a1b82d7SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 19288a1b82d7SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 19298a1b82d7SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 19308a1b82d7SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 19318a1b82d7SSwapnil Jakhade }; 19328a1b82d7SSwapnil Jakhade 19338a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_ext_ssc_plllc_cmn_vals = { 19348a1b82d7SSwapnil Jakhade .reg_pairs = pcie_100_ext_ssc_plllc_cmn_regs, 19358a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(pcie_100_ext_ssc_plllc_cmn_regs), 19368a1b82d7SSwapnil Jakhade }; 19378a1b82d7SSwapnil Jakhade 19388a1b82d7SSwapnil Jakhade static struct cdns_sierra_vals ml_pcie_100_ext_ssc_ln_vals = { 19398a1b82d7SSwapnil Jakhade .reg_pairs = ml_pcie_100_ext_ssc_ln_regs, 19408a1b82d7SSwapnil Jakhade .num_regs = ARRAY_SIZE(ml_pcie_100_ext_ssc_ln_regs), 19418a1b82d7SSwapnil Jakhade }; 19428a1b82d7SSwapnil Jakhade 1943e72659b6SSwapnil Jakhade /* 1944e72659b6SSwapnil Jakhade * TI J721E: 1945e72659b6SSwapnil Jakhade * refclk100MHz_32b_PCIe_ln_ext_ssc, multilink, using_plllc, 1946e72659b6SSwapnil Jakhade * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 1947e72659b6SSwapnil Jakhade */ 1948e72659b6SSwapnil Jakhade static const struct cdns_reg_pairs ti_ml_pcie_100_ext_ssc_ln_regs[] = { 1949e72659b6SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 1950e72659b6SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 1951e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A3_PREG}, 1952e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_A4_PREG}, 1953e72659b6SSwapnil Jakhade {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 1954e72659b6SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 1955e72659b6SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 1956e72659b6SSwapnil Jakhade {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 1957e72659b6SSwapnil Jakhade {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 1958e72659b6SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 1959e72659b6SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 1960e72659b6SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 1961e72659b6SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 1962e72659b6SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 1963e72659b6SSwapnil Jakhade {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 1964e72659b6SSwapnil Jakhade {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 1965e72659b6SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 1966e72659b6SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 1967e72659b6SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 1968e72659b6SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 1969e72659b6SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 1970e72659b6SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 1971e72659b6SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 1972e72659b6SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 1973e72659b6SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 1974e72659b6SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 1975e72659b6SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 1976e72659b6SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 1977e72659b6SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 1978e72659b6SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 1979e72659b6SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 1980e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 1981e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 1982e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 1983e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 1984e72659b6SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 1985e72659b6SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 1986e72659b6SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 1987e72659b6SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 1988e72659b6SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 1989e72659b6SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 1990e72659b6SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 1991e72659b6SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 1992e72659b6SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 1993e72659b6SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 1994e72659b6SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 1995e72659b6SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 1996e72659b6SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 1997e72659b6SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}, 1998e72659b6SSwapnil Jakhade {0x0002, SIERRA_TX_RCVDET_OVRD_PREG} 1999e72659b6SSwapnil Jakhade }; 2000e72659b6SSwapnil Jakhade 2001e72659b6SSwapnil Jakhade static struct cdns_sierra_vals ti_ml_pcie_100_ext_ssc_ln_vals = { 2002e72659b6SSwapnil Jakhade .reg_pairs = ti_ml_pcie_100_ext_ssc_ln_regs, 2003e72659b6SSwapnil Jakhade .num_regs = ARRAY_SIZE(ti_ml_pcie_100_ext_ssc_ln_regs), 2004e72659b6SSwapnil Jakhade }; 2005e72659b6SSwapnil Jakhade 20067a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_no_ssc */ 20077a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_cmn_regs_no_ssc[] = { 20087a5ad9b4SSwapnil Jakhade {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 20097a5ad9b4SSwapnil Jakhade {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 20107a5ad9b4SSwapnil Jakhade {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 20117a5ad9b4SSwapnil Jakhade {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG} 20127a5ad9b4SSwapnil Jakhade }; 20137a5ad9b4SSwapnil Jakhade 20147a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_ln_no_ssc */ 20157a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_ln_regs_no_ssc[] = { 20167a5ad9b4SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 20177a5ad9b4SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 20187a5ad9b4SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 20197a5ad9b4SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 20207a5ad9b4SSwapnil Jakhade {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 20217a5ad9b4SSwapnil Jakhade {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 20227a5ad9b4SSwapnil Jakhade {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 20237a5ad9b4SSwapnil Jakhade {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 20247a5ad9b4SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 20257a5ad9b4SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 20267a5ad9b4SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 20277a5ad9b4SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 20287a5ad9b4SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 20297a5ad9b4SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 20307a5ad9b4SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 20317a5ad9b4SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 20327a5ad9b4SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 20337a5ad9b4SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 20347a5ad9b4SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 20357a5ad9b4SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 20367a5ad9b4SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 20377a5ad9b4SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 20387a5ad9b4SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 20397a5ad9b4SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 20407a5ad9b4SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 20417a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 20427a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 20437a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 20447a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 20457a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 20467a5ad9b4SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 20477a5ad9b4SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 20487a5ad9b4SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 20497a5ad9b4SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 20507a5ad9b4SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 20517a5ad9b4SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 20527a5ad9b4SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 20537a5ad9b4SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 20547a5ad9b4SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 20557a5ad9b4SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 20567a5ad9b4SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 20577a5ad9b4SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 20587a5ad9b4SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 20597a5ad9b4SSwapnil Jakhade }; 20607a5ad9b4SSwapnil Jakhade 20617a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_no_ssc_cmn_vals = { 20627a5ad9b4SSwapnil Jakhade .reg_pairs = cdns_pcie_cmn_regs_no_ssc, 20637a5ad9b4SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_no_ssc), 20647a5ad9b4SSwapnil Jakhade }; 20657a5ad9b4SSwapnil Jakhade 20667a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_no_ssc_ln_vals = { 20677a5ad9b4SSwapnil Jakhade .reg_pairs = cdns_pcie_ln_regs_no_ssc, 20687a5ad9b4SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_no_ssc), 20697a5ad9b4SSwapnil Jakhade }; 20707a5ad9b4SSwapnil Jakhade 20717a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_cmn_pll_int_ssc */ 20727a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_cmn_regs_int_ssc[] = { 20737a5ad9b4SSwapnil Jakhade {0x000E, SIERRA_CMN_PLLLC_MODE_PREG}, 20747a5ad9b4SSwapnil Jakhade {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 20757a5ad9b4SSwapnil Jakhade {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 20767a5ad9b4SSwapnil Jakhade {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 20777a5ad9b4SSwapnil Jakhade {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 20787a5ad9b4SSwapnil Jakhade {0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG}, 20797a5ad9b4SSwapnil Jakhade {0x7F80, SIERRA_CMN_PLLLC_SS_PREG}, 20807a5ad9b4SSwapnil Jakhade {0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG}, 20817a5ad9b4SSwapnil Jakhade {0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG}, 20827a5ad9b4SSwapnil Jakhade {0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}, 20837a5ad9b4SSwapnil Jakhade {0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG} 20847a5ad9b4SSwapnil Jakhade }; 20857a5ad9b4SSwapnil Jakhade 20867a5ad9b4SSwapnil Jakhade /* refclk100MHz_32b_PCIe_ln_int_ssc */ 20877a5ad9b4SSwapnil Jakhade static const struct cdns_reg_pairs cdns_pcie_ln_regs_int_ssc[] = { 20887a5ad9b4SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 20897a5ad9b4SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 20907a5ad9b4SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 20917a5ad9b4SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 20927a5ad9b4SSwapnil Jakhade {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 20937a5ad9b4SSwapnil Jakhade {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 20947a5ad9b4SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 20957a5ad9b4SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 20967a5ad9b4SSwapnil Jakhade {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 20977a5ad9b4SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 20987a5ad9b4SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 20997a5ad9b4SSwapnil Jakhade {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 21007a5ad9b4SSwapnil Jakhade {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 21017a5ad9b4SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 21027a5ad9b4SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 21037a5ad9b4SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 21047a5ad9b4SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 21057a5ad9b4SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 21067a5ad9b4SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 21077a5ad9b4SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 21087a5ad9b4SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 21097a5ad9b4SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 21107a5ad9b4SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 21117a5ad9b4SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 21127a5ad9b4SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 21137a5ad9b4SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 21147a5ad9b4SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 21157a5ad9b4SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 21167a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 21177a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 21187a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 21197a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 21207a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 21217a5ad9b4SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 21227a5ad9b4SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 21237a5ad9b4SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 21247a5ad9b4SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 21257a5ad9b4SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 21267a5ad9b4SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 21277a5ad9b4SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 21287a5ad9b4SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 21297a5ad9b4SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 21307a5ad9b4SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 21317a5ad9b4SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 21327a5ad9b4SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 21337a5ad9b4SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 21347a5ad9b4SSwapnil Jakhade }; 21357a5ad9b4SSwapnil Jakhade 21367a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_int_ssc_cmn_vals = { 21377a5ad9b4SSwapnil Jakhade .reg_pairs = cdns_pcie_cmn_regs_int_ssc, 21387a5ad9b4SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_int_ssc), 21397a5ad9b4SSwapnil Jakhade }; 21407a5ad9b4SSwapnil Jakhade 21417a5ad9b4SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_int_ssc_ln_vals = { 21427a5ad9b4SSwapnil Jakhade .reg_pairs = cdns_pcie_ln_regs_int_ssc, 21437a5ad9b4SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_int_ssc), 21447a5ad9b4SSwapnil Jakhade }; 21457a5ad9b4SSwapnil Jakhade 2146871002d7SAnil Varughese /* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc */ 21473cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_pcie_cmn_regs_ext_ssc[] = { 2148871002d7SAnil Varughese {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 2149871002d7SAnil Varughese {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 2150871002d7SAnil Varughese {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 2151871002d7SAnil Varughese {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 2152871002d7SAnil Varughese {0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG} 2153871002d7SAnil Varughese }; 2154871002d7SAnil Varughese 2155871002d7SAnil Varughese /* refclk100MHz_32b_PCIe_ln_ext_ssc */ 21563cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_pcie_ln_regs_ext_ssc[] = { 21577a5ad9b4SSwapnil Jakhade {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 21587a5ad9b4SSwapnil Jakhade {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 21597a5ad9b4SSwapnil Jakhade {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 21607a5ad9b4SSwapnil Jakhade {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 2161871002d7SAnil Varughese {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 2162871002d7SAnil Varughese {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 2163871002d7SAnil Varughese {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 2164871002d7SAnil Varughese {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 2165871002d7SAnil Varughese {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 21667a5ad9b4SSwapnil Jakhade {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 21677a5ad9b4SSwapnil Jakhade {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 2168871002d7SAnil Varughese {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 21697a5ad9b4SSwapnil Jakhade {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 21707a5ad9b4SSwapnil Jakhade {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 21717a5ad9b4SSwapnil Jakhade {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 21727a5ad9b4SSwapnil Jakhade {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 21737a5ad9b4SSwapnil Jakhade {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 21747a5ad9b4SSwapnil Jakhade {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 21757a5ad9b4SSwapnil Jakhade {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 21767a5ad9b4SSwapnil Jakhade {0x0041, SIERRA_DEQ_GLUT0}, 21777a5ad9b4SSwapnil Jakhade {0x0082, SIERRA_DEQ_GLUT1}, 21787a5ad9b4SSwapnil Jakhade {0x00C3, SIERRA_DEQ_GLUT2}, 21797a5ad9b4SSwapnil Jakhade {0x0145, SIERRA_DEQ_GLUT3}, 21807a5ad9b4SSwapnil Jakhade {0x0186, SIERRA_DEQ_GLUT4}, 21817a5ad9b4SSwapnil Jakhade {0x09E7, SIERRA_DEQ_ALUT0}, 21827a5ad9b4SSwapnil Jakhade {0x09A6, SIERRA_DEQ_ALUT1}, 21837a5ad9b4SSwapnil Jakhade {0x0965, SIERRA_DEQ_ALUT2}, 21847a5ad9b4SSwapnil Jakhade {0x08E3, SIERRA_DEQ_ALUT3}, 21857a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP0}, 21867a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP1}, 21877a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP2}, 21887a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP3}, 21897a5ad9b4SSwapnil Jakhade {0x00FA, SIERRA_DEQ_DFETAP4}, 21907a5ad9b4SSwapnil Jakhade {0x000F, SIERRA_DEQ_PRECUR_PREG}, 21917a5ad9b4SSwapnil Jakhade {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 21927a5ad9b4SSwapnil Jakhade {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 21937a5ad9b4SSwapnil Jakhade {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 21947a5ad9b4SSwapnil Jakhade {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 21957a5ad9b4SSwapnil Jakhade {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 21967a5ad9b4SSwapnil Jakhade {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 21977a5ad9b4SSwapnil Jakhade {0x002B, SIERRA_CPI_TRIM_PREG}, 21987a5ad9b4SSwapnil Jakhade {0x0003, SIERRA_EPI_CTRL_PREG}, 21997a5ad9b4SSwapnil Jakhade {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 22007a5ad9b4SSwapnil Jakhade {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 22017a5ad9b4SSwapnil Jakhade {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 22027a5ad9b4SSwapnil Jakhade {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 2203871002d7SAnil Varughese }; 2204871002d7SAnil Varughese 2205078e9e92SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_ext_ssc_cmn_vals = { 2206078e9e92SSwapnil Jakhade .reg_pairs = cdns_pcie_cmn_regs_ext_ssc, 2207078e9e92SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_ext_ssc), 2208078e9e92SSwapnil Jakhade }; 2209078e9e92SSwapnil Jakhade 2210078e9e92SSwapnil Jakhade static struct cdns_sierra_vals pcie_100_ext_ssc_ln_vals = { 2211078e9e92SSwapnil Jakhade .reg_pairs = cdns_pcie_ln_regs_ext_ssc, 2212078e9e92SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_ext_ssc), 2213078e9e92SSwapnil Jakhade }; 2214078e9e92SSwapnil Jakhade 2215871002d7SAnil Varughese /* refclk100MHz_20b_USB_cmn_pll_ext_ssc */ 22163cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = { 2217871002d7SAnil Varughese {0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 2218871002d7SAnil Varughese {0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 2219871002d7SAnil Varughese {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 2220871002d7SAnil Varughese {0x0000, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG} 2221871002d7SAnil Varughese }; 2222871002d7SAnil Varughese 2223871002d7SAnil Varughese /* refclk100MHz_20b_USB_ln_ext_ssc */ 22243cfb0e8eSRikard Falkeborn static const struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { 2225aead5fd6SKishon Vijay Abraham I {0xFE0A, SIERRA_DET_STANDEC_A_PREG}, 2226aead5fd6SKishon Vijay Abraham I {0x000F, SIERRA_DET_STANDEC_B_PREG}, 22272bcf14caSSanket Parmar {0x55A5, SIERRA_DET_STANDEC_C_PREG}, 2228871002d7SAnil Varughese {0x69ad, SIERRA_DET_STANDEC_D_PREG}, 2229aead5fd6SKishon Vijay Abraham I {0x0241, SIERRA_DET_STANDEC_E_PREG}, 22302bcf14caSSanket Parmar {0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, 2231871002d7SAnil Varughese {0x0014, SIERRA_PSM_A0IN_TMR_PREG}, 2232aead5fd6SKishon Vijay Abraham I {0xCF00, SIERRA_PSM_DIAG_PREG}, 2233aead5fd6SKishon Vijay Abraham I {0x001F, SIERRA_PSC_TX_A0_PREG}, 2234aead5fd6SKishon Vijay Abraham I {0x0007, SIERRA_PSC_TX_A1_PREG}, 2235aead5fd6SKishon Vijay Abraham I {0x0003, SIERRA_PSC_TX_A2_PREG}, 2236aead5fd6SKishon Vijay Abraham I {0x0003, SIERRA_PSC_TX_A3_PREG}, 2237aead5fd6SKishon Vijay Abraham I {0x0FFF, SIERRA_PSC_RX_A0_PREG}, 22382bcf14caSSanket Parmar {0x0003, SIERRA_PSC_RX_A1_PREG}, 2239aead5fd6SKishon Vijay Abraham I {0x0003, SIERRA_PSC_RX_A2_PREG}, 2240aead5fd6SKishon Vijay Abraham I {0x0001, SIERRA_PSC_RX_A3_PREG}, 2241aead5fd6SKishon Vijay Abraham I {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG}, 2242aead5fd6SKishon Vijay Abraham I {0x0406, SIERRA_PLLCTRL_GEN_D_PREG}, 2243871002d7SAnil Varughese {0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG}, 2244871002d7SAnil Varughese {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG}, 2245871002d7SAnil Varughese {0x2512, SIERRA_DFE_BIASTRIM_PREG}, 2246aead5fd6SKishon Vijay Abraham I {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 22472bcf14caSSanket Parmar {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, 22482bcf14caSSanket Parmar {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 22492bcf14caSSanket Parmar {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 2250aead5fd6SKishon Vijay Abraham I {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 22512bcf14caSSanket Parmar {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 2252aead5fd6SKishon Vijay Abraham I {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, 2253871002d7SAnil Varughese {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 22542bcf14caSSanket Parmar {0x0000, SIERRA_CREQ_SPARE_PREG}, 2255871002d7SAnil Varughese {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 22562bcf14caSSanket Parmar {0x8452, SIERRA_CTLELUT_CTRL_PREG}, 22572bcf14caSSanket Parmar {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, 22582bcf14caSSanket Parmar {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, 22592bcf14caSSanket Parmar {0x0003, SIERRA_DEQ_PHALIGN_CTRL}, 2260871002d7SAnil Varughese {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG}, 2261871002d7SAnil Varughese {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 2262871002d7SAnil Varughese {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 2263871002d7SAnil Varughese {0x0048, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 2264871002d7SAnil Varughese {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 2265871002d7SAnil Varughese {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG}, 2266871002d7SAnil Varughese {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG}, 22672bcf14caSSanket Parmar {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, 2268871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT0}, 2269871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT1}, 2270871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT2}, 2271871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT3}, 2272871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT4}, 2273871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT5}, 2274871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT6}, 2275871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT7}, 2276871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT8}, 2277871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT9}, 2278871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT10}, 2279871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT11}, 2280871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT12}, 2281871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT13}, 2282871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT14}, 2283871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT15}, 2284871002d7SAnil Varughese {0x0014, SIERRA_DEQ_GLUT16}, 2285871002d7SAnil Varughese {0x0BAE, SIERRA_DEQ_ALUT0}, 2286871002d7SAnil Varughese {0x0AEB, SIERRA_DEQ_ALUT1}, 2287871002d7SAnil Varughese {0x0A28, SIERRA_DEQ_ALUT2}, 2288871002d7SAnil Varughese {0x0965, SIERRA_DEQ_ALUT3}, 2289871002d7SAnil Varughese {0x08A2, SIERRA_DEQ_ALUT4}, 2290871002d7SAnil Varughese {0x07DF, SIERRA_DEQ_ALUT5}, 2291871002d7SAnil Varughese {0x071C, SIERRA_DEQ_ALUT6}, 2292871002d7SAnil Varughese {0x0659, SIERRA_DEQ_ALUT7}, 2293871002d7SAnil Varughese {0x0596, SIERRA_DEQ_ALUT8}, 2294871002d7SAnil Varughese {0x0514, SIERRA_DEQ_ALUT9}, 2295871002d7SAnil Varughese {0x0492, SIERRA_DEQ_ALUT10}, 2296871002d7SAnil Varughese {0x0410, SIERRA_DEQ_ALUT11}, 2297871002d7SAnil Varughese {0x038E, SIERRA_DEQ_ALUT12}, 2298871002d7SAnil Varughese {0x030C, SIERRA_DEQ_ALUT13}, 2299871002d7SAnil Varughese {0x03F4, SIERRA_DEQ_DFETAP_CTRL_PREG}, 2300871002d7SAnil Varughese {0x0001, SIERRA_DFE_EN_1010_IGNORE_PREG}, 2301871002d7SAnil Varughese {0x3C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG}, 2302871002d7SAnil Varughese {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 2303871002d7SAnil Varughese {0x1C08, SIERRA_DEQ_TAU_CTRL2_PREG}, 2304871002d7SAnil Varughese {0x0033, SIERRA_DEQ_PICTRL_PREG}, 2305871002d7SAnil Varughese {0x0400, SIERRA_CPICAL_TMRVAL_MODE1_PREG}, 2306871002d7SAnil Varughese {0x0330, SIERRA_CPICAL_TMRVAL_MODE0_PREG}, 2307871002d7SAnil Varughese {0x01FF, SIERRA_CPICAL_PICNT_MODE1_PREG}, 2308aead5fd6SKishon Vijay Abraham I {0x0009, SIERRA_CPI_OUTBUF_RATESEL_PREG}, 2309871002d7SAnil Varughese {0x3232, SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG}, 2310871002d7SAnil Varughese {0x0005, SIERRA_LFPSDET_SUPPORT_PREG}, 2311aead5fd6SKishon Vijay Abraham I {0x000F, SIERRA_LFPSFILT_NS_PREG}, 2312aead5fd6SKishon Vijay Abraham I {0x0009, SIERRA_LFPSFILT_RD_PREG}, 2313aead5fd6SKishon Vijay Abraham I {0x0001, SIERRA_LFPSFILT_MP_PREG}, 23142bcf14caSSanket Parmar {0x6013, SIERRA_SIGDET_SUPPORT_PREG}, 2315aead5fd6SKishon Vijay Abraham I {0x8013, SIERRA_SDFILT_H2L_A_PREG}, 2316871002d7SAnil Varughese {0x8009, SIERRA_SDFILT_L2H_PREG}, 2317871002d7SAnil Varughese {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG}, 2318871002d7SAnil Varughese {0x0020, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 2319871002d7SAnil Varughese {0x4243, SIERRA_RXBUFFER_DFECTRL_PREG} 232044d30d62SAlan Douglas }; 232144d30d62SAlan Douglas 2322078e9e92SSwapnil Jakhade static struct cdns_sierra_vals usb_100_ext_ssc_cmn_vals = { 2323078e9e92SSwapnil Jakhade .reg_pairs = cdns_usb_cmn_regs_ext_ssc, 2324078e9e92SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_usb_cmn_regs_ext_ssc), 2325078e9e92SSwapnil Jakhade }; 2326078e9e92SSwapnil Jakhade 2327078e9e92SSwapnil Jakhade static struct cdns_sierra_vals usb_100_ext_ssc_ln_vals = { 2328078e9e92SSwapnil Jakhade .reg_pairs = cdns_usb_ln_regs_ext_ssc, 2329078e9e92SSwapnil Jakhade .num_regs = ARRAY_SIZE(cdns_usb_ln_regs_ext_ssc), 2330078e9e92SSwapnil Jakhade }; 2331078e9e92SSwapnil Jakhade 233244d30d62SAlan Douglas static const struct cdns_sierra_data cdns_map_sierra = { 2333078e9e92SSwapnil Jakhade .id_value = SIERRA_MACRO_ID, 2334078e9e92SSwapnil Jakhade .block_offset_shift = 0x2, 2335078e9e92SSwapnil Jakhade .reg_offset_shift = 0x2, 2336fa105172SSwapnil Jakhade .pcs_cmn_vals = { 2337fa105172SSwapnil Jakhade [TYPE_PCIE] = { 2338fa105172SSwapnil Jakhade [TYPE_NONE] = { 23397a5ad9b4SSwapnil Jakhade [NO_SSC] = &pcie_phy_pcs_cmn_vals, 2340fa105172SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 23417a5ad9b4SSwapnil Jakhade [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 2342fa105172SSwapnil Jakhade }, 23438a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 23448a1b82d7SSwapnil Jakhade [NO_SSC] = &pcie_phy_pcs_cmn_vals, 23458a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 23468a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 23478a1b82d7SSwapnil Jakhade }, 2348fa105172SSwapnil Jakhade }, 2349fa105172SSwapnil Jakhade }, 2350078e9e92SSwapnil Jakhade .pma_cmn_vals = { 2351078e9e92SSwapnil Jakhade [TYPE_PCIE] = { 2352078e9e92SSwapnil Jakhade [TYPE_NONE] = { 23537a5ad9b4SSwapnil Jakhade [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 2354078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals, 23557a5ad9b4SSwapnil Jakhade [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 2356078e9e92SSwapnil Jakhade }, 23578a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 23588a1b82d7SSwapnil Jakhade [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals, 23598a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals, 23608a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals, 23618a1b82d7SSwapnil Jakhade }, 2362078e9e92SSwapnil Jakhade }, 2363078e9e92SSwapnil Jakhade [TYPE_USB] = { 2364078e9e92SSwapnil Jakhade [TYPE_NONE] = { 2365078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals, 2366078e9e92SSwapnil Jakhade }, 2367078e9e92SSwapnil Jakhade }, 23688a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 23698a1b82d7SSwapnil Jakhade [TYPE_PCIE] = { 23708a1b82d7SSwapnil Jakhade [NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 23718a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 23728a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 23738a1b82d7SSwapnil Jakhade }, 23748a1b82d7SSwapnil Jakhade }, 2375078e9e92SSwapnil Jakhade }, 2376078e9e92SSwapnil Jakhade .pma_ln_vals = { 2377078e9e92SSwapnil Jakhade [TYPE_PCIE] = { 2378078e9e92SSwapnil Jakhade [TYPE_NONE] = { 23797a5ad9b4SSwapnil Jakhade [NO_SSC] = &pcie_100_no_ssc_ln_vals, 2380078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals, 23817a5ad9b4SSwapnil Jakhade [INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals, 2382078e9e92SSwapnil Jakhade }, 23838a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 23848a1b82d7SSwapnil Jakhade [NO_SSC] = &ml_pcie_100_no_ssc_ln_vals, 23858a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals, 23868a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals, 23878a1b82d7SSwapnil Jakhade }, 2388078e9e92SSwapnil Jakhade }, 2389078e9e92SSwapnil Jakhade [TYPE_USB] = { 2390078e9e92SSwapnil Jakhade [TYPE_NONE] = { 2391078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals, 2392078e9e92SSwapnil Jakhade }, 2393078e9e92SSwapnil Jakhade }, 23948a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 23958a1b82d7SSwapnil Jakhade [TYPE_PCIE] = { 23968a1b82d7SSwapnil Jakhade [NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 23978a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 23988a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 23998a1b82d7SSwapnil Jakhade }, 24008a1b82d7SSwapnil Jakhade }, 2401078e9e92SSwapnil Jakhade }, 240244d30d62SAlan Douglas }; 240344d30d62SAlan Douglas 2404367da978SKishon Vijay Abraham I static const struct cdns_sierra_data cdns_ti_map_sierra = { 2405078e9e92SSwapnil Jakhade .id_value = SIERRA_MACRO_ID, 2406078e9e92SSwapnil Jakhade .block_offset_shift = 0x0, 2407078e9e92SSwapnil Jakhade .reg_offset_shift = 0x1, 2408fa105172SSwapnil Jakhade .pcs_cmn_vals = { 2409fa105172SSwapnil Jakhade [TYPE_PCIE] = { 2410fa105172SSwapnil Jakhade [TYPE_NONE] = { 24117a5ad9b4SSwapnil Jakhade [NO_SSC] = &pcie_phy_pcs_cmn_vals, 2412fa105172SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 24137a5ad9b4SSwapnil Jakhade [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 2414fa105172SSwapnil Jakhade }, 24158a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 24168a1b82d7SSwapnil Jakhade [NO_SSC] = &pcie_phy_pcs_cmn_vals, 24178a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 24188a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 24198a1b82d7SSwapnil Jakhade }, 24208a1b82d7SSwapnil Jakhade }, 24218a1b82d7SSwapnil Jakhade }, 24228a1b82d7SSwapnil Jakhade .phy_pma_ln_vals = { 24238a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 24248a1b82d7SSwapnil Jakhade [TYPE_PCIE] = { 24258a1b82d7SSwapnil Jakhade [NO_SSC] = &qsgmii_phy_pma_ln_vals, 24268a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &qsgmii_phy_pma_ln_vals, 24278a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &qsgmii_phy_pma_ln_vals, 24288a1b82d7SSwapnil Jakhade }, 2429fa105172SSwapnil Jakhade }, 2430fa105172SSwapnil Jakhade }, 2431078e9e92SSwapnil Jakhade .pma_cmn_vals = { 2432078e9e92SSwapnil Jakhade [TYPE_PCIE] = { 2433078e9e92SSwapnil Jakhade [TYPE_NONE] = { 24347a5ad9b4SSwapnil Jakhade [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 2435078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals, 24367a5ad9b4SSwapnil Jakhade [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 2437078e9e92SSwapnil Jakhade }, 24388a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 24398a1b82d7SSwapnil Jakhade [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals, 24408a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals, 24418a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals, 24428a1b82d7SSwapnil Jakhade }, 2443078e9e92SSwapnil Jakhade }, 2444078e9e92SSwapnil Jakhade [TYPE_USB] = { 2445078e9e92SSwapnil Jakhade [TYPE_NONE] = { 2446078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals, 2447078e9e92SSwapnil Jakhade }, 2448078e9e92SSwapnil Jakhade }, 24498a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 24508a1b82d7SSwapnil Jakhade [TYPE_PCIE] = { 24518a1b82d7SSwapnil Jakhade [NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 24528a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 24538a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 24548a1b82d7SSwapnil Jakhade }, 24558a1b82d7SSwapnil Jakhade }, 2456078e9e92SSwapnil Jakhade }, 2457078e9e92SSwapnil Jakhade .pma_ln_vals = { 2458078e9e92SSwapnil Jakhade [TYPE_PCIE] = { 2459078e9e92SSwapnil Jakhade [TYPE_NONE] = { 24607a5ad9b4SSwapnil Jakhade [NO_SSC] = &pcie_100_no_ssc_ln_vals, 2461078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals, 24627a5ad9b4SSwapnil Jakhade [INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals, 2463078e9e92SSwapnil Jakhade }, 24648a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 2465e72659b6SSwapnil Jakhade [NO_SSC] = &ti_ml_pcie_100_no_ssc_ln_vals, 2466e72659b6SSwapnil Jakhade [EXTERNAL_SSC] = &ti_ml_pcie_100_ext_ssc_ln_vals, 2467e72659b6SSwapnil Jakhade [INTERNAL_SSC] = &ti_ml_pcie_100_int_ssc_ln_vals, 24688a1b82d7SSwapnil Jakhade }, 2469078e9e92SSwapnil Jakhade }, 2470078e9e92SSwapnil Jakhade [TYPE_USB] = { 2471078e9e92SSwapnil Jakhade [TYPE_NONE] = { 2472078e9e92SSwapnil Jakhade [EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals, 2473078e9e92SSwapnil Jakhade }, 2474078e9e92SSwapnil Jakhade }, 24758a1b82d7SSwapnil Jakhade [TYPE_QSGMII] = { 24768a1b82d7SSwapnil Jakhade [TYPE_PCIE] = { 24778a1b82d7SSwapnil Jakhade [NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 24788a1b82d7SSwapnil Jakhade [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 24798a1b82d7SSwapnil Jakhade [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 24808a1b82d7SSwapnil Jakhade }, 24818a1b82d7SSwapnil Jakhade }, 2482078e9e92SSwapnil Jakhade }, 2483367da978SKishon Vijay Abraham I }; 2484367da978SKishon Vijay Abraham I 248544d30d62SAlan Douglas static const struct of_device_id cdns_sierra_id_table[] = { 248644d30d62SAlan Douglas { 248744d30d62SAlan Douglas .compatible = "cdns,sierra-phy-t0", 248844d30d62SAlan Douglas .data = &cdns_map_sierra, 248944d30d62SAlan Douglas }, 2490367da978SKishon Vijay Abraham I { 2491367da978SKishon Vijay Abraham I .compatible = "ti,sierra-phy-t0", 2492367da978SKishon Vijay Abraham I .data = &cdns_ti_map_sierra, 2493367da978SKishon Vijay Abraham I }, 249444d30d62SAlan Douglas {} 249544d30d62SAlan Douglas }; 249644d30d62SAlan Douglas MODULE_DEVICE_TABLE(of, cdns_sierra_id_table); 249744d30d62SAlan Douglas 249844d30d62SAlan Douglas static struct platform_driver cdns_sierra_driver = { 249944d30d62SAlan Douglas .probe = cdns_sierra_phy_probe, 2500e9ddb1adSUwe Kleine-König .remove_new = cdns_sierra_phy_remove, 250144d30d62SAlan Douglas .driver = { 250244d30d62SAlan Douglas .name = "cdns-sierra-phy", 250344d30d62SAlan Douglas .of_match_table = cdns_sierra_id_table, 250444d30d62SAlan Douglas }, 250544d30d62SAlan Douglas }; 250644d30d62SAlan Douglas module_platform_driver(cdns_sierra_driver); 250744d30d62SAlan Douglas 250844d30d62SAlan Douglas MODULE_ALIAS("platform:cdns_sierra"); 250944d30d62SAlan Douglas MODULE_AUTHOR("Cadence Design Systems"); 251044d30d62SAlan Douglas MODULE_DESCRIPTION("CDNS sierra phy driver"); 251144d30d62SAlan Douglas MODULE_LICENSE("GPL v2"); 2512