162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Cadence Torrent SD0801 PHY driver. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2018 Cadence Design Systems, Inc. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <dt-bindings/phy/phy.h> 1062306a36Sopenharmony_ci#include <dt-bindings/phy/phy-cadence.h> 1162306a36Sopenharmony_ci#include <linux/clk.h> 1262306a36Sopenharmony_ci#include <linux/clk-provider.h> 1362306a36Sopenharmony_ci#include <linux/delay.h> 1462306a36Sopenharmony_ci#include <linux/err.h> 1562306a36Sopenharmony_ci#include <linux/io.h> 1662306a36Sopenharmony_ci#include <linux/iopoll.h> 1762306a36Sopenharmony_ci#include <linux/kernel.h> 1862306a36Sopenharmony_ci#include <linux/module.h> 1962306a36Sopenharmony_ci#include <linux/of.h> 2062306a36Sopenharmony_ci#include <linux/phy/phy.h> 2162306a36Sopenharmony_ci#include <linux/platform_device.h> 2262306a36Sopenharmony_ci#include <linux/reset.h> 2362306a36Sopenharmony_ci#include <linux/regmap.h> 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define REF_CLK_19_2MHZ 19200000 2662306a36Sopenharmony_ci#define REF_CLK_25MHZ 25000000 2762306a36Sopenharmony_ci#define REF_CLK_100MHZ 100000000 2862306a36Sopenharmony_ci#define REF_CLK_156_25MHZ 156250000 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define MAX_NUM_LANES 4 3162306a36Sopenharmony_ci#define DEFAULT_MAX_BIT_RATE 8100 /* in Mbps */ 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define POLL_TIMEOUT_US 5000 3462306a36Sopenharmony_ci#define PLL_LOCK_TIMEOUT 100000 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define DP_PLL0 BIT(0) 3762306a36Sopenharmony_ci#define DP_PLL1 BIT(1) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define TORRENT_COMMON_CDB_OFFSET 0x0 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci#define TORRENT_TX_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 4262306a36Sopenharmony_ci ((0x4000 << (block_offset)) + \ 4362306a36Sopenharmony_ci (((ln) << 9) << (reg_offset))) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define TORRENT_RX_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 4662306a36Sopenharmony_ci ((0x8000 << (block_offset)) + \ 4762306a36Sopenharmony_ci (((ln) << 9) << (reg_offset))) 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define TORRENT_PHY_PCS_COMMON_OFFSET(block_offset) \ 5062306a36Sopenharmony_ci (0xC000 << (block_offset)) 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci#define TORRENT_PHY_PCS_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 5362306a36Sopenharmony_ci ((0xD000 << (block_offset)) + \ 5462306a36Sopenharmony_ci (((ln) << 8) << (reg_offset))) 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define TORRENT_PHY_PMA_COMMON_OFFSET(block_offset) \ 5762306a36Sopenharmony_ci (0xE000 << (block_offset)) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define TORRENT_DPTX_PHY_OFFSET 0x0 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* 6262306a36Sopenharmony_ci * register offsets from DPTX PHY register block base (i.e MHDP 6362306a36Sopenharmony_ci * register base + 0x30a00) 6462306a36Sopenharmony_ci */ 6562306a36Sopenharmony_ci#define PHY_AUX_CTRL 0x04 6662306a36Sopenharmony_ci#define PHY_RESET 0x20 6762306a36Sopenharmony_ci#define PMA_TX_ELEC_IDLE_SHIFT 4 6862306a36Sopenharmony_ci#define PHY_PMA_XCVR_PLLCLK_EN 0x24 6962306a36Sopenharmony_ci#define PHY_PMA_XCVR_PLLCLK_EN_ACK 0x28 7062306a36Sopenharmony_ci#define PHY_PMA_XCVR_POWER_STATE_REQ 0x2c 7162306a36Sopenharmony_ci#define PHY_POWER_STATE_LN(ln) ((ln) * 8) 7262306a36Sopenharmony_ci#define PMA_XCVR_POWER_STATE_REQ_LN_MASK 0x3FU 7362306a36Sopenharmony_ci#define PHY_PMA_XCVR_POWER_STATE_ACK 0x30 7462306a36Sopenharmony_ci#define PHY_PMA_CMN_READY 0x34 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* 7762306a36Sopenharmony_ci * register offsets from SD0801 PHY register block base (i.e MHDP 7862306a36Sopenharmony_ci * register base + 0x500000) 7962306a36Sopenharmony_ci */ 8062306a36Sopenharmony_ci#define CMN_SSM_BANDGAP_TMR 0x0021U 8162306a36Sopenharmony_ci#define CMN_SSM_BIAS_TMR 0x0022U 8262306a36Sopenharmony_ci#define CMN_PLLSM0_PLLPRE_TMR 0x002AU 8362306a36Sopenharmony_ci#define CMN_PLLSM0_PLLLOCK_TMR 0x002CU 8462306a36Sopenharmony_ci#define CMN_PLLSM1_PLLPRE_TMR 0x0032U 8562306a36Sopenharmony_ci#define CMN_PLLSM1_PLLLOCK_TMR 0x0034U 8662306a36Sopenharmony_ci#define CMN_CDIAG_CDB_PWRI_OVRD 0x0041U 8762306a36Sopenharmony_ci#define CMN_CDIAG_XCVRC_PWRI_OVRD 0x0047U 8862306a36Sopenharmony_ci#define CMN_CDIAG_REFCLK_OVRD 0x004CU 8962306a36Sopenharmony_ci#define CMN_CDIAG_REFCLK_DRV0_CTRL 0x0050U 9062306a36Sopenharmony_ci#define CMN_BGCAL_INIT_TMR 0x0064U 9162306a36Sopenharmony_ci#define CMN_BGCAL_ITER_TMR 0x0065U 9262306a36Sopenharmony_ci#define CMN_IBCAL_INIT_TMR 0x0074U 9362306a36Sopenharmony_ci#define CMN_PLL0_VCOCAL_TCTRL 0x0082U 9462306a36Sopenharmony_ci#define CMN_PLL0_VCOCAL_INIT_TMR 0x0084U 9562306a36Sopenharmony_ci#define CMN_PLL0_VCOCAL_ITER_TMR 0x0085U 9662306a36Sopenharmony_ci#define CMN_PLL0_VCOCAL_REFTIM_START 0x0086U 9762306a36Sopenharmony_ci#define CMN_PLL0_VCOCAL_PLLCNT_START 0x0088U 9862306a36Sopenharmony_ci#define CMN_PLL0_INTDIV_M0 0x0090U 9962306a36Sopenharmony_ci#define CMN_PLL0_FRACDIVL_M0 0x0091U 10062306a36Sopenharmony_ci#define CMN_PLL0_FRACDIVH_M0 0x0092U 10162306a36Sopenharmony_ci#define CMN_PLL0_HIGH_THR_M0 0x0093U 10262306a36Sopenharmony_ci#define CMN_PLL0_DSM_DIAG_M0 0x0094U 10362306a36Sopenharmony_ci#define CMN_PLL0_DSM_FBH_OVRD_M0 0x0095U 10462306a36Sopenharmony_ci#define CMN_PLL0_DSM_FBL_OVRD_M0 0x0096U 10562306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL1_M0 0x0098U 10662306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL2_M0 0x0099U 10762306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL3_M0 0x009AU 10862306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL4_M0 0x009BU 10962306a36Sopenharmony_ci#define CMN_PLL0_LOCK_REFCNT_START 0x009CU 11062306a36Sopenharmony_ci#define CMN_PLL0_LOCK_PLLCNT_START 0x009EU 11162306a36Sopenharmony_ci#define CMN_PLL0_LOCK_PLLCNT_THR 0x009FU 11262306a36Sopenharmony_ci#define CMN_PLL0_INTDIV_M1 0x00A0U 11362306a36Sopenharmony_ci#define CMN_PLL0_FRACDIVH_M1 0x00A2U 11462306a36Sopenharmony_ci#define CMN_PLL0_HIGH_THR_M1 0x00A3U 11562306a36Sopenharmony_ci#define CMN_PLL0_DSM_DIAG_M1 0x00A4U 11662306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL1_M1 0x00A8U 11762306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL2_M1 0x00A9U 11862306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL3_M1 0x00AAU 11962306a36Sopenharmony_ci#define CMN_PLL0_SS_CTRL4_M1 0x00ABU 12062306a36Sopenharmony_ci#define CMN_PLL1_VCOCAL_TCTRL 0x00C2U 12162306a36Sopenharmony_ci#define CMN_PLL1_VCOCAL_INIT_TMR 0x00C4U 12262306a36Sopenharmony_ci#define CMN_PLL1_VCOCAL_ITER_TMR 0x00C5U 12362306a36Sopenharmony_ci#define CMN_PLL1_VCOCAL_REFTIM_START 0x00C6U 12462306a36Sopenharmony_ci#define CMN_PLL1_VCOCAL_PLLCNT_START 0x00C8U 12562306a36Sopenharmony_ci#define CMN_PLL1_INTDIV_M0 0x00D0U 12662306a36Sopenharmony_ci#define CMN_PLL1_FRACDIVL_M0 0x00D1U 12762306a36Sopenharmony_ci#define CMN_PLL1_FRACDIVH_M0 0x00D2U 12862306a36Sopenharmony_ci#define CMN_PLL1_HIGH_THR_M0 0x00D3U 12962306a36Sopenharmony_ci#define CMN_PLL1_DSM_DIAG_M0 0x00D4U 13062306a36Sopenharmony_ci#define CMN_PLL1_DSM_FBH_OVRD_M0 0x00D5U 13162306a36Sopenharmony_ci#define CMN_PLL1_DSM_FBL_OVRD_M0 0x00D6U 13262306a36Sopenharmony_ci#define CMN_PLL1_SS_CTRL1_M0 0x00D8U 13362306a36Sopenharmony_ci#define CMN_PLL1_SS_CTRL2_M0 0x00D9U 13462306a36Sopenharmony_ci#define CMN_PLL1_SS_CTRL3_M0 0x00DAU 13562306a36Sopenharmony_ci#define CMN_PLL1_SS_CTRL4_M0 0x00DBU 13662306a36Sopenharmony_ci#define CMN_PLL1_LOCK_REFCNT_START 0x00DCU 13762306a36Sopenharmony_ci#define CMN_PLL1_LOCK_PLLCNT_START 0x00DEU 13862306a36Sopenharmony_ci#define CMN_PLL1_LOCK_PLLCNT_THR 0x00DFU 13962306a36Sopenharmony_ci#define CMN_TXPUCAL_TUNE 0x0103U 14062306a36Sopenharmony_ci#define CMN_TXPUCAL_INIT_TMR 0x0104U 14162306a36Sopenharmony_ci#define CMN_TXPUCAL_ITER_TMR 0x0105U 14262306a36Sopenharmony_ci#define CMN_TXPDCAL_TUNE 0x010BU 14362306a36Sopenharmony_ci#define CMN_TXPDCAL_INIT_TMR 0x010CU 14462306a36Sopenharmony_ci#define CMN_TXPDCAL_ITER_TMR 0x010DU 14562306a36Sopenharmony_ci#define CMN_RXCAL_INIT_TMR 0x0114U 14662306a36Sopenharmony_ci#define CMN_RXCAL_ITER_TMR 0x0115U 14762306a36Sopenharmony_ci#define CMN_SD_CAL_INIT_TMR 0x0124U 14862306a36Sopenharmony_ci#define CMN_SD_CAL_ITER_TMR 0x0125U 14962306a36Sopenharmony_ci#define CMN_SD_CAL_REFTIM_START 0x0126U 15062306a36Sopenharmony_ci#define CMN_SD_CAL_PLLCNT_START 0x0128U 15162306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CTRL_M0 0x01A0U 15262306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CLK_SEL_M0 0x01A1U 15362306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_PADJ_M0 0x01A4U 15462306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_IADJ_M0 0x01A5U 15562306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_FILT_PADJ_M0 0x01A6U 15662306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CTRL_M1 0x01B0U 15762306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CLK_SEL_M1 0x01B1U 15862306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_PADJ_M1 0x01B4U 15962306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_IADJ_M1 0x01B5U 16062306a36Sopenharmony_ci#define CMN_PDIAG_PLL0_FILT_PADJ_M1 0x01B6U 16162306a36Sopenharmony_ci#define CMN_PDIAG_PLL1_CTRL_M0 0x01C0U 16262306a36Sopenharmony_ci#define CMN_PDIAG_PLL1_CLK_SEL_M0 0x01C1U 16362306a36Sopenharmony_ci#define CMN_PDIAG_PLL1_CP_PADJ_M0 0x01C4U 16462306a36Sopenharmony_ci#define CMN_PDIAG_PLL1_CP_IADJ_M0 0x01C5U 16562306a36Sopenharmony_ci#define CMN_PDIAG_PLL1_FILT_PADJ_M0 0x01C6U 16662306a36Sopenharmony_ci#define CMN_DIAG_BIAS_OVRD1 0x01E1U 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* PMA TX Lane registers */ 16962306a36Sopenharmony_ci#define TX_TXCC_CTRL 0x0040U 17062306a36Sopenharmony_ci#define TX_TXCC_CPOST_MULT_00 0x004CU 17162306a36Sopenharmony_ci#define TX_TXCC_CPOST_MULT_01 0x004DU 17262306a36Sopenharmony_ci#define TX_TXCC_MGNFS_MULT_000 0x0050U 17362306a36Sopenharmony_ci#define TX_TXCC_MGNFS_MULT_100 0x0054U 17462306a36Sopenharmony_ci#define DRV_DIAG_TX_DRV 0x00C6U 17562306a36Sopenharmony_ci#define XCVR_DIAG_PLLDRC_CTRL 0x00E5U 17662306a36Sopenharmony_ci#define XCVR_DIAG_HSCLK_SEL 0x00E6U 17762306a36Sopenharmony_ci#define XCVR_DIAG_HSCLK_DIV 0x00E7U 17862306a36Sopenharmony_ci#define XCVR_DIAG_RXCLK_CTRL 0x00E9U 17962306a36Sopenharmony_ci#define XCVR_DIAG_BIDI_CTRL 0x00EAU 18062306a36Sopenharmony_ci#define XCVR_DIAG_PSC_OVRD 0x00EBU 18162306a36Sopenharmony_ci#define TX_PSC_A0 0x0100U 18262306a36Sopenharmony_ci#define TX_PSC_A1 0x0101U 18362306a36Sopenharmony_ci#define TX_PSC_A2 0x0102U 18462306a36Sopenharmony_ci#define TX_PSC_A3 0x0103U 18562306a36Sopenharmony_ci#define TX_RCVDET_ST_TMR 0x0123U 18662306a36Sopenharmony_ci#define TX_DIAG_ACYA 0x01E7U 18762306a36Sopenharmony_ci#define TX_DIAG_ACYA_HBDC_MASK 0x0001U 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci/* PMA RX Lane registers */ 19062306a36Sopenharmony_ci#define RX_PSC_A0 0x0000U 19162306a36Sopenharmony_ci#define RX_PSC_A1 0x0001U 19262306a36Sopenharmony_ci#define RX_PSC_A2 0x0002U 19362306a36Sopenharmony_ci#define RX_PSC_A3 0x0003U 19462306a36Sopenharmony_ci#define RX_PSC_CAL 0x0006U 19562306a36Sopenharmony_ci#define RX_SDCAL0_INIT_TMR 0x0044U 19662306a36Sopenharmony_ci#define RX_SDCAL0_ITER_TMR 0x0045U 19762306a36Sopenharmony_ci#define RX_SDCAL1_INIT_TMR 0x004CU 19862306a36Sopenharmony_ci#define RX_SDCAL1_ITER_TMR 0x004DU 19962306a36Sopenharmony_ci#define RX_CDRLF_CNFG 0x0080U 20062306a36Sopenharmony_ci#define RX_CDRLF_CNFG3 0x0082U 20162306a36Sopenharmony_ci#define RX_SIGDET_HL_FILT_TMR 0x0090U 20262306a36Sopenharmony_ci#define RX_REE_GCSM1_CTRL 0x0108U 20362306a36Sopenharmony_ci#define RX_REE_GCSM1_EQENM_PH1 0x0109U 20462306a36Sopenharmony_ci#define RX_REE_GCSM1_EQENM_PH2 0x010AU 20562306a36Sopenharmony_ci#define RX_REE_GCSM2_CTRL 0x0110U 20662306a36Sopenharmony_ci#define RX_REE_PERGCSM_CTRL 0x0118U 20762306a36Sopenharmony_ci#define RX_REE_ATTEN_THR 0x0149U 20862306a36Sopenharmony_ci#define RX_REE_TAP1_CLIP 0x0171U 20962306a36Sopenharmony_ci#define RX_REE_TAP2TON_CLIP 0x0172U 21062306a36Sopenharmony_ci#define RX_REE_SMGM_CTRL1 0x0177U 21162306a36Sopenharmony_ci#define RX_REE_SMGM_CTRL2 0x0178U 21262306a36Sopenharmony_ci#define RX_DIAG_DFE_CTRL 0x01E0U 21362306a36Sopenharmony_ci#define RX_DIAG_DFE_AMP_TUNE_2 0x01E2U 21462306a36Sopenharmony_ci#define RX_DIAG_DFE_AMP_TUNE_3 0x01E3U 21562306a36Sopenharmony_ci#define RX_DIAG_NQST_CTRL 0x01E5U 21662306a36Sopenharmony_ci#define RX_DIAG_SIGDET_TUNE 0x01E8U 21762306a36Sopenharmony_ci#define RX_DIAG_PI_RATE 0x01F4U 21862306a36Sopenharmony_ci#define RX_DIAG_PI_CAP 0x01F5U 21962306a36Sopenharmony_ci#define RX_DIAG_ACYA 0x01FFU 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci/* PHY PCS common registers */ 22262306a36Sopenharmony_ci#define PHY_PIPE_CMN_CTRL1 0x0000U 22362306a36Sopenharmony_ci#define PHY_PLL_CFG 0x000EU 22462306a36Sopenharmony_ci#define PHY_PIPE_USB3_GEN2_PRE_CFG0 0x0020U 22562306a36Sopenharmony_ci#define PHY_PIPE_USB3_GEN2_POST_CFG0 0x0022U 22662306a36Sopenharmony_ci#define PHY_PIPE_USB3_GEN2_POST_CFG1 0x0023U 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci/* PHY PCS lane registers */ 22962306a36Sopenharmony_ci#define PHY_PCS_ISO_LINK_CTRL 0x000BU 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci/* PHY PMA common registers */ 23262306a36Sopenharmony_ci#define PHY_PMA_CMN_CTRL1 0x0000U 23362306a36Sopenharmony_ci#define PHY_PMA_CMN_CTRL2 0x0001U 23462306a36Sopenharmony_ci#define PHY_PMA_PLL_RAW_CTRL 0x0003U 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci#define CDNS_TORRENT_OUTPUT_CLOCKS 3 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_cistatic const char * const clk_names[] = { 23962306a36Sopenharmony_ci [CDNS_TORRENT_REFCLK_DRIVER] = "refclk-driver", 24062306a36Sopenharmony_ci [CDNS_TORRENT_DERIVED_REFCLK] = "refclk-der", 24162306a36Sopenharmony_ci [CDNS_TORRENT_RECEIVED_REFCLK] = "refclk-rec", 24262306a36Sopenharmony_ci}; 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_cistatic const struct reg_field phy_pll_cfg = 24562306a36Sopenharmony_ci REG_FIELD(PHY_PLL_CFG, 0, 1); 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_cistatic const struct reg_field phy_pma_cmn_ctrl_1 = 24862306a36Sopenharmony_ci REG_FIELD(PHY_PMA_CMN_CTRL1, 0, 0); 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_cistatic const struct reg_field phy_pma_cmn_ctrl_2 = 25162306a36Sopenharmony_ci REG_FIELD(PHY_PMA_CMN_CTRL2, 0, 7); 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_cistatic const struct reg_field phy_pma_pll_raw_ctrl = 25462306a36Sopenharmony_ci REG_FIELD(PHY_PMA_PLL_RAW_CTRL, 0, 1); 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_cistatic const struct reg_field phy_reset_ctrl = 25762306a36Sopenharmony_ci REG_FIELD(PHY_RESET, 8, 8); 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_cistatic const struct reg_field phy_pcs_iso_link_ctrl_1 = 26062306a36Sopenharmony_ci REG_FIELD(PHY_PCS_ISO_LINK_CTRL, 1, 1); 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_cistatic const struct reg_field phy_pipe_cmn_ctrl1_0 = REG_FIELD(PHY_PIPE_CMN_CTRL1, 0, 0); 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_cistatic const struct reg_field cmn_cdiag_refclk_ovrd_4 = 26562306a36Sopenharmony_ci REG_FIELD(CMN_CDIAG_REFCLK_OVRD, 4, 4); 26662306a36Sopenharmony_ci 26762306a36Sopenharmony_ci#define REFCLK_OUT_NUM_CMN_CONFIG 4 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_cienum cdns_torrent_refclk_out_cmn { 27062306a36Sopenharmony_ci CMN_CDIAG_REFCLK_DRV0_CTRL_1, 27162306a36Sopenharmony_ci CMN_CDIAG_REFCLK_DRV0_CTRL_4, 27262306a36Sopenharmony_ci CMN_CDIAG_REFCLK_DRV0_CTRL_5, 27362306a36Sopenharmony_ci CMN_CDIAG_REFCLK_DRV0_CTRL_6, 27462306a36Sopenharmony_ci}; 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_cistatic const struct reg_field refclk_out_cmn_cfg[] = { 27762306a36Sopenharmony_ci [CMN_CDIAG_REFCLK_DRV0_CTRL_1] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 1, 1), 27862306a36Sopenharmony_ci [CMN_CDIAG_REFCLK_DRV0_CTRL_4] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 4, 4), 27962306a36Sopenharmony_ci [CMN_CDIAG_REFCLK_DRV0_CTRL_5] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 5, 5), 28062306a36Sopenharmony_ci [CMN_CDIAG_REFCLK_DRV0_CTRL_6] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 6, 6), 28162306a36Sopenharmony_ci}; 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_cistatic const int refclk_driver_parent_index[] = { 28462306a36Sopenharmony_ci CDNS_TORRENT_DERIVED_REFCLK, 28562306a36Sopenharmony_ci CDNS_TORRENT_RECEIVED_REFCLK 28662306a36Sopenharmony_ci}; 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_cistatic u32 cdns_torrent_refclk_driver_mux_table[] = { 1, 0 }; 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_cienum cdns_torrent_phy_type { 29162306a36Sopenharmony_ci TYPE_NONE, 29262306a36Sopenharmony_ci TYPE_DP, 29362306a36Sopenharmony_ci TYPE_PCIE, 29462306a36Sopenharmony_ci TYPE_SGMII, 29562306a36Sopenharmony_ci TYPE_QSGMII, 29662306a36Sopenharmony_ci TYPE_USB, 29762306a36Sopenharmony_ci TYPE_USXGMII, 29862306a36Sopenharmony_ci}; 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_cienum cdns_torrent_ref_clk { 30162306a36Sopenharmony_ci CLK_19_2_MHZ, 30262306a36Sopenharmony_ci CLK_25_MHZ, 30362306a36Sopenharmony_ci CLK_100_MHZ, 30462306a36Sopenharmony_ci CLK_156_25_MHZ, 30562306a36Sopenharmony_ci CLK_ANY, 30662306a36Sopenharmony_ci}; 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_cienum cdns_torrent_ssc_mode { 30962306a36Sopenharmony_ci NO_SSC, 31062306a36Sopenharmony_ci EXTERNAL_SSC, 31162306a36Sopenharmony_ci INTERNAL_SSC, 31262306a36Sopenharmony_ci ANY_SSC, 31362306a36Sopenharmony_ci}; 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_ci/* Unique key id for vals table entry 31662306a36Sopenharmony_ci * REFCLK0_RATE | REFCLK1_RATE | LINK0_TYPE | LINK1_TYPE | SSC_TYPE 31762306a36Sopenharmony_ci */ 31862306a36Sopenharmony_ci#define REFCLK0_SHIFT 12 31962306a36Sopenharmony_ci#define REFCLK0_MASK GENMASK(14, 12) 32062306a36Sopenharmony_ci#define REFCLK1_SHIFT 9 32162306a36Sopenharmony_ci#define REFCLK1_MASK GENMASK(11, 9) 32262306a36Sopenharmony_ci#define LINK0_SHIFT 6 32362306a36Sopenharmony_ci#define LINK0_MASK GENMASK(8, 6) 32462306a36Sopenharmony_ci#define LINK1_SHIFT 3 32562306a36Sopenharmony_ci#define LINK1_MASK GENMASK(5, 3) 32662306a36Sopenharmony_ci#define SSC_SHIFT 0 32762306a36Sopenharmony_ci#define SSC_MASK GENMASK(2, 0) 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci#define CDNS_TORRENT_KEY(refclk0, refclk1, link0, link1, ssc) \ 33062306a36Sopenharmony_ci ((((refclk0) << REFCLK0_SHIFT) & REFCLK0_MASK) | \ 33162306a36Sopenharmony_ci (((refclk1) << REFCLK1_SHIFT) & REFCLK1_MASK) | \ 33262306a36Sopenharmony_ci (((link0) << LINK0_SHIFT) & LINK0_MASK) | \ 33362306a36Sopenharmony_ci (((link1) << LINK1_SHIFT) & LINK1_MASK) | \ 33462306a36Sopenharmony_ci (((ssc) << SSC_SHIFT) & SSC_MASK)) 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_ci#define CDNS_TORRENT_KEY_ANYCLK(link0, link1) \ 33762306a36Sopenharmony_ci CDNS_TORRENT_KEY(CLK_ANY, CLK_ANY, \ 33862306a36Sopenharmony_ci (link0), (link1), ANY_SSC) 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_cistruct cdns_torrent_inst { 34162306a36Sopenharmony_ci struct phy *phy; 34262306a36Sopenharmony_ci u32 mlane; 34362306a36Sopenharmony_ci enum cdns_torrent_phy_type phy_type; 34462306a36Sopenharmony_ci u32 num_lanes; 34562306a36Sopenharmony_ci struct reset_control *lnk_rst; 34662306a36Sopenharmony_ci enum cdns_torrent_ssc_mode ssc_mode; 34762306a36Sopenharmony_ci}; 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_cistruct cdns_torrent_phy { 35062306a36Sopenharmony_ci void __iomem *base; /* DPTX registers base */ 35162306a36Sopenharmony_ci void __iomem *sd_base; /* SD0801 registers base */ 35262306a36Sopenharmony_ci u32 max_bit_rate; /* Maximum link bit rate to use (in Mbps) */ 35362306a36Sopenharmony_ci u32 dp_pll; 35462306a36Sopenharmony_ci struct reset_control *phy_rst; 35562306a36Sopenharmony_ci struct reset_control *apb_rst; 35662306a36Sopenharmony_ci struct device *dev; 35762306a36Sopenharmony_ci struct clk *clk; 35862306a36Sopenharmony_ci enum cdns_torrent_ref_clk ref_clk_rate; 35962306a36Sopenharmony_ci struct cdns_torrent_inst phys[MAX_NUM_LANES]; 36062306a36Sopenharmony_ci int nsubnodes; 36162306a36Sopenharmony_ci const struct cdns_torrent_data *init_data; 36262306a36Sopenharmony_ci struct regmap *regmap_common_cdb; 36362306a36Sopenharmony_ci struct regmap *regmap_phy_pcs_common_cdb; 36462306a36Sopenharmony_ci struct regmap *regmap_phy_pma_common_cdb; 36562306a36Sopenharmony_ci struct regmap *regmap_tx_lane_cdb[MAX_NUM_LANES]; 36662306a36Sopenharmony_ci struct regmap *regmap_rx_lane_cdb[MAX_NUM_LANES]; 36762306a36Sopenharmony_ci struct regmap *regmap_phy_pcs_lane_cdb[MAX_NUM_LANES]; 36862306a36Sopenharmony_ci struct regmap *regmap_dptx_phy_reg; 36962306a36Sopenharmony_ci struct regmap_field *phy_pll_cfg; 37062306a36Sopenharmony_ci struct regmap_field *phy_pipe_cmn_ctrl1_0; 37162306a36Sopenharmony_ci struct regmap_field *cmn_cdiag_refclk_ovrd_4; 37262306a36Sopenharmony_ci struct regmap_field *phy_pma_cmn_ctrl_1; 37362306a36Sopenharmony_ci struct regmap_field *phy_pma_cmn_ctrl_2; 37462306a36Sopenharmony_ci struct regmap_field *phy_pma_pll_raw_ctrl; 37562306a36Sopenharmony_ci struct regmap_field *phy_reset_ctrl; 37662306a36Sopenharmony_ci struct regmap_field *phy_pcs_iso_link_ctrl_1[MAX_NUM_LANES]; 37762306a36Sopenharmony_ci struct clk_hw_onecell_data *clk_hw_data; 37862306a36Sopenharmony_ci}; 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_cienum phy_powerstate { 38162306a36Sopenharmony_ci POWERSTATE_A0 = 0, 38262306a36Sopenharmony_ci /* Powerstate A1 is unused */ 38362306a36Sopenharmony_ci POWERSTATE_A2 = 2, 38462306a36Sopenharmony_ci POWERSTATE_A3 = 3, 38562306a36Sopenharmony_ci}; 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_cistruct cdns_torrent_refclk_driver { 38862306a36Sopenharmony_ci struct clk_hw hw; 38962306a36Sopenharmony_ci struct regmap_field *cmn_fields[REFCLK_OUT_NUM_CMN_CONFIG]; 39062306a36Sopenharmony_ci struct clk_init_data clk_data; 39162306a36Sopenharmony_ci}; 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci#define to_cdns_torrent_refclk_driver(_hw) \ 39462306a36Sopenharmony_ci container_of(_hw, struct cdns_torrent_refclk_driver, hw) 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_cistruct cdns_torrent_derived_refclk { 39762306a36Sopenharmony_ci struct clk_hw hw; 39862306a36Sopenharmony_ci struct regmap_field *phy_pipe_cmn_ctrl1_0; 39962306a36Sopenharmony_ci struct regmap_field *cmn_cdiag_refclk_ovrd_4; 40062306a36Sopenharmony_ci struct clk_init_data clk_data; 40162306a36Sopenharmony_ci}; 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci#define to_cdns_torrent_derived_refclk(_hw) \ 40462306a36Sopenharmony_ci container_of(_hw, struct cdns_torrent_derived_refclk, hw) 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_cistruct cdns_torrent_received_refclk { 40762306a36Sopenharmony_ci struct clk_hw hw; 40862306a36Sopenharmony_ci struct regmap_field *phy_pipe_cmn_ctrl1_0; 40962306a36Sopenharmony_ci struct regmap_field *cmn_cdiag_refclk_ovrd_4; 41062306a36Sopenharmony_ci struct clk_init_data clk_data; 41162306a36Sopenharmony_ci}; 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci#define to_cdns_torrent_received_refclk(_hw) \ 41462306a36Sopenharmony_ci container_of(_hw, struct cdns_torrent_received_refclk, hw) 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_cistruct cdns_reg_pairs { 41762306a36Sopenharmony_ci u32 val; 41862306a36Sopenharmony_ci u32 off; 41962306a36Sopenharmony_ci}; 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_cistruct cdns_torrent_vals { 42262306a36Sopenharmony_ci struct cdns_reg_pairs *reg_pairs; 42362306a36Sopenharmony_ci u32 num_regs; 42462306a36Sopenharmony_ci}; 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_cistruct cdns_torrent_vals_entry { 42762306a36Sopenharmony_ci u32 key; 42862306a36Sopenharmony_ci struct cdns_torrent_vals *vals; 42962306a36Sopenharmony_ci}; 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_cistruct cdns_torrent_vals_table { 43262306a36Sopenharmony_ci struct cdns_torrent_vals_entry *entries; 43362306a36Sopenharmony_ci u32 num_entries; 43462306a36Sopenharmony_ci}; 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_cistruct cdns_torrent_data { 43762306a36Sopenharmony_ci u8 block_offset_shift; 43862306a36Sopenharmony_ci u8 reg_offset_shift; 43962306a36Sopenharmony_ci struct cdns_torrent_vals_table link_cmn_vals_tbl; 44062306a36Sopenharmony_ci struct cdns_torrent_vals_table xcvr_diag_vals_tbl; 44162306a36Sopenharmony_ci struct cdns_torrent_vals_table pcs_cmn_vals_tbl; 44262306a36Sopenharmony_ci struct cdns_torrent_vals_table phy_pma_cmn_vals_tbl; 44362306a36Sopenharmony_ci struct cdns_torrent_vals_table cmn_vals_tbl; 44462306a36Sopenharmony_ci struct cdns_torrent_vals_table tx_ln_vals_tbl; 44562306a36Sopenharmony_ci struct cdns_torrent_vals_table rx_ln_vals_tbl; 44662306a36Sopenharmony_ci}; 44762306a36Sopenharmony_ci 44862306a36Sopenharmony_cistruct cdns_regmap_cdb_context { 44962306a36Sopenharmony_ci struct device *dev; 45062306a36Sopenharmony_ci void __iomem *base; 45162306a36Sopenharmony_ci u8 reg_offset_shift; 45262306a36Sopenharmony_ci}; 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_cistatic struct cdns_torrent_vals *cdns_torrent_get_tbl_vals(const struct cdns_torrent_vals_table *tbl, 45562306a36Sopenharmony_ci enum cdns_torrent_ref_clk refclk0, 45662306a36Sopenharmony_ci enum cdns_torrent_ref_clk refclk1, 45762306a36Sopenharmony_ci enum cdns_torrent_phy_type link0, 45862306a36Sopenharmony_ci enum cdns_torrent_phy_type link1, 45962306a36Sopenharmony_ci enum cdns_torrent_ssc_mode ssc) 46062306a36Sopenharmony_ci{ 46162306a36Sopenharmony_ci int i; 46262306a36Sopenharmony_ci u32 key = CDNS_TORRENT_KEY(refclk0, refclk1, link0, link1, ssc); 46362306a36Sopenharmony_ci 46462306a36Sopenharmony_ci for (i = 0; i < tbl->num_entries; i++) { 46562306a36Sopenharmony_ci if (tbl->entries[i].key == key) 46662306a36Sopenharmony_ci return tbl->entries[i].vals; 46762306a36Sopenharmony_ci } 46862306a36Sopenharmony_ci 46962306a36Sopenharmony_ci return NULL; 47062306a36Sopenharmony_ci} 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_cistatic int cdns_regmap_write(void *context, unsigned int reg, unsigned int val) 47362306a36Sopenharmony_ci{ 47462306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 47562306a36Sopenharmony_ci u32 offset = reg << ctx->reg_offset_shift; 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ci writew(val, ctx->base + offset); 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ci return 0; 48062306a36Sopenharmony_ci} 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_cistatic int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val) 48362306a36Sopenharmony_ci{ 48462306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 48562306a36Sopenharmony_ci u32 offset = reg << ctx->reg_offset_shift; 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_ci *val = readw(ctx->base + offset); 48862306a36Sopenharmony_ci return 0; 48962306a36Sopenharmony_ci} 49062306a36Sopenharmony_ci 49162306a36Sopenharmony_cistatic int cdns_regmap_dptx_write(void *context, unsigned int reg, 49262306a36Sopenharmony_ci unsigned int val) 49362306a36Sopenharmony_ci{ 49462306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 49562306a36Sopenharmony_ci u32 offset = reg; 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_ci writel(val, ctx->base + offset); 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci return 0; 50062306a36Sopenharmony_ci} 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_cistatic int cdns_regmap_dptx_read(void *context, unsigned int reg, 50362306a36Sopenharmony_ci unsigned int *val) 50462306a36Sopenharmony_ci{ 50562306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 50662306a36Sopenharmony_ci u32 offset = reg; 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ci *val = readl(ctx->base + offset); 50962306a36Sopenharmony_ci return 0; 51062306a36Sopenharmony_ci} 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci#define TORRENT_TX_LANE_CDB_REGMAP_CONF(n) \ 51362306a36Sopenharmony_ci{ \ 51462306a36Sopenharmony_ci .name = "torrent_tx_lane" n "_cdb", \ 51562306a36Sopenharmony_ci .reg_stride = 1, \ 51662306a36Sopenharmony_ci .fast_io = true, \ 51762306a36Sopenharmony_ci .reg_write = cdns_regmap_write, \ 51862306a36Sopenharmony_ci .reg_read = cdns_regmap_read, \ 51962306a36Sopenharmony_ci} 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ci#define TORRENT_RX_LANE_CDB_REGMAP_CONF(n) \ 52262306a36Sopenharmony_ci{ \ 52362306a36Sopenharmony_ci .name = "torrent_rx_lane" n "_cdb", \ 52462306a36Sopenharmony_ci .reg_stride = 1, \ 52562306a36Sopenharmony_ci .fast_io = true, \ 52662306a36Sopenharmony_ci .reg_write = cdns_regmap_write, \ 52762306a36Sopenharmony_ci .reg_read = cdns_regmap_read, \ 52862306a36Sopenharmony_ci} 52962306a36Sopenharmony_ci 53062306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_tx_lane_cdb_config[] = { 53162306a36Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("0"), 53262306a36Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("1"), 53362306a36Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("2"), 53462306a36Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("3"), 53562306a36Sopenharmony_ci}; 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_rx_lane_cdb_config[] = { 53862306a36Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("0"), 53962306a36Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("1"), 54062306a36Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("2"), 54162306a36Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("3"), 54262306a36Sopenharmony_ci}; 54362306a36Sopenharmony_ci 54462306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_common_cdb_config = { 54562306a36Sopenharmony_ci .name = "torrent_common_cdb", 54662306a36Sopenharmony_ci .reg_stride = 1, 54762306a36Sopenharmony_ci .fast_io = true, 54862306a36Sopenharmony_ci .reg_write = cdns_regmap_write, 54962306a36Sopenharmony_ci .reg_read = cdns_regmap_read, 55062306a36Sopenharmony_ci}; 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci#define TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF(n) \ 55362306a36Sopenharmony_ci{ \ 55462306a36Sopenharmony_ci .name = "torrent_phy_pcs_lane" n "_cdb", \ 55562306a36Sopenharmony_ci .reg_stride = 1, \ 55662306a36Sopenharmony_ci .fast_io = true, \ 55762306a36Sopenharmony_ci .reg_write = cdns_regmap_write, \ 55862306a36Sopenharmony_ci .reg_read = cdns_regmap_read, \ 55962306a36Sopenharmony_ci} 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_phy_pcs_lane_cdb_config[] = { 56262306a36Sopenharmony_ci TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("0"), 56362306a36Sopenharmony_ci TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("1"), 56462306a36Sopenharmony_ci TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("2"), 56562306a36Sopenharmony_ci TORRENT_PHY_PCS_LANE_CDB_REGMAP_CONF("3"), 56662306a36Sopenharmony_ci}; 56762306a36Sopenharmony_ci 56862306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_phy_pcs_cmn_cdb_config = { 56962306a36Sopenharmony_ci .name = "torrent_phy_pcs_cmn_cdb", 57062306a36Sopenharmony_ci .reg_stride = 1, 57162306a36Sopenharmony_ci .fast_io = true, 57262306a36Sopenharmony_ci .reg_write = cdns_regmap_write, 57362306a36Sopenharmony_ci .reg_read = cdns_regmap_read, 57462306a36Sopenharmony_ci}; 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_phy_pma_cmn_cdb_config = { 57762306a36Sopenharmony_ci .name = "torrent_phy_pma_cmn_cdb", 57862306a36Sopenharmony_ci .reg_stride = 1, 57962306a36Sopenharmony_ci .fast_io = true, 58062306a36Sopenharmony_ci .reg_write = cdns_regmap_write, 58162306a36Sopenharmony_ci .reg_read = cdns_regmap_read, 58262306a36Sopenharmony_ci}; 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_cistatic const struct regmap_config cdns_torrent_dptx_phy_config = { 58562306a36Sopenharmony_ci .name = "torrent_dptx_phy", 58662306a36Sopenharmony_ci .reg_stride = 1, 58762306a36Sopenharmony_ci .fast_io = true, 58862306a36Sopenharmony_ci .reg_write = cdns_regmap_dptx_write, 58962306a36Sopenharmony_ci .reg_read = cdns_regmap_dptx_read, 59062306a36Sopenharmony_ci}; 59162306a36Sopenharmony_ci 59262306a36Sopenharmony_ci/* PHY mmr access functions */ 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_cistatic void cdns_torrent_phy_write(struct regmap *regmap, u32 offset, u32 val) 59562306a36Sopenharmony_ci{ 59662306a36Sopenharmony_ci regmap_write(regmap, offset, val); 59762306a36Sopenharmony_ci} 59862306a36Sopenharmony_ci 59962306a36Sopenharmony_cistatic u32 cdns_torrent_phy_read(struct regmap *regmap, u32 offset) 60062306a36Sopenharmony_ci{ 60162306a36Sopenharmony_ci unsigned int val; 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_ci regmap_read(regmap, offset, &val); 60462306a36Sopenharmony_ci return val; 60562306a36Sopenharmony_ci} 60662306a36Sopenharmony_ci 60762306a36Sopenharmony_ci/* DPTX mmr access functions */ 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_cistatic void cdns_torrent_dp_write(struct regmap *regmap, u32 offset, u32 val) 61062306a36Sopenharmony_ci{ 61162306a36Sopenharmony_ci regmap_write(regmap, offset, val); 61262306a36Sopenharmony_ci} 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_cistatic u32 cdns_torrent_dp_read(struct regmap *regmap, u32 offset) 61562306a36Sopenharmony_ci{ 61662306a36Sopenharmony_ci u32 val; 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_ci regmap_read(regmap, offset, &val); 61962306a36Sopenharmony_ci return val; 62062306a36Sopenharmony_ci} 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci/* 62362306a36Sopenharmony_ci * Structure used to store values of PHY registers for voltage-related 62462306a36Sopenharmony_ci * coefficients, for particular voltage swing and pre-emphasis level. Values 62562306a36Sopenharmony_ci * are shared across all physical lanes. 62662306a36Sopenharmony_ci */ 62762306a36Sopenharmony_cistruct coefficients { 62862306a36Sopenharmony_ci /* Value of DRV_DIAG_TX_DRV register to use */ 62962306a36Sopenharmony_ci u16 diag_tx_drv; 63062306a36Sopenharmony_ci /* Value of TX_TXCC_MGNFS_MULT_000 register to use */ 63162306a36Sopenharmony_ci u16 mgnfs_mult; 63262306a36Sopenharmony_ci /* Value of TX_TXCC_CPOST_MULT_00 register to use */ 63362306a36Sopenharmony_ci u16 cpost_mult; 63462306a36Sopenharmony_ci}; 63562306a36Sopenharmony_ci 63662306a36Sopenharmony_ci/* 63762306a36Sopenharmony_ci * Array consists of values of voltage-related registers for sd0801 PHY. A value 63862306a36Sopenharmony_ci * of 0xFFFF is a placeholder for invalid combination, and will never be used. 63962306a36Sopenharmony_ci */ 64062306a36Sopenharmony_cistatic const struct coefficients vltg_coeff[4][4] = { 64162306a36Sopenharmony_ci /* voltage swing 0, pre-emphasis 0->3 */ 64262306a36Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x002A, 64362306a36Sopenharmony_ci .cpost_mult = 0x0000}, 64462306a36Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F, 64562306a36Sopenharmony_ci .cpost_mult = 0x0014}, 64662306a36Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0012, 64762306a36Sopenharmony_ci .cpost_mult = 0x0020}, 64862306a36Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 64962306a36Sopenharmony_ci .cpost_mult = 0x002A} 65062306a36Sopenharmony_ci }, 65162306a36Sopenharmony_ci 65262306a36Sopenharmony_ci /* voltage swing 1, pre-emphasis 0->3 */ 65362306a36Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F, 65462306a36Sopenharmony_ci .cpost_mult = 0x0000}, 65562306a36Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013, 65662306a36Sopenharmony_ci .cpost_mult = 0x0012}, 65762306a36Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 65862306a36Sopenharmony_ci .cpost_mult = 0x001F}, 65962306a36Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 66062306a36Sopenharmony_ci .cpost_mult = 0xFFFF} 66162306a36Sopenharmony_ci }, 66262306a36Sopenharmony_ci 66362306a36Sopenharmony_ci /* voltage swing 2, pre-emphasis 0->3 */ 66462306a36Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013, 66562306a36Sopenharmony_ci .cpost_mult = 0x0000}, 66662306a36Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 66762306a36Sopenharmony_ci .cpost_mult = 0x0013}, 66862306a36Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 66962306a36Sopenharmony_ci .cpost_mult = 0xFFFF}, 67062306a36Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 67162306a36Sopenharmony_ci .cpost_mult = 0xFFFF} 67262306a36Sopenharmony_ci }, 67362306a36Sopenharmony_ci 67462306a36Sopenharmony_ci /* voltage swing 3, pre-emphasis 0->3 */ 67562306a36Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 67662306a36Sopenharmony_ci .cpost_mult = 0x0000}, 67762306a36Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 67862306a36Sopenharmony_ci .cpost_mult = 0xFFFF}, 67962306a36Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 68062306a36Sopenharmony_ci .cpost_mult = 0xFFFF}, 68162306a36Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 68262306a36Sopenharmony_ci .cpost_mult = 0xFFFF} 68362306a36Sopenharmony_ci } 68462306a36Sopenharmony_ci}; 68562306a36Sopenharmony_ci 68662306a36Sopenharmony_cistatic const char *cdns_torrent_get_phy_type(enum cdns_torrent_phy_type phy_type) 68762306a36Sopenharmony_ci{ 68862306a36Sopenharmony_ci switch (phy_type) { 68962306a36Sopenharmony_ci case TYPE_DP: 69062306a36Sopenharmony_ci return "DisplayPort"; 69162306a36Sopenharmony_ci case TYPE_PCIE: 69262306a36Sopenharmony_ci return "PCIe"; 69362306a36Sopenharmony_ci case TYPE_SGMII: 69462306a36Sopenharmony_ci return "SGMII"; 69562306a36Sopenharmony_ci case TYPE_QSGMII: 69662306a36Sopenharmony_ci return "QSGMII"; 69762306a36Sopenharmony_ci case TYPE_USB: 69862306a36Sopenharmony_ci return "USB"; 69962306a36Sopenharmony_ci case TYPE_USXGMII: 70062306a36Sopenharmony_ci return "USXGMII"; 70162306a36Sopenharmony_ci default: 70262306a36Sopenharmony_ci return "None"; 70362306a36Sopenharmony_ci } 70462306a36Sopenharmony_ci} 70562306a36Sopenharmony_ci 70662306a36Sopenharmony_ci/* 70762306a36Sopenharmony_ci * Set registers responsible for enabling and configuring SSC, with second and 70862306a36Sopenharmony_ci * third register values provided by parameters. 70962306a36Sopenharmony_ci */ 71062306a36Sopenharmony_cistatic 71162306a36Sopenharmony_civoid cdns_torrent_dp_enable_ssc_19_2mhz(struct cdns_torrent_phy *cdns_phy, 71262306a36Sopenharmony_ci u32 ctrl2_val, u32 ctrl3_val) 71362306a36Sopenharmony_ci{ 71462306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 71562306a36Sopenharmony_ci 71662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0001); 71762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl2_val); 71862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl3_val); 71962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0003); 72062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0001); 72162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl2_val); 72262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl3_val); 72362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0003); 72462306a36Sopenharmony_ci} 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_cistatic 72762306a36Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy, 72862306a36Sopenharmony_ci u32 rate, bool ssc) 72962306a36Sopenharmony_ci{ 73062306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_ci /* Assumes 19.2 MHz refclock */ 73362306a36Sopenharmony_ci switch (rate) { 73462306a36Sopenharmony_ci /* Setting VCO for 10.8GHz */ 73562306a36Sopenharmony_ci case 2700: 73662306a36Sopenharmony_ci case 5400: 73762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0119); 73862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x4000); 73962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 74062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00BC); 74162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0012); 74262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0119); 74362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x4000); 74462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 74562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00BC); 74662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0012); 74762306a36Sopenharmony_ci if (ssc) 74862306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x033A, 0x006A); 74962306a36Sopenharmony_ci break; 75062306a36Sopenharmony_ci /* Setting VCO for 9.72GHz */ 75162306a36Sopenharmony_ci case 1620: 75262306a36Sopenharmony_ci case 2430: 75362306a36Sopenharmony_ci case 3240: 75462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01FA); 75562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x4000); 75662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 75762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0152); 75862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 75962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01FA); 76062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x4000); 76162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 76262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0152); 76362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 76462306a36Sopenharmony_ci if (ssc) 76562306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x05DD, 0x0069); 76662306a36Sopenharmony_ci break; 76762306a36Sopenharmony_ci /* Setting VCO for 8.64GHz */ 76862306a36Sopenharmony_ci case 2160: 76962306a36Sopenharmony_ci case 4320: 77062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01C2); 77162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000); 77262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 77362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x012C); 77462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 77562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01C2); 77662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000); 77762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 77862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x012C); 77962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 78062306a36Sopenharmony_ci if (ssc) 78162306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x0536, 0x0069); 78262306a36Sopenharmony_ci break; 78362306a36Sopenharmony_ci /* Setting VCO for 8.1GHz */ 78462306a36Sopenharmony_ci case 8100: 78562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01A5); 78662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0xE000); 78762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 78862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x011A); 78962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 79062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01A5); 79162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0xE000); 79262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 79362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x011A); 79462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 79562306a36Sopenharmony_ci if (ssc) 79662306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x04D7, 0x006A); 79762306a36Sopenharmony_ci break; 79862306a36Sopenharmony_ci } 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci if (ssc) { 80162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_PLLCNT_START, 0x025E); 80262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_THR, 0x0005); 80362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_PLLCNT_START, 0x025E); 80462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_THR, 0x0005); 80562306a36Sopenharmony_ci } else { 80662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_PLLCNT_START, 0x0260); 80762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_PLLCNT_START, 0x0260); 80862306a36Sopenharmony_ci /* Set reset register values to disable SSC */ 80962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0002); 81062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL2_M0, 0x0000); 81162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL3_M0, 0x0000); 81262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0000); 81362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_THR, 0x0003); 81462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0002); 81562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL2_M0, 0x0000); 81662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL3_M0, 0x0000); 81762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0000); 81862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_THR, 0x0003); 81962306a36Sopenharmony_ci } 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_REFCNT_START, 0x0099); 82262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_START, 0x0099); 82362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_REFCNT_START, 0x0099); 82462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_START, 0x0099); 82562306a36Sopenharmony_ci} 82662306a36Sopenharmony_ci 82762306a36Sopenharmony_ci/* 82862306a36Sopenharmony_ci * Set registers responsible for enabling and configuring SSC, with second 82962306a36Sopenharmony_ci * register value provided by a parameter. 83062306a36Sopenharmony_ci */ 83162306a36Sopenharmony_cistatic void cdns_torrent_dp_enable_ssc_25mhz(struct cdns_torrent_phy *cdns_phy, 83262306a36Sopenharmony_ci u32 ctrl2_val) 83362306a36Sopenharmony_ci{ 83462306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 83562306a36Sopenharmony_ci 83662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0001); 83762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl2_val); 83862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x007F); 83962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0003); 84062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0001); 84162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl2_val); 84262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x007F); 84362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0003); 84462306a36Sopenharmony_ci} 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_cistatic 84762306a36Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy *cdns_phy, 84862306a36Sopenharmony_ci u32 rate, bool ssc) 84962306a36Sopenharmony_ci{ 85062306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 85162306a36Sopenharmony_ci 85262306a36Sopenharmony_ci /* Assumes 25 MHz refclock */ 85362306a36Sopenharmony_ci switch (rate) { 85462306a36Sopenharmony_ci /* Setting VCO for 10.8GHz */ 85562306a36Sopenharmony_ci case 2700: 85662306a36Sopenharmony_ci case 5400: 85762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01B0); 85862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000); 85962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 86062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0120); 86162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01B0); 86262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000); 86362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 86462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0120); 86562306a36Sopenharmony_ci if (ssc) 86662306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x0423); 86762306a36Sopenharmony_ci break; 86862306a36Sopenharmony_ci /* Setting VCO for 9.72GHz */ 86962306a36Sopenharmony_ci case 1620: 87062306a36Sopenharmony_ci case 2430: 87162306a36Sopenharmony_ci case 3240: 87262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0184); 87362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0xCCCD); 87462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 87562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0104); 87662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0184); 87762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0xCCCD); 87862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 87962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0104); 88062306a36Sopenharmony_ci if (ssc) 88162306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x03B9); 88262306a36Sopenharmony_ci break; 88362306a36Sopenharmony_ci /* Setting VCO for 8.64GHz */ 88462306a36Sopenharmony_ci case 2160: 88562306a36Sopenharmony_ci case 4320: 88662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0159); 88762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x999A); 88862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 88962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00E7); 89062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0159); 89162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x999A); 89262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 89362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00E7); 89462306a36Sopenharmony_ci if (ssc) 89562306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x034F); 89662306a36Sopenharmony_ci break; 89762306a36Sopenharmony_ci /* Setting VCO for 8.1GHz */ 89862306a36Sopenharmony_ci case 8100: 89962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0144); 90062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000); 90162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 90262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00D8); 90362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0144); 90462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000); 90562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 90662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00D8); 90762306a36Sopenharmony_ci if (ssc) 90862306a36Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x031A); 90962306a36Sopenharmony_ci break; 91062306a36Sopenharmony_ci } 91162306a36Sopenharmony_ci 91262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 91362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 91462306a36Sopenharmony_ci 91562306a36Sopenharmony_ci if (ssc) { 91662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 91762306a36Sopenharmony_ci CMN_PLL0_VCOCAL_PLLCNT_START, 0x0315); 91862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 91962306a36Sopenharmony_ci CMN_PLL0_LOCK_PLLCNT_THR, 0x0005); 92062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 92162306a36Sopenharmony_ci CMN_PLL1_VCOCAL_PLLCNT_START, 0x0315); 92262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 92362306a36Sopenharmony_ci CMN_PLL1_LOCK_PLLCNT_THR, 0x0005); 92462306a36Sopenharmony_ci } else { 92562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 92662306a36Sopenharmony_ci CMN_PLL0_VCOCAL_PLLCNT_START, 0x0317); 92762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 92862306a36Sopenharmony_ci CMN_PLL1_VCOCAL_PLLCNT_START, 0x0317); 92962306a36Sopenharmony_ci /* Set reset register values to disable SSC */ 93062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0002); 93162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL2_M0, 0x0000); 93262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL3_M0, 0x0000); 93362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0000); 93462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 93562306a36Sopenharmony_ci CMN_PLL0_LOCK_PLLCNT_THR, 0x0003); 93662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0002); 93762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL2_M0, 0x0000); 93862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL3_M0, 0x0000); 93962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0000); 94062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, 94162306a36Sopenharmony_ci CMN_PLL1_LOCK_PLLCNT_THR, 0x0003); 94262306a36Sopenharmony_ci } 94362306a36Sopenharmony_ci 94462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_REFCNT_START, 0x00C7); 94562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_START, 0x00C7); 94662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_REFCNT_START, 0x00C7); 94762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_START, 0x00C7); 94862306a36Sopenharmony_ci} 94962306a36Sopenharmony_ci 95062306a36Sopenharmony_cistatic 95162306a36Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(struct cdns_torrent_phy *cdns_phy, 95262306a36Sopenharmony_ci u32 rate, bool ssc) 95362306a36Sopenharmony_ci{ 95462306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 95562306a36Sopenharmony_ci 95662306a36Sopenharmony_ci /* Assumes 100 MHz refclock */ 95762306a36Sopenharmony_ci switch (rate) { 95862306a36Sopenharmony_ci /* Setting VCO for 10.8GHz */ 95962306a36Sopenharmony_ci case 2700: 96062306a36Sopenharmony_ci case 5400: 96162306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) 96262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_FBH_OVRD_M0, 0x0022); 96362306a36Sopenharmony_ci 96462306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL1) { 96562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0028); 96662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_FBH_OVRD_M0, 0x0022); 96762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_FBL_OVRD_M0, 0x000C); 96862306a36Sopenharmony_ci } 96962306a36Sopenharmony_ci break; 97062306a36Sopenharmony_ci /* Setting VCO for 9.72GHz */ 97162306a36Sopenharmony_ci case 1620: 97262306a36Sopenharmony_ci case 2430: 97362306a36Sopenharmony_ci case 3240: 97462306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) { 97562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004); 97662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509); 97762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00); 97862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08); 97962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0061); 98062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x3333); 98162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 98262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0042); 98362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 98462306a36Sopenharmony_ci } 98562306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL1) { 98662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004); 98762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509); 98862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00); 98962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08); 99062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0061); 99162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x3333); 99262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 99362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0042); 99462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 99562306a36Sopenharmony_ci } 99662306a36Sopenharmony_ci break; 99762306a36Sopenharmony_ci /* Setting VCO for 8.64GHz */ 99862306a36Sopenharmony_ci case 2160: 99962306a36Sopenharmony_ci case 4320: 100062306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) { 100162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004); 100262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509); 100362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00); 100462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08); 100562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0056); 100662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x6666); 100762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 100862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x003A); 100962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 101062306a36Sopenharmony_ci } 101162306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL1) { 101262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004); 101362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509); 101462306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00); 101562306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08); 101662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0056); 101762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x6666); 101862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 101962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x003A); 102062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 102162306a36Sopenharmony_ci } 102262306a36Sopenharmony_ci break; 102362306a36Sopenharmony_ci /* Setting VCO for 8.1GHz */ 102462306a36Sopenharmony_ci case 8100: 102562306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) { 102662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004); 102762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509); 102862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00); 102962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08); 103062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0051); 103162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 103262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0036); 103362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 103462306a36Sopenharmony_ci } 103562306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL1) { 103662306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004); 103762306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509); 103862306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00); 103962306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08); 104062306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0051); 104162306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 104262306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0036); 104362306a36Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 104462306a36Sopenharmony_ci } 104562306a36Sopenharmony_ci break; 104662306a36Sopenharmony_ci } 104762306a36Sopenharmony_ci} 104862306a36Sopenharmony_ci 104962306a36Sopenharmony_ci/* Set PLL used for DP configuration */ 105062306a36Sopenharmony_cistatic int cdns_torrent_dp_get_pll(struct cdns_torrent_phy *cdns_phy, 105162306a36Sopenharmony_ci enum cdns_torrent_phy_type phy_t2) 105262306a36Sopenharmony_ci{ 105362306a36Sopenharmony_ci switch (phy_t2) { 105462306a36Sopenharmony_ci case TYPE_PCIE: 105562306a36Sopenharmony_ci case TYPE_USB: 105662306a36Sopenharmony_ci cdns_phy->dp_pll = DP_PLL1; 105762306a36Sopenharmony_ci break; 105862306a36Sopenharmony_ci case TYPE_SGMII: 105962306a36Sopenharmony_ci case TYPE_QSGMII: 106062306a36Sopenharmony_ci cdns_phy->dp_pll = DP_PLL0; 106162306a36Sopenharmony_ci break; 106262306a36Sopenharmony_ci case TYPE_NONE: 106362306a36Sopenharmony_ci cdns_phy->dp_pll = DP_PLL0 | DP_PLL1; 106462306a36Sopenharmony_ci break; 106562306a36Sopenharmony_ci default: 106662306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Unsupported PHY configuration\n"); 106762306a36Sopenharmony_ci return -EINVAL; 106862306a36Sopenharmony_ci } 106962306a36Sopenharmony_ci 107062306a36Sopenharmony_ci return 0; 107162306a36Sopenharmony_ci} 107262306a36Sopenharmony_ci 107362306a36Sopenharmony_ci/* 107462306a36Sopenharmony_ci * Enable or disable PLL for selected lanes. 107562306a36Sopenharmony_ci */ 107662306a36Sopenharmony_cistatic int cdns_torrent_dp_set_pll_en(struct cdns_torrent_phy *cdns_phy, 107762306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 107862306a36Sopenharmony_ci struct phy_configure_opts_dp *dp, 107962306a36Sopenharmony_ci bool enable) 108062306a36Sopenharmony_ci{ 108162306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 108262306a36Sopenharmony_ci u32 rd_val, pll_ack_val; 108362306a36Sopenharmony_ci int ret; 108462306a36Sopenharmony_ci 108562306a36Sopenharmony_ci /* 108662306a36Sopenharmony_ci * Used to determine, which bits to check for or enable in 108762306a36Sopenharmony_ci * PHY_PMA_XCVR_PLLCLK_EN register. 108862306a36Sopenharmony_ci */ 108962306a36Sopenharmony_ci u32 pll_bits; 109062306a36Sopenharmony_ci /* Used to enable or disable lanes. */ 109162306a36Sopenharmony_ci u32 pll_val; 109262306a36Sopenharmony_ci 109362306a36Sopenharmony_ci /* Select values of registers and mask, depending on enabled lane count. */ 109462306a36Sopenharmony_ci pll_val = cdns_torrent_dp_read(regmap, PHY_PMA_XCVR_PLLCLK_EN); 109562306a36Sopenharmony_ci 109662306a36Sopenharmony_ci if (enable) { 109762306a36Sopenharmony_ci pll_bits = ((1 << dp->lanes) - 1); 109862306a36Sopenharmony_ci pll_val |= pll_bits; 109962306a36Sopenharmony_ci pll_ack_val = pll_bits; 110062306a36Sopenharmony_ci } else { 110162306a36Sopenharmony_ci pll_bits = ((1 << inst->num_lanes) - 1); 110262306a36Sopenharmony_ci pll_val &= (~pll_bits); 110362306a36Sopenharmony_ci pll_ack_val = 0; 110462306a36Sopenharmony_ci } 110562306a36Sopenharmony_ci 110662306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, pll_val); 110762306a36Sopenharmony_ci 110862306a36Sopenharmony_ci /* Wait for acknowledgment from PHY. */ 110962306a36Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, 111062306a36Sopenharmony_ci PHY_PMA_XCVR_PLLCLK_EN_ACK, 111162306a36Sopenharmony_ci rd_val, 111262306a36Sopenharmony_ci (rd_val & pll_bits) == pll_ack_val, 111362306a36Sopenharmony_ci 0, POLL_TIMEOUT_US); 111462306a36Sopenharmony_ci ndelay(100); 111562306a36Sopenharmony_ci return ret; 111662306a36Sopenharmony_ci} 111762306a36Sopenharmony_ci 111862306a36Sopenharmony_cistatic int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy, 111962306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 112062306a36Sopenharmony_ci u32 num_lanes, 112162306a36Sopenharmony_ci enum phy_powerstate powerstate) 112262306a36Sopenharmony_ci{ 112362306a36Sopenharmony_ci /* Register value for power state for a single byte. */ 112462306a36Sopenharmony_ci u32 value_part, i; 112562306a36Sopenharmony_ci u32 value = 0; 112662306a36Sopenharmony_ci u32 mask = 0; 112762306a36Sopenharmony_ci u32 read_val; 112862306a36Sopenharmony_ci int ret; 112962306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 113062306a36Sopenharmony_ci 113162306a36Sopenharmony_ci switch (powerstate) { 113262306a36Sopenharmony_ci case (POWERSTATE_A0): 113362306a36Sopenharmony_ci value_part = 0x01U; 113462306a36Sopenharmony_ci break; 113562306a36Sopenharmony_ci case (POWERSTATE_A2): 113662306a36Sopenharmony_ci value_part = 0x04U; 113762306a36Sopenharmony_ci break; 113862306a36Sopenharmony_ci default: 113962306a36Sopenharmony_ci /* Powerstate A3 */ 114062306a36Sopenharmony_ci value_part = 0x08U; 114162306a36Sopenharmony_ci break; 114262306a36Sopenharmony_ci } 114362306a36Sopenharmony_ci 114462306a36Sopenharmony_ci /* Select values of registers and mask, depending on enabled lane count. */ 114562306a36Sopenharmony_ci 114662306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 114762306a36Sopenharmony_ci value |= (value_part << PHY_POWER_STATE_LN(i)); 114862306a36Sopenharmony_ci mask |= (PMA_XCVR_POWER_STATE_REQ_LN_MASK << PHY_POWER_STATE_LN(i)); 114962306a36Sopenharmony_ci } 115062306a36Sopenharmony_ci 115162306a36Sopenharmony_ci /* Set power state A<n>. */ 115262306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, value); 115362306a36Sopenharmony_ci /* Wait, until PHY acknowledges power state completion. */ 115462306a36Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_POWER_STATE_ACK, 115562306a36Sopenharmony_ci read_val, (read_val & mask) == value, 0, 115662306a36Sopenharmony_ci POLL_TIMEOUT_US); 115762306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, 0x00000000); 115862306a36Sopenharmony_ci ndelay(100); 115962306a36Sopenharmony_ci 116062306a36Sopenharmony_ci return ret; 116162306a36Sopenharmony_ci} 116262306a36Sopenharmony_ci 116362306a36Sopenharmony_cistatic int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy, 116462306a36Sopenharmony_ci struct cdns_torrent_inst *inst, u32 num_lanes) 116562306a36Sopenharmony_ci{ 116662306a36Sopenharmony_ci unsigned int read_val; 116762306a36Sopenharmony_ci int ret; 116862306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 116962306a36Sopenharmony_ci 117062306a36Sopenharmony_ci /* 117162306a36Sopenharmony_ci * waiting for ACK of pma_xcvr_pllclk_en_ln_*, only for the 117262306a36Sopenharmony_ci * master lane 117362306a36Sopenharmony_ci */ 117462306a36Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_PLLCLK_EN_ACK, 117562306a36Sopenharmony_ci read_val, read_val & 1, 117662306a36Sopenharmony_ci 0, POLL_TIMEOUT_US); 117762306a36Sopenharmony_ci if (ret == -ETIMEDOUT) { 117862306a36Sopenharmony_ci dev_err(cdns_phy->dev, 117962306a36Sopenharmony_ci "timeout waiting for link PLL clock enable ack\n"); 118062306a36Sopenharmony_ci return ret; 118162306a36Sopenharmony_ci } 118262306a36Sopenharmony_ci 118362306a36Sopenharmony_ci ndelay(100); 118462306a36Sopenharmony_ci 118562306a36Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, num_lanes, 118662306a36Sopenharmony_ci POWERSTATE_A2); 118762306a36Sopenharmony_ci if (ret) 118862306a36Sopenharmony_ci return ret; 118962306a36Sopenharmony_ci 119062306a36Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, num_lanes, 119162306a36Sopenharmony_ci POWERSTATE_A0); 119262306a36Sopenharmony_ci 119362306a36Sopenharmony_ci return ret; 119462306a36Sopenharmony_ci} 119562306a36Sopenharmony_ci 119662306a36Sopenharmony_cistatic int cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy) 119762306a36Sopenharmony_ci{ 119862306a36Sopenharmony_ci unsigned int reg; 119962306a36Sopenharmony_ci int ret; 120062306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 120162306a36Sopenharmony_ci 120262306a36Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, PHY_PMA_CMN_READY, reg, 120362306a36Sopenharmony_ci reg & 1, 0, POLL_TIMEOUT_US); 120462306a36Sopenharmony_ci if (ret == -ETIMEDOUT) { 120562306a36Sopenharmony_ci dev_err(cdns_phy->dev, 120662306a36Sopenharmony_ci "timeout waiting for PMA common ready\n"); 120762306a36Sopenharmony_ci return -ETIMEDOUT; 120862306a36Sopenharmony_ci } 120962306a36Sopenharmony_ci 121062306a36Sopenharmony_ci return 0; 121162306a36Sopenharmony_ci} 121262306a36Sopenharmony_ci 121362306a36Sopenharmony_cistatic void cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy *cdns_phy, 121462306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 121562306a36Sopenharmony_ci u32 rate, u32 num_lanes) 121662306a36Sopenharmony_ci{ 121762306a36Sopenharmony_ci unsigned int clk_sel_val = 0; 121862306a36Sopenharmony_ci unsigned int hsclk_div_val = 0; 121962306a36Sopenharmony_ci unsigned int i; 122062306a36Sopenharmony_ci 122162306a36Sopenharmony_ci switch (rate) { 122262306a36Sopenharmony_ci case 1620: 122362306a36Sopenharmony_ci clk_sel_val = 0x0f01; 122462306a36Sopenharmony_ci hsclk_div_val = 2; 122562306a36Sopenharmony_ci break; 122662306a36Sopenharmony_ci case 2160: 122762306a36Sopenharmony_ci case 2430: 122862306a36Sopenharmony_ci case 2700: 122962306a36Sopenharmony_ci clk_sel_val = 0x0701; 123062306a36Sopenharmony_ci hsclk_div_val = 1; 123162306a36Sopenharmony_ci break; 123262306a36Sopenharmony_ci case 3240: 123362306a36Sopenharmony_ci clk_sel_val = 0x0b00; 123462306a36Sopenharmony_ci hsclk_div_val = 2; 123562306a36Sopenharmony_ci break; 123662306a36Sopenharmony_ci case 4320: 123762306a36Sopenharmony_ci case 5400: 123862306a36Sopenharmony_ci clk_sel_val = 0x0301; 123962306a36Sopenharmony_ci hsclk_div_val = 0; 124062306a36Sopenharmony_ci break; 124162306a36Sopenharmony_ci case 8100: 124262306a36Sopenharmony_ci clk_sel_val = 0x0200; 124362306a36Sopenharmony_ci hsclk_div_val = 0; 124462306a36Sopenharmony_ci break; 124562306a36Sopenharmony_ci } 124662306a36Sopenharmony_ci 124762306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) 124862306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_common_cdb, 124962306a36Sopenharmony_ci CMN_PDIAG_PLL0_CLK_SEL_M0, clk_sel_val); 125062306a36Sopenharmony_ci 125162306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL1) 125262306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_common_cdb, 125362306a36Sopenharmony_ci CMN_PDIAG_PLL1_CLK_SEL_M0, clk_sel_val); 125462306a36Sopenharmony_ci 125562306a36Sopenharmony_ci /* PMA lane configuration to deal with multi-link operation */ 125662306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) 125762306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + i], 125862306a36Sopenharmony_ci XCVR_DIAG_HSCLK_DIV, hsclk_div_val); 125962306a36Sopenharmony_ci} 126062306a36Sopenharmony_ci 126162306a36Sopenharmony_ci/* 126262306a36Sopenharmony_ci * Perform register operations related to setting link rate, once powerstate is 126362306a36Sopenharmony_ci * set and PLL disable request was processed. 126462306a36Sopenharmony_ci */ 126562306a36Sopenharmony_cistatic int cdns_torrent_dp_configure_rate(struct cdns_torrent_phy *cdns_phy, 126662306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 126762306a36Sopenharmony_ci struct phy_configure_opts_dp *dp) 126862306a36Sopenharmony_ci{ 126962306a36Sopenharmony_ci u32 read_val, field_val; 127062306a36Sopenharmony_ci int ret; 127162306a36Sopenharmony_ci 127262306a36Sopenharmony_ci /* 127362306a36Sopenharmony_ci * Disable the associated PLL (cmn_pll0_en or cmn_pll1_en) before 127462306a36Sopenharmony_ci * re-programming the new data rate. 127562306a36Sopenharmony_ci */ 127662306a36Sopenharmony_ci ret = regmap_field_read(cdns_phy->phy_pma_pll_raw_ctrl, &field_val); 127762306a36Sopenharmony_ci if (ret) 127862306a36Sopenharmony_ci return ret; 127962306a36Sopenharmony_ci field_val &= ~(cdns_phy->dp_pll); 128062306a36Sopenharmony_ci regmap_field_write(cdns_phy->phy_pma_pll_raw_ctrl, field_val); 128162306a36Sopenharmony_ci 128262306a36Sopenharmony_ci /* 128362306a36Sopenharmony_ci * Wait for PLL ready de-assertion. 128462306a36Sopenharmony_ci * For PLL0 - PHY_PMA_CMN_CTRL2[2] == 1 128562306a36Sopenharmony_ci * For PLL1 - PHY_PMA_CMN_CTRL2[3] == 1 128662306a36Sopenharmony_ci */ 128762306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) { 128862306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2, 128962306a36Sopenharmony_ci read_val, 129062306a36Sopenharmony_ci ((read_val >> 2) & 0x01) != 0, 129162306a36Sopenharmony_ci 0, POLL_TIMEOUT_US); 129262306a36Sopenharmony_ci if (ret) 129362306a36Sopenharmony_ci return ret; 129462306a36Sopenharmony_ci } 129562306a36Sopenharmony_ci 129662306a36Sopenharmony_ci if ((cdns_phy->dp_pll & DP_PLL1) && cdns_phy->nsubnodes != 1) { 129762306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2, 129862306a36Sopenharmony_ci read_val, 129962306a36Sopenharmony_ci ((read_val >> 3) & 0x01) != 0, 130062306a36Sopenharmony_ci 0, POLL_TIMEOUT_US); 130162306a36Sopenharmony_ci if (ret) 130262306a36Sopenharmony_ci return ret; 130362306a36Sopenharmony_ci } 130462306a36Sopenharmony_ci ndelay(200); 130562306a36Sopenharmony_ci 130662306a36Sopenharmony_ci /* DP Rate Change - VCO Output settings. */ 130762306a36Sopenharmony_ci if (cdns_phy->ref_clk_rate == CLK_19_2_MHZ) 130862306a36Sopenharmony_ci /* PMA common configuration 19.2MHz */ 130962306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, dp->link_rate, dp->ssc); 131062306a36Sopenharmony_ci else if (cdns_phy->ref_clk_rate == CLK_25_MHZ) 131162306a36Sopenharmony_ci /* PMA common configuration 25MHz */ 131262306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, dp->link_rate, dp->ssc); 131362306a36Sopenharmony_ci else if (cdns_phy->ref_clk_rate == CLK_100_MHZ) 131462306a36Sopenharmony_ci /* PMA common configuration 100MHz */ 131562306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(cdns_phy, dp->link_rate, dp->ssc); 131662306a36Sopenharmony_ci 131762306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_rate(cdns_phy, inst, dp->link_rate, dp->lanes); 131862306a36Sopenharmony_ci 131962306a36Sopenharmony_ci /* Enable the associated PLL (cmn_pll0_en or cmn_pll1_en) */ 132062306a36Sopenharmony_ci ret = regmap_field_read(cdns_phy->phy_pma_pll_raw_ctrl, &field_val); 132162306a36Sopenharmony_ci if (ret) 132262306a36Sopenharmony_ci return ret; 132362306a36Sopenharmony_ci field_val |= cdns_phy->dp_pll; 132462306a36Sopenharmony_ci regmap_field_write(cdns_phy->phy_pma_pll_raw_ctrl, field_val); 132562306a36Sopenharmony_ci 132662306a36Sopenharmony_ci /* 132762306a36Sopenharmony_ci * Wait for PLL ready assertion. 132862306a36Sopenharmony_ci * For PLL0 - PHY_PMA_CMN_CTRL2[0] == 1 132962306a36Sopenharmony_ci * For PLL1 - PHY_PMA_CMN_CTRL2[1] == 1 133062306a36Sopenharmony_ci */ 133162306a36Sopenharmony_ci if (cdns_phy->dp_pll & DP_PLL0) { 133262306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2, 133362306a36Sopenharmony_ci read_val, 133462306a36Sopenharmony_ci (read_val & 0x01) != 0, 133562306a36Sopenharmony_ci 0, POLL_TIMEOUT_US); 133662306a36Sopenharmony_ci if (ret) 133762306a36Sopenharmony_ci return ret; 133862306a36Sopenharmony_ci } 133962306a36Sopenharmony_ci 134062306a36Sopenharmony_ci if ((cdns_phy->dp_pll & DP_PLL1) && cdns_phy->nsubnodes != 1) 134162306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2, 134262306a36Sopenharmony_ci read_val, 134362306a36Sopenharmony_ci ((read_val >> 1) & 0x01) != 0, 134462306a36Sopenharmony_ci 0, POLL_TIMEOUT_US); 134562306a36Sopenharmony_ci 134662306a36Sopenharmony_ci return ret; 134762306a36Sopenharmony_ci} 134862306a36Sopenharmony_ci 134962306a36Sopenharmony_ci/* 135062306a36Sopenharmony_ci * Verify, that parameters to configure PHY with are correct. 135162306a36Sopenharmony_ci */ 135262306a36Sopenharmony_cistatic int cdns_torrent_dp_verify_config(struct cdns_torrent_inst *inst, 135362306a36Sopenharmony_ci struct phy_configure_opts_dp *dp) 135462306a36Sopenharmony_ci{ 135562306a36Sopenharmony_ci u8 i; 135662306a36Sopenharmony_ci 135762306a36Sopenharmony_ci /* If changing link rate was required, verify it's supported. */ 135862306a36Sopenharmony_ci if (dp->set_rate) { 135962306a36Sopenharmony_ci switch (dp->link_rate) { 136062306a36Sopenharmony_ci case 1620: 136162306a36Sopenharmony_ci case 2160: 136262306a36Sopenharmony_ci case 2430: 136362306a36Sopenharmony_ci case 2700: 136462306a36Sopenharmony_ci case 3240: 136562306a36Sopenharmony_ci case 4320: 136662306a36Sopenharmony_ci case 5400: 136762306a36Sopenharmony_ci case 8100: 136862306a36Sopenharmony_ci /* valid bit rate */ 136962306a36Sopenharmony_ci break; 137062306a36Sopenharmony_ci default: 137162306a36Sopenharmony_ci return -EINVAL; 137262306a36Sopenharmony_ci } 137362306a36Sopenharmony_ci } 137462306a36Sopenharmony_ci 137562306a36Sopenharmony_ci /* Verify lane count. */ 137662306a36Sopenharmony_ci switch (dp->lanes) { 137762306a36Sopenharmony_ci case 1: 137862306a36Sopenharmony_ci case 2: 137962306a36Sopenharmony_ci case 4: 138062306a36Sopenharmony_ci /* valid lane count. */ 138162306a36Sopenharmony_ci break; 138262306a36Sopenharmony_ci default: 138362306a36Sopenharmony_ci return -EINVAL; 138462306a36Sopenharmony_ci } 138562306a36Sopenharmony_ci 138662306a36Sopenharmony_ci /* Check against actual number of PHY's lanes. */ 138762306a36Sopenharmony_ci if (dp->lanes > inst->num_lanes) 138862306a36Sopenharmony_ci return -EINVAL; 138962306a36Sopenharmony_ci 139062306a36Sopenharmony_ci /* 139162306a36Sopenharmony_ci * If changing voltages is required, check swing and pre-emphasis 139262306a36Sopenharmony_ci * levels, per-lane. 139362306a36Sopenharmony_ci */ 139462306a36Sopenharmony_ci if (dp->set_voltages) { 139562306a36Sopenharmony_ci /* Lane count verified previously. */ 139662306a36Sopenharmony_ci for (i = 0; i < dp->lanes; i++) { 139762306a36Sopenharmony_ci if (dp->voltage[i] > 3 || dp->pre[i] > 3) 139862306a36Sopenharmony_ci return -EINVAL; 139962306a36Sopenharmony_ci 140062306a36Sopenharmony_ci /* Sum of voltage swing and pre-emphasis levels cannot 140162306a36Sopenharmony_ci * exceed 3. 140262306a36Sopenharmony_ci */ 140362306a36Sopenharmony_ci if (dp->voltage[i] + dp->pre[i] > 3) 140462306a36Sopenharmony_ci return -EINVAL; 140562306a36Sopenharmony_ci } 140662306a36Sopenharmony_ci } 140762306a36Sopenharmony_ci 140862306a36Sopenharmony_ci return 0; 140962306a36Sopenharmony_ci} 141062306a36Sopenharmony_ci 141162306a36Sopenharmony_ci/* Set power state A0 and PLL clock enable to 0 on enabled lanes. */ 141262306a36Sopenharmony_cistatic void cdns_torrent_dp_set_a0_pll(struct cdns_torrent_phy *cdns_phy, 141362306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 141462306a36Sopenharmony_ci u32 num_lanes) 141562306a36Sopenharmony_ci{ 141662306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 141762306a36Sopenharmony_ci u32 pwr_state = cdns_torrent_dp_read(regmap, 141862306a36Sopenharmony_ci PHY_PMA_XCVR_POWER_STATE_REQ); 141962306a36Sopenharmony_ci u32 pll_clk_en = cdns_torrent_dp_read(regmap, 142062306a36Sopenharmony_ci PHY_PMA_XCVR_PLLCLK_EN); 142162306a36Sopenharmony_ci u32 i; 142262306a36Sopenharmony_ci 142362306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 142462306a36Sopenharmony_ci pwr_state &= ~(PMA_XCVR_POWER_STATE_REQ_LN_MASK 142562306a36Sopenharmony_ci << PHY_POWER_STATE_LN(inst->mlane + i)); 142662306a36Sopenharmony_ci 142762306a36Sopenharmony_ci pll_clk_en &= ~(0x01U << (inst->mlane + i)); 142862306a36Sopenharmony_ci } 142962306a36Sopenharmony_ci 143062306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, pwr_state); 143162306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, pll_clk_en); 143262306a36Sopenharmony_ci} 143362306a36Sopenharmony_ci 143462306a36Sopenharmony_ci/* Configure lane count as required. */ 143562306a36Sopenharmony_cistatic int cdns_torrent_dp_set_lanes(struct cdns_torrent_phy *cdns_phy, 143662306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 143762306a36Sopenharmony_ci struct phy_configure_opts_dp *dp) 143862306a36Sopenharmony_ci{ 143962306a36Sopenharmony_ci u32 value, i; 144062306a36Sopenharmony_ci int ret; 144162306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 144262306a36Sopenharmony_ci u8 lane_mask = (1 << dp->lanes) - 1; 144362306a36Sopenharmony_ci u8 pma_tx_elec_idle_mask = 0; 144462306a36Sopenharmony_ci u32 clane = inst->mlane; 144562306a36Sopenharmony_ci 144662306a36Sopenharmony_ci lane_mask <<= clane; 144762306a36Sopenharmony_ci 144862306a36Sopenharmony_ci value = cdns_torrent_dp_read(regmap, PHY_RESET); 144962306a36Sopenharmony_ci /* clear pma_tx_elec_idle_ln_* bits. */ 145062306a36Sopenharmony_ci pma_tx_elec_idle_mask = ((1 << inst->num_lanes) - 1) << clane; 145162306a36Sopenharmony_ci 145262306a36Sopenharmony_ci pma_tx_elec_idle_mask <<= PMA_TX_ELEC_IDLE_SHIFT; 145362306a36Sopenharmony_ci 145462306a36Sopenharmony_ci value &= ~pma_tx_elec_idle_mask; 145562306a36Sopenharmony_ci 145662306a36Sopenharmony_ci /* Assert pma_tx_elec_idle_ln_* for disabled lanes. */ 145762306a36Sopenharmony_ci value |= ((~lane_mask) << PMA_TX_ELEC_IDLE_SHIFT) & 145862306a36Sopenharmony_ci pma_tx_elec_idle_mask; 145962306a36Sopenharmony_ci 146062306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, value); 146162306a36Sopenharmony_ci 146262306a36Sopenharmony_ci /* reset the link by asserting master lane phy_l0*_reset_n low */ 146362306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, 146462306a36Sopenharmony_ci value & (~(1 << clane))); 146562306a36Sopenharmony_ci 146662306a36Sopenharmony_ci /* 146762306a36Sopenharmony_ci * Assert lane reset on unused lanes and master lane so they remain in reset 146862306a36Sopenharmony_ci * and powered down when re-enabling the link 146962306a36Sopenharmony_ci */ 147062306a36Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) 147162306a36Sopenharmony_ci value &= (~(1 << (clane + i))); 147262306a36Sopenharmony_ci 147362306a36Sopenharmony_ci for (i = 1; i < inst->num_lanes; i++) 147462306a36Sopenharmony_ci value |= ((1 << (clane + i)) & lane_mask); 147562306a36Sopenharmony_ci 147662306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, value); 147762306a36Sopenharmony_ci 147862306a36Sopenharmony_ci cdns_torrent_dp_set_a0_pll(cdns_phy, inst, dp->lanes); 147962306a36Sopenharmony_ci 148062306a36Sopenharmony_ci /* release phy_l0*_reset_n based on used laneCount */ 148162306a36Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) 148262306a36Sopenharmony_ci value &= (~(1 << (clane + i))); 148362306a36Sopenharmony_ci 148462306a36Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) 148562306a36Sopenharmony_ci value |= ((1 << (clane + i)) & lane_mask); 148662306a36Sopenharmony_ci 148762306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, value); 148862306a36Sopenharmony_ci 148962306a36Sopenharmony_ci /* Wait, until PHY gets ready after releasing PHY reset signal. */ 149062306a36Sopenharmony_ci ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy); 149162306a36Sopenharmony_ci if (ret) 149262306a36Sopenharmony_ci return ret; 149362306a36Sopenharmony_ci 149462306a36Sopenharmony_ci ndelay(100); 149562306a36Sopenharmony_ci 149662306a36Sopenharmony_ci /* release pma_xcvr_pllclk_en_ln_*, only for the master lane */ 149762306a36Sopenharmony_ci value = cdns_torrent_dp_read(regmap, PHY_PMA_XCVR_PLLCLK_EN); 149862306a36Sopenharmony_ci value |= (1 << clane); 149962306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, value); 150062306a36Sopenharmony_ci 150162306a36Sopenharmony_ci ret = cdns_torrent_dp_run(cdns_phy, inst, dp->lanes); 150262306a36Sopenharmony_ci 150362306a36Sopenharmony_ci return ret; 150462306a36Sopenharmony_ci} 150562306a36Sopenharmony_ci 150662306a36Sopenharmony_ci/* Configure link rate as required. */ 150762306a36Sopenharmony_cistatic int cdns_torrent_dp_set_rate(struct cdns_torrent_phy *cdns_phy, 150862306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 150962306a36Sopenharmony_ci struct phy_configure_opts_dp *dp) 151062306a36Sopenharmony_ci{ 151162306a36Sopenharmony_ci int ret; 151262306a36Sopenharmony_ci 151362306a36Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, dp->lanes, 151462306a36Sopenharmony_ci POWERSTATE_A3); 151562306a36Sopenharmony_ci if (ret) 151662306a36Sopenharmony_ci return ret; 151762306a36Sopenharmony_ci ret = cdns_torrent_dp_set_pll_en(cdns_phy, inst, dp, false); 151862306a36Sopenharmony_ci if (ret) 151962306a36Sopenharmony_ci return ret; 152062306a36Sopenharmony_ci ndelay(200); 152162306a36Sopenharmony_ci 152262306a36Sopenharmony_ci ret = cdns_torrent_dp_configure_rate(cdns_phy, inst, dp); 152362306a36Sopenharmony_ci if (ret) 152462306a36Sopenharmony_ci return ret; 152562306a36Sopenharmony_ci ndelay(200); 152662306a36Sopenharmony_ci 152762306a36Sopenharmony_ci ret = cdns_torrent_dp_set_pll_en(cdns_phy, inst, dp, true); 152862306a36Sopenharmony_ci if (ret) 152962306a36Sopenharmony_ci return ret; 153062306a36Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, dp->lanes, 153162306a36Sopenharmony_ci POWERSTATE_A2); 153262306a36Sopenharmony_ci if (ret) 153362306a36Sopenharmony_ci return ret; 153462306a36Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, inst, dp->lanes, 153562306a36Sopenharmony_ci POWERSTATE_A0); 153662306a36Sopenharmony_ci if (ret) 153762306a36Sopenharmony_ci return ret; 153862306a36Sopenharmony_ci ndelay(900); 153962306a36Sopenharmony_ci 154062306a36Sopenharmony_ci return ret; 154162306a36Sopenharmony_ci} 154262306a36Sopenharmony_ci 154362306a36Sopenharmony_ci/* Configure voltage swing and pre-emphasis for all enabled lanes. */ 154462306a36Sopenharmony_cistatic void cdns_torrent_dp_set_voltages(struct cdns_torrent_phy *cdns_phy, 154562306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 154662306a36Sopenharmony_ci struct phy_configure_opts_dp *dp) 154762306a36Sopenharmony_ci{ 154862306a36Sopenharmony_ci u8 lane; 154962306a36Sopenharmony_ci u16 val; 155062306a36Sopenharmony_ci 155162306a36Sopenharmony_ci for (lane = 0; lane < dp->lanes; lane++) { 155262306a36Sopenharmony_ci val = cdns_torrent_phy_read(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 155362306a36Sopenharmony_ci TX_DIAG_ACYA); 155462306a36Sopenharmony_ci /* 155562306a36Sopenharmony_ci * Write 1 to register bit TX_DIAG_ACYA[0] to freeze the 155662306a36Sopenharmony_ci * current state of the analog TX driver. 155762306a36Sopenharmony_ci */ 155862306a36Sopenharmony_ci val |= TX_DIAG_ACYA_HBDC_MASK; 155962306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 156062306a36Sopenharmony_ci TX_DIAG_ACYA, val); 156162306a36Sopenharmony_ci 156262306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 156362306a36Sopenharmony_ci TX_TXCC_CTRL, 0x08A4); 156462306a36Sopenharmony_ci val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].diag_tx_drv; 156562306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 156662306a36Sopenharmony_ci DRV_DIAG_TX_DRV, val); 156762306a36Sopenharmony_ci val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].mgnfs_mult; 156862306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 156962306a36Sopenharmony_ci TX_TXCC_MGNFS_MULT_000, 157062306a36Sopenharmony_ci val); 157162306a36Sopenharmony_ci val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].cpost_mult; 157262306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 157362306a36Sopenharmony_ci TX_TXCC_CPOST_MULT_00, 157462306a36Sopenharmony_ci val); 157562306a36Sopenharmony_ci 157662306a36Sopenharmony_ci val = cdns_torrent_phy_read(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 157762306a36Sopenharmony_ci TX_DIAG_ACYA); 157862306a36Sopenharmony_ci /* 157962306a36Sopenharmony_ci * Write 0 to register bit TX_DIAG_ACYA[0] to allow the state of 158062306a36Sopenharmony_ci * analog TX driver to reflect the new programmed one. 158162306a36Sopenharmony_ci */ 158262306a36Sopenharmony_ci val &= ~TX_DIAG_ACYA_HBDC_MASK; 158362306a36Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[inst->mlane + lane], 158462306a36Sopenharmony_ci TX_DIAG_ACYA, val); 158562306a36Sopenharmony_ci } 158662306a36Sopenharmony_ci}; 158762306a36Sopenharmony_ci 158862306a36Sopenharmony_cistatic int cdns_torrent_dp_configure(struct phy *phy, 158962306a36Sopenharmony_ci union phy_configure_opts *opts) 159062306a36Sopenharmony_ci{ 159162306a36Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 159262306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 159362306a36Sopenharmony_ci int ret; 159462306a36Sopenharmony_ci 159562306a36Sopenharmony_ci ret = cdns_torrent_dp_verify_config(inst, &opts->dp); 159662306a36Sopenharmony_ci if (ret) { 159762306a36Sopenharmony_ci dev_err(&phy->dev, "invalid params for phy configure\n"); 159862306a36Sopenharmony_ci return ret; 159962306a36Sopenharmony_ci } 160062306a36Sopenharmony_ci 160162306a36Sopenharmony_ci if (opts->dp.set_lanes) { 160262306a36Sopenharmony_ci ret = cdns_torrent_dp_set_lanes(cdns_phy, inst, &opts->dp); 160362306a36Sopenharmony_ci if (ret) { 160462306a36Sopenharmony_ci dev_err(&phy->dev, "cdns_torrent_dp_set_lanes failed\n"); 160562306a36Sopenharmony_ci return ret; 160662306a36Sopenharmony_ci } 160762306a36Sopenharmony_ci } 160862306a36Sopenharmony_ci 160962306a36Sopenharmony_ci if (opts->dp.set_rate) { 161062306a36Sopenharmony_ci ret = cdns_torrent_dp_set_rate(cdns_phy, inst, &opts->dp); 161162306a36Sopenharmony_ci if (ret) { 161262306a36Sopenharmony_ci dev_err(&phy->dev, "cdns_torrent_dp_set_rate failed\n"); 161362306a36Sopenharmony_ci return ret; 161462306a36Sopenharmony_ci } 161562306a36Sopenharmony_ci } 161662306a36Sopenharmony_ci 161762306a36Sopenharmony_ci if (opts->dp.set_voltages) 161862306a36Sopenharmony_ci cdns_torrent_dp_set_voltages(cdns_phy, inst, &opts->dp); 161962306a36Sopenharmony_ci 162062306a36Sopenharmony_ci return ret; 162162306a36Sopenharmony_ci} 162262306a36Sopenharmony_ci 162362306a36Sopenharmony_cistatic int cdns_torrent_phy_on(struct phy *phy) 162462306a36Sopenharmony_ci{ 162562306a36Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 162662306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 162762306a36Sopenharmony_ci u32 read_val; 162862306a36Sopenharmony_ci int ret; 162962306a36Sopenharmony_ci 163062306a36Sopenharmony_ci if (cdns_phy->nsubnodes == 1) { 163162306a36Sopenharmony_ci /* Take the PHY lane group out of reset */ 163262306a36Sopenharmony_ci reset_control_deassert(inst->lnk_rst); 163362306a36Sopenharmony_ci 163462306a36Sopenharmony_ci /* Take the PHY out of reset */ 163562306a36Sopenharmony_ci ret = reset_control_deassert(cdns_phy->phy_rst); 163662306a36Sopenharmony_ci if (ret) 163762306a36Sopenharmony_ci return ret; 163862306a36Sopenharmony_ci } 163962306a36Sopenharmony_ci 164062306a36Sopenharmony_ci /* 164162306a36Sopenharmony_ci * Wait for cmn_ready assertion 164262306a36Sopenharmony_ci * PHY_PMA_CMN_CTRL1[0] == 1 164362306a36Sopenharmony_ci */ 164462306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_1, 164562306a36Sopenharmony_ci read_val, read_val, 1000, 164662306a36Sopenharmony_ci PLL_LOCK_TIMEOUT); 164762306a36Sopenharmony_ci if (ret) { 164862306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Timeout waiting for CMN ready\n"); 164962306a36Sopenharmony_ci return ret; 165062306a36Sopenharmony_ci } 165162306a36Sopenharmony_ci 165262306a36Sopenharmony_ci if (inst->phy_type == TYPE_PCIE || inst->phy_type == TYPE_USB) { 165362306a36Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pcs_iso_link_ctrl_1[inst->mlane], 165462306a36Sopenharmony_ci read_val, !read_val, 1000, 165562306a36Sopenharmony_ci PLL_LOCK_TIMEOUT); 165662306a36Sopenharmony_ci if (ret == -ETIMEDOUT) { 165762306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Timeout waiting for PHY status ready\n"); 165862306a36Sopenharmony_ci return ret; 165962306a36Sopenharmony_ci } 166062306a36Sopenharmony_ci } 166162306a36Sopenharmony_ci 166262306a36Sopenharmony_ci return 0; 166362306a36Sopenharmony_ci} 166462306a36Sopenharmony_ci 166562306a36Sopenharmony_cistatic int cdns_torrent_phy_off(struct phy *phy) 166662306a36Sopenharmony_ci{ 166762306a36Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 166862306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 166962306a36Sopenharmony_ci int ret; 167062306a36Sopenharmony_ci 167162306a36Sopenharmony_ci if (cdns_phy->nsubnodes != 1) 167262306a36Sopenharmony_ci return 0; 167362306a36Sopenharmony_ci 167462306a36Sopenharmony_ci ret = reset_control_assert(cdns_phy->phy_rst); 167562306a36Sopenharmony_ci if (ret) 167662306a36Sopenharmony_ci return ret; 167762306a36Sopenharmony_ci 167862306a36Sopenharmony_ci return reset_control_assert(inst->lnk_rst); 167962306a36Sopenharmony_ci} 168062306a36Sopenharmony_ci 168162306a36Sopenharmony_cistatic void cdns_torrent_dp_common_init(struct cdns_torrent_phy *cdns_phy, 168262306a36Sopenharmony_ci struct cdns_torrent_inst *inst) 168362306a36Sopenharmony_ci{ 168462306a36Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 168562306a36Sopenharmony_ci unsigned char lane_bits; 168662306a36Sopenharmony_ci u32 val; 168762306a36Sopenharmony_ci 168862306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_AUX_CTRL, 0x0003); /* enable AUX */ 168962306a36Sopenharmony_ci 169062306a36Sopenharmony_ci /* 169162306a36Sopenharmony_ci * Set lines power state to A0 169262306a36Sopenharmony_ci * Set lines pll clk enable to 0 169362306a36Sopenharmony_ci */ 169462306a36Sopenharmony_ci cdns_torrent_dp_set_a0_pll(cdns_phy, inst, inst->num_lanes); 169562306a36Sopenharmony_ci 169662306a36Sopenharmony_ci /* 169762306a36Sopenharmony_ci * release phy_l0*_reset_n and pma_tx_elec_idle_ln_* based on 169862306a36Sopenharmony_ci * used lanes 169962306a36Sopenharmony_ci */ 170062306a36Sopenharmony_ci lane_bits = (1 << inst->num_lanes) - 1; 170162306a36Sopenharmony_ci 170262306a36Sopenharmony_ci val = cdns_torrent_dp_read(regmap, PHY_RESET); 170362306a36Sopenharmony_ci val |= (0xF & lane_bits); 170462306a36Sopenharmony_ci val &= ~(lane_bits << 4); 170562306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, val); 170662306a36Sopenharmony_ci 170762306a36Sopenharmony_ci /* release pma_xcvr_pllclk_en_ln_*, only for the master lane */ 170862306a36Sopenharmony_ci val = cdns_torrent_dp_read(regmap, PHY_PMA_XCVR_PLLCLK_EN); 170962306a36Sopenharmony_ci val |= 1; 171062306a36Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, val); 171162306a36Sopenharmony_ci 171262306a36Sopenharmony_ci /* 171362306a36Sopenharmony_ci * PHY PMA registers configuration functions 171462306a36Sopenharmony_ci * Initialize PHY with max supported link rate, without SSC. 171562306a36Sopenharmony_ci */ 171662306a36Sopenharmony_ci if (cdns_phy->ref_clk_rate == CLK_19_2_MHZ) 171762306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, 171862306a36Sopenharmony_ci cdns_phy->max_bit_rate, 171962306a36Sopenharmony_ci false); 172062306a36Sopenharmony_ci else if (cdns_phy->ref_clk_rate == CLK_25_MHZ) 172162306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, 172262306a36Sopenharmony_ci cdns_phy->max_bit_rate, 172362306a36Sopenharmony_ci false); 172462306a36Sopenharmony_ci else if (cdns_phy->ref_clk_rate == CLK_100_MHZ) 172562306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_100mhz(cdns_phy, 172662306a36Sopenharmony_ci cdns_phy->max_bit_rate, 172762306a36Sopenharmony_ci false); 172862306a36Sopenharmony_ci 172962306a36Sopenharmony_ci cdns_torrent_dp_pma_cmn_rate(cdns_phy, inst, cdns_phy->max_bit_rate, 173062306a36Sopenharmony_ci inst->num_lanes); 173162306a36Sopenharmony_ci 173262306a36Sopenharmony_ci /* take out of reset */ 173362306a36Sopenharmony_ci regmap_field_write(cdns_phy->phy_reset_ctrl, 0x1); 173462306a36Sopenharmony_ci} 173562306a36Sopenharmony_ci 173662306a36Sopenharmony_cistatic int cdns_torrent_dp_start(struct cdns_torrent_phy *cdns_phy, 173762306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 173862306a36Sopenharmony_ci struct phy *phy) 173962306a36Sopenharmony_ci{ 174062306a36Sopenharmony_ci int ret; 174162306a36Sopenharmony_ci 174262306a36Sopenharmony_ci ret = cdns_torrent_phy_on(phy); 174362306a36Sopenharmony_ci if (ret) 174462306a36Sopenharmony_ci return ret; 174562306a36Sopenharmony_ci 174662306a36Sopenharmony_ci ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy); 174762306a36Sopenharmony_ci if (ret) 174862306a36Sopenharmony_ci return ret; 174962306a36Sopenharmony_ci 175062306a36Sopenharmony_ci ret = cdns_torrent_dp_run(cdns_phy, inst, inst->num_lanes); 175162306a36Sopenharmony_ci 175262306a36Sopenharmony_ci return ret; 175362306a36Sopenharmony_ci} 175462306a36Sopenharmony_ci 175562306a36Sopenharmony_cistatic int cdns_torrent_dp_init(struct phy *phy) 175662306a36Sopenharmony_ci{ 175762306a36Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 175862306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 175962306a36Sopenharmony_ci int ret; 176062306a36Sopenharmony_ci 176162306a36Sopenharmony_ci switch (cdns_phy->ref_clk_rate) { 176262306a36Sopenharmony_ci case CLK_19_2_MHZ: 176362306a36Sopenharmony_ci case CLK_25_MHZ: 176462306a36Sopenharmony_ci case CLK_100_MHZ: 176562306a36Sopenharmony_ci /* Valid Ref Clock Rate */ 176662306a36Sopenharmony_ci break; 176762306a36Sopenharmony_ci default: 176862306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Unsupported Ref Clock Rate\n"); 176962306a36Sopenharmony_ci return -EINVAL; 177062306a36Sopenharmony_ci } 177162306a36Sopenharmony_ci 177262306a36Sopenharmony_ci ret = cdns_torrent_dp_get_pll(cdns_phy, TYPE_NONE); 177362306a36Sopenharmony_ci if (ret) 177462306a36Sopenharmony_ci return ret; 177562306a36Sopenharmony_ci 177662306a36Sopenharmony_ci cdns_torrent_dp_common_init(cdns_phy, inst); 177762306a36Sopenharmony_ci 177862306a36Sopenharmony_ci return cdns_torrent_dp_start(cdns_phy, inst, phy); 177962306a36Sopenharmony_ci} 178062306a36Sopenharmony_ci 178162306a36Sopenharmony_cistatic int cdns_torrent_dp_multilink_init(struct cdns_torrent_phy *cdns_phy, 178262306a36Sopenharmony_ci struct cdns_torrent_inst *inst, 178362306a36Sopenharmony_ci struct phy *phy) 178462306a36Sopenharmony_ci{ 178562306a36Sopenharmony_ci if (cdns_phy->ref_clk_rate != CLK_100_MHZ) { 178662306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Unsupported Ref Clock Rate\n"); 178762306a36Sopenharmony_ci return -EINVAL; 178862306a36Sopenharmony_ci } 178962306a36Sopenharmony_ci 179062306a36Sopenharmony_ci cdns_torrent_dp_common_init(cdns_phy, inst); 179162306a36Sopenharmony_ci 179262306a36Sopenharmony_ci return cdns_torrent_dp_start(cdns_phy, inst, phy); 179362306a36Sopenharmony_ci} 179462306a36Sopenharmony_ci 179562306a36Sopenharmony_cistatic int cdns_torrent_derived_refclk_enable(struct clk_hw *hw) 179662306a36Sopenharmony_ci{ 179762306a36Sopenharmony_ci struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw); 179862306a36Sopenharmony_ci 179962306a36Sopenharmony_ci regmap_field_write(derived_refclk->cmn_cdiag_refclk_ovrd_4, 1); 180062306a36Sopenharmony_ci regmap_field_write(derived_refclk->phy_pipe_cmn_ctrl1_0, 1); 180162306a36Sopenharmony_ci 180262306a36Sopenharmony_ci return 0; 180362306a36Sopenharmony_ci} 180462306a36Sopenharmony_ci 180562306a36Sopenharmony_cistatic void cdns_torrent_derived_refclk_disable(struct clk_hw *hw) 180662306a36Sopenharmony_ci{ 180762306a36Sopenharmony_ci struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw); 180862306a36Sopenharmony_ci 180962306a36Sopenharmony_ci regmap_field_write(derived_refclk->phy_pipe_cmn_ctrl1_0, 0); 181062306a36Sopenharmony_ci regmap_field_write(derived_refclk->cmn_cdiag_refclk_ovrd_4, 0); 181162306a36Sopenharmony_ci} 181262306a36Sopenharmony_ci 181362306a36Sopenharmony_cistatic int cdns_torrent_derived_refclk_is_enabled(struct clk_hw *hw) 181462306a36Sopenharmony_ci{ 181562306a36Sopenharmony_ci struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw); 181662306a36Sopenharmony_ci int val; 181762306a36Sopenharmony_ci 181862306a36Sopenharmony_ci regmap_field_read(derived_refclk->cmn_cdiag_refclk_ovrd_4, &val); 181962306a36Sopenharmony_ci 182062306a36Sopenharmony_ci return !!val; 182162306a36Sopenharmony_ci} 182262306a36Sopenharmony_ci 182362306a36Sopenharmony_cistatic const struct clk_ops cdns_torrent_derived_refclk_ops = { 182462306a36Sopenharmony_ci .enable = cdns_torrent_derived_refclk_enable, 182562306a36Sopenharmony_ci .disable = cdns_torrent_derived_refclk_disable, 182662306a36Sopenharmony_ci .is_enabled = cdns_torrent_derived_refclk_is_enabled, 182762306a36Sopenharmony_ci}; 182862306a36Sopenharmony_ci 182962306a36Sopenharmony_cistatic int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_phy) 183062306a36Sopenharmony_ci{ 183162306a36Sopenharmony_ci struct cdns_torrent_derived_refclk *derived_refclk; 183262306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 183362306a36Sopenharmony_ci struct clk_init_data *init; 183462306a36Sopenharmony_ci const char *parent_name; 183562306a36Sopenharmony_ci char clk_name[100]; 183662306a36Sopenharmony_ci struct clk_hw *hw; 183762306a36Sopenharmony_ci struct clk *clk; 183862306a36Sopenharmony_ci int ret; 183962306a36Sopenharmony_ci 184062306a36Sopenharmony_ci derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); 184162306a36Sopenharmony_ci if (!derived_refclk) 184262306a36Sopenharmony_ci return -ENOMEM; 184362306a36Sopenharmony_ci 184462306a36Sopenharmony_ci snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), 184562306a36Sopenharmony_ci clk_names[CDNS_TORRENT_DERIVED_REFCLK]); 184662306a36Sopenharmony_ci 184762306a36Sopenharmony_ci clk = devm_clk_get_optional(dev, "phy_en_refclk"); 184862306a36Sopenharmony_ci if (IS_ERR(clk)) { 184962306a36Sopenharmony_ci dev_err(dev, "No parent clock for derived_refclk\n"); 185062306a36Sopenharmony_ci return PTR_ERR(clk); 185162306a36Sopenharmony_ci } 185262306a36Sopenharmony_ci 185362306a36Sopenharmony_ci init = &derived_refclk->clk_data; 185462306a36Sopenharmony_ci 185562306a36Sopenharmony_ci if (clk) { 185662306a36Sopenharmony_ci parent_name = __clk_get_name(clk); 185762306a36Sopenharmony_ci init->parent_names = &parent_name; 185862306a36Sopenharmony_ci init->num_parents = 1; 185962306a36Sopenharmony_ci } 186062306a36Sopenharmony_ci init->ops = &cdns_torrent_derived_refclk_ops; 186162306a36Sopenharmony_ci init->flags = 0; 186262306a36Sopenharmony_ci init->name = clk_name; 186362306a36Sopenharmony_ci 186462306a36Sopenharmony_ci derived_refclk->phy_pipe_cmn_ctrl1_0 = cdns_phy->phy_pipe_cmn_ctrl1_0; 186562306a36Sopenharmony_ci derived_refclk->cmn_cdiag_refclk_ovrd_4 = cdns_phy->cmn_cdiag_refclk_ovrd_4; 186662306a36Sopenharmony_ci 186762306a36Sopenharmony_ci derived_refclk->hw.init = init; 186862306a36Sopenharmony_ci 186962306a36Sopenharmony_ci hw = &derived_refclk->hw; 187062306a36Sopenharmony_ci ret = devm_clk_hw_register(dev, hw); 187162306a36Sopenharmony_ci if (ret) 187262306a36Sopenharmony_ci return ret; 187362306a36Sopenharmony_ci 187462306a36Sopenharmony_ci cdns_phy->clk_hw_data->hws[CDNS_TORRENT_DERIVED_REFCLK] = hw; 187562306a36Sopenharmony_ci 187662306a36Sopenharmony_ci return 0; 187762306a36Sopenharmony_ci} 187862306a36Sopenharmony_ci 187962306a36Sopenharmony_cistatic int cdns_torrent_received_refclk_enable(struct clk_hw *hw) 188062306a36Sopenharmony_ci{ 188162306a36Sopenharmony_ci struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw); 188262306a36Sopenharmony_ci 188362306a36Sopenharmony_ci regmap_field_write(received_refclk->phy_pipe_cmn_ctrl1_0, 1); 188462306a36Sopenharmony_ci 188562306a36Sopenharmony_ci return 0; 188662306a36Sopenharmony_ci} 188762306a36Sopenharmony_ci 188862306a36Sopenharmony_cistatic void cdns_torrent_received_refclk_disable(struct clk_hw *hw) 188962306a36Sopenharmony_ci{ 189062306a36Sopenharmony_ci struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw); 189162306a36Sopenharmony_ci 189262306a36Sopenharmony_ci regmap_field_write(received_refclk->phy_pipe_cmn_ctrl1_0, 0); 189362306a36Sopenharmony_ci} 189462306a36Sopenharmony_ci 189562306a36Sopenharmony_cistatic int cdns_torrent_received_refclk_is_enabled(struct clk_hw *hw) 189662306a36Sopenharmony_ci{ 189762306a36Sopenharmony_ci struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw); 189862306a36Sopenharmony_ci int val, cmn_val; 189962306a36Sopenharmony_ci 190062306a36Sopenharmony_ci regmap_field_read(received_refclk->phy_pipe_cmn_ctrl1_0, &val); 190162306a36Sopenharmony_ci regmap_field_read(received_refclk->cmn_cdiag_refclk_ovrd_4, &cmn_val); 190262306a36Sopenharmony_ci 190362306a36Sopenharmony_ci return val && !cmn_val; 190462306a36Sopenharmony_ci} 190562306a36Sopenharmony_ci 190662306a36Sopenharmony_cistatic const struct clk_ops cdns_torrent_received_refclk_ops = { 190762306a36Sopenharmony_ci .enable = cdns_torrent_received_refclk_enable, 190862306a36Sopenharmony_ci .disable = cdns_torrent_received_refclk_disable, 190962306a36Sopenharmony_ci .is_enabled = cdns_torrent_received_refclk_is_enabled, 191062306a36Sopenharmony_ci}; 191162306a36Sopenharmony_ci 191262306a36Sopenharmony_cistatic int cdns_torrent_received_refclk_register(struct cdns_torrent_phy *cdns_phy) 191362306a36Sopenharmony_ci{ 191462306a36Sopenharmony_ci struct cdns_torrent_received_refclk *received_refclk; 191562306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 191662306a36Sopenharmony_ci struct clk_init_data *init; 191762306a36Sopenharmony_ci const char *parent_name; 191862306a36Sopenharmony_ci char clk_name[100]; 191962306a36Sopenharmony_ci struct clk_hw *hw; 192062306a36Sopenharmony_ci struct clk *clk; 192162306a36Sopenharmony_ci int ret; 192262306a36Sopenharmony_ci 192362306a36Sopenharmony_ci received_refclk = devm_kzalloc(dev, sizeof(*received_refclk), GFP_KERNEL); 192462306a36Sopenharmony_ci if (!received_refclk) 192562306a36Sopenharmony_ci return -ENOMEM; 192662306a36Sopenharmony_ci 192762306a36Sopenharmony_ci snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), 192862306a36Sopenharmony_ci clk_names[CDNS_TORRENT_RECEIVED_REFCLK]); 192962306a36Sopenharmony_ci 193062306a36Sopenharmony_ci clk = devm_clk_get_optional(dev, "phy_en_refclk"); 193162306a36Sopenharmony_ci if (IS_ERR(clk)) { 193262306a36Sopenharmony_ci dev_err(dev, "No parent clock for received_refclk\n"); 193362306a36Sopenharmony_ci return PTR_ERR(clk); 193462306a36Sopenharmony_ci } 193562306a36Sopenharmony_ci 193662306a36Sopenharmony_ci init = &received_refclk->clk_data; 193762306a36Sopenharmony_ci 193862306a36Sopenharmony_ci if (clk) { 193962306a36Sopenharmony_ci parent_name = __clk_get_name(clk); 194062306a36Sopenharmony_ci init->parent_names = &parent_name; 194162306a36Sopenharmony_ci init->num_parents = 1; 194262306a36Sopenharmony_ci } 194362306a36Sopenharmony_ci init->ops = &cdns_torrent_received_refclk_ops; 194462306a36Sopenharmony_ci init->flags = 0; 194562306a36Sopenharmony_ci init->name = clk_name; 194662306a36Sopenharmony_ci 194762306a36Sopenharmony_ci received_refclk->phy_pipe_cmn_ctrl1_0 = cdns_phy->phy_pipe_cmn_ctrl1_0; 194862306a36Sopenharmony_ci received_refclk->cmn_cdiag_refclk_ovrd_4 = cdns_phy->cmn_cdiag_refclk_ovrd_4; 194962306a36Sopenharmony_ci 195062306a36Sopenharmony_ci received_refclk->hw.init = init; 195162306a36Sopenharmony_ci 195262306a36Sopenharmony_ci hw = &received_refclk->hw; 195362306a36Sopenharmony_ci ret = devm_clk_hw_register(dev, hw); 195462306a36Sopenharmony_ci if (ret) 195562306a36Sopenharmony_ci return ret; 195662306a36Sopenharmony_ci 195762306a36Sopenharmony_ci cdns_phy->clk_hw_data->hws[CDNS_TORRENT_RECEIVED_REFCLK] = hw; 195862306a36Sopenharmony_ci 195962306a36Sopenharmony_ci return 0; 196062306a36Sopenharmony_ci} 196162306a36Sopenharmony_ci 196262306a36Sopenharmony_cistatic int cdns_torrent_refclk_driver_enable(struct clk_hw *hw) 196362306a36Sopenharmony_ci{ 196462306a36Sopenharmony_ci struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); 196562306a36Sopenharmony_ci 196662306a36Sopenharmony_ci regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_6], 0); 196762306a36Sopenharmony_ci regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_5], 1); 196862306a36Sopenharmony_ci regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 0); 196962306a36Sopenharmony_ci 197062306a36Sopenharmony_ci return 0; 197162306a36Sopenharmony_ci} 197262306a36Sopenharmony_ci 197362306a36Sopenharmony_cistatic void cdns_torrent_refclk_driver_disable(struct clk_hw *hw) 197462306a36Sopenharmony_ci{ 197562306a36Sopenharmony_ci struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); 197662306a36Sopenharmony_ci 197762306a36Sopenharmony_ci regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 1); 197862306a36Sopenharmony_ci} 197962306a36Sopenharmony_ci 198062306a36Sopenharmony_cistatic int cdns_torrent_refclk_driver_is_enabled(struct clk_hw *hw) 198162306a36Sopenharmony_ci{ 198262306a36Sopenharmony_ci struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); 198362306a36Sopenharmony_ci int val; 198462306a36Sopenharmony_ci 198562306a36Sopenharmony_ci regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], &val); 198662306a36Sopenharmony_ci 198762306a36Sopenharmony_ci return !val; 198862306a36Sopenharmony_ci} 198962306a36Sopenharmony_ci 199062306a36Sopenharmony_cistatic u8 cdns_torrent_refclk_driver_get_parent(struct clk_hw *hw) 199162306a36Sopenharmony_ci{ 199262306a36Sopenharmony_ci struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); 199362306a36Sopenharmony_ci unsigned int val; 199462306a36Sopenharmony_ci 199562306a36Sopenharmony_ci regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], &val); 199662306a36Sopenharmony_ci return clk_mux_val_to_index(hw, cdns_torrent_refclk_driver_mux_table, 0, val); 199762306a36Sopenharmony_ci} 199862306a36Sopenharmony_ci 199962306a36Sopenharmony_cistatic int cdns_torrent_refclk_driver_set_parent(struct clk_hw *hw, u8 index) 200062306a36Sopenharmony_ci{ 200162306a36Sopenharmony_ci struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); 200262306a36Sopenharmony_ci unsigned int val; 200362306a36Sopenharmony_ci 200462306a36Sopenharmony_ci val = cdns_torrent_refclk_driver_mux_table[index]; 200562306a36Sopenharmony_ci return regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], val); 200662306a36Sopenharmony_ci} 200762306a36Sopenharmony_ci 200862306a36Sopenharmony_cistatic const struct clk_ops cdns_torrent_refclk_driver_ops = { 200962306a36Sopenharmony_ci .enable = cdns_torrent_refclk_driver_enable, 201062306a36Sopenharmony_ci .disable = cdns_torrent_refclk_driver_disable, 201162306a36Sopenharmony_ci .is_enabled = cdns_torrent_refclk_driver_is_enabled, 201262306a36Sopenharmony_ci .determine_rate = __clk_mux_determine_rate, 201362306a36Sopenharmony_ci .set_parent = cdns_torrent_refclk_driver_set_parent, 201462306a36Sopenharmony_ci .get_parent = cdns_torrent_refclk_driver_get_parent, 201562306a36Sopenharmony_ci}; 201662306a36Sopenharmony_ci 201762306a36Sopenharmony_cistatic int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy) 201862306a36Sopenharmony_ci{ 201962306a36Sopenharmony_ci struct cdns_torrent_refclk_driver *refclk_driver; 202062306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 202162306a36Sopenharmony_ci struct regmap_field *field; 202262306a36Sopenharmony_ci struct clk_init_data *init; 202362306a36Sopenharmony_ci const char **parent_names; 202462306a36Sopenharmony_ci unsigned int num_parents; 202562306a36Sopenharmony_ci struct regmap *regmap; 202662306a36Sopenharmony_ci char clk_name[100]; 202762306a36Sopenharmony_ci struct clk_hw *hw; 202862306a36Sopenharmony_ci int i, ret; 202962306a36Sopenharmony_ci 203062306a36Sopenharmony_ci refclk_driver = devm_kzalloc(dev, sizeof(*refclk_driver), GFP_KERNEL); 203162306a36Sopenharmony_ci if (!refclk_driver) 203262306a36Sopenharmony_ci return -ENOMEM; 203362306a36Sopenharmony_ci 203462306a36Sopenharmony_ci num_parents = ARRAY_SIZE(refclk_driver_parent_index); 203562306a36Sopenharmony_ci parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL); 203662306a36Sopenharmony_ci if (!parent_names) 203762306a36Sopenharmony_ci return -ENOMEM; 203862306a36Sopenharmony_ci 203962306a36Sopenharmony_ci for (i = 0; i < num_parents; i++) { 204062306a36Sopenharmony_ci hw = cdns_phy->clk_hw_data->hws[refclk_driver_parent_index[i]]; 204162306a36Sopenharmony_ci if (IS_ERR_OR_NULL(hw)) { 204262306a36Sopenharmony_ci dev_err(dev, "No parent clock for refclk driver clock\n"); 204362306a36Sopenharmony_ci return IS_ERR(hw) ? PTR_ERR(hw) : -ENOENT; 204462306a36Sopenharmony_ci } 204562306a36Sopenharmony_ci parent_names[i] = clk_hw_get_name(hw); 204662306a36Sopenharmony_ci } 204762306a36Sopenharmony_ci 204862306a36Sopenharmony_ci snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), 204962306a36Sopenharmony_ci clk_names[CDNS_TORRENT_REFCLK_DRIVER]); 205062306a36Sopenharmony_ci 205162306a36Sopenharmony_ci init = &refclk_driver->clk_data; 205262306a36Sopenharmony_ci 205362306a36Sopenharmony_ci init->ops = &cdns_torrent_refclk_driver_ops; 205462306a36Sopenharmony_ci init->flags = CLK_SET_RATE_NO_REPARENT; 205562306a36Sopenharmony_ci init->parent_names = parent_names; 205662306a36Sopenharmony_ci init->num_parents = num_parents; 205762306a36Sopenharmony_ci init->name = clk_name; 205862306a36Sopenharmony_ci 205962306a36Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 206062306a36Sopenharmony_ci 206162306a36Sopenharmony_ci for (i = 0; i < REFCLK_OUT_NUM_CMN_CONFIG; i++) { 206262306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, refclk_out_cmn_cfg[i]); 206362306a36Sopenharmony_ci if (IS_ERR(field)) { 206462306a36Sopenharmony_ci dev_err(dev, "Refclk driver CMN reg field init failed\n"); 206562306a36Sopenharmony_ci return PTR_ERR(field); 206662306a36Sopenharmony_ci } 206762306a36Sopenharmony_ci refclk_driver->cmn_fields[i] = field; 206862306a36Sopenharmony_ci } 206962306a36Sopenharmony_ci 207062306a36Sopenharmony_ci /* Enable Derived reference clock as default */ 207162306a36Sopenharmony_ci regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], 1); 207262306a36Sopenharmony_ci 207362306a36Sopenharmony_ci refclk_driver->hw.init = init; 207462306a36Sopenharmony_ci 207562306a36Sopenharmony_ci hw = &refclk_driver->hw; 207662306a36Sopenharmony_ci ret = devm_clk_hw_register(dev, hw); 207762306a36Sopenharmony_ci if (ret) 207862306a36Sopenharmony_ci return ret; 207962306a36Sopenharmony_ci 208062306a36Sopenharmony_ci cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER] = hw; 208162306a36Sopenharmony_ci 208262306a36Sopenharmony_ci return 0; 208362306a36Sopenharmony_ci} 208462306a36Sopenharmony_ci 208562306a36Sopenharmony_cistatic struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, 208662306a36Sopenharmony_ci u32 block_offset, 208762306a36Sopenharmony_ci u8 reg_offset_shift, 208862306a36Sopenharmony_ci const struct regmap_config *config) 208962306a36Sopenharmony_ci{ 209062306a36Sopenharmony_ci struct cdns_regmap_cdb_context *ctx; 209162306a36Sopenharmony_ci 209262306a36Sopenharmony_ci ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 209362306a36Sopenharmony_ci if (!ctx) 209462306a36Sopenharmony_ci return ERR_PTR(-ENOMEM); 209562306a36Sopenharmony_ci 209662306a36Sopenharmony_ci ctx->dev = dev; 209762306a36Sopenharmony_ci ctx->base = base + block_offset; 209862306a36Sopenharmony_ci ctx->reg_offset_shift = reg_offset_shift; 209962306a36Sopenharmony_ci 210062306a36Sopenharmony_ci return devm_regmap_init(dev, NULL, ctx, config); 210162306a36Sopenharmony_ci} 210262306a36Sopenharmony_ci 210362306a36Sopenharmony_cistatic int cdns_torrent_dp_regfield_init(struct cdns_torrent_phy *cdns_phy) 210462306a36Sopenharmony_ci{ 210562306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 210662306a36Sopenharmony_ci struct regmap_field *field; 210762306a36Sopenharmony_ci struct regmap *regmap; 210862306a36Sopenharmony_ci 210962306a36Sopenharmony_ci regmap = cdns_phy->regmap_dptx_phy_reg; 211062306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_reset_ctrl); 211162306a36Sopenharmony_ci if (IS_ERR(field)) { 211262306a36Sopenharmony_ci dev_err(dev, "PHY_RESET reg field init failed\n"); 211362306a36Sopenharmony_ci return PTR_ERR(field); 211462306a36Sopenharmony_ci } 211562306a36Sopenharmony_ci cdns_phy->phy_reset_ctrl = field; 211662306a36Sopenharmony_ci 211762306a36Sopenharmony_ci return 0; 211862306a36Sopenharmony_ci} 211962306a36Sopenharmony_ci 212062306a36Sopenharmony_cistatic int cdns_torrent_regfield_init(struct cdns_torrent_phy *cdns_phy) 212162306a36Sopenharmony_ci{ 212262306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 212362306a36Sopenharmony_ci struct regmap_field *field; 212462306a36Sopenharmony_ci struct regmap *regmap; 212562306a36Sopenharmony_ci int i; 212662306a36Sopenharmony_ci 212762306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 212862306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg); 212962306a36Sopenharmony_ci if (IS_ERR(field)) { 213062306a36Sopenharmony_ci dev_err(dev, "PHY_PLL_CFG reg field init failed\n"); 213162306a36Sopenharmony_ci return PTR_ERR(field); 213262306a36Sopenharmony_ci } 213362306a36Sopenharmony_ci cdns_phy->phy_pll_cfg = field; 213462306a36Sopenharmony_ci 213562306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 213662306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pipe_cmn_ctrl1_0); 213762306a36Sopenharmony_ci if (IS_ERR(field)) { 213862306a36Sopenharmony_ci dev_err(dev, "phy_pipe_cmn_ctrl1_0 reg field init failed\n"); 213962306a36Sopenharmony_ci return PTR_ERR(field); 214062306a36Sopenharmony_ci } 214162306a36Sopenharmony_ci cdns_phy->phy_pipe_cmn_ctrl1_0 = field; 214262306a36Sopenharmony_ci 214362306a36Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 214462306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, cmn_cdiag_refclk_ovrd_4); 214562306a36Sopenharmony_ci if (IS_ERR(field)) { 214662306a36Sopenharmony_ci dev_err(dev, "cmn_cdiag_refclk_ovrd_4 reg field init failed\n"); 214762306a36Sopenharmony_ci return PTR_ERR(field); 214862306a36Sopenharmony_ci } 214962306a36Sopenharmony_ci cdns_phy->cmn_cdiag_refclk_ovrd_4 = field; 215062306a36Sopenharmony_ci 215162306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 215262306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_1); 215362306a36Sopenharmony_ci if (IS_ERR(field)) { 215462306a36Sopenharmony_ci dev_err(dev, "PHY_PMA_CMN_CTRL1 reg field init failed\n"); 215562306a36Sopenharmony_ci return PTR_ERR(field); 215662306a36Sopenharmony_ci } 215762306a36Sopenharmony_ci cdns_phy->phy_pma_cmn_ctrl_1 = field; 215862306a36Sopenharmony_ci 215962306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 216062306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_2); 216162306a36Sopenharmony_ci if (IS_ERR(field)) { 216262306a36Sopenharmony_ci dev_err(dev, "PHY_PMA_CMN_CTRL2 reg field init failed\n"); 216362306a36Sopenharmony_ci return PTR_ERR(field); 216462306a36Sopenharmony_ci } 216562306a36Sopenharmony_ci cdns_phy->phy_pma_cmn_ctrl_2 = field; 216662306a36Sopenharmony_ci 216762306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 216862306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pma_pll_raw_ctrl); 216962306a36Sopenharmony_ci if (IS_ERR(field)) { 217062306a36Sopenharmony_ci dev_err(dev, "PHY_PMA_PLL_RAW_CTRL reg field init failed\n"); 217162306a36Sopenharmony_ci return PTR_ERR(field); 217262306a36Sopenharmony_ci } 217362306a36Sopenharmony_ci cdns_phy->phy_pma_pll_raw_ctrl = field; 217462306a36Sopenharmony_ci 217562306a36Sopenharmony_ci for (i = 0; i < MAX_NUM_LANES; i++) { 217662306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_lane_cdb[i]; 217762306a36Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pcs_iso_link_ctrl_1); 217862306a36Sopenharmony_ci if (IS_ERR(field)) { 217962306a36Sopenharmony_ci dev_err(dev, "PHY_PCS_ISO_LINK_CTRL reg field init for ln %d failed\n", i); 218062306a36Sopenharmony_ci return PTR_ERR(field); 218162306a36Sopenharmony_ci } 218262306a36Sopenharmony_ci cdns_phy->phy_pcs_iso_link_ctrl_1[i] = field; 218362306a36Sopenharmony_ci } 218462306a36Sopenharmony_ci 218562306a36Sopenharmony_ci return 0; 218662306a36Sopenharmony_ci} 218762306a36Sopenharmony_ci 218862306a36Sopenharmony_cistatic int cdns_torrent_dp_regmap_init(struct cdns_torrent_phy *cdns_phy) 218962306a36Sopenharmony_ci{ 219062306a36Sopenharmony_ci void __iomem *base = cdns_phy->base; 219162306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 219262306a36Sopenharmony_ci struct regmap *regmap; 219362306a36Sopenharmony_ci u8 reg_offset_shift; 219462306a36Sopenharmony_ci u32 block_offset; 219562306a36Sopenharmony_ci 219662306a36Sopenharmony_ci reg_offset_shift = cdns_phy->init_data->reg_offset_shift; 219762306a36Sopenharmony_ci 219862306a36Sopenharmony_ci block_offset = TORRENT_DPTX_PHY_OFFSET; 219962306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, 220062306a36Sopenharmony_ci reg_offset_shift, 220162306a36Sopenharmony_ci &cdns_torrent_dptx_phy_config); 220262306a36Sopenharmony_ci if (IS_ERR(regmap)) { 220362306a36Sopenharmony_ci dev_err(dev, "Failed to init DPTX PHY regmap\n"); 220462306a36Sopenharmony_ci return PTR_ERR(regmap); 220562306a36Sopenharmony_ci } 220662306a36Sopenharmony_ci cdns_phy->regmap_dptx_phy_reg = regmap; 220762306a36Sopenharmony_ci 220862306a36Sopenharmony_ci return 0; 220962306a36Sopenharmony_ci} 221062306a36Sopenharmony_ci 221162306a36Sopenharmony_cistatic int cdns_torrent_regmap_init(struct cdns_torrent_phy *cdns_phy) 221262306a36Sopenharmony_ci{ 221362306a36Sopenharmony_ci void __iomem *sd_base = cdns_phy->sd_base; 221462306a36Sopenharmony_ci u8 block_offset_shift, reg_offset_shift; 221562306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 221662306a36Sopenharmony_ci struct regmap *regmap; 221762306a36Sopenharmony_ci u32 block_offset; 221862306a36Sopenharmony_ci int i; 221962306a36Sopenharmony_ci 222062306a36Sopenharmony_ci block_offset_shift = cdns_phy->init_data->block_offset_shift; 222162306a36Sopenharmony_ci reg_offset_shift = cdns_phy->init_data->reg_offset_shift; 222262306a36Sopenharmony_ci 222362306a36Sopenharmony_ci for (i = 0; i < MAX_NUM_LANES; i++) { 222462306a36Sopenharmony_ci block_offset = TORRENT_TX_LANE_CDB_OFFSET(i, block_offset_shift, 222562306a36Sopenharmony_ci reg_offset_shift); 222662306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 222762306a36Sopenharmony_ci reg_offset_shift, 222862306a36Sopenharmony_ci &cdns_torrent_tx_lane_cdb_config[i]); 222962306a36Sopenharmony_ci if (IS_ERR(regmap)) { 223062306a36Sopenharmony_ci dev_err(dev, "Failed to init tx lane CDB regmap\n"); 223162306a36Sopenharmony_ci return PTR_ERR(regmap); 223262306a36Sopenharmony_ci } 223362306a36Sopenharmony_ci cdns_phy->regmap_tx_lane_cdb[i] = regmap; 223462306a36Sopenharmony_ci 223562306a36Sopenharmony_ci block_offset = TORRENT_RX_LANE_CDB_OFFSET(i, block_offset_shift, 223662306a36Sopenharmony_ci reg_offset_shift); 223762306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 223862306a36Sopenharmony_ci reg_offset_shift, 223962306a36Sopenharmony_ci &cdns_torrent_rx_lane_cdb_config[i]); 224062306a36Sopenharmony_ci if (IS_ERR(regmap)) { 224162306a36Sopenharmony_ci dev_err(dev, "Failed to init rx lane CDB regmap\n"); 224262306a36Sopenharmony_ci return PTR_ERR(regmap); 224362306a36Sopenharmony_ci } 224462306a36Sopenharmony_ci cdns_phy->regmap_rx_lane_cdb[i] = regmap; 224562306a36Sopenharmony_ci 224662306a36Sopenharmony_ci block_offset = TORRENT_PHY_PCS_LANE_CDB_OFFSET(i, block_offset_shift, 224762306a36Sopenharmony_ci reg_offset_shift); 224862306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 224962306a36Sopenharmony_ci reg_offset_shift, 225062306a36Sopenharmony_ci &cdns_torrent_phy_pcs_lane_cdb_config[i]); 225162306a36Sopenharmony_ci if (IS_ERR(regmap)) { 225262306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PCS lane CDB regmap\n"); 225362306a36Sopenharmony_ci return PTR_ERR(regmap); 225462306a36Sopenharmony_ci } 225562306a36Sopenharmony_ci cdns_phy->regmap_phy_pcs_lane_cdb[i] = regmap; 225662306a36Sopenharmony_ci } 225762306a36Sopenharmony_ci 225862306a36Sopenharmony_ci block_offset = TORRENT_COMMON_CDB_OFFSET; 225962306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 226062306a36Sopenharmony_ci reg_offset_shift, 226162306a36Sopenharmony_ci &cdns_torrent_common_cdb_config); 226262306a36Sopenharmony_ci if (IS_ERR(regmap)) { 226362306a36Sopenharmony_ci dev_err(dev, "Failed to init common CDB regmap\n"); 226462306a36Sopenharmony_ci return PTR_ERR(regmap); 226562306a36Sopenharmony_ci } 226662306a36Sopenharmony_ci cdns_phy->regmap_common_cdb = regmap; 226762306a36Sopenharmony_ci 226862306a36Sopenharmony_ci block_offset = TORRENT_PHY_PCS_COMMON_OFFSET(block_offset_shift); 226962306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 227062306a36Sopenharmony_ci reg_offset_shift, 227162306a36Sopenharmony_ci &cdns_torrent_phy_pcs_cmn_cdb_config); 227262306a36Sopenharmony_ci if (IS_ERR(regmap)) { 227362306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PCS common CDB regmap\n"); 227462306a36Sopenharmony_ci return PTR_ERR(regmap); 227562306a36Sopenharmony_ci } 227662306a36Sopenharmony_ci cdns_phy->regmap_phy_pcs_common_cdb = regmap; 227762306a36Sopenharmony_ci 227862306a36Sopenharmony_ci block_offset = TORRENT_PHY_PMA_COMMON_OFFSET(block_offset_shift); 227962306a36Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 228062306a36Sopenharmony_ci reg_offset_shift, 228162306a36Sopenharmony_ci &cdns_torrent_phy_pma_cmn_cdb_config); 228262306a36Sopenharmony_ci if (IS_ERR(regmap)) { 228362306a36Sopenharmony_ci dev_err(dev, "Failed to init PHY PMA common CDB regmap\n"); 228462306a36Sopenharmony_ci return PTR_ERR(regmap); 228562306a36Sopenharmony_ci } 228662306a36Sopenharmony_ci cdns_phy->regmap_phy_pma_common_cdb = regmap; 228762306a36Sopenharmony_ci 228862306a36Sopenharmony_ci return 0; 228962306a36Sopenharmony_ci} 229062306a36Sopenharmony_ci 229162306a36Sopenharmony_cistatic int cdns_torrent_phy_init(struct phy *phy) 229262306a36Sopenharmony_ci{ 229362306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 229462306a36Sopenharmony_ci const struct cdns_torrent_data *init_data = cdns_phy->init_data; 229562306a36Sopenharmony_ci struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals; 229662306a36Sopenharmony_ci enum cdns_torrent_ref_clk ref_clk = cdns_phy->ref_clk_rate; 229762306a36Sopenharmony_ci struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals; 229862306a36Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 229962306a36Sopenharmony_ci enum cdns_torrent_phy_type phy_type = inst->phy_type; 230062306a36Sopenharmony_ci enum cdns_torrent_ssc_mode ssc = inst->ssc_mode; 230162306a36Sopenharmony_ci struct cdns_torrent_vals *phy_pma_cmn_vals; 230262306a36Sopenharmony_ci struct cdns_torrent_vals *pcs_cmn_vals; 230362306a36Sopenharmony_ci struct cdns_reg_pairs *reg_pairs; 230462306a36Sopenharmony_ci struct regmap *regmap; 230562306a36Sopenharmony_ci u32 num_regs; 230662306a36Sopenharmony_ci int i, j; 230762306a36Sopenharmony_ci 230862306a36Sopenharmony_ci if (cdns_phy->nsubnodes > 1) { 230962306a36Sopenharmony_ci if (phy_type == TYPE_DP) 231062306a36Sopenharmony_ci return cdns_torrent_dp_multilink_init(cdns_phy, inst, phy); 231162306a36Sopenharmony_ci return 0; 231262306a36Sopenharmony_ci } 231362306a36Sopenharmony_ci 231462306a36Sopenharmony_ci /** 231562306a36Sopenharmony_ci * Spread spectrum generation is not required or supported 231662306a36Sopenharmony_ci * for SGMII/QSGMII/USXGMII 231762306a36Sopenharmony_ci */ 231862306a36Sopenharmony_ci if (phy_type == TYPE_SGMII || phy_type == TYPE_QSGMII || phy_type == TYPE_USXGMII) 231962306a36Sopenharmony_ci ssc = NO_SSC; 232062306a36Sopenharmony_ci 232162306a36Sopenharmony_ci /* PHY configuration specific registers for single link */ 232262306a36Sopenharmony_ci link_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->link_cmn_vals_tbl, 232362306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 232462306a36Sopenharmony_ci phy_type, TYPE_NONE, 232562306a36Sopenharmony_ci ANY_SSC); 232662306a36Sopenharmony_ci if (link_cmn_vals) { 232762306a36Sopenharmony_ci reg_pairs = link_cmn_vals->reg_pairs; 232862306a36Sopenharmony_ci num_regs = link_cmn_vals->num_regs; 232962306a36Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 233062306a36Sopenharmony_ci 233162306a36Sopenharmony_ci /** 233262306a36Sopenharmony_ci * First array value in link_cmn_vals must be of 233362306a36Sopenharmony_ci * PHY_PLL_CFG register 233462306a36Sopenharmony_ci */ 233562306a36Sopenharmony_ci regmap_field_write(cdns_phy->phy_pll_cfg, reg_pairs[0].val); 233662306a36Sopenharmony_ci 233762306a36Sopenharmony_ci for (i = 1; i < num_regs; i++) 233862306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 233962306a36Sopenharmony_ci reg_pairs[i].val); 234062306a36Sopenharmony_ci } 234162306a36Sopenharmony_ci 234262306a36Sopenharmony_ci xcvr_diag_vals = cdns_torrent_get_tbl_vals(&init_data->xcvr_diag_vals_tbl, 234362306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 234462306a36Sopenharmony_ci phy_type, TYPE_NONE, 234562306a36Sopenharmony_ci ANY_SSC); 234662306a36Sopenharmony_ci if (xcvr_diag_vals) { 234762306a36Sopenharmony_ci reg_pairs = xcvr_diag_vals->reg_pairs; 234862306a36Sopenharmony_ci num_regs = xcvr_diag_vals->num_regs; 234962306a36Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) { 235062306a36Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane]; 235162306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 235262306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 235362306a36Sopenharmony_ci reg_pairs[j].val); 235462306a36Sopenharmony_ci } 235562306a36Sopenharmony_ci } 235662306a36Sopenharmony_ci 235762306a36Sopenharmony_ci /* PHY PCS common registers configurations */ 235862306a36Sopenharmony_ci pcs_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->pcs_cmn_vals_tbl, 235962306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 236062306a36Sopenharmony_ci phy_type, TYPE_NONE, 236162306a36Sopenharmony_ci ANY_SSC); 236262306a36Sopenharmony_ci if (pcs_cmn_vals) { 236362306a36Sopenharmony_ci reg_pairs = pcs_cmn_vals->reg_pairs; 236462306a36Sopenharmony_ci num_regs = pcs_cmn_vals->num_regs; 236562306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 236662306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 236762306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 236862306a36Sopenharmony_ci reg_pairs[i].val); 236962306a36Sopenharmony_ci } 237062306a36Sopenharmony_ci 237162306a36Sopenharmony_ci /* PHY PMA common registers configurations */ 237262306a36Sopenharmony_ci phy_pma_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->phy_pma_cmn_vals_tbl, 237362306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 237462306a36Sopenharmony_ci phy_type, TYPE_NONE, 237562306a36Sopenharmony_ci ANY_SSC); 237662306a36Sopenharmony_ci if (phy_pma_cmn_vals) { 237762306a36Sopenharmony_ci reg_pairs = phy_pma_cmn_vals->reg_pairs; 237862306a36Sopenharmony_ci num_regs = phy_pma_cmn_vals->num_regs; 237962306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 238062306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 238162306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 238262306a36Sopenharmony_ci reg_pairs[i].val); 238362306a36Sopenharmony_ci } 238462306a36Sopenharmony_ci 238562306a36Sopenharmony_ci /* PMA common registers configurations */ 238662306a36Sopenharmony_ci cmn_vals = cdns_torrent_get_tbl_vals(&init_data->cmn_vals_tbl, 238762306a36Sopenharmony_ci ref_clk, ref_clk, 238862306a36Sopenharmony_ci phy_type, TYPE_NONE, 238962306a36Sopenharmony_ci ssc); 239062306a36Sopenharmony_ci if (cmn_vals) { 239162306a36Sopenharmony_ci reg_pairs = cmn_vals->reg_pairs; 239262306a36Sopenharmony_ci num_regs = cmn_vals->num_regs; 239362306a36Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 239462306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 239562306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 239662306a36Sopenharmony_ci reg_pairs[i].val); 239762306a36Sopenharmony_ci } 239862306a36Sopenharmony_ci 239962306a36Sopenharmony_ci /* PMA TX lane registers configurations */ 240062306a36Sopenharmony_ci tx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->tx_ln_vals_tbl, 240162306a36Sopenharmony_ci ref_clk, ref_clk, 240262306a36Sopenharmony_ci phy_type, TYPE_NONE, 240362306a36Sopenharmony_ci ssc); 240462306a36Sopenharmony_ci if (tx_ln_vals) { 240562306a36Sopenharmony_ci reg_pairs = tx_ln_vals->reg_pairs; 240662306a36Sopenharmony_ci num_regs = tx_ln_vals->num_regs; 240762306a36Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) { 240862306a36Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane]; 240962306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 241062306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 241162306a36Sopenharmony_ci reg_pairs[j].val); 241262306a36Sopenharmony_ci } 241362306a36Sopenharmony_ci } 241462306a36Sopenharmony_ci 241562306a36Sopenharmony_ci /* PMA RX lane registers configurations */ 241662306a36Sopenharmony_ci rx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->rx_ln_vals_tbl, 241762306a36Sopenharmony_ci ref_clk, ref_clk, 241862306a36Sopenharmony_ci phy_type, TYPE_NONE, 241962306a36Sopenharmony_ci ssc); 242062306a36Sopenharmony_ci if (rx_ln_vals) { 242162306a36Sopenharmony_ci reg_pairs = rx_ln_vals->reg_pairs; 242262306a36Sopenharmony_ci num_regs = rx_ln_vals->num_regs; 242362306a36Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) { 242462306a36Sopenharmony_ci regmap = cdns_phy->regmap_rx_lane_cdb[i + inst->mlane]; 242562306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 242662306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 242762306a36Sopenharmony_ci reg_pairs[j].val); 242862306a36Sopenharmony_ci } 242962306a36Sopenharmony_ci } 243062306a36Sopenharmony_ci 243162306a36Sopenharmony_ci if (phy_type == TYPE_DP) 243262306a36Sopenharmony_ci return cdns_torrent_dp_init(phy); 243362306a36Sopenharmony_ci 243462306a36Sopenharmony_ci return 0; 243562306a36Sopenharmony_ci} 243662306a36Sopenharmony_ci 243762306a36Sopenharmony_cistatic const struct phy_ops cdns_torrent_phy_ops = { 243862306a36Sopenharmony_ci .init = cdns_torrent_phy_init, 243962306a36Sopenharmony_ci .configure = cdns_torrent_dp_configure, 244062306a36Sopenharmony_ci .power_on = cdns_torrent_phy_on, 244162306a36Sopenharmony_ci .power_off = cdns_torrent_phy_off, 244262306a36Sopenharmony_ci .owner = THIS_MODULE, 244362306a36Sopenharmony_ci}; 244462306a36Sopenharmony_ci 244562306a36Sopenharmony_cistatic int cdns_torrent_noop_phy_on(struct phy *phy) 244662306a36Sopenharmony_ci{ 244762306a36Sopenharmony_ci /* Give 5ms to 10ms delay for the PIPE clock to be stable */ 244862306a36Sopenharmony_ci usleep_range(5000, 10000); 244962306a36Sopenharmony_ci 245062306a36Sopenharmony_ci return 0; 245162306a36Sopenharmony_ci} 245262306a36Sopenharmony_ci 245362306a36Sopenharmony_cistatic const struct phy_ops noop_ops = { 245462306a36Sopenharmony_ci .power_on = cdns_torrent_noop_phy_on, 245562306a36Sopenharmony_ci .owner = THIS_MODULE, 245662306a36Sopenharmony_ci}; 245762306a36Sopenharmony_ci 245862306a36Sopenharmony_cistatic 245962306a36Sopenharmony_ciint cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) 246062306a36Sopenharmony_ci{ 246162306a36Sopenharmony_ci const struct cdns_torrent_data *init_data = cdns_phy->init_data; 246262306a36Sopenharmony_ci struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals; 246362306a36Sopenharmony_ci enum cdns_torrent_ref_clk ref_clk = cdns_phy->ref_clk_rate; 246462306a36Sopenharmony_ci struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals; 246562306a36Sopenharmony_ci enum cdns_torrent_phy_type phy_t1, phy_t2; 246662306a36Sopenharmony_ci struct cdns_torrent_vals *pcs_cmn_vals; 246762306a36Sopenharmony_ci int i, j, node, mlane, num_lanes, ret; 246862306a36Sopenharmony_ci struct cdns_reg_pairs *reg_pairs; 246962306a36Sopenharmony_ci enum cdns_torrent_ssc_mode ssc; 247062306a36Sopenharmony_ci struct regmap *regmap; 247162306a36Sopenharmony_ci u32 num_regs; 247262306a36Sopenharmony_ci 247362306a36Sopenharmony_ci /* Maximum 2 links (subnodes) are supported */ 247462306a36Sopenharmony_ci if (cdns_phy->nsubnodes != 2) 247562306a36Sopenharmony_ci return -EINVAL; 247662306a36Sopenharmony_ci 247762306a36Sopenharmony_ci phy_t1 = cdns_phy->phys[0].phy_type; 247862306a36Sopenharmony_ci phy_t2 = cdns_phy->phys[1].phy_type; 247962306a36Sopenharmony_ci 248062306a36Sopenharmony_ci /** 248162306a36Sopenharmony_ci * First configure the PHY for first link with phy_t1. Get the array 248262306a36Sopenharmony_ci * values as [phy_t1][phy_t2][ssc]. 248362306a36Sopenharmony_ci */ 248462306a36Sopenharmony_ci for (node = 0; node < cdns_phy->nsubnodes; node++) { 248562306a36Sopenharmony_ci if (node == 1) { 248662306a36Sopenharmony_ci /** 248762306a36Sopenharmony_ci * If first link with phy_t1 is configured, then 248862306a36Sopenharmony_ci * configure the PHY for second link with phy_t2. 248962306a36Sopenharmony_ci * Get the array values as [phy_t2][phy_t1][ssc]. 249062306a36Sopenharmony_ci */ 249162306a36Sopenharmony_ci swap(phy_t1, phy_t2); 249262306a36Sopenharmony_ci } 249362306a36Sopenharmony_ci 249462306a36Sopenharmony_ci mlane = cdns_phy->phys[node].mlane; 249562306a36Sopenharmony_ci ssc = cdns_phy->phys[node].ssc_mode; 249662306a36Sopenharmony_ci num_lanes = cdns_phy->phys[node].num_lanes; 249762306a36Sopenharmony_ci 249862306a36Sopenharmony_ci /** 249962306a36Sopenharmony_ci * PHY configuration specific registers: 250062306a36Sopenharmony_ci * link_cmn_vals depend on combination of PHY types being 250162306a36Sopenharmony_ci * configured and are common for both PHY types, so array 250262306a36Sopenharmony_ci * values should be same for [phy_t1][phy_t2][ssc] and 250362306a36Sopenharmony_ci * [phy_t2][phy_t1][ssc]. 250462306a36Sopenharmony_ci * xcvr_diag_vals also depend on combination of PHY types 250562306a36Sopenharmony_ci * being configured, but these can be different for particular 250662306a36Sopenharmony_ci * PHY type and are per lane. 250762306a36Sopenharmony_ci */ 250862306a36Sopenharmony_ci link_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->link_cmn_vals_tbl, 250962306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 251062306a36Sopenharmony_ci phy_t1, phy_t2, ANY_SSC); 251162306a36Sopenharmony_ci if (link_cmn_vals) { 251262306a36Sopenharmony_ci reg_pairs = link_cmn_vals->reg_pairs; 251362306a36Sopenharmony_ci num_regs = link_cmn_vals->num_regs; 251462306a36Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 251562306a36Sopenharmony_ci 251662306a36Sopenharmony_ci /** 251762306a36Sopenharmony_ci * First array value in link_cmn_vals must be of 251862306a36Sopenharmony_ci * PHY_PLL_CFG register 251962306a36Sopenharmony_ci */ 252062306a36Sopenharmony_ci regmap_field_write(cdns_phy->phy_pll_cfg, 252162306a36Sopenharmony_ci reg_pairs[0].val); 252262306a36Sopenharmony_ci 252362306a36Sopenharmony_ci for (i = 1; i < num_regs; i++) 252462306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 252562306a36Sopenharmony_ci reg_pairs[i].val); 252662306a36Sopenharmony_ci } 252762306a36Sopenharmony_ci 252862306a36Sopenharmony_ci xcvr_diag_vals = cdns_torrent_get_tbl_vals(&init_data->xcvr_diag_vals_tbl, 252962306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 253062306a36Sopenharmony_ci phy_t1, phy_t2, ANY_SSC); 253162306a36Sopenharmony_ci if (xcvr_diag_vals) { 253262306a36Sopenharmony_ci reg_pairs = xcvr_diag_vals->reg_pairs; 253362306a36Sopenharmony_ci num_regs = xcvr_diag_vals->num_regs; 253462306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 253562306a36Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + mlane]; 253662306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 253762306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 253862306a36Sopenharmony_ci reg_pairs[j].val); 253962306a36Sopenharmony_ci } 254062306a36Sopenharmony_ci } 254162306a36Sopenharmony_ci 254262306a36Sopenharmony_ci /* PHY PCS common registers configurations */ 254362306a36Sopenharmony_ci pcs_cmn_vals = cdns_torrent_get_tbl_vals(&init_data->pcs_cmn_vals_tbl, 254462306a36Sopenharmony_ci CLK_ANY, CLK_ANY, 254562306a36Sopenharmony_ci phy_t1, phy_t2, ANY_SSC); 254662306a36Sopenharmony_ci if (pcs_cmn_vals) { 254762306a36Sopenharmony_ci reg_pairs = pcs_cmn_vals->reg_pairs; 254862306a36Sopenharmony_ci num_regs = pcs_cmn_vals->num_regs; 254962306a36Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 255062306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 255162306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 255262306a36Sopenharmony_ci reg_pairs[i].val); 255362306a36Sopenharmony_ci } 255462306a36Sopenharmony_ci 255562306a36Sopenharmony_ci /* PMA common registers configurations */ 255662306a36Sopenharmony_ci cmn_vals = cdns_torrent_get_tbl_vals(&init_data->cmn_vals_tbl, 255762306a36Sopenharmony_ci ref_clk, ref_clk, 255862306a36Sopenharmony_ci phy_t1, phy_t2, ssc); 255962306a36Sopenharmony_ci if (cmn_vals) { 256062306a36Sopenharmony_ci reg_pairs = cmn_vals->reg_pairs; 256162306a36Sopenharmony_ci num_regs = cmn_vals->num_regs; 256262306a36Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 256362306a36Sopenharmony_ci for (i = 0; i < num_regs; i++) 256462306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 256562306a36Sopenharmony_ci reg_pairs[i].val); 256662306a36Sopenharmony_ci } 256762306a36Sopenharmony_ci 256862306a36Sopenharmony_ci /* PMA TX lane registers configurations */ 256962306a36Sopenharmony_ci tx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->tx_ln_vals_tbl, 257062306a36Sopenharmony_ci ref_clk, ref_clk, 257162306a36Sopenharmony_ci phy_t1, phy_t2, ssc); 257262306a36Sopenharmony_ci if (tx_ln_vals) { 257362306a36Sopenharmony_ci reg_pairs = tx_ln_vals->reg_pairs; 257462306a36Sopenharmony_ci num_regs = tx_ln_vals->num_regs; 257562306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 257662306a36Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + mlane]; 257762306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 257862306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 257962306a36Sopenharmony_ci reg_pairs[j].val); 258062306a36Sopenharmony_ci } 258162306a36Sopenharmony_ci } 258262306a36Sopenharmony_ci 258362306a36Sopenharmony_ci /* PMA RX lane registers configurations */ 258462306a36Sopenharmony_ci rx_ln_vals = cdns_torrent_get_tbl_vals(&init_data->rx_ln_vals_tbl, 258562306a36Sopenharmony_ci ref_clk, ref_clk, 258662306a36Sopenharmony_ci phy_t1, phy_t2, ssc); 258762306a36Sopenharmony_ci if (rx_ln_vals) { 258862306a36Sopenharmony_ci reg_pairs = rx_ln_vals->reg_pairs; 258962306a36Sopenharmony_ci num_regs = rx_ln_vals->num_regs; 259062306a36Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 259162306a36Sopenharmony_ci regmap = cdns_phy->regmap_rx_lane_cdb[i + mlane]; 259262306a36Sopenharmony_ci for (j = 0; j < num_regs; j++) 259362306a36Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 259462306a36Sopenharmony_ci reg_pairs[j].val); 259562306a36Sopenharmony_ci } 259662306a36Sopenharmony_ci } 259762306a36Sopenharmony_ci 259862306a36Sopenharmony_ci if (phy_t1 == TYPE_DP) { 259962306a36Sopenharmony_ci ret = cdns_torrent_dp_get_pll(cdns_phy, phy_t2); 260062306a36Sopenharmony_ci if (ret) 260162306a36Sopenharmony_ci return ret; 260262306a36Sopenharmony_ci } 260362306a36Sopenharmony_ci 260462306a36Sopenharmony_ci reset_control_deassert(cdns_phy->phys[node].lnk_rst); 260562306a36Sopenharmony_ci } 260662306a36Sopenharmony_ci 260762306a36Sopenharmony_ci /* Take the PHY out of reset */ 260862306a36Sopenharmony_ci ret = reset_control_deassert(cdns_phy->phy_rst); 260962306a36Sopenharmony_ci if (ret) 261062306a36Sopenharmony_ci return ret; 261162306a36Sopenharmony_ci 261262306a36Sopenharmony_ci return 0; 261362306a36Sopenharmony_ci} 261462306a36Sopenharmony_ci 261562306a36Sopenharmony_cistatic void cdns_torrent_clk_cleanup(struct cdns_torrent_phy *cdns_phy) 261662306a36Sopenharmony_ci{ 261762306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 261862306a36Sopenharmony_ci 261962306a36Sopenharmony_ci of_clk_del_provider(dev->of_node); 262062306a36Sopenharmony_ci} 262162306a36Sopenharmony_ci 262262306a36Sopenharmony_cistatic int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy) 262362306a36Sopenharmony_ci{ 262462306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 262562306a36Sopenharmony_ci struct device_node *node = dev->of_node; 262662306a36Sopenharmony_ci struct clk_hw_onecell_data *data; 262762306a36Sopenharmony_ci int ret; 262862306a36Sopenharmony_ci 262962306a36Sopenharmony_ci data = devm_kzalloc(dev, struct_size(data, hws, CDNS_TORRENT_OUTPUT_CLOCKS), GFP_KERNEL); 263062306a36Sopenharmony_ci if (!data) 263162306a36Sopenharmony_ci return -ENOMEM; 263262306a36Sopenharmony_ci 263362306a36Sopenharmony_ci data->num = CDNS_TORRENT_OUTPUT_CLOCKS; 263462306a36Sopenharmony_ci cdns_phy->clk_hw_data = data; 263562306a36Sopenharmony_ci 263662306a36Sopenharmony_ci ret = cdns_torrent_derived_refclk_register(cdns_phy); 263762306a36Sopenharmony_ci if (ret) { 263862306a36Sopenharmony_ci dev_err(dev, "failed to register derived refclk\n"); 263962306a36Sopenharmony_ci return ret; 264062306a36Sopenharmony_ci } 264162306a36Sopenharmony_ci 264262306a36Sopenharmony_ci ret = cdns_torrent_received_refclk_register(cdns_phy); 264362306a36Sopenharmony_ci if (ret) { 264462306a36Sopenharmony_ci dev_err(dev, "failed to register received refclk\n"); 264562306a36Sopenharmony_ci return ret; 264662306a36Sopenharmony_ci } 264762306a36Sopenharmony_ci 264862306a36Sopenharmony_ci ret = cdns_torrent_refclk_driver_register(cdns_phy); 264962306a36Sopenharmony_ci if (ret) { 265062306a36Sopenharmony_ci dev_err(dev, "failed to register refclk driver\n"); 265162306a36Sopenharmony_ci return ret; 265262306a36Sopenharmony_ci } 265362306a36Sopenharmony_ci 265462306a36Sopenharmony_ci ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data); 265562306a36Sopenharmony_ci if (ret) { 265662306a36Sopenharmony_ci dev_err(dev, "Failed to add clock provider: %s\n", node->name); 265762306a36Sopenharmony_ci return ret; 265862306a36Sopenharmony_ci } 265962306a36Sopenharmony_ci 266062306a36Sopenharmony_ci return 0; 266162306a36Sopenharmony_ci} 266262306a36Sopenharmony_ci 266362306a36Sopenharmony_cistatic int cdns_torrent_reset(struct cdns_torrent_phy *cdns_phy) 266462306a36Sopenharmony_ci{ 266562306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 266662306a36Sopenharmony_ci 266762306a36Sopenharmony_ci cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0); 266862306a36Sopenharmony_ci if (IS_ERR(cdns_phy->phy_rst)) { 266962306a36Sopenharmony_ci dev_err(dev, "%s: failed to get reset\n", 267062306a36Sopenharmony_ci dev->of_node->full_name); 267162306a36Sopenharmony_ci return PTR_ERR(cdns_phy->phy_rst); 267262306a36Sopenharmony_ci } 267362306a36Sopenharmony_ci 267462306a36Sopenharmony_ci cdns_phy->apb_rst = devm_reset_control_get_optional_exclusive(dev, "torrent_apb"); 267562306a36Sopenharmony_ci if (IS_ERR(cdns_phy->apb_rst)) { 267662306a36Sopenharmony_ci dev_err(dev, "%s: failed to get apb reset\n", 267762306a36Sopenharmony_ci dev->of_node->full_name); 267862306a36Sopenharmony_ci return PTR_ERR(cdns_phy->apb_rst); 267962306a36Sopenharmony_ci } 268062306a36Sopenharmony_ci 268162306a36Sopenharmony_ci return 0; 268262306a36Sopenharmony_ci} 268362306a36Sopenharmony_ci 268462306a36Sopenharmony_cistatic int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy) 268562306a36Sopenharmony_ci{ 268662306a36Sopenharmony_ci struct device *dev = cdns_phy->dev; 268762306a36Sopenharmony_ci unsigned long ref_clk_rate; 268862306a36Sopenharmony_ci int ret; 268962306a36Sopenharmony_ci 269062306a36Sopenharmony_ci cdns_phy->clk = devm_clk_get(dev, "refclk"); 269162306a36Sopenharmony_ci if (IS_ERR(cdns_phy->clk)) { 269262306a36Sopenharmony_ci dev_err(dev, "phy ref clock not found\n"); 269362306a36Sopenharmony_ci return PTR_ERR(cdns_phy->clk); 269462306a36Sopenharmony_ci } 269562306a36Sopenharmony_ci 269662306a36Sopenharmony_ci ret = clk_prepare_enable(cdns_phy->clk); 269762306a36Sopenharmony_ci if (ret) { 269862306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); 269962306a36Sopenharmony_ci return ret; 270062306a36Sopenharmony_ci } 270162306a36Sopenharmony_ci 270262306a36Sopenharmony_ci ref_clk_rate = clk_get_rate(cdns_phy->clk); 270362306a36Sopenharmony_ci if (!ref_clk_rate) { 270462306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); 270562306a36Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 270662306a36Sopenharmony_ci return -EINVAL; 270762306a36Sopenharmony_ci } 270862306a36Sopenharmony_ci 270962306a36Sopenharmony_ci switch (ref_clk_rate) { 271062306a36Sopenharmony_ci case REF_CLK_19_2MHZ: 271162306a36Sopenharmony_ci cdns_phy->ref_clk_rate = CLK_19_2_MHZ; 271262306a36Sopenharmony_ci break; 271362306a36Sopenharmony_ci case REF_CLK_25MHZ: 271462306a36Sopenharmony_ci cdns_phy->ref_clk_rate = CLK_25_MHZ; 271562306a36Sopenharmony_ci break; 271662306a36Sopenharmony_ci case REF_CLK_100MHZ: 271762306a36Sopenharmony_ci cdns_phy->ref_clk_rate = CLK_100_MHZ; 271862306a36Sopenharmony_ci break; 271962306a36Sopenharmony_ci case REF_CLK_156_25MHZ: 272062306a36Sopenharmony_ci cdns_phy->ref_clk_rate = CLK_156_25_MHZ; 272162306a36Sopenharmony_ci break; 272262306a36Sopenharmony_ci default: 272362306a36Sopenharmony_ci dev_err(cdns_phy->dev, "Invalid Ref Clock Rate\n"); 272462306a36Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 272562306a36Sopenharmony_ci return -EINVAL; 272662306a36Sopenharmony_ci } 272762306a36Sopenharmony_ci 272862306a36Sopenharmony_ci return 0; 272962306a36Sopenharmony_ci} 273062306a36Sopenharmony_ci 273162306a36Sopenharmony_cistatic int cdns_torrent_phy_probe(struct platform_device *pdev) 273262306a36Sopenharmony_ci{ 273362306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy; 273462306a36Sopenharmony_ci struct device *dev = &pdev->dev; 273562306a36Sopenharmony_ci struct phy_provider *phy_provider; 273662306a36Sopenharmony_ci const struct cdns_torrent_data *data; 273762306a36Sopenharmony_ci struct device_node *child; 273862306a36Sopenharmony_ci int ret, subnodes, node = 0, i; 273962306a36Sopenharmony_ci u32 total_num_lanes = 0; 274062306a36Sopenharmony_ci int already_configured; 274162306a36Sopenharmony_ci u8 init_dp_regmap = 0; 274262306a36Sopenharmony_ci u32 phy_type; 274362306a36Sopenharmony_ci 274462306a36Sopenharmony_ci /* Get init data for this PHY */ 274562306a36Sopenharmony_ci data = of_device_get_match_data(dev); 274662306a36Sopenharmony_ci if (!data) 274762306a36Sopenharmony_ci return -EINVAL; 274862306a36Sopenharmony_ci 274962306a36Sopenharmony_ci cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL); 275062306a36Sopenharmony_ci if (!cdns_phy) 275162306a36Sopenharmony_ci return -ENOMEM; 275262306a36Sopenharmony_ci 275362306a36Sopenharmony_ci dev_set_drvdata(dev, cdns_phy); 275462306a36Sopenharmony_ci cdns_phy->dev = dev; 275562306a36Sopenharmony_ci cdns_phy->init_data = data; 275662306a36Sopenharmony_ci 275762306a36Sopenharmony_ci cdns_phy->sd_base = devm_platform_ioremap_resource(pdev, 0); 275862306a36Sopenharmony_ci if (IS_ERR(cdns_phy->sd_base)) 275962306a36Sopenharmony_ci return PTR_ERR(cdns_phy->sd_base); 276062306a36Sopenharmony_ci 276162306a36Sopenharmony_ci subnodes = of_get_available_child_count(dev->of_node); 276262306a36Sopenharmony_ci if (subnodes == 0) { 276362306a36Sopenharmony_ci dev_err(dev, "No available link subnodes found\n"); 276462306a36Sopenharmony_ci return -EINVAL; 276562306a36Sopenharmony_ci } 276662306a36Sopenharmony_ci 276762306a36Sopenharmony_ci ret = cdns_torrent_regmap_init(cdns_phy); 276862306a36Sopenharmony_ci if (ret) 276962306a36Sopenharmony_ci return ret; 277062306a36Sopenharmony_ci 277162306a36Sopenharmony_ci ret = cdns_torrent_regfield_init(cdns_phy); 277262306a36Sopenharmony_ci if (ret) 277362306a36Sopenharmony_ci return ret; 277462306a36Sopenharmony_ci 277562306a36Sopenharmony_ci ret = cdns_torrent_clk_register(cdns_phy); 277662306a36Sopenharmony_ci if (ret) 277762306a36Sopenharmony_ci return ret; 277862306a36Sopenharmony_ci 277962306a36Sopenharmony_ci regmap_field_read(cdns_phy->phy_pma_cmn_ctrl_1, &already_configured); 278062306a36Sopenharmony_ci 278162306a36Sopenharmony_ci if (!already_configured) { 278262306a36Sopenharmony_ci ret = cdns_torrent_reset(cdns_phy); 278362306a36Sopenharmony_ci if (ret) 278462306a36Sopenharmony_ci goto clk_cleanup; 278562306a36Sopenharmony_ci 278662306a36Sopenharmony_ci ret = cdns_torrent_clk(cdns_phy); 278762306a36Sopenharmony_ci if (ret) 278862306a36Sopenharmony_ci goto clk_cleanup; 278962306a36Sopenharmony_ci 279062306a36Sopenharmony_ci /* Enable APB */ 279162306a36Sopenharmony_ci reset_control_deassert(cdns_phy->apb_rst); 279262306a36Sopenharmony_ci } 279362306a36Sopenharmony_ci 279462306a36Sopenharmony_ci for_each_available_child_of_node(dev->of_node, child) { 279562306a36Sopenharmony_ci struct phy *gphy; 279662306a36Sopenharmony_ci 279762306a36Sopenharmony_ci /* PHY subnode name must be 'phy'. */ 279862306a36Sopenharmony_ci if (!(of_node_name_eq(child, "phy"))) 279962306a36Sopenharmony_ci continue; 280062306a36Sopenharmony_ci 280162306a36Sopenharmony_ci cdns_phy->phys[node].lnk_rst = 280262306a36Sopenharmony_ci of_reset_control_array_get_exclusive(child); 280362306a36Sopenharmony_ci if (IS_ERR(cdns_phy->phys[node].lnk_rst)) { 280462306a36Sopenharmony_ci dev_err(dev, "%s: failed to get reset\n", 280562306a36Sopenharmony_ci child->full_name); 280662306a36Sopenharmony_ci ret = PTR_ERR(cdns_phy->phys[node].lnk_rst); 280762306a36Sopenharmony_ci goto put_lnk_rst; 280862306a36Sopenharmony_ci } 280962306a36Sopenharmony_ci 281062306a36Sopenharmony_ci if (of_property_read_u32(child, "reg", 281162306a36Sopenharmony_ci &cdns_phy->phys[node].mlane)) { 281262306a36Sopenharmony_ci dev_err(dev, "%s: No \"reg\"-property.\n", 281362306a36Sopenharmony_ci child->full_name); 281462306a36Sopenharmony_ci ret = -EINVAL; 281562306a36Sopenharmony_ci goto put_child; 281662306a36Sopenharmony_ci } 281762306a36Sopenharmony_ci 281862306a36Sopenharmony_ci if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) { 281962306a36Sopenharmony_ci dev_err(dev, "%s: No \"cdns,phy-type\"-property.\n", 282062306a36Sopenharmony_ci child->full_name); 282162306a36Sopenharmony_ci ret = -EINVAL; 282262306a36Sopenharmony_ci goto put_child; 282362306a36Sopenharmony_ci } 282462306a36Sopenharmony_ci 282562306a36Sopenharmony_ci switch (phy_type) { 282662306a36Sopenharmony_ci case PHY_TYPE_PCIE: 282762306a36Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_PCIE; 282862306a36Sopenharmony_ci break; 282962306a36Sopenharmony_ci case PHY_TYPE_DP: 283062306a36Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_DP; 283162306a36Sopenharmony_ci break; 283262306a36Sopenharmony_ci case PHY_TYPE_SGMII: 283362306a36Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_SGMII; 283462306a36Sopenharmony_ci break; 283562306a36Sopenharmony_ci case PHY_TYPE_QSGMII: 283662306a36Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_QSGMII; 283762306a36Sopenharmony_ci break; 283862306a36Sopenharmony_ci case PHY_TYPE_USB3: 283962306a36Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_USB; 284062306a36Sopenharmony_ci break; 284162306a36Sopenharmony_ci case PHY_TYPE_USXGMII: 284262306a36Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_USXGMII; 284362306a36Sopenharmony_ci break; 284462306a36Sopenharmony_ci default: 284562306a36Sopenharmony_ci dev_err(dev, "Unsupported protocol\n"); 284662306a36Sopenharmony_ci ret = -EINVAL; 284762306a36Sopenharmony_ci goto put_child; 284862306a36Sopenharmony_ci } 284962306a36Sopenharmony_ci 285062306a36Sopenharmony_ci if (of_property_read_u32(child, "cdns,num-lanes", 285162306a36Sopenharmony_ci &cdns_phy->phys[node].num_lanes)) { 285262306a36Sopenharmony_ci dev_err(dev, "%s: No \"cdns,num-lanes\"-property.\n", 285362306a36Sopenharmony_ci child->full_name); 285462306a36Sopenharmony_ci ret = -EINVAL; 285562306a36Sopenharmony_ci goto put_child; 285662306a36Sopenharmony_ci } 285762306a36Sopenharmony_ci 285862306a36Sopenharmony_ci total_num_lanes += cdns_phy->phys[node].num_lanes; 285962306a36Sopenharmony_ci 286062306a36Sopenharmony_ci /* Get SSC mode */ 286162306a36Sopenharmony_ci cdns_phy->phys[node].ssc_mode = NO_SSC; 286262306a36Sopenharmony_ci of_property_read_u32(child, "cdns,ssc-mode", 286362306a36Sopenharmony_ci &cdns_phy->phys[node].ssc_mode); 286462306a36Sopenharmony_ci 286562306a36Sopenharmony_ci if (!already_configured) 286662306a36Sopenharmony_ci gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); 286762306a36Sopenharmony_ci else 286862306a36Sopenharmony_ci gphy = devm_phy_create(dev, child, &noop_ops); 286962306a36Sopenharmony_ci if (IS_ERR(gphy)) { 287062306a36Sopenharmony_ci ret = PTR_ERR(gphy); 287162306a36Sopenharmony_ci goto put_child; 287262306a36Sopenharmony_ci } 287362306a36Sopenharmony_ci 287462306a36Sopenharmony_ci if (cdns_phy->phys[node].phy_type == TYPE_DP) { 287562306a36Sopenharmony_ci switch (cdns_phy->phys[node].num_lanes) { 287662306a36Sopenharmony_ci case 1: 287762306a36Sopenharmony_ci case 2: 287862306a36Sopenharmony_ci case 4: 287962306a36Sopenharmony_ci /* valid number of lanes */ 288062306a36Sopenharmony_ci break; 288162306a36Sopenharmony_ci default: 288262306a36Sopenharmony_ci dev_err(dev, "unsupported number of lanes: %d\n", 288362306a36Sopenharmony_ci cdns_phy->phys[node].num_lanes); 288462306a36Sopenharmony_ci ret = -EINVAL; 288562306a36Sopenharmony_ci goto put_child; 288662306a36Sopenharmony_ci } 288762306a36Sopenharmony_ci 288862306a36Sopenharmony_ci cdns_phy->max_bit_rate = DEFAULT_MAX_BIT_RATE; 288962306a36Sopenharmony_ci of_property_read_u32(child, "cdns,max-bit-rate", 289062306a36Sopenharmony_ci &cdns_phy->max_bit_rate); 289162306a36Sopenharmony_ci 289262306a36Sopenharmony_ci switch (cdns_phy->max_bit_rate) { 289362306a36Sopenharmony_ci case 1620: 289462306a36Sopenharmony_ci case 2160: 289562306a36Sopenharmony_ci case 2430: 289662306a36Sopenharmony_ci case 2700: 289762306a36Sopenharmony_ci case 3240: 289862306a36Sopenharmony_ci case 4320: 289962306a36Sopenharmony_ci case 5400: 290062306a36Sopenharmony_ci case 8100: 290162306a36Sopenharmony_ci /* valid bit rate */ 290262306a36Sopenharmony_ci break; 290362306a36Sopenharmony_ci default: 290462306a36Sopenharmony_ci dev_err(dev, "unsupported max bit rate: %dMbps\n", 290562306a36Sopenharmony_ci cdns_phy->max_bit_rate); 290662306a36Sopenharmony_ci ret = -EINVAL; 290762306a36Sopenharmony_ci goto put_child; 290862306a36Sopenharmony_ci } 290962306a36Sopenharmony_ci 291062306a36Sopenharmony_ci /* DPTX registers */ 291162306a36Sopenharmony_ci cdns_phy->base = devm_platform_ioremap_resource(pdev, 1); 291262306a36Sopenharmony_ci if (IS_ERR(cdns_phy->base)) { 291362306a36Sopenharmony_ci ret = PTR_ERR(cdns_phy->base); 291462306a36Sopenharmony_ci goto put_child; 291562306a36Sopenharmony_ci } 291662306a36Sopenharmony_ci 291762306a36Sopenharmony_ci if (!init_dp_regmap) { 291862306a36Sopenharmony_ci ret = cdns_torrent_dp_regmap_init(cdns_phy); 291962306a36Sopenharmony_ci if (ret) 292062306a36Sopenharmony_ci goto put_child; 292162306a36Sopenharmony_ci 292262306a36Sopenharmony_ci ret = cdns_torrent_dp_regfield_init(cdns_phy); 292362306a36Sopenharmony_ci if (ret) 292462306a36Sopenharmony_ci goto put_child; 292562306a36Sopenharmony_ci 292662306a36Sopenharmony_ci init_dp_regmap++; 292762306a36Sopenharmony_ci } 292862306a36Sopenharmony_ci 292962306a36Sopenharmony_ci dev_dbg(dev, "DP max bit rate %d.%03d Gbps\n", 293062306a36Sopenharmony_ci cdns_phy->max_bit_rate / 1000, 293162306a36Sopenharmony_ci cdns_phy->max_bit_rate % 1000); 293262306a36Sopenharmony_ci 293362306a36Sopenharmony_ci gphy->attrs.bus_width = cdns_phy->phys[node].num_lanes; 293462306a36Sopenharmony_ci gphy->attrs.max_link_rate = cdns_phy->max_bit_rate; 293562306a36Sopenharmony_ci gphy->attrs.mode = PHY_MODE_DP; 293662306a36Sopenharmony_ci } 293762306a36Sopenharmony_ci 293862306a36Sopenharmony_ci cdns_phy->phys[node].phy = gphy; 293962306a36Sopenharmony_ci phy_set_drvdata(gphy, &cdns_phy->phys[node]); 294062306a36Sopenharmony_ci 294162306a36Sopenharmony_ci node++; 294262306a36Sopenharmony_ci } 294362306a36Sopenharmony_ci cdns_phy->nsubnodes = node; 294462306a36Sopenharmony_ci 294562306a36Sopenharmony_ci if (total_num_lanes > MAX_NUM_LANES) { 294662306a36Sopenharmony_ci dev_err(dev, "Invalid lane configuration\n"); 294762306a36Sopenharmony_ci ret = -EINVAL; 294862306a36Sopenharmony_ci goto put_lnk_rst; 294962306a36Sopenharmony_ci } 295062306a36Sopenharmony_ci 295162306a36Sopenharmony_ci if (cdns_phy->nsubnodes > 1 && !already_configured) { 295262306a36Sopenharmony_ci ret = cdns_torrent_phy_configure_multilink(cdns_phy); 295362306a36Sopenharmony_ci if (ret) 295462306a36Sopenharmony_ci goto put_lnk_rst; 295562306a36Sopenharmony_ci } 295662306a36Sopenharmony_ci 295762306a36Sopenharmony_ci phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 295862306a36Sopenharmony_ci if (IS_ERR(phy_provider)) { 295962306a36Sopenharmony_ci ret = PTR_ERR(phy_provider); 296062306a36Sopenharmony_ci goto put_lnk_rst; 296162306a36Sopenharmony_ci } 296262306a36Sopenharmony_ci 296362306a36Sopenharmony_ci if (cdns_phy->nsubnodes > 1) 296462306a36Sopenharmony_ci dev_dbg(dev, "Multi-link: %s (%d lanes) & %s (%d lanes)", 296562306a36Sopenharmony_ci cdns_torrent_get_phy_type(cdns_phy->phys[0].phy_type), 296662306a36Sopenharmony_ci cdns_phy->phys[0].num_lanes, 296762306a36Sopenharmony_ci cdns_torrent_get_phy_type(cdns_phy->phys[1].phy_type), 296862306a36Sopenharmony_ci cdns_phy->phys[1].num_lanes); 296962306a36Sopenharmony_ci else 297062306a36Sopenharmony_ci dev_dbg(dev, "Single link: %s (%d lanes)", 297162306a36Sopenharmony_ci cdns_torrent_get_phy_type(cdns_phy->phys[0].phy_type), 297262306a36Sopenharmony_ci cdns_phy->phys[0].num_lanes); 297362306a36Sopenharmony_ci 297462306a36Sopenharmony_ci return 0; 297562306a36Sopenharmony_ci 297662306a36Sopenharmony_ciput_child: 297762306a36Sopenharmony_ci node++; 297862306a36Sopenharmony_ciput_lnk_rst: 297962306a36Sopenharmony_ci for (i = 0; i < node; i++) 298062306a36Sopenharmony_ci reset_control_put(cdns_phy->phys[i].lnk_rst); 298162306a36Sopenharmony_ci of_node_put(child); 298262306a36Sopenharmony_ci reset_control_assert(cdns_phy->apb_rst); 298362306a36Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 298462306a36Sopenharmony_ciclk_cleanup: 298562306a36Sopenharmony_ci cdns_torrent_clk_cleanup(cdns_phy); 298662306a36Sopenharmony_ci return ret; 298762306a36Sopenharmony_ci} 298862306a36Sopenharmony_ci 298962306a36Sopenharmony_cistatic void cdns_torrent_phy_remove(struct platform_device *pdev) 299062306a36Sopenharmony_ci{ 299162306a36Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = platform_get_drvdata(pdev); 299262306a36Sopenharmony_ci int i; 299362306a36Sopenharmony_ci 299462306a36Sopenharmony_ci reset_control_assert(cdns_phy->phy_rst); 299562306a36Sopenharmony_ci reset_control_assert(cdns_phy->apb_rst); 299662306a36Sopenharmony_ci for (i = 0; i < cdns_phy->nsubnodes; i++) { 299762306a36Sopenharmony_ci reset_control_assert(cdns_phy->phys[i].lnk_rst); 299862306a36Sopenharmony_ci reset_control_put(cdns_phy->phys[i].lnk_rst); 299962306a36Sopenharmony_ci } 300062306a36Sopenharmony_ci 300162306a36Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 300262306a36Sopenharmony_ci cdns_torrent_clk_cleanup(cdns_phy); 300362306a36Sopenharmony_ci} 300462306a36Sopenharmony_ci 300562306a36Sopenharmony_ci/* USB and DP link configuration */ 300662306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_dp_link_cmn_regs[] = { 300762306a36Sopenharmony_ci {0x0002, PHY_PLL_CFG}, 300862306a36Sopenharmony_ci {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0} 300962306a36Sopenharmony_ci}; 301062306a36Sopenharmony_ci 301162306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_dp_xcvr_diag_ln_regs[] = { 301262306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 301362306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 301462306a36Sopenharmony_ci {0x0041, XCVR_DIAG_PLLDRC_CTRL} 301562306a36Sopenharmony_ci}; 301662306a36Sopenharmony_ci 301762306a36Sopenharmony_cistatic struct cdns_reg_pairs dp_usb_xcvr_diag_ln_regs[] = { 301862306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_SEL}, 301962306a36Sopenharmony_ci {0x0009, XCVR_DIAG_PLLDRC_CTRL} 302062306a36Sopenharmony_ci}; 302162306a36Sopenharmony_ci 302262306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_dp_link_cmn_vals = { 302362306a36Sopenharmony_ci .reg_pairs = usb_dp_link_cmn_regs, 302462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_dp_link_cmn_regs), 302562306a36Sopenharmony_ci}; 302662306a36Sopenharmony_ci 302762306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_dp_xcvr_diag_ln_vals = { 302862306a36Sopenharmony_ci .reg_pairs = usb_dp_xcvr_diag_ln_regs, 302962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_dp_xcvr_diag_ln_regs), 303062306a36Sopenharmony_ci}; 303162306a36Sopenharmony_ci 303262306a36Sopenharmony_cistatic struct cdns_torrent_vals dp_usb_xcvr_diag_ln_vals = { 303362306a36Sopenharmony_ci .reg_pairs = dp_usb_xcvr_diag_ln_regs, 303462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(dp_usb_xcvr_diag_ln_regs), 303562306a36Sopenharmony_ci}; 303662306a36Sopenharmony_ci 303762306a36Sopenharmony_ci/* TI USXGMII configuration: Enable cmn_refclk_rcv_out_en */ 303862306a36Sopenharmony_cistatic struct cdns_reg_pairs ti_usxgmii_phy_pma_cmn_regs[] = { 303962306a36Sopenharmony_ci {0x0040, PHY_PMA_CMN_CTRL1}, 304062306a36Sopenharmony_ci}; 304162306a36Sopenharmony_ci 304262306a36Sopenharmony_cistatic struct cdns_torrent_vals ti_usxgmii_phy_pma_cmn_vals = { 304362306a36Sopenharmony_ci .reg_pairs = ti_usxgmii_phy_pma_cmn_regs, 304462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ti_usxgmii_phy_pma_cmn_regs), 304562306a36Sopenharmony_ci}; 304662306a36Sopenharmony_ci 304762306a36Sopenharmony_ci/* Single USXGMII link configuration */ 304862306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usxgmii_link_cmn_regs[] = { 304962306a36Sopenharmony_ci {0x0000, PHY_PLL_CFG}, 305062306a36Sopenharmony_ci {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M0} 305162306a36Sopenharmony_ci}; 305262306a36Sopenharmony_ci 305362306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usxgmii_xcvr_diag_ln_regs[] = { 305462306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 305562306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 305662306a36Sopenharmony_ci {0x0001, XCVR_DIAG_PLLDRC_CTRL} 305762306a36Sopenharmony_ci}; 305862306a36Sopenharmony_ci 305962306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usxgmii_link_cmn_vals = { 306062306a36Sopenharmony_ci .reg_pairs = sl_usxgmii_link_cmn_regs, 306162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usxgmii_link_cmn_regs), 306262306a36Sopenharmony_ci}; 306362306a36Sopenharmony_ci 306462306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usxgmii_xcvr_diag_ln_vals = { 306562306a36Sopenharmony_ci .reg_pairs = sl_usxgmii_xcvr_diag_ln_regs, 306662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usxgmii_xcvr_diag_ln_regs), 306762306a36Sopenharmony_ci}; 306862306a36Sopenharmony_ci 306962306a36Sopenharmony_ci/* Single link USXGMII, 156.25 MHz Ref clk, no SSC */ 307062306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usxgmii_156_25_no_ssc_cmn_regs[] = { 307162306a36Sopenharmony_ci {0x0014, CMN_SSM_BIAS_TMR}, 307262306a36Sopenharmony_ci {0x0028, CMN_PLLSM0_PLLPRE_TMR}, 307362306a36Sopenharmony_ci {0x00A4, CMN_PLLSM0_PLLLOCK_TMR}, 307462306a36Sopenharmony_ci {0x0028, CMN_PLLSM1_PLLPRE_TMR}, 307562306a36Sopenharmony_ci {0x00A4, CMN_PLLSM1_PLLLOCK_TMR}, 307662306a36Sopenharmony_ci {0x0062, CMN_BGCAL_INIT_TMR}, 307762306a36Sopenharmony_ci {0x0062, CMN_BGCAL_ITER_TMR}, 307862306a36Sopenharmony_ci {0x0014, CMN_IBCAL_INIT_TMR}, 307962306a36Sopenharmony_ci {0x0018, CMN_TXPUCAL_INIT_TMR}, 308062306a36Sopenharmony_ci {0x0005, CMN_TXPUCAL_ITER_TMR}, 308162306a36Sopenharmony_ci {0x0018, CMN_TXPDCAL_INIT_TMR}, 308262306a36Sopenharmony_ci {0x0005, CMN_TXPDCAL_ITER_TMR}, 308362306a36Sopenharmony_ci {0x024A, CMN_RXCAL_INIT_TMR}, 308462306a36Sopenharmony_ci {0x0005, CMN_RXCAL_ITER_TMR}, 308562306a36Sopenharmony_ci {0x000B, CMN_SD_CAL_REFTIM_START}, 308662306a36Sopenharmony_ci {0x0132, CMN_SD_CAL_PLLCNT_START}, 308762306a36Sopenharmony_ci {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0}, 308862306a36Sopenharmony_ci {0x0014, CMN_PLL0_DSM_FBH_OVRD_M0}, 308962306a36Sopenharmony_ci {0x0014, CMN_PLL1_DSM_FBH_OVRD_M0}, 309062306a36Sopenharmony_ci {0x0005, CMN_PLL0_DSM_FBL_OVRD_M0}, 309162306a36Sopenharmony_ci {0x0005, CMN_PLL1_DSM_FBL_OVRD_M0}, 309262306a36Sopenharmony_ci {0x061B, CMN_PLL0_VCOCAL_INIT_TMR}, 309362306a36Sopenharmony_ci {0x061B, CMN_PLL1_VCOCAL_INIT_TMR}, 309462306a36Sopenharmony_ci {0x0019, CMN_PLL0_VCOCAL_ITER_TMR}, 309562306a36Sopenharmony_ci {0x0019, CMN_PLL1_VCOCAL_ITER_TMR}, 309662306a36Sopenharmony_ci {0x1354, CMN_PLL0_VCOCAL_REFTIM_START}, 309762306a36Sopenharmony_ci {0x1354, CMN_PLL1_VCOCAL_REFTIM_START}, 309862306a36Sopenharmony_ci {0x1354, CMN_PLL0_VCOCAL_PLLCNT_START}, 309962306a36Sopenharmony_ci {0x1354, CMN_PLL1_VCOCAL_PLLCNT_START}, 310062306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 310162306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 310262306a36Sopenharmony_ci {0x0138, CMN_PLL0_LOCK_REFCNT_START}, 310362306a36Sopenharmony_ci {0x0138, CMN_PLL1_LOCK_REFCNT_START}, 310462306a36Sopenharmony_ci {0x0138, CMN_PLL0_LOCK_PLLCNT_START}, 310562306a36Sopenharmony_ci {0x0138, CMN_PLL1_LOCK_PLLCNT_START} 310662306a36Sopenharmony_ci}; 310762306a36Sopenharmony_ci 310862306a36Sopenharmony_cistatic struct cdns_reg_pairs usxgmii_156_25_no_ssc_tx_ln_regs[] = { 310962306a36Sopenharmony_ci {0x07A2, TX_RCVDET_ST_TMR}, 311062306a36Sopenharmony_ci {0x00F3, TX_PSC_A0}, 311162306a36Sopenharmony_ci {0x04A2, TX_PSC_A2}, 311262306a36Sopenharmony_ci {0x04A2, TX_PSC_A3}, 311362306a36Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 311462306a36Sopenharmony_ci {0x0000, XCVR_DIAG_PSC_OVRD} 311562306a36Sopenharmony_ci}; 311662306a36Sopenharmony_ci 311762306a36Sopenharmony_cistatic struct cdns_reg_pairs usxgmii_156_25_no_ssc_rx_ln_regs[] = { 311862306a36Sopenharmony_ci {0x0014, RX_SDCAL0_INIT_TMR}, 311962306a36Sopenharmony_ci {0x0062, RX_SDCAL0_ITER_TMR}, 312062306a36Sopenharmony_ci {0x0014, RX_SDCAL1_INIT_TMR}, 312162306a36Sopenharmony_ci {0x0062, RX_SDCAL1_ITER_TMR}, 312262306a36Sopenharmony_ci {0x091D, RX_PSC_A0}, 312362306a36Sopenharmony_ci {0x0900, RX_PSC_A2}, 312462306a36Sopenharmony_ci {0x0100, RX_PSC_A3}, 312562306a36Sopenharmony_ci {0x0030, RX_REE_SMGM_CTRL1}, 312662306a36Sopenharmony_ci {0x03C7, RX_REE_GCSM1_EQENM_PH1}, 312762306a36Sopenharmony_ci {0x01C7, RX_REE_GCSM1_EQENM_PH2}, 312862306a36Sopenharmony_ci {0x0000, RX_DIAG_DFE_CTRL}, 312962306a36Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 313062306a36Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 313162306a36Sopenharmony_ci {0x00B9, RX_DIAG_NQST_CTRL}, 313262306a36Sopenharmony_ci {0x0C21, RX_DIAG_DFE_AMP_TUNE_2}, 313362306a36Sopenharmony_ci {0x0002, RX_DIAG_DFE_AMP_TUNE_3}, 313462306a36Sopenharmony_ci {0x0033, RX_DIAG_PI_RATE}, 313562306a36Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 313662306a36Sopenharmony_ci {0x018C, RX_CDRLF_CNFG} 313762306a36Sopenharmony_ci}; 313862306a36Sopenharmony_ci 313962306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usxgmii_156_25_no_ssc_cmn_vals = { 314062306a36Sopenharmony_ci .reg_pairs = sl_usxgmii_156_25_no_ssc_cmn_regs, 314162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usxgmii_156_25_no_ssc_cmn_regs), 314262306a36Sopenharmony_ci}; 314362306a36Sopenharmony_ci 314462306a36Sopenharmony_cistatic struct cdns_torrent_vals usxgmii_156_25_no_ssc_tx_ln_vals = { 314562306a36Sopenharmony_ci .reg_pairs = usxgmii_156_25_no_ssc_tx_ln_regs, 314662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usxgmii_156_25_no_ssc_tx_ln_regs), 314762306a36Sopenharmony_ci}; 314862306a36Sopenharmony_ci 314962306a36Sopenharmony_cistatic struct cdns_torrent_vals usxgmii_156_25_no_ssc_rx_ln_vals = { 315062306a36Sopenharmony_ci .reg_pairs = usxgmii_156_25_no_ssc_rx_ln_regs, 315162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usxgmii_156_25_no_ssc_rx_ln_regs), 315262306a36Sopenharmony_ci}; 315362306a36Sopenharmony_ci 315462306a36Sopenharmony_ci/* PCIe and DP link configuration */ 315562306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_dp_link_cmn_regs[] = { 315662306a36Sopenharmony_ci {0x0003, PHY_PLL_CFG}, 315762306a36Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}, 315862306a36Sopenharmony_ci {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1} 315962306a36Sopenharmony_ci}; 316062306a36Sopenharmony_ci 316162306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_dp_xcvr_diag_ln_regs[] = { 316262306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 316362306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 316462306a36Sopenharmony_ci {0x0012, XCVR_DIAG_PLLDRC_CTRL} 316562306a36Sopenharmony_ci}; 316662306a36Sopenharmony_ci 316762306a36Sopenharmony_cistatic struct cdns_reg_pairs dp_pcie_xcvr_diag_ln_regs[] = { 316862306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_SEL}, 316962306a36Sopenharmony_ci {0x0009, XCVR_DIAG_PLLDRC_CTRL} 317062306a36Sopenharmony_ci}; 317162306a36Sopenharmony_ci 317262306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_dp_link_cmn_vals = { 317362306a36Sopenharmony_ci .reg_pairs = pcie_dp_link_cmn_regs, 317462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_dp_link_cmn_regs), 317562306a36Sopenharmony_ci}; 317662306a36Sopenharmony_ci 317762306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_dp_xcvr_diag_ln_vals = { 317862306a36Sopenharmony_ci .reg_pairs = pcie_dp_xcvr_diag_ln_regs, 317962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_dp_xcvr_diag_ln_regs), 318062306a36Sopenharmony_ci}; 318162306a36Sopenharmony_ci 318262306a36Sopenharmony_cistatic struct cdns_torrent_vals dp_pcie_xcvr_diag_ln_vals = { 318362306a36Sopenharmony_ci .reg_pairs = dp_pcie_xcvr_diag_ln_regs, 318462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(dp_pcie_xcvr_diag_ln_regs), 318562306a36Sopenharmony_ci}; 318662306a36Sopenharmony_ci 318762306a36Sopenharmony_ci/* DP Multilink, 100 MHz Ref clk, no SSC */ 318862306a36Sopenharmony_cistatic struct cdns_reg_pairs dp_100_no_ssc_cmn_regs[] = { 318962306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 319062306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 319162306a36Sopenharmony_ci}; 319262306a36Sopenharmony_ci 319362306a36Sopenharmony_cistatic struct cdns_reg_pairs dp_100_no_ssc_tx_ln_regs[] = { 319462306a36Sopenharmony_ci {0x00FB, TX_PSC_A0}, 319562306a36Sopenharmony_ci {0x04AA, TX_PSC_A2}, 319662306a36Sopenharmony_ci {0x04AA, TX_PSC_A3}, 319762306a36Sopenharmony_ci {0x000F, XCVR_DIAG_BIDI_CTRL} 319862306a36Sopenharmony_ci}; 319962306a36Sopenharmony_ci 320062306a36Sopenharmony_cistatic struct cdns_reg_pairs dp_100_no_ssc_rx_ln_regs[] = { 320162306a36Sopenharmony_ci {0x0000, RX_PSC_A0}, 320262306a36Sopenharmony_ci {0x0000, RX_PSC_A2}, 320362306a36Sopenharmony_ci {0x0000, RX_PSC_A3}, 320462306a36Sopenharmony_ci {0x0000, RX_PSC_CAL}, 320562306a36Sopenharmony_ci {0x0000, RX_REE_GCSM1_CTRL}, 320662306a36Sopenharmony_ci {0x0000, RX_REE_GCSM2_CTRL}, 320762306a36Sopenharmony_ci {0x0000, RX_REE_PERGCSM_CTRL} 320862306a36Sopenharmony_ci}; 320962306a36Sopenharmony_ci 321062306a36Sopenharmony_cistatic struct cdns_torrent_vals dp_100_no_ssc_cmn_vals = { 321162306a36Sopenharmony_ci .reg_pairs = dp_100_no_ssc_cmn_regs, 321262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(dp_100_no_ssc_cmn_regs), 321362306a36Sopenharmony_ci}; 321462306a36Sopenharmony_ci 321562306a36Sopenharmony_cistatic struct cdns_torrent_vals dp_100_no_ssc_tx_ln_vals = { 321662306a36Sopenharmony_ci .reg_pairs = dp_100_no_ssc_tx_ln_regs, 321762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(dp_100_no_ssc_tx_ln_regs), 321862306a36Sopenharmony_ci}; 321962306a36Sopenharmony_ci 322062306a36Sopenharmony_cistatic struct cdns_torrent_vals dp_100_no_ssc_rx_ln_vals = { 322162306a36Sopenharmony_ci .reg_pairs = dp_100_no_ssc_rx_ln_regs, 322262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(dp_100_no_ssc_rx_ln_regs), 322362306a36Sopenharmony_ci}; 322462306a36Sopenharmony_ci 322562306a36Sopenharmony_ci/* Single DisplayPort(DP) link configuration */ 322662306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_link_cmn_regs[] = { 322762306a36Sopenharmony_ci {0x0000, PHY_PLL_CFG}, 322862306a36Sopenharmony_ci}; 322962306a36Sopenharmony_ci 323062306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_xcvr_diag_ln_regs[] = { 323162306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 323262306a36Sopenharmony_ci {0x0001, XCVR_DIAG_PLLDRC_CTRL} 323362306a36Sopenharmony_ci}; 323462306a36Sopenharmony_ci 323562306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_link_cmn_vals = { 323662306a36Sopenharmony_ci .reg_pairs = sl_dp_link_cmn_regs, 323762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_link_cmn_regs), 323862306a36Sopenharmony_ci}; 323962306a36Sopenharmony_ci 324062306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_xcvr_diag_ln_vals = { 324162306a36Sopenharmony_ci .reg_pairs = sl_dp_xcvr_diag_ln_regs, 324262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_xcvr_diag_ln_regs), 324362306a36Sopenharmony_ci}; 324462306a36Sopenharmony_ci 324562306a36Sopenharmony_ci/* Single DP, 19.2 MHz Ref clk, no SSC */ 324662306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_19_2_no_ssc_cmn_regs[] = { 324762306a36Sopenharmony_ci {0x0014, CMN_SSM_BIAS_TMR}, 324862306a36Sopenharmony_ci {0x0027, CMN_PLLSM0_PLLPRE_TMR}, 324962306a36Sopenharmony_ci {0x00A1, CMN_PLLSM0_PLLLOCK_TMR}, 325062306a36Sopenharmony_ci {0x0027, CMN_PLLSM1_PLLPRE_TMR}, 325162306a36Sopenharmony_ci {0x00A1, CMN_PLLSM1_PLLLOCK_TMR}, 325262306a36Sopenharmony_ci {0x0060, CMN_BGCAL_INIT_TMR}, 325362306a36Sopenharmony_ci {0x0060, CMN_BGCAL_ITER_TMR}, 325462306a36Sopenharmony_ci {0x0014, CMN_IBCAL_INIT_TMR}, 325562306a36Sopenharmony_ci {0x0018, CMN_TXPUCAL_INIT_TMR}, 325662306a36Sopenharmony_ci {0x0005, CMN_TXPUCAL_ITER_TMR}, 325762306a36Sopenharmony_ci {0x0018, CMN_TXPDCAL_INIT_TMR}, 325862306a36Sopenharmony_ci {0x0005, CMN_TXPDCAL_ITER_TMR}, 325962306a36Sopenharmony_ci {0x0240, CMN_RXCAL_INIT_TMR}, 326062306a36Sopenharmony_ci {0x0005, CMN_RXCAL_ITER_TMR}, 326162306a36Sopenharmony_ci {0x0002, CMN_SD_CAL_INIT_TMR}, 326262306a36Sopenharmony_ci {0x0002, CMN_SD_CAL_ITER_TMR}, 326362306a36Sopenharmony_ci {0x000B, CMN_SD_CAL_REFTIM_START}, 326462306a36Sopenharmony_ci {0x0137, CMN_SD_CAL_PLLCNT_START}, 326562306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 326662306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 326762306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 326862306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 326962306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 327062306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 327162306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 327262306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 327362306a36Sopenharmony_ci {0x00C0, CMN_PLL0_VCOCAL_INIT_TMR}, 327462306a36Sopenharmony_ci {0x0004, CMN_PLL0_VCOCAL_ITER_TMR}, 327562306a36Sopenharmony_ci {0x00C0, CMN_PLL1_VCOCAL_INIT_TMR}, 327662306a36Sopenharmony_ci {0x0004, CMN_PLL1_VCOCAL_ITER_TMR}, 327762306a36Sopenharmony_ci {0x0260, CMN_PLL0_VCOCAL_REFTIM_START}, 327862306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 327962306a36Sopenharmony_ci {0x0260, CMN_PLL1_VCOCAL_REFTIM_START}, 328062306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 328162306a36Sopenharmony_ci}; 328262306a36Sopenharmony_ci 328362306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_19_2_no_ssc_tx_ln_regs[] = { 328462306a36Sopenharmony_ci {0x0780, TX_RCVDET_ST_TMR}, 328562306a36Sopenharmony_ci {0x00FB, TX_PSC_A0}, 328662306a36Sopenharmony_ci {0x04AA, TX_PSC_A2}, 328762306a36Sopenharmony_ci {0x04AA, TX_PSC_A3}, 328862306a36Sopenharmony_ci {0x000F, XCVR_DIAG_BIDI_CTRL} 328962306a36Sopenharmony_ci}; 329062306a36Sopenharmony_ci 329162306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_19_2_no_ssc_rx_ln_regs[] = { 329262306a36Sopenharmony_ci {0x0000, RX_PSC_A0}, 329362306a36Sopenharmony_ci {0x0000, RX_PSC_A2}, 329462306a36Sopenharmony_ci {0x0000, RX_PSC_A3}, 329562306a36Sopenharmony_ci {0x0000, RX_PSC_CAL}, 329662306a36Sopenharmony_ci {0x0000, RX_REE_GCSM1_CTRL}, 329762306a36Sopenharmony_ci {0x0000, RX_REE_GCSM2_CTRL}, 329862306a36Sopenharmony_ci {0x0000, RX_REE_PERGCSM_CTRL} 329962306a36Sopenharmony_ci}; 330062306a36Sopenharmony_ci 330162306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_19_2_no_ssc_cmn_vals = { 330262306a36Sopenharmony_ci .reg_pairs = sl_dp_19_2_no_ssc_cmn_regs, 330362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_19_2_no_ssc_cmn_regs), 330462306a36Sopenharmony_ci}; 330562306a36Sopenharmony_ci 330662306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_19_2_no_ssc_tx_ln_vals = { 330762306a36Sopenharmony_ci .reg_pairs = sl_dp_19_2_no_ssc_tx_ln_regs, 330862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_19_2_no_ssc_tx_ln_regs), 330962306a36Sopenharmony_ci}; 331062306a36Sopenharmony_ci 331162306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_19_2_no_ssc_rx_ln_vals = { 331262306a36Sopenharmony_ci .reg_pairs = sl_dp_19_2_no_ssc_rx_ln_regs, 331362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_19_2_no_ssc_rx_ln_regs), 331462306a36Sopenharmony_ci}; 331562306a36Sopenharmony_ci 331662306a36Sopenharmony_ci/* Single DP, 25 MHz Ref clk, no SSC */ 331762306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_25_no_ssc_cmn_regs[] = { 331862306a36Sopenharmony_ci {0x0019, CMN_SSM_BIAS_TMR}, 331962306a36Sopenharmony_ci {0x0032, CMN_PLLSM0_PLLPRE_TMR}, 332062306a36Sopenharmony_ci {0x00D1, CMN_PLLSM0_PLLLOCK_TMR}, 332162306a36Sopenharmony_ci {0x0032, CMN_PLLSM1_PLLPRE_TMR}, 332262306a36Sopenharmony_ci {0x00D1, CMN_PLLSM1_PLLLOCK_TMR}, 332362306a36Sopenharmony_ci {0x007D, CMN_BGCAL_INIT_TMR}, 332462306a36Sopenharmony_ci {0x007D, CMN_BGCAL_ITER_TMR}, 332562306a36Sopenharmony_ci {0x0019, CMN_IBCAL_INIT_TMR}, 332662306a36Sopenharmony_ci {0x001E, CMN_TXPUCAL_INIT_TMR}, 332762306a36Sopenharmony_ci {0x0006, CMN_TXPUCAL_ITER_TMR}, 332862306a36Sopenharmony_ci {0x001E, CMN_TXPDCAL_INIT_TMR}, 332962306a36Sopenharmony_ci {0x0006, CMN_TXPDCAL_ITER_TMR}, 333062306a36Sopenharmony_ci {0x02EE, CMN_RXCAL_INIT_TMR}, 333162306a36Sopenharmony_ci {0x0006, CMN_RXCAL_ITER_TMR}, 333262306a36Sopenharmony_ci {0x0002, CMN_SD_CAL_INIT_TMR}, 333362306a36Sopenharmony_ci {0x0002, CMN_SD_CAL_ITER_TMR}, 333462306a36Sopenharmony_ci {0x000E, CMN_SD_CAL_REFTIM_START}, 333562306a36Sopenharmony_ci {0x012B, CMN_SD_CAL_PLLCNT_START}, 333662306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 333762306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 333862306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 333962306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 334062306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 334162306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 334262306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 334362306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 334462306a36Sopenharmony_ci {0x00FA, CMN_PLL0_VCOCAL_INIT_TMR}, 334562306a36Sopenharmony_ci {0x0004, CMN_PLL0_VCOCAL_ITER_TMR}, 334662306a36Sopenharmony_ci {0x00FA, CMN_PLL1_VCOCAL_INIT_TMR}, 334762306a36Sopenharmony_ci {0x0004, CMN_PLL1_VCOCAL_ITER_TMR}, 334862306a36Sopenharmony_ci {0x0317, CMN_PLL0_VCOCAL_REFTIM_START}, 334962306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 335062306a36Sopenharmony_ci {0x0317, CMN_PLL1_VCOCAL_REFTIM_START}, 335162306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 335262306a36Sopenharmony_ci}; 335362306a36Sopenharmony_ci 335462306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_25_no_ssc_tx_ln_regs[] = { 335562306a36Sopenharmony_ci {0x09C4, TX_RCVDET_ST_TMR}, 335662306a36Sopenharmony_ci {0x00FB, TX_PSC_A0}, 335762306a36Sopenharmony_ci {0x04AA, TX_PSC_A2}, 335862306a36Sopenharmony_ci {0x04AA, TX_PSC_A3}, 335962306a36Sopenharmony_ci {0x000F, XCVR_DIAG_BIDI_CTRL} 336062306a36Sopenharmony_ci}; 336162306a36Sopenharmony_ci 336262306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_25_no_ssc_rx_ln_regs[] = { 336362306a36Sopenharmony_ci {0x0000, RX_PSC_A0}, 336462306a36Sopenharmony_ci {0x0000, RX_PSC_A2}, 336562306a36Sopenharmony_ci {0x0000, RX_PSC_A3}, 336662306a36Sopenharmony_ci {0x0000, RX_PSC_CAL}, 336762306a36Sopenharmony_ci {0x0000, RX_REE_GCSM1_CTRL}, 336862306a36Sopenharmony_ci {0x0000, RX_REE_GCSM2_CTRL}, 336962306a36Sopenharmony_ci {0x0000, RX_REE_PERGCSM_CTRL} 337062306a36Sopenharmony_ci}; 337162306a36Sopenharmony_ci 337262306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_25_no_ssc_cmn_vals = { 337362306a36Sopenharmony_ci .reg_pairs = sl_dp_25_no_ssc_cmn_regs, 337462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_25_no_ssc_cmn_regs), 337562306a36Sopenharmony_ci}; 337662306a36Sopenharmony_ci 337762306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_25_no_ssc_tx_ln_vals = { 337862306a36Sopenharmony_ci .reg_pairs = sl_dp_25_no_ssc_tx_ln_regs, 337962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_25_no_ssc_tx_ln_regs), 338062306a36Sopenharmony_ci}; 338162306a36Sopenharmony_ci 338262306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_25_no_ssc_rx_ln_vals = { 338362306a36Sopenharmony_ci .reg_pairs = sl_dp_25_no_ssc_rx_ln_regs, 338462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_25_no_ssc_rx_ln_regs), 338562306a36Sopenharmony_ci}; 338662306a36Sopenharmony_ci 338762306a36Sopenharmony_ci/* Single DP, 100 MHz Ref clk, no SSC */ 338862306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_100_no_ssc_cmn_regs[] = { 338962306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 339062306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 339162306a36Sopenharmony_ci}; 339262306a36Sopenharmony_ci 339362306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_100_no_ssc_tx_ln_regs[] = { 339462306a36Sopenharmony_ci {0x00FB, TX_PSC_A0}, 339562306a36Sopenharmony_ci {0x04AA, TX_PSC_A2}, 339662306a36Sopenharmony_ci {0x04AA, TX_PSC_A3}, 339762306a36Sopenharmony_ci {0x000F, XCVR_DIAG_BIDI_CTRL} 339862306a36Sopenharmony_ci}; 339962306a36Sopenharmony_ci 340062306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_dp_100_no_ssc_rx_ln_regs[] = { 340162306a36Sopenharmony_ci {0x0000, RX_PSC_A0}, 340262306a36Sopenharmony_ci {0x0000, RX_PSC_A2}, 340362306a36Sopenharmony_ci {0x0000, RX_PSC_A3}, 340462306a36Sopenharmony_ci {0x0000, RX_PSC_CAL}, 340562306a36Sopenharmony_ci {0x0000, RX_REE_GCSM1_CTRL}, 340662306a36Sopenharmony_ci {0x0000, RX_REE_GCSM2_CTRL}, 340762306a36Sopenharmony_ci {0x0000, RX_REE_PERGCSM_CTRL} 340862306a36Sopenharmony_ci}; 340962306a36Sopenharmony_ci 341062306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_100_no_ssc_cmn_vals = { 341162306a36Sopenharmony_ci .reg_pairs = sl_dp_100_no_ssc_cmn_regs, 341262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_100_no_ssc_cmn_regs), 341362306a36Sopenharmony_ci}; 341462306a36Sopenharmony_ci 341562306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_100_no_ssc_tx_ln_vals = { 341662306a36Sopenharmony_ci .reg_pairs = sl_dp_100_no_ssc_tx_ln_regs, 341762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_100_no_ssc_tx_ln_regs), 341862306a36Sopenharmony_ci}; 341962306a36Sopenharmony_ci 342062306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_dp_100_no_ssc_rx_ln_vals = { 342162306a36Sopenharmony_ci .reg_pairs = sl_dp_100_no_ssc_rx_ln_regs, 342262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_dp_100_no_ssc_rx_ln_regs), 342362306a36Sopenharmony_ci}; 342462306a36Sopenharmony_ci 342562306a36Sopenharmony_ci/* USB and SGMII/QSGMII link configuration */ 342662306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_sgmii_link_cmn_regs[] = { 342762306a36Sopenharmony_ci {0x0002, PHY_PLL_CFG}, 342862306a36Sopenharmony_ci {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0}, 342962306a36Sopenharmony_ci {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0} 343062306a36Sopenharmony_ci}; 343162306a36Sopenharmony_ci 343262306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_sgmii_xcvr_diag_ln_regs[] = { 343362306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 343462306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 343562306a36Sopenharmony_ci {0x0041, XCVR_DIAG_PLLDRC_CTRL} 343662306a36Sopenharmony_ci}; 343762306a36Sopenharmony_ci 343862306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_usb_xcvr_diag_ln_regs[] = { 343962306a36Sopenharmony_ci {0x0011, XCVR_DIAG_HSCLK_SEL}, 344062306a36Sopenharmony_ci {0x0003, XCVR_DIAG_HSCLK_DIV}, 344162306a36Sopenharmony_ci {0x009B, XCVR_DIAG_PLLDRC_CTRL} 344262306a36Sopenharmony_ci}; 344362306a36Sopenharmony_ci 344462306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_sgmii_link_cmn_vals = { 344562306a36Sopenharmony_ci .reg_pairs = usb_sgmii_link_cmn_regs, 344662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_sgmii_link_cmn_regs), 344762306a36Sopenharmony_ci}; 344862306a36Sopenharmony_ci 344962306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_sgmii_xcvr_diag_ln_vals = { 345062306a36Sopenharmony_ci .reg_pairs = usb_sgmii_xcvr_diag_ln_regs, 345162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_sgmii_xcvr_diag_ln_regs), 345262306a36Sopenharmony_ci}; 345362306a36Sopenharmony_ci 345462306a36Sopenharmony_cistatic struct cdns_torrent_vals sgmii_usb_xcvr_diag_ln_vals = { 345562306a36Sopenharmony_ci .reg_pairs = sgmii_usb_xcvr_diag_ln_regs, 345662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_usb_xcvr_diag_ln_regs), 345762306a36Sopenharmony_ci}; 345862306a36Sopenharmony_ci 345962306a36Sopenharmony_ci/* PCIe and USB Unique SSC link configuration */ 346062306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_usb_link_cmn_regs[] = { 346162306a36Sopenharmony_ci {0x0003, PHY_PLL_CFG}, 346262306a36Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}, 346362306a36Sopenharmony_ci {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1}, 346462306a36Sopenharmony_ci {0x8600, CMN_PDIAG_PLL1_CLK_SEL_M0} 346562306a36Sopenharmony_ci}; 346662306a36Sopenharmony_ci 346762306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_usb_xcvr_diag_ln_regs[] = { 346862306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 346962306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 347062306a36Sopenharmony_ci {0x0012, XCVR_DIAG_PLLDRC_CTRL} 347162306a36Sopenharmony_ci}; 347262306a36Sopenharmony_ci 347362306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_pcie_xcvr_diag_ln_regs[] = { 347462306a36Sopenharmony_ci {0x0011, XCVR_DIAG_HSCLK_SEL}, 347562306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 347662306a36Sopenharmony_ci {0x00C9, XCVR_DIAG_PLLDRC_CTRL} 347762306a36Sopenharmony_ci}; 347862306a36Sopenharmony_ci 347962306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_usb_link_cmn_vals = { 348062306a36Sopenharmony_ci .reg_pairs = pcie_usb_link_cmn_regs, 348162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_usb_link_cmn_regs), 348262306a36Sopenharmony_ci}; 348362306a36Sopenharmony_ci 348462306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_usb_xcvr_diag_ln_vals = { 348562306a36Sopenharmony_ci .reg_pairs = pcie_usb_xcvr_diag_ln_regs, 348662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_usb_xcvr_diag_ln_regs), 348762306a36Sopenharmony_ci}; 348862306a36Sopenharmony_ci 348962306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_pcie_xcvr_diag_ln_vals = { 349062306a36Sopenharmony_ci .reg_pairs = usb_pcie_xcvr_diag_ln_regs, 349162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_pcie_xcvr_diag_ln_regs), 349262306a36Sopenharmony_ci}; 349362306a36Sopenharmony_ci 349462306a36Sopenharmony_ci/* USB 100 MHz Ref clk, internal SSC */ 349562306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_100_int_ssc_cmn_regs[] = { 349662306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 349762306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 349862306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 349962306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 350062306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 350162306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 350262306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 350362306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 350462306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 350562306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 350662306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 350762306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 350862306a36Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 350962306a36Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 351062306a36Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 351162306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 351262306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 351362306a36Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 351462306a36Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 351562306a36Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 351662306a36Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 351762306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 351862306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 351962306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 352062306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 352162306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 352262306a36Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 352362306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 352462306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 352562306a36Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 352662306a36Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 352762306a36Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 352862306a36Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 352962306a36Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 353062306a36Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 353162306a36Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 353262306a36Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 353362306a36Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 353462306a36Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 353562306a36Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 353662306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 353762306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 353862306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 353962306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 354062306a36Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 354162306a36Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 354262306a36Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 354362306a36Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD}, 354462306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 354562306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 354662306a36Sopenharmony_ci}; 354762306a36Sopenharmony_ci 354862306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_100_int_ssc_cmn_vals = { 354962306a36Sopenharmony_ci .reg_pairs = usb_100_int_ssc_cmn_regs, 355062306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_int_ssc_cmn_regs), 355162306a36Sopenharmony_ci}; 355262306a36Sopenharmony_ci 355362306a36Sopenharmony_ci/* Single USB link configuration */ 355462306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_link_cmn_regs[] = { 355562306a36Sopenharmony_ci {0x0000, PHY_PLL_CFG}, 355662306a36Sopenharmony_ci {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0} 355762306a36Sopenharmony_ci}; 355862306a36Sopenharmony_ci 355962306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_xcvr_diag_ln_regs[] = { 356062306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 356162306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 356262306a36Sopenharmony_ci {0x0041, XCVR_DIAG_PLLDRC_CTRL} 356362306a36Sopenharmony_ci}; 356462306a36Sopenharmony_ci 356562306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_link_cmn_vals = { 356662306a36Sopenharmony_ci .reg_pairs = sl_usb_link_cmn_regs, 356762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_link_cmn_regs), 356862306a36Sopenharmony_ci}; 356962306a36Sopenharmony_ci 357062306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_xcvr_diag_ln_vals = { 357162306a36Sopenharmony_ci .reg_pairs = sl_usb_xcvr_diag_ln_regs, 357262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_xcvr_diag_ln_regs), 357362306a36Sopenharmony_ci}; 357462306a36Sopenharmony_ci 357562306a36Sopenharmony_ci/* USB PHY PCS common configuration */ 357662306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_phy_pcs_cmn_regs[] = { 357762306a36Sopenharmony_ci {0x0A0A, PHY_PIPE_USB3_GEN2_PRE_CFG0}, 357862306a36Sopenharmony_ci {0x1000, PHY_PIPE_USB3_GEN2_POST_CFG0}, 357962306a36Sopenharmony_ci {0x0010, PHY_PIPE_USB3_GEN2_POST_CFG1} 358062306a36Sopenharmony_ci}; 358162306a36Sopenharmony_ci 358262306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_phy_pcs_cmn_vals = { 358362306a36Sopenharmony_ci .reg_pairs = usb_phy_pcs_cmn_regs, 358462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_phy_pcs_cmn_regs), 358562306a36Sopenharmony_ci}; 358662306a36Sopenharmony_ci 358762306a36Sopenharmony_ci/* USB 100 MHz Ref clk, no SSC */ 358862306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_100_no_ssc_cmn_regs[] = { 358962306a36Sopenharmony_ci {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0}, 359062306a36Sopenharmony_ci {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0}, 359162306a36Sopenharmony_ci {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0}, 359262306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 359362306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 359462306a36Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 359562306a36Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD} 359662306a36Sopenharmony_ci}; 359762306a36Sopenharmony_ci 359862306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_100_no_ssc_cmn_vals = { 359962306a36Sopenharmony_ci .reg_pairs = sl_usb_100_no_ssc_cmn_regs, 360062306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_100_no_ssc_cmn_regs), 360162306a36Sopenharmony_ci}; 360262306a36Sopenharmony_ci 360362306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_100_no_ssc_cmn_regs[] = { 360462306a36Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 360562306a36Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD}, 360662306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 360762306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 360862306a36Sopenharmony_ci}; 360962306a36Sopenharmony_ci 361062306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_100_no_ssc_tx_ln_regs[] = { 361162306a36Sopenharmony_ci {0x02FF, TX_PSC_A0}, 361262306a36Sopenharmony_ci {0x06AF, TX_PSC_A1}, 361362306a36Sopenharmony_ci {0x06AE, TX_PSC_A2}, 361462306a36Sopenharmony_ci {0x06AE, TX_PSC_A3}, 361562306a36Sopenharmony_ci {0x2A82, TX_TXCC_CTRL}, 361662306a36Sopenharmony_ci {0x0014, TX_TXCC_CPOST_MULT_01}, 361762306a36Sopenharmony_ci {0x0003, XCVR_DIAG_PSC_OVRD} 361862306a36Sopenharmony_ci}; 361962306a36Sopenharmony_ci 362062306a36Sopenharmony_cistatic struct cdns_reg_pairs usb_100_no_ssc_rx_ln_regs[] = { 362162306a36Sopenharmony_ci {0x0D1D, RX_PSC_A0}, 362262306a36Sopenharmony_ci {0x0D1D, RX_PSC_A1}, 362362306a36Sopenharmony_ci {0x0D00, RX_PSC_A2}, 362462306a36Sopenharmony_ci {0x0500, RX_PSC_A3}, 362562306a36Sopenharmony_ci {0x0013, RX_SIGDET_HL_FILT_TMR}, 362662306a36Sopenharmony_ci {0x0000, RX_REE_GCSM1_CTRL}, 362762306a36Sopenharmony_ci {0x0C02, RX_REE_ATTEN_THR}, 362862306a36Sopenharmony_ci {0x0330, RX_REE_SMGM_CTRL1}, 362962306a36Sopenharmony_ci {0x0300, RX_REE_SMGM_CTRL2}, 363062306a36Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 363162306a36Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 363262306a36Sopenharmony_ci {0x1004, RX_DIAG_SIGDET_TUNE}, 363362306a36Sopenharmony_ci {0x00F9, RX_DIAG_NQST_CTRL}, 363462306a36Sopenharmony_ci {0x0C01, RX_DIAG_DFE_AMP_TUNE_2}, 363562306a36Sopenharmony_ci {0x0002, RX_DIAG_DFE_AMP_TUNE_3}, 363662306a36Sopenharmony_ci {0x0000, RX_DIAG_PI_CAP}, 363762306a36Sopenharmony_ci {0x0031, RX_DIAG_PI_RATE}, 363862306a36Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 363962306a36Sopenharmony_ci {0x018C, RX_CDRLF_CNFG}, 364062306a36Sopenharmony_ci {0x0003, RX_CDRLF_CNFG3} 364162306a36Sopenharmony_ci}; 364262306a36Sopenharmony_ci 364362306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_100_no_ssc_cmn_vals = { 364462306a36Sopenharmony_ci .reg_pairs = usb_100_no_ssc_cmn_regs, 364562306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_no_ssc_cmn_regs), 364662306a36Sopenharmony_ci}; 364762306a36Sopenharmony_ci 364862306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_100_no_ssc_tx_ln_vals = { 364962306a36Sopenharmony_ci .reg_pairs = usb_100_no_ssc_tx_ln_regs, 365062306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_no_ssc_tx_ln_regs), 365162306a36Sopenharmony_ci}; 365262306a36Sopenharmony_ci 365362306a36Sopenharmony_cistatic struct cdns_torrent_vals usb_100_no_ssc_rx_ln_vals = { 365462306a36Sopenharmony_ci .reg_pairs = usb_100_no_ssc_rx_ln_regs, 365562306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_no_ssc_rx_ln_regs), 365662306a36Sopenharmony_ci}; 365762306a36Sopenharmony_ci 365862306a36Sopenharmony_ci/* Single link USB, 100 MHz Ref clk, internal SSC */ 365962306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_100_int_ssc_cmn_regs[] = { 366062306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 366162306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 366262306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 366362306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 366462306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 366562306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 366662306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 366762306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 366862306a36Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 366962306a36Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 367062306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 367162306a36Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 367262306a36Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 367362306a36Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 367462306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 367562306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 367662306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 367762306a36Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 367862306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 367962306a36Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 368062306a36Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 368162306a36Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 368262306a36Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 368362306a36Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 368462306a36Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 368562306a36Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 368662306a36Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 368762306a36Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 368862306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 368962306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 369062306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 369162306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 369262306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 369362306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 369462306a36Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 369562306a36Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 369662306a36Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 369762306a36Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD} 369862306a36Sopenharmony_ci}; 369962306a36Sopenharmony_ci 370062306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_100_int_ssc_cmn_vals = { 370162306a36Sopenharmony_ci .reg_pairs = sl_usb_100_int_ssc_cmn_regs, 370262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_100_int_ssc_cmn_regs), 370362306a36Sopenharmony_ci}; 370462306a36Sopenharmony_ci 370562306a36Sopenharmony_ci/* PCIe and SGMII/QSGMII Unique SSC link configuration */ 370662306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_sgmii_link_cmn_regs[] = { 370762306a36Sopenharmony_ci {0x0003, PHY_PLL_CFG}, 370862306a36Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}, 370962306a36Sopenharmony_ci {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1}, 371062306a36Sopenharmony_ci {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0} 371162306a36Sopenharmony_ci}; 371262306a36Sopenharmony_ci 371362306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_sgmii_xcvr_diag_ln_regs[] = { 371462306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 371562306a36Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 371662306a36Sopenharmony_ci {0x0012, XCVR_DIAG_PLLDRC_CTRL} 371762306a36Sopenharmony_ci}; 371862306a36Sopenharmony_ci 371962306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_pcie_xcvr_diag_ln_regs[] = { 372062306a36Sopenharmony_ci {0x0011, XCVR_DIAG_HSCLK_SEL}, 372162306a36Sopenharmony_ci {0x0003, XCVR_DIAG_HSCLK_DIV}, 372262306a36Sopenharmony_ci {0x009B, XCVR_DIAG_PLLDRC_CTRL} 372362306a36Sopenharmony_ci}; 372462306a36Sopenharmony_ci 372562306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_sgmii_link_cmn_vals = { 372662306a36Sopenharmony_ci .reg_pairs = pcie_sgmii_link_cmn_regs, 372762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_sgmii_link_cmn_regs), 372862306a36Sopenharmony_ci}; 372962306a36Sopenharmony_ci 373062306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_sgmii_xcvr_diag_ln_vals = { 373162306a36Sopenharmony_ci .reg_pairs = pcie_sgmii_xcvr_diag_ln_regs, 373262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_sgmii_xcvr_diag_ln_regs), 373362306a36Sopenharmony_ci}; 373462306a36Sopenharmony_ci 373562306a36Sopenharmony_cistatic struct cdns_torrent_vals sgmii_pcie_xcvr_diag_ln_vals = { 373662306a36Sopenharmony_ci .reg_pairs = sgmii_pcie_xcvr_diag_ln_regs, 373762306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_pcie_xcvr_diag_ln_regs), 373862306a36Sopenharmony_ci}; 373962306a36Sopenharmony_ci 374062306a36Sopenharmony_ci/* SGMII 100 MHz Ref clk, no SSC */ 374162306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_sgmii_100_no_ssc_cmn_regs[] = { 374262306a36Sopenharmony_ci {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0}, 374362306a36Sopenharmony_ci {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0}, 374462306a36Sopenharmony_ci {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0}, 374562306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 374662306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 374762306a36Sopenharmony_ci}; 374862306a36Sopenharmony_ci 374962306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_sgmii_100_no_ssc_cmn_vals = { 375062306a36Sopenharmony_ci .reg_pairs = sl_sgmii_100_no_ssc_cmn_regs, 375162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_sgmii_100_no_ssc_cmn_regs), 375262306a36Sopenharmony_ci}; 375362306a36Sopenharmony_ci 375462306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_no_ssc_cmn_regs[] = { 375562306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 375662306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 375762306a36Sopenharmony_ci}; 375862306a36Sopenharmony_ci 375962306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_no_ssc_tx_ln_regs[] = { 376062306a36Sopenharmony_ci {0x00F3, TX_PSC_A0}, 376162306a36Sopenharmony_ci {0x04A2, TX_PSC_A2}, 376262306a36Sopenharmony_ci {0x04A2, TX_PSC_A3}, 376362306a36Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 376462306a36Sopenharmony_ci {0x00B3, DRV_DIAG_TX_DRV} 376562306a36Sopenharmony_ci}; 376662306a36Sopenharmony_ci 376762306a36Sopenharmony_cistatic struct cdns_reg_pairs ti_sgmii_100_no_ssc_tx_ln_regs[] = { 376862306a36Sopenharmony_ci {0x00F3, TX_PSC_A0}, 376962306a36Sopenharmony_ci {0x04A2, TX_PSC_A2}, 377062306a36Sopenharmony_ci {0x04A2, TX_PSC_A3}, 377162306a36Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 377262306a36Sopenharmony_ci {0x00B3, DRV_DIAG_TX_DRV}, 377362306a36Sopenharmony_ci {0x4000, XCVR_DIAG_RXCLK_CTRL}, 377462306a36Sopenharmony_ci}; 377562306a36Sopenharmony_ci 377662306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_no_ssc_rx_ln_regs[] = { 377762306a36Sopenharmony_ci {0x091D, RX_PSC_A0}, 377862306a36Sopenharmony_ci {0x0900, RX_PSC_A2}, 377962306a36Sopenharmony_ci {0x0100, RX_PSC_A3}, 378062306a36Sopenharmony_ci {0x03C7, RX_REE_GCSM1_EQENM_PH1}, 378162306a36Sopenharmony_ci {0x01C7, RX_REE_GCSM1_EQENM_PH2}, 378262306a36Sopenharmony_ci {0x0000, RX_DIAG_DFE_CTRL}, 378362306a36Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 378462306a36Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 378562306a36Sopenharmony_ci {0x0098, RX_DIAG_NQST_CTRL}, 378662306a36Sopenharmony_ci {0x0C01, RX_DIAG_DFE_AMP_TUNE_2}, 378762306a36Sopenharmony_ci {0x0000, RX_DIAG_DFE_AMP_TUNE_3}, 378862306a36Sopenharmony_ci {0x0000, RX_DIAG_PI_CAP}, 378962306a36Sopenharmony_ci {0x0010, RX_DIAG_PI_RATE}, 379062306a36Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 379162306a36Sopenharmony_ci {0x018C, RX_CDRLF_CNFG}, 379262306a36Sopenharmony_ci}; 379362306a36Sopenharmony_ci 379462306a36Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_no_ssc_cmn_vals = { 379562306a36Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_cmn_regs, 379662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_cmn_regs), 379762306a36Sopenharmony_ci}; 379862306a36Sopenharmony_ci 379962306a36Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_no_ssc_tx_ln_vals = { 380062306a36Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_tx_ln_regs, 380162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_tx_ln_regs), 380262306a36Sopenharmony_ci}; 380362306a36Sopenharmony_ci 380462306a36Sopenharmony_cistatic struct cdns_torrent_vals ti_sgmii_100_no_ssc_tx_ln_vals = { 380562306a36Sopenharmony_ci .reg_pairs = ti_sgmii_100_no_ssc_tx_ln_regs, 380662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ti_sgmii_100_no_ssc_tx_ln_regs), 380762306a36Sopenharmony_ci}; 380862306a36Sopenharmony_ci 380962306a36Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_no_ssc_rx_ln_vals = { 381062306a36Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_rx_ln_regs, 381162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_rx_ln_regs), 381262306a36Sopenharmony_ci}; 381362306a36Sopenharmony_ci 381462306a36Sopenharmony_ci/* SGMII 100 MHz Ref clk, internal SSC */ 381562306a36Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_int_ssc_cmn_regs[] = { 381662306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 381762306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 381862306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 381962306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 382062306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 382162306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 382262306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 382362306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 382462306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 382562306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 382662306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 382762306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 382862306a36Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 382962306a36Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 383062306a36Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 383162306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 383262306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 383362306a36Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 383462306a36Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 383562306a36Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 383662306a36Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 383762306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 383862306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 383962306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 384062306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 384162306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 384262306a36Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 384362306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 384462306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 384562306a36Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 384662306a36Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 384762306a36Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 384862306a36Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 384962306a36Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 385062306a36Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 385162306a36Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 385262306a36Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 385362306a36Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 385462306a36Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 385562306a36Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 385662306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 385762306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 385862306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 385962306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 386062306a36Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 386162306a36Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 386262306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 386362306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 386462306a36Sopenharmony_ci}; 386562306a36Sopenharmony_ci 386662306a36Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_int_ssc_cmn_vals = { 386762306a36Sopenharmony_ci .reg_pairs = sgmii_100_int_ssc_cmn_regs, 386862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_int_ssc_cmn_regs), 386962306a36Sopenharmony_ci}; 387062306a36Sopenharmony_ci 387162306a36Sopenharmony_ci/* QSGMII 100 MHz Ref clk, no SSC */ 387262306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_qsgmii_100_no_ssc_cmn_regs[] = { 387362306a36Sopenharmony_ci {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0}, 387462306a36Sopenharmony_ci {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0}, 387562306a36Sopenharmony_ci {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0}, 387662306a36Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 387762306a36Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 387862306a36Sopenharmony_ci}; 387962306a36Sopenharmony_ci 388062306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_qsgmii_100_no_ssc_cmn_vals = { 388162306a36Sopenharmony_ci .reg_pairs = sl_qsgmii_100_no_ssc_cmn_regs, 388262306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_qsgmii_100_no_ssc_cmn_regs), 388362306a36Sopenharmony_ci}; 388462306a36Sopenharmony_ci 388562306a36Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_no_ssc_cmn_regs[] = { 388662306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 388762306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 388862306a36Sopenharmony_ci}; 388962306a36Sopenharmony_ci 389062306a36Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_no_ssc_tx_ln_regs[] = { 389162306a36Sopenharmony_ci {0x00F3, TX_PSC_A0}, 389262306a36Sopenharmony_ci {0x04A2, TX_PSC_A2}, 389362306a36Sopenharmony_ci {0x04A2, TX_PSC_A3}, 389462306a36Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 389562306a36Sopenharmony_ci {0x0011, TX_TXCC_MGNFS_MULT_100}, 389662306a36Sopenharmony_ci {0x0003, DRV_DIAG_TX_DRV} 389762306a36Sopenharmony_ci}; 389862306a36Sopenharmony_ci 389962306a36Sopenharmony_cistatic struct cdns_reg_pairs ti_qsgmii_100_no_ssc_tx_ln_regs[] = { 390062306a36Sopenharmony_ci {0x00F3, TX_PSC_A0}, 390162306a36Sopenharmony_ci {0x04A2, TX_PSC_A2}, 390262306a36Sopenharmony_ci {0x04A2, TX_PSC_A3}, 390362306a36Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 390462306a36Sopenharmony_ci {0x0011, TX_TXCC_MGNFS_MULT_100}, 390562306a36Sopenharmony_ci {0x0003, DRV_DIAG_TX_DRV}, 390662306a36Sopenharmony_ci {0x4000, XCVR_DIAG_RXCLK_CTRL}, 390762306a36Sopenharmony_ci}; 390862306a36Sopenharmony_ci 390962306a36Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_no_ssc_rx_ln_regs[] = { 391062306a36Sopenharmony_ci {0x091D, RX_PSC_A0}, 391162306a36Sopenharmony_ci {0x0900, RX_PSC_A2}, 391262306a36Sopenharmony_ci {0x0100, RX_PSC_A3}, 391362306a36Sopenharmony_ci {0x03C7, RX_REE_GCSM1_EQENM_PH1}, 391462306a36Sopenharmony_ci {0x01C7, RX_REE_GCSM1_EQENM_PH2}, 391562306a36Sopenharmony_ci {0x0000, RX_DIAG_DFE_CTRL}, 391662306a36Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 391762306a36Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 391862306a36Sopenharmony_ci {0x0098, RX_DIAG_NQST_CTRL}, 391962306a36Sopenharmony_ci {0x0C01, RX_DIAG_DFE_AMP_TUNE_2}, 392062306a36Sopenharmony_ci {0x0000, RX_DIAG_DFE_AMP_TUNE_3}, 392162306a36Sopenharmony_ci {0x0000, RX_DIAG_PI_CAP}, 392262306a36Sopenharmony_ci {0x0010, RX_DIAG_PI_RATE}, 392362306a36Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 392462306a36Sopenharmony_ci {0x018C, RX_CDRLF_CNFG}, 392562306a36Sopenharmony_ci}; 392662306a36Sopenharmony_ci 392762306a36Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_no_ssc_cmn_vals = { 392862306a36Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_cmn_regs, 392962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_cmn_regs), 393062306a36Sopenharmony_ci}; 393162306a36Sopenharmony_ci 393262306a36Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_no_ssc_tx_ln_vals = { 393362306a36Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_tx_ln_regs, 393462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_tx_ln_regs), 393562306a36Sopenharmony_ci}; 393662306a36Sopenharmony_ci 393762306a36Sopenharmony_cistatic struct cdns_torrent_vals ti_qsgmii_100_no_ssc_tx_ln_vals = { 393862306a36Sopenharmony_ci .reg_pairs = ti_qsgmii_100_no_ssc_tx_ln_regs, 393962306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(ti_qsgmii_100_no_ssc_tx_ln_regs), 394062306a36Sopenharmony_ci}; 394162306a36Sopenharmony_ci 394262306a36Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_no_ssc_rx_ln_vals = { 394362306a36Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_rx_ln_regs, 394462306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_rx_ln_regs), 394562306a36Sopenharmony_ci}; 394662306a36Sopenharmony_ci 394762306a36Sopenharmony_ci/* QSGMII 100 MHz Ref clk, internal SSC */ 394862306a36Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_int_ssc_cmn_regs[] = { 394962306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 395062306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 395162306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 395262306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 395362306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 395462306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 395562306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 395662306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 395762306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 395862306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 395962306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 396062306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 396162306a36Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 396262306a36Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 396362306a36Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 396462306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 396562306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 396662306a36Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 396762306a36Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 396862306a36Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 396962306a36Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 397062306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 397162306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 397262306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 397362306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 397462306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 397562306a36Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 397662306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 397762306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 397862306a36Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 397962306a36Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 398062306a36Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 398162306a36Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 398262306a36Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 398362306a36Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 398462306a36Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 398562306a36Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 398662306a36Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 398762306a36Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 398862306a36Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 398962306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 399062306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 399162306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 399262306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 399362306a36Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 399462306a36Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 399562306a36Sopenharmony_ci {0x007F, CMN_TXPUCAL_TUNE}, 399662306a36Sopenharmony_ci {0x007F, CMN_TXPDCAL_TUNE} 399762306a36Sopenharmony_ci}; 399862306a36Sopenharmony_ci 399962306a36Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_int_ssc_cmn_vals = { 400062306a36Sopenharmony_ci .reg_pairs = qsgmii_100_int_ssc_cmn_regs, 400162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_int_ssc_cmn_regs), 400262306a36Sopenharmony_ci}; 400362306a36Sopenharmony_ci 400462306a36Sopenharmony_ci/* Single SGMII/QSGMII link configuration */ 400562306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_sgmii_link_cmn_regs[] = { 400662306a36Sopenharmony_ci {0x0000, PHY_PLL_CFG}, 400762306a36Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0} 400862306a36Sopenharmony_ci}; 400962306a36Sopenharmony_ci 401062306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_sgmii_xcvr_diag_ln_regs[] = { 401162306a36Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 401262306a36Sopenharmony_ci {0x0003, XCVR_DIAG_HSCLK_DIV}, 401362306a36Sopenharmony_ci {0x0013, XCVR_DIAG_PLLDRC_CTRL} 401462306a36Sopenharmony_ci}; 401562306a36Sopenharmony_ci 401662306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_sgmii_link_cmn_vals = { 401762306a36Sopenharmony_ci .reg_pairs = sl_sgmii_link_cmn_regs, 401862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_sgmii_link_cmn_regs), 401962306a36Sopenharmony_ci}; 402062306a36Sopenharmony_ci 402162306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_sgmii_xcvr_diag_ln_vals = { 402262306a36Sopenharmony_ci .reg_pairs = sl_sgmii_xcvr_diag_ln_regs, 402362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_sgmii_xcvr_diag_ln_regs), 402462306a36Sopenharmony_ci}; 402562306a36Sopenharmony_ci 402662306a36Sopenharmony_ci/* Multi link PCIe, 100 MHz Ref clk, internal SSC */ 402762306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_100_int_ssc_cmn_regs[] = { 402862306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 402962306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 403062306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 403162306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 403262306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 403362306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 403462306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 403562306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 403662306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 403762306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 403862306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 403962306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 404062306a36Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 404162306a36Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 404262306a36Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 404362306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 404462306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 404562306a36Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 404662306a36Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 404762306a36Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 404862306a36Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 404962306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 405062306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 405162306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 405262306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 405362306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 405462306a36Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 405562306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 405662306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 405762306a36Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 405862306a36Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 405962306a36Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 406062306a36Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 406162306a36Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 406262306a36Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 406362306a36Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 406462306a36Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 406562306a36Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 406662306a36Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 406762306a36Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 406862306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 406962306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 407062306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 407162306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 407262306a36Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 407362306a36Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR} 407462306a36Sopenharmony_ci}; 407562306a36Sopenharmony_ci 407662306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_100_int_ssc_cmn_vals = { 407762306a36Sopenharmony_ci .reg_pairs = pcie_100_int_ssc_cmn_regs, 407862306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_int_ssc_cmn_regs), 407962306a36Sopenharmony_ci}; 408062306a36Sopenharmony_ci 408162306a36Sopenharmony_ci/* Single link PCIe, 100 MHz Ref clk, internal SSC */ 408262306a36Sopenharmony_cistatic struct cdns_reg_pairs sl_pcie_100_int_ssc_cmn_regs[] = { 408362306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 408462306a36Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 408562306a36Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 408662306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 408762306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 408862306a36Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 408962306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 409062306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 409162306a36Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 409262306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 409362306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 409462306a36Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 409562306a36Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 409662306a36Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 409762306a36Sopenharmony_ci {0x0050, CMN_PLL1_INTDIV_M0}, 409862306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 409962306a36Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 410062306a36Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 410162306a36Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 410262306a36Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 410362306a36Sopenharmony_ci {0x0036, CMN_PLL1_HIGH_THR_M0}, 410462306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 410562306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 410662306a36Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 410762306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 410862306a36Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 410962306a36Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 411062306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 411162306a36Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 411262306a36Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 411362306a36Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 411462306a36Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 411562306a36Sopenharmony_ci {0x0058, CMN_PLL1_SS_CTRL3_M0}, 411662306a36Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 411762306a36Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 411862306a36Sopenharmony_ci {0x0012, CMN_PLL1_SS_CTRL4_M0}, 411962306a36Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 412062306a36Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 412162306a36Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 412262306a36Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 412362306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 412462306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 412562306a36Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 412662306a36Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 412762306a36Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 412862306a36Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR} 412962306a36Sopenharmony_ci}; 413062306a36Sopenharmony_ci 413162306a36Sopenharmony_cistatic struct cdns_torrent_vals sl_pcie_100_int_ssc_cmn_vals = { 413262306a36Sopenharmony_ci .reg_pairs = sl_pcie_100_int_ssc_cmn_regs, 413362306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_pcie_100_int_ssc_cmn_regs), 413462306a36Sopenharmony_ci}; 413562306a36Sopenharmony_ci 413662306a36Sopenharmony_ci/* PCIe, 100 MHz Ref clk, no SSC & external SSC */ 413762306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_100_ext_no_ssc_cmn_regs[] = { 413862306a36Sopenharmony_ci {0x0028, CMN_PDIAG_PLL1_CP_PADJ_M0}, 413962306a36Sopenharmony_ci {0x001E, CMN_PLL1_DSM_FBH_OVRD_M0}, 414062306a36Sopenharmony_ci {0x000C, CMN_PLL1_DSM_FBL_OVRD_M0} 414162306a36Sopenharmony_ci}; 414262306a36Sopenharmony_ci 414362306a36Sopenharmony_cistatic struct cdns_reg_pairs pcie_100_ext_no_ssc_rx_ln_regs[] = { 414462306a36Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 414562306a36Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 414662306a36Sopenharmony_ci {0x0001, RX_DIAG_ACYA} 414762306a36Sopenharmony_ci}; 414862306a36Sopenharmony_ci 414962306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_100_no_ssc_cmn_vals = { 415062306a36Sopenharmony_ci .reg_pairs = pcie_100_ext_no_ssc_cmn_regs, 415162306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_cmn_regs), 415262306a36Sopenharmony_ci}; 415362306a36Sopenharmony_ci 415462306a36Sopenharmony_cistatic struct cdns_torrent_vals pcie_100_no_ssc_rx_ln_vals = { 415562306a36Sopenharmony_ci .reg_pairs = pcie_100_ext_no_ssc_rx_ln_regs, 415662306a36Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_rx_ln_regs), 415762306a36Sopenharmony_ci}; 415862306a36Sopenharmony_ci 415962306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry link_cmn_vals_entries[] = { 416062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_NONE), &sl_dp_link_cmn_vals}, 416162306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_PCIE), &pcie_dp_link_cmn_vals}, 416262306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_USB), &usb_dp_link_cmn_vals}, 416362306a36Sopenharmony_ci 416462306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_NONE), NULL}, 416562306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_SGMII), &pcie_sgmii_link_cmn_vals}, 416662306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_QSGMII), &pcie_sgmii_link_cmn_vals}, 416762306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_USB), &pcie_usb_link_cmn_vals}, 416862306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_DP), &pcie_dp_link_cmn_vals}, 416962306a36Sopenharmony_ci 417062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_NONE), &sl_sgmii_link_cmn_vals}, 417162306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_PCIE), &pcie_sgmii_link_cmn_vals}, 417262306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_USB), &usb_sgmii_link_cmn_vals}, 417362306a36Sopenharmony_ci 417462306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_NONE), &sl_sgmii_link_cmn_vals}, 417562306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_PCIE), &pcie_sgmii_link_cmn_vals}, 417662306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_USB), &usb_sgmii_link_cmn_vals}, 417762306a36Sopenharmony_ci 417862306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &sl_usb_link_cmn_vals}, 417962306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &pcie_usb_link_cmn_vals}, 418062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_sgmii_link_cmn_vals}, 418162306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_sgmii_link_cmn_vals}, 418262306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_dp_link_cmn_vals}, 418362306a36Sopenharmony_ci 418462306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &sl_usxgmii_link_cmn_vals}, 418562306a36Sopenharmony_ci}; 418662306a36Sopenharmony_ci 418762306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry xcvr_diag_vals_entries[] = { 418862306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_NONE), &sl_dp_xcvr_diag_ln_vals}, 418962306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_PCIE), &dp_pcie_xcvr_diag_ln_vals}, 419062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_DP, TYPE_USB), &dp_usb_xcvr_diag_ln_vals}, 419162306a36Sopenharmony_ci 419262306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_NONE), NULL}, 419362306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_SGMII), &pcie_sgmii_xcvr_diag_ln_vals}, 419462306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_QSGMII), &pcie_sgmii_xcvr_diag_ln_vals}, 419562306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_USB), &pcie_usb_xcvr_diag_ln_vals}, 419662306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_PCIE, TYPE_DP), &pcie_dp_xcvr_diag_ln_vals}, 419762306a36Sopenharmony_ci 419862306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_NONE), &sl_sgmii_xcvr_diag_ln_vals}, 419962306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_PCIE), &sgmii_pcie_xcvr_diag_ln_vals}, 420062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_SGMII, TYPE_USB), &sgmii_usb_xcvr_diag_ln_vals}, 420162306a36Sopenharmony_ci 420262306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_NONE), &sl_sgmii_xcvr_diag_ln_vals}, 420362306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_PCIE), &sgmii_pcie_xcvr_diag_ln_vals}, 420462306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_QSGMII, TYPE_USB), &sgmii_usb_xcvr_diag_ln_vals}, 420562306a36Sopenharmony_ci 420662306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &sl_usb_xcvr_diag_ln_vals}, 420762306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &usb_pcie_xcvr_diag_ln_vals}, 420862306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_sgmii_xcvr_diag_ln_vals}, 420962306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_sgmii_xcvr_diag_ln_vals}, 421062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_dp_xcvr_diag_ln_vals}, 421162306a36Sopenharmony_ci 421262306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &sl_usxgmii_xcvr_diag_ln_vals}, 421362306a36Sopenharmony_ci}; 421462306a36Sopenharmony_ci 421562306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry pcs_cmn_vals_entries[] = { 421662306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_NONE), &usb_phy_pcs_cmn_vals}, 421762306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_PCIE), &usb_phy_pcs_cmn_vals}, 421862306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_SGMII), &usb_phy_pcs_cmn_vals}, 421962306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_QSGMII), &usb_phy_pcs_cmn_vals}, 422062306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USB, TYPE_DP), &usb_phy_pcs_cmn_vals}, 422162306a36Sopenharmony_ci}; 422262306a36Sopenharmony_ci 422362306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry cmn_vals_entries[] = { 422462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_cmn_vals}, 422562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_cmn_vals}, 422662306a36Sopenharmony_ci 422762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_cmn_vals}, 422862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_cmn_vals}, 422962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &sl_dp_100_no_ssc_cmn_vals}, 423062306a36Sopenharmony_ci 423162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL}, 423262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL}, 423362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), &sl_pcie_100_int_ssc_cmn_vals}, 423462306a36Sopenharmony_ci 423562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), &pcie_100_no_ssc_cmn_vals}, 423662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals}, 423762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals}, 423862306a36Sopenharmony_ci 423962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), &pcie_100_no_ssc_cmn_vals}, 424062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals}, 424162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals}, 424262306a36Sopenharmony_ci 424362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), &pcie_100_no_ssc_cmn_vals}, 424462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_cmn_vals}, 424562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), &pcie_100_int_ssc_cmn_vals}, 424662306a36Sopenharmony_ci 424762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL}, 424862306a36Sopenharmony_ci 424962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sl_sgmii_100_no_ssc_cmn_vals}, 425062306a36Sopenharmony_ci 425162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_cmn_vals}, 425262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals}, 425362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_int_ssc_cmn_vals}, 425462306a36Sopenharmony_ci 425562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_cmn_vals}, 425662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals}, 425762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_cmn_vals}, 425862306a36Sopenharmony_ci 425962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &sl_qsgmii_100_no_ssc_cmn_vals}, 426062306a36Sopenharmony_ci 426162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_cmn_vals}, 426262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals}, 426362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_int_ssc_cmn_vals}, 426462306a36Sopenharmony_ci 426562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_cmn_vals}, 426662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals}, 426762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_cmn_vals}, 426862306a36Sopenharmony_ci 426962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &sl_usb_100_no_ssc_cmn_vals}, 427062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals}, 427162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals}, 427262306a36Sopenharmony_ci 427362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_cmn_vals}, 427462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_cmn_vals}, 427562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_int_ssc_cmn_vals}, 427662306a36Sopenharmony_ci 427762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &sl_usb_100_no_ssc_cmn_vals}, 427862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals}, 427962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals}, 428062306a36Sopenharmony_ci 428162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &sl_usb_100_no_ssc_cmn_vals}, 428262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &sl_usb_100_no_ssc_cmn_vals}, 428362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &sl_usb_100_int_ssc_cmn_vals}, 428462306a36Sopenharmony_ci 428562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_cmn_vals}, 428662306a36Sopenharmony_ci 428762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &sl_usxgmii_156_25_no_ssc_cmn_vals}, 428862306a36Sopenharmony_ci}; 428962306a36Sopenharmony_ci 429062306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry cdns_tx_ln_vals_entries[] = { 429162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals}, 429262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals}, 429362306a36Sopenharmony_ci 429462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_tx_ln_vals}, 429562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_tx_ln_vals}, 429662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_tx_ln_vals}, 429762306a36Sopenharmony_ci 429862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL}, 429962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL}, 430062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), NULL}, 430162306a36Sopenharmony_ci 430262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), NULL}, 430362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), NULL}, 430462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), NULL}, 430562306a36Sopenharmony_ci 430662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), NULL}, 430762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), NULL}, 430862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), NULL}, 430962306a36Sopenharmony_ci 431062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), NULL}, 431162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), NULL}, 431262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), NULL}, 431362306a36Sopenharmony_ci 431462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL}, 431562306a36Sopenharmony_ci 431662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 431762306a36Sopenharmony_ci 431862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 431962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 432062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 432162306a36Sopenharmony_ci 432262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 432362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 432462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_tx_ln_vals}, 432562306a36Sopenharmony_ci 432662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 432762306a36Sopenharmony_ci 432862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 432962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 433062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 433162306a36Sopenharmony_ci 433262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 433362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 433462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_tx_ln_vals}, 433562306a36Sopenharmony_ci 433662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 433762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 433862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 433962306a36Sopenharmony_ci 434062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 434162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 434262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 434362306a36Sopenharmony_ci 434462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 434562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 434662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 434762306a36Sopenharmony_ci 434862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 434962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 435062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 435162306a36Sopenharmony_ci 435262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 435362306a36Sopenharmony_ci 435462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals}, 435562306a36Sopenharmony_ci}; 435662306a36Sopenharmony_ci 435762306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry cdns_rx_ln_vals_entries[] = { 435862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_rx_ln_vals}, 435962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_rx_ln_vals}, 436062306a36Sopenharmony_ci 436162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_rx_ln_vals}, 436262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_rx_ln_vals}, 436362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_rx_ln_vals}, 436462306a36Sopenharmony_ci 436562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), &pcie_100_no_ssc_rx_ln_vals}, 436662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 436762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 436862306a36Sopenharmony_ci 436962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437262306a36Sopenharmony_ci 437362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437662306a36Sopenharmony_ci 437762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 437962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), &pcie_100_no_ssc_rx_ln_vals}, 438062306a36Sopenharmony_ci 438162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), &pcie_100_no_ssc_rx_ln_vals}, 438262306a36Sopenharmony_ci 438362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 438462306a36Sopenharmony_ci 438562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 438662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 438762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 438862306a36Sopenharmony_ci 438962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 439062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 439162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &sgmii_100_no_ssc_rx_ln_vals}, 439262306a36Sopenharmony_ci 439362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 439462306a36Sopenharmony_ci 439562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 439662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 439762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 439862306a36Sopenharmony_ci 439962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 440062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 440162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &qsgmii_100_no_ssc_rx_ln_vals}, 440262306a36Sopenharmony_ci 440362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_rx_ln_vals}, 440462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 440562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 440662306a36Sopenharmony_ci 440762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_rx_ln_vals}, 440862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 440962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 441062306a36Sopenharmony_ci 441162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_rx_ln_vals}, 441262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 441362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 441462306a36Sopenharmony_ci 441562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_rx_ln_vals}, 441662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 441762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_rx_ln_vals}, 441862306a36Sopenharmony_ci 441962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_rx_ln_vals}, 442062306a36Sopenharmony_ci 442162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_rx_ln_vals}, 442262306a36Sopenharmony_ci}; 442362306a36Sopenharmony_ci 442462306a36Sopenharmony_cistatic const struct cdns_torrent_data cdns_map_torrent = { 442562306a36Sopenharmony_ci .block_offset_shift = 0x2, 442662306a36Sopenharmony_ci .reg_offset_shift = 0x2, 442762306a36Sopenharmony_ci .link_cmn_vals_tbl = { 442862306a36Sopenharmony_ci .entries = link_cmn_vals_entries, 442962306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(link_cmn_vals_entries), 443062306a36Sopenharmony_ci }, 443162306a36Sopenharmony_ci .xcvr_diag_vals_tbl = { 443262306a36Sopenharmony_ci .entries = xcvr_diag_vals_entries, 443362306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(xcvr_diag_vals_entries), 443462306a36Sopenharmony_ci }, 443562306a36Sopenharmony_ci .pcs_cmn_vals_tbl = { 443662306a36Sopenharmony_ci .entries = pcs_cmn_vals_entries, 443762306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(pcs_cmn_vals_entries), 443862306a36Sopenharmony_ci }, 443962306a36Sopenharmony_ci .cmn_vals_tbl = { 444062306a36Sopenharmony_ci .entries = cmn_vals_entries, 444162306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(cmn_vals_entries), 444262306a36Sopenharmony_ci }, 444362306a36Sopenharmony_ci .tx_ln_vals_tbl = { 444462306a36Sopenharmony_ci .entries = cdns_tx_ln_vals_entries, 444562306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(cdns_tx_ln_vals_entries), 444662306a36Sopenharmony_ci }, 444762306a36Sopenharmony_ci .rx_ln_vals_tbl = { 444862306a36Sopenharmony_ci .entries = cdns_rx_ln_vals_entries, 444962306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(cdns_rx_ln_vals_entries), 445062306a36Sopenharmony_ci }, 445162306a36Sopenharmony_ci}; 445262306a36Sopenharmony_ci 445362306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry j721e_phy_pma_cmn_vals_entries[] = { 445462306a36Sopenharmony_ci {CDNS_TORRENT_KEY_ANYCLK(TYPE_USXGMII, TYPE_NONE), &ti_usxgmii_phy_pma_cmn_vals}, 445562306a36Sopenharmony_ci}; 445662306a36Sopenharmony_ci 445762306a36Sopenharmony_cistatic struct cdns_torrent_vals_entry ti_tx_ln_vals_entries[] = { 445862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_19_2_MHZ, CLK_19_2_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_19_2_no_ssc_tx_ln_vals}, 445962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_25_MHZ, CLK_25_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_25_no_ssc_tx_ln_vals}, 446062306a36Sopenharmony_ci 446162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_NONE, NO_SSC), &sl_dp_100_no_ssc_tx_ln_vals}, 446262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_PCIE, NO_SSC), &dp_100_no_ssc_tx_ln_vals}, 446362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_DP, TYPE_USB, NO_SSC), &dp_100_no_ssc_tx_ln_vals}, 446462306a36Sopenharmony_ci 446562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, NO_SSC), NULL}, 446662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, EXTERNAL_SSC), NULL}, 446762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_NONE, INTERNAL_SSC), NULL}, 446862306a36Sopenharmony_ci 446962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, NO_SSC), NULL}, 447062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, EXTERNAL_SSC), NULL}, 447162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_SGMII, INTERNAL_SSC), NULL}, 447262306a36Sopenharmony_ci 447362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, NO_SSC), NULL}, 447462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, EXTERNAL_SSC), NULL}, 447562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_QSGMII, INTERNAL_SSC), NULL}, 447662306a36Sopenharmony_ci 447762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, NO_SSC), NULL}, 447862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, EXTERNAL_SSC), NULL}, 447962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_USB, INTERNAL_SSC), NULL}, 448062306a36Sopenharmony_ci 448162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_PCIE, TYPE_DP, NO_SSC), NULL}, 448262306a36Sopenharmony_ci 448362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_NONE, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 448462306a36Sopenharmony_ci 448562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 448662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, EXTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 448762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_PCIE, INTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 448862306a36Sopenharmony_ci 448962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, NO_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 449062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, EXTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 449162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_SGMII, TYPE_USB, INTERNAL_SSC), &ti_sgmii_100_no_ssc_tx_ln_vals}, 449262306a36Sopenharmony_ci 449362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_NONE, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 449462306a36Sopenharmony_ci 449562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 449662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, EXTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 449762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_PCIE, INTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 449862306a36Sopenharmony_ci 449962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, NO_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 450062306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, EXTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 450162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_QSGMII, TYPE_USB, INTERNAL_SSC), &ti_qsgmii_100_no_ssc_tx_ln_vals}, 450262306a36Sopenharmony_ci 450362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 450462306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 450562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_NONE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 450662306a36Sopenharmony_ci 450762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 450862306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 450962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_PCIE, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 451062306a36Sopenharmony_ci 451162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 451262306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 451362306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_SGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 451462306a36Sopenharmony_ci 451562306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 451662306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, EXTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 451762306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_QSGMII, INTERNAL_SSC), &usb_100_no_ssc_tx_ln_vals}, 451862306a36Sopenharmony_ci 451962306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_100_MHZ, CLK_100_MHZ, TYPE_USB, TYPE_DP, NO_SSC), &usb_100_no_ssc_tx_ln_vals}, 452062306a36Sopenharmony_ci 452162306a36Sopenharmony_ci {CDNS_TORRENT_KEY(CLK_156_25_MHZ, CLK_156_25_MHZ, TYPE_USXGMII, TYPE_NONE, NO_SSC), &usxgmii_156_25_no_ssc_tx_ln_vals}, 452262306a36Sopenharmony_ci}; 452362306a36Sopenharmony_ci 452462306a36Sopenharmony_cistatic const struct cdns_torrent_data ti_j721e_map_torrent = { 452562306a36Sopenharmony_ci .block_offset_shift = 0x0, 452662306a36Sopenharmony_ci .reg_offset_shift = 0x1, 452762306a36Sopenharmony_ci .link_cmn_vals_tbl = { 452862306a36Sopenharmony_ci .entries = link_cmn_vals_entries, 452962306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(link_cmn_vals_entries), 453062306a36Sopenharmony_ci }, 453162306a36Sopenharmony_ci .xcvr_diag_vals_tbl = { 453262306a36Sopenharmony_ci .entries = xcvr_diag_vals_entries, 453362306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(xcvr_diag_vals_entries), 453462306a36Sopenharmony_ci }, 453562306a36Sopenharmony_ci .pcs_cmn_vals_tbl = { 453662306a36Sopenharmony_ci .entries = pcs_cmn_vals_entries, 453762306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(pcs_cmn_vals_entries), 453862306a36Sopenharmony_ci }, 453962306a36Sopenharmony_ci .phy_pma_cmn_vals_tbl = { 454062306a36Sopenharmony_ci .entries = j721e_phy_pma_cmn_vals_entries, 454162306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(j721e_phy_pma_cmn_vals_entries), 454262306a36Sopenharmony_ci }, 454362306a36Sopenharmony_ci .cmn_vals_tbl = { 454462306a36Sopenharmony_ci .entries = cmn_vals_entries, 454562306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(cmn_vals_entries), 454662306a36Sopenharmony_ci }, 454762306a36Sopenharmony_ci .tx_ln_vals_tbl = { 454862306a36Sopenharmony_ci .entries = ti_tx_ln_vals_entries, 454962306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(ti_tx_ln_vals_entries), 455062306a36Sopenharmony_ci }, 455162306a36Sopenharmony_ci .rx_ln_vals_tbl = { 455262306a36Sopenharmony_ci .entries = cdns_rx_ln_vals_entries, 455362306a36Sopenharmony_ci .num_entries = ARRAY_SIZE(cdns_rx_ln_vals_entries), 455462306a36Sopenharmony_ci }, 455562306a36Sopenharmony_ci}; 455662306a36Sopenharmony_ci 455762306a36Sopenharmony_cistatic const struct of_device_id cdns_torrent_phy_of_match[] = { 455862306a36Sopenharmony_ci { 455962306a36Sopenharmony_ci .compatible = "cdns,torrent-phy", 456062306a36Sopenharmony_ci .data = &cdns_map_torrent, 456162306a36Sopenharmony_ci }, 456262306a36Sopenharmony_ci { 456362306a36Sopenharmony_ci .compatible = "ti,j721e-serdes-10g", 456462306a36Sopenharmony_ci .data = &ti_j721e_map_torrent, 456562306a36Sopenharmony_ci }, 456662306a36Sopenharmony_ci {} 456762306a36Sopenharmony_ci}; 456862306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, cdns_torrent_phy_of_match); 456962306a36Sopenharmony_ci 457062306a36Sopenharmony_cistatic struct platform_driver cdns_torrent_phy_driver = { 457162306a36Sopenharmony_ci .probe = cdns_torrent_phy_probe, 457262306a36Sopenharmony_ci .remove_new = cdns_torrent_phy_remove, 457362306a36Sopenharmony_ci .driver = { 457462306a36Sopenharmony_ci .name = "cdns-torrent-phy", 457562306a36Sopenharmony_ci .of_match_table = cdns_torrent_phy_of_match, 457662306a36Sopenharmony_ci } 457762306a36Sopenharmony_ci}; 457862306a36Sopenharmony_cimodule_platform_driver(cdns_torrent_phy_driver); 457962306a36Sopenharmony_ci 458062306a36Sopenharmony_ciMODULE_AUTHOR("Cadence Design Systems, Inc."); 458162306a36Sopenharmony_ciMODULE_DESCRIPTION("Cadence Torrent PHY driver"); 458262306a36Sopenharmony_ciMODULE_LICENSE("GPL v2"); 4583