162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Cadence Sierra PHY Driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (c) 2018 Cadence Design Systems 662306a36Sopenharmony_ci * Author: Alan Douglas <adouglas@cadence.com> 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci#include <linux/clk.h> 1062306a36Sopenharmony_ci#include <linux/clk-provider.h> 1162306a36Sopenharmony_ci#include <linux/delay.h> 1262306a36Sopenharmony_ci#include <linux/err.h> 1362306a36Sopenharmony_ci#include <linux/io.h> 1462306a36Sopenharmony_ci#include <linux/module.h> 1562306a36Sopenharmony_ci#include <linux/phy/phy.h> 1662306a36Sopenharmony_ci#include <linux/platform_device.h> 1762306a36Sopenharmony_ci#include <linux/pm_runtime.h> 1862306a36Sopenharmony_ci#include <linux/regmap.h> 1962306a36Sopenharmony_ci#include <linux/reset.h> 2062306a36Sopenharmony_ci#include <linux/slab.h> 2162306a36Sopenharmony_ci#include <linux/of.h> 2262306a36Sopenharmony_ci#include <linux/of_platform.h> 2362306a36Sopenharmony_ci#include <dt-bindings/phy/phy.h> 2462306a36Sopenharmony_ci#include <dt-bindings/phy/phy-cadence.h> 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define NUM_SSC_MODE 3 2762306a36Sopenharmony_ci#define NUM_PHY_TYPE 5 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* PHY register offsets */ 3062306a36Sopenharmony_ci#define SIERRA_COMMON_CDB_OFFSET 0x0 3162306a36Sopenharmony_ci#define SIERRA_MACRO_ID_REG 0x0 3262306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_GEN_PREG 0x42 3362306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_FBDIV_INT_MODE0_PREG 0x43 3462306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_DCOCAL_CTRL_PREG 0x45 3562306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_INIT_PREG 0x46 3662306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_ITERTMR_PREG 0x47 3762306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_MODE_PREG 0x48 3862306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG 0x49 3962306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG 0x4A 4062306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_LOCK_CNTSTART_PREG 0x4B 4162306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_LOCKSEARCH_PREG 0x4C 4262306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_CLK1_PREG 0x4D 4362306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_CLK0_PREG 0x4E 4462306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG 0x4F 4562306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG 0x50 4662306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_DSMCORR_PREG 0x51 4762306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_SS_PREG 0x52 4862306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG 0x53 4962306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_SSTWOPT_PREG 0x54 5062306a36Sopenharmony_ci#define SIERRA_CMN_PLLCSM_PLLEN_TMR_PREG 0x5D 5162306a36Sopenharmony_ci#define SIERRA_CMN_PLLCSM_PLLPRE_TMR_PREG 0x5E 5262306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG 0x62 5362306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG 0x63 5462306a36Sopenharmony_ci#define SIERRA_SDOSCCAL_CLK_CNT_PREG 0x6E 5562306a36Sopenharmony_ci#define SIERRA_CMN_REFRCV_PREG 0x98 5662306a36Sopenharmony_ci#define SIERRA_CMN_RESCAL_CTRLA_PREG 0xA0 5762306a36Sopenharmony_ci#define SIERRA_CMN_REFRCV1_PREG 0xB8 5862306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_GEN_PREG 0xC2 5962306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_FBDIV_INT_PREG 0xC3 6062306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_DCOCAL_CTRL_PREG 0xC5 6162306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG 0xCA 6262306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_CLK0_PREG 0xCE 6362306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG 0xD0 6462306a36Sopenharmony_ci#define SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG 0xE2 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define SIERRA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 6762306a36Sopenharmony_ci ((0x4000 << (block_offset)) + \ 6862306a36Sopenharmony_ci (((ln) << 9) << (reg_offset))) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define SIERRA_DET_STANDEC_A_PREG 0x000 7162306a36Sopenharmony_ci#define SIERRA_DET_STANDEC_B_PREG 0x001 7262306a36Sopenharmony_ci#define SIERRA_DET_STANDEC_C_PREG 0x002 7362306a36Sopenharmony_ci#define SIERRA_DET_STANDEC_D_PREG 0x003 7462306a36Sopenharmony_ci#define SIERRA_DET_STANDEC_E_PREG 0x004 7562306a36Sopenharmony_ci#define SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG 0x008 7662306a36Sopenharmony_ci#define SIERRA_PSM_A0IN_TMR_PREG 0x009 7762306a36Sopenharmony_ci#define SIERRA_PSM_A3IN_TMR_PREG 0x00C 7862306a36Sopenharmony_ci#define SIERRA_PSM_DIAG_PREG 0x015 7962306a36Sopenharmony_ci#define SIERRA_PSC_LN_A3_PREG 0x023 8062306a36Sopenharmony_ci#define SIERRA_PSC_LN_A4_PREG 0x024 8162306a36Sopenharmony_ci#define SIERRA_PSC_LN_IDLE_PREG 0x026 8262306a36Sopenharmony_ci#define SIERRA_PSC_TX_A0_PREG 0x028 8362306a36Sopenharmony_ci#define SIERRA_PSC_TX_A1_PREG 0x029 8462306a36Sopenharmony_ci#define SIERRA_PSC_TX_A2_PREG 0x02A 8562306a36Sopenharmony_ci#define SIERRA_PSC_TX_A3_PREG 0x02B 8662306a36Sopenharmony_ci#define SIERRA_PSC_RX_A0_PREG 0x030 8762306a36Sopenharmony_ci#define SIERRA_PSC_RX_A1_PREG 0x031 8862306a36Sopenharmony_ci#define SIERRA_PSC_RX_A2_PREG 0x032 8962306a36Sopenharmony_ci#define SIERRA_PSC_RX_A3_PREG 0x033 9062306a36Sopenharmony_ci#define SIERRA_PLLCTRL_FBDIV_MODE01_PREG 0x039 9162306a36Sopenharmony_ci#define SIERRA_PLLCTRL_SUBRATE_PREG 0x03A 9262306a36Sopenharmony_ci#define SIERRA_PLLCTRL_GEN_A_PREG 0x03B 9362306a36Sopenharmony_ci#define SIERRA_PLLCTRL_GEN_D_PREG 0x03E 9462306a36Sopenharmony_ci#define SIERRA_PLLCTRL_CPGAIN_MODE_PREG 0x03F 9562306a36Sopenharmony_ci#define SIERRA_PLLCTRL_STATUS_PREG 0x044 9662306a36Sopenharmony_ci#define SIERRA_CLKPATH_BIASTRIM_PREG 0x04B 9762306a36Sopenharmony_ci#define SIERRA_DFE_BIASTRIM_PREG 0x04C 9862306a36Sopenharmony_ci#define SIERRA_DRVCTRL_ATTEN_PREG 0x06A 9962306a36Sopenharmony_ci#define SIERRA_DRVCTRL_BOOST_PREG 0x06F 10062306a36Sopenharmony_ci#define SIERRA_LANE_TX_RECEIVER_DETECT_PREG 0x071 10162306a36Sopenharmony_ci#define SIERRA_TX_RCVDET_OVRD_PREG 0x072 10262306a36Sopenharmony_ci#define SIERRA_CLKPATHCTRL_TMR_PREG 0x081 10362306a36Sopenharmony_ci#define SIERRA_RX_CREQ_FLTR_A_MODE3_PREG 0x085 10462306a36Sopenharmony_ci#define SIERRA_RX_CREQ_FLTR_A_MODE2_PREG 0x086 10562306a36Sopenharmony_ci#define SIERRA_RX_CREQ_FLTR_A_MODE1_PREG 0x087 10662306a36Sopenharmony_ci#define SIERRA_RX_CREQ_FLTR_A_MODE0_PREG 0x088 10762306a36Sopenharmony_ci#define SIERRA_CREQ_DCBIASATTEN_OVR_PREG 0x08C 10862306a36Sopenharmony_ci#define SIERRA_CREQ_CCLKDET_MODE01_PREG 0x08E 10962306a36Sopenharmony_ci#define SIERRA_RX_CTLE_CAL_PREG 0x08F 11062306a36Sopenharmony_ci#define SIERRA_RX_CTLE_MAINTENANCE_PREG 0x091 11162306a36Sopenharmony_ci#define SIERRA_CREQ_FSMCLK_SEL_PREG 0x092 11262306a36Sopenharmony_ci#define SIERRA_CREQ_EQ_CTRL_PREG 0x093 11362306a36Sopenharmony_ci#define SIERRA_CREQ_SPARE_PREG 0x096 11462306a36Sopenharmony_ci#define SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG 0x097 11562306a36Sopenharmony_ci#define SIERRA_CTLELUT_CTRL_PREG 0x098 11662306a36Sopenharmony_ci#define SIERRA_DEQ_BLK_TAU_CTRL1_PREG 0x0AC 11762306a36Sopenharmony_ci#define SIERRA_DEQ_BLK_TAU_CTRL4_PREG 0x0AF 11862306a36Sopenharmony_ci#define SIERRA_DFE_ECMP_RATESEL_PREG 0x0C0 11962306a36Sopenharmony_ci#define SIERRA_DFE_SMP_RATESEL_PREG 0x0C1 12062306a36Sopenharmony_ci#define SIERRA_DEQ_PHALIGN_CTRL 0x0C4 12162306a36Sopenharmony_ci#define SIERRA_DEQ_CONCUR_CTRL1_PREG 0x0C8 12262306a36Sopenharmony_ci#define SIERRA_DEQ_CONCUR_CTRL2_PREG 0x0C9 12362306a36Sopenharmony_ci#define SIERRA_DEQ_EPIPWR_CTRL2_PREG 0x0CD 12462306a36Sopenharmony_ci#define SIERRA_DEQ_FAST_MAINT_CYCLES_PREG 0x0CE 12562306a36Sopenharmony_ci#define SIERRA_DEQ_ERRCMP_CTRL_PREG 0x0D0 12662306a36Sopenharmony_ci#define SIERRA_DEQ_OFFSET_CTRL_PREG 0x0D8 12762306a36Sopenharmony_ci#define SIERRA_DEQ_GAIN_CTRL_PREG 0x0E0 12862306a36Sopenharmony_ci#define SIERRA_DEQ_VGATUNE_CTRL_PREG 0x0E1 12962306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT0 0x0E8 13062306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT1 0x0E9 13162306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT2 0x0EA 13262306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT3 0x0EB 13362306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT4 0x0EC 13462306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT5 0x0ED 13562306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT6 0x0EE 13662306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT7 0x0EF 13762306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT8 0x0F0 13862306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT9 0x0F1 13962306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT10 0x0F2 14062306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT11 0x0F3 14162306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT12 0x0F4 14262306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT13 0x0F5 14362306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT14 0x0F6 14462306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT15 0x0F7 14562306a36Sopenharmony_ci#define SIERRA_DEQ_GLUT16 0x0F8 14662306a36Sopenharmony_ci#define SIERRA_POSTPRECUR_EN_CEPH_CTRL_PREG 0x0F9 14762306a36Sopenharmony_ci#define SIERRA_TAU_EN_CEPH2TO0_PREG 0x0FB 14862306a36Sopenharmony_ci#define SIERRA_TAU_EN_CEPH5TO3_PREG 0x0FC 14962306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT0 0x108 15062306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT1 0x109 15162306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT2 0x10A 15262306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT3 0x10B 15362306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT4 0x10C 15462306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT5 0x10D 15562306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT6 0x10E 15662306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT7 0x10F 15762306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT8 0x110 15862306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT9 0x111 15962306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT10 0x112 16062306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT11 0x113 16162306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT12 0x114 16262306a36Sopenharmony_ci#define SIERRA_DEQ_ALUT13 0x115 16362306a36Sopenharmony_ci#define SIERRA_OEPH_EN_CTRL_PREG 0x124 16462306a36Sopenharmony_ci#define SIERRA_DEQ_DFETAP_CTRL_PREG 0x128 16562306a36Sopenharmony_ci#define SIERRA_DEQ_DFETAP0 0x129 16662306a36Sopenharmony_ci#define SIERRA_DEQ_DFETAP1 0x12B 16762306a36Sopenharmony_ci#define SIERRA_DEQ_DFETAP2 0x12D 16862306a36Sopenharmony_ci#define SIERRA_DEQ_DFETAP3 0x12F 16962306a36Sopenharmony_ci#define SIERRA_DEQ_DFETAP4 0x131 17062306a36Sopenharmony_ci#define SIERRA_DFE_EN_1010_IGNORE_PREG 0x134 17162306a36Sopenharmony_ci#define SIERRA_DEQ_PRECUR_PREG 0x138 17262306a36Sopenharmony_ci#define SIERRA_DEQ_POSTCUR_PREG 0x140 17362306a36Sopenharmony_ci#define SIERRA_DEQ_POSTCUR_DECR_PREG 0x142 17462306a36Sopenharmony_ci#define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150 17562306a36Sopenharmony_ci#define SIERRA_DEQ_TAU_CTRL2_PREG 0x151 17662306a36Sopenharmony_ci#define SIERRA_DEQ_TAU_CTRL3_PREG 0x152 17762306a36Sopenharmony_ci#define SIERRA_DEQ_OPENEYE_CTRL_PREG 0x158 17862306a36Sopenharmony_ci#define SIERRA_DEQ_CONCUR_EPIOFFSET_MODE_PREG 0x159 17962306a36Sopenharmony_ci#define SIERRA_DEQ_PICTRL_PREG 0x161 18062306a36Sopenharmony_ci#define SIERRA_CPICAL_TMRVAL_MODE1_PREG 0x170 18162306a36Sopenharmony_ci#define SIERRA_CPICAL_TMRVAL_MODE0_PREG 0x171 18262306a36Sopenharmony_ci#define SIERRA_CPICAL_PICNT_MODE1_PREG 0x174 18362306a36Sopenharmony_ci#define SIERRA_CPI_OUTBUF_RATESEL_PREG 0x17C 18462306a36Sopenharmony_ci#define SIERRA_CPI_RESBIAS_BIN_PREG 0x17E 18562306a36Sopenharmony_ci#define SIERRA_CPI_TRIM_PREG 0x17F 18662306a36Sopenharmony_ci#define SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG 0x183 18762306a36Sopenharmony_ci#define SIERRA_CPICAL_RES_STARTCODE_MODE01_PREG 0x184 18862306a36Sopenharmony_ci#define SIERRA_EPI_CTRL_PREG 0x187 18962306a36Sopenharmony_ci#define SIERRA_LFPSDET_SUPPORT_PREG 0x188 19062306a36Sopenharmony_ci#define SIERRA_LFPSFILT_NS_PREG 0x18A 19162306a36Sopenharmony_ci#define SIERRA_LFPSFILT_RD_PREG 0x18B 19262306a36Sopenharmony_ci#define SIERRA_LFPSFILT_MP_PREG 0x18C 19362306a36Sopenharmony_ci#define SIERRA_SIGDET_SUPPORT_PREG 0x190 19462306a36Sopenharmony_ci#define SIERRA_SDFILT_H2L_A_PREG 0x191 19562306a36Sopenharmony_ci#define SIERRA_SDFILT_L2H_PREG 0x193 19662306a36Sopenharmony_ci#define SIERRA_RXBUFFER_CTLECTRL_PREG 0x19E 19762306a36Sopenharmony_ci#define SIERRA_RXBUFFER_RCDFECTRL_PREG 0x19F 19862306a36Sopenharmony_ci#define SIERRA_RXBUFFER_DFECTRL_PREG 0x1A0 19962306a36Sopenharmony_ci#define SIERRA_LN_SPARE_REG_PREG 0x1B0 20062306a36Sopenharmony_ci#define SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG 0x14F 20162306a36Sopenharmony_ci#define SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG 0x150 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci/* PHY PCS common registers */ 20462306a36Sopenharmony_ci#define SIERRA_PHY_PCS_COMMON_OFFSET(block_offset) \ 20562306a36Sopenharmony_ci (0xc000 << (block_offset)) 20662306a36Sopenharmony_ci#define SIERRA_PHY_PIPE_CMN_CTRL1 0x0 20762306a36Sopenharmony_ci#define SIERRA_PHY_PLL_CFG 0xe 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci/* PHY PCS lane registers */ 21062306a36Sopenharmony_ci#define SIERRA_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 21162306a36Sopenharmony_ci ((0xD000 << (block_offset)) + \ 21262306a36Sopenharmony_ci (((ln) << 8) << (reg_offset))) 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci#define SIERRA_PHY_ISO_LINK_CTRL 0xB 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci/* PHY PMA common registers */ 21762306a36Sopenharmony_ci#define SIERRA_PHY_PMA_COMMON_OFFSET(block_offset) \ 21862306a36Sopenharmony_ci (0xE000 << (block_offset)) 21962306a36Sopenharmony_ci#define SIERRA_PHY_PMA_CMN_CTRL 0x000 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci/* PHY PMA lane registers */ 22262306a36Sopenharmony_ci#define SIERRA_PHY_PMA_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 22362306a36Sopenharmony_ci ((0xF000 << (block_offset)) + \ 22462306a36Sopenharmony_ci (((ln) << 8) << (reg_offset))) 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci#define SIERRA_PHY_PMA_XCVR_CTRL 0x000 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci#define SIERRA_MACRO_ID 0x00007364 22962306a36Sopenharmony_ci#define SIERRA_MAX_LANES 16 23062306a36Sopenharmony_ci#define PLL_LOCK_TIME 100000 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci#define CDNS_SIERRA_OUTPUT_CLOCKS 3 23362306a36Sopenharmony_ci#define CDNS_SIERRA_INPUT_CLOCKS 3 23462306a36Sopenharmony_cienum cdns_sierra_clock_input { 23562306a36Sopenharmony_ci PHY_CLK, 23662306a36Sopenharmony_ci CMN_REFCLK_DIG_DIV, 23762306a36Sopenharmony_ci CMN_REFCLK1_DIG_DIV, 23862306a36Sopenharmony_ci}; 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci#define SIERRA_NUM_CMN_PLLC 2 24162306a36Sopenharmony_ci#define SIERRA_NUM_CMN_PLLC_PARENTS 2 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_cistatic const struct reg_field macro_id_type = 24462306a36Sopenharmony_ci REG_FIELD(SIERRA_MACRO_ID_REG, 0, 15); 24562306a36Sopenharmony_cistatic const struct reg_field phy_pll_cfg_1 = 24662306a36Sopenharmony_ci REG_FIELD(SIERRA_PHY_PLL_CFG, 1, 1); 24762306a36Sopenharmony_cistatic const struct reg_field pma_cmn_ready = 24862306a36Sopenharmony_ci REG_FIELD(SIERRA_PHY_PMA_CMN_CTRL, 0, 0); 24962306a36Sopenharmony_cistatic const struct reg_field pllctrl_lock = 25062306a36Sopenharmony_ci REG_FIELD(SIERRA_PLLCTRL_STATUS_PREG, 0, 0); 25162306a36Sopenharmony_cistatic const struct reg_field phy_iso_link_ctrl_1 = 25262306a36Sopenharmony_ci REG_FIELD(SIERRA_PHY_ISO_LINK_CTRL, 1, 1); 25362306a36Sopenharmony_cistatic const struct reg_field cmn_plllc_clk1outdiv_preg = 25462306a36Sopenharmony_ci REG_FIELD(SIERRA_CMN_PLLLC_CLK1_PREG, 0, 6); 25562306a36Sopenharmony_cistatic const struct reg_field cmn_plllc_clk1_en_preg = 25662306a36Sopenharmony_ci REG_FIELD(SIERRA_CMN_PLLLC_CLK1_PREG, 12, 12); 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_cistatic const char * const clk_names[] = { 25962306a36Sopenharmony_ci [CDNS_SIERRA_PLL_CMNLC] = "pll_cmnlc", 26062306a36Sopenharmony_ci [CDNS_SIERRA_PLL_CMNLC1] = "pll_cmnlc1", 26162306a36Sopenharmony_ci [CDNS_SIERRA_DERIVED_REFCLK] = "refclk_der", 26262306a36Sopenharmony_ci}; 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_cienum cdns_sierra_cmn_plllc { 26562306a36Sopenharmony_ci CMN_PLLLC, 26662306a36Sopenharmony_ci CMN_PLLLC1, 26762306a36Sopenharmony_ci}; 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_cistruct cdns_sierra_pll_mux_reg_fields { 27062306a36Sopenharmony_ci struct reg_field pfdclk_sel_preg; 27162306a36Sopenharmony_ci struct reg_field plllc1en_field; 27262306a36Sopenharmony_ci struct reg_field termen_field; 27362306a36Sopenharmony_ci}; 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_cistatic const struct cdns_sierra_pll_mux_reg_fields cmn_plllc_pfdclk1_sel_preg[] = { 27662306a36Sopenharmony_ci [CMN_PLLLC] = { 27762306a36Sopenharmony_ci .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC_GEN_PREG, 1, 1), 27862306a36Sopenharmony_ci .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 8, 8), 27962306a36Sopenharmony_ci .termen_field = REG_FIELD(SIERRA_CMN_REFRCV1_PREG, 0, 0), 28062306a36Sopenharmony_ci }, 28162306a36Sopenharmony_ci [CMN_PLLLC1] = { 28262306a36Sopenharmony_ci .pfdclk_sel_preg = REG_FIELD(SIERRA_CMN_PLLLC1_GEN_PREG, 1, 1), 28362306a36Sopenharmony_ci .plllc1en_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 8, 8), 28462306a36Sopenharmony_ci .termen_field = REG_FIELD(SIERRA_CMN_REFRCV_PREG, 0, 0), 28562306a36Sopenharmony_ci }, 28662306a36Sopenharmony_ci}; 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_cistruct cdns_sierra_pll_mux { 28962306a36Sopenharmony_ci struct clk_hw hw; 29062306a36Sopenharmony_ci struct regmap_field *pfdclk_sel_preg; 29162306a36Sopenharmony_ci struct regmap_field *plllc1en_field; 29262306a36Sopenharmony_ci struct regmap_field *termen_field; 29362306a36Sopenharmony_ci struct clk_init_data clk_data; 29462306a36Sopenharmony_ci}; 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci#define to_cdns_sierra_pll_mux(_hw) \ 29762306a36Sopenharmony_ci container_of(_hw, struct cdns_sierra_pll_mux, hw) 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ci#define PLL0_REFCLK_NAME "pll0_refclk" 30062306a36Sopenharmony_ci#define PLL1_REFCLK_NAME "pll1_refclk" 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_cistatic const struct clk_parent_data pll_mux_parent_data[][SIERRA_NUM_CMN_PLLC_PARENTS] = { 30362306a36Sopenharmony_ci [CMN_PLLLC] = { 30462306a36Sopenharmony_ci { .fw_name = PLL0_REFCLK_NAME }, 30562306a36Sopenharmony_ci { .fw_name = PLL1_REFCLK_NAME } 30662306a36Sopenharmony_ci }, 30762306a36Sopenharmony_ci [CMN_PLLLC1] = { 30862306a36Sopenharmony_ci { .fw_name = PLL1_REFCLK_NAME }, 30962306a36Sopenharmony_ci { .fw_name = PLL0_REFCLK_NAME } 31062306a36Sopenharmony_ci }, 31162306a36Sopenharmony_ci}; 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_cistatic u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS] = { 31462306a36Sopenharmony_ci [CMN_PLLLC] = { 0, 1 }, 31562306a36Sopenharmony_ci [CMN_PLLLC1] = { 1, 0 }, 31662306a36Sopenharmony_ci}; 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_cistruct cdns_sierra_derived_refclk { 31962306a36Sopenharmony_ci struct clk_hw hw; 32062306a36Sopenharmony_ci struct regmap_field *cmn_plllc_clk1outdiv_preg; 32162306a36Sopenharmony_ci struct regmap_field *cmn_plllc_clk1_en_preg; 32262306a36Sopenharmony_ci struct clk_init_data clk_data; 32362306a36Sopenharmony_ci}; 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci#define to_cdns_sierra_derived_refclk(_hw) \ 32662306a36Sopenharmony_ci container_of(_hw, struct cdns_sierra_derived_refclk, hw) 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_cienum cdns_sierra_phy_type { 32962306a36Sopenharmony_ci TYPE_NONE, 33062306a36Sopenharmony_ci TYPE_PCIE, 33162306a36Sopenharmony_ci TYPE_USB, 33262306a36Sopenharmony_ci TYPE_SGMII, 33362306a36Sopenharmony_ci TYPE_QSGMII 33462306a36Sopenharmony_ci}; 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_cienum cdns_sierra_ssc_mode { 33762306a36Sopenharmony_ci NO_SSC, 33862306a36Sopenharmony_ci EXTERNAL_SSC, 33962306a36Sopenharmony_ci INTERNAL_SSC 34062306a36Sopenharmony_ci}; 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_cistruct cdns_sierra_inst { 34362306a36Sopenharmony_ci struct phy *phy; 34462306a36Sopenharmony_ci enum cdns_sierra_phy_type phy_type; 34562306a36Sopenharmony_ci u32 num_lanes; 34662306a36Sopenharmony_ci u32 mlane; 34762306a36Sopenharmony_ci struct reset_control *lnk_rst; 34862306a36Sopenharmony_ci enum cdns_sierra_ssc_mode ssc_mode; 34962306a36Sopenharmony_ci}; 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_cistruct cdns_reg_pairs { 35262306a36Sopenharmony_ci u16 val; 35362306a36Sopenharmony_ci u32 off; 35462306a36Sopenharmony_ci}; 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_cistruct cdns_sierra_vals { 35762306a36Sopenharmony_ci const struct cdns_reg_pairs *reg_pairs; 35862306a36Sopenharmony_ci u32 num_regs; 35962306a36Sopenharmony_ci}; 36062306a36Sopenharmony_ci 36162306a36Sopenharmony_cistruct cdns_sierra_data { 36262306a36Sopenharmony_ci u32 id_value; 36362306a36Sopenharmony_ci u8 block_offset_shift; 36462306a36Sopenharmony_ci u8 reg_offset_shift; 36562306a36Sopenharmony_ci struct cdns_sierra_vals *pcs_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 36662306a36Sopenharmony_ci [NUM_SSC_MODE]; 36762306a36Sopenharmony_ci struct cdns_sierra_vals *phy_pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 36862306a36Sopenharmony_ci [NUM_SSC_MODE]; 36962306a36Sopenharmony_ci struct cdns_sierra_vals *pma_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 37062306a36Sopenharmony_ci [NUM_SSC_MODE]; 37162306a36Sopenharmony_ci struct cdns_sierra_vals *pma_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 37262306a36Sopenharmony_ci [NUM_SSC_MODE]; 37362306a36Sopenharmony_ci}; 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_cistruct cdns_regmap_cdb_context { 37662306a36Sopenharmony_ci struct device *dev; 37762306a36Sopenharmony_ci void __iomem *base; 37862306a36Sopenharmony_ci u8 reg_offset_shift; 37962306a36Sopenharmony_ci}; 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_cistruct cdns_sierra_phy { 38262306a36Sopenharmony_ci struct device *dev; 38362306a36Sopenharmony_ci const struct cdns_sierra_data *init_data; 38462306a36Sopenharmony_ci struct cdns_sierra_inst phys[SIERRA_MAX_LANES]; 38562306a36Sopenharmony_ci struct reset_control *phy_rst; 38662306a36Sopenharmony_ci struct reset_control *apb_rst; 38762306a36Sopenharmony_ci struct regmap *regmap_lane_cdb[SIERRA_MAX_LANES]; 38862306a36Sopenharmony_ci struct regmap *regmap_phy_pcs_common_cdb; 38962306a36Sopenharmony_ci struct regmap *regmap_phy_pcs_lane_cdb[SIERRA_MAX_LANES]; 39062306a36Sopenharmony_ci struct regmap *regmap_phy_pma_common_cdb; 39162306a36Sopenharmony_ci struct regmap *regmap_phy_pma_lane_cdb[SIERRA_MAX_LANES]; 39262306a36Sopenharmony_ci struct regmap *regmap_common_cdb; 39362306a36Sopenharmony_ci struct regmap_field *macro_id_type; 39462306a36Sopenharmony_ci struct regmap_field *phy_pll_cfg_1; 39562306a36Sopenharmony_ci struct regmap_field *pma_cmn_ready; 39662306a36Sopenharmony_ci struct regmap_field *pllctrl_lock[SIERRA_MAX_LANES]; 39762306a36Sopenharmony_ci struct regmap_field *phy_iso_link_ctrl_1[SIERRA_MAX_LANES]; 39862306a36Sopenharmony_ci struct regmap_field *cmn_refrcv_refclk_plllc1en_preg[SIERRA_NUM_CMN_PLLC]; 39962306a36Sopenharmony_ci struct regmap_field *cmn_refrcv_refclk_termen_preg[SIERRA_NUM_CMN_PLLC]; 40062306a36Sopenharmony_ci struct regmap_field *cmn_plllc_pfdclk1_sel_preg[SIERRA_NUM_CMN_PLLC]; 40162306a36Sopenharmony_ci struct clk *input_clks[CDNS_SIERRA_INPUT_CLOCKS]; 40262306a36Sopenharmony_ci int nsubnodes; 40362306a36Sopenharmony_ci u32 num_lanes; 40462306a36Sopenharmony_ci bool autoconf; 40562306a36Sopenharmony_ci int already_configured; 40662306a36Sopenharmony_ci struct clk *pll_clks[SIERRA_NUM_CMN_PLLC]; 40762306a36Sopenharmony_ci struct clk_hw_onecell_data clk_data; 40862306a36Sopenharmony_ci}; 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_cistatic int cdns_regmap_write(void *context, unsigned int reg, unsigned int val) 41162306a36Sopenharmony_ci{ 41262306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 41362306a36Sopenharmony_ci u32 offset = reg << ctx->reg_offset_shift; 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci writew(val, ctx->base + offset); 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci return 0; 41862306a36Sopenharmony_ci} 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_cistatic int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val) 42162306a36Sopenharmony_ci{ 42262306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 42362306a36Sopenharmony_ci u32 offset = reg << ctx->reg_offset_shift; 42462306a36Sopenharmony_ci 42562306a36Sopenharmony_ci *val = readw(ctx->base + offset); 42662306a36Sopenharmony_ci return 0; 42762306a36Sopenharmony_ci} 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci#define SIERRA_LANE_CDB_REGMAP_CONF(n) \ 43062306a36Sopenharmony_ci{ \ 43162306a36Sopenharmony_ci .name = "sierra_lane" n "_cdb", \ 43262306a36Sopenharmony_ci .reg_stride = 1, \ 43362306a36Sopenharmony_ci .fast_io = true, \ 43462306a36Sopenharmony_ci .reg_write = cdns_regmap_write, \ 43562306a36Sopenharmony_ci .reg_read = cdns_regmap_read, \ 43662306a36Sopenharmony_ci} 43762306a36Sopenharmony_ci 43862306a36Sopenharmony_cistatic const struct regmap_config cdns_sierra_lane_cdb_config[] = { 43962306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("0"), 44062306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("1"), 44162306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("2"), 44262306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("3"), 44362306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("4"), 44462306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("5"), 44562306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("6"), 44662306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("7"), 44762306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("8"), 44862306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("9"), 44962306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("10"), 45062306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("11"), 45162306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("12"), 45262306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("13"), 45362306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("14"), 45462306a36Sopenharmony_ci SIERRA_LANE_CDB_REGMAP_CONF("15"), 45562306a36Sopenharmony_ci}; 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_cistatic const struct regmap_config cdns_sierra_common_cdb_config = { 45862306a36Sopenharmony_ci .name = "sierra_common_cdb", 45962306a36Sopenharmony_ci .reg_stride = 1, 46062306a36Sopenharmony_ci .fast_io = true, 46162306a36Sopenharmony_ci .reg_write = cdns_regmap_write, 46262306a36Sopenharmony_ci .reg_read = cdns_regmap_read, 46362306a36Sopenharmony_ci}; 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_cistatic const struct regmap_config cdns_sierra_phy_pcs_cmn_cdb_config = { 46662306a36Sopenharmony_ci .name = "sierra_phy_pcs_cmn_cdb", 46762306a36Sopenharmony_ci .reg_stride = 1, 46862306a36Sopenharmony_ci .fast_io = true, 46962306a36Sopenharmony_ci .reg_write = cdns_regmap_write, 47062306a36Sopenharmony_ci .reg_read = cdns_regmap_read, 47162306a36Sopenharmony_ci}; 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci#define SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \ 47462306a36Sopenharmony_ci{ \ 47562306a36Sopenharmony_ci .name = "sierra_phy_pcs_lane" n "_cdb", \ 47662306a36Sopenharmony_ci .reg_stride = 1, \ 47762306a36Sopenharmony_ci .fast_io = true, \ 47862306a36Sopenharmony_ci .reg_write = cdns_regmap_write, \ 47962306a36Sopenharmony_ci .reg_read = cdns_regmap_read, \ 48062306a36Sopenharmony_ci} 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_cistatic const struct regmap_config cdns_sierra_phy_pcs_lane_cdb_config[] = { 48362306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("0"), 48462306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("1"), 48562306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("2"), 48662306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("3"), 48762306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("4"), 48862306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("5"), 48962306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("6"), 49062306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("7"), 49162306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("8"), 49262306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("9"), 49362306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("10"), 49462306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("11"), 49562306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("12"), 49662306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("13"), 49762306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("14"), 49862306a36Sopenharmony_ci SIERRA_PHY_PCS_LANE_CDB_REGMAP_CONF("15"), 49962306a36Sopenharmony_ci}; 50062306a36Sopenharmony_ci 50162306a36Sopenharmony_cistatic const struct regmap_config cdns_sierra_phy_pma_cmn_cdb_config = { 50262306a36Sopenharmony_ci .name = "sierra_phy_pma_cmn_cdb", 50362306a36Sopenharmony_ci .reg_stride = 1, 50462306a36Sopenharmony_ci .fast_io = true, 50562306a36Sopenharmony_ci .reg_write = cdns_regmap_write, 50662306a36Sopenharmony_ci .reg_read = cdns_regmap_read, 50762306a36Sopenharmony_ci}; 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci#define SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF(n) \ 51062306a36Sopenharmony_ci{ \ 51162306a36Sopenharmony_ci .name = "sierra_phy_pma_lane" n "_cdb", \ 51262306a36Sopenharmony_ci .reg_stride = 1, \ 51362306a36Sopenharmony_ci .fast_io = true, \ 51462306a36Sopenharmony_ci .reg_write = cdns_regmap_write, \ 51562306a36Sopenharmony_ci .reg_read = cdns_regmap_read, \ 51662306a36Sopenharmony_ci} 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_cistatic const struct regmap_config cdns_sierra_phy_pma_lane_cdb_config[] = { 51962306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("0"), 52062306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("1"), 52162306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("2"), 52262306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("3"), 52362306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("4"), 52462306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("5"), 52562306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("6"), 52662306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("7"), 52762306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("8"), 52862306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("9"), 52962306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("10"), 53062306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("11"), 53162306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("12"), 53262306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("13"), 53362306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("14"), 53462306a36Sopenharmony_ci SIERRA_PHY_PMA_LANE_CDB_REGMAP_CONF("15"), 53562306a36Sopenharmony_ci}; 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_cistatic int cdns_sierra_phy_init(struct phy *gphy) 53862306a36Sopenharmony_ci{ 53962306a36Sopenharmony_ci struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); 54062306a36Sopenharmony_ci struct cdns_sierra_phy *phy = dev_get_drvdata(gphy->dev.parent); 54162306a36Sopenharmony_ci const struct cdns_sierra_data *init_data = phy->init_data; 54262306a36Sopenharmony_ci struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals; 54362306a36Sopenharmony_ci enum cdns_sierra_phy_type phy_type = ins->phy_type; 54462306a36Sopenharmony_ci enum cdns_sierra_ssc_mode ssc = ins->ssc_mode; 54562306a36Sopenharmony_ci struct cdns_sierra_vals *phy_pma_ln_vals; 54662306a36Sopenharmony_ci const struct cdns_reg_pairs *reg_pairs; 54762306a36Sopenharmony_ci struct cdns_sierra_vals *pcs_cmn_vals; 54862306a36Sopenharmony_ci struct regmap *regmap; 54962306a36Sopenharmony_ci u32 num_regs; 55062306a36Sopenharmony_ci int i, j; 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci /* Initialise the PHY registers, unless auto configured */ 55362306a36Sopenharmony_ci if (phy->autoconf || phy->already_configured || phy->nsubnodes > 1) 55462306a36Sopenharmony_ci return 0; 55562306a36Sopenharmony_ci 55662306a36Sopenharmony_ci clk_set_rate(phy->input_clks[CMN_REFCLK_DIG_DIV], 25000000); 55762306a36Sopenharmony_ci clk_set_rate(phy->input_clks[CMN_REFCLK1_DIG_DIV], 25000000); 55862306a36Sopenharmony_ci 55962306a36Sopenharmony_ci /* PHY PCS common registers configurations */ 56062306a36Sopenharmony_ci pcs_cmn_vals = init_data->pcs_cmn_vals[phy_type][TYPE_NONE][ssc]; 56162306a36Sopenharmony_ci if (pcs_cmn_vals) { 56262306a36Sopenharmony_ci reg_pairs = pcs_cmn_vals->reg_pairs; 56362306a36Sopenharmony_ci num_regs = pcs_cmn_vals->num_regs; 56462306a36Sopenharmony_ci regmap = phy->regmap_phy_pcs_common_cdb; 56562306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 56662306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 56762306a36Sopenharmony_ci } 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci /* PHY PMA lane registers configurations */ 57062306a36Sopenharmony_ci phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_type][TYPE_NONE][ssc]; 57162306a36Sopenharmony_ci if (phy_pma_ln_vals) { 57262306a36Sopenharmony_ci reg_pairs = phy_pma_ln_vals->reg_pairs; 57362306a36Sopenharmony_ci num_regs = phy_pma_ln_vals->num_regs; 57462306a36Sopenharmony_ci for (i = 0; i < ins->num_lanes; i++) { 57562306a36Sopenharmony_ci regmap = phy->regmap_phy_pma_lane_cdb[i + ins->mlane]; 57662306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 57762306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 57862306a36Sopenharmony_ci } 57962306a36Sopenharmony_ci } 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci /* PMA common registers configurations */ 58262306a36Sopenharmony_ci pma_cmn_vals = init_data->pma_cmn_vals[phy_type][TYPE_NONE][ssc]; 58362306a36Sopenharmony_ci if (pma_cmn_vals) { 58462306a36Sopenharmony_ci reg_pairs = pma_cmn_vals->reg_pairs; 58562306a36Sopenharmony_ci num_regs = pma_cmn_vals->num_regs; 58662306a36Sopenharmony_ci regmap = phy->regmap_common_cdb; 58762306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 58862306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 58962306a36Sopenharmony_ci } 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci /* PMA lane registers configurations */ 59262306a36Sopenharmony_ci pma_ln_vals = init_data->pma_ln_vals[phy_type][TYPE_NONE][ssc]; 59362306a36Sopenharmony_ci if (pma_ln_vals) { 59462306a36Sopenharmony_ci reg_pairs = pma_ln_vals->reg_pairs; 59562306a36Sopenharmony_ci num_regs = pma_ln_vals->num_regs; 59662306a36Sopenharmony_ci for (i = 0; i < ins->num_lanes; i++) { 59762306a36Sopenharmony_ci regmap = phy->regmap_lane_cdb[i + ins->mlane]; 59862306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 59962306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 60062306a36Sopenharmony_ci } 60162306a36Sopenharmony_ci } 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_ci return 0; 60462306a36Sopenharmony_ci} 60562306a36Sopenharmony_ci 60662306a36Sopenharmony_cistatic int cdns_sierra_phy_on(struct phy *gphy) 60762306a36Sopenharmony_ci{ 60862306a36Sopenharmony_ci struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent); 60962306a36Sopenharmony_ci struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); 61062306a36Sopenharmony_ci struct device *dev = sp->dev; 61162306a36Sopenharmony_ci u32 val; 61262306a36Sopenharmony_ci int ret; 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci if (sp->nsubnodes == 1) { 61562306a36Sopenharmony_ci /* Take the PHY out of reset */ 61662306a36Sopenharmony_ci ret = reset_control_deassert(sp->phy_rst); 61762306a36Sopenharmony_ci if (ret) { 61862306a36Sopenharmony_ci dev_err(dev, "Failed to take the PHY out of reset\n"); 61962306a36Sopenharmony_ci return ret; 62062306a36Sopenharmony_ci } 62162306a36Sopenharmony_ci } 62262306a36Sopenharmony_ci 62362306a36Sopenharmony_ci /* Take the PHY lane group out of reset */ 62462306a36Sopenharmony_ci ret = reset_control_deassert(ins->lnk_rst); 62562306a36Sopenharmony_ci if (ret) { 62662306a36Sopenharmony_ci dev_err(dev, "Failed to take the PHY lane out of reset\n"); 62762306a36Sopenharmony_ci return ret; 62862306a36Sopenharmony_ci } 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci if (ins->phy_type == TYPE_PCIE || ins->phy_type == TYPE_USB) { 63162306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(sp->phy_iso_link_ctrl_1[ins->mlane], 63262306a36Sopenharmony_ci val, !val, 1000, PLL_LOCK_TIME); 63362306a36Sopenharmony_ci if (ret) { 63462306a36Sopenharmony_ci dev_err(dev, "Timeout waiting for PHY status ready\n"); 63562306a36Sopenharmony_ci return ret; 63662306a36Sopenharmony_ci } 63762306a36Sopenharmony_ci } 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci /* 64062306a36Sopenharmony_ci * Wait for cmn_ready assertion 64162306a36Sopenharmony_ci * PHY_PMA_CMN_CTRL[0] == 1 64262306a36Sopenharmony_ci */ 64362306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(sp->pma_cmn_ready, val, val, 64462306a36Sopenharmony_ci 1000, PLL_LOCK_TIME); 64562306a36Sopenharmony_ci if (ret) { 64662306a36Sopenharmony_ci dev_err(dev, "Timeout waiting for CMN ready\n"); 64762306a36Sopenharmony_ci return ret; 64862306a36Sopenharmony_ci } 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(sp->pllctrl_lock[ins->mlane], 65162306a36Sopenharmony_ci val, val, 1000, PLL_LOCK_TIME); 65262306a36Sopenharmony_ci if (ret < 0) 65362306a36Sopenharmony_ci dev_err(dev, "PLL lock of lane failed\n"); 65462306a36Sopenharmony_ci 65562306a36Sopenharmony_ci return ret; 65662306a36Sopenharmony_ci} 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_cistatic int cdns_sierra_phy_off(struct phy *gphy) 65962306a36Sopenharmony_ci{ 66062306a36Sopenharmony_ci struct cdns_sierra_inst *ins = phy_get_drvdata(gphy); 66162306a36Sopenharmony_ci 66262306a36Sopenharmony_ci return reset_control_assert(ins->lnk_rst); 66362306a36Sopenharmony_ci} 66462306a36Sopenharmony_ci 66562306a36Sopenharmony_cistatic int cdns_sierra_phy_reset(struct phy *gphy) 66662306a36Sopenharmony_ci{ 66762306a36Sopenharmony_ci struct cdns_sierra_phy *sp = dev_get_drvdata(gphy->dev.parent); 66862306a36Sopenharmony_ci 66962306a36Sopenharmony_ci reset_control_assert(sp->phy_rst); 67062306a36Sopenharmony_ci reset_control_deassert(sp->phy_rst); 67162306a36Sopenharmony_ci return 0; 67262306a36Sopenharmony_ci}; 67362306a36Sopenharmony_ci 67462306a36Sopenharmony_cistatic const struct phy_ops ops = { 67562306a36Sopenharmony_ci .init = cdns_sierra_phy_init, 67662306a36Sopenharmony_ci .power_on = cdns_sierra_phy_on, 67762306a36Sopenharmony_ci .power_off = cdns_sierra_phy_off, 67862306a36Sopenharmony_ci .reset = cdns_sierra_phy_reset, 67962306a36Sopenharmony_ci .owner = THIS_MODULE, 68062306a36Sopenharmony_ci}; 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_cistatic int cdns_sierra_noop_phy_on(struct phy *gphy) 68362306a36Sopenharmony_ci{ 68462306a36Sopenharmony_ci usleep_range(5000, 10000); 68562306a36Sopenharmony_ci 68662306a36Sopenharmony_ci return 0; 68762306a36Sopenharmony_ci} 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_cistatic const struct phy_ops noop_ops = { 69062306a36Sopenharmony_ci .power_on = cdns_sierra_noop_phy_on, 69162306a36Sopenharmony_ci .owner = THIS_MODULE, 69262306a36Sopenharmony_ci}; 69362306a36Sopenharmony_ci 69462306a36Sopenharmony_cistatic u8 cdns_sierra_pll_mux_get_parent(struct clk_hw *hw) 69562306a36Sopenharmony_ci{ 69662306a36Sopenharmony_ci struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); 69762306a36Sopenharmony_ci struct regmap_field *plllc1en_field = mux->plllc1en_field; 69862306a36Sopenharmony_ci struct regmap_field *termen_field = mux->termen_field; 69962306a36Sopenharmony_ci struct regmap_field *field = mux->pfdclk_sel_preg; 70062306a36Sopenharmony_ci unsigned int val; 70162306a36Sopenharmony_ci int index; 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ci regmap_field_read(field, &val); 70462306a36Sopenharmony_ci 70562306a36Sopenharmony_ci if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) { 70662306a36Sopenharmony_ci index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC1], 0, val); 70762306a36Sopenharmony_ci if (index == 1) { 70862306a36Sopenharmony_ci regmap_field_write(plllc1en_field, 1); 70962306a36Sopenharmony_ci regmap_field_write(termen_field, 1); 71062306a36Sopenharmony_ci } 71162306a36Sopenharmony_ci } else { 71262306a36Sopenharmony_ci index = clk_mux_val_to_index(hw, cdns_sierra_pll_mux_table[CMN_PLLLC], 0, val); 71362306a36Sopenharmony_ci } 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_ci return index; 71662306a36Sopenharmony_ci} 71762306a36Sopenharmony_ci 71862306a36Sopenharmony_cistatic int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) 71962306a36Sopenharmony_ci{ 72062306a36Sopenharmony_ci struct cdns_sierra_pll_mux *mux = to_cdns_sierra_pll_mux(hw); 72162306a36Sopenharmony_ci struct regmap_field *plllc1en_field = mux->plllc1en_field; 72262306a36Sopenharmony_ci struct regmap_field *termen_field = mux->termen_field; 72362306a36Sopenharmony_ci struct regmap_field *field = mux->pfdclk_sel_preg; 72462306a36Sopenharmony_ci int val, ret; 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_ci ret = regmap_field_write(plllc1en_field, 0); 72762306a36Sopenharmony_ci ret |= regmap_field_write(termen_field, 0); 72862306a36Sopenharmony_ci if (index == 1) { 72962306a36Sopenharmony_ci ret |= regmap_field_write(plllc1en_field, 1); 73062306a36Sopenharmony_ci ret |= regmap_field_write(termen_field, 1); 73162306a36Sopenharmony_ci } 73262306a36Sopenharmony_ci 73362306a36Sopenharmony_ci if (strstr(clk_hw_get_name(hw), clk_names[CDNS_SIERRA_PLL_CMNLC1])) 73462306a36Sopenharmony_ci val = cdns_sierra_pll_mux_table[CMN_PLLLC1][index]; 73562306a36Sopenharmony_ci else 73662306a36Sopenharmony_ci val = cdns_sierra_pll_mux_table[CMN_PLLLC][index]; 73762306a36Sopenharmony_ci 73862306a36Sopenharmony_ci ret |= regmap_field_write(field, val); 73962306a36Sopenharmony_ci 74062306a36Sopenharmony_ci return ret; 74162306a36Sopenharmony_ci} 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_cistatic const struct clk_ops cdns_sierra_pll_mux_ops = { 74462306a36Sopenharmony_ci .determine_rate = __clk_mux_determine_rate, 74562306a36Sopenharmony_ci .set_parent = cdns_sierra_pll_mux_set_parent, 74662306a36Sopenharmony_ci .get_parent = cdns_sierra_pll_mux_get_parent, 74762306a36Sopenharmony_ci}; 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_cistatic int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp, 75062306a36Sopenharmony_ci struct regmap_field *pfdclk1_sel_field, 75162306a36Sopenharmony_ci struct regmap_field *plllc1en_field, 75262306a36Sopenharmony_ci struct regmap_field *termen_field, 75362306a36Sopenharmony_ci int clk_index) 75462306a36Sopenharmony_ci{ 75562306a36Sopenharmony_ci struct cdns_sierra_pll_mux *mux; 75662306a36Sopenharmony_ci struct device *dev = sp->dev; 75762306a36Sopenharmony_ci struct clk_init_data *init; 75862306a36Sopenharmony_ci char clk_name[100]; 75962306a36Sopenharmony_ci int ret; 76062306a36Sopenharmony_ci 76162306a36Sopenharmony_ci mux = devm_kzalloc(dev, sizeof(*mux), GFP_KERNEL); 76262306a36Sopenharmony_ci if (!mux) 76362306a36Sopenharmony_ci return -ENOMEM; 76462306a36Sopenharmony_ci 76562306a36Sopenharmony_ci snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), clk_names[clk_index]); 76662306a36Sopenharmony_ci 76762306a36Sopenharmony_ci init = &mux->clk_data; 76862306a36Sopenharmony_ci 76962306a36Sopenharmony_ci init->ops = &cdns_sierra_pll_mux_ops; 77062306a36Sopenharmony_ci init->flags = CLK_SET_RATE_NO_REPARENT; 77162306a36Sopenharmony_ci init->parent_data = pll_mux_parent_data[clk_index]; 77262306a36Sopenharmony_ci init->num_parents = SIERRA_NUM_CMN_PLLC_PARENTS; 77362306a36Sopenharmony_ci init->name = clk_name; 77462306a36Sopenharmony_ci 77562306a36Sopenharmony_ci mux->pfdclk_sel_preg = pfdclk1_sel_field; 77662306a36Sopenharmony_ci mux->plllc1en_field = plllc1en_field; 77762306a36Sopenharmony_ci mux->termen_field = termen_field; 77862306a36Sopenharmony_ci mux->hw.init = init; 77962306a36Sopenharmony_ci 78062306a36Sopenharmony_ci ret = devm_clk_hw_register(dev, &mux->hw); 78162306a36Sopenharmony_ci if (ret) 78262306a36Sopenharmony_ci return ret; 78362306a36Sopenharmony_ci 78462306a36Sopenharmony_ci sp->clk_data.hws[clk_index] = &mux->hw; 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci sp->pll_clks[clk_index] = devm_clk_hw_get_clk(dev, &mux->hw, 78762306a36Sopenharmony_ci clk_names[clk_index]); 78862306a36Sopenharmony_ci 78962306a36Sopenharmony_ci return 0; 79062306a36Sopenharmony_ci} 79162306a36Sopenharmony_ci 79262306a36Sopenharmony_cistatic int cdns_sierra_phy_register_pll_mux(struct cdns_sierra_phy *sp) 79362306a36Sopenharmony_ci{ 79462306a36Sopenharmony_ci struct regmap_field *pfdclk1_sel_field; 79562306a36Sopenharmony_ci struct regmap_field *plllc1en_field; 79662306a36Sopenharmony_ci struct regmap_field *termen_field; 79762306a36Sopenharmony_ci struct device *dev = sp->dev; 79862306a36Sopenharmony_ci int ret = 0, i, clk_index; 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci clk_index = CDNS_SIERRA_PLL_CMNLC; 80162306a36Sopenharmony_ci for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++, clk_index++) { 80262306a36Sopenharmony_ci pfdclk1_sel_field = sp->cmn_plllc_pfdclk1_sel_preg[i]; 80362306a36Sopenharmony_ci plllc1en_field = sp->cmn_refrcv_refclk_plllc1en_preg[i]; 80462306a36Sopenharmony_ci termen_field = sp->cmn_refrcv_refclk_termen_preg[i]; 80562306a36Sopenharmony_ci 80662306a36Sopenharmony_ci ret = cdns_sierra_pll_mux_register(sp, pfdclk1_sel_field, plllc1en_field, 80762306a36Sopenharmony_ci termen_field, clk_index); 80862306a36Sopenharmony_ci if (ret) { 80962306a36Sopenharmony_ci dev_err(dev, "Fail to register cmn plllc mux\n"); 81062306a36Sopenharmony_ci return ret; 81162306a36Sopenharmony_ci } 81262306a36Sopenharmony_ci } 81362306a36Sopenharmony_ci 81462306a36Sopenharmony_ci return 0; 81562306a36Sopenharmony_ci} 81662306a36Sopenharmony_ci 81762306a36Sopenharmony_cistatic int cdns_sierra_derived_refclk_enable(struct clk_hw *hw) 81862306a36Sopenharmony_ci{ 81962306a36Sopenharmony_ci struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw); 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0x1); 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci /* Programming to get 100Mhz clock output in ref_der_clk_out 5GHz VCO/50 = 100MHz */ 82462306a36Sopenharmony_ci regmap_field_write(derived_refclk->cmn_plllc_clk1outdiv_preg, 0x2E); 82562306a36Sopenharmony_ci 82662306a36Sopenharmony_ci return 0; 82762306a36Sopenharmony_ci} 82862306a36Sopenharmony_ci 82962306a36Sopenharmony_cistatic void cdns_sierra_derived_refclk_disable(struct clk_hw *hw) 83062306a36Sopenharmony_ci{ 83162306a36Sopenharmony_ci struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw); 83262306a36Sopenharmony_ci 83362306a36Sopenharmony_ci regmap_field_write(derived_refclk->cmn_plllc_clk1_en_preg, 0); 83462306a36Sopenharmony_ci} 83562306a36Sopenharmony_ci 83662306a36Sopenharmony_cistatic int cdns_sierra_derived_refclk_is_enabled(struct clk_hw *hw) 83762306a36Sopenharmony_ci{ 83862306a36Sopenharmony_ci struct cdns_sierra_derived_refclk *derived_refclk = to_cdns_sierra_derived_refclk(hw); 83962306a36Sopenharmony_ci int val; 84062306a36Sopenharmony_ci 84162306a36Sopenharmony_ci regmap_field_read(derived_refclk->cmn_plllc_clk1_en_preg, &val); 84262306a36Sopenharmony_ci 84362306a36Sopenharmony_ci return !!val; 84462306a36Sopenharmony_ci} 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_cistatic const struct clk_ops cdns_sierra_derived_refclk_ops = { 84762306a36Sopenharmony_ci .enable = cdns_sierra_derived_refclk_enable, 84862306a36Sopenharmony_ci .disable = cdns_sierra_derived_refclk_disable, 84962306a36Sopenharmony_ci .is_enabled = cdns_sierra_derived_refclk_is_enabled, 85062306a36Sopenharmony_ci}; 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_cistatic int cdns_sierra_derived_refclk_register(struct cdns_sierra_phy *sp) 85362306a36Sopenharmony_ci{ 85462306a36Sopenharmony_ci struct cdns_sierra_derived_refclk *derived_refclk; 85562306a36Sopenharmony_ci struct device *dev = sp->dev; 85662306a36Sopenharmony_ci struct regmap_field *field; 85762306a36Sopenharmony_ci struct clk_init_data *init; 85862306a36Sopenharmony_ci struct regmap *regmap; 85962306a36Sopenharmony_ci char clk_name[100]; 86062306a36Sopenharmony_ci int ret; 86162306a36Sopenharmony_ci 86262306a36Sopenharmony_ci derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); 86362306a36Sopenharmony_ci if (!derived_refclk) 86462306a36Sopenharmony_ci return -ENOMEM; 86562306a36Sopenharmony_ci 86662306a36Sopenharmony_ci snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), 86762306a36Sopenharmony_ci clk_names[CDNS_SIERRA_DERIVED_REFCLK]); 86862306a36Sopenharmony_ci 86962306a36Sopenharmony_ci init = &derived_refclk->clk_data; 87062306a36Sopenharmony_ci 87162306a36Sopenharmony_ci init->ops = &cdns_sierra_derived_refclk_ops; 87262306a36Sopenharmony_ci init->flags = 0; 87362306a36Sopenharmony_ci init->name = clk_name; 87462306a36Sopenharmony_ci 87562306a36Sopenharmony_ci regmap = sp->regmap_common_cdb; 87662306a36Sopenharmony_ci 87762306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, cmn_plllc_clk1outdiv_preg); 87862306a36Sopenharmony_ci if (IS_ERR(field)) { 87962306a36Sopenharmony_ci dev_err(dev, "cmn_plllc_clk1outdiv_preg reg field init failed\n"); 88062306a36Sopenharmony_ci return PTR_ERR(field); 88162306a36Sopenharmony_ci } 88262306a36Sopenharmony_ci derived_refclk->cmn_plllc_clk1outdiv_preg = field; 88362306a36Sopenharmony_ci 88462306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, cmn_plllc_clk1_en_preg); 88562306a36Sopenharmony_ci if (IS_ERR(field)) { 88662306a36Sopenharmony_ci dev_err(dev, "cmn_plllc_clk1_en_preg reg field init failed\n"); 88762306a36Sopenharmony_ci return PTR_ERR(field); 88862306a36Sopenharmony_ci } 88962306a36Sopenharmony_ci derived_refclk->cmn_plllc_clk1_en_preg = field; 89062306a36Sopenharmony_ci 89162306a36Sopenharmony_ci derived_refclk->hw.init = init; 89262306a36Sopenharmony_ci 89362306a36Sopenharmony_ci ret = devm_clk_hw_register(dev, &derived_refclk->hw); 89462306a36Sopenharmony_ci if (ret) 89562306a36Sopenharmony_ci return ret; 89662306a36Sopenharmony_ci 89762306a36Sopenharmony_ci sp->clk_data.hws[CDNS_SIERRA_DERIVED_REFCLK] = &derived_refclk->hw; 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_ci return 0; 90062306a36Sopenharmony_ci} 90162306a36Sopenharmony_ci 90262306a36Sopenharmony_cistatic void cdns_sierra_clk_unregister(struct cdns_sierra_phy *sp) 90362306a36Sopenharmony_ci{ 90462306a36Sopenharmony_ci struct device *dev = sp->dev; 90562306a36Sopenharmony_ci struct device_node *node = dev->of_node; 90662306a36Sopenharmony_ci 90762306a36Sopenharmony_ci of_clk_del_provider(node); 90862306a36Sopenharmony_ci} 90962306a36Sopenharmony_ci 91062306a36Sopenharmony_cistatic int cdns_sierra_clk_register(struct cdns_sierra_phy *sp) 91162306a36Sopenharmony_ci{ 91262306a36Sopenharmony_ci struct device *dev = sp->dev; 91362306a36Sopenharmony_ci struct device_node *node = dev->of_node; 91462306a36Sopenharmony_ci int ret; 91562306a36Sopenharmony_ci 91662306a36Sopenharmony_ci ret = cdns_sierra_phy_register_pll_mux(sp); 91762306a36Sopenharmony_ci if (ret) { 91862306a36Sopenharmony_ci dev_err(dev, "Failed to pll mux clocks\n"); 91962306a36Sopenharmony_ci return ret; 92062306a36Sopenharmony_ci } 92162306a36Sopenharmony_ci 92262306a36Sopenharmony_ci ret = cdns_sierra_derived_refclk_register(sp); 92362306a36Sopenharmony_ci if (ret) { 92462306a36Sopenharmony_ci dev_err(dev, "Failed to register derived refclk\n"); 92562306a36Sopenharmony_ci return ret; 92662306a36Sopenharmony_ci } 92762306a36Sopenharmony_ci 92862306a36Sopenharmony_ci sp->clk_data.num = CDNS_SIERRA_OUTPUT_CLOCKS; 92962306a36Sopenharmony_ci ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, 93062306a36Sopenharmony_ci &sp->clk_data); 93162306a36Sopenharmony_ci if (ret) 93262306a36Sopenharmony_ci dev_err(dev, "Failed to add clock provider: %s\n", node->name); 93362306a36Sopenharmony_ci 93462306a36Sopenharmony_ci return ret; 93562306a36Sopenharmony_ci} 93662306a36Sopenharmony_ci 93762306a36Sopenharmony_cistatic int cdns_sierra_get_optional(struct cdns_sierra_inst *inst, 93862306a36Sopenharmony_ci struct device_node *child) 93962306a36Sopenharmony_ci{ 94062306a36Sopenharmony_ci u32 phy_type; 94162306a36Sopenharmony_ci 94262306a36Sopenharmony_ci if (of_property_read_u32(child, "reg", &inst->mlane)) 94362306a36Sopenharmony_ci return -EINVAL; 94462306a36Sopenharmony_ci 94562306a36Sopenharmony_ci if (of_property_read_u32(child, "cdns,num-lanes", &inst->num_lanes)) 94662306a36Sopenharmony_ci return -EINVAL; 94762306a36Sopenharmony_ci 94862306a36Sopenharmony_ci if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) 94962306a36Sopenharmony_ci return -EINVAL; 95062306a36Sopenharmony_ci 95162306a36Sopenharmony_ci switch (phy_type) { 95262306a36Sopenharmony_ci case PHY_TYPE_PCIE: 95362306a36Sopenharmony_ci inst->phy_type = TYPE_PCIE; 95462306a36Sopenharmony_ci break; 95562306a36Sopenharmony_ci case PHY_TYPE_USB3: 95662306a36Sopenharmony_ci inst->phy_type = TYPE_USB; 95762306a36Sopenharmony_ci break; 95862306a36Sopenharmony_ci case PHY_TYPE_SGMII: 95962306a36Sopenharmony_ci inst->phy_type = TYPE_SGMII; 96062306a36Sopenharmony_ci break; 96162306a36Sopenharmony_ci case PHY_TYPE_QSGMII: 96262306a36Sopenharmony_ci inst->phy_type = TYPE_QSGMII; 96362306a36Sopenharmony_ci break; 96462306a36Sopenharmony_ci default: 96562306a36Sopenharmony_ci return -EINVAL; 96662306a36Sopenharmony_ci } 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci inst->ssc_mode = EXTERNAL_SSC; 96962306a36Sopenharmony_ci of_property_read_u32(child, "cdns,ssc-mode", &inst->ssc_mode); 97062306a36Sopenharmony_ci 97162306a36Sopenharmony_ci return 0; 97262306a36Sopenharmony_ci} 97362306a36Sopenharmony_ci 97462306a36Sopenharmony_cistatic struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, 97562306a36Sopenharmony_ci u32 block_offset, u8 reg_offset_shift, 97662306a36Sopenharmony_ci const struct regmap_config *config) 97762306a36Sopenharmony_ci{ 97862306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx; 97962306a36Sopenharmony_ci 98062306a36Sopenharmony_ci ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 98162306a36Sopenharmony_ci if (!ctx) 98262306a36Sopenharmony_ci return ERR_PTR(-ENOMEM); 98362306a36Sopenharmony_ci 98462306a36Sopenharmony_ci ctx->dev = dev; 98562306a36Sopenharmony_ci ctx->base = base + block_offset; 98662306a36Sopenharmony_ci ctx->reg_offset_shift = reg_offset_shift; 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_ci return devm_regmap_init(dev, NULL, ctx, config); 98962306a36Sopenharmony_ci} 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_cistatic int cdns_regfield_init(struct cdns_sierra_phy *sp) 99262306a36Sopenharmony_ci{ 99362306a36Sopenharmony_ci struct device *dev = sp->dev; 99462306a36Sopenharmony_ci struct regmap_field *field; 99562306a36Sopenharmony_ci struct reg_field reg_field; 99662306a36Sopenharmony_ci struct regmap *regmap; 99762306a36Sopenharmony_ci int i; 99862306a36Sopenharmony_ci 99962306a36Sopenharmony_ci regmap = sp->regmap_common_cdb; 100062306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, macro_id_type); 100162306a36Sopenharmony_ci if (IS_ERR(field)) { 100262306a36Sopenharmony_ci dev_err(dev, "MACRO_ID_TYPE reg field init failed\n"); 100362306a36Sopenharmony_ci return PTR_ERR(field); 100462306a36Sopenharmony_ci } 100562306a36Sopenharmony_ci sp->macro_id_type = field; 100662306a36Sopenharmony_ci 100762306a36Sopenharmony_ci for (i = 0; i < SIERRA_NUM_CMN_PLLC; i++) { 100862306a36Sopenharmony_ci reg_field = cmn_plllc_pfdclk1_sel_preg[i].pfdclk_sel_preg; 100962306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, reg_field); 101062306a36Sopenharmony_ci if (IS_ERR(field)) { 101162306a36Sopenharmony_ci dev_err(dev, "PLLLC%d_PFDCLK1_SEL failed\n", i); 101262306a36Sopenharmony_ci return PTR_ERR(field); 101362306a36Sopenharmony_ci } 101462306a36Sopenharmony_ci sp->cmn_plllc_pfdclk1_sel_preg[i] = field; 101562306a36Sopenharmony_ci 101662306a36Sopenharmony_ci reg_field = cmn_plllc_pfdclk1_sel_preg[i].plllc1en_field; 101762306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, reg_field); 101862306a36Sopenharmony_ci if (IS_ERR(field)) { 101962306a36Sopenharmony_ci dev_err(dev, "REFRCV%d_REFCLK_PLLLC1EN failed\n", i); 102062306a36Sopenharmony_ci return PTR_ERR(field); 102162306a36Sopenharmony_ci } 102262306a36Sopenharmony_ci sp->cmn_refrcv_refclk_plllc1en_preg[i] = field; 102362306a36Sopenharmony_ci 102462306a36Sopenharmony_ci reg_field = cmn_plllc_pfdclk1_sel_preg[i].termen_field; 102562306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, reg_field); 102662306a36Sopenharmony_ci if (IS_ERR(field)) { 102762306a36Sopenharmony_ci dev_err(dev, "REFRCV%d_REFCLK_TERMEN failed\n", i); 102862306a36Sopenharmony_ci return PTR_ERR(field); 102962306a36Sopenharmony_ci } 103062306a36Sopenharmony_ci sp->cmn_refrcv_refclk_termen_preg[i] = field; 103162306a36Sopenharmony_ci } 103262306a36Sopenharmony_ci 103362306a36Sopenharmony_ci regmap = sp->regmap_phy_pcs_common_cdb; 103462306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg_1); 103562306a36Sopenharmony_ci if (IS_ERR(field)) { 103662306a36Sopenharmony_ci dev_err(dev, "PHY_PLL_CFG_1 reg field init failed\n"); 103762306a36Sopenharmony_ci return PTR_ERR(field); 103862306a36Sopenharmony_ci } 103962306a36Sopenharmony_ci sp->phy_pll_cfg_1 = field; 104062306a36Sopenharmony_ci 104162306a36Sopenharmony_ci regmap = sp->regmap_phy_pma_common_cdb; 104262306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, pma_cmn_ready); 104362306a36Sopenharmony_ci if (IS_ERR(field)) { 104462306a36Sopenharmony_ci dev_err(dev, "PHY_PMA_CMN_CTRL reg field init failed\n"); 104562306a36Sopenharmony_ci return PTR_ERR(field); 104662306a36Sopenharmony_ci } 104762306a36Sopenharmony_ci sp->pma_cmn_ready = field; 104862306a36Sopenharmony_ci 104962306a36Sopenharmony_ci for (i = 0; i < SIERRA_MAX_LANES; i++) { 105062306a36Sopenharmony_ci regmap = sp->regmap_lane_cdb[i]; 105162306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, pllctrl_lock); 105262306a36Sopenharmony_ci if (IS_ERR(field)) { 105362306a36Sopenharmony_ci dev_err(dev, "P%d_ENABLE reg field init failed\n", i); 105462306a36Sopenharmony_ci return PTR_ERR(field); 105562306a36Sopenharmony_ci } 105662306a36Sopenharmony_ci sp->pllctrl_lock[i] = field; 105762306a36Sopenharmony_ci } 105862306a36Sopenharmony_ci 105962306a36Sopenharmony_ci for (i = 0; i < SIERRA_MAX_LANES; i++) { 106062306a36Sopenharmony_ci regmap = sp->regmap_phy_pcs_lane_cdb[i]; 106162306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_iso_link_ctrl_1); 106262306a36Sopenharmony_ci if (IS_ERR(field)) { 106362306a36Sopenharmony_ci dev_err(dev, "PHY_ISO_LINK_CTRL reg field init for lane %d failed\n", i); 106462306a36Sopenharmony_ci return PTR_ERR(field); 106562306a36Sopenharmony_ci } 106662306a36Sopenharmony_ci sp->phy_iso_link_ctrl_1[i] = field; 106762306a36Sopenharmony_ci } 106862306a36Sopenharmony_ci 106962306a36Sopenharmony_ci return 0; 107062306a36Sopenharmony_ci} 107162306a36Sopenharmony_ci 107262306a36Sopenharmony_cistatic int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp, 107362306a36Sopenharmony_ci void __iomem *base, u8 block_offset_shift, 107462306a36Sopenharmony_ci u8 reg_offset_shift) 107562306a36Sopenharmony_ci{ 107662306a36Sopenharmony_ci struct device *dev = sp->dev; 107762306a36Sopenharmony_ci struct regmap *regmap; 107862306a36Sopenharmony_ci u32 block_offset; 107962306a36Sopenharmony_ci int i; 108062306a36Sopenharmony_ci 108162306a36Sopenharmony_ci for (i = 0; i < SIERRA_MAX_LANES; i++) { 108262306a36Sopenharmony_ci block_offset = SIERRA_LANE_CDB_OFFSET(i, block_offset_shift, 108362306a36Sopenharmony_ci reg_offset_shift); 108462306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, 108562306a36Sopenharmony_ci reg_offset_shift, 108662306a36Sopenharmony_ci &cdns_sierra_lane_cdb_config[i]); 108762306a36Sopenharmony_ci if (IS_ERR(regmap)) { 108862306a36Sopenharmony_ci dev_err(dev, "Failed to init lane CDB regmap\n"); 108962306a36Sopenharmony_ci return PTR_ERR(regmap); 109062306a36Sopenharmony_ci } 109162306a36Sopenharmony_ci sp->regmap_lane_cdb[i] = regmap; 109262306a36Sopenharmony_ci } 109362306a36Sopenharmony_ci 109462306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, SIERRA_COMMON_CDB_OFFSET, 109562306a36Sopenharmony_ci reg_offset_shift, 109662306a36Sopenharmony_ci &cdns_sierra_common_cdb_config); 109762306a36Sopenharmony_ci if (IS_ERR(regmap)) { 109862306a36Sopenharmony_ci dev_err(dev, "Failed to init common CDB regmap\n"); 109962306a36Sopenharmony_ci return PTR_ERR(regmap); 110062306a36Sopenharmony_ci } 110162306a36Sopenharmony_ci sp->regmap_common_cdb = regmap; 110262306a36Sopenharmony_ci 110362306a36Sopenharmony_ci block_offset = SIERRA_PHY_PCS_COMMON_OFFSET(block_offset_shift); 110462306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift, 110562306a36Sopenharmony_ci &cdns_sierra_phy_pcs_cmn_cdb_config); 110662306a36Sopenharmony_ci if (IS_ERR(regmap)) { 110762306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PCS common CDB regmap\n"); 110862306a36Sopenharmony_ci return PTR_ERR(regmap); 110962306a36Sopenharmony_ci } 111062306a36Sopenharmony_ci sp->regmap_phy_pcs_common_cdb = regmap; 111162306a36Sopenharmony_ci 111262306a36Sopenharmony_ci for (i = 0; i < SIERRA_MAX_LANES; i++) { 111362306a36Sopenharmony_ci block_offset = SIERRA_PHY_PCS_LANE_CDB_OFFSET(i, block_offset_shift, 111462306a36Sopenharmony_ci reg_offset_shift); 111562306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, 111662306a36Sopenharmony_ci reg_offset_shift, 111762306a36Sopenharmony_ci &cdns_sierra_phy_pcs_lane_cdb_config[i]); 111862306a36Sopenharmony_ci if (IS_ERR(regmap)) { 111962306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n"); 112062306a36Sopenharmony_ci return PTR_ERR(regmap); 112162306a36Sopenharmony_ci } 112262306a36Sopenharmony_ci sp->regmap_phy_pcs_lane_cdb[i] = regmap; 112362306a36Sopenharmony_ci } 112462306a36Sopenharmony_ci 112562306a36Sopenharmony_ci block_offset = SIERRA_PHY_PMA_COMMON_OFFSET(block_offset_shift); 112662306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, reg_offset_shift, 112762306a36Sopenharmony_ci &cdns_sierra_phy_pma_cmn_cdb_config); 112862306a36Sopenharmony_ci if (IS_ERR(regmap)) { 112962306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PMA common CDB regmap\n"); 113062306a36Sopenharmony_ci return PTR_ERR(regmap); 113162306a36Sopenharmony_ci } 113262306a36Sopenharmony_ci sp->regmap_phy_pma_common_cdb = regmap; 113362306a36Sopenharmony_ci 113462306a36Sopenharmony_ci for (i = 0; i < SIERRA_MAX_LANES; i++) { 113562306a36Sopenharmony_ci block_offset = SIERRA_PHY_PMA_LANE_CDB_OFFSET(i, block_offset_shift, 113662306a36Sopenharmony_ci reg_offset_shift); 113762306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, 113862306a36Sopenharmony_ci reg_offset_shift, 113962306a36Sopenharmony_ci &cdns_sierra_phy_pma_lane_cdb_config[i]); 114062306a36Sopenharmony_ci if (IS_ERR(regmap)) { 114162306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PMA lane CDB regmap\n"); 114262306a36Sopenharmony_ci return PTR_ERR(regmap); 114362306a36Sopenharmony_ci } 114462306a36Sopenharmony_ci sp->regmap_phy_pma_lane_cdb[i] = regmap; 114562306a36Sopenharmony_ci } 114662306a36Sopenharmony_ci 114762306a36Sopenharmony_ci return 0; 114862306a36Sopenharmony_ci} 114962306a36Sopenharmony_ci 115062306a36Sopenharmony_cistatic int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, 115162306a36Sopenharmony_ci struct device *dev) 115262306a36Sopenharmony_ci{ 115362306a36Sopenharmony_ci struct clk *clk; 115462306a36Sopenharmony_ci int ret; 115562306a36Sopenharmony_ci 115662306a36Sopenharmony_ci clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); 115762306a36Sopenharmony_ci if (IS_ERR(clk)) { 115862306a36Sopenharmony_ci dev_err(dev, "cmn_refclk_dig_div clock not found\n"); 115962306a36Sopenharmony_ci ret = PTR_ERR(clk); 116062306a36Sopenharmony_ci return ret; 116162306a36Sopenharmony_ci } 116262306a36Sopenharmony_ci sp->input_clks[CMN_REFCLK_DIG_DIV] = clk; 116362306a36Sopenharmony_ci 116462306a36Sopenharmony_ci clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); 116562306a36Sopenharmony_ci if (IS_ERR(clk)) { 116662306a36Sopenharmony_ci dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); 116762306a36Sopenharmony_ci ret = PTR_ERR(clk); 116862306a36Sopenharmony_ci return ret; 116962306a36Sopenharmony_ci } 117062306a36Sopenharmony_ci sp->input_clks[CMN_REFCLK1_DIG_DIV] = clk; 117162306a36Sopenharmony_ci 117262306a36Sopenharmony_ci return 0; 117362306a36Sopenharmony_ci} 117462306a36Sopenharmony_ci 117562306a36Sopenharmony_cistatic int cdns_sierra_phy_clk(struct cdns_sierra_phy *sp) 117662306a36Sopenharmony_ci{ 117762306a36Sopenharmony_ci struct device *dev = sp->dev; 117862306a36Sopenharmony_ci struct clk *clk; 117962306a36Sopenharmony_ci int ret; 118062306a36Sopenharmony_ci 118162306a36Sopenharmony_ci clk = devm_clk_get_optional(dev, "phy_clk"); 118262306a36Sopenharmony_ci if (IS_ERR(clk)) { 118362306a36Sopenharmony_ci dev_err(dev, "failed to get clock phy_clk\n"); 118462306a36Sopenharmony_ci return PTR_ERR(clk); 118562306a36Sopenharmony_ci } 118662306a36Sopenharmony_ci sp->input_clks[PHY_CLK] = clk; 118762306a36Sopenharmony_ci 118862306a36Sopenharmony_ci ret = clk_prepare_enable(sp->input_clks[PHY_CLK]); 118962306a36Sopenharmony_ci if (ret) 119062306a36Sopenharmony_ci return ret; 119162306a36Sopenharmony_ci 119262306a36Sopenharmony_ci return 0; 119362306a36Sopenharmony_ci} 119462306a36Sopenharmony_ci 119562306a36Sopenharmony_cistatic int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp) 119662306a36Sopenharmony_ci{ 119762306a36Sopenharmony_ci int ret; 119862306a36Sopenharmony_ci 119962306a36Sopenharmony_ci ret = clk_prepare_enable(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]); 120062306a36Sopenharmony_ci if (ret) 120162306a36Sopenharmony_ci return ret; 120262306a36Sopenharmony_ci 120362306a36Sopenharmony_ci ret = clk_prepare_enable(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC1]); 120462306a36Sopenharmony_ci if (ret) 120562306a36Sopenharmony_ci goto err_pll_cmnlc1; 120662306a36Sopenharmony_ci 120762306a36Sopenharmony_ci return 0; 120862306a36Sopenharmony_ci 120962306a36Sopenharmony_cierr_pll_cmnlc1: 121062306a36Sopenharmony_ci clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]); 121162306a36Sopenharmony_ci 121262306a36Sopenharmony_ci return ret; 121362306a36Sopenharmony_ci} 121462306a36Sopenharmony_ci 121562306a36Sopenharmony_cistatic void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp) 121662306a36Sopenharmony_ci{ 121762306a36Sopenharmony_ci clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC1]); 121862306a36Sopenharmony_ci clk_disable_unprepare(sp->pll_clks[CDNS_SIERRA_PLL_CMNLC]); 121962306a36Sopenharmony_ci if (!sp->already_configured) 122062306a36Sopenharmony_ci clk_disable_unprepare(sp->input_clks[PHY_CLK]); 122162306a36Sopenharmony_ci} 122262306a36Sopenharmony_ci 122362306a36Sopenharmony_cistatic int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, 122462306a36Sopenharmony_ci struct device *dev) 122562306a36Sopenharmony_ci{ 122662306a36Sopenharmony_ci struct reset_control *rst; 122762306a36Sopenharmony_ci 122862306a36Sopenharmony_ci rst = devm_reset_control_get_exclusive(dev, "sierra_reset"); 122962306a36Sopenharmony_ci if (IS_ERR(rst)) { 123062306a36Sopenharmony_ci dev_err(dev, "failed to get reset\n"); 123162306a36Sopenharmony_ci return PTR_ERR(rst); 123262306a36Sopenharmony_ci } 123362306a36Sopenharmony_ci sp->phy_rst = rst; 123462306a36Sopenharmony_ci 123562306a36Sopenharmony_ci rst = devm_reset_control_get_optional_exclusive(dev, "sierra_apb"); 123662306a36Sopenharmony_ci if (IS_ERR(rst)) { 123762306a36Sopenharmony_ci dev_err(dev, "failed to get apb reset\n"); 123862306a36Sopenharmony_ci return PTR_ERR(rst); 123962306a36Sopenharmony_ci } 124062306a36Sopenharmony_ci sp->apb_rst = rst; 124162306a36Sopenharmony_ci 124262306a36Sopenharmony_ci return 0; 124362306a36Sopenharmony_ci} 124462306a36Sopenharmony_ci 124562306a36Sopenharmony_cistatic int cdns_sierra_phy_configure_multilink(struct cdns_sierra_phy *sp) 124662306a36Sopenharmony_ci{ 124762306a36Sopenharmony_ci const struct cdns_sierra_data *init_data = sp->init_data; 124862306a36Sopenharmony_ci struct cdns_sierra_vals *pma_cmn_vals, *pma_ln_vals; 124962306a36Sopenharmony_ci enum cdns_sierra_phy_type phy_t1, phy_t2; 125062306a36Sopenharmony_ci struct cdns_sierra_vals *phy_pma_ln_vals; 125162306a36Sopenharmony_ci const struct cdns_reg_pairs *reg_pairs; 125262306a36Sopenharmony_ci struct cdns_sierra_vals *pcs_cmn_vals; 125362306a36Sopenharmony_ci int i, j, node, mlane, num_lanes, ret; 125462306a36Sopenharmony_ci enum cdns_sierra_ssc_mode ssc; 125562306a36Sopenharmony_ci struct regmap *regmap; 125662306a36Sopenharmony_ci u32 num_regs; 125762306a36Sopenharmony_ci 125862306a36Sopenharmony_ci /* Maximum 2 links (subnodes) are supported */ 125962306a36Sopenharmony_ci if (sp->nsubnodes != 2) 126062306a36Sopenharmony_ci return -EINVAL; 126162306a36Sopenharmony_ci 126262306a36Sopenharmony_ci clk_set_rate(sp->input_clks[CMN_REFCLK_DIG_DIV], 25000000); 126362306a36Sopenharmony_ci clk_set_rate(sp->input_clks[CMN_REFCLK1_DIG_DIV], 25000000); 126462306a36Sopenharmony_ci 126562306a36Sopenharmony_ci /* PHY configured to use both PLL LC and LC1 */ 126662306a36Sopenharmony_ci regmap_field_write(sp->phy_pll_cfg_1, 0x1); 126762306a36Sopenharmony_ci 126862306a36Sopenharmony_ci phy_t1 = sp->phys[0].phy_type; 126962306a36Sopenharmony_ci phy_t2 = sp->phys[1].phy_type; 127062306a36Sopenharmony_ci 127162306a36Sopenharmony_ci /* 127262306a36Sopenharmony_ci * PHY configuration for multi-link operation is done in two steps. 127362306a36Sopenharmony_ci * e.g. Consider a case for a 4 lane PHY with PCIe using 2 lanes and QSGMII other 2 lanes. 127462306a36Sopenharmony_ci * Sierra PHY has 2 PLLs, viz. PLLLC and PLLLC1. So in this case, PLLLC is used for PCIe 127562306a36Sopenharmony_ci * and PLLLC1 is used for QSGMII. PHY is configured in two steps as described below. 127662306a36Sopenharmony_ci * 127762306a36Sopenharmony_ci * [1] For first step, phy_t1 = TYPE_PCIE and phy_t2 = TYPE_QSGMII 127862306a36Sopenharmony_ci * So the register values are selected as [TYPE_PCIE][TYPE_QSGMII][ssc]. 127962306a36Sopenharmony_ci * This will configure PHY registers associated for PCIe (i.e. first protocol) 128062306a36Sopenharmony_ci * involving PLLLC registers and registers for first 2 lanes of PHY. 128162306a36Sopenharmony_ci * [2] In second step, the variables phy_t1 and phy_t2 are swapped. So now, 128262306a36Sopenharmony_ci * phy_t1 = TYPE_QSGMII and phy_t2 = TYPE_PCIE. And the register values are selected as 128362306a36Sopenharmony_ci * [TYPE_QSGMII][TYPE_PCIE][ssc]. 128462306a36Sopenharmony_ci * This will configure PHY registers associated for QSGMII (i.e. second protocol) 128562306a36Sopenharmony_ci * involving PLLLC1 registers and registers for other 2 lanes of PHY. 128662306a36Sopenharmony_ci * 128762306a36Sopenharmony_ci * This completes the PHY configuration for multilink operation. This approach enables 128862306a36Sopenharmony_ci * dividing the large number of PHY register configurations into protocol specific 128962306a36Sopenharmony_ci * smaller groups. 129062306a36Sopenharmony_ci */ 129162306a36Sopenharmony_ci for (node = 0; node < sp->nsubnodes; node++) { 129262306a36Sopenharmony_ci if (node == 1) { 129362306a36Sopenharmony_ci /* 129462306a36Sopenharmony_ci * If first link with phy_t1 is configured, then configure the PHY for 129562306a36Sopenharmony_ci * second link with phy_t2. Get the array values as [phy_t2][phy_t1][ssc]. 129662306a36Sopenharmony_ci */ 129762306a36Sopenharmony_ci swap(phy_t1, phy_t2); 129862306a36Sopenharmony_ci } 129962306a36Sopenharmony_ci 130062306a36Sopenharmony_ci mlane = sp->phys[node].mlane; 130162306a36Sopenharmony_ci ssc = sp->phys[node].ssc_mode; 130262306a36Sopenharmony_ci num_lanes = sp->phys[node].num_lanes; 130362306a36Sopenharmony_ci 130462306a36Sopenharmony_ci /* PHY PCS common registers configurations */ 130562306a36Sopenharmony_ci pcs_cmn_vals = init_data->pcs_cmn_vals[phy_t1][phy_t2][ssc]; 130662306a36Sopenharmony_ci if (pcs_cmn_vals) { 130762306a36Sopenharmony_ci reg_pairs = pcs_cmn_vals->reg_pairs; 130862306a36Sopenharmony_ci num_regs = pcs_cmn_vals->num_regs; 130962306a36Sopenharmony_ci regmap = sp->regmap_phy_pcs_common_cdb; 131062306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 131162306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 131262306a36Sopenharmony_ci } 131362306a36Sopenharmony_ci 131462306a36Sopenharmony_ci /* PHY PMA lane registers configurations */ 131562306a36Sopenharmony_ci phy_pma_ln_vals = init_data->phy_pma_ln_vals[phy_t1][phy_t2][ssc]; 131662306a36Sopenharmony_ci if (phy_pma_ln_vals) { 131762306a36Sopenharmony_ci reg_pairs = phy_pma_ln_vals->reg_pairs; 131862306a36Sopenharmony_ci num_regs = phy_pma_ln_vals->num_regs; 131962306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 132062306a36Sopenharmony_ci regmap = sp->regmap_phy_pma_lane_cdb[i + mlane]; 132162306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 132262306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 132362306a36Sopenharmony_ci } 132462306a36Sopenharmony_ci } 132562306a36Sopenharmony_ci 132662306a36Sopenharmony_ci /* PMA common registers configurations */ 132762306a36Sopenharmony_ci pma_cmn_vals = init_data->pma_cmn_vals[phy_t1][phy_t2][ssc]; 132862306a36Sopenharmony_ci if (pma_cmn_vals) { 132962306a36Sopenharmony_ci reg_pairs = pma_cmn_vals->reg_pairs; 133062306a36Sopenharmony_ci num_regs = pma_cmn_vals->num_regs; 133162306a36Sopenharmony_ci regmap = sp->regmap_common_cdb; 133262306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 133362306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, reg_pairs[i].val); 133462306a36Sopenharmony_ci } 133562306a36Sopenharmony_ci 133662306a36Sopenharmony_ci /* PMA lane registers configurations */ 133762306a36Sopenharmony_ci pma_ln_vals = init_data->pma_ln_vals[phy_t1][phy_t2][ssc]; 133862306a36Sopenharmony_ci if (pma_ln_vals) { 133962306a36Sopenharmony_ci reg_pairs = pma_ln_vals->reg_pairs; 134062306a36Sopenharmony_ci num_regs = pma_ln_vals->num_regs; 134162306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 134262306a36Sopenharmony_ci regmap = sp->regmap_lane_cdb[i + mlane]; 134362306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 134462306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, reg_pairs[j].val); 134562306a36Sopenharmony_ci } 134662306a36Sopenharmony_ci } 134762306a36Sopenharmony_ci 134862306a36Sopenharmony_ci if (phy_t1 == TYPE_SGMII || phy_t1 == TYPE_QSGMII) 134962306a36Sopenharmony_ci reset_control_deassert(sp->phys[node].lnk_rst); 135062306a36Sopenharmony_ci } 135162306a36Sopenharmony_ci 135262306a36Sopenharmony_ci /* Take the PHY out of reset */ 135362306a36Sopenharmony_ci ret = reset_control_deassert(sp->phy_rst); 135462306a36Sopenharmony_ci if (ret) 135562306a36Sopenharmony_ci return ret; 135662306a36Sopenharmony_ci 135762306a36Sopenharmony_ci return 0; 135862306a36Sopenharmony_ci} 135962306a36Sopenharmony_ci 136062306a36Sopenharmony_cistatic int cdns_sierra_phy_probe(struct platform_device *pdev) 136162306a36Sopenharmony_ci{ 136262306a36Sopenharmony_ci struct cdns_sierra_phy *sp; 136362306a36Sopenharmony_ci struct phy_provider *phy_provider; 136462306a36Sopenharmony_ci struct device *dev = &pdev->dev; 136562306a36Sopenharmony_ci const struct cdns_sierra_data *data; 136662306a36Sopenharmony_ci unsigned int id_value; 136762306a36Sopenharmony_ci int ret, node = 0; 136862306a36Sopenharmony_ci void __iomem *base; 136962306a36Sopenharmony_ci struct device_node *dn = dev->of_node, *child; 137062306a36Sopenharmony_ci 137162306a36Sopenharmony_ci if (of_get_child_count(dn) == 0) 137262306a36Sopenharmony_ci return -ENODEV; 137362306a36Sopenharmony_ci 137462306a36Sopenharmony_ci /* Get init data for this PHY */ 137562306a36Sopenharmony_ci data = of_device_get_match_data(dev); 137662306a36Sopenharmony_ci if (!data) 137762306a36Sopenharmony_ci return -EINVAL; 137862306a36Sopenharmony_ci 137962306a36Sopenharmony_ci sp = devm_kzalloc(dev, struct_size(sp, clk_data.hws, 138062306a36Sopenharmony_ci CDNS_SIERRA_OUTPUT_CLOCKS), 138162306a36Sopenharmony_ci GFP_KERNEL); 138262306a36Sopenharmony_ci if (!sp) 138362306a36Sopenharmony_ci return -ENOMEM; 138462306a36Sopenharmony_ci dev_set_drvdata(dev, sp); 138562306a36Sopenharmony_ci sp->dev = dev; 138662306a36Sopenharmony_ci sp->init_data = data; 138762306a36Sopenharmony_ci 138862306a36Sopenharmony_ci base = devm_platform_ioremap_resource(pdev, 0); 138962306a36Sopenharmony_ci if (IS_ERR(base)) { 139062306a36Sopenharmony_ci dev_err(dev, "missing \"reg\"\n"); 139162306a36Sopenharmony_ci return PTR_ERR(base); 139262306a36Sopenharmony_ci } 139362306a36Sopenharmony_ci 139462306a36Sopenharmony_ci ret = cdns_regmap_init_blocks(sp, base, data->block_offset_shift, 139562306a36Sopenharmony_ci data->reg_offset_shift); 139662306a36Sopenharmony_ci if (ret) 139762306a36Sopenharmony_ci return ret; 139862306a36Sopenharmony_ci 139962306a36Sopenharmony_ci ret = cdns_regfield_init(sp); 140062306a36Sopenharmony_ci if (ret) 140162306a36Sopenharmony_ci return ret; 140262306a36Sopenharmony_ci 140362306a36Sopenharmony_ci platform_set_drvdata(pdev, sp); 140462306a36Sopenharmony_ci 140562306a36Sopenharmony_ci ret = cdns_sierra_phy_get_clocks(sp, dev); 140662306a36Sopenharmony_ci if (ret) 140762306a36Sopenharmony_ci return ret; 140862306a36Sopenharmony_ci 140962306a36Sopenharmony_ci ret = cdns_sierra_clk_register(sp); 141062306a36Sopenharmony_ci if (ret) 141162306a36Sopenharmony_ci return ret; 141262306a36Sopenharmony_ci 141362306a36Sopenharmony_ci ret = cdns_sierra_phy_enable_clocks(sp); 141462306a36Sopenharmony_ci if (ret) 141562306a36Sopenharmony_ci goto unregister_clk; 141662306a36Sopenharmony_ci 141762306a36Sopenharmony_ci regmap_field_read(sp->pma_cmn_ready, &sp->already_configured); 141862306a36Sopenharmony_ci 141962306a36Sopenharmony_ci if (!sp->already_configured) { 142062306a36Sopenharmony_ci ret = cdns_sierra_phy_clk(sp); 142162306a36Sopenharmony_ci if (ret) 142262306a36Sopenharmony_ci goto clk_disable; 142362306a36Sopenharmony_ci 142462306a36Sopenharmony_ci ret = cdns_sierra_phy_get_resets(sp, dev); 142562306a36Sopenharmony_ci if (ret) 142662306a36Sopenharmony_ci goto clk_disable; 142762306a36Sopenharmony_ci 142862306a36Sopenharmony_ci /* Enable APB */ 142962306a36Sopenharmony_ci reset_control_deassert(sp->apb_rst); 143062306a36Sopenharmony_ci } 143162306a36Sopenharmony_ci 143262306a36Sopenharmony_ci /* Check that PHY is present */ 143362306a36Sopenharmony_ci regmap_field_read(sp->macro_id_type, &id_value); 143462306a36Sopenharmony_ci if (sp->init_data->id_value != id_value) { 143562306a36Sopenharmony_ci ret = -EINVAL; 143662306a36Sopenharmony_ci goto ctrl_assert; 143762306a36Sopenharmony_ci } 143862306a36Sopenharmony_ci 143962306a36Sopenharmony_ci sp->autoconf = of_property_read_bool(dn, "cdns,autoconf"); 144062306a36Sopenharmony_ci 144162306a36Sopenharmony_ci for_each_available_child_of_node(dn, child) { 144262306a36Sopenharmony_ci struct phy *gphy; 144362306a36Sopenharmony_ci 144462306a36Sopenharmony_ci if (!(of_node_name_eq(child, "phy") || 144562306a36Sopenharmony_ci of_node_name_eq(child, "link"))) 144662306a36Sopenharmony_ci continue; 144762306a36Sopenharmony_ci 144862306a36Sopenharmony_ci sp->phys[node].lnk_rst = 144962306a36Sopenharmony_ci of_reset_control_array_get_exclusive(child); 145062306a36Sopenharmony_ci 145162306a36Sopenharmony_ci if (IS_ERR(sp->phys[node].lnk_rst)) { 145262306a36Sopenharmony_ci dev_err(dev, "failed to get reset %s\n", 145362306a36Sopenharmony_ci child->full_name); 145462306a36Sopenharmony_ci ret = PTR_ERR(sp->phys[node].lnk_rst); 145562306a36Sopenharmony_ci of_node_put(child); 145662306a36Sopenharmony_ci goto put_control; 145762306a36Sopenharmony_ci } 145862306a36Sopenharmony_ci 145962306a36Sopenharmony_ci if (!sp->autoconf) { 146062306a36Sopenharmony_ci ret = cdns_sierra_get_optional(&sp->phys[node], child); 146162306a36Sopenharmony_ci if (ret) { 146262306a36Sopenharmony_ci dev_err(dev, "missing property in node %s\n", 146362306a36Sopenharmony_ci child->name); 146462306a36Sopenharmony_ci of_node_put(child); 146562306a36Sopenharmony_ci reset_control_put(sp->phys[node].lnk_rst); 146662306a36Sopenharmony_ci goto put_control; 146762306a36Sopenharmony_ci } 146862306a36Sopenharmony_ci } 146962306a36Sopenharmony_ci 147062306a36Sopenharmony_ci sp->num_lanes += sp->phys[node].num_lanes; 147162306a36Sopenharmony_ci 147262306a36Sopenharmony_ci if (!sp->already_configured) 147362306a36Sopenharmony_ci gphy = devm_phy_create(dev, child, &ops); 147462306a36Sopenharmony_ci else 147562306a36Sopenharmony_ci gphy = devm_phy_create(dev, child, &noop_ops); 147662306a36Sopenharmony_ci if (IS_ERR(gphy)) { 147762306a36Sopenharmony_ci ret = PTR_ERR(gphy); 147862306a36Sopenharmony_ci of_node_put(child); 147962306a36Sopenharmony_ci reset_control_put(sp->phys[node].lnk_rst); 148062306a36Sopenharmony_ci goto put_control; 148162306a36Sopenharmony_ci } 148262306a36Sopenharmony_ci sp->phys[node].phy = gphy; 148362306a36Sopenharmony_ci phy_set_drvdata(gphy, &sp->phys[node]); 148462306a36Sopenharmony_ci 148562306a36Sopenharmony_ci node++; 148662306a36Sopenharmony_ci } 148762306a36Sopenharmony_ci sp->nsubnodes = node; 148862306a36Sopenharmony_ci 148962306a36Sopenharmony_ci if (sp->num_lanes > SIERRA_MAX_LANES) { 149062306a36Sopenharmony_ci ret = -EINVAL; 149162306a36Sopenharmony_ci dev_err(dev, "Invalid lane configuration\n"); 149262306a36Sopenharmony_ci goto put_control; 149362306a36Sopenharmony_ci } 149462306a36Sopenharmony_ci 149562306a36Sopenharmony_ci /* If more than one subnode, configure the PHY as multilink */ 149662306a36Sopenharmony_ci if (!sp->already_configured && !sp->autoconf && sp->nsubnodes > 1) { 149762306a36Sopenharmony_ci ret = cdns_sierra_phy_configure_multilink(sp); 149862306a36Sopenharmony_ci if (ret) 149962306a36Sopenharmony_ci goto put_control; 150062306a36Sopenharmony_ci } 150162306a36Sopenharmony_ci 150262306a36Sopenharmony_ci pm_runtime_enable(dev); 150362306a36Sopenharmony_ci phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 150462306a36Sopenharmony_ci if (IS_ERR(phy_provider)) { 150562306a36Sopenharmony_ci ret = PTR_ERR(phy_provider); 150662306a36Sopenharmony_ci goto put_control; 150762306a36Sopenharmony_ci } 150862306a36Sopenharmony_ci 150962306a36Sopenharmony_ci return 0; 151062306a36Sopenharmony_ci 151162306a36Sopenharmony_ciput_control: 151262306a36Sopenharmony_ci while (--node >= 0) 151362306a36Sopenharmony_ci reset_control_put(sp->phys[node].lnk_rst); 151462306a36Sopenharmony_cictrl_assert: 151562306a36Sopenharmony_ci if (!sp->already_configured) 151662306a36Sopenharmony_ci reset_control_assert(sp->apb_rst); 151762306a36Sopenharmony_ciclk_disable: 151862306a36Sopenharmony_ci cdns_sierra_phy_disable_clocks(sp); 151962306a36Sopenharmony_ciunregister_clk: 152062306a36Sopenharmony_ci cdns_sierra_clk_unregister(sp); 152162306a36Sopenharmony_ci return ret; 152262306a36Sopenharmony_ci} 152362306a36Sopenharmony_ci 152462306a36Sopenharmony_cistatic void cdns_sierra_phy_remove(struct platform_device *pdev) 152562306a36Sopenharmony_ci{ 152662306a36Sopenharmony_ci struct cdns_sierra_phy *phy = platform_get_drvdata(pdev); 152762306a36Sopenharmony_ci int i; 152862306a36Sopenharmony_ci 152962306a36Sopenharmony_ci reset_control_assert(phy->phy_rst); 153062306a36Sopenharmony_ci reset_control_assert(phy->apb_rst); 153162306a36Sopenharmony_ci pm_runtime_disable(&pdev->dev); 153262306a36Sopenharmony_ci 153362306a36Sopenharmony_ci cdns_sierra_phy_disable_clocks(phy); 153462306a36Sopenharmony_ci /* 153562306a36Sopenharmony_ci * The device level resets will be put automatically. 153662306a36Sopenharmony_ci * Need to put the subnode resets here though. 153762306a36Sopenharmony_ci */ 153862306a36Sopenharmony_ci for (i = 0; i < phy->nsubnodes; i++) { 153962306a36Sopenharmony_ci reset_control_assert(phy->phys[i].lnk_rst); 154062306a36Sopenharmony_ci reset_control_put(phy->phys[i].lnk_rst); 154162306a36Sopenharmony_ci } 154262306a36Sopenharmony_ci 154362306a36Sopenharmony_ci cdns_sierra_clk_unregister(phy); 154462306a36Sopenharmony_ci} 154562306a36Sopenharmony_ci 154662306a36Sopenharmony_ci/* SGMII PHY PMA lane configuration */ 154762306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_phy_pma_ln_regs[] = { 154862306a36Sopenharmony_ci {0x9010, SIERRA_PHY_PMA_XCVR_CTRL} 154962306a36Sopenharmony_ci}; 155062306a36Sopenharmony_ci 155162306a36Sopenharmony_cistatic struct cdns_sierra_vals sgmii_phy_pma_ln_vals = { 155262306a36Sopenharmony_ci .reg_pairs = sgmii_phy_pma_ln_regs, 155362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_phy_pma_ln_regs), 155462306a36Sopenharmony_ci}; 155562306a36Sopenharmony_ci 155662306a36Sopenharmony_ci/* SGMII refclk 100MHz, no ssc, opt3 and GE1 links using PLL LC1 */ 155762306a36Sopenharmony_cistatic const struct cdns_reg_pairs sgmii_100_no_ssc_plllc1_opt3_cmn_regs[] = { 155862306a36Sopenharmony_ci {0x002D, SIERRA_CMN_PLLLC1_FBDIV_INT_PREG}, 155962306a36Sopenharmony_ci {0x2085, SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG}, 156062306a36Sopenharmony_ci {0x1005, SIERRA_CMN_PLLLC1_CLK0_PREG}, 156162306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG}, 156262306a36Sopenharmony_ci {0x0800, SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG} 156362306a36Sopenharmony_ci}; 156462306a36Sopenharmony_ci 156562306a36Sopenharmony_cistatic const struct cdns_reg_pairs sgmii_100_no_ssc_plllc1_opt3_ln_regs[] = { 156662306a36Sopenharmony_ci {0x688E, SIERRA_DET_STANDEC_D_PREG}, 156762306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 156862306a36Sopenharmony_ci {0x0FFE, SIERRA_PSC_RX_A0_PREG}, 156962306a36Sopenharmony_ci {0x0106, SIERRA_PLLCTRL_FBDIV_MODE01_PREG}, 157062306a36Sopenharmony_ci {0x0013, SIERRA_PLLCTRL_SUBRATE_PREG}, 157162306a36Sopenharmony_ci {0x0003, SIERRA_PLLCTRL_GEN_A_PREG}, 157262306a36Sopenharmony_ci {0x0106, SIERRA_PLLCTRL_GEN_D_PREG}, 157362306a36Sopenharmony_ci {0x5231, SIERRA_PLLCTRL_CPGAIN_MODE_PREG }, 157462306a36Sopenharmony_ci {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 157562306a36Sopenharmony_ci {0x9702, SIERRA_DRVCTRL_BOOST_PREG}, 157662306a36Sopenharmony_ci {0x0051, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 157762306a36Sopenharmony_ci {0x3C0E, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 157862306a36Sopenharmony_ci {0x3220, SIERRA_CREQ_FSMCLK_SEL_PREG}, 157962306a36Sopenharmony_ci {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 158062306a36Sopenharmony_ci {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, 158162306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT0}, 158262306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT1}, 158362306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT2}, 158462306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT3}, 158562306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 158662306a36Sopenharmony_ci {0x0861, SIERRA_DEQ_ALUT0}, 158762306a36Sopenharmony_ci {0x07E0, SIERRA_DEQ_ALUT1}, 158862306a36Sopenharmony_ci {0x079E, SIERRA_DEQ_ALUT2}, 158962306a36Sopenharmony_ci {0x071D, SIERRA_DEQ_ALUT3}, 159062306a36Sopenharmony_ci {0x03F5, SIERRA_DEQ_DFETAP_CTRL_PREG}, 159162306a36Sopenharmony_ci {0x0C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG}, 159262306a36Sopenharmony_ci {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 159362306a36Sopenharmony_ci {0x1C04, SIERRA_DEQ_TAU_CTRL2_PREG}, 159462306a36Sopenharmony_ci {0x0033, SIERRA_DEQ_PICTRL_PREG}, 159562306a36Sopenharmony_ci {0x0000, SIERRA_CPI_OUTBUF_RATESEL_PREG}, 159662306a36Sopenharmony_ci {0x0B6D, SIERRA_CPI_RESBIAS_BIN_PREG}, 159762306a36Sopenharmony_ci {0x0102, SIERRA_RXBUFFER_CTLECTRL_PREG}, 159862306a36Sopenharmony_ci {0x0002, SIERRA_RXBUFFER_RCDFECTRL_PREG} 159962306a36Sopenharmony_ci}; 160062306a36Sopenharmony_ci 160162306a36Sopenharmony_cistatic struct cdns_sierra_vals sgmii_100_no_ssc_plllc1_opt3_cmn_vals = { 160262306a36Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_plllc1_opt3_cmn_regs, 160362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_plllc1_opt3_cmn_regs), 160462306a36Sopenharmony_ci}; 160562306a36Sopenharmony_ci 160662306a36Sopenharmony_cistatic struct cdns_sierra_vals sgmii_100_no_ssc_plllc1_opt3_ln_vals = { 160762306a36Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_plllc1_opt3_ln_regs, 160862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_plllc1_opt3_ln_regs), 160962306a36Sopenharmony_ci}; 161062306a36Sopenharmony_ci 161162306a36Sopenharmony_ci/* QSGMII PHY PMA lane configuration */ 161262306a36Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_phy_pma_ln_regs[] = { 161362306a36Sopenharmony_ci {0x9010, SIERRA_PHY_PMA_XCVR_CTRL} 161462306a36Sopenharmony_ci}; 161562306a36Sopenharmony_ci 161662306a36Sopenharmony_cistatic struct cdns_sierra_vals qsgmii_phy_pma_ln_vals = { 161762306a36Sopenharmony_ci .reg_pairs = qsgmii_phy_pma_ln_regs, 161862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_phy_pma_ln_regs), 161962306a36Sopenharmony_ci}; 162062306a36Sopenharmony_ci 162162306a36Sopenharmony_ci/* QSGMII refclk 100MHz, 20b, opt1, No BW cal, no ssc, PLL LC1 */ 162262306a36Sopenharmony_cistatic const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_cmn_regs[] = { 162362306a36Sopenharmony_ci {0x2085, SIERRA_CMN_PLLLC1_LF_COEFF_MODE0_PREG}, 162462306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC1_BWCAL_MODE0_PREG}, 162562306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC1_SS_TIME_STEPSIZE_MODE_PREG} 162662306a36Sopenharmony_ci}; 162762306a36Sopenharmony_ci 162862306a36Sopenharmony_cistatic const struct cdns_reg_pairs qsgmii_100_no_ssc_plllc1_ln_regs[] = { 162962306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 163062306a36Sopenharmony_ci {0x0252, SIERRA_DET_STANDEC_E_PREG}, 163162306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 163262306a36Sopenharmony_ci {0x0FFE, SIERRA_PSC_RX_A0_PREG}, 163362306a36Sopenharmony_ci {0x0011, SIERRA_PLLCTRL_SUBRATE_PREG}, 163462306a36Sopenharmony_ci {0x0001, SIERRA_PLLCTRL_GEN_A_PREG}, 163562306a36Sopenharmony_ci {0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG}, 163662306a36Sopenharmony_ci {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 163762306a36Sopenharmony_ci {0x0089, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 163862306a36Sopenharmony_ci {0x3C3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 163962306a36Sopenharmony_ci {0x3222, SIERRA_CREQ_FSMCLK_SEL_PREG}, 164062306a36Sopenharmony_ci {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 164162306a36Sopenharmony_ci {0x8422, SIERRA_CTLELUT_CTRL_PREG}, 164262306a36Sopenharmony_ci {0x4111, SIERRA_DFE_ECMP_RATESEL_PREG}, 164362306a36Sopenharmony_ci {0x4111, SIERRA_DFE_SMP_RATESEL_PREG}, 164462306a36Sopenharmony_ci {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, 164562306a36Sopenharmony_ci {0x9595, SIERRA_DEQ_VGATUNE_CTRL_PREG}, 164662306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT0}, 164762306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT1}, 164862306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT2}, 164962306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT3}, 165062306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 165162306a36Sopenharmony_ci {0x0861, SIERRA_DEQ_ALUT0}, 165262306a36Sopenharmony_ci {0x07E0, SIERRA_DEQ_ALUT1}, 165362306a36Sopenharmony_ci {0x079E, SIERRA_DEQ_ALUT2}, 165462306a36Sopenharmony_ci {0x071D, SIERRA_DEQ_ALUT3}, 165562306a36Sopenharmony_ci {0x03F5, SIERRA_DEQ_DFETAP_CTRL_PREG}, 165662306a36Sopenharmony_ci {0x0C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG}, 165762306a36Sopenharmony_ci {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 165862306a36Sopenharmony_ci {0x1C04, SIERRA_DEQ_TAU_CTRL2_PREG}, 165962306a36Sopenharmony_ci {0x0033, SIERRA_DEQ_PICTRL_PREG}, 166062306a36Sopenharmony_ci {0x0660, SIERRA_CPICAL_TMRVAL_MODE0_PREG}, 166162306a36Sopenharmony_ci {0x00D5, SIERRA_CPI_OUTBUF_RATESEL_PREG}, 166262306a36Sopenharmony_ci {0x0B6D, SIERRA_CPI_RESBIAS_BIN_PREG}, 166362306a36Sopenharmony_ci {0x0102, SIERRA_RXBUFFER_CTLECTRL_PREG}, 166462306a36Sopenharmony_ci {0x0002, SIERRA_RXBUFFER_RCDFECTRL_PREG} 166562306a36Sopenharmony_ci}; 166662306a36Sopenharmony_ci 166762306a36Sopenharmony_cistatic struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_cmn_vals = { 166862306a36Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_plllc1_cmn_regs, 166962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_cmn_regs), 167062306a36Sopenharmony_ci}; 167162306a36Sopenharmony_ci 167262306a36Sopenharmony_cistatic struct cdns_sierra_vals qsgmii_100_no_ssc_plllc1_ln_vals = { 167362306a36Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_plllc1_ln_regs, 167462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_plllc1_ln_regs), 167562306a36Sopenharmony_ci}; 167662306a36Sopenharmony_ci 167762306a36Sopenharmony_ci/* PCIE PHY PCS common configuration */ 167862306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_phy_pcs_cmn_regs[] = { 167962306a36Sopenharmony_ci {0x0430, SIERRA_PHY_PIPE_CMN_CTRL1} 168062306a36Sopenharmony_ci}; 168162306a36Sopenharmony_ci 168262306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_phy_pcs_cmn_vals = { 168362306a36Sopenharmony_ci .reg_pairs = pcie_phy_pcs_cmn_regs, 168462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_phy_pcs_cmn_regs), 168562306a36Sopenharmony_ci}; 168662306a36Sopenharmony_ci 168762306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_cmn_pll_no_ssc, pcie_links_using_plllc, pipe_bw_3 */ 168862306a36Sopenharmony_cistatic const struct cdns_reg_pairs pcie_100_no_ssc_plllc_cmn_regs[] = { 168962306a36Sopenharmony_ci {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 169062306a36Sopenharmony_ci {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 169162306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 169262306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG} 169362306a36Sopenharmony_ci}; 169462306a36Sopenharmony_ci 169562306a36Sopenharmony_ci/* 169662306a36Sopenharmony_ci * refclk100MHz_32b_PCIe_ln_no_ssc, multilink, using_plllc, 169762306a36Sopenharmony_ci * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 169862306a36Sopenharmony_ci */ 169962306a36Sopenharmony_cistatic const struct cdns_reg_pairs ml_pcie_100_no_ssc_ln_regs[] = { 170062306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 170162306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 170262306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A3_PREG}, 170362306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A4_PREG}, 170462306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 170562306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 170662306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 170762306a36Sopenharmony_ci {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 170862306a36Sopenharmony_ci {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 170962306a36Sopenharmony_ci {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 171062306a36Sopenharmony_ci {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 171162306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 171262306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 171362306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 171462306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 171562306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 171662306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 171762306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 171862306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 171962306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 172062306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 172162306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 172262306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 172362306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 172462306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 172562306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 172662306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 172762306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 172862306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 172962306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 173062306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 173162306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 173262306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 173362306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 173462306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 173562306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 173662306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 173762306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 173862306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 173962306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 174062306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 174162306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 174262306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 174362306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 174462306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 174562306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 174662306a36Sopenharmony_ci}; 174762306a36Sopenharmony_ci 174862306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_no_ssc_plllc_cmn_vals = { 174962306a36Sopenharmony_ci .reg_pairs = pcie_100_no_ssc_plllc_cmn_regs, 175062306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_no_ssc_plllc_cmn_regs), 175162306a36Sopenharmony_ci}; 175262306a36Sopenharmony_ci 175362306a36Sopenharmony_cistatic struct cdns_sierra_vals ml_pcie_100_no_ssc_ln_vals = { 175462306a36Sopenharmony_ci .reg_pairs = ml_pcie_100_no_ssc_ln_regs, 175562306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ml_pcie_100_no_ssc_ln_regs), 175662306a36Sopenharmony_ci}; 175762306a36Sopenharmony_ci 175862306a36Sopenharmony_ci/* 175962306a36Sopenharmony_ci * TI J721E: 176062306a36Sopenharmony_ci * refclk100MHz_32b_PCIe_ln_no_ssc, multilink, using_plllc, 176162306a36Sopenharmony_ci * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 176262306a36Sopenharmony_ci */ 176362306a36Sopenharmony_cistatic const struct cdns_reg_pairs ti_ml_pcie_100_no_ssc_ln_regs[] = { 176462306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 176562306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 176662306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A3_PREG}, 176762306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A4_PREG}, 176862306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 176962306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 177062306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 177162306a36Sopenharmony_ci {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 177262306a36Sopenharmony_ci {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 177362306a36Sopenharmony_ci {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 177462306a36Sopenharmony_ci {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 177562306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 177662306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 177762306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 177862306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 177962306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 178062306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 178162306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 178262306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 178362306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 178462306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 178562306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 178662306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 178762306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 178862306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 178962306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 179062306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 179162306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 179262306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 179362306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 179462306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 179562306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 179662306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 179762306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 179862306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 179962306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 180062306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 180162306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 180262306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 180362306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 180462306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 180562306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 180662306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 180762306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 180862306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 180962306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}, 181062306a36Sopenharmony_ci {0x0002, SIERRA_TX_RCVDET_OVRD_PREG} 181162306a36Sopenharmony_ci}; 181262306a36Sopenharmony_ci 181362306a36Sopenharmony_cistatic struct cdns_sierra_vals ti_ml_pcie_100_no_ssc_ln_vals = { 181462306a36Sopenharmony_ci .reg_pairs = ti_ml_pcie_100_no_ssc_ln_regs, 181562306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ti_ml_pcie_100_no_ssc_ln_regs), 181662306a36Sopenharmony_ci}; 181762306a36Sopenharmony_ci 181862306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_cmn_pll_int_ssc, pcie_links_using_plllc, pipe_bw_3 */ 181962306a36Sopenharmony_cistatic const struct cdns_reg_pairs pcie_100_int_ssc_plllc_cmn_regs[] = { 182062306a36Sopenharmony_ci {0x000E, SIERRA_CMN_PLLLC_MODE_PREG}, 182162306a36Sopenharmony_ci {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 182262306a36Sopenharmony_ci {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 182362306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 182462306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 182562306a36Sopenharmony_ci {0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG}, 182662306a36Sopenharmony_ci {0x7F80, SIERRA_CMN_PLLLC_SS_PREG}, 182762306a36Sopenharmony_ci {0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG}, 182862306a36Sopenharmony_ci {0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG}, 182962306a36Sopenharmony_ci {0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}, 183062306a36Sopenharmony_ci {0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG} 183162306a36Sopenharmony_ci}; 183262306a36Sopenharmony_ci 183362306a36Sopenharmony_ci/* 183462306a36Sopenharmony_ci * refclk100MHz_32b_PCIe_ln_int_ssc, multilink, using_plllc, 183562306a36Sopenharmony_ci * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 183662306a36Sopenharmony_ci */ 183762306a36Sopenharmony_cistatic const struct cdns_reg_pairs ml_pcie_100_int_ssc_ln_regs[] = { 183862306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 183962306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 184062306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A3_PREG}, 184162306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A4_PREG}, 184262306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 184362306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 184462306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 184562306a36Sopenharmony_ci {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 184662306a36Sopenharmony_ci {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 184762306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 184862306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 184962306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 185062306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 185162306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 185262306a36Sopenharmony_ci {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 185362306a36Sopenharmony_ci {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 185462306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 185562306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 185662306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 185762306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 185862306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 185962306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 186062306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 186162306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 186262306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 186362306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 186462306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 186562306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 186662306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 186762306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 186862306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 186962306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 187062306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 187162306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 187262306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 187362306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 187462306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 187562306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 187662306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 187762306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 187862306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 187962306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 188062306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 188162306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 188262306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 188362306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 188462306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 188562306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 188662306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 188762306a36Sopenharmony_ci}; 188862306a36Sopenharmony_ci 188962306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_int_ssc_plllc_cmn_vals = { 189062306a36Sopenharmony_ci .reg_pairs = pcie_100_int_ssc_plllc_cmn_regs, 189162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_int_ssc_plllc_cmn_regs), 189262306a36Sopenharmony_ci}; 189362306a36Sopenharmony_ci 189462306a36Sopenharmony_cistatic struct cdns_sierra_vals ml_pcie_100_int_ssc_ln_vals = { 189562306a36Sopenharmony_ci .reg_pairs = ml_pcie_100_int_ssc_ln_regs, 189662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ml_pcie_100_int_ssc_ln_regs), 189762306a36Sopenharmony_ci}; 189862306a36Sopenharmony_ci 189962306a36Sopenharmony_ci/* 190062306a36Sopenharmony_ci * TI J721E: 190162306a36Sopenharmony_ci * refclk100MHz_32b_PCIe_ln_int_ssc, multilink, using_plllc, 190262306a36Sopenharmony_ci * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 190362306a36Sopenharmony_ci */ 190462306a36Sopenharmony_cistatic const struct cdns_reg_pairs ti_ml_pcie_100_int_ssc_ln_regs[] = { 190562306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 190662306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 190762306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A3_PREG}, 190862306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A4_PREG}, 190962306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 191062306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 191162306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 191262306a36Sopenharmony_ci {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 191362306a36Sopenharmony_ci {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 191462306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 191562306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 191662306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 191762306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 191862306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 191962306a36Sopenharmony_ci {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 192062306a36Sopenharmony_ci {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 192162306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 192262306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 192362306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 192462306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 192562306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 192662306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 192762306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 192862306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 192962306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 193062306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 193162306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 193262306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 193362306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 193462306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 193562306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 193662306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 193762306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 193862306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 193962306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 194062306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 194162306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 194262306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 194362306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 194462306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 194562306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 194662306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 194762306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 194862306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 194962306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 195062306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 195162306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 195262306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 195362306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}, 195462306a36Sopenharmony_ci {0x0002, SIERRA_TX_RCVDET_OVRD_PREG} 195562306a36Sopenharmony_ci}; 195662306a36Sopenharmony_ci 195762306a36Sopenharmony_cistatic struct cdns_sierra_vals ti_ml_pcie_100_int_ssc_ln_vals = { 195862306a36Sopenharmony_ci .reg_pairs = ti_ml_pcie_100_int_ssc_ln_regs, 195962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ti_ml_pcie_100_int_ssc_ln_regs), 196062306a36Sopenharmony_ci}; 196162306a36Sopenharmony_ci 196262306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc, pcie_links_using_plllc, pipe_bw_3 */ 196362306a36Sopenharmony_cistatic const struct cdns_reg_pairs pcie_100_ext_ssc_plllc_cmn_regs[] = { 196462306a36Sopenharmony_ci {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 196562306a36Sopenharmony_ci {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 196662306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 196762306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 196862306a36Sopenharmony_ci {0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG} 196962306a36Sopenharmony_ci}; 197062306a36Sopenharmony_ci 197162306a36Sopenharmony_ci/* 197262306a36Sopenharmony_ci * refclk100MHz_32b_PCIe_ln_ext_ssc, multilink, using_plllc, 197362306a36Sopenharmony_ci * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 197462306a36Sopenharmony_ci */ 197562306a36Sopenharmony_cistatic const struct cdns_reg_pairs ml_pcie_100_ext_ssc_ln_regs[] = { 197662306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 197762306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 197862306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A3_PREG}, 197962306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A4_PREG}, 198062306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 198162306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 198262306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 198362306a36Sopenharmony_ci {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 198462306a36Sopenharmony_ci {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 198562306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 198662306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 198762306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 198862306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 198962306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 199062306a36Sopenharmony_ci {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 199162306a36Sopenharmony_ci {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 199262306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 199362306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 199462306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 199562306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 199662306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 199762306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 199862306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 199962306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 200062306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 200162306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 200262306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 200362306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 200462306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 200562306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 200662306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 200762306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 200862306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 200962306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 201062306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 201162306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 201262306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 201362306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 201462306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 201562306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 201662306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 201762306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 201862306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 201962306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 202062306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 202162306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 202262306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 202362306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 202462306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 202562306a36Sopenharmony_ci}; 202662306a36Sopenharmony_ci 202762306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_ext_ssc_plllc_cmn_vals = { 202862306a36Sopenharmony_ci .reg_pairs = pcie_100_ext_ssc_plllc_cmn_regs, 202962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_ext_ssc_plllc_cmn_regs), 203062306a36Sopenharmony_ci}; 203162306a36Sopenharmony_ci 203262306a36Sopenharmony_cistatic struct cdns_sierra_vals ml_pcie_100_ext_ssc_ln_vals = { 203362306a36Sopenharmony_ci .reg_pairs = ml_pcie_100_ext_ssc_ln_regs, 203462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ml_pcie_100_ext_ssc_ln_regs), 203562306a36Sopenharmony_ci}; 203662306a36Sopenharmony_ci 203762306a36Sopenharmony_ci/* 203862306a36Sopenharmony_ci * TI J721E: 203962306a36Sopenharmony_ci * refclk100MHz_32b_PCIe_ln_ext_ssc, multilink, using_plllc, 204062306a36Sopenharmony_ci * cmn_pllcy_anaclk0_1Ghz, xcvr_pllclk_fullrt_500mhz 204162306a36Sopenharmony_ci */ 204262306a36Sopenharmony_cistatic const struct cdns_reg_pairs ti_ml_pcie_100_ext_ssc_ln_regs[] = { 204362306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 204462306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 204562306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A3_PREG}, 204662306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_A4_PREG}, 204762306a36Sopenharmony_ci {0x0004, SIERRA_PSC_LN_IDLE_PREG}, 204862306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 204962306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 205062306a36Sopenharmony_ci {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 205162306a36Sopenharmony_ci {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 205262306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 205362306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 205462306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 205562306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 205662306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 205762306a36Sopenharmony_ci {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 205862306a36Sopenharmony_ci {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 205962306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 206062306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 206162306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 206262306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 206362306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 206462306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 206562306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 206662306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 206762306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 206862306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 206962306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 207062306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 207162306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 207262306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 207362306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 207462306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 207562306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 207662306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 207762306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 207862306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 207962306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 208062306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 208162306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 208262306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 208362306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 208462306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 208562306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 208662306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 208762306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 208862306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 208962306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 209062306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 209162306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG}, 209262306a36Sopenharmony_ci {0x0002, SIERRA_TX_RCVDET_OVRD_PREG} 209362306a36Sopenharmony_ci}; 209462306a36Sopenharmony_ci 209562306a36Sopenharmony_cistatic struct cdns_sierra_vals ti_ml_pcie_100_ext_ssc_ln_vals = { 209662306a36Sopenharmony_ci .reg_pairs = ti_ml_pcie_100_ext_ssc_ln_regs, 209762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ti_ml_pcie_100_ext_ssc_ln_regs), 209862306a36Sopenharmony_ci}; 209962306a36Sopenharmony_ci 210062306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_cmn_pll_no_ssc */ 210162306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_pcie_cmn_regs_no_ssc[] = { 210262306a36Sopenharmony_ci {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 210362306a36Sopenharmony_ci {0x2105, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 210462306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 210562306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG} 210662306a36Sopenharmony_ci}; 210762306a36Sopenharmony_ci 210862306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_ln_no_ssc */ 210962306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_pcie_ln_regs_no_ssc[] = { 211062306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 211162306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 211262306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 211362306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 211462306a36Sopenharmony_ci {0x8055, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 211562306a36Sopenharmony_ci {0x80BB, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 211662306a36Sopenharmony_ci {0x8351, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 211762306a36Sopenharmony_ci {0x8349, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 211862306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 211962306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 212062306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 212162306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 212262306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 212362306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 212462306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 212562306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 212662306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 212762306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 212862306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 212962306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 213062306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 213162306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 213262306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 213362306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 213462306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 213562306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 213662306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 213762306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 213862306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 213962306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 214062306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 214162306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 214262306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 214362306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 214462306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 214562306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 214662306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 214762306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 214862306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 214962306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 215062306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 215162306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 215262306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 215362306a36Sopenharmony_ci}; 215462306a36Sopenharmony_ci 215562306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_no_ssc_cmn_vals = { 215662306a36Sopenharmony_ci .reg_pairs = cdns_pcie_cmn_regs_no_ssc, 215762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_no_ssc), 215862306a36Sopenharmony_ci}; 215962306a36Sopenharmony_ci 216062306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_no_ssc_ln_vals = { 216162306a36Sopenharmony_ci .reg_pairs = cdns_pcie_ln_regs_no_ssc, 216262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_no_ssc), 216362306a36Sopenharmony_ci}; 216462306a36Sopenharmony_ci 216562306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_cmn_pll_int_ssc */ 216662306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_pcie_cmn_regs_int_ssc[] = { 216762306a36Sopenharmony_ci {0x000E, SIERRA_CMN_PLLLC_MODE_PREG}, 216862306a36Sopenharmony_ci {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 216962306a36Sopenharmony_ci {0x4006, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 217062306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 217162306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 217262306a36Sopenharmony_ci {0x0581, SIERRA_CMN_PLLLC_DSMCORR_PREG}, 217362306a36Sopenharmony_ci {0x7F80, SIERRA_CMN_PLLLC_SS_PREG}, 217462306a36Sopenharmony_ci {0x0041, SIERRA_CMN_PLLLC_SS_AMP_STEP_SIZE_PREG}, 217562306a36Sopenharmony_ci {0x0464, SIERRA_CMN_PLLLC_SSTWOPT_PREG}, 217662306a36Sopenharmony_ci {0x0D0D, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}, 217762306a36Sopenharmony_ci {0x0060, SIERRA_CMN_PLLLC_LOCK_DELAY_CTRL_PREG} 217862306a36Sopenharmony_ci}; 217962306a36Sopenharmony_ci 218062306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_ln_int_ssc */ 218162306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_pcie_ln_regs_int_ssc[] = { 218262306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 218362306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 218462306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 218562306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 218662306a36Sopenharmony_ci {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 218762306a36Sopenharmony_ci {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 218862306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 218962306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 219062306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 219162306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 219262306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 219362306a36Sopenharmony_ci {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 219462306a36Sopenharmony_ci {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 219562306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 219662306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 219762306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 219862306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 219962306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 220062306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 220162306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 220262306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 220362306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 220462306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 220562306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 220662306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 220762306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 220862306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 220962306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 221062306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 221162306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 221262306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 221362306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 221462306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 221562306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 221662306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 221762306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 221862306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 221962306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 222062306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 222162306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 222262306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 222362306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 222462306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 222562306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 222662306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 222762306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 222862306a36Sopenharmony_ci}; 222962306a36Sopenharmony_ci 223062306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_int_ssc_cmn_vals = { 223162306a36Sopenharmony_ci .reg_pairs = cdns_pcie_cmn_regs_int_ssc, 223262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_int_ssc), 223362306a36Sopenharmony_ci}; 223462306a36Sopenharmony_ci 223562306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_int_ssc_ln_vals = { 223662306a36Sopenharmony_ci .reg_pairs = cdns_pcie_ln_regs_int_ssc, 223762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_int_ssc), 223862306a36Sopenharmony_ci}; 223962306a36Sopenharmony_ci 224062306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_cmn_pll_ext_ssc */ 224162306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_pcie_cmn_regs_ext_ssc[] = { 224262306a36Sopenharmony_ci {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 224362306a36Sopenharmony_ci {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 224462306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE1_PREG}, 224562306a36Sopenharmony_ci {0x8A06, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 224662306a36Sopenharmony_ci {0x1B1B, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG} 224762306a36Sopenharmony_ci}; 224862306a36Sopenharmony_ci 224962306a36Sopenharmony_ci/* refclk100MHz_32b_PCIe_ln_ext_ssc */ 225062306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_pcie_ln_regs_ext_ssc[] = { 225162306a36Sopenharmony_ci {0xFC08, SIERRA_DET_STANDEC_A_PREG}, 225262306a36Sopenharmony_ci {0x001D, SIERRA_PSM_A3IN_TMR_PREG}, 225362306a36Sopenharmony_ci {0x1555, SIERRA_DFE_BIASTRIM_PREG}, 225462306a36Sopenharmony_ci {0x9703, SIERRA_DRVCTRL_BOOST_PREG}, 225562306a36Sopenharmony_ci {0x813E, SIERRA_CLKPATHCTRL_TMR_PREG}, 225662306a36Sopenharmony_ci {0x8047, SIERRA_RX_CREQ_FLTR_A_MODE3_PREG}, 225762306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE2_PREG}, 225862306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 225962306a36Sopenharmony_ci {0x808F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 226062306a36Sopenharmony_ci {0x0002, SIERRA_CREQ_DCBIASATTEN_OVR_PREG}, 226162306a36Sopenharmony_ci {0x9800, SIERRA_RX_CTLE_CAL_PREG}, 226262306a36Sopenharmony_ci {0x033C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 226362306a36Sopenharmony_ci {0x44CC, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 226462306a36Sopenharmony_ci {0x5624, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 226562306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 226662306a36Sopenharmony_ci {0x00FF, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 226762306a36Sopenharmony_ci {0x4C4C, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 226862306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_OFFSET_CTRL_PREG}, 226962306a36Sopenharmony_ci {0x02FA, SIERRA_DEQ_GAIN_CTRL_PREG}, 227062306a36Sopenharmony_ci {0x0041, SIERRA_DEQ_GLUT0}, 227162306a36Sopenharmony_ci {0x0082, SIERRA_DEQ_GLUT1}, 227262306a36Sopenharmony_ci {0x00C3, SIERRA_DEQ_GLUT2}, 227362306a36Sopenharmony_ci {0x0145, SIERRA_DEQ_GLUT3}, 227462306a36Sopenharmony_ci {0x0186, SIERRA_DEQ_GLUT4}, 227562306a36Sopenharmony_ci {0x09E7, SIERRA_DEQ_ALUT0}, 227662306a36Sopenharmony_ci {0x09A6, SIERRA_DEQ_ALUT1}, 227762306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT2}, 227862306a36Sopenharmony_ci {0x08E3, SIERRA_DEQ_ALUT3}, 227962306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP0}, 228062306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP1}, 228162306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP2}, 228262306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP3}, 228362306a36Sopenharmony_ci {0x00FA, SIERRA_DEQ_DFETAP4}, 228462306a36Sopenharmony_ci {0x000F, SIERRA_DEQ_PRECUR_PREG}, 228562306a36Sopenharmony_ci {0x0280, SIERRA_DEQ_POSTCUR_PREG}, 228662306a36Sopenharmony_ci {0x8F00, SIERRA_DEQ_POSTCUR_DECR_PREG}, 228762306a36Sopenharmony_ci {0x3C0F, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 228862306a36Sopenharmony_ci {0x1C0C, SIERRA_DEQ_TAU_CTRL2_PREG}, 228962306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_TAU_CTRL3_PREG}, 229062306a36Sopenharmony_ci {0x5E82, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 229162306a36Sopenharmony_ci {0x002B, SIERRA_CPI_TRIM_PREG}, 229262306a36Sopenharmony_ci {0x0003, SIERRA_EPI_CTRL_PREG}, 229362306a36Sopenharmony_ci {0x803F, SIERRA_SDFILT_H2L_A_PREG}, 229462306a36Sopenharmony_ci {0x0004, SIERRA_RXBUFFER_CTLECTRL_PREG}, 229562306a36Sopenharmony_ci {0x2010, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 229662306a36Sopenharmony_ci {0x4432, SIERRA_RXBUFFER_DFECTRL_PREG} 229762306a36Sopenharmony_ci}; 229862306a36Sopenharmony_ci 229962306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_ext_ssc_cmn_vals = { 230062306a36Sopenharmony_ci .reg_pairs = cdns_pcie_cmn_regs_ext_ssc, 230162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_pcie_cmn_regs_ext_ssc), 230262306a36Sopenharmony_ci}; 230362306a36Sopenharmony_ci 230462306a36Sopenharmony_cistatic struct cdns_sierra_vals pcie_100_ext_ssc_ln_vals = { 230562306a36Sopenharmony_ci .reg_pairs = cdns_pcie_ln_regs_ext_ssc, 230662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_pcie_ln_regs_ext_ssc), 230762306a36Sopenharmony_ci}; 230862306a36Sopenharmony_ci 230962306a36Sopenharmony_ci/* refclk100MHz_20b_USB_cmn_pll_ext_ssc */ 231062306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = { 231162306a36Sopenharmony_ci {0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE1_PREG}, 231262306a36Sopenharmony_ci {0x2085, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 231362306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 231462306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG} 231562306a36Sopenharmony_ci}; 231662306a36Sopenharmony_ci 231762306a36Sopenharmony_ci/* refclk100MHz_20b_USB_ln_ext_ssc */ 231862306a36Sopenharmony_cistatic const struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { 231962306a36Sopenharmony_ci {0xFE0A, SIERRA_DET_STANDEC_A_PREG}, 232062306a36Sopenharmony_ci {0x000F, SIERRA_DET_STANDEC_B_PREG}, 232162306a36Sopenharmony_ci {0x55A5, SIERRA_DET_STANDEC_C_PREG}, 232262306a36Sopenharmony_ci {0x69ad, SIERRA_DET_STANDEC_D_PREG}, 232362306a36Sopenharmony_ci {0x0241, SIERRA_DET_STANDEC_E_PREG}, 232462306a36Sopenharmony_ci {0x0110, SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG}, 232562306a36Sopenharmony_ci {0x0014, SIERRA_PSM_A0IN_TMR_PREG}, 232662306a36Sopenharmony_ci {0xCF00, SIERRA_PSM_DIAG_PREG}, 232762306a36Sopenharmony_ci {0x001F, SIERRA_PSC_TX_A0_PREG}, 232862306a36Sopenharmony_ci {0x0007, SIERRA_PSC_TX_A1_PREG}, 232962306a36Sopenharmony_ci {0x0003, SIERRA_PSC_TX_A2_PREG}, 233062306a36Sopenharmony_ci {0x0003, SIERRA_PSC_TX_A3_PREG}, 233162306a36Sopenharmony_ci {0x0FFF, SIERRA_PSC_RX_A0_PREG}, 233262306a36Sopenharmony_ci {0x0003, SIERRA_PSC_RX_A1_PREG}, 233362306a36Sopenharmony_ci {0x0003, SIERRA_PSC_RX_A2_PREG}, 233462306a36Sopenharmony_ci {0x0001, SIERRA_PSC_RX_A3_PREG}, 233562306a36Sopenharmony_ci {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG}, 233662306a36Sopenharmony_ci {0x0406, SIERRA_PLLCTRL_GEN_D_PREG}, 233762306a36Sopenharmony_ci {0x5233, SIERRA_PLLCTRL_CPGAIN_MODE_PREG}, 233862306a36Sopenharmony_ci {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG}, 233962306a36Sopenharmony_ci {0x2512, SIERRA_DFE_BIASTRIM_PREG}, 234062306a36Sopenharmony_ci {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 234162306a36Sopenharmony_ci {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, 234262306a36Sopenharmony_ci {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, 234362306a36Sopenharmony_ci {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 234462306a36Sopenharmony_ci {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 234562306a36Sopenharmony_ci {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, 234662306a36Sopenharmony_ci {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, 234762306a36Sopenharmony_ci {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 234862306a36Sopenharmony_ci {0x0000, SIERRA_CREQ_SPARE_PREG}, 234962306a36Sopenharmony_ci {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, 235062306a36Sopenharmony_ci {0x8452, SIERRA_CTLELUT_CTRL_PREG}, 235162306a36Sopenharmony_ci {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, 235262306a36Sopenharmony_ci {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, 235362306a36Sopenharmony_ci {0x0003, SIERRA_DEQ_PHALIGN_CTRL}, 235462306a36Sopenharmony_ci {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG}, 235562306a36Sopenharmony_ci {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 235662306a36Sopenharmony_ci {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG}, 235762306a36Sopenharmony_ci {0x0048, SIERRA_DEQ_FAST_MAINT_CYCLES_PREG}, 235862306a36Sopenharmony_ci {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG}, 235962306a36Sopenharmony_ci {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG}, 236062306a36Sopenharmony_ci {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG}, 236162306a36Sopenharmony_ci {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, 236262306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT0}, 236362306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT1}, 236462306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT2}, 236562306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT3}, 236662306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT4}, 236762306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT5}, 236862306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT6}, 236962306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT7}, 237062306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT8}, 237162306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT9}, 237262306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT10}, 237362306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT11}, 237462306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT12}, 237562306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT13}, 237662306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT14}, 237762306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT15}, 237862306a36Sopenharmony_ci {0x0014, SIERRA_DEQ_GLUT16}, 237962306a36Sopenharmony_ci {0x0BAE, SIERRA_DEQ_ALUT0}, 238062306a36Sopenharmony_ci {0x0AEB, SIERRA_DEQ_ALUT1}, 238162306a36Sopenharmony_ci {0x0A28, SIERRA_DEQ_ALUT2}, 238262306a36Sopenharmony_ci {0x0965, SIERRA_DEQ_ALUT3}, 238362306a36Sopenharmony_ci {0x08A2, SIERRA_DEQ_ALUT4}, 238462306a36Sopenharmony_ci {0x07DF, SIERRA_DEQ_ALUT5}, 238562306a36Sopenharmony_ci {0x071C, SIERRA_DEQ_ALUT6}, 238662306a36Sopenharmony_ci {0x0659, SIERRA_DEQ_ALUT7}, 238762306a36Sopenharmony_ci {0x0596, SIERRA_DEQ_ALUT8}, 238862306a36Sopenharmony_ci {0x0514, SIERRA_DEQ_ALUT9}, 238962306a36Sopenharmony_ci {0x0492, SIERRA_DEQ_ALUT10}, 239062306a36Sopenharmony_ci {0x0410, SIERRA_DEQ_ALUT11}, 239162306a36Sopenharmony_ci {0x038E, SIERRA_DEQ_ALUT12}, 239262306a36Sopenharmony_ci {0x030C, SIERRA_DEQ_ALUT13}, 239362306a36Sopenharmony_ci {0x03F4, SIERRA_DEQ_DFETAP_CTRL_PREG}, 239462306a36Sopenharmony_ci {0x0001, SIERRA_DFE_EN_1010_IGNORE_PREG}, 239562306a36Sopenharmony_ci {0x3C01, SIERRA_DEQ_TAU_CTRL1_FAST_MAINT_PREG}, 239662306a36Sopenharmony_ci {0x3C40, SIERRA_DEQ_TAU_CTRL1_SLOW_MAINT_PREG}, 239762306a36Sopenharmony_ci {0x1C08, SIERRA_DEQ_TAU_CTRL2_PREG}, 239862306a36Sopenharmony_ci {0x0033, SIERRA_DEQ_PICTRL_PREG}, 239962306a36Sopenharmony_ci {0x0400, SIERRA_CPICAL_TMRVAL_MODE1_PREG}, 240062306a36Sopenharmony_ci {0x0330, SIERRA_CPICAL_TMRVAL_MODE0_PREG}, 240162306a36Sopenharmony_ci {0x01FF, SIERRA_CPICAL_PICNT_MODE1_PREG}, 240262306a36Sopenharmony_ci {0x0009, SIERRA_CPI_OUTBUF_RATESEL_PREG}, 240362306a36Sopenharmony_ci {0x3232, SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG}, 240462306a36Sopenharmony_ci {0x0005, SIERRA_LFPSDET_SUPPORT_PREG}, 240562306a36Sopenharmony_ci {0x000F, SIERRA_LFPSFILT_NS_PREG}, 240662306a36Sopenharmony_ci {0x0009, SIERRA_LFPSFILT_RD_PREG}, 240762306a36Sopenharmony_ci {0x0001, SIERRA_LFPSFILT_MP_PREG}, 240862306a36Sopenharmony_ci {0x6013, SIERRA_SIGDET_SUPPORT_PREG}, 240962306a36Sopenharmony_ci {0x8013, SIERRA_SDFILT_H2L_A_PREG}, 241062306a36Sopenharmony_ci {0x8009, SIERRA_SDFILT_L2H_PREG}, 241162306a36Sopenharmony_ci {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG}, 241262306a36Sopenharmony_ci {0x0020, SIERRA_RXBUFFER_RCDFECTRL_PREG}, 241362306a36Sopenharmony_ci {0x4243, SIERRA_RXBUFFER_DFECTRL_PREG} 241462306a36Sopenharmony_ci}; 241562306a36Sopenharmony_ci 241662306a36Sopenharmony_cistatic struct cdns_sierra_vals usb_100_ext_ssc_cmn_vals = { 241762306a36Sopenharmony_ci .reg_pairs = cdns_usb_cmn_regs_ext_ssc, 241862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_usb_cmn_regs_ext_ssc), 241962306a36Sopenharmony_ci}; 242062306a36Sopenharmony_ci 242162306a36Sopenharmony_cistatic struct cdns_sierra_vals usb_100_ext_ssc_ln_vals = { 242262306a36Sopenharmony_ci .reg_pairs = cdns_usb_ln_regs_ext_ssc, 242362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(cdns_usb_ln_regs_ext_ssc), 242462306a36Sopenharmony_ci}; 242562306a36Sopenharmony_ci 242662306a36Sopenharmony_ci/* SGMII PHY common configuration */ 242762306a36Sopenharmony_cistatic const struct cdns_reg_pairs sgmii_pma_cmn_vals[] = { 242862306a36Sopenharmony_ci {0x0180, SIERRA_SDOSCCAL_CLK_CNT_PREG}, 242962306a36Sopenharmony_ci {0x6000, SIERRA_CMN_REFRCV_PREG}, 243062306a36Sopenharmony_ci {0x0031, SIERRA_CMN_RESCAL_CTRLA_PREG}, 243162306a36Sopenharmony_ci {0x001C, SIERRA_CMN_PLLLC_FBDIV_INT_MODE0_PREG}, 243262306a36Sopenharmony_ci {0x2106, SIERRA_CMN_PLLLC_LF_COEFF_MODE0_PREG}, 243362306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_LOCKSEARCH_PREG}, 243462306a36Sopenharmony_ci {0x8103, SIERRA_CMN_PLLLC_CLK0_PREG}, 243562306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_BWCAL_MODE0_PREG}, 243662306a36Sopenharmony_ci {0x0027, SIERRA_CMN_PLLCSM_PLLEN_TMR_PREG}, 243762306a36Sopenharmony_ci {0x0062, SIERRA_CMN_PLLCSM_PLLPRE_TMR_PREG}, 243862306a36Sopenharmony_ci {0x0800, SIERRA_CMN_PLLLC_SS_TIME_STEPSIZE_MODE_PREG}, 243962306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_INIT_PREG}, 244062306a36Sopenharmony_ci {0x0000, SIERRA_CMN_PLLLC_ITERTMR_PREG}, 244162306a36Sopenharmony_ci {0x0020, SIERRA_CMN_PLLLC_LOCK_CNTSTART_PREG}, 244262306a36Sopenharmony_ci {0x0013, SIERRA_CMN_PLLLC_DCOCAL_CTRL_PREG}, 244362306a36Sopenharmony_ci {0x0013, SIERRA_CMN_PLLLC1_DCOCAL_CTRL_PREG}, 244462306a36Sopenharmony_ci}; 244562306a36Sopenharmony_ci 244662306a36Sopenharmony_cistatic struct cdns_sierra_vals sgmii_cmn_vals = { 244762306a36Sopenharmony_ci .reg_pairs = sgmii_pma_cmn_vals, 244862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_pma_cmn_vals), 244962306a36Sopenharmony_ci}; 245062306a36Sopenharmony_ci 245162306a36Sopenharmony_ci/* SGMII PHY lane configuration */ 245262306a36Sopenharmony_cistatic const struct cdns_reg_pairs sgmii_ln_regs[] = { 245362306a36Sopenharmony_ci {0x691E, SIERRA_DET_STANDEC_D_PREG}, 245462306a36Sopenharmony_ci {0x0FFE, SIERRA_PSC_RX_A0_PREG}, 245562306a36Sopenharmony_ci {0x0104, SIERRA_PLLCTRL_FBDIV_MODE01_PREG}, 245662306a36Sopenharmony_ci {0x0013, SIERRA_PLLCTRL_SUBRATE_PREG}, 245762306a36Sopenharmony_ci {0x0106, SIERRA_PLLCTRL_GEN_D_PREG}, 245862306a36Sopenharmony_ci {0x5234, SIERRA_PLLCTRL_CPGAIN_MODE_PREG}, 245962306a36Sopenharmony_ci {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, 246062306a36Sopenharmony_ci {0x00AB, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, 246162306a36Sopenharmony_ci {0x3C0E, SIERRA_CREQ_CCLKDET_MODE01_PREG}, 246262306a36Sopenharmony_ci {0x3220, SIERRA_CREQ_FSMCLK_SEL_PREG}, 246362306a36Sopenharmony_ci {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, 246462306a36Sopenharmony_ci {0x6320, SIERRA_DEQ_CONCUR_EPIOFFSET_MODE_PREG}, 246562306a36Sopenharmony_ci {0x0000, SIERRA_CPI_OUTBUF_RATESEL_PREG}, 246662306a36Sopenharmony_ci {0x15A2, SIERRA_LN_SPARE_REG_PREG}, 246762306a36Sopenharmony_ci {0x7900, SIERRA_DEQ_BLK_TAU_CTRL1_PREG}, 246862306a36Sopenharmony_ci {0x2202, SIERRA_DEQ_BLK_TAU_CTRL4_PREG}, 246962306a36Sopenharmony_ci {0x2206, SIERRA_DEQ_TAU_CTRL2_PREG}, 247062306a36Sopenharmony_ci {0x0005, SIERRA_LANE_TX_RECEIVER_DETECT_PREG}, 247162306a36Sopenharmony_ci {0x8001, SIERRA_CREQ_SPARE_PREG}, 247262306a36Sopenharmony_ci {0x0000, SIERRA_DEQ_CONCUR_CTRL1_PREG}, 247362306a36Sopenharmony_ci {0xD004, SIERRA_DEQ_CONCUR_CTRL2_PREG}, 247462306a36Sopenharmony_ci {0x0101, SIERRA_DEQ_GLUT9}, 247562306a36Sopenharmony_ci {0x0101, SIERRA_DEQ_GLUT10}, 247662306a36Sopenharmony_ci {0x0101, SIERRA_DEQ_GLUT11}, 247762306a36Sopenharmony_ci {0x0101, SIERRA_DEQ_GLUT12}, 247862306a36Sopenharmony_ci {0x0000, SIERRA_DEQ_GLUT13}, 247962306a36Sopenharmony_ci {0x0000, SIERRA_DEQ_GLUT16}, 248062306a36Sopenharmony_ci {0x0000, SIERRA_POSTPRECUR_EN_CEPH_CTRL_PREG}, 248162306a36Sopenharmony_ci {0x0000, SIERRA_TAU_EN_CEPH2TO0_PREG}, 248262306a36Sopenharmony_ci {0x0003, SIERRA_TAU_EN_CEPH5TO3_PREG}, 248362306a36Sopenharmony_ci {0x0101, SIERRA_DEQ_ALUT8}, 248462306a36Sopenharmony_ci {0x0101, SIERRA_DEQ_ALUT9}, 248562306a36Sopenharmony_ci {0x0100, SIERRA_DEQ_ALUT10}, 248662306a36Sopenharmony_ci {0x0000, SIERRA_OEPH_EN_CTRL_PREG}, 248762306a36Sopenharmony_ci {0x5425, SIERRA_DEQ_OPENEYE_CTRL_PREG}, 248862306a36Sopenharmony_ci {0x7458, SIERRA_CPICAL_RES_STARTCODE_MODE23_PREG}, 248962306a36Sopenharmony_ci {0x321F, SIERRA_CPICAL_RES_STARTCODE_MODE01_PREG}, 249062306a36Sopenharmony_ci}; 249162306a36Sopenharmony_ci 249262306a36Sopenharmony_cistatic struct cdns_sierra_vals sgmii_pma_ln_vals = { 249362306a36Sopenharmony_ci .reg_pairs = sgmii_ln_regs, 249462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_ln_regs), 249562306a36Sopenharmony_ci}; 249662306a36Sopenharmony_ci 249762306a36Sopenharmony_cistatic const struct cdns_sierra_data cdns_map_sierra = { 249862306a36Sopenharmony_ci .id_value = SIERRA_MACRO_ID, 249962306a36Sopenharmony_ci .block_offset_shift = 0x2, 250062306a36Sopenharmony_ci .reg_offset_shift = 0x2, 250162306a36Sopenharmony_ci .pcs_cmn_vals = { 250262306a36Sopenharmony_ci [TYPE_PCIE] = { 250362306a36Sopenharmony_ci [TYPE_NONE] = { 250462306a36Sopenharmony_ci [NO_SSC] = &pcie_phy_pcs_cmn_vals, 250562306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 250662306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 250762306a36Sopenharmony_ci }, 250862306a36Sopenharmony_ci [TYPE_SGMII] = { 250962306a36Sopenharmony_ci [NO_SSC] = &pcie_phy_pcs_cmn_vals, 251062306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 251162306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 251262306a36Sopenharmony_ci }, 251362306a36Sopenharmony_ci [TYPE_QSGMII] = { 251462306a36Sopenharmony_ci [NO_SSC] = &pcie_phy_pcs_cmn_vals, 251562306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 251662306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 251762306a36Sopenharmony_ci }, 251862306a36Sopenharmony_ci }, 251962306a36Sopenharmony_ci }, 252062306a36Sopenharmony_ci .pma_cmn_vals = { 252162306a36Sopenharmony_ci [TYPE_PCIE] = { 252262306a36Sopenharmony_ci [TYPE_NONE] = { 252362306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 252462306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals, 252562306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 252662306a36Sopenharmony_ci }, 252762306a36Sopenharmony_ci [TYPE_SGMII] = { 252862306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals, 252962306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals, 253062306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals, 253162306a36Sopenharmony_ci }, 253262306a36Sopenharmony_ci [TYPE_QSGMII] = { 253362306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals, 253462306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals, 253562306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals, 253662306a36Sopenharmony_ci }, 253762306a36Sopenharmony_ci }, 253862306a36Sopenharmony_ci [TYPE_USB] = { 253962306a36Sopenharmony_ci [TYPE_NONE] = { 254062306a36Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals, 254162306a36Sopenharmony_ci }, 254262306a36Sopenharmony_ci }, 254362306a36Sopenharmony_ci [TYPE_SGMII] = { 254462306a36Sopenharmony_ci [TYPE_NONE] = { 254562306a36Sopenharmony_ci [NO_SSC] = &sgmii_cmn_vals, 254662306a36Sopenharmony_ci }, 254762306a36Sopenharmony_ci [TYPE_PCIE] = { 254862306a36Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_plllc1_opt3_cmn_vals, 254962306a36Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_cmn_vals, 255062306a36Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_cmn_vals, 255162306a36Sopenharmony_ci }, 255262306a36Sopenharmony_ci }, 255362306a36Sopenharmony_ci [TYPE_QSGMII] = { 255462306a36Sopenharmony_ci [TYPE_PCIE] = { 255562306a36Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 255662306a36Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 255762306a36Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 255862306a36Sopenharmony_ci }, 255962306a36Sopenharmony_ci }, 256062306a36Sopenharmony_ci }, 256162306a36Sopenharmony_ci .pma_ln_vals = { 256262306a36Sopenharmony_ci [TYPE_PCIE] = { 256362306a36Sopenharmony_ci [TYPE_NONE] = { 256462306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_ln_vals, 256562306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals, 256662306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals, 256762306a36Sopenharmony_ci }, 256862306a36Sopenharmony_ci [TYPE_SGMII] = { 256962306a36Sopenharmony_ci [NO_SSC] = &ml_pcie_100_no_ssc_ln_vals, 257062306a36Sopenharmony_ci [EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals, 257162306a36Sopenharmony_ci [INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals, 257262306a36Sopenharmony_ci }, 257362306a36Sopenharmony_ci [TYPE_QSGMII] = { 257462306a36Sopenharmony_ci [NO_SSC] = &ml_pcie_100_no_ssc_ln_vals, 257562306a36Sopenharmony_ci [EXTERNAL_SSC] = &ml_pcie_100_ext_ssc_ln_vals, 257662306a36Sopenharmony_ci [INTERNAL_SSC] = &ml_pcie_100_int_ssc_ln_vals, 257762306a36Sopenharmony_ci }, 257862306a36Sopenharmony_ci }, 257962306a36Sopenharmony_ci [TYPE_USB] = { 258062306a36Sopenharmony_ci [TYPE_NONE] = { 258162306a36Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals, 258262306a36Sopenharmony_ci }, 258362306a36Sopenharmony_ci }, 258462306a36Sopenharmony_ci [TYPE_SGMII] = { 258562306a36Sopenharmony_ci [TYPE_NONE] = { 258662306a36Sopenharmony_ci [NO_SSC] = &sgmii_pma_ln_vals, 258762306a36Sopenharmony_ci }, 258862306a36Sopenharmony_ci [TYPE_PCIE] = { 258962306a36Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_plllc1_opt3_ln_vals, 259062306a36Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_ln_vals, 259162306a36Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_ln_vals, 259262306a36Sopenharmony_ci }, 259362306a36Sopenharmony_ci }, 259462306a36Sopenharmony_ci [TYPE_QSGMII] = { 259562306a36Sopenharmony_ci [TYPE_PCIE] = { 259662306a36Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 259762306a36Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 259862306a36Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 259962306a36Sopenharmony_ci }, 260062306a36Sopenharmony_ci }, 260162306a36Sopenharmony_ci }, 260262306a36Sopenharmony_ci}; 260362306a36Sopenharmony_ci 260462306a36Sopenharmony_cistatic const struct cdns_sierra_data cdns_ti_map_sierra = { 260562306a36Sopenharmony_ci .id_value = SIERRA_MACRO_ID, 260662306a36Sopenharmony_ci .block_offset_shift = 0x0, 260762306a36Sopenharmony_ci .reg_offset_shift = 0x1, 260862306a36Sopenharmony_ci .pcs_cmn_vals = { 260962306a36Sopenharmony_ci [TYPE_PCIE] = { 261062306a36Sopenharmony_ci [TYPE_NONE] = { 261162306a36Sopenharmony_ci [NO_SSC] = &pcie_phy_pcs_cmn_vals, 261262306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 261362306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 261462306a36Sopenharmony_ci }, 261562306a36Sopenharmony_ci [TYPE_SGMII] = { 261662306a36Sopenharmony_ci [NO_SSC] = &pcie_phy_pcs_cmn_vals, 261762306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 261862306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 261962306a36Sopenharmony_ci }, 262062306a36Sopenharmony_ci [TYPE_QSGMII] = { 262162306a36Sopenharmony_ci [NO_SSC] = &pcie_phy_pcs_cmn_vals, 262262306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 262362306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_phy_pcs_cmn_vals, 262462306a36Sopenharmony_ci }, 262562306a36Sopenharmony_ci }, 262662306a36Sopenharmony_ci }, 262762306a36Sopenharmony_ci .phy_pma_ln_vals = { 262862306a36Sopenharmony_ci [TYPE_SGMII] = { 262962306a36Sopenharmony_ci [TYPE_PCIE] = { 263062306a36Sopenharmony_ci [NO_SSC] = &sgmii_phy_pma_ln_vals, 263162306a36Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_phy_pma_ln_vals, 263262306a36Sopenharmony_ci [INTERNAL_SSC] = &sgmii_phy_pma_ln_vals, 263362306a36Sopenharmony_ci }, 263462306a36Sopenharmony_ci }, 263562306a36Sopenharmony_ci [TYPE_QSGMII] = { 263662306a36Sopenharmony_ci [TYPE_PCIE] = { 263762306a36Sopenharmony_ci [NO_SSC] = &qsgmii_phy_pma_ln_vals, 263862306a36Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_phy_pma_ln_vals, 263962306a36Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_phy_pma_ln_vals, 264062306a36Sopenharmony_ci }, 264162306a36Sopenharmony_ci }, 264262306a36Sopenharmony_ci }, 264362306a36Sopenharmony_ci .pma_cmn_vals = { 264462306a36Sopenharmony_ci [TYPE_PCIE] = { 264562306a36Sopenharmony_ci [TYPE_NONE] = { 264662306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 264762306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_cmn_vals, 264862306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 264962306a36Sopenharmony_ci }, 265062306a36Sopenharmony_ci [TYPE_SGMII] = { 265162306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals, 265262306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals, 265362306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals, 265462306a36Sopenharmony_ci }, 265562306a36Sopenharmony_ci [TYPE_QSGMII] = { 265662306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_plllc_cmn_vals, 265762306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_plllc_cmn_vals, 265862306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_plllc_cmn_vals, 265962306a36Sopenharmony_ci }, 266062306a36Sopenharmony_ci }, 266162306a36Sopenharmony_ci [TYPE_USB] = { 266262306a36Sopenharmony_ci [TYPE_NONE] = { 266362306a36Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_ext_ssc_cmn_vals, 266462306a36Sopenharmony_ci }, 266562306a36Sopenharmony_ci }, 266662306a36Sopenharmony_ci [TYPE_SGMII] = { 266762306a36Sopenharmony_ci [TYPE_PCIE] = { 266862306a36Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_plllc1_opt3_cmn_vals, 266962306a36Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_cmn_vals, 267062306a36Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_cmn_vals, 267162306a36Sopenharmony_ci }, 267262306a36Sopenharmony_ci }, 267362306a36Sopenharmony_ci [TYPE_QSGMII] = { 267462306a36Sopenharmony_ci [TYPE_PCIE] = { 267562306a36Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 267662306a36Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 267762306a36Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_cmn_vals, 267862306a36Sopenharmony_ci }, 267962306a36Sopenharmony_ci }, 268062306a36Sopenharmony_ci }, 268162306a36Sopenharmony_ci .pma_ln_vals = { 268262306a36Sopenharmony_ci [TYPE_PCIE] = { 268362306a36Sopenharmony_ci [TYPE_NONE] = { 268462306a36Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_ln_vals, 268562306a36Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_ext_ssc_ln_vals, 268662306a36Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_ln_vals, 268762306a36Sopenharmony_ci }, 268862306a36Sopenharmony_ci [TYPE_SGMII] = { 268962306a36Sopenharmony_ci [NO_SSC] = &ti_ml_pcie_100_no_ssc_ln_vals, 269062306a36Sopenharmony_ci [EXTERNAL_SSC] = &ti_ml_pcie_100_ext_ssc_ln_vals, 269162306a36Sopenharmony_ci [INTERNAL_SSC] = &ti_ml_pcie_100_int_ssc_ln_vals, 269262306a36Sopenharmony_ci }, 269362306a36Sopenharmony_ci [TYPE_QSGMII] = { 269462306a36Sopenharmony_ci [NO_SSC] = &ti_ml_pcie_100_no_ssc_ln_vals, 269562306a36Sopenharmony_ci [EXTERNAL_SSC] = &ti_ml_pcie_100_ext_ssc_ln_vals, 269662306a36Sopenharmony_ci [INTERNAL_SSC] = &ti_ml_pcie_100_int_ssc_ln_vals, 269762306a36Sopenharmony_ci }, 269862306a36Sopenharmony_ci }, 269962306a36Sopenharmony_ci [TYPE_USB] = { 270062306a36Sopenharmony_ci [TYPE_NONE] = { 270162306a36Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_ext_ssc_ln_vals, 270262306a36Sopenharmony_ci }, 270362306a36Sopenharmony_ci }, 270462306a36Sopenharmony_ci [TYPE_SGMII] = { 270562306a36Sopenharmony_ci [TYPE_PCIE] = { 270662306a36Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_plllc1_opt3_ln_vals, 270762306a36Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_ln_vals, 270862306a36Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_plllc1_opt3_ln_vals, 270962306a36Sopenharmony_ci }, 271062306a36Sopenharmony_ci }, 271162306a36Sopenharmony_ci [TYPE_QSGMII] = { 271262306a36Sopenharmony_ci [TYPE_PCIE] = { 271362306a36Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 271462306a36Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 271562306a36Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_plllc1_ln_vals, 271662306a36Sopenharmony_ci }, 271762306a36Sopenharmony_ci }, 271862306a36Sopenharmony_ci }, 271962306a36Sopenharmony_ci}; 272062306a36Sopenharmony_ci 272162306a36Sopenharmony_cistatic const struct of_device_id cdns_sierra_id_table[] = { 272262306a36Sopenharmony_ci { 272362306a36Sopenharmony_ci .compatible = "cdns,sierra-phy-t0", 272462306a36Sopenharmony_ci .data = &cdns_map_sierra, 272562306a36Sopenharmony_ci }, 272662306a36Sopenharmony_ci { 272762306a36Sopenharmony_ci .compatible = "ti,sierra-phy-t0", 272862306a36Sopenharmony_ci .data = &cdns_ti_map_sierra, 272962306a36Sopenharmony_ci }, 273062306a36Sopenharmony_ci {} 273162306a36Sopenharmony_ci}; 273262306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, cdns_sierra_id_table); 273362306a36Sopenharmony_ci 273462306a36Sopenharmony_cistatic struct platform_driver cdns_sierra_driver = { 273562306a36Sopenharmony_ci .probe = cdns_sierra_phy_probe, 273662306a36Sopenharmony_ci .remove_new = cdns_sierra_phy_remove, 273762306a36Sopenharmony_ci .driver = { 273862306a36Sopenharmony_ci .name = "cdns-sierra-phy", 273962306a36Sopenharmony_ci .of_match_table = cdns_sierra_id_table, 274062306a36Sopenharmony_ci }, 274162306a36Sopenharmony_ci}; 274262306a36Sopenharmony_cimodule_platform_driver(cdns_sierra_driver); 274362306a36Sopenharmony_ci 274462306a36Sopenharmony_ciMODULE_ALIAS("platform:cdns_sierra"); 274562306a36Sopenharmony_ciMODULE_AUTHOR("Cadence Design Systems"); 274662306a36Sopenharmony_ciMODULE_DESCRIPTION("CDNS sierra phy driver"); 274762306a36Sopenharmony_ciMODULE_LICENSE("GPL v2"); 2748