18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Cadence Torrent SD0801 PHY driver. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2018 Cadence Design Systems, Inc. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <dt-bindings/phy/phy.h> 108c2ecf20Sopenharmony_ci#include <linux/clk.h> 118c2ecf20Sopenharmony_ci#include <linux/delay.h> 128c2ecf20Sopenharmony_ci#include <linux/err.h> 138c2ecf20Sopenharmony_ci#include <linux/io.h> 148c2ecf20Sopenharmony_ci#include <linux/iopoll.h> 158c2ecf20Sopenharmony_ci#include <linux/kernel.h> 168c2ecf20Sopenharmony_ci#include <linux/module.h> 178c2ecf20Sopenharmony_ci#include <linux/of.h> 188c2ecf20Sopenharmony_ci#include <linux/of_address.h> 198c2ecf20Sopenharmony_ci#include <linux/of_device.h> 208c2ecf20Sopenharmony_ci#include <linux/phy/phy.h> 218c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 228c2ecf20Sopenharmony_ci#include <linux/reset.h> 238c2ecf20Sopenharmony_ci#include <linux/regmap.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define REF_CLK_19_2MHz 19200000 268c2ecf20Sopenharmony_ci#define REF_CLK_25MHz 25000000 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define MAX_NUM_LANES 4 298c2ecf20Sopenharmony_ci#define DEFAULT_MAX_BIT_RATE 8100 /* in Mbps */ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define NUM_SSC_MODE 3 328c2ecf20Sopenharmony_ci#define NUM_PHY_TYPE 6 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define POLL_TIMEOUT_US 5000 358c2ecf20Sopenharmony_ci#define PLL_LOCK_TIMEOUT 100000 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define TORRENT_COMMON_CDB_OFFSET 0x0 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define TORRENT_TX_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 408c2ecf20Sopenharmony_ci ((0x4000 << (block_offset)) + \ 418c2ecf20Sopenharmony_ci (((ln) << 9) << (reg_offset))) 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define TORRENT_RX_LANE_CDB_OFFSET(ln, block_offset, reg_offset) \ 448c2ecf20Sopenharmony_ci ((0x8000 << (block_offset)) + \ 458c2ecf20Sopenharmony_ci (((ln) << 9) << (reg_offset))) 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define TORRENT_PHY_PCS_COMMON_OFFSET(block_offset) \ 488c2ecf20Sopenharmony_ci (0xC000 << (block_offset)) 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define TORRENT_PHY_PMA_COMMON_OFFSET(block_offset) \ 518c2ecf20Sopenharmony_ci (0xE000 << (block_offset)) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define TORRENT_DPTX_PHY_OFFSET 0x0 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* 568c2ecf20Sopenharmony_ci * register offsets from DPTX PHY register block base (i.e MHDP 578c2ecf20Sopenharmony_ci * register base + 0x30a00) 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_ci#define PHY_AUX_CTRL 0x04 608c2ecf20Sopenharmony_ci#define PHY_RESET 0x20 618c2ecf20Sopenharmony_ci#define PMA_TX_ELEC_IDLE_MASK 0xF0U 628c2ecf20Sopenharmony_ci#define PMA_TX_ELEC_IDLE_SHIFT 4 638c2ecf20Sopenharmony_ci#define PHY_L00_RESET_N_MASK 0x01U 648c2ecf20Sopenharmony_ci#define PHY_PMA_XCVR_PLLCLK_EN 0x24 658c2ecf20Sopenharmony_ci#define PHY_PMA_XCVR_PLLCLK_EN_ACK 0x28 668c2ecf20Sopenharmony_ci#define PHY_PMA_XCVR_POWER_STATE_REQ 0x2c 678c2ecf20Sopenharmony_ci#define PHY_POWER_STATE_LN_0 0x0000 688c2ecf20Sopenharmony_ci#define PHY_POWER_STATE_LN_1 0x0008 698c2ecf20Sopenharmony_ci#define PHY_POWER_STATE_LN_2 0x0010 708c2ecf20Sopenharmony_ci#define PHY_POWER_STATE_LN_3 0x0018 718c2ecf20Sopenharmony_ci#define PMA_XCVR_POWER_STATE_REQ_LN_MASK 0x3FU 728c2ecf20Sopenharmony_ci#define PHY_PMA_XCVR_POWER_STATE_ACK 0x30 738c2ecf20Sopenharmony_ci#define PHY_PMA_CMN_READY 0x34 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci/* 768c2ecf20Sopenharmony_ci * register offsets from SD0801 PHY register block base (i.e MHDP 778c2ecf20Sopenharmony_ci * register base + 0x500000) 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_ci#define CMN_SSM_BANDGAP_TMR 0x0021U 808c2ecf20Sopenharmony_ci#define CMN_SSM_BIAS_TMR 0x0022U 818c2ecf20Sopenharmony_ci#define CMN_PLLSM0_PLLPRE_TMR 0x002AU 828c2ecf20Sopenharmony_ci#define CMN_PLLSM0_PLLLOCK_TMR 0x002CU 838c2ecf20Sopenharmony_ci#define CMN_PLLSM1_PLLPRE_TMR 0x0032U 848c2ecf20Sopenharmony_ci#define CMN_PLLSM1_PLLLOCK_TMR 0x0034U 858c2ecf20Sopenharmony_ci#define CMN_CDIAG_CDB_PWRI_OVRD 0x0041U 868c2ecf20Sopenharmony_ci#define CMN_CDIAG_XCVRC_PWRI_OVRD 0x0047U 878c2ecf20Sopenharmony_ci#define CMN_BGCAL_INIT_TMR 0x0064U 888c2ecf20Sopenharmony_ci#define CMN_BGCAL_ITER_TMR 0x0065U 898c2ecf20Sopenharmony_ci#define CMN_IBCAL_INIT_TMR 0x0074U 908c2ecf20Sopenharmony_ci#define CMN_PLL0_VCOCAL_TCTRL 0x0082U 918c2ecf20Sopenharmony_ci#define CMN_PLL0_VCOCAL_INIT_TMR 0x0084U 928c2ecf20Sopenharmony_ci#define CMN_PLL0_VCOCAL_ITER_TMR 0x0085U 938c2ecf20Sopenharmony_ci#define CMN_PLL0_VCOCAL_REFTIM_START 0x0086U 948c2ecf20Sopenharmony_ci#define CMN_PLL0_VCOCAL_PLLCNT_START 0x0088U 958c2ecf20Sopenharmony_ci#define CMN_PLL0_INTDIV_M0 0x0090U 968c2ecf20Sopenharmony_ci#define CMN_PLL0_FRACDIVL_M0 0x0091U 978c2ecf20Sopenharmony_ci#define CMN_PLL0_FRACDIVH_M0 0x0092U 988c2ecf20Sopenharmony_ci#define CMN_PLL0_HIGH_THR_M0 0x0093U 998c2ecf20Sopenharmony_ci#define CMN_PLL0_DSM_DIAG_M0 0x0094U 1008c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL1_M0 0x0098U 1018c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL2_M0 0x0099U 1028c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL3_M0 0x009AU 1038c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL4_M0 0x009BU 1048c2ecf20Sopenharmony_ci#define CMN_PLL0_LOCK_REFCNT_START 0x009CU 1058c2ecf20Sopenharmony_ci#define CMN_PLL0_LOCK_PLLCNT_START 0x009EU 1068c2ecf20Sopenharmony_ci#define CMN_PLL0_LOCK_PLLCNT_THR 0x009FU 1078c2ecf20Sopenharmony_ci#define CMN_PLL0_INTDIV_M1 0x00A0U 1088c2ecf20Sopenharmony_ci#define CMN_PLL0_FRACDIVH_M1 0x00A2U 1098c2ecf20Sopenharmony_ci#define CMN_PLL0_HIGH_THR_M1 0x00A3U 1108c2ecf20Sopenharmony_ci#define CMN_PLL0_DSM_DIAG_M1 0x00A4U 1118c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL1_M1 0x00A8U 1128c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL2_M1 0x00A9U 1138c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL3_M1 0x00AAU 1148c2ecf20Sopenharmony_ci#define CMN_PLL0_SS_CTRL4_M1 0x00ABU 1158c2ecf20Sopenharmony_ci#define CMN_PLL1_VCOCAL_TCTRL 0x00C2U 1168c2ecf20Sopenharmony_ci#define CMN_PLL1_VCOCAL_INIT_TMR 0x00C4U 1178c2ecf20Sopenharmony_ci#define CMN_PLL1_VCOCAL_ITER_TMR 0x00C5U 1188c2ecf20Sopenharmony_ci#define CMN_PLL1_VCOCAL_REFTIM_START 0x00C6U 1198c2ecf20Sopenharmony_ci#define CMN_PLL1_VCOCAL_PLLCNT_START 0x00C8U 1208c2ecf20Sopenharmony_ci#define CMN_PLL1_INTDIV_M0 0x00D0U 1218c2ecf20Sopenharmony_ci#define CMN_PLL1_FRACDIVL_M0 0x00D1U 1228c2ecf20Sopenharmony_ci#define CMN_PLL1_FRACDIVH_M0 0x00D2U 1238c2ecf20Sopenharmony_ci#define CMN_PLL1_HIGH_THR_M0 0x00D3U 1248c2ecf20Sopenharmony_ci#define CMN_PLL1_DSM_DIAG_M0 0x00D4U 1258c2ecf20Sopenharmony_ci#define CMN_PLL1_SS_CTRL1_M0 0x00D8U 1268c2ecf20Sopenharmony_ci#define CMN_PLL1_SS_CTRL2_M0 0x00D9U 1278c2ecf20Sopenharmony_ci#define CMN_PLL1_SS_CTRL3_M0 0x00DAU 1288c2ecf20Sopenharmony_ci#define CMN_PLL1_SS_CTRL4_M0 0x00DBU 1298c2ecf20Sopenharmony_ci#define CMN_PLL1_LOCK_REFCNT_START 0x00DCU 1308c2ecf20Sopenharmony_ci#define CMN_PLL1_LOCK_PLLCNT_START 0x00DEU 1318c2ecf20Sopenharmony_ci#define CMN_PLL1_LOCK_PLLCNT_THR 0x00DFU 1328c2ecf20Sopenharmony_ci#define CMN_TXPUCAL_TUNE 0x0103U 1338c2ecf20Sopenharmony_ci#define CMN_TXPUCAL_INIT_TMR 0x0104U 1348c2ecf20Sopenharmony_ci#define CMN_TXPUCAL_ITER_TMR 0x0105U 1358c2ecf20Sopenharmony_ci#define CMN_TXPDCAL_TUNE 0x010BU 1368c2ecf20Sopenharmony_ci#define CMN_TXPDCAL_INIT_TMR 0x010CU 1378c2ecf20Sopenharmony_ci#define CMN_TXPDCAL_ITER_TMR 0x010DU 1388c2ecf20Sopenharmony_ci#define CMN_RXCAL_INIT_TMR 0x0114U 1398c2ecf20Sopenharmony_ci#define CMN_RXCAL_ITER_TMR 0x0115U 1408c2ecf20Sopenharmony_ci#define CMN_SD_CAL_INIT_TMR 0x0124U 1418c2ecf20Sopenharmony_ci#define CMN_SD_CAL_ITER_TMR 0x0125U 1428c2ecf20Sopenharmony_ci#define CMN_SD_CAL_REFTIM_START 0x0126U 1438c2ecf20Sopenharmony_ci#define CMN_SD_CAL_PLLCNT_START 0x0128U 1448c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CTRL_M0 0x01A0U 1458c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CLK_SEL_M0 0x01A1U 1468c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_PADJ_M0 0x01A4U 1478c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_IADJ_M0 0x01A5U 1488c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_FILT_PADJ_M0 0x01A6U 1498c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CTRL_M1 0x01B0U 1508c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CLK_SEL_M1 0x01B1U 1518c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_PADJ_M1 0x01B4U 1528c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_CP_IADJ_M1 0x01B5U 1538c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL0_FILT_PADJ_M1 0x01B6U 1548c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL1_CTRL_M0 0x01C0U 1558c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL1_CLK_SEL_M0 0x01C1U 1568c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL1_CP_PADJ_M0 0x01C4U 1578c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL1_CP_IADJ_M0 0x01C5U 1588c2ecf20Sopenharmony_ci#define CMN_PDIAG_PLL1_FILT_PADJ_M0 0x01C6U 1598c2ecf20Sopenharmony_ci#define CMN_DIAG_BIAS_OVRD1 0x01E1U 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/* PMA TX Lane registers */ 1628c2ecf20Sopenharmony_ci#define TX_TXCC_CTRL 0x0040U 1638c2ecf20Sopenharmony_ci#define TX_TXCC_CPOST_MULT_00 0x004CU 1648c2ecf20Sopenharmony_ci#define TX_TXCC_CPOST_MULT_01 0x004DU 1658c2ecf20Sopenharmony_ci#define TX_TXCC_MGNFS_MULT_000 0x0050U 1668c2ecf20Sopenharmony_ci#define DRV_DIAG_TX_DRV 0x00C6U 1678c2ecf20Sopenharmony_ci#define XCVR_DIAG_PLLDRC_CTRL 0x00E5U 1688c2ecf20Sopenharmony_ci#define XCVR_DIAG_HSCLK_SEL 0x00E6U 1698c2ecf20Sopenharmony_ci#define XCVR_DIAG_HSCLK_DIV 0x00E7U 1708c2ecf20Sopenharmony_ci#define XCVR_DIAG_BIDI_CTRL 0x00EAU 1718c2ecf20Sopenharmony_ci#define XCVR_DIAG_PSC_OVRD 0x00EBU 1728c2ecf20Sopenharmony_ci#define TX_PSC_A0 0x0100U 1738c2ecf20Sopenharmony_ci#define TX_PSC_A1 0x0101U 1748c2ecf20Sopenharmony_ci#define TX_PSC_A2 0x0102U 1758c2ecf20Sopenharmony_ci#define TX_PSC_A3 0x0103U 1768c2ecf20Sopenharmony_ci#define TX_RCVDET_ST_TMR 0x0123U 1778c2ecf20Sopenharmony_ci#define TX_DIAG_ACYA 0x01E7U 1788c2ecf20Sopenharmony_ci#define TX_DIAG_ACYA_HBDC_MASK 0x0001U 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci/* PMA RX Lane registers */ 1818c2ecf20Sopenharmony_ci#define RX_PSC_A0 0x0000U 1828c2ecf20Sopenharmony_ci#define RX_PSC_A1 0x0001U 1838c2ecf20Sopenharmony_ci#define RX_PSC_A2 0x0002U 1848c2ecf20Sopenharmony_ci#define RX_PSC_A3 0x0003U 1858c2ecf20Sopenharmony_ci#define RX_PSC_CAL 0x0006U 1868c2ecf20Sopenharmony_ci#define RX_CDRLF_CNFG 0x0080U 1878c2ecf20Sopenharmony_ci#define RX_CDRLF_CNFG3 0x0082U 1888c2ecf20Sopenharmony_ci#define RX_SIGDET_HL_FILT_TMR 0x0090U 1898c2ecf20Sopenharmony_ci#define RX_REE_GCSM1_CTRL 0x0108U 1908c2ecf20Sopenharmony_ci#define RX_REE_GCSM1_EQENM_PH1 0x0109U 1918c2ecf20Sopenharmony_ci#define RX_REE_GCSM1_EQENM_PH2 0x010AU 1928c2ecf20Sopenharmony_ci#define RX_REE_GCSM2_CTRL 0x0110U 1938c2ecf20Sopenharmony_ci#define RX_REE_PERGCSM_CTRL 0x0118U 1948c2ecf20Sopenharmony_ci#define RX_REE_ATTEN_THR 0x0149U 1958c2ecf20Sopenharmony_ci#define RX_REE_TAP1_CLIP 0x0171U 1968c2ecf20Sopenharmony_ci#define RX_REE_TAP2TON_CLIP 0x0172U 1978c2ecf20Sopenharmony_ci#define RX_REE_SMGM_CTRL1 0x0177U 1988c2ecf20Sopenharmony_ci#define RX_REE_SMGM_CTRL2 0x0178U 1998c2ecf20Sopenharmony_ci#define RX_DIAG_DFE_CTRL 0x01E0U 2008c2ecf20Sopenharmony_ci#define RX_DIAG_DFE_AMP_TUNE_2 0x01E2U 2018c2ecf20Sopenharmony_ci#define RX_DIAG_DFE_AMP_TUNE_3 0x01E3U 2028c2ecf20Sopenharmony_ci#define RX_DIAG_NQST_CTRL 0x01E5U 2038c2ecf20Sopenharmony_ci#define RX_DIAG_SIGDET_TUNE 0x01E8U 2048c2ecf20Sopenharmony_ci#define RX_DIAG_PI_RATE 0x01F4U 2058c2ecf20Sopenharmony_ci#define RX_DIAG_PI_CAP 0x01F5U 2068c2ecf20Sopenharmony_ci#define RX_DIAG_ACYA 0x01FFU 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci/* PHY PCS common registers */ 2098c2ecf20Sopenharmony_ci#define PHY_PLL_CFG 0x000EU 2108c2ecf20Sopenharmony_ci#define PHY_PIPE_USB3_GEN2_PRE_CFG0 0x0020U 2118c2ecf20Sopenharmony_ci#define PHY_PIPE_USB3_GEN2_POST_CFG0 0x0022U 2128c2ecf20Sopenharmony_ci#define PHY_PIPE_USB3_GEN2_POST_CFG1 0x0023U 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* PHY PMA common registers */ 2158c2ecf20Sopenharmony_ci#define PHY_PMA_CMN_CTRL1 0x0000U 2168c2ecf20Sopenharmony_ci#define PHY_PMA_CMN_CTRL2 0x0001U 2178c2ecf20Sopenharmony_ci#define PHY_PMA_PLL_RAW_CTRL 0x0003U 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_cistatic const struct reg_field phy_pll_cfg = 2208c2ecf20Sopenharmony_ci REG_FIELD(PHY_PLL_CFG, 0, 1); 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_cistatic const struct reg_field phy_pma_cmn_ctrl_1 = 2238c2ecf20Sopenharmony_ci REG_FIELD(PHY_PMA_CMN_CTRL1, 0, 0); 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_cistatic const struct reg_field phy_pma_cmn_ctrl_2 = 2268c2ecf20Sopenharmony_ci REG_FIELD(PHY_PMA_CMN_CTRL2, 0, 7); 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic const struct reg_field phy_pma_pll_raw_ctrl = 2298c2ecf20Sopenharmony_ci REG_FIELD(PHY_PMA_PLL_RAW_CTRL, 0, 1); 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_cistatic const struct reg_field phy_reset_ctrl = 2328c2ecf20Sopenharmony_ci REG_FIELD(PHY_RESET, 8, 8); 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_cienum cdns_torrent_phy_type { 2358c2ecf20Sopenharmony_ci TYPE_NONE, 2368c2ecf20Sopenharmony_ci TYPE_DP, 2378c2ecf20Sopenharmony_ci TYPE_PCIE, 2388c2ecf20Sopenharmony_ci TYPE_SGMII, 2398c2ecf20Sopenharmony_ci TYPE_QSGMII, 2408c2ecf20Sopenharmony_ci TYPE_USB, 2418c2ecf20Sopenharmony_ci}; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_cienum cdns_torrent_ssc_mode { 2448c2ecf20Sopenharmony_ci NO_SSC, 2458c2ecf20Sopenharmony_ci EXTERNAL_SSC, 2468c2ecf20Sopenharmony_ci INTERNAL_SSC 2478c2ecf20Sopenharmony_ci}; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_cistruct cdns_torrent_inst { 2508c2ecf20Sopenharmony_ci struct phy *phy; 2518c2ecf20Sopenharmony_ci u32 mlane; 2528c2ecf20Sopenharmony_ci enum cdns_torrent_phy_type phy_type; 2538c2ecf20Sopenharmony_ci u32 num_lanes; 2548c2ecf20Sopenharmony_ci struct reset_control *lnk_rst; 2558c2ecf20Sopenharmony_ci enum cdns_torrent_ssc_mode ssc_mode; 2568c2ecf20Sopenharmony_ci}; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistruct cdns_torrent_phy { 2598c2ecf20Sopenharmony_ci void __iomem *base; /* DPTX registers base */ 2608c2ecf20Sopenharmony_ci void __iomem *sd_base; /* SD0801 registers base */ 2618c2ecf20Sopenharmony_ci u32 max_bit_rate; /* Maximum link bit rate to use (in Mbps) */ 2628c2ecf20Sopenharmony_ci struct reset_control *phy_rst; 2638c2ecf20Sopenharmony_ci struct reset_control *apb_rst; 2648c2ecf20Sopenharmony_ci struct device *dev; 2658c2ecf20Sopenharmony_ci struct clk *clk; 2668c2ecf20Sopenharmony_ci unsigned long ref_clk_rate; 2678c2ecf20Sopenharmony_ci struct cdns_torrent_inst phys[MAX_NUM_LANES]; 2688c2ecf20Sopenharmony_ci int nsubnodes; 2698c2ecf20Sopenharmony_ci const struct cdns_torrent_data *init_data; 2708c2ecf20Sopenharmony_ci struct regmap *regmap; 2718c2ecf20Sopenharmony_ci struct regmap *regmap_common_cdb; 2728c2ecf20Sopenharmony_ci struct regmap *regmap_phy_pcs_common_cdb; 2738c2ecf20Sopenharmony_ci struct regmap *regmap_phy_pma_common_cdb; 2748c2ecf20Sopenharmony_ci struct regmap *regmap_tx_lane_cdb[MAX_NUM_LANES]; 2758c2ecf20Sopenharmony_ci struct regmap *regmap_rx_lane_cdb[MAX_NUM_LANES]; 2768c2ecf20Sopenharmony_ci struct regmap *regmap_dptx_phy_reg; 2778c2ecf20Sopenharmony_ci struct regmap_field *phy_pll_cfg; 2788c2ecf20Sopenharmony_ci struct regmap_field *phy_pma_cmn_ctrl_1; 2798c2ecf20Sopenharmony_ci struct regmap_field *phy_pma_cmn_ctrl_2; 2808c2ecf20Sopenharmony_ci struct regmap_field *phy_pma_pll_raw_ctrl; 2818c2ecf20Sopenharmony_ci struct regmap_field *phy_reset_ctrl; 2828c2ecf20Sopenharmony_ci}; 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_cienum phy_powerstate { 2858c2ecf20Sopenharmony_ci POWERSTATE_A0 = 0, 2868c2ecf20Sopenharmony_ci /* Powerstate A1 is unused */ 2878c2ecf20Sopenharmony_ci POWERSTATE_A2 = 2, 2888c2ecf20Sopenharmony_ci POWERSTATE_A3 = 3, 2898c2ecf20Sopenharmony_ci}; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_init(struct phy *phy); 2928c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_init(struct phy *phy); 2938c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy, 2948c2ecf20Sopenharmony_ci u32 num_lanes); 2958c2ecf20Sopenharmony_cistatic 2968c2ecf20Sopenharmony_ciint cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy); 2978c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_pma_cfg(struct cdns_torrent_phy *cdns_phy, 2988c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst); 2998c2ecf20Sopenharmony_cistatic 3008c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy); 3018c2ecf20Sopenharmony_cistatic 3028c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy, 3038c2ecf20Sopenharmony_ci u32 rate, bool ssc); 3048c2ecf20Sopenharmony_cistatic 3058c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_cfg_25mhz(struct cdns_torrent_phy *cdns_phy); 3068c2ecf20Sopenharmony_cistatic 3078c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy *cdns_phy, 3088c2ecf20Sopenharmony_ci u32 rate, bool ssc); 3098c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_pma_lane_cfg(struct cdns_torrent_phy *cdns_phy, 3108c2ecf20Sopenharmony_ci unsigned int lane); 3118c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy *cdns_phy, 3128c2ecf20Sopenharmony_ci u32 rate, u32 num_lanes); 3138c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_configure(struct phy *phy, 3148c2ecf20Sopenharmony_ci union phy_configure_opts *opts); 3158c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy, 3168c2ecf20Sopenharmony_ci u32 num_lanes, 3178c2ecf20Sopenharmony_ci enum phy_powerstate powerstate); 3188c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_on(struct phy *phy); 3198c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_off(struct phy *phy); 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_cistatic const struct phy_ops cdns_torrent_phy_ops = { 3228c2ecf20Sopenharmony_ci .init = cdns_torrent_phy_init, 3238c2ecf20Sopenharmony_ci .configure = cdns_torrent_dp_configure, 3248c2ecf20Sopenharmony_ci .power_on = cdns_torrent_phy_on, 3258c2ecf20Sopenharmony_ci .power_off = cdns_torrent_phy_off, 3268c2ecf20Sopenharmony_ci .owner = THIS_MODULE, 3278c2ecf20Sopenharmony_ci}; 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_cistruct cdns_reg_pairs { 3308c2ecf20Sopenharmony_ci u32 val; 3318c2ecf20Sopenharmony_ci u32 off; 3328c2ecf20Sopenharmony_ci}; 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_cistruct cdns_torrent_vals { 3358c2ecf20Sopenharmony_ci struct cdns_reg_pairs *reg_pairs; 3368c2ecf20Sopenharmony_ci u32 num_regs; 3378c2ecf20Sopenharmony_ci}; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_cistruct cdns_torrent_data { 3408c2ecf20Sopenharmony_ci u8 block_offset_shift; 3418c2ecf20Sopenharmony_ci u8 reg_offset_shift; 3428c2ecf20Sopenharmony_ci struct cdns_torrent_vals *link_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3438c2ecf20Sopenharmony_ci [NUM_SSC_MODE]; 3448c2ecf20Sopenharmony_ci struct cdns_torrent_vals *xcvr_diag_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3458c2ecf20Sopenharmony_ci [NUM_SSC_MODE]; 3468c2ecf20Sopenharmony_ci struct cdns_torrent_vals *pcs_cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3478c2ecf20Sopenharmony_ci [NUM_SSC_MODE]; 3488c2ecf20Sopenharmony_ci struct cdns_torrent_vals *cmn_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3498c2ecf20Sopenharmony_ci [NUM_SSC_MODE]; 3508c2ecf20Sopenharmony_ci struct cdns_torrent_vals *tx_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3518c2ecf20Sopenharmony_ci [NUM_SSC_MODE]; 3528c2ecf20Sopenharmony_ci struct cdns_torrent_vals *rx_ln_vals[NUM_PHY_TYPE][NUM_PHY_TYPE] 3538c2ecf20Sopenharmony_ci [NUM_SSC_MODE]; 3548c2ecf20Sopenharmony_ci}; 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_cistruct cdns_regmap_cdb_context { 3578c2ecf20Sopenharmony_ci struct device *dev; 3588c2ecf20Sopenharmony_ci void __iomem *base; 3598c2ecf20Sopenharmony_ci u8 reg_offset_shift; 3608c2ecf20Sopenharmony_ci}; 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_cistatic int cdns_regmap_write(void *context, unsigned int reg, unsigned int val) 3638c2ecf20Sopenharmony_ci{ 3648c2ecf20Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 3658c2ecf20Sopenharmony_ci u32 offset = reg << ctx->reg_offset_shift; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci writew(val, ctx->base + offset); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci return 0; 3708c2ecf20Sopenharmony_ci} 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_cistatic int cdns_regmap_read(void *context, unsigned int reg, unsigned int *val) 3738c2ecf20Sopenharmony_ci{ 3748c2ecf20Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 3758c2ecf20Sopenharmony_ci u32 offset = reg << ctx->reg_offset_shift; 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci *val = readw(ctx->base + offset); 3788c2ecf20Sopenharmony_ci return 0; 3798c2ecf20Sopenharmony_ci} 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistatic int cdns_regmap_dptx_write(void *context, unsigned int reg, 3828c2ecf20Sopenharmony_ci unsigned int val) 3838c2ecf20Sopenharmony_ci{ 3848c2ecf20Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 3858c2ecf20Sopenharmony_ci u32 offset = reg; 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci writel(val, ctx->base + offset); 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci return 0; 3908c2ecf20Sopenharmony_ci} 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_cistatic int cdns_regmap_dptx_read(void *context, unsigned int reg, 3938c2ecf20Sopenharmony_ci unsigned int *val) 3948c2ecf20Sopenharmony_ci{ 3958c2ecf20Sopenharmony_ci struct cdns_regmap_cdb_context *ctx = context; 3968c2ecf20Sopenharmony_ci u32 offset = reg; 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci *val = readl(ctx->base + offset); 3998c2ecf20Sopenharmony_ci return 0; 4008c2ecf20Sopenharmony_ci} 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci#define TORRENT_TX_LANE_CDB_REGMAP_CONF(n) \ 4038c2ecf20Sopenharmony_ci{ \ 4048c2ecf20Sopenharmony_ci .name = "torrent_tx_lane" n "_cdb", \ 4058c2ecf20Sopenharmony_ci .reg_stride = 1, \ 4068c2ecf20Sopenharmony_ci .fast_io = true, \ 4078c2ecf20Sopenharmony_ci .reg_write = cdns_regmap_write, \ 4088c2ecf20Sopenharmony_ci .reg_read = cdns_regmap_read, \ 4098c2ecf20Sopenharmony_ci} 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_ci#define TORRENT_RX_LANE_CDB_REGMAP_CONF(n) \ 4128c2ecf20Sopenharmony_ci{ \ 4138c2ecf20Sopenharmony_ci .name = "torrent_rx_lane" n "_cdb", \ 4148c2ecf20Sopenharmony_ci .reg_stride = 1, \ 4158c2ecf20Sopenharmony_ci .fast_io = true, \ 4168c2ecf20Sopenharmony_ci .reg_write = cdns_regmap_write, \ 4178c2ecf20Sopenharmony_ci .reg_read = cdns_regmap_read, \ 4188c2ecf20Sopenharmony_ci} 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_cistatic const struct regmap_config cdns_torrent_tx_lane_cdb_config[] = { 4218c2ecf20Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("0"), 4228c2ecf20Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("1"), 4238c2ecf20Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("2"), 4248c2ecf20Sopenharmony_ci TORRENT_TX_LANE_CDB_REGMAP_CONF("3"), 4258c2ecf20Sopenharmony_ci}; 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_cistatic const struct regmap_config cdns_torrent_rx_lane_cdb_config[] = { 4288c2ecf20Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("0"), 4298c2ecf20Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("1"), 4308c2ecf20Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("2"), 4318c2ecf20Sopenharmony_ci TORRENT_RX_LANE_CDB_REGMAP_CONF("3"), 4328c2ecf20Sopenharmony_ci}; 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_cistatic const struct regmap_config cdns_torrent_common_cdb_config = { 4358c2ecf20Sopenharmony_ci .name = "torrent_common_cdb", 4368c2ecf20Sopenharmony_ci .reg_stride = 1, 4378c2ecf20Sopenharmony_ci .fast_io = true, 4388c2ecf20Sopenharmony_ci .reg_write = cdns_regmap_write, 4398c2ecf20Sopenharmony_ci .reg_read = cdns_regmap_read, 4408c2ecf20Sopenharmony_ci}; 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_cistatic const struct regmap_config cdns_torrent_phy_pcs_cmn_cdb_config = { 4438c2ecf20Sopenharmony_ci .name = "torrent_phy_pcs_cmn_cdb", 4448c2ecf20Sopenharmony_ci .reg_stride = 1, 4458c2ecf20Sopenharmony_ci .fast_io = true, 4468c2ecf20Sopenharmony_ci .reg_write = cdns_regmap_write, 4478c2ecf20Sopenharmony_ci .reg_read = cdns_regmap_read, 4488c2ecf20Sopenharmony_ci}; 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_cistatic const struct regmap_config cdns_torrent_phy_pma_cmn_cdb_config = { 4518c2ecf20Sopenharmony_ci .name = "torrent_phy_pma_cmn_cdb", 4528c2ecf20Sopenharmony_ci .reg_stride = 1, 4538c2ecf20Sopenharmony_ci .fast_io = true, 4548c2ecf20Sopenharmony_ci .reg_write = cdns_regmap_write, 4558c2ecf20Sopenharmony_ci .reg_read = cdns_regmap_read, 4568c2ecf20Sopenharmony_ci}; 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_cistatic const struct regmap_config cdns_torrent_dptx_phy_config = { 4598c2ecf20Sopenharmony_ci .name = "torrent_dptx_phy", 4608c2ecf20Sopenharmony_ci .reg_stride = 1, 4618c2ecf20Sopenharmony_ci .fast_io = true, 4628c2ecf20Sopenharmony_ci .reg_write = cdns_regmap_dptx_write, 4638c2ecf20Sopenharmony_ci .reg_read = cdns_regmap_dptx_read, 4648c2ecf20Sopenharmony_ci}; 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci/* PHY mmr access functions */ 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistatic void cdns_torrent_phy_write(struct regmap *regmap, u32 offset, u32 val) 4698c2ecf20Sopenharmony_ci{ 4708c2ecf20Sopenharmony_ci regmap_write(regmap, offset, val); 4718c2ecf20Sopenharmony_ci} 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_cistatic u32 cdns_torrent_phy_read(struct regmap *regmap, u32 offset) 4748c2ecf20Sopenharmony_ci{ 4758c2ecf20Sopenharmony_ci unsigned int val; 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_ci regmap_read(regmap, offset, &val); 4788c2ecf20Sopenharmony_ci return val; 4798c2ecf20Sopenharmony_ci} 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_ci/* DPTX mmr access functions */ 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_write(struct regmap *regmap, u32 offset, u32 val) 4848c2ecf20Sopenharmony_ci{ 4858c2ecf20Sopenharmony_ci regmap_write(regmap, offset, val); 4868c2ecf20Sopenharmony_ci} 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_cistatic u32 cdns_torrent_dp_read(struct regmap *regmap, u32 offset) 4898c2ecf20Sopenharmony_ci{ 4908c2ecf20Sopenharmony_ci u32 val; 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci regmap_read(regmap, offset, &val); 4938c2ecf20Sopenharmony_ci return val; 4948c2ecf20Sopenharmony_ci} 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci/* 4978c2ecf20Sopenharmony_ci * Structure used to store values of PHY registers for voltage-related 4988c2ecf20Sopenharmony_ci * coefficients, for particular voltage swing and pre-emphasis level. Values 4998c2ecf20Sopenharmony_ci * are shared across all physical lanes. 5008c2ecf20Sopenharmony_ci */ 5018c2ecf20Sopenharmony_cistruct coefficients { 5028c2ecf20Sopenharmony_ci /* Value of DRV_DIAG_TX_DRV register to use */ 5038c2ecf20Sopenharmony_ci u16 diag_tx_drv; 5048c2ecf20Sopenharmony_ci /* Value of TX_TXCC_MGNFS_MULT_000 register to use */ 5058c2ecf20Sopenharmony_ci u16 mgnfs_mult; 5068c2ecf20Sopenharmony_ci /* Value of TX_TXCC_CPOST_MULT_00 register to use */ 5078c2ecf20Sopenharmony_ci u16 cpost_mult; 5088c2ecf20Sopenharmony_ci}; 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci/* 5118c2ecf20Sopenharmony_ci * Array consists of values of voltage-related registers for sd0801 PHY. A value 5128c2ecf20Sopenharmony_ci * of 0xFFFF is a placeholder for invalid combination, and will never be used. 5138c2ecf20Sopenharmony_ci */ 5148c2ecf20Sopenharmony_cistatic const struct coefficients vltg_coeff[4][4] = { 5158c2ecf20Sopenharmony_ci /* voltage swing 0, pre-emphasis 0->3 */ 5168c2ecf20Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x002A, 5178c2ecf20Sopenharmony_ci .cpost_mult = 0x0000}, 5188c2ecf20Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F, 5198c2ecf20Sopenharmony_ci .cpost_mult = 0x0014}, 5208c2ecf20Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0012, 5218c2ecf20Sopenharmony_ci .cpost_mult = 0x0020}, 5228c2ecf20Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 5238c2ecf20Sopenharmony_ci .cpost_mult = 0x002A} 5248c2ecf20Sopenharmony_ci }, 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci /* voltage swing 1, pre-emphasis 0->3 */ 5278c2ecf20Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x001F, 5288c2ecf20Sopenharmony_ci .cpost_mult = 0x0000}, 5298c2ecf20Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013, 5308c2ecf20Sopenharmony_ci .cpost_mult = 0x0012}, 5318c2ecf20Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 5328c2ecf20Sopenharmony_ci .cpost_mult = 0x001F}, 5338c2ecf20Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 5348c2ecf20Sopenharmony_ci .cpost_mult = 0xFFFF} 5358c2ecf20Sopenharmony_ci }, 5368c2ecf20Sopenharmony_ci 5378c2ecf20Sopenharmony_ci /* voltage swing 2, pre-emphasis 0->3 */ 5388c2ecf20Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0013, 5398c2ecf20Sopenharmony_ci .cpost_mult = 0x0000}, 5408c2ecf20Sopenharmony_ci {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 5418c2ecf20Sopenharmony_ci .cpost_mult = 0x0013}, 5428c2ecf20Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 5438c2ecf20Sopenharmony_ci .cpost_mult = 0xFFFF}, 5448c2ecf20Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 5458c2ecf20Sopenharmony_ci .cpost_mult = 0xFFFF} 5468c2ecf20Sopenharmony_ci }, 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ci /* voltage swing 3, pre-emphasis 0->3 */ 5498c2ecf20Sopenharmony_ci { {.diag_tx_drv = 0x0003, .mgnfs_mult = 0x0000, 5508c2ecf20Sopenharmony_ci .cpost_mult = 0x0000}, 5518c2ecf20Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 5528c2ecf20Sopenharmony_ci .cpost_mult = 0xFFFF}, 5538c2ecf20Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 5548c2ecf20Sopenharmony_ci .cpost_mult = 0xFFFF}, 5558c2ecf20Sopenharmony_ci {.diag_tx_drv = 0xFFFF, .mgnfs_mult = 0xFFFF, 5568c2ecf20Sopenharmony_ci .cpost_mult = 0xFFFF} 5578c2ecf20Sopenharmony_ci } 5588c2ecf20Sopenharmony_ci}; 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci/* 5618c2ecf20Sopenharmony_ci * Enable or disable PLL for selected lanes. 5628c2ecf20Sopenharmony_ci */ 5638c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_set_pll_en(struct cdns_torrent_phy *cdns_phy, 5648c2ecf20Sopenharmony_ci struct phy_configure_opts_dp *dp, 5658c2ecf20Sopenharmony_ci bool enable) 5668c2ecf20Sopenharmony_ci{ 5678c2ecf20Sopenharmony_ci u32 rd_val; 5688c2ecf20Sopenharmony_ci u32 ret; 5698c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci /* 5728c2ecf20Sopenharmony_ci * Used to determine, which bits to check for or enable in 5738c2ecf20Sopenharmony_ci * PHY_PMA_XCVR_PLLCLK_EN register. 5748c2ecf20Sopenharmony_ci */ 5758c2ecf20Sopenharmony_ci u32 pll_bits; 5768c2ecf20Sopenharmony_ci /* Used to enable or disable lanes. */ 5778c2ecf20Sopenharmony_ci u32 pll_val; 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci /* Select values of registers and mask, depending on enabled lane 5808c2ecf20Sopenharmony_ci * count. 5818c2ecf20Sopenharmony_ci */ 5828c2ecf20Sopenharmony_ci switch (dp->lanes) { 5838c2ecf20Sopenharmony_ci /* lane 0 */ 5848c2ecf20Sopenharmony_ci case (1): 5858c2ecf20Sopenharmony_ci pll_bits = 0x00000001; 5868c2ecf20Sopenharmony_ci break; 5878c2ecf20Sopenharmony_ci /* lanes 0-1 */ 5888c2ecf20Sopenharmony_ci case (2): 5898c2ecf20Sopenharmony_ci pll_bits = 0x00000003; 5908c2ecf20Sopenharmony_ci break; 5918c2ecf20Sopenharmony_ci /* lanes 0-3, all */ 5928c2ecf20Sopenharmony_ci default: 5938c2ecf20Sopenharmony_ci pll_bits = 0x0000000F; 5948c2ecf20Sopenharmony_ci break; 5958c2ecf20Sopenharmony_ci } 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci if (enable) 5988c2ecf20Sopenharmony_ci pll_val = pll_bits; 5998c2ecf20Sopenharmony_ci else 6008c2ecf20Sopenharmony_ci pll_val = 0x00000000; 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, pll_val); 6038c2ecf20Sopenharmony_ci 6048c2ecf20Sopenharmony_ci /* Wait for acknowledgment from PHY. */ 6058c2ecf20Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, 6068c2ecf20Sopenharmony_ci PHY_PMA_XCVR_PLLCLK_EN_ACK, 6078c2ecf20Sopenharmony_ci rd_val, 6088c2ecf20Sopenharmony_ci (rd_val & pll_bits) == pll_val, 6098c2ecf20Sopenharmony_ci 0, POLL_TIMEOUT_US); 6108c2ecf20Sopenharmony_ci ndelay(100); 6118c2ecf20Sopenharmony_ci return ret; 6128c2ecf20Sopenharmony_ci} 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci/* 6158c2ecf20Sopenharmony_ci * Perform register operations related to setting link rate, once powerstate is 6168c2ecf20Sopenharmony_ci * set and PLL disable request was processed. 6178c2ecf20Sopenharmony_ci */ 6188c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_configure_rate(struct cdns_torrent_phy *cdns_phy, 6198c2ecf20Sopenharmony_ci struct phy_configure_opts_dp *dp) 6208c2ecf20Sopenharmony_ci{ 6218c2ecf20Sopenharmony_ci u32 ret; 6228c2ecf20Sopenharmony_ci u32 read_val; 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci /* Disable the cmn_pll0_en before re-programming the new data rate. */ 6258c2ecf20Sopenharmony_ci regmap_field_write(cdns_phy->phy_pma_pll_raw_ctrl, 0x0); 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci /* 6288c2ecf20Sopenharmony_ci * Wait for PLL ready de-assertion. 6298c2ecf20Sopenharmony_ci * For PLL0 - PHY_PMA_CMN_CTRL2[2] == 1 6308c2ecf20Sopenharmony_ci */ 6318c2ecf20Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2, 6328c2ecf20Sopenharmony_ci read_val, 6338c2ecf20Sopenharmony_ci ((read_val >> 2) & 0x01) != 0, 6348c2ecf20Sopenharmony_ci 0, POLL_TIMEOUT_US); 6358c2ecf20Sopenharmony_ci if (ret) 6368c2ecf20Sopenharmony_ci return ret; 6378c2ecf20Sopenharmony_ci ndelay(200); 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci /* DP Rate Change - VCO Output settings. */ 6408c2ecf20Sopenharmony_ci if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz) { 6418c2ecf20Sopenharmony_ci /* PMA common configuration 19.2MHz */ 6428c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, dp->link_rate, 6438c2ecf20Sopenharmony_ci dp->ssc); 6448c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_cfg_19_2mhz(cdns_phy); 6458c2ecf20Sopenharmony_ci } else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz) { 6468c2ecf20Sopenharmony_ci /* PMA common configuration 25MHz */ 6478c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, dp->link_rate, 6488c2ecf20Sopenharmony_ci dp->ssc); 6498c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_cfg_25mhz(cdns_phy); 6508c2ecf20Sopenharmony_ci } 6518c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_rate(cdns_phy, dp->link_rate, dp->lanes); 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci /* Enable the cmn_pll0_en. */ 6548c2ecf20Sopenharmony_ci regmap_field_write(cdns_phy->phy_pma_pll_raw_ctrl, 0x3); 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci /* 6578c2ecf20Sopenharmony_ci * Wait for PLL ready assertion. 6588c2ecf20Sopenharmony_ci * For PLL0 - PHY_PMA_CMN_CTRL2[0] == 1 6598c2ecf20Sopenharmony_ci */ 6608c2ecf20Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_2, 6618c2ecf20Sopenharmony_ci read_val, 6628c2ecf20Sopenharmony_ci (read_val & 0x01) != 0, 6638c2ecf20Sopenharmony_ci 0, POLL_TIMEOUT_US); 6648c2ecf20Sopenharmony_ci return ret; 6658c2ecf20Sopenharmony_ci} 6668c2ecf20Sopenharmony_ci 6678c2ecf20Sopenharmony_ci/* 6688c2ecf20Sopenharmony_ci * Verify, that parameters to configure PHY with are correct. 6698c2ecf20Sopenharmony_ci */ 6708c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_verify_config(struct cdns_torrent_inst *inst, 6718c2ecf20Sopenharmony_ci struct phy_configure_opts_dp *dp) 6728c2ecf20Sopenharmony_ci{ 6738c2ecf20Sopenharmony_ci u8 i; 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ci /* If changing link rate was required, verify it's supported. */ 6768c2ecf20Sopenharmony_ci if (dp->set_rate) { 6778c2ecf20Sopenharmony_ci switch (dp->link_rate) { 6788c2ecf20Sopenharmony_ci case 1620: 6798c2ecf20Sopenharmony_ci case 2160: 6808c2ecf20Sopenharmony_ci case 2430: 6818c2ecf20Sopenharmony_ci case 2700: 6828c2ecf20Sopenharmony_ci case 3240: 6838c2ecf20Sopenharmony_ci case 4320: 6848c2ecf20Sopenharmony_ci case 5400: 6858c2ecf20Sopenharmony_ci case 8100: 6868c2ecf20Sopenharmony_ci /* valid bit rate */ 6878c2ecf20Sopenharmony_ci break; 6888c2ecf20Sopenharmony_ci default: 6898c2ecf20Sopenharmony_ci return -EINVAL; 6908c2ecf20Sopenharmony_ci } 6918c2ecf20Sopenharmony_ci } 6928c2ecf20Sopenharmony_ci 6938c2ecf20Sopenharmony_ci /* Verify lane count. */ 6948c2ecf20Sopenharmony_ci switch (dp->lanes) { 6958c2ecf20Sopenharmony_ci case 1: 6968c2ecf20Sopenharmony_ci case 2: 6978c2ecf20Sopenharmony_ci case 4: 6988c2ecf20Sopenharmony_ci /* valid lane count. */ 6998c2ecf20Sopenharmony_ci break; 7008c2ecf20Sopenharmony_ci default: 7018c2ecf20Sopenharmony_ci return -EINVAL; 7028c2ecf20Sopenharmony_ci } 7038c2ecf20Sopenharmony_ci 7048c2ecf20Sopenharmony_ci /* Check against actual number of PHY's lanes. */ 7058c2ecf20Sopenharmony_ci if (dp->lanes > inst->num_lanes) 7068c2ecf20Sopenharmony_ci return -EINVAL; 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci /* 7098c2ecf20Sopenharmony_ci * If changing voltages is required, check swing and pre-emphasis 7108c2ecf20Sopenharmony_ci * levels, per-lane. 7118c2ecf20Sopenharmony_ci */ 7128c2ecf20Sopenharmony_ci if (dp->set_voltages) { 7138c2ecf20Sopenharmony_ci /* Lane count verified previously. */ 7148c2ecf20Sopenharmony_ci for (i = 0; i < dp->lanes; i++) { 7158c2ecf20Sopenharmony_ci if (dp->voltage[i] > 3 || dp->pre[i] > 3) 7168c2ecf20Sopenharmony_ci return -EINVAL; 7178c2ecf20Sopenharmony_ci 7188c2ecf20Sopenharmony_ci /* Sum of voltage swing and pre-emphasis levels cannot 7198c2ecf20Sopenharmony_ci * exceed 3. 7208c2ecf20Sopenharmony_ci */ 7218c2ecf20Sopenharmony_ci if (dp->voltage[i] + dp->pre[i] > 3) 7228c2ecf20Sopenharmony_ci return -EINVAL; 7238c2ecf20Sopenharmony_ci } 7248c2ecf20Sopenharmony_ci } 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_ci return 0; 7278c2ecf20Sopenharmony_ci} 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci/* Set power state A0 and PLL clock enable to 0 on enabled lanes. */ 7308c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_set_a0_pll(struct cdns_torrent_phy *cdns_phy, 7318c2ecf20Sopenharmony_ci u32 num_lanes) 7328c2ecf20Sopenharmony_ci{ 7338c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 7348c2ecf20Sopenharmony_ci u32 pwr_state = cdns_torrent_dp_read(regmap, 7358c2ecf20Sopenharmony_ci PHY_PMA_XCVR_POWER_STATE_REQ); 7368c2ecf20Sopenharmony_ci u32 pll_clk_en = cdns_torrent_dp_read(regmap, 7378c2ecf20Sopenharmony_ci PHY_PMA_XCVR_PLLCLK_EN); 7388c2ecf20Sopenharmony_ci 7398c2ecf20Sopenharmony_ci /* Lane 0 is always enabled. */ 7408c2ecf20Sopenharmony_ci pwr_state &= ~(PMA_XCVR_POWER_STATE_REQ_LN_MASK << 7418c2ecf20Sopenharmony_ci PHY_POWER_STATE_LN_0); 7428c2ecf20Sopenharmony_ci pll_clk_en &= ~0x01U; 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_ci if (num_lanes > 1) { 7458c2ecf20Sopenharmony_ci /* lane 1 */ 7468c2ecf20Sopenharmony_ci pwr_state &= ~(PMA_XCVR_POWER_STATE_REQ_LN_MASK << 7478c2ecf20Sopenharmony_ci PHY_POWER_STATE_LN_1); 7488c2ecf20Sopenharmony_ci pll_clk_en &= ~(0x01U << 1); 7498c2ecf20Sopenharmony_ci } 7508c2ecf20Sopenharmony_ci 7518c2ecf20Sopenharmony_ci if (num_lanes > 2) { 7528c2ecf20Sopenharmony_ci /* lanes 2 and 3 */ 7538c2ecf20Sopenharmony_ci pwr_state &= ~(PMA_XCVR_POWER_STATE_REQ_LN_MASK << 7548c2ecf20Sopenharmony_ci PHY_POWER_STATE_LN_2); 7558c2ecf20Sopenharmony_ci pwr_state &= ~(PMA_XCVR_POWER_STATE_REQ_LN_MASK << 7568c2ecf20Sopenharmony_ci PHY_POWER_STATE_LN_3); 7578c2ecf20Sopenharmony_ci pll_clk_en &= ~(0x01U << 2); 7588c2ecf20Sopenharmony_ci pll_clk_en &= ~(0x01U << 3); 7598c2ecf20Sopenharmony_ci } 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, pwr_state); 7628c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, pll_clk_en); 7638c2ecf20Sopenharmony_ci} 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci/* Configure lane count as required. */ 7668c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_set_lanes(struct cdns_torrent_phy *cdns_phy, 7678c2ecf20Sopenharmony_ci struct phy_configure_opts_dp *dp) 7688c2ecf20Sopenharmony_ci{ 7698c2ecf20Sopenharmony_ci u32 value; 7708c2ecf20Sopenharmony_ci u32 ret; 7718c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 7728c2ecf20Sopenharmony_ci u8 lane_mask = (1 << dp->lanes) - 1; 7738c2ecf20Sopenharmony_ci 7748c2ecf20Sopenharmony_ci value = cdns_torrent_dp_read(regmap, PHY_RESET); 7758c2ecf20Sopenharmony_ci /* clear pma_tx_elec_idle_ln_* bits. */ 7768c2ecf20Sopenharmony_ci value &= ~PMA_TX_ELEC_IDLE_MASK; 7778c2ecf20Sopenharmony_ci /* Assert pma_tx_elec_idle_ln_* for disabled lanes. */ 7788c2ecf20Sopenharmony_ci value |= ((~lane_mask) << PMA_TX_ELEC_IDLE_SHIFT) & 7798c2ecf20Sopenharmony_ci PMA_TX_ELEC_IDLE_MASK; 7808c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, value); 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_ci /* reset the link by asserting phy_l00_reset_n low */ 7838c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, 7848c2ecf20Sopenharmony_ci value & (~PHY_L00_RESET_N_MASK)); 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci /* 7878c2ecf20Sopenharmony_ci * Assert lane reset on unused lanes and lane 0 so they remain in reset 7888c2ecf20Sopenharmony_ci * and powered down when re-enabling the link 7898c2ecf20Sopenharmony_ci */ 7908c2ecf20Sopenharmony_ci value = (value & 0x0000FFF0) | (0x0000000E & lane_mask); 7918c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, value); 7928c2ecf20Sopenharmony_ci 7938c2ecf20Sopenharmony_ci cdns_torrent_dp_set_a0_pll(cdns_phy, dp->lanes); 7948c2ecf20Sopenharmony_ci 7958c2ecf20Sopenharmony_ci /* release phy_l0*_reset_n based on used laneCount */ 7968c2ecf20Sopenharmony_ci value = (value & 0x0000FFF0) | (0x0000000F & lane_mask); 7978c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, value); 7988c2ecf20Sopenharmony_ci 7998c2ecf20Sopenharmony_ci /* Wait, until PHY gets ready after releasing PHY reset signal. */ 8008c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy); 8018c2ecf20Sopenharmony_ci if (ret) 8028c2ecf20Sopenharmony_ci return ret; 8038c2ecf20Sopenharmony_ci 8048c2ecf20Sopenharmony_ci ndelay(100); 8058c2ecf20Sopenharmony_ci 8068c2ecf20Sopenharmony_ci /* release pma_xcvr_pllclk_en_ln_*, only for the master lane */ 8078c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, 0x0001); 8088c2ecf20Sopenharmony_ci 8098c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_run(cdns_phy, dp->lanes); 8108c2ecf20Sopenharmony_ci 8118c2ecf20Sopenharmony_ci return ret; 8128c2ecf20Sopenharmony_ci} 8138c2ecf20Sopenharmony_ci 8148c2ecf20Sopenharmony_ci/* Configure link rate as required. */ 8158c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_set_rate(struct cdns_torrent_phy *cdns_phy, 8168c2ecf20Sopenharmony_ci struct phy_configure_opts_dp *dp) 8178c2ecf20Sopenharmony_ci{ 8188c2ecf20Sopenharmony_ci u32 ret; 8198c2ecf20Sopenharmony_ci 8208c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, dp->lanes, 8218c2ecf20Sopenharmony_ci POWERSTATE_A3); 8228c2ecf20Sopenharmony_ci if (ret) 8238c2ecf20Sopenharmony_ci return ret; 8248c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_pll_en(cdns_phy, dp, false); 8258c2ecf20Sopenharmony_ci if (ret) 8268c2ecf20Sopenharmony_ci return ret; 8278c2ecf20Sopenharmony_ci ndelay(200); 8288c2ecf20Sopenharmony_ci 8298c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_configure_rate(cdns_phy, dp); 8308c2ecf20Sopenharmony_ci if (ret) 8318c2ecf20Sopenharmony_ci return ret; 8328c2ecf20Sopenharmony_ci ndelay(200); 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_pll_en(cdns_phy, dp, true); 8358c2ecf20Sopenharmony_ci if (ret) 8368c2ecf20Sopenharmony_ci return ret; 8378c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, dp->lanes, 8388c2ecf20Sopenharmony_ci POWERSTATE_A2); 8398c2ecf20Sopenharmony_ci if (ret) 8408c2ecf20Sopenharmony_ci return ret; 8418c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, dp->lanes, 8428c2ecf20Sopenharmony_ci POWERSTATE_A0); 8438c2ecf20Sopenharmony_ci if (ret) 8448c2ecf20Sopenharmony_ci return ret; 8458c2ecf20Sopenharmony_ci ndelay(900); 8468c2ecf20Sopenharmony_ci 8478c2ecf20Sopenharmony_ci return ret; 8488c2ecf20Sopenharmony_ci} 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_ci/* Configure voltage swing and pre-emphasis for all enabled lanes. */ 8518c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_set_voltages(struct cdns_torrent_phy *cdns_phy, 8528c2ecf20Sopenharmony_ci struct phy_configure_opts_dp *dp) 8538c2ecf20Sopenharmony_ci{ 8548c2ecf20Sopenharmony_ci u8 lane; 8558c2ecf20Sopenharmony_ci u16 val; 8568c2ecf20Sopenharmony_ci 8578c2ecf20Sopenharmony_ci for (lane = 0; lane < dp->lanes; lane++) { 8588c2ecf20Sopenharmony_ci val = cdns_torrent_phy_read(cdns_phy->regmap_tx_lane_cdb[lane], 8598c2ecf20Sopenharmony_ci TX_DIAG_ACYA); 8608c2ecf20Sopenharmony_ci /* 8618c2ecf20Sopenharmony_ci * Write 1 to register bit TX_DIAG_ACYA[0] to freeze the 8628c2ecf20Sopenharmony_ci * current state of the analog TX driver. 8638c2ecf20Sopenharmony_ci */ 8648c2ecf20Sopenharmony_ci val |= TX_DIAG_ACYA_HBDC_MASK; 8658c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 8668c2ecf20Sopenharmony_ci TX_DIAG_ACYA, val); 8678c2ecf20Sopenharmony_ci 8688c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 8698c2ecf20Sopenharmony_ci TX_TXCC_CTRL, 0x08A4); 8708c2ecf20Sopenharmony_ci val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].diag_tx_drv; 8718c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 8728c2ecf20Sopenharmony_ci DRV_DIAG_TX_DRV, val); 8738c2ecf20Sopenharmony_ci val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].mgnfs_mult; 8748c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 8758c2ecf20Sopenharmony_ci TX_TXCC_MGNFS_MULT_000, 8768c2ecf20Sopenharmony_ci val); 8778c2ecf20Sopenharmony_ci val = vltg_coeff[dp->voltage[lane]][dp->pre[lane]].cpost_mult; 8788c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 8798c2ecf20Sopenharmony_ci TX_TXCC_CPOST_MULT_00, 8808c2ecf20Sopenharmony_ci val); 8818c2ecf20Sopenharmony_ci 8828c2ecf20Sopenharmony_ci val = cdns_torrent_phy_read(cdns_phy->regmap_tx_lane_cdb[lane], 8838c2ecf20Sopenharmony_ci TX_DIAG_ACYA); 8848c2ecf20Sopenharmony_ci /* 8858c2ecf20Sopenharmony_ci * Write 0 to register bit TX_DIAG_ACYA[0] to allow the state of 8868c2ecf20Sopenharmony_ci * analog TX driver to reflect the new programmed one. 8878c2ecf20Sopenharmony_ci */ 8888c2ecf20Sopenharmony_ci val &= ~TX_DIAG_ACYA_HBDC_MASK; 8898c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 8908c2ecf20Sopenharmony_ci TX_DIAG_ACYA, val); 8918c2ecf20Sopenharmony_ci } 8928c2ecf20Sopenharmony_ci}; 8938c2ecf20Sopenharmony_ci 8948c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_configure(struct phy *phy, 8958c2ecf20Sopenharmony_ci union phy_configure_opts *opts) 8968c2ecf20Sopenharmony_ci{ 8978c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 8988c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 8998c2ecf20Sopenharmony_ci int ret; 9008c2ecf20Sopenharmony_ci 9018c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_verify_config(inst, &opts->dp); 9028c2ecf20Sopenharmony_ci if (ret) { 9038c2ecf20Sopenharmony_ci dev_err(&phy->dev, "invalid params for phy configure\n"); 9048c2ecf20Sopenharmony_ci return ret; 9058c2ecf20Sopenharmony_ci } 9068c2ecf20Sopenharmony_ci 9078c2ecf20Sopenharmony_ci if (opts->dp.set_lanes) { 9088c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_lanes(cdns_phy, &opts->dp); 9098c2ecf20Sopenharmony_ci if (ret) { 9108c2ecf20Sopenharmony_ci dev_err(&phy->dev, "cdns_torrent_dp_set_lanes failed\n"); 9118c2ecf20Sopenharmony_ci return ret; 9128c2ecf20Sopenharmony_ci } 9138c2ecf20Sopenharmony_ci } 9148c2ecf20Sopenharmony_ci 9158c2ecf20Sopenharmony_ci if (opts->dp.set_rate) { 9168c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_rate(cdns_phy, &opts->dp); 9178c2ecf20Sopenharmony_ci if (ret) { 9188c2ecf20Sopenharmony_ci dev_err(&phy->dev, "cdns_torrent_dp_set_rate failed\n"); 9198c2ecf20Sopenharmony_ci return ret; 9208c2ecf20Sopenharmony_ci } 9218c2ecf20Sopenharmony_ci } 9228c2ecf20Sopenharmony_ci 9238c2ecf20Sopenharmony_ci if (opts->dp.set_voltages) 9248c2ecf20Sopenharmony_ci cdns_torrent_dp_set_voltages(cdns_phy, &opts->dp); 9258c2ecf20Sopenharmony_ci 9268c2ecf20Sopenharmony_ci return ret; 9278c2ecf20Sopenharmony_ci} 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_init(struct phy *phy) 9308c2ecf20Sopenharmony_ci{ 9318c2ecf20Sopenharmony_ci unsigned char lane_bits; 9328c2ecf20Sopenharmony_ci int ret; 9338c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 9348c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 9358c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 9368c2ecf20Sopenharmony_ci 9378c2ecf20Sopenharmony_ci switch (cdns_phy->ref_clk_rate) { 9388c2ecf20Sopenharmony_ci case REF_CLK_19_2MHz: 9398c2ecf20Sopenharmony_ci case REF_CLK_25MHz: 9408c2ecf20Sopenharmony_ci /* Valid Ref Clock Rate */ 9418c2ecf20Sopenharmony_ci break; 9428c2ecf20Sopenharmony_ci default: 9438c2ecf20Sopenharmony_ci dev_err(cdns_phy->dev, "Unsupported Ref Clock Rate\n"); 9448c2ecf20Sopenharmony_ci return -EINVAL; 9458c2ecf20Sopenharmony_ci } 9468c2ecf20Sopenharmony_ci 9478c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_AUX_CTRL, 0x0003); /* enable AUX */ 9488c2ecf20Sopenharmony_ci 9498c2ecf20Sopenharmony_ci /* PHY PMA registers configuration function */ 9508c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cfg(cdns_phy, inst); 9518c2ecf20Sopenharmony_ci 9528c2ecf20Sopenharmony_ci /* 9538c2ecf20Sopenharmony_ci * Set lines power state to A0 9548c2ecf20Sopenharmony_ci * Set lines pll clk enable to 0 9558c2ecf20Sopenharmony_ci */ 9568c2ecf20Sopenharmony_ci cdns_torrent_dp_set_a0_pll(cdns_phy, inst->num_lanes); 9578c2ecf20Sopenharmony_ci 9588c2ecf20Sopenharmony_ci /* 9598c2ecf20Sopenharmony_ci * release phy_l0*_reset_n and pma_tx_elec_idle_ln_* based on 9608c2ecf20Sopenharmony_ci * used lanes 9618c2ecf20Sopenharmony_ci */ 9628c2ecf20Sopenharmony_ci lane_bits = (1 << inst->num_lanes) - 1; 9638c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_RESET, 9648c2ecf20Sopenharmony_ci ((0xF & ~lane_bits) << 4) | (0xF & lane_bits)); 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_ci /* release pma_xcvr_pllclk_en_ln_*, only for the master lane */ 9678c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_PLLCLK_EN, 0x0001); 9688c2ecf20Sopenharmony_ci 9698c2ecf20Sopenharmony_ci /* PHY PMA registers configuration functions */ 9708c2ecf20Sopenharmony_ci /* Initialize PHY with max supported link rate, without SSC. */ 9718c2ecf20Sopenharmony_ci if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz) 9728c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, 9738c2ecf20Sopenharmony_ci cdns_phy->max_bit_rate, 9748c2ecf20Sopenharmony_ci false); 9758c2ecf20Sopenharmony_ci else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz) 9768c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, 9778c2ecf20Sopenharmony_ci cdns_phy->max_bit_rate, 9788c2ecf20Sopenharmony_ci false); 9798c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_rate(cdns_phy, cdns_phy->max_bit_rate, 9808c2ecf20Sopenharmony_ci inst->num_lanes); 9818c2ecf20Sopenharmony_ci 9828c2ecf20Sopenharmony_ci /* take out of reset */ 9838c2ecf20Sopenharmony_ci regmap_field_write(cdns_phy->phy_reset_ctrl, 0x1); 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_ci cdns_torrent_phy_on(phy); 9868c2ecf20Sopenharmony_ci 9878c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy); 9888c2ecf20Sopenharmony_ci if (ret) 9898c2ecf20Sopenharmony_ci return ret; 9908c2ecf20Sopenharmony_ci 9918c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_run(cdns_phy, inst->num_lanes); 9928c2ecf20Sopenharmony_ci 9938c2ecf20Sopenharmony_ci return ret; 9948c2ecf20Sopenharmony_ci} 9958c2ecf20Sopenharmony_ci 9968c2ecf20Sopenharmony_cistatic 9978c2ecf20Sopenharmony_ciint cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy) 9988c2ecf20Sopenharmony_ci{ 9998c2ecf20Sopenharmony_ci unsigned int reg; 10008c2ecf20Sopenharmony_ci int ret; 10018c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 10028c2ecf20Sopenharmony_ci 10038c2ecf20Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, PHY_PMA_CMN_READY, reg, 10048c2ecf20Sopenharmony_ci reg & 1, 0, POLL_TIMEOUT_US); 10058c2ecf20Sopenharmony_ci if (ret == -ETIMEDOUT) { 10068c2ecf20Sopenharmony_ci dev_err(cdns_phy->dev, 10078c2ecf20Sopenharmony_ci "timeout waiting for PMA common ready\n"); 10088c2ecf20Sopenharmony_ci return -ETIMEDOUT; 10098c2ecf20Sopenharmony_ci } 10108c2ecf20Sopenharmony_ci 10118c2ecf20Sopenharmony_ci return 0; 10128c2ecf20Sopenharmony_ci} 10138c2ecf20Sopenharmony_ci 10148c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_pma_cfg(struct cdns_torrent_phy *cdns_phy, 10158c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst) 10168c2ecf20Sopenharmony_ci{ 10178c2ecf20Sopenharmony_ci unsigned int i; 10188c2ecf20Sopenharmony_ci 10198c2ecf20Sopenharmony_ci if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz) 10208c2ecf20Sopenharmony_ci /* PMA common configuration 19.2MHz */ 10218c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_cfg_19_2mhz(cdns_phy); 10228c2ecf20Sopenharmony_ci else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz) 10238c2ecf20Sopenharmony_ci /* PMA common configuration 25MHz */ 10248c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_cmn_cfg_25mhz(cdns_phy); 10258c2ecf20Sopenharmony_ci 10268c2ecf20Sopenharmony_ci /* PMA lane configuration to deal with multi-link operation */ 10278c2ecf20Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) 10288c2ecf20Sopenharmony_ci cdns_torrent_dp_pma_lane_cfg(cdns_phy, i); 10298c2ecf20Sopenharmony_ci} 10308c2ecf20Sopenharmony_ci 10318c2ecf20Sopenharmony_cistatic 10328c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy) 10338c2ecf20Sopenharmony_ci{ 10348c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 10358c2ecf20Sopenharmony_ci 10368c2ecf20Sopenharmony_ci /* refclock registers - assumes 19.2 MHz refclock */ 10378c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SSM_BIAS_TMR, 0x0014); 10388c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM0_PLLPRE_TMR, 0x0027); 10398c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM0_PLLLOCK_TMR, 0x00A1); 10408c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM1_PLLPRE_TMR, 0x0027); 10418c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM1_PLLLOCK_TMR, 0x00A1); 10428c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_BGCAL_INIT_TMR, 0x0060); 10438c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_BGCAL_ITER_TMR, 0x0060); 10448c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_IBCAL_INIT_TMR, 0x0014); 10458c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPUCAL_INIT_TMR, 0x0018); 10468c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPUCAL_ITER_TMR, 0x0005); 10478c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPDCAL_INIT_TMR, 0x0018); 10488c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPDCAL_ITER_TMR, 0x0005); 10498c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_RXCAL_INIT_TMR, 0x0240); 10508c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_RXCAL_ITER_TMR, 0x0005); 10518c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_INIT_TMR, 0x0002); 10528c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_ITER_TMR, 0x0002); 10538c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_REFTIM_START, 0x000B); 10548c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_PLLCNT_START, 0x0137); 10558c2ecf20Sopenharmony_ci 10568c2ecf20Sopenharmony_ci /* PLL registers */ 10578c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509); 10588c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00); 10598c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08); 10608c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004); 10618c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509); 10628c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00); 10638c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08); 10648c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004); 10658c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_INIT_TMR, 0x00C0); 10668c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_ITER_TMR, 0x0004); 10678c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_INIT_TMR, 0x00C0); 10688c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_ITER_TMR, 0x0004); 10698c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_REFTIM_START, 0x0260); 10708c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_TCTRL, 0x0003); 10718c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_REFTIM_START, 0x0260); 10728c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_TCTRL, 0x0003); 10738c2ecf20Sopenharmony_ci} 10748c2ecf20Sopenharmony_ci 10758c2ecf20Sopenharmony_ci/* 10768c2ecf20Sopenharmony_ci * Set registers responsible for enabling and configuring SSC, with second and 10778c2ecf20Sopenharmony_ci * third register values provided by parameters. 10788c2ecf20Sopenharmony_ci */ 10798c2ecf20Sopenharmony_cistatic 10808c2ecf20Sopenharmony_civoid cdns_torrent_dp_enable_ssc_19_2mhz(struct cdns_torrent_phy *cdns_phy, 10818c2ecf20Sopenharmony_ci u32 ctrl2_val, u32 ctrl3_val) 10828c2ecf20Sopenharmony_ci{ 10838c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 10848c2ecf20Sopenharmony_ci 10858c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0001); 10868c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl2_val); 10878c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl3_val); 10888c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0003); 10898c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0001); 10908c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl2_val); 10918c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl3_val); 10928c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0003); 10938c2ecf20Sopenharmony_ci} 10948c2ecf20Sopenharmony_ci 10958c2ecf20Sopenharmony_cistatic 10968c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy, 10978c2ecf20Sopenharmony_ci u32 rate, bool ssc) 10988c2ecf20Sopenharmony_ci{ 10998c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 11008c2ecf20Sopenharmony_ci 11018c2ecf20Sopenharmony_ci /* Assumes 19.2 MHz refclock */ 11028c2ecf20Sopenharmony_ci switch (rate) { 11038c2ecf20Sopenharmony_ci /* Setting VCO for 10.8GHz */ 11048c2ecf20Sopenharmony_ci case 2700: 11058c2ecf20Sopenharmony_ci case 5400: 11068c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11078c2ecf20Sopenharmony_ci CMN_PLL0_INTDIV_M0, 0x0119); 11088c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11098c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVL_M0, 0x4000); 11108c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11118c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVH_M0, 0x0002); 11128c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11138c2ecf20Sopenharmony_ci CMN_PLL0_HIGH_THR_M0, 0x00BC); 11148c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11158c2ecf20Sopenharmony_ci CMN_PDIAG_PLL0_CTRL_M0, 0x0012); 11168c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11178c2ecf20Sopenharmony_ci CMN_PLL1_INTDIV_M0, 0x0119); 11188c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11198c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVL_M0, 0x4000); 11208c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11218c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVH_M0, 0x0002); 11228c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11238c2ecf20Sopenharmony_ci CMN_PLL1_HIGH_THR_M0, 0x00BC); 11248c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11258c2ecf20Sopenharmony_ci CMN_PDIAG_PLL1_CTRL_M0, 0x0012); 11268c2ecf20Sopenharmony_ci if (ssc) 11278c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x033A, 11288c2ecf20Sopenharmony_ci 0x006A); 11298c2ecf20Sopenharmony_ci break; 11308c2ecf20Sopenharmony_ci /* Setting VCO for 9.72GHz */ 11318c2ecf20Sopenharmony_ci case 1620: 11328c2ecf20Sopenharmony_ci case 2430: 11338c2ecf20Sopenharmony_ci case 3240: 11348c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11358c2ecf20Sopenharmony_ci CMN_PLL0_INTDIV_M0, 0x01FA); 11368c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11378c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVL_M0, 0x4000); 11388c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11398c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVH_M0, 0x0002); 11408c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11418c2ecf20Sopenharmony_ci CMN_PLL0_HIGH_THR_M0, 0x0152); 11428c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11438c2ecf20Sopenharmony_ci CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 11448c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11458c2ecf20Sopenharmony_ci CMN_PLL1_INTDIV_M0, 0x01FA); 11468c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11478c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVL_M0, 0x4000); 11488c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11498c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVH_M0, 0x0002); 11508c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11518c2ecf20Sopenharmony_ci CMN_PLL1_HIGH_THR_M0, 0x0152); 11528c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11538c2ecf20Sopenharmony_ci CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 11548c2ecf20Sopenharmony_ci if (ssc) 11558c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x05DD, 11568c2ecf20Sopenharmony_ci 0x0069); 11578c2ecf20Sopenharmony_ci break; 11588c2ecf20Sopenharmony_ci /* Setting VCO for 8.64GHz */ 11598c2ecf20Sopenharmony_ci case 2160: 11608c2ecf20Sopenharmony_ci case 4320: 11618c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11628c2ecf20Sopenharmony_ci CMN_PLL0_INTDIV_M0, 0x01C2); 11638c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11648c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVL_M0, 0x0000); 11658c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11668c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVH_M0, 0x0002); 11678c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11688c2ecf20Sopenharmony_ci CMN_PLL0_HIGH_THR_M0, 0x012C); 11698c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11708c2ecf20Sopenharmony_ci CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 11718c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11728c2ecf20Sopenharmony_ci CMN_PLL1_INTDIV_M0, 0x01C2); 11738c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11748c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVL_M0, 0x0000); 11758c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11768c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVH_M0, 0x0002); 11778c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11788c2ecf20Sopenharmony_ci CMN_PLL1_HIGH_THR_M0, 0x012C); 11798c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11808c2ecf20Sopenharmony_ci CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 11818c2ecf20Sopenharmony_ci if (ssc) 11828c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x0536, 11838c2ecf20Sopenharmony_ci 0x0069); 11848c2ecf20Sopenharmony_ci break; 11858c2ecf20Sopenharmony_ci /* Setting VCO for 8.1GHz */ 11868c2ecf20Sopenharmony_ci case 8100: 11878c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11888c2ecf20Sopenharmony_ci CMN_PLL0_INTDIV_M0, 0x01A5); 11898c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11908c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVL_M0, 0xE000); 11918c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11928c2ecf20Sopenharmony_ci CMN_PLL0_FRACDIVH_M0, 0x0002); 11938c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11948c2ecf20Sopenharmony_ci CMN_PLL0_HIGH_THR_M0, 0x011A); 11958c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11968c2ecf20Sopenharmony_ci CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 11978c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 11988c2ecf20Sopenharmony_ci CMN_PLL1_INTDIV_M0, 0x01A5); 11998c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12008c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVL_M0, 0xE000); 12018c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12028c2ecf20Sopenharmony_ci CMN_PLL1_FRACDIVH_M0, 0x0002); 12038c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12048c2ecf20Sopenharmony_ci CMN_PLL1_HIGH_THR_M0, 0x011A); 12058c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12068c2ecf20Sopenharmony_ci CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 12078c2ecf20Sopenharmony_ci if (ssc) 12088c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x04D7, 12098c2ecf20Sopenharmony_ci 0x006A); 12108c2ecf20Sopenharmony_ci break; 12118c2ecf20Sopenharmony_ci } 12128c2ecf20Sopenharmony_ci 12138c2ecf20Sopenharmony_ci if (ssc) { 12148c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12158c2ecf20Sopenharmony_ci CMN_PLL0_VCOCAL_PLLCNT_START, 0x025E); 12168c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12178c2ecf20Sopenharmony_ci CMN_PLL0_LOCK_PLLCNT_THR, 0x0005); 12188c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12198c2ecf20Sopenharmony_ci CMN_PLL1_VCOCAL_PLLCNT_START, 0x025E); 12208c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12218c2ecf20Sopenharmony_ci CMN_PLL1_LOCK_PLLCNT_THR, 0x0005); 12228c2ecf20Sopenharmony_ci } else { 12238c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12248c2ecf20Sopenharmony_ci CMN_PLL0_VCOCAL_PLLCNT_START, 0x0260); 12258c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12268c2ecf20Sopenharmony_ci CMN_PLL1_VCOCAL_PLLCNT_START, 0x0260); 12278c2ecf20Sopenharmony_ci /* Set reset register values to disable SSC */ 12288c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12298c2ecf20Sopenharmony_ci CMN_PLL0_SS_CTRL1_M0, 0x0002); 12308c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12318c2ecf20Sopenharmony_ci CMN_PLL0_SS_CTRL2_M0, 0x0000); 12328c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12338c2ecf20Sopenharmony_ci CMN_PLL0_SS_CTRL3_M0, 0x0000); 12348c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12358c2ecf20Sopenharmony_ci CMN_PLL0_SS_CTRL4_M0, 0x0000); 12368c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12378c2ecf20Sopenharmony_ci CMN_PLL0_LOCK_PLLCNT_THR, 0x0003); 12388c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12398c2ecf20Sopenharmony_ci CMN_PLL1_SS_CTRL1_M0, 0x0002); 12408c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12418c2ecf20Sopenharmony_ci CMN_PLL1_SS_CTRL2_M0, 0x0000); 12428c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12438c2ecf20Sopenharmony_ci CMN_PLL1_SS_CTRL3_M0, 0x0000); 12448c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12458c2ecf20Sopenharmony_ci CMN_PLL1_SS_CTRL4_M0, 0x0000); 12468c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 12478c2ecf20Sopenharmony_ci CMN_PLL1_LOCK_PLLCNT_THR, 0x0003); 12488c2ecf20Sopenharmony_ci } 12498c2ecf20Sopenharmony_ci 12508c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_REFCNT_START, 0x0099); 12518c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_START, 0x0099); 12528c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_REFCNT_START, 0x0099); 12538c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_START, 0x0099); 12548c2ecf20Sopenharmony_ci} 12558c2ecf20Sopenharmony_ci 12568c2ecf20Sopenharmony_cistatic 12578c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_cfg_25mhz(struct cdns_torrent_phy *cdns_phy) 12588c2ecf20Sopenharmony_ci{ 12598c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 12608c2ecf20Sopenharmony_ci 12618c2ecf20Sopenharmony_ci /* refclock registers - assumes 25 MHz refclock */ 12628c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SSM_BIAS_TMR, 0x0019); 12638c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM0_PLLPRE_TMR, 0x0032); 12648c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM0_PLLLOCK_TMR, 0x00D1); 12658c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM1_PLLPRE_TMR, 0x0032); 12668c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLLSM1_PLLLOCK_TMR, 0x00D1); 12678c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_BGCAL_INIT_TMR, 0x007D); 12688c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_BGCAL_ITER_TMR, 0x007D); 12698c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_IBCAL_INIT_TMR, 0x0019); 12708c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPUCAL_INIT_TMR, 0x001E); 12718c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPUCAL_ITER_TMR, 0x0006); 12728c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPDCAL_INIT_TMR, 0x001E); 12738c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_TXPDCAL_ITER_TMR, 0x0006); 12748c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_RXCAL_INIT_TMR, 0x02EE); 12758c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_RXCAL_ITER_TMR, 0x0006); 12768c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_INIT_TMR, 0x0002); 12778c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_ITER_TMR, 0x0002); 12788c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_REFTIM_START, 0x000E); 12798c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_SD_CAL_PLLCNT_START, 0x012B); 12808c2ecf20Sopenharmony_ci 12818c2ecf20Sopenharmony_ci /* PLL registers */ 12828c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_PADJ_M0, 0x0509); 12838c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CP_IADJ_M0, 0x0F00); 12848c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_FILT_PADJ_M0, 0x0F08); 12858c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_DSM_DIAG_M0, 0x0004); 12868c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_PADJ_M0, 0x0509); 12878c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CP_IADJ_M0, 0x0F00); 12888c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_FILT_PADJ_M0, 0x0F08); 12898c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_DSM_DIAG_M0, 0x0004); 12908c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_INIT_TMR, 0x00FA); 12918c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_ITER_TMR, 0x0004); 12928c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_INIT_TMR, 0x00FA); 12938c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_ITER_TMR, 0x0004); 12948c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_REFTIM_START, 0x0317); 12958c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_VCOCAL_TCTRL, 0x0003); 12968c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_REFTIM_START, 0x0317); 12978c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_VCOCAL_TCTRL, 0x0003); 12988c2ecf20Sopenharmony_ci} 12998c2ecf20Sopenharmony_ci 13008c2ecf20Sopenharmony_ci/* 13018c2ecf20Sopenharmony_ci * Set registers responsible for enabling and configuring SSC, with second 13028c2ecf20Sopenharmony_ci * register value provided by a parameter. 13038c2ecf20Sopenharmony_ci */ 13048c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_enable_ssc_25mhz(struct cdns_torrent_phy *cdns_phy, 13058c2ecf20Sopenharmony_ci u32 ctrl2_val) 13068c2ecf20Sopenharmony_ci{ 13078c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 13088c2ecf20Sopenharmony_ci 13098c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0001); 13108c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, ctrl2_val); 13118c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x007F); 13128c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0003); 13138c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0001); 13148c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, ctrl2_val); 13158c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x007F); 13168c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0003); 13178c2ecf20Sopenharmony_ci} 13188c2ecf20Sopenharmony_ci 13198c2ecf20Sopenharmony_cistatic 13208c2ecf20Sopenharmony_civoid cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy *cdns_phy, 13218c2ecf20Sopenharmony_ci u32 rate, bool ssc) 13228c2ecf20Sopenharmony_ci{ 13238c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_common_cdb; 13248c2ecf20Sopenharmony_ci 13258c2ecf20Sopenharmony_ci /* Assumes 25 MHz refclock */ 13268c2ecf20Sopenharmony_ci switch (rate) { 13278c2ecf20Sopenharmony_ci /* Setting VCO for 10.8GHz */ 13288c2ecf20Sopenharmony_ci case 2700: 13298c2ecf20Sopenharmony_ci case 5400: 13308c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x01B0); 13318c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000); 13328c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 13338c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0120); 13348c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x01B0); 13358c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000); 13368c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 13378c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0120); 13388c2ecf20Sopenharmony_ci if (ssc) 13398c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x0423); 13408c2ecf20Sopenharmony_ci break; 13418c2ecf20Sopenharmony_ci /* Setting VCO for 9.72GHz */ 13428c2ecf20Sopenharmony_ci case 1620: 13438c2ecf20Sopenharmony_ci case 2430: 13448c2ecf20Sopenharmony_ci case 3240: 13458c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0184); 13468c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0xCCCD); 13478c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 13488c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x0104); 13498c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0184); 13508c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0xCCCD); 13518c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 13528c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x0104); 13538c2ecf20Sopenharmony_ci if (ssc) 13548c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x03B9); 13558c2ecf20Sopenharmony_ci break; 13568c2ecf20Sopenharmony_ci /* Setting VCO for 8.64GHz */ 13578c2ecf20Sopenharmony_ci case 2160: 13588c2ecf20Sopenharmony_ci case 4320: 13598c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0159); 13608c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x999A); 13618c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 13628c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00E7); 13638c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0159); 13648c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x999A); 13658c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 13668c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00E7); 13678c2ecf20Sopenharmony_ci if (ssc) 13688c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x034F); 13698c2ecf20Sopenharmony_ci break; 13708c2ecf20Sopenharmony_ci /* Setting VCO for 8.1GHz */ 13718c2ecf20Sopenharmony_ci case 8100: 13728c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_INTDIV_M0, 0x0144); 13738c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVL_M0, 0x0000); 13748c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_FRACDIVH_M0, 0x0002); 13758c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_HIGH_THR_M0, 0x00D8); 13768c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_INTDIV_M0, 0x0144); 13778c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVL_M0, 0x0000); 13788c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_FRACDIVH_M0, 0x0002); 13798c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_HIGH_THR_M0, 0x00D8); 13808c2ecf20Sopenharmony_ci if (ssc) 13818c2ecf20Sopenharmony_ci cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x031A); 13828c2ecf20Sopenharmony_ci break; 13838c2ecf20Sopenharmony_ci } 13848c2ecf20Sopenharmony_ci 13858c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL0_CTRL_M0, 0x0002); 13868c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PDIAG_PLL1_CTRL_M0, 0x0002); 13878c2ecf20Sopenharmony_ci 13888c2ecf20Sopenharmony_ci if (ssc) { 13898c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 13908c2ecf20Sopenharmony_ci CMN_PLL0_VCOCAL_PLLCNT_START, 0x0315); 13918c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 13928c2ecf20Sopenharmony_ci CMN_PLL0_LOCK_PLLCNT_THR, 0x0005); 13938c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 13948c2ecf20Sopenharmony_ci CMN_PLL1_VCOCAL_PLLCNT_START, 0x0315); 13958c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 13968c2ecf20Sopenharmony_ci CMN_PLL1_LOCK_PLLCNT_THR, 0x0005); 13978c2ecf20Sopenharmony_ci } else { 13988c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 13998c2ecf20Sopenharmony_ci CMN_PLL0_VCOCAL_PLLCNT_START, 0x0317); 14008c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 14018c2ecf20Sopenharmony_ci CMN_PLL1_VCOCAL_PLLCNT_START, 0x0317); 14028c2ecf20Sopenharmony_ci /* Set reset register values to disable SSC */ 14038c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL1_M0, 0x0002); 14048c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL2_M0, 0x0000); 14058c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL3_M0, 0x0000); 14068c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_SS_CTRL4_M0, 0x0000); 14078c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 14088c2ecf20Sopenharmony_ci CMN_PLL0_LOCK_PLLCNT_THR, 0x0003); 14098c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL1_M0, 0x0002); 14108c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL2_M0, 0x0000); 14118c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL3_M0, 0x0000); 14128c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_SS_CTRL4_M0, 0x0000); 14138c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, 14148c2ecf20Sopenharmony_ci CMN_PLL1_LOCK_PLLCNT_THR, 0x0003); 14158c2ecf20Sopenharmony_ci } 14168c2ecf20Sopenharmony_ci 14178c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_REFCNT_START, 0x00C7); 14188c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL0_LOCK_PLLCNT_START, 0x00C7); 14198c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_REFCNT_START, 0x00C7); 14208c2ecf20Sopenharmony_ci cdns_torrent_phy_write(regmap, CMN_PLL1_LOCK_PLLCNT_START, 0x00C7); 14218c2ecf20Sopenharmony_ci} 14228c2ecf20Sopenharmony_ci 14238c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy *cdns_phy, 14248c2ecf20Sopenharmony_ci u32 rate, u32 num_lanes) 14258c2ecf20Sopenharmony_ci{ 14268c2ecf20Sopenharmony_ci unsigned int clk_sel_val = 0; 14278c2ecf20Sopenharmony_ci unsigned int hsclk_div_val = 0; 14288c2ecf20Sopenharmony_ci unsigned int i; 14298c2ecf20Sopenharmony_ci 14308c2ecf20Sopenharmony_ci /* 16'h0000 for single DP link configuration */ 14318c2ecf20Sopenharmony_ci regmap_field_write(cdns_phy->phy_pll_cfg, 0x0); 14328c2ecf20Sopenharmony_ci 14338c2ecf20Sopenharmony_ci switch (rate) { 14348c2ecf20Sopenharmony_ci case 1620: 14358c2ecf20Sopenharmony_ci clk_sel_val = 0x0f01; 14368c2ecf20Sopenharmony_ci hsclk_div_val = 2; 14378c2ecf20Sopenharmony_ci break; 14388c2ecf20Sopenharmony_ci case 2160: 14398c2ecf20Sopenharmony_ci case 2430: 14408c2ecf20Sopenharmony_ci case 2700: 14418c2ecf20Sopenharmony_ci clk_sel_val = 0x0701; 14428c2ecf20Sopenharmony_ci hsclk_div_val = 1; 14438c2ecf20Sopenharmony_ci break; 14448c2ecf20Sopenharmony_ci case 3240: 14458c2ecf20Sopenharmony_ci clk_sel_val = 0x0b00; 14468c2ecf20Sopenharmony_ci hsclk_div_val = 2; 14478c2ecf20Sopenharmony_ci break; 14488c2ecf20Sopenharmony_ci case 4320: 14498c2ecf20Sopenharmony_ci case 5400: 14508c2ecf20Sopenharmony_ci clk_sel_val = 0x0301; 14518c2ecf20Sopenharmony_ci hsclk_div_val = 0; 14528c2ecf20Sopenharmony_ci break; 14538c2ecf20Sopenharmony_ci case 8100: 14548c2ecf20Sopenharmony_ci clk_sel_val = 0x0200; 14558c2ecf20Sopenharmony_ci hsclk_div_val = 0; 14568c2ecf20Sopenharmony_ci break; 14578c2ecf20Sopenharmony_ci } 14588c2ecf20Sopenharmony_ci 14598c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_common_cdb, 14608c2ecf20Sopenharmony_ci CMN_PDIAG_PLL0_CLK_SEL_M0, clk_sel_val); 14618c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_common_cdb, 14628c2ecf20Sopenharmony_ci CMN_PDIAG_PLL1_CLK_SEL_M0, clk_sel_val); 14638c2ecf20Sopenharmony_ci 14648c2ecf20Sopenharmony_ci /* PMA lane configuration to deal with multi-link operation */ 14658c2ecf20Sopenharmony_ci for (i = 0; i < num_lanes; i++) 14668c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[i], 14678c2ecf20Sopenharmony_ci XCVR_DIAG_HSCLK_DIV, hsclk_div_val); 14688c2ecf20Sopenharmony_ci} 14698c2ecf20Sopenharmony_ci 14708c2ecf20Sopenharmony_cistatic void cdns_torrent_dp_pma_lane_cfg(struct cdns_torrent_phy *cdns_phy, 14718c2ecf20Sopenharmony_ci unsigned int lane) 14728c2ecf20Sopenharmony_ci{ 14738c2ecf20Sopenharmony_ci /* Per lane, refclock-dependent receiver detection setting */ 14748c2ecf20Sopenharmony_ci if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz) 14758c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 14768c2ecf20Sopenharmony_ci TX_RCVDET_ST_TMR, 0x0780); 14778c2ecf20Sopenharmony_ci else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz) 14788c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 14798c2ecf20Sopenharmony_ci TX_RCVDET_ST_TMR, 0x09C4); 14808c2ecf20Sopenharmony_ci 14818c2ecf20Sopenharmony_ci /* Writing Tx/Rx Power State Controllers registers */ 14828c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 14838c2ecf20Sopenharmony_ci TX_PSC_A0, 0x00FB); 14848c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 14858c2ecf20Sopenharmony_ci TX_PSC_A2, 0x04AA); 14868c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 14878c2ecf20Sopenharmony_ci TX_PSC_A3, 0x04AA); 14888c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 14898c2ecf20Sopenharmony_ci RX_PSC_A0, 0x0000); 14908c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 14918c2ecf20Sopenharmony_ci RX_PSC_A2, 0x0000); 14928c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 14938c2ecf20Sopenharmony_ci RX_PSC_A3, 0x0000); 14948c2ecf20Sopenharmony_ci 14958c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 14968c2ecf20Sopenharmony_ci RX_PSC_CAL, 0x0000); 14978c2ecf20Sopenharmony_ci 14988c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 14998c2ecf20Sopenharmony_ci RX_REE_GCSM1_CTRL, 0x0000); 15008c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 15018c2ecf20Sopenharmony_ci RX_REE_GCSM2_CTRL, 0x0000); 15028c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_rx_lane_cdb[lane], 15038c2ecf20Sopenharmony_ci RX_REE_PERGCSM_CTRL, 0x0000); 15048c2ecf20Sopenharmony_ci 15058c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 15068c2ecf20Sopenharmony_ci XCVR_DIAG_BIDI_CTRL, 0x000F); 15078c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 15088c2ecf20Sopenharmony_ci XCVR_DIAG_PLLDRC_CTRL, 0x0001); 15098c2ecf20Sopenharmony_ci cdns_torrent_phy_write(cdns_phy->regmap_tx_lane_cdb[lane], 15108c2ecf20Sopenharmony_ci XCVR_DIAG_HSCLK_SEL, 0x0000); 15118c2ecf20Sopenharmony_ci} 15128c2ecf20Sopenharmony_ci 15138c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy, 15148c2ecf20Sopenharmony_ci u32 num_lanes, 15158c2ecf20Sopenharmony_ci enum phy_powerstate powerstate) 15168c2ecf20Sopenharmony_ci{ 15178c2ecf20Sopenharmony_ci /* Register value for power state for a single byte. */ 15188c2ecf20Sopenharmony_ci u32 value_part; 15198c2ecf20Sopenharmony_ci u32 value; 15208c2ecf20Sopenharmony_ci u32 mask; 15218c2ecf20Sopenharmony_ci u32 read_val; 15228c2ecf20Sopenharmony_ci u32 ret; 15238c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 15248c2ecf20Sopenharmony_ci 15258c2ecf20Sopenharmony_ci switch (powerstate) { 15268c2ecf20Sopenharmony_ci case (POWERSTATE_A0): 15278c2ecf20Sopenharmony_ci value_part = 0x01U; 15288c2ecf20Sopenharmony_ci break; 15298c2ecf20Sopenharmony_ci case (POWERSTATE_A2): 15308c2ecf20Sopenharmony_ci value_part = 0x04U; 15318c2ecf20Sopenharmony_ci break; 15328c2ecf20Sopenharmony_ci default: 15338c2ecf20Sopenharmony_ci /* Powerstate A3 */ 15348c2ecf20Sopenharmony_ci value_part = 0x08U; 15358c2ecf20Sopenharmony_ci break; 15368c2ecf20Sopenharmony_ci } 15378c2ecf20Sopenharmony_ci 15388c2ecf20Sopenharmony_ci /* Select values of registers and mask, depending on enabled 15398c2ecf20Sopenharmony_ci * lane count. 15408c2ecf20Sopenharmony_ci */ 15418c2ecf20Sopenharmony_ci switch (num_lanes) { 15428c2ecf20Sopenharmony_ci /* lane 0 */ 15438c2ecf20Sopenharmony_ci case (1): 15448c2ecf20Sopenharmony_ci value = value_part; 15458c2ecf20Sopenharmony_ci mask = 0x0000003FU; 15468c2ecf20Sopenharmony_ci break; 15478c2ecf20Sopenharmony_ci /* lanes 0-1 */ 15488c2ecf20Sopenharmony_ci case (2): 15498c2ecf20Sopenharmony_ci value = (value_part 15508c2ecf20Sopenharmony_ci | (value_part << 8)); 15518c2ecf20Sopenharmony_ci mask = 0x00003F3FU; 15528c2ecf20Sopenharmony_ci break; 15538c2ecf20Sopenharmony_ci /* lanes 0-3, all */ 15548c2ecf20Sopenharmony_ci default: 15558c2ecf20Sopenharmony_ci value = (value_part 15568c2ecf20Sopenharmony_ci | (value_part << 8) 15578c2ecf20Sopenharmony_ci | (value_part << 16) 15588c2ecf20Sopenharmony_ci | (value_part << 24)); 15598c2ecf20Sopenharmony_ci mask = 0x3F3F3F3FU; 15608c2ecf20Sopenharmony_ci break; 15618c2ecf20Sopenharmony_ci } 15628c2ecf20Sopenharmony_ci 15638c2ecf20Sopenharmony_ci /* Set power state A<n>. */ 15648c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, value); 15658c2ecf20Sopenharmony_ci /* Wait, until PHY acknowledges power state completion. */ 15668c2ecf20Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_POWER_STATE_ACK, 15678c2ecf20Sopenharmony_ci read_val, (read_val & mask) == value, 0, 15688c2ecf20Sopenharmony_ci POLL_TIMEOUT_US); 15698c2ecf20Sopenharmony_ci cdns_torrent_dp_write(regmap, PHY_PMA_XCVR_POWER_STATE_REQ, 0x00000000); 15708c2ecf20Sopenharmony_ci ndelay(100); 15718c2ecf20Sopenharmony_ci 15728c2ecf20Sopenharmony_ci return ret; 15738c2ecf20Sopenharmony_ci} 15748c2ecf20Sopenharmony_ci 15758c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy, u32 num_lanes) 15768c2ecf20Sopenharmony_ci{ 15778c2ecf20Sopenharmony_ci unsigned int read_val; 15788c2ecf20Sopenharmony_ci int ret; 15798c2ecf20Sopenharmony_ci struct regmap *regmap = cdns_phy->regmap_dptx_phy_reg; 15808c2ecf20Sopenharmony_ci 15818c2ecf20Sopenharmony_ci /* 15828c2ecf20Sopenharmony_ci * waiting for ACK of pma_xcvr_pllclk_en_ln_*, only for the 15838c2ecf20Sopenharmony_ci * master lane 15848c2ecf20Sopenharmony_ci */ 15858c2ecf20Sopenharmony_ci ret = regmap_read_poll_timeout(regmap, PHY_PMA_XCVR_PLLCLK_EN_ACK, 15868c2ecf20Sopenharmony_ci read_val, read_val & 1, 15878c2ecf20Sopenharmony_ci 0, POLL_TIMEOUT_US); 15888c2ecf20Sopenharmony_ci if (ret == -ETIMEDOUT) { 15898c2ecf20Sopenharmony_ci dev_err(cdns_phy->dev, 15908c2ecf20Sopenharmony_ci "timeout waiting for link PLL clock enable ack\n"); 15918c2ecf20Sopenharmony_ci return ret; 15928c2ecf20Sopenharmony_ci } 15938c2ecf20Sopenharmony_ci 15948c2ecf20Sopenharmony_ci ndelay(100); 15958c2ecf20Sopenharmony_ci 15968c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, num_lanes, 15978c2ecf20Sopenharmony_ci POWERSTATE_A2); 15988c2ecf20Sopenharmony_ci if (ret) 15998c2ecf20Sopenharmony_ci return ret; 16008c2ecf20Sopenharmony_ci 16018c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_set_power_state(cdns_phy, num_lanes, 16028c2ecf20Sopenharmony_ci POWERSTATE_A0); 16038c2ecf20Sopenharmony_ci 16048c2ecf20Sopenharmony_ci return ret; 16058c2ecf20Sopenharmony_ci} 16068c2ecf20Sopenharmony_ci 16078c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_on(struct phy *phy) 16088c2ecf20Sopenharmony_ci{ 16098c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 16108c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 16118c2ecf20Sopenharmony_ci u32 read_val; 16128c2ecf20Sopenharmony_ci int ret; 16138c2ecf20Sopenharmony_ci 16148c2ecf20Sopenharmony_ci if (cdns_phy->nsubnodes == 1) { 16158c2ecf20Sopenharmony_ci /* Take the PHY lane group out of reset */ 16168c2ecf20Sopenharmony_ci reset_control_deassert(inst->lnk_rst); 16178c2ecf20Sopenharmony_ci 16188c2ecf20Sopenharmony_ci /* Take the PHY out of reset */ 16198c2ecf20Sopenharmony_ci ret = reset_control_deassert(cdns_phy->phy_rst); 16208c2ecf20Sopenharmony_ci if (ret) 16218c2ecf20Sopenharmony_ci return ret; 16228c2ecf20Sopenharmony_ci } 16238c2ecf20Sopenharmony_ci 16248c2ecf20Sopenharmony_ci /* 16258c2ecf20Sopenharmony_ci * Wait for cmn_ready assertion 16268c2ecf20Sopenharmony_ci * PHY_PMA_CMN_CTRL1[0] == 1 16278c2ecf20Sopenharmony_ci */ 16288c2ecf20Sopenharmony_ci ret = regmap_field_read_poll_timeout(cdns_phy->phy_pma_cmn_ctrl_1, 16298c2ecf20Sopenharmony_ci read_val, read_val, 1000, 16308c2ecf20Sopenharmony_ci PLL_LOCK_TIMEOUT); 16318c2ecf20Sopenharmony_ci if (ret) { 16328c2ecf20Sopenharmony_ci dev_err(cdns_phy->dev, "Timeout waiting for CMN ready\n"); 16338c2ecf20Sopenharmony_ci return ret; 16348c2ecf20Sopenharmony_ci } 16358c2ecf20Sopenharmony_ci 16368c2ecf20Sopenharmony_ci mdelay(10); 16378c2ecf20Sopenharmony_ci 16388c2ecf20Sopenharmony_ci return 0; 16398c2ecf20Sopenharmony_ci} 16408c2ecf20Sopenharmony_ci 16418c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_off(struct phy *phy) 16428c2ecf20Sopenharmony_ci{ 16438c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 16448c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 16458c2ecf20Sopenharmony_ci int ret; 16468c2ecf20Sopenharmony_ci 16478c2ecf20Sopenharmony_ci if (cdns_phy->nsubnodes != 1) 16488c2ecf20Sopenharmony_ci return 0; 16498c2ecf20Sopenharmony_ci 16508c2ecf20Sopenharmony_ci ret = reset_control_assert(cdns_phy->phy_rst); 16518c2ecf20Sopenharmony_ci if (ret) 16528c2ecf20Sopenharmony_ci return ret; 16538c2ecf20Sopenharmony_ci 16548c2ecf20Sopenharmony_ci return reset_control_assert(inst->lnk_rst); 16558c2ecf20Sopenharmony_ci} 16568c2ecf20Sopenharmony_ci 16578c2ecf20Sopenharmony_cistatic struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, 16588c2ecf20Sopenharmony_ci u32 block_offset, 16598c2ecf20Sopenharmony_ci u8 reg_offset_shift, 16608c2ecf20Sopenharmony_ci const struct regmap_config *config) 16618c2ecf20Sopenharmony_ci{ 16628c2ecf20Sopenharmony_ci struct cdns_regmap_cdb_context *ctx; 16638c2ecf20Sopenharmony_ci 16648c2ecf20Sopenharmony_ci ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 16658c2ecf20Sopenharmony_ci if (!ctx) 16668c2ecf20Sopenharmony_ci return ERR_PTR(-ENOMEM); 16678c2ecf20Sopenharmony_ci 16688c2ecf20Sopenharmony_ci ctx->dev = dev; 16698c2ecf20Sopenharmony_ci ctx->base = base + block_offset; 16708c2ecf20Sopenharmony_ci ctx->reg_offset_shift = reg_offset_shift; 16718c2ecf20Sopenharmony_ci 16728c2ecf20Sopenharmony_ci return devm_regmap_init(dev, NULL, ctx, config); 16738c2ecf20Sopenharmony_ci} 16748c2ecf20Sopenharmony_ci 16758c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_regfield_init(struct cdns_torrent_phy *cdns_phy) 16768c2ecf20Sopenharmony_ci{ 16778c2ecf20Sopenharmony_ci struct device *dev = cdns_phy->dev; 16788c2ecf20Sopenharmony_ci struct regmap_field *field; 16798c2ecf20Sopenharmony_ci struct regmap *regmap; 16808c2ecf20Sopenharmony_ci 16818c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_dptx_phy_reg; 16828c2ecf20Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_reset_ctrl); 16838c2ecf20Sopenharmony_ci if (IS_ERR(field)) { 16848c2ecf20Sopenharmony_ci dev_err(dev, "PHY_RESET reg field init failed\n"); 16858c2ecf20Sopenharmony_ci return PTR_ERR(field); 16868c2ecf20Sopenharmony_ci } 16878c2ecf20Sopenharmony_ci cdns_phy->phy_reset_ctrl = field; 16888c2ecf20Sopenharmony_ci 16898c2ecf20Sopenharmony_ci return 0; 16908c2ecf20Sopenharmony_ci} 16918c2ecf20Sopenharmony_ci 16928c2ecf20Sopenharmony_cistatic int cdns_torrent_regfield_init(struct cdns_torrent_phy *cdns_phy) 16938c2ecf20Sopenharmony_ci{ 16948c2ecf20Sopenharmony_ci struct device *dev = cdns_phy->dev; 16958c2ecf20Sopenharmony_ci struct regmap_field *field; 16968c2ecf20Sopenharmony_ci struct regmap *regmap; 16978c2ecf20Sopenharmony_ci 16988c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 16998c2ecf20Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pll_cfg); 17008c2ecf20Sopenharmony_ci if (IS_ERR(field)) { 17018c2ecf20Sopenharmony_ci dev_err(dev, "PHY_PLL_CFG reg field init failed\n"); 17028c2ecf20Sopenharmony_ci return PTR_ERR(field); 17038c2ecf20Sopenharmony_ci } 17048c2ecf20Sopenharmony_ci cdns_phy->phy_pll_cfg = field; 17058c2ecf20Sopenharmony_ci 17068c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 17078c2ecf20Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_1); 17088c2ecf20Sopenharmony_ci if (IS_ERR(field)) { 17098c2ecf20Sopenharmony_ci dev_err(dev, "PHY_PMA_CMN_CTRL1 reg field init failed\n"); 17108c2ecf20Sopenharmony_ci return PTR_ERR(field); 17118c2ecf20Sopenharmony_ci } 17128c2ecf20Sopenharmony_ci cdns_phy->phy_pma_cmn_ctrl_1 = field; 17138c2ecf20Sopenharmony_ci 17148c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 17158c2ecf20Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_2); 17168c2ecf20Sopenharmony_ci if (IS_ERR(field)) { 17178c2ecf20Sopenharmony_ci dev_err(dev, "PHY_PMA_CMN_CTRL2 reg field init failed\n"); 17188c2ecf20Sopenharmony_ci return PTR_ERR(field); 17198c2ecf20Sopenharmony_ci } 17208c2ecf20Sopenharmony_ci cdns_phy->phy_pma_cmn_ctrl_2 = field; 17218c2ecf20Sopenharmony_ci 17228c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_phy_pma_common_cdb; 17238c2ecf20Sopenharmony_ci field = devm_regmap_field_alloc(dev, regmap, phy_pma_pll_raw_ctrl); 17248c2ecf20Sopenharmony_ci if (IS_ERR(field)) { 17258c2ecf20Sopenharmony_ci dev_err(dev, "PHY_PMA_PLL_RAW_CTRL reg field init failed\n"); 17268c2ecf20Sopenharmony_ci return PTR_ERR(field); 17278c2ecf20Sopenharmony_ci } 17288c2ecf20Sopenharmony_ci cdns_phy->phy_pma_pll_raw_ctrl = field; 17298c2ecf20Sopenharmony_ci 17308c2ecf20Sopenharmony_ci return 0; 17318c2ecf20Sopenharmony_ci} 17328c2ecf20Sopenharmony_ci 17338c2ecf20Sopenharmony_cistatic int cdns_torrent_dp_regmap_init(struct cdns_torrent_phy *cdns_phy) 17348c2ecf20Sopenharmony_ci{ 17358c2ecf20Sopenharmony_ci void __iomem *base = cdns_phy->base; 17368c2ecf20Sopenharmony_ci struct device *dev = cdns_phy->dev; 17378c2ecf20Sopenharmony_ci struct regmap *regmap; 17388c2ecf20Sopenharmony_ci u8 reg_offset_shift; 17398c2ecf20Sopenharmony_ci u32 block_offset; 17408c2ecf20Sopenharmony_ci 17418c2ecf20Sopenharmony_ci reg_offset_shift = cdns_phy->init_data->reg_offset_shift; 17428c2ecf20Sopenharmony_ci 17438c2ecf20Sopenharmony_ci block_offset = TORRENT_DPTX_PHY_OFFSET; 17448c2ecf20Sopenharmony_ci regmap = cdns_regmap_init(dev, base, block_offset, 17458c2ecf20Sopenharmony_ci reg_offset_shift, 17468c2ecf20Sopenharmony_ci &cdns_torrent_dptx_phy_config); 17478c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) { 17488c2ecf20Sopenharmony_ci dev_err(dev, "Failed to init DPTX PHY regmap\n"); 17498c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 17508c2ecf20Sopenharmony_ci } 17518c2ecf20Sopenharmony_ci cdns_phy->regmap_dptx_phy_reg = regmap; 17528c2ecf20Sopenharmony_ci 17538c2ecf20Sopenharmony_ci return 0; 17548c2ecf20Sopenharmony_ci} 17558c2ecf20Sopenharmony_ci 17568c2ecf20Sopenharmony_cistatic int cdns_torrent_regmap_init(struct cdns_torrent_phy *cdns_phy) 17578c2ecf20Sopenharmony_ci{ 17588c2ecf20Sopenharmony_ci void __iomem *sd_base = cdns_phy->sd_base; 17598c2ecf20Sopenharmony_ci u8 block_offset_shift, reg_offset_shift; 17608c2ecf20Sopenharmony_ci struct device *dev = cdns_phy->dev; 17618c2ecf20Sopenharmony_ci struct regmap *regmap; 17628c2ecf20Sopenharmony_ci u32 block_offset; 17638c2ecf20Sopenharmony_ci int i; 17648c2ecf20Sopenharmony_ci 17658c2ecf20Sopenharmony_ci block_offset_shift = cdns_phy->init_data->block_offset_shift; 17668c2ecf20Sopenharmony_ci reg_offset_shift = cdns_phy->init_data->reg_offset_shift; 17678c2ecf20Sopenharmony_ci 17688c2ecf20Sopenharmony_ci for (i = 0; i < MAX_NUM_LANES; i++) { 17698c2ecf20Sopenharmony_ci block_offset = TORRENT_TX_LANE_CDB_OFFSET(i, block_offset_shift, 17708c2ecf20Sopenharmony_ci reg_offset_shift); 17718c2ecf20Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 17728c2ecf20Sopenharmony_ci reg_offset_shift, 17738c2ecf20Sopenharmony_ci &cdns_torrent_tx_lane_cdb_config[i]); 17748c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) { 17758c2ecf20Sopenharmony_ci dev_err(dev, "Failed to init tx lane CDB regmap\n"); 17768c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 17778c2ecf20Sopenharmony_ci } 17788c2ecf20Sopenharmony_ci cdns_phy->regmap_tx_lane_cdb[i] = regmap; 17798c2ecf20Sopenharmony_ci 17808c2ecf20Sopenharmony_ci block_offset = TORRENT_RX_LANE_CDB_OFFSET(i, block_offset_shift, 17818c2ecf20Sopenharmony_ci reg_offset_shift); 17828c2ecf20Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 17838c2ecf20Sopenharmony_ci reg_offset_shift, 17848c2ecf20Sopenharmony_ci &cdns_torrent_rx_lane_cdb_config[i]); 17858c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) { 17868c2ecf20Sopenharmony_ci dev_err(dev, "Failed to init rx lane CDB regmap\n"); 17878c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 17888c2ecf20Sopenharmony_ci } 17898c2ecf20Sopenharmony_ci cdns_phy->regmap_rx_lane_cdb[i] = regmap; 17908c2ecf20Sopenharmony_ci } 17918c2ecf20Sopenharmony_ci 17928c2ecf20Sopenharmony_ci block_offset = TORRENT_COMMON_CDB_OFFSET; 17938c2ecf20Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 17948c2ecf20Sopenharmony_ci reg_offset_shift, 17958c2ecf20Sopenharmony_ci &cdns_torrent_common_cdb_config); 17968c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) { 17978c2ecf20Sopenharmony_ci dev_err(dev, "Failed to init common CDB regmap\n"); 17988c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 17998c2ecf20Sopenharmony_ci } 18008c2ecf20Sopenharmony_ci cdns_phy->regmap_common_cdb = regmap; 18018c2ecf20Sopenharmony_ci 18028c2ecf20Sopenharmony_ci block_offset = TORRENT_PHY_PCS_COMMON_OFFSET(block_offset_shift); 18038c2ecf20Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 18048c2ecf20Sopenharmony_ci reg_offset_shift, 18058c2ecf20Sopenharmony_ci &cdns_torrent_phy_pcs_cmn_cdb_config); 18068c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) { 18078c2ecf20Sopenharmony_ci dev_err(dev, "Failed to init PHY PCS common CDB regmap\n"); 18088c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 18098c2ecf20Sopenharmony_ci } 18108c2ecf20Sopenharmony_ci cdns_phy->regmap_phy_pcs_common_cdb = regmap; 18118c2ecf20Sopenharmony_ci 18128c2ecf20Sopenharmony_ci block_offset = TORRENT_PHY_PMA_COMMON_OFFSET(block_offset_shift); 18138c2ecf20Sopenharmony_ci regmap = cdns_regmap_init(dev, sd_base, block_offset, 18148c2ecf20Sopenharmony_ci reg_offset_shift, 18158c2ecf20Sopenharmony_ci &cdns_torrent_phy_pma_cmn_cdb_config); 18168c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) { 18178c2ecf20Sopenharmony_ci dev_err(dev, "Failed to init PHY PMA common CDB regmap\n"); 18188c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 18198c2ecf20Sopenharmony_ci } 18208c2ecf20Sopenharmony_ci cdns_phy->regmap_phy_pma_common_cdb = regmap; 18218c2ecf20Sopenharmony_ci 18228c2ecf20Sopenharmony_ci return 0; 18238c2ecf20Sopenharmony_ci} 18248c2ecf20Sopenharmony_ci 18258c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_init(struct phy *phy) 18268c2ecf20Sopenharmony_ci{ 18278c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); 18288c2ecf20Sopenharmony_ci const struct cdns_torrent_data *init_data = cdns_phy->init_data; 18298c2ecf20Sopenharmony_ci struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals; 18308c2ecf20Sopenharmony_ci struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals; 18318c2ecf20Sopenharmony_ci struct cdns_torrent_inst *inst = phy_get_drvdata(phy); 18328c2ecf20Sopenharmony_ci enum cdns_torrent_phy_type phy_type = inst->phy_type; 18338c2ecf20Sopenharmony_ci enum cdns_torrent_ssc_mode ssc = inst->ssc_mode; 18348c2ecf20Sopenharmony_ci struct cdns_torrent_vals *pcs_cmn_vals; 18358c2ecf20Sopenharmony_ci struct cdns_reg_pairs *reg_pairs; 18368c2ecf20Sopenharmony_ci struct regmap *regmap; 18378c2ecf20Sopenharmony_ci u32 num_regs; 18388c2ecf20Sopenharmony_ci int i, j; 18398c2ecf20Sopenharmony_ci 18408c2ecf20Sopenharmony_ci if (cdns_phy->nsubnodes > 1) 18418c2ecf20Sopenharmony_ci return 0; 18428c2ecf20Sopenharmony_ci 18438c2ecf20Sopenharmony_ci if (phy_type == TYPE_DP) 18448c2ecf20Sopenharmony_ci return cdns_torrent_dp_init(phy); 18458c2ecf20Sopenharmony_ci 18468c2ecf20Sopenharmony_ci /** 18478c2ecf20Sopenharmony_ci * Spread spectrum generation is not required or supported 18488c2ecf20Sopenharmony_ci * for SGMII/QSGMII 18498c2ecf20Sopenharmony_ci */ 18508c2ecf20Sopenharmony_ci if (phy_type == TYPE_SGMII || phy_type == TYPE_QSGMII) 18518c2ecf20Sopenharmony_ci ssc = NO_SSC; 18528c2ecf20Sopenharmony_ci 18538c2ecf20Sopenharmony_ci /* PHY configuration specific registers for single link */ 18548c2ecf20Sopenharmony_ci link_cmn_vals = init_data->link_cmn_vals[phy_type][TYPE_NONE][ssc]; 18558c2ecf20Sopenharmony_ci if (link_cmn_vals) { 18568c2ecf20Sopenharmony_ci reg_pairs = link_cmn_vals->reg_pairs; 18578c2ecf20Sopenharmony_ci num_regs = link_cmn_vals->num_regs; 18588c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 18598c2ecf20Sopenharmony_ci 18608c2ecf20Sopenharmony_ci /** 18618c2ecf20Sopenharmony_ci * First array value in link_cmn_vals must be of 18628c2ecf20Sopenharmony_ci * PHY_PLL_CFG register 18638c2ecf20Sopenharmony_ci */ 18648c2ecf20Sopenharmony_ci regmap_field_write(cdns_phy->phy_pll_cfg, reg_pairs[0].val); 18658c2ecf20Sopenharmony_ci 18668c2ecf20Sopenharmony_ci for (i = 1; i < num_regs; i++) 18678c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 18688c2ecf20Sopenharmony_ci reg_pairs[i].val); 18698c2ecf20Sopenharmony_ci } 18708c2ecf20Sopenharmony_ci 18718c2ecf20Sopenharmony_ci xcvr_diag_vals = init_data->xcvr_diag_vals[phy_type][TYPE_NONE][ssc]; 18728c2ecf20Sopenharmony_ci if (xcvr_diag_vals) { 18738c2ecf20Sopenharmony_ci reg_pairs = xcvr_diag_vals->reg_pairs; 18748c2ecf20Sopenharmony_ci num_regs = xcvr_diag_vals->num_regs; 18758c2ecf20Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) { 18768c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane]; 18778c2ecf20Sopenharmony_ci for (j = 0; j < num_regs; j++) 18788c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 18798c2ecf20Sopenharmony_ci reg_pairs[j].val); 18808c2ecf20Sopenharmony_ci } 18818c2ecf20Sopenharmony_ci } 18828c2ecf20Sopenharmony_ci 18838c2ecf20Sopenharmony_ci /* PHY PCS common registers configurations */ 18848c2ecf20Sopenharmony_ci pcs_cmn_vals = init_data->pcs_cmn_vals[phy_type][TYPE_NONE][ssc]; 18858c2ecf20Sopenharmony_ci if (pcs_cmn_vals) { 18868c2ecf20Sopenharmony_ci reg_pairs = pcs_cmn_vals->reg_pairs; 18878c2ecf20Sopenharmony_ci num_regs = pcs_cmn_vals->num_regs; 18888c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 18898c2ecf20Sopenharmony_ci for (i = 0; i < num_regs; i++) 18908c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 18918c2ecf20Sopenharmony_ci reg_pairs[i].val); 18928c2ecf20Sopenharmony_ci } 18938c2ecf20Sopenharmony_ci 18948c2ecf20Sopenharmony_ci /* PMA common registers configurations */ 18958c2ecf20Sopenharmony_ci cmn_vals = init_data->cmn_vals[phy_type][TYPE_NONE][ssc]; 18968c2ecf20Sopenharmony_ci if (cmn_vals) { 18978c2ecf20Sopenharmony_ci reg_pairs = cmn_vals->reg_pairs; 18988c2ecf20Sopenharmony_ci num_regs = cmn_vals->num_regs; 18998c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 19008c2ecf20Sopenharmony_ci for (i = 0; i < num_regs; i++) 19018c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 19028c2ecf20Sopenharmony_ci reg_pairs[i].val); 19038c2ecf20Sopenharmony_ci } 19048c2ecf20Sopenharmony_ci 19058c2ecf20Sopenharmony_ci /* PMA TX lane registers configurations */ 19068c2ecf20Sopenharmony_ci tx_ln_vals = init_data->tx_ln_vals[phy_type][TYPE_NONE][ssc]; 19078c2ecf20Sopenharmony_ci if (tx_ln_vals) { 19088c2ecf20Sopenharmony_ci reg_pairs = tx_ln_vals->reg_pairs; 19098c2ecf20Sopenharmony_ci num_regs = tx_ln_vals->num_regs; 19108c2ecf20Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) { 19118c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + inst->mlane]; 19128c2ecf20Sopenharmony_ci for (j = 0; j < num_regs; j++) 19138c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 19148c2ecf20Sopenharmony_ci reg_pairs[j].val); 19158c2ecf20Sopenharmony_ci } 19168c2ecf20Sopenharmony_ci } 19178c2ecf20Sopenharmony_ci 19188c2ecf20Sopenharmony_ci /* PMA RX lane registers configurations */ 19198c2ecf20Sopenharmony_ci rx_ln_vals = init_data->rx_ln_vals[phy_type][TYPE_NONE][ssc]; 19208c2ecf20Sopenharmony_ci if (rx_ln_vals) { 19218c2ecf20Sopenharmony_ci reg_pairs = rx_ln_vals->reg_pairs; 19228c2ecf20Sopenharmony_ci num_regs = rx_ln_vals->num_regs; 19238c2ecf20Sopenharmony_ci for (i = 0; i < inst->num_lanes; i++) { 19248c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_rx_lane_cdb[i + inst->mlane]; 19258c2ecf20Sopenharmony_ci for (j = 0; j < num_regs; j++) 19268c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 19278c2ecf20Sopenharmony_ci reg_pairs[j].val); 19288c2ecf20Sopenharmony_ci } 19298c2ecf20Sopenharmony_ci } 19308c2ecf20Sopenharmony_ci 19318c2ecf20Sopenharmony_ci return 0; 19328c2ecf20Sopenharmony_ci} 19338c2ecf20Sopenharmony_ci 19348c2ecf20Sopenharmony_cistatic 19358c2ecf20Sopenharmony_ciint cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) 19368c2ecf20Sopenharmony_ci{ 19378c2ecf20Sopenharmony_ci const struct cdns_torrent_data *init_data = cdns_phy->init_data; 19388c2ecf20Sopenharmony_ci struct cdns_torrent_vals *cmn_vals, *tx_ln_vals, *rx_ln_vals; 19398c2ecf20Sopenharmony_ci struct cdns_torrent_vals *link_cmn_vals, *xcvr_diag_vals; 19408c2ecf20Sopenharmony_ci enum cdns_torrent_phy_type phy_t1, phy_t2, tmp_phy_type; 19418c2ecf20Sopenharmony_ci struct cdns_torrent_vals *pcs_cmn_vals; 19428c2ecf20Sopenharmony_ci int i, j, node, mlane, num_lanes, ret; 19438c2ecf20Sopenharmony_ci struct cdns_reg_pairs *reg_pairs; 19448c2ecf20Sopenharmony_ci enum cdns_torrent_ssc_mode ssc; 19458c2ecf20Sopenharmony_ci struct regmap *regmap; 19468c2ecf20Sopenharmony_ci u32 num_regs; 19478c2ecf20Sopenharmony_ci 19488c2ecf20Sopenharmony_ci /* Maximum 2 links (subnodes) are supported */ 19498c2ecf20Sopenharmony_ci if (cdns_phy->nsubnodes != 2) 19508c2ecf20Sopenharmony_ci return -EINVAL; 19518c2ecf20Sopenharmony_ci 19528c2ecf20Sopenharmony_ci phy_t1 = cdns_phy->phys[0].phy_type; 19538c2ecf20Sopenharmony_ci phy_t2 = cdns_phy->phys[1].phy_type; 19548c2ecf20Sopenharmony_ci 19558c2ecf20Sopenharmony_ci /** 19568c2ecf20Sopenharmony_ci * First configure the PHY for first link with phy_t1. Get the array 19578c2ecf20Sopenharmony_ci * values as [phy_t1][phy_t2][ssc]. 19588c2ecf20Sopenharmony_ci */ 19598c2ecf20Sopenharmony_ci for (node = 0; node < cdns_phy->nsubnodes; node++) { 19608c2ecf20Sopenharmony_ci if (node == 1) { 19618c2ecf20Sopenharmony_ci /** 19628c2ecf20Sopenharmony_ci * If first link with phy_t1 is configured, then 19638c2ecf20Sopenharmony_ci * configure the PHY for second link with phy_t2. 19648c2ecf20Sopenharmony_ci * Get the array values as [phy_t2][phy_t1][ssc]. 19658c2ecf20Sopenharmony_ci */ 19668c2ecf20Sopenharmony_ci tmp_phy_type = phy_t1; 19678c2ecf20Sopenharmony_ci phy_t1 = phy_t2; 19688c2ecf20Sopenharmony_ci phy_t2 = tmp_phy_type; 19698c2ecf20Sopenharmony_ci } 19708c2ecf20Sopenharmony_ci 19718c2ecf20Sopenharmony_ci mlane = cdns_phy->phys[node].mlane; 19728c2ecf20Sopenharmony_ci ssc = cdns_phy->phys[node].ssc_mode; 19738c2ecf20Sopenharmony_ci num_lanes = cdns_phy->phys[node].num_lanes; 19748c2ecf20Sopenharmony_ci 19758c2ecf20Sopenharmony_ci /** 19768c2ecf20Sopenharmony_ci * PHY configuration specific registers: 19778c2ecf20Sopenharmony_ci * link_cmn_vals depend on combination of PHY types being 19788c2ecf20Sopenharmony_ci * configured and are common for both PHY types, so array 19798c2ecf20Sopenharmony_ci * values should be same for [phy_t1][phy_t2][ssc] and 19808c2ecf20Sopenharmony_ci * [phy_t2][phy_t1][ssc]. 19818c2ecf20Sopenharmony_ci * xcvr_diag_vals also depend on combination of PHY types 19828c2ecf20Sopenharmony_ci * being configured, but these can be different for particular 19838c2ecf20Sopenharmony_ci * PHY type and are per lane. 19848c2ecf20Sopenharmony_ci */ 19858c2ecf20Sopenharmony_ci link_cmn_vals = init_data->link_cmn_vals[phy_t1][phy_t2][ssc]; 19868c2ecf20Sopenharmony_ci if (link_cmn_vals) { 19878c2ecf20Sopenharmony_ci reg_pairs = link_cmn_vals->reg_pairs; 19888c2ecf20Sopenharmony_ci num_regs = link_cmn_vals->num_regs; 19898c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 19908c2ecf20Sopenharmony_ci 19918c2ecf20Sopenharmony_ci /** 19928c2ecf20Sopenharmony_ci * First array value in link_cmn_vals must be of 19938c2ecf20Sopenharmony_ci * PHY_PLL_CFG register 19948c2ecf20Sopenharmony_ci */ 19958c2ecf20Sopenharmony_ci regmap_field_write(cdns_phy->phy_pll_cfg, 19968c2ecf20Sopenharmony_ci reg_pairs[0].val); 19978c2ecf20Sopenharmony_ci 19988c2ecf20Sopenharmony_ci for (i = 1; i < num_regs; i++) 19998c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 20008c2ecf20Sopenharmony_ci reg_pairs[i].val); 20018c2ecf20Sopenharmony_ci } 20028c2ecf20Sopenharmony_ci 20038c2ecf20Sopenharmony_ci xcvr_diag_vals = init_data->xcvr_diag_vals[phy_t1][phy_t2][ssc]; 20048c2ecf20Sopenharmony_ci if (xcvr_diag_vals) { 20058c2ecf20Sopenharmony_ci reg_pairs = xcvr_diag_vals->reg_pairs; 20068c2ecf20Sopenharmony_ci num_regs = xcvr_diag_vals->num_regs; 20078c2ecf20Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 20088c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + mlane]; 20098c2ecf20Sopenharmony_ci for (j = 0; j < num_regs; j++) 20108c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 20118c2ecf20Sopenharmony_ci reg_pairs[j].val); 20128c2ecf20Sopenharmony_ci } 20138c2ecf20Sopenharmony_ci } 20148c2ecf20Sopenharmony_ci 20158c2ecf20Sopenharmony_ci /* PHY PCS common registers configurations */ 20168c2ecf20Sopenharmony_ci pcs_cmn_vals = init_data->pcs_cmn_vals[phy_t1][phy_t2][ssc]; 20178c2ecf20Sopenharmony_ci if (pcs_cmn_vals) { 20188c2ecf20Sopenharmony_ci reg_pairs = pcs_cmn_vals->reg_pairs; 20198c2ecf20Sopenharmony_ci num_regs = pcs_cmn_vals->num_regs; 20208c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_phy_pcs_common_cdb; 20218c2ecf20Sopenharmony_ci for (i = 0; i < num_regs; i++) 20228c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 20238c2ecf20Sopenharmony_ci reg_pairs[i].val); 20248c2ecf20Sopenharmony_ci } 20258c2ecf20Sopenharmony_ci 20268c2ecf20Sopenharmony_ci /* PMA common registers configurations */ 20278c2ecf20Sopenharmony_ci cmn_vals = init_data->cmn_vals[phy_t1][phy_t2][ssc]; 20288c2ecf20Sopenharmony_ci if (cmn_vals) { 20298c2ecf20Sopenharmony_ci reg_pairs = cmn_vals->reg_pairs; 20308c2ecf20Sopenharmony_ci num_regs = cmn_vals->num_regs; 20318c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_common_cdb; 20328c2ecf20Sopenharmony_ci for (i = 0; i < num_regs; i++) 20338c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[i].off, 20348c2ecf20Sopenharmony_ci reg_pairs[i].val); 20358c2ecf20Sopenharmony_ci } 20368c2ecf20Sopenharmony_ci 20378c2ecf20Sopenharmony_ci /* PMA TX lane registers configurations */ 20388c2ecf20Sopenharmony_ci tx_ln_vals = init_data->tx_ln_vals[phy_t1][phy_t2][ssc]; 20398c2ecf20Sopenharmony_ci if (tx_ln_vals) { 20408c2ecf20Sopenharmony_ci reg_pairs = tx_ln_vals->reg_pairs; 20418c2ecf20Sopenharmony_ci num_regs = tx_ln_vals->num_regs; 20428c2ecf20Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 20438c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_tx_lane_cdb[i + mlane]; 20448c2ecf20Sopenharmony_ci for (j = 0; j < num_regs; j++) 20458c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 20468c2ecf20Sopenharmony_ci reg_pairs[j].val); 20478c2ecf20Sopenharmony_ci } 20488c2ecf20Sopenharmony_ci } 20498c2ecf20Sopenharmony_ci 20508c2ecf20Sopenharmony_ci /* PMA RX lane registers configurations */ 20518c2ecf20Sopenharmony_ci rx_ln_vals = init_data->rx_ln_vals[phy_t1][phy_t2][ssc]; 20528c2ecf20Sopenharmony_ci if (rx_ln_vals) { 20538c2ecf20Sopenharmony_ci reg_pairs = rx_ln_vals->reg_pairs; 20548c2ecf20Sopenharmony_ci num_regs = rx_ln_vals->num_regs; 20558c2ecf20Sopenharmony_ci for (i = 0; i < num_lanes; i++) { 20568c2ecf20Sopenharmony_ci regmap = cdns_phy->regmap_rx_lane_cdb[i + mlane]; 20578c2ecf20Sopenharmony_ci for (j = 0; j < num_regs; j++) 20588c2ecf20Sopenharmony_ci regmap_write(regmap, reg_pairs[j].off, 20598c2ecf20Sopenharmony_ci reg_pairs[j].val); 20608c2ecf20Sopenharmony_ci } 20618c2ecf20Sopenharmony_ci } 20628c2ecf20Sopenharmony_ci 20638c2ecf20Sopenharmony_ci reset_control_deassert(cdns_phy->phys[node].lnk_rst); 20648c2ecf20Sopenharmony_ci } 20658c2ecf20Sopenharmony_ci 20668c2ecf20Sopenharmony_ci /* Take the PHY out of reset */ 20678c2ecf20Sopenharmony_ci ret = reset_control_deassert(cdns_phy->phy_rst); 20688c2ecf20Sopenharmony_ci if (ret) 20698c2ecf20Sopenharmony_ci return ret; 20708c2ecf20Sopenharmony_ci 20718c2ecf20Sopenharmony_ci return 0; 20728c2ecf20Sopenharmony_ci} 20738c2ecf20Sopenharmony_ci 20748c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_probe(struct platform_device *pdev) 20758c2ecf20Sopenharmony_ci{ 20768c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy; 20778c2ecf20Sopenharmony_ci struct device *dev = &pdev->dev; 20788c2ecf20Sopenharmony_ci struct phy_provider *phy_provider; 20798c2ecf20Sopenharmony_ci const struct cdns_torrent_data *data; 20808c2ecf20Sopenharmony_ci struct device_node *child; 20818c2ecf20Sopenharmony_ci int ret, subnodes, node = 0, i; 20828c2ecf20Sopenharmony_ci u32 total_num_lanes = 0; 20838c2ecf20Sopenharmony_ci u8 init_dp_regmap = 0; 20848c2ecf20Sopenharmony_ci u32 phy_type; 20858c2ecf20Sopenharmony_ci 20868c2ecf20Sopenharmony_ci /* Get init data for this PHY */ 20878c2ecf20Sopenharmony_ci data = of_device_get_match_data(dev); 20888c2ecf20Sopenharmony_ci if (!data) 20898c2ecf20Sopenharmony_ci return -EINVAL; 20908c2ecf20Sopenharmony_ci 20918c2ecf20Sopenharmony_ci cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL); 20928c2ecf20Sopenharmony_ci if (!cdns_phy) 20938c2ecf20Sopenharmony_ci return -ENOMEM; 20948c2ecf20Sopenharmony_ci 20958c2ecf20Sopenharmony_ci dev_set_drvdata(dev, cdns_phy); 20968c2ecf20Sopenharmony_ci cdns_phy->dev = dev; 20978c2ecf20Sopenharmony_ci cdns_phy->init_data = data; 20988c2ecf20Sopenharmony_ci 20998c2ecf20Sopenharmony_ci cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0); 21008c2ecf20Sopenharmony_ci if (IS_ERR(cdns_phy->phy_rst)) { 21018c2ecf20Sopenharmony_ci dev_err(dev, "%s: failed to get reset\n", 21028c2ecf20Sopenharmony_ci dev->of_node->full_name); 21038c2ecf20Sopenharmony_ci return PTR_ERR(cdns_phy->phy_rst); 21048c2ecf20Sopenharmony_ci } 21058c2ecf20Sopenharmony_ci 21068c2ecf20Sopenharmony_ci cdns_phy->apb_rst = devm_reset_control_get_optional(dev, "torrent_apb"); 21078c2ecf20Sopenharmony_ci if (IS_ERR(cdns_phy->apb_rst)) { 21088c2ecf20Sopenharmony_ci dev_err(dev, "%s: failed to get apb reset\n", 21098c2ecf20Sopenharmony_ci dev->of_node->full_name); 21108c2ecf20Sopenharmony_ci return PTR_ERR(cdns_phy->apb_rst); 21118c2ecf20Sopenharmony_ci } 21128c2ecf20Sopenharmony_ci 21138c2ecf20Sopenharmony_ci cdns_phy->clk = devm_clk_get(dev, "refclk"); 21148c2ecf20Sopenharmony_ci if (IS_ERR(cdns_phy->clk)) { 21158c2ecf20Sopenharmony_ci dev_err(dev, "phy ref clock not found\n"); 21168c2ecf20Sopenharmony_ci return PTR_ERR(cdns_phy->clk); 21178c2ecf20Sopenharmony_ci } 21188c2ecf20Sopenharmony_ci 21198c2ecf20Sopenharmony_ci cdns_phy->sd_base = devm_platform_ioremap_resource(pdev, 0); 21208c2ecf20Sopenharmony_ci if (IS_ERR(cdns_phy->sd_base)) 21218c2ecf20Sopenharmony_ci return PTR_ERR(cdns_phy->sd_base); 21228c2ecf20Sopenharmony_ci 21238c2ecf20Sopenharmony_ci subnodes = of_get_available_child_count(dev->of_node); 21248c2ecf20Sopenharmony_ci if (subnodes == 0) { 21258c2ecf20Sopenharmony_ci dev_err(dev, "No available link subnodes found\n"); 21268c2ecf20Sopenharmony_ci return -EINVAL; 21278c2ecf20Sopenharmony_ci } 21288c2ecf20Sopenharmony_ci 21298c2ecf20Sopenharmony_ci ret = cdns_torrent_regmap_init(cdns_phy); 21308c2ecf20Sopenharmony_ci if (ret) 21318c2ecf20Sopenharmony_ci return ret; 21328c2ecf20Sopenharmony_ci 21338c2ecf20Sopenharmony_ci ret = cdns_torrent_regfield_init(cdns_phy); 21348c2ecf20Sopenharmony_ci if (ret) 21358c2ecf20Sopenharmony_ci return ret; 21368c2ecf20Sopenharmony_ci 21378c2ecf20Sopenharmony_ci ret = clk_prepare_enable(cdns_phy->clk); 21388c2ecf20Sopenharmony_ci if (ret) { 21398c2ecf20Sopenharmony_ci dev_err(cdns_phy->dev, "Failed to prepare ref clock\n"); 21408c2ecf20Sopenharmony_ci return ret; 21418c2ecf20Sopenharmony_ci } 21428c2ecf20Sopenharmony_ci 21438c2ecf20Sopenharmony_ci cdns_phy->ref_clk_rate = clk_get_rate(cdns_phy->clk); 21448c2ecf20Sopenharmony_ci if (!(cdns_phy->ref_clk_rate)) { 21458c2ecf20Sopenharmony_ci dev_err(cdns_phy->dev, "Failed to get ref clock rate\n"); 21468c2ecf20Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 21478c2ecf20Sopenharmony_ci return -EINVAL; 21488c2ecf20Sopenharmony_ci } 21498c2ecf20Sopenharmony_ci 21508c2ecf20Sopenharmony_ci /* Enable APB */ 21518c2ecf20Sopenharmony_ci reset_control_deassert(cdns_phy->apb_rst); 21528c2ecf20Sopenharmony_ci 21538c2ecf20Sopenharmony_ci for_each_available_child_of_node(dev->of_node, child) { 21548c2ecf20Sopenharmony_ci struct phy *gphy; 21558c2ecf20Sopenharmony_ci 21568c2ecf20Sopenharmony_ci /* PHY subnode name must be 'phy'. */ 21578c2ecf20Sopenharmony_ci if (!(of_node_name_eq(child, "phy"))) 21588c2ecf20Sopenharmony_ci continue; 21598c2ecf20Sopenharmony_ci 21608c2ecf20Sopenharmony_ci cdns_phy->phys[node].lnk_rst = 21618c2ecf20Sopenharmony_ci of_reset_control_array_get_exclusive(child); 21628c2ecf20Sopenharmony_ci if (IS_ERR(cdns_phy->phys[node].lnk_rst)) { 21638c2ecf20Sopenharmony_ci dev_err(dev, "%s: failed to get reset\n", 21648c2ecf20Sopenharmony_ci child->full_name); 21658c2ecf20Sopenharmony_ci ret = PTR_ERR(cdns_phy->phys[node].lnk_rst); 21668c2ecf20Sopenharmony_ci goto put_lnk_rst; 21678c2ecf20Sopenharmony_ci } 21688c2ecf20Sopenharmony_ci 21698c2ecf20Sopenharmony_ci if (of_property_read_u32(child, "reg", 21708c2ecf20Sopenharmony_ci &cdns_phy->phys[node].mlane)) { 21718c2ecf20Sopenharmony_ci dev_err(dev, "%s: No \"reg\"-property.\n", 21728c2ecf20Sopenharmony_ci child->full_name); 21738c2ecf20Sopenharmony_ci ret = -EINVAL; 21748c2ecf20Sopenharmony_ci goto put_child; 21758c2ecf20Sopenharmony_ci } 21768c2ecf20Sopenharmony_ci 21778c2ecf20Sopenharmony_ci if (of_property_read_u32(child, "cdns,phy-type", &phy_type)) { 21788c2ecf20Sopenharmony_ci dev_err(dev, "%s: No \"cdns,phy-type\"-property.\n", 21798c2ecf20Sopenharmony_ci child->full_name); 21808c2ecf20Sopenharmony_ci ret = -EINVAL; 21818c2ecf20Sopenharmony_ci goto put_child; 21828c2ecf20Sopenharmony_ci } 21838c2ecf20Sopenharmony_ci 21848c2ecf20Sopenharmony_ci switch (phy_type) { 21858c2ecf20Sopenharmony_ci case PHY_TYPE_PCIE: 21868c2ecf20Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_PCIE; 21878c2ecf20Sopenharmony_ci break; 21888c2ecf20Sopenharmony_ci case PHY_TYPE_DP: 21898c2ecf20Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_DP; 21908c2ecf20Sopenharmony_ci break; 21918c2ecf20Sopenharmony_ci case PHY_TYPE_SGMII: 21928c2ecf20Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_SGMII; 21938c2ecf20Sopenharmony_ci break; 21948c2ecf20Sopenharmony_ci case PHY_TYPE_QSGMII: 21958c2ecf20Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_QSGMII; 21968c2ecf20Sopenharmony_ci break; 21978c2ecf20Sopenharmony_ci case PHY_TYPE_USB3: 21988c2ecf20Sopenharmony_ci cdns_phy->phys[node].phy_type = TYPE_USB; 21998c2ecf20Sopenharmony_ci break; 22008c2ecf20Sopenharmony_ci default: 22018c2ecf20Sopenharmony_ci dev_err(dev, "Unsupported protocol\n"); 22028c2ecf20Sopenharmony_ci ret = -EINVAL; 22038c2ecf20Sopenharmony_ci goto put_child; 22048c2ecf20Sopenharmony_ci } 22058c2ecf20Sopenharmony_ci 22068c2ecf20Sopenharmony_ci if (of_property_read_u32(child, "cdns,num-lanes", 22078c2ecf20Sopenharmony_ci &cdns_phy->phys[node].num_lanes)) { 22088c2ecf20Sopenharmony_ci dev_err(dev, "%s: No \"cdns,num-lanes\"-property.\n", 22098c2ecf20Sopenharmony_ci child->full_name); 22108c2ecf20Sopenharmony_ci ret = -EINVAL; 22118c2ecf20Sopenharmony_ci goto put_child; 22128c2ecf20Sopenharmony_ci } 22138c2ecf20Sopenharmony_ci 22148c2ecf20Sopenharmony_ci total_num_lanes += cdns_phy->phys[node].num_lanes; 22158c2ecf20Sopenharmony_ci 22168c2ecf20Sopenharmony_ci /* Get SSC mode */ 22178c2ecf20Sopenharmony_ci cdns_phy->phys[node].ssc_mode = NO_SSC; 22188c2ecf20Sopenharmony_ci of_property_read_u32(child, "cdns,ssc-mode", 22198c2ecf20Sopenharmony_ci &cdns_phy->phys[node].ssc_mode); 22208c2ecf20Sopenharmony_ci 22218c2ecf20Sopenharmony_ci gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); 22228c2ecf20Sopenharmony_ci if (IS_ERR(gphy)) { 22238c2ecf20Sopenharmony_ci ret = PTR_ERR(gphy); 22248c2ecf20Sopenharmony_ci goto put_child; 22258c2ecf20Sopenharmony_ci } 22268c2ecf20Sopenharmony_ci 22278c2ecf20Sopenharmony_ci if (cdns_phy->phys[node].phy_type == TYPE_DP) { 22288c2ecf20Sopenharmony_ci switch (cdns_phy->phys[node].num_lanes) { 22298c2ecf20Sopenharmony_ci case 1: 22308c2ecf20Sopenharmony_ci case 2: 22318c2ecf20Sopenharmony_ci case 4: 22328c2ecf20Sopenharmony_ci /* valid number of lanes */ 22338c2ecf20Sopenharmony_ci break; 22348c2ecf20Sopenharmony_ci default: 22358c2ecf20Sopenharmony_ci dev_err(dev, "unsupported number of lanes: %d\n", 22368c2ecf20Sopenharmony_ci cdns_phy->phys[node].num_lanes); 22378c2ecf20Sopenharmony_ci ret = -EINVAL; 22388c2ecf20Sopenharmony_ci goto put_child; 22398c2ecf20Sopenharmony_ci } 22408c2ecf20Sopenharmony_ci 22418c2ecf20Sopenharmony_ci cdns_phy->max_bit_rate = DEFAULT_MAX_BIT_RATE; 22428c2ecf20Sopenharmony_ci of_property_read_u32(child, "cdns,max-bit-rate", 22438c2ecf20Sopenharmony_ci &cdns_phy->max_bit_rate); 22448c2ecf20Sopenharmony_ci 22458c2ecf20Sopenharmony_ci switch (cdns_phy->max_bit_rate) { 22468c2ecf20Sopenharmony_ci case 1620: 22478c2ecf20Sopenharmony_ci case 2160: 22488c2ecf20Sopenharmony_ci case 2430: 22498c2ecf20Sopenharmony_ci case 2700: 22508c2ecf20Sopenharmony_ci case 3240: 22518c2ecf20Sopenharmony_ci case 4320: 22528c2ecf20Sopenharmony_ci case 5400: 22538c2ecf20Sopenharmony_ci case 8100: 22548c2ecf20Sopenharmony_ci /* valid bit rate */ 22558c2ecf20Sopenharmony_ci break; 22568c2ecf20Sopenharmony_ci default: 22578c2ecf20Sopenharmony_ci dev_err(dev, "unsupported max bit rate: %dMbps\n", 22588c2ecf20Sopenharmony_ci cdns_phy->max_bit_rate); 22598c2ecf20Sopenharmony_ci ret = -EINVAL; 22608c2ecf20Sopenharmony_ci goto put_child; 22618c2ecf20Sopenharmony_ci } 22628c2ecf20Sopenharmony_ci 22638c2ecf20Sopenharmony_ci /* DPTX registers */ 22648c2ecf20Sopenharmony_ci cdns_phy->base = devm_platform_ioremap_resource(pdev, 1); 22658c2ecf20Sopenharmony_ci if (IS_ERR(cdns_phy->base)) { 22668c2ecf20Sopenharmony_ci ret = PTR_ERR(cdns_phy->base); 22678c2ecf20Sopenharmony_ci goto put_child; 22688c2ecf20Sopenharmony_ci } 22698c2ecf20Sopenharmony_ci 22708c2ecf20Sopenharmony_ci if (!init_dp_regmap) { 22718c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_regmap_init(cdns_phy); 22728c2ecf20Sopenharmony_ci if (ret) 22738c2ecf20Sopenharmony_ci goto put_child; 22748c2ecf20Sopenharmony_ci 22758c2ecf20Sopenharmony_ci ret = cdns_torrent_dp_regfield_init(cdns_phy); 22768c2ecf20Sopenharmony_ci if (ret) 22778c2ecf20Sopenharmony_ci goto put_child; 22788c2ecf20Sopenharmony_ci 22798c2ecf20Sopenharmony_ci init_dp_regmap++; 22808c2ecf20Sopenharmony_ci } 22818c2ecf20Sopenharmony_ci 22828c2ecf20Sopenharmony_ci dev_info(dev, "%d lanes, max bit rate %d.%03d Gbps\n", 22838c2ecf20Sopenharmony_ci cdns_phy->phys[node].num_lanes, 22848c2ecf20Sopenharmony_ci cdns_phy->max_bit_rate / 1000, 22858c2ecf20Sopenharmony_ci cdns_phy->max_bit_rate % 1000); 22868c2ecf20Sopenharmony_ci 22878c2ecf20Sopenharmony_ci gphy->attrs.bus_width = cdns_phy->phys[node].num_lanes; 22888c2ecf20Sopenharmony_ci gphy->attrs.max_link_rate = cdns_phy->max_bit_rate; 22898c2ecf20Sopenharmony_ci gphy->attrs.mode = PHY_MODE_DP; 22908c2ecf20Sopenharmony_ci } 22918c2ecf20Sopenharmony_ci 22928c2ecf20Sopenharmony_ci cdns_phy->phys[node].phy = gphy; 22938c2ecf20Sopenharmony_ci phy_set_drvdata(gphy, &cdns_phy->phys[node]); 22948c2ecf20Sopenharmony_ci 22958c2ecf20Sopenharmony_ci node++; 22968c2ecf20Sopenharmony_ci } 22978c2ecf20Sopenharmony_ci cdns_phy->nsubnodes = node; 22988c2ecf20Sopenharmony_ci 22998c2ecf20Sopenharmony_ci if (total_num_lanes > MAX_NUM_LANES) { 23008c2ecf20Sopenharmony_ci dev_err(dev, "Invalid lane configuration\n"); 23018c2ecf20Sopenharmony_ci ret = -EINVAL; 23028c2ecf20Sopenharmony_ci goto put_lnk_rst; 23038c2ecf20Sopenharmony_ci } 23048c2ecf20Sopenharmony_ci 23058c2ecf20Sopenharmony_ci if (cdns_phy->nsubnodes > 1) { 23068c2ecf20Sopenharmony_ci ret = cdns_torrent_phy_configure_multilink(cdns_phy); 23078c2ecf20Sopenharmony_ci if (ret) 23088c2ecf20Sopenharmony_ci goto put_lnk_rst; 23098c2ecf20Sopenharmony_ci } 23108c2ecf20Sopenharmony_ci 23118c2ecf20Sopenharmony_ci phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 23128c2ecf20Sopenharmony_ci if (IS_ERR(phy_provider)) { 23138c2ecf20Sopenharmony_ci ret = PTR_ERR(phy_provider); 23148c2ecf20Sopenharmony_ci goto put_lnk_rst; 23158c2ecf20Sopenharmony_ci } 23168c2ecf20Sopenharmony_ci 23178c2ecf20Sopenharmony_ci return 0; 23188c2ecf20Sopenharmony_ci 23198c2ecf20Sopenharmony_ciput_child: 23208c2ecf20Sopenharmony_ci node++; 23218c2ecf20Sopenharmony_ciput_lnk_rst: 23228c2ecf20Sopenharmony_ci for (i = 0; i < node; i++) 23238c2ecf20Sopenharmony_ci reset_control_put(cdns_phy->phys[i].lnk_rst); 23248c2ecf20Sopenharmony_ci of_node_put(child); 23258c2ecf20Sopenharmony_ci reset_control_assert(cdns_phy->apb_rst); 23268c2ecf20Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 23278c2ecf20Sopenharmony_ci return ret; 23288c2ecf20Sopenharmony_ci} 23298c2ecf20Sopenharmony_ci 23308c2ecf20Sopenharmony_cistatic int cdns_torrent_phy_remove(struct platform_device *pdev) 23318c2ecf20Sopenharmony_ci{ 23328c2ecf20Sopenharmony_ci struct cdns_torrent_phy *cdns_phy = platform_get_drvdata(pdev); 23338c2ecf20Sopenharmony_ci int i; 23348c2ecf20Sopenharmony_ci 23358c2ecf20Sopenharmony_ci reset_control_assert(cdns_phy->phy_rst); 23368c2ecf20Sopenharmony_ci reset_control_assert(cdns_phy->apb_rst); 23378c2ecf20Sopenharmony_ci for (i = 0; i < cdns_phy->nsubnodes; i++) { 23388c2ecf20Sopenharmony_ci reset_control_assert(cdns_phy->phys[i].lnk_rst); 23398c2ecf20Sopenharmony_ci reset_control_put(cdns_phy->phys[i].lnk_rst); 23408c2ecf20Sopenharmony_ci } 23418c2ecf20Sopenharmony_ci 23428c2ecf20Sopenharmony_ci clk_disable_unprepare(cdns_phy->clk); 23438c2ecf20Sopenharmony_ci 23448c2ecf20Sopenharmony_ci return 0; 23458c2ecf20Sopenharmony_ci} 23468c2ecf20Sopenharmony_ci 23478c2ecf20Sopenharmony_ci/* USB and SGMII/QSGMII link configuration */ 23488c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_sgmii_link_cmn_regs[] = { 23498c2ecf20Sopenharmony_ci {0x0002, PHY_PLL_CFG}, 23508c2ecf20Sopenharmony_ci {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0}, 23518c2ecf20Sopenharmony_ci {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0} 23528c2ecf20Sopenharmony_ci}; 23538c2ecf20Sopenharmony_ci 23548c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_sgmii_xcvr_diag_ln_regs[] = { 23558c2ecf20Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 23568c2ecf20Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 23578c2ecf20Sopenharmony_ci {0x0041, XCVR_DIAG_PLLDRC_CTRL} 23588c2ecf20Sopenharmony_ci}; 23598c2ecf20Sopenharmony_ci 23608c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sgmii_usb_xcvr_diag_ln_regs[] = { 23618c2ecf20Sopenharmony_ci {0x0011, XCVR_DIAG_HSCLK_SEL}, 23628c2ecf20Sopenharmony_ci {0x0003, XCVR_DIAG_HSCLK_DIV}, 23638c2ecf20Sopenharmony_ci {0x009B, XCVR_DIAG_PLLDRC_CTRL} 23648c2ecf20Sopenharmony_ci}; 23658c2ecf20Sopenharmony_ci 23668c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_sgmii_link_cmn_vals = { 23678c2ecf20Sopenharmony_ci .reg_pairs = usb_sgmii_link_cmn_regs, 23688c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_sgmii_link_cmn_regs), 23698c2ecf20Sopenharmony_ci}; 23708c2ecf20Sopenharmony_ci 23718c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_sgmii_xcvr_diag_ln_vals = { 23728c2ecf20Sopenharmony_ci .reg_pairs = usb_sgmii_xcvr_diag_ln_regs, 23738c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_sgmii_xcvr_diag_ln_regs), 23748c2ecf20Sopenharmony_ci}; 23758c2ecf20Sopenharmony_ci 23768c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sgmii_usb_xcvr_diag_ln_vals = { 23778c2ecf20Sopenharmony_ci .reg_pairs = sgmii_usb_xcvr_diag_ln_regs, 23788c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_usb_xcvr_diag_ln_regs), 23798c2ecf20Sopenharmony_ci}; 23808c2ecf20Sopenharmony_ci 23818c2ecf20Sopenharmony_ci/* PCIe and USB Unique SSC link configuration */ 23828c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_usb_link_cmn_regs[] = { 23838c2ecf20Sopenharmony_ci {0x0003, PHY_PLL_CFG}, 23848c2ecf20Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}, 23858c2ecf20Sopenharmony_ci {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1}, 23868c2ecf20Sopenharmony_ci {0x8600, CMN_PDIAG_PLL1_CLK_SEL_M0} 23878c2ecf20Sopenharmony_ci}; 23888c2ecf20Sopenharmony_ci 23898c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_usb_xcvr_diag_ln_regs[] = { 23908c2ecf20Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 23918c2ecf20Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 23928c2ecf20Sopenharmony_ci {0x0012, XCVR_DIAG_PLLDRC_CTRL} 23938c2ecf20Sopenharmony_ci}; 23948c2ecf20Sopenharmony_ci 23958c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_pcie_xcvr_diag_ln_regs[] = { 23968c2ecf20Sopenharmony_ci {0x0011, XCVR_DIAG_HSCLK_SEL}, 23978c2ecf20Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 23988c2ecf20Sopenharmony_ci {0x00C9, XCVR_DIAG_PLLDRC_CTRL} 23998c2ecf20Sopenharmony_ci}; 24008c2ecf20Sopenharmony_ci 24018c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_usb_link_cmn_vals = { 24028c2ecf20Sopenharmony_ci .reg_pairs = pcie_usb_link_cmn_regs, 24038c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_usb_link_cmn_regs), 24048c2ecf20Sopenharmony_ci}; 24058c2ecf20Sopenharmony_ci 24068c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_usb_xcvr_diag_ln_vals = { 24078c2ecf20Sopenharmony_ci .reg_pairs = pcie_usb_xcvr_diag_ln_regs, 24088c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_usb_xcvr_diag_ln_regs), 24098c2ecf20Sopenharmony_ci}; 24108c2ecf20Sopenharmony_ci 24118c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_pcie_xcvr_diag_ln_vals = { 24128c2ecf20Sopenharmony_ci .reg_pairs = usb_pcie_xcvr_diag_ln_regs, 24138c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_pcie_xcvr_diag_ln_regs), 24148c2ecf20Sopenharmony_ci}; 24158c2ecf20Sopenharmony_ci 24168c2ecf20Sopenharmony_ci/* USB 100 MHz Ref clk, internal SSC */ 24178c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_100_int_ssc_cmn_regs[] = { 24188c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 24198c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 24208c2ecf20Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 24218c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 24228c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 24238c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 24248c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 24258c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 24268c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 24278c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 24288c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 24298c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 24308c2ecf20Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 24318c2ecf20Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 24328c2ecf20Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 24338c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 24348c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 24358c2ecf20Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 24368c2ecf20Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 24378c2ecf20Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 24388c2ecf20Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 24398c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 24408c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 24418c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 24428c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 24438c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 24448c2ecf20Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 24458c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 24468c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 24478c2ecf20Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 24488c2ecf20Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 24498c2ecf20Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 24508c2ecf20Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 24518c2ecf20Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 24528c2ecf20Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 24538c2ecf20Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 24548c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 24558c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 24568c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 24578c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 24588c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 24598c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 24608c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 24618c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 24628c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 24638c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 24648c2ecf20Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 24658c2ecf20Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 24668c2ecf20Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 24678c2ecf20Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD} 24688c2ecf20Sopenharmony_ci}; 24698c2ecf20Sopenharmony_ci 24708c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_100_int_ssc_cmn_vals = { 24718c2ecf20Sopenharmony_ci .reg_pairs = usb_100_int_ssc_cmn_regs, 24728c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_int_ssc_cmn_regs), 24738c2ecf20Sopenharmony_ci}; 24748c2ecf20Sopenharmony_ci 24758c2ecf20Sopenharmony_ci/* Single USB link configuration */ 24768c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_link_cmn_regs[] = { 24778c2ecf20Sopenharmony_ci {0x0000, PHY_PLL_CFG}, 24788c2ecf20Sopenharmony_ci {0x8600, CMN_PDIAG_PLL0_CLK_SEL_M0} 24798c2ecf20Sopenharmony_ci}; 24808c2ecf20Sopenharmony_ci 24818c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_xcvr_diag_ln_regs[] = { 24828c2ecf20Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 24838c2ecf20Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 24848c2ecf20Sopenharmony_ci {0x0041, XCVR_DIAG_PLLDRC_CTRL} 24858c2ecf20Sopenharmony_ci}; 24868c2ecf20Sopenharmony_ci 24878c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_link_cmn_vals = { 24888c2ecf20Sopenharmony_ci .reg_pairs = sl_usb_link_cmn_regs, 24898c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_link_cmn_regs), 24908c2ecf20Sopenharmony_ci}; 24918c2ecf20Sopenharmony_ci 24928c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_xcvr_diag_ln_vals = { 24938c2ecf20Sopenharmony_ci .reg_pairs = sl_usb_xcvr_diag_ln_regs, 24948c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_xcvr_diag_ln_regs), 24958c2ecf20Sopenharmony_ci}; 24968c2ecf20Sopenharmony_ci 24978c2ecf20Sopenharmony_ci/* USB PHY PCS common configuration */ 24988c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_phy_pcs_cmn_regs[] = { 24998c2ecf20Sopenharmony_ci {0x0A0A, PHY_PIPE_USB3_GEN2_PRE_CFG0}, 25008c2ecf20Sopenharmony_ci {0x1000, PHY_PIPE_USB3_GEN2_POST_CFG0}, 25018c2ecf20Sopenharmony_ci {0x0010, PHY_PIPE_USB3_GEN2_POST_CFG1} 25028c2ecf20Sopenharmony_ci}; 25038c2ecf20Sopenharmony_ci 25048c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_phy_pcs_cmn_vals = { 25058c2ecf20Sopenharmony_ci .reg_pairs = usb_phy_pcs_cmn_regs, 25068c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_phy_pcs_cmn_regs), 25078c2ecf20Sopenharmony_ci}; 25088c2ecf20Sopenharmony_ci 25098c2ecf20Sopenharmony_ci/* USB 100 MHz Ref clk, no SSC */ 25108c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_100_no_ssc_cmn_regs[] = { 25118c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 25128c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 25138c2ecf20Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 25148c2ecf20Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD} 25158c2ecf20Sopenharmony_ci}; 25168c2ecf20Sopenharmony_ci 25178c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_100_no_ssc_tx_ln_regs[] = { 25188c2ecf20Sopenharmony_ci {0x02FF, TX_PSC_A0}, 25198c2ecf20Sopenharmony_ci {0x06AF, TX_PSC_A1}, 25208c2ecf20Sopenharmony_ci {0x06AE, TX_PSC_A2}, 25218c2ecf20Sopenharmony_ci {0x06AE, TX_PSC_A3}, 25228c2ecf20Sopenharmony_ci {0x2A82, TX_TXCC_CTRL}, 25238c2ecf20Sopenharmony_ci {0x0014, TX_TXCC_CPOST_MULT_01}, 25248c2ecf20Sopenharmony_ci {0x0003, XCVR_DIAG_PSC_OVRD} 25258c2ecf20Sopenharmony_ci}; 25268c2ecf20Sopenharmony_ci 25278c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs usb_100_no_ssc_rx_ln_regs[] = { 25288c2ecf20Sopenharmony_ci {0x0D1D, RX_PSC_A0}, 25298c2ecf20Sopenharmony_ci {0x0D1D, RX_PSC_A1}, 25308c2ecf20Sopenharmony_ci {0x0D00, RX_PSC_A2}, 25318c2ecf20Sopenharmony_ci {0x0500, RX_PSC_A3}, 25328c2ecf20Sopenharmony_ci {0x0013, RX_SIGDET_HL_FILT_TMR}, 25338c2ecf20Sopenharmony_ci {0x0000, RX_REE_GCSM1_CTRL}, 25348c2ecf20Sopenharmony_ci {0x0C02, RX_REE_ATTEN_THR}, 25358c2ecf20Sopenharmony_ci {0x0330, RX_REE_SMGM_CTRL1}, 25368c2ecf20Sopenharmony_ci {0x0300, RX_REE_SMGM_CTRL2}, 25378c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 25388c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 25398c2ecf20Sopenharmony_ci {0x1004, RX_DIAG_SIGDET_TUNE}, 25408c2ecf20Sopenharmony_ci {0x00F9, RX_DIAG_NQST_CTRL}, 25418c2ecf20Sopenharmony_ci {0x0C01, RX_DIAG_DFE_AMP_TUNE_2}, 25428c2ecf20Sopenharmony_ci {0x0002, RX_DIAG_DFE_AMP_TUNE_3}, 25438c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_PI_CAP}, 25448c2ecf20Sopenharmony_ci {0x0031, RX_DIAG_PI_RATE}, 25458c2ecf20Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 25468c2ecf20Sopenharmony_ci {0x018C, RX_CDRLF_CNFG}, 25478c2ecf20Sopenharmony_ci {0x0003, RX_CDRLF_CNFG3} 25488c2ecf20Sopenharmony_ci}; 25498c2ecf20Sopenharmony_ci 25508c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_100_no_ssc_cmn_vals = { 25518c2ecf20Sopenharmony_ci .reg_pairs = usb_100_no_ssc_cmn_regs, 25528c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_no_ssc_cmn_regs), 25538c2ecf20Sopenharmony_ci}; 25548c2ecf20Sopenharmony_ci 25558c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_100_no_ssc_tx_ln_vals = { 25568c2ecf20Sopenharmony_ci .reg_pairs = usb_100_no_ssc_tx_ln_regs, 25578c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_no_ssc_tx_ln_regs), 25588c2ecf20Sopenharmony_ci}; 25598c2ecf20Sopenharmony_ci 25608c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals usb_100_no_ssc_rx_ln_vals = { 25618c2ecf20Sopenharmony_ci .reg_pairs = usb_100_no_ssc_rx_ln_regs, 25628c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(usb_100_no_ssc_rx_ln_regs), 25638c2ecf20Sopenharmony_ci}; 25648c2ecf20Sopenharmony_ci 25658c2ecf20Sopenharmony_ci/* Single link USB, 100 MHz Ref clk, internal SSC */ 25668c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sl_usb_100_int_ssc_cmn_regs[] = { 25678c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 25688c2ecf20Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 25698c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 25708c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 25718c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 25728c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 25738c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 25748c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 25758c2ecf20Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 25768c2ecf20Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 25778c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 25788c2ecf20Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 25798c2ecf20Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 25808c2ecf20Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 25818c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 25828c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 25838c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 25848c2ecf20Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 25858c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 25868c2ecf20Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 25878c2ecf20Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 25888c2ecf20Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 25898c2ecf20Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 25908c2ecf20Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 25918c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 25928c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 25938c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 25948c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 25958c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 25968c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 25978c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 25988c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 25998c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 26008c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 26018c2ecf20Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 26028c2ecf20Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 26038c2ecf20Sopenharmony_ci {0x8200, CMN_CDIAG_CDB_PWRI_OVRD}, 26048c2ecf20Sopenharmony_ci {0x8200, CMN_CDIAG_XCVRC_PWRI_OVRD} 26058c2ecf20Sopenharmony_ci}; 26068c2ecf20Sopenharmony_ci 26078c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sl_usb_100_int_ssc_cmn_vals = { 26088c2ecf20Sopenharmony_ci .reg_pairs = sl_usb_100_int_ssc_cmn_regs, 26098c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_usb_100_int_ssc_cmn_regs), 26108c2ecf20Sopenharmony_ci}; 26118c2ecf20Sopenharmony_ci 26128c2ecf20Sopenharmony_ci/* PCIe and SGMII/QSGMII Unique SSC link configuration */ 26138c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_sgmii_link_cmn_regs[] = { 26148c2ecf20Sopenharmony_ci {0x0003, PHY_PLL_CFG}, 26158c2ecf20Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0}, 26168c2ecf20Sopenharmony_ci {0x0400, CMN_PDIAG_PLL0_CLK_SEL_M1}, 26178c2ecf20Sopenharmony_ci {0x0601, CMN_PDIAG_PLL1_CLK_SEL_M0} 26188c2ecf20Sopenharmony_ci}; 26198c2ecf20Sopenharmony_ci 26208c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_sgmii_xcvr_diag_ln_regs[] = { 26218c2ecf20Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 26228c2ecf20Sopenharmony_ci {0x0001, XCVR_DIAG_HSCLK_DIV}, 26238c2ecf20Sopenharmony_ci {0x0012, XCVR_DIAG_PLLDRC_CTRL} 26248c2ecf20Sopenharmony_ci}; 26258c2ecf20Sopenharmony_ci 26268c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sgmii_pcie_xcvr_diag_ln_regs[] = { 26278c2ecf20Sopenharmony_ci {0x0011, XCVR_DIAG_HSCLK_SEL}, 26288c2ecf20Sopenharmony_ci {0x0003, XCVR_DIAG_HSCLK_DIV}, 26298c2ecf20Sopenharmony_ci {0x009B, XCVR_DIAG_PLLDRC_CTRL} 26308c2ecf20Sopenharmony_ci}; 26318c2ecf20Sopenharmony_ci 26328c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_sgmii_link_cmn_vals = { 26338c2ecf20Sopenharmony_ci .reg_pairs = pcie_sgmii_link_cmn_regs, 26348c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_sgmii_link_cmn_regs), 26358c2ecf20Sopenharmony_ci}; 26368c2ecf20Sopenharmony_ci 26378c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_sgmii_xcvr_diag_ln_vals = { 26388c2ecf20Sopenharmony_ci .reg_pairs = pcie_sgmii_xcvr_diag_ln_regs, 26398c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_sgmii_xcvr_diag_ln_regs), 26408c2ecf20Sopenharmony_ci}; 26418c2ecf20Sopenharmony_ci 26428c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sgmii_pcie_xcvr_diag_ln_vals = { 26438c2ecf20Sopenharmony_ci .reg_pairs = sgmii_pcie_xcvr_diag_ln_regs, 26448c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_pcie_xcvr_diag_ln_regs), 26458c2ecf20Sopenharmony_ci}; 26468c2ecf20Sopenharmony_ci 26478c2ecf20Sopenharmony_ci/* SGMII 100 MHz Ref clk, no SSC */ 26488c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_no_ssc_cmn_regs[] = { 26498c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 26508c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 26518c2ecf20Sopenharmony_ci {0x3700, CMN_DIAG_BIAS_OVRD1}, 26528c2ecf20Sopenharmony_ci {0x0008, CMN_TXPUCAL_TUNE}, 26538c2ecf20Sopenharmony_ci {0x0008, CMN_TXPDCAL_TUNE} 26548c2ecf20Sopenharmony_ci}; 26558c2ecf20Sopenharmony_ci 26568c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_no_ssc_tx_ln_regs[] = { 26578c2ecf20Sopenharmony_ci {0x00F3, TX_PSC_A0}, 26588c2ecf20Sopenharmony_ci {0x04A2, TX_PSC_A2}, 26598c2ecf20Sopenharmony_ci {0x04A2, TX_PSC_A3}, 26608c2ecf20Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 26618c2ecf20Sopenharmony_ci {0x00B3, DRV_DIAG_TX_DRV} 26628c2ecf20Sopenharmony_ci}; 26638c2ecf20Sopenharmony_ci 26648c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_no_ssc_rx_ln_regs[] = { 26658c2ecf20Sopenharmony_ci {0x091D, RX_PSC_A0}, 26668c2ecf20Sopenharmony_ci {0x0900, RX_PSC_A2}, 26678c2ecf20Sopenharmony_ci {0x0100, RX_PSC_A3}, 26688c2ecf20Sopenharmony_ci {0x03C7, RX_REE_GCSM1_EQENM_PH1}, 26698c2ecf20Sopenharmony_ci {0x01C7, RX_REE_GCSM1_EQENM_PH2}, 26708c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_DFE_CTRL}, 26718c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 26728c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 26738c2ecf20Sopenharmony_ci {0x0098, RX_DIAG_NQST_CTRL}, 26748c2ecf20Sopenharmony_ci {0x0C01, RX_DIAG_DFE_AMP_TUNE_2}, 26758c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_DFE_AMP_TUNE_3}, 26768c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_PI_CAP}, 26778c2ecf20Sopenharmony_ci {0x0010, RX_DIAG_PI_RATE}, 26788c2ecf20Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 26798c2ecf20Sopenharmony_ci {0x018C, RX_CDRLF_CNFG}, 26808c2ecf20Sopenharmony_ci}; 26818c2ecf20Sopenharmony_ci 26828c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_no_ssc_cmn_vals = { 26838c2ecf20Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_cmn_regs, 26848c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_cmn_regs), 26858c2ecf20Sopenharmony_ci}; 26868c2ecf20Sopenharmony_ci 26878c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_no_ssc_tx_ln_vals = { 26888c2ecf20Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_tx_ln_regs, 26898c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_tx_ln_regs), 26908c2ecf20Sopenharmony_ci}; 26918c2ecf20Sopenharmony_ci 26928c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_no_ssc_rx_ln_vals = { 26938c2ecf20Sopenharmony_ci .reg_pairs = sgmii_100_no_ssc_rx_ln_regs, 26948c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_no_ssc_rx_ln_regs), 26958c2ecf20Sopenharmony_ci}; 26968c2ecf20Sopenharmony_ci 26978c2ecf20Sopenharmony_ci/* SGMII 100 MHz Ref clk, internal SSC */ 26988c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sgmii_100_int_ssc_cmn_regs[] = { 26998c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 27008c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 27018c2ecf20Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 27028c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 27038c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 27048c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 27058c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 27068c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 27078c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 27088c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 27098c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 27108c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 27118c2ecf20Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 27128c2ecf20Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 27138c2ecf20Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 27148c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 27158c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 27168c2ecf20Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 27178c2ecf20Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 27188c2ecf20Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 27198c2ecf20Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 27208c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 27218c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 27228c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 27238c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 27248c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 27258c2ecf20Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 27268c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 27278c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 27288c2ecf20Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 27298c2ecf20Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 27308c2ecf20Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 27318c2ecf20Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 27328c2ecf20Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 27338c2ecf20Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 27348c2ecf20Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 27358c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 27368c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 27378c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 27388c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 27398c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 27408c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 27418c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 27428c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 27438c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 27448c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 27458c2ecf20Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 27468c2ecf20Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR}, 27478c2ecf20Sopenharmony_ci {0x3700, CMN_DIAG_BIAS_OVRD1}, 27488c2ecf20Sopenharmony_ci {0x0008, CMN_TXPUCAL_TUNE}, 27498c2ecf20Sopenharmony_ci {0x0008, CMN_TXPDCAL_TUNE} 27508c2ecf20Sopenharmony_ci}; 27518c2ecf20Sopenharmony_ci 27528c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sgmii_100_int_ssc_cmn_vals = { 27538c2ecf20Sopenharmony_ci .reg_pairs = sgmii_100_int_ssc_cmn_regs, 27548c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sgmii_100_int_ssc_cmn_regs), 27558c2ecf20Sopenharmony_ci}; 27568c2ecf20Sopenharmony_ci 27578c2ecf20Sopenharmony_ci/* QSGMII 100 MHz Ref clk, no SSC */ 27588c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_no_ssc_cmn_regs[] = { 27598c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 27608c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 27618c2ecf20Sopenharmony_ci}; 27628c2ecf20Sopenharmony_ci 27638c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_no_ssc_tx_ln_regs[] = { 27648c2ecf20Sopenharmony_ci {0x00F3, TX_PSC_A0}, 27658c2ecf20Sopenharmony_ci {0x04A2, TX_PSC_A2}, 27668c2ecf20Sopenharmony_ci {0x04A2, TX_PSC_A3}, 27678c2ecf20Sopenharmony_ci {0x0000, TX_TXCC_CPOST_MULT_00}, 27688c2ecf20Sopenharmony_ci {0x0003, DRV_DIAG_TX_DRV} 27698c2ecf20Sopenharmony_ci}; 27708c2ecf20Sopenharmony_ci 27718c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_no_ssc_rx_ln_regs[] = { 27728c2ecf20Sopenharmony_ci {0x091D, RX_PSC_A0}, 27738c2ecf20Sopenharmony_ci {0x0900, RX_PSC_A2}, 27748c2ecf20Sopenharmony_ci {0x0100, RX_PSC_A3}, 27758c2ecf20Sopenharmony_ci {0x03C7, RX_REE_GCSM1_EQENM_PH1}, 27768c2ecf20Sopenharmony_ci {0x01C7, RX_REE_GCSM1_EQENM_PH2}, 27778c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_DFE_CTRL}, 27788c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 27798c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 27808c2ecf20Sopenharmony_ci {0x0098, RX_DIAG_NQST_CTRL}, 27818c2ecf20Sopenharmony_ci {0x0C01, RX_DIAG_DFE_AMP_TUNE_2}, 27828c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_DFE_AMP_TUNE_3}, 27838c2ecf20Sopenharmony_ci {0x0000, RX_DIAG_PI_CAP}, 27848c2ecf20Sopenharmony_ci {0x0010, RX_DIAG_PI_RATE}, 27858c2ecf20Sopenharmony_ci {0x0001, RX_DIAG_ACYA}, 27868c2ecf20Sopenharmony_ci {0x018C, RX_CDRLF_CNFG}, 27878c2ecf20Sopenharmony_ci}; 27888c2ecf20Sopenharmony_ci 27898c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_no_ssc_cmn_vals = { 27908c2ecf20Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_cmn_regs, 27918c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_cmn_regs), 27928c2ecf20Sopenharmony_ci}; 27938c2ecf20Sopenharmony_ci 27948c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_no_ssc_tx_ln_vals = { 27958c2ecf20Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_tx_ln_regs, 27968c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_tx_ln_regs), 27978c2ecf20Sopenharmony_ci}; 27988c2ecf20Sopenharmony_ci 27998c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_no_ssc_rx_ln_vals = { 28008c2ecf20Sopenharmony_ci .reg_pairs = qsgmii_100_no_ssc_rx_ln_regs, 28018c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_no_ssc_rx_ln_regs), 28028c2ecf20Sopenharmony_ci}; 28038c2ecf20Sopenharmony_ci 28048c2ecf20Sopenharmony_ci/* QSGMII 100 MHz Ref clk, internal SSC */ 28058c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs qsgmii_100_int_ssc_cmn_regs[] = { 28068c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 28078c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 28088c2ecf20Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 28098c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 28108c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 28118c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 28128c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 28138c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 28148c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 28158c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 28168c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 28178c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 28188c2ecf20Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 28198c2ecf20Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 28208c2ecf20Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 28218c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 28228c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 28238c2ecf20Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 28248c2ecf20Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 28258c2ecf20Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 28268c2ecf20Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 28278c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 28288c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 28298c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 28308c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 28318c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 28328c2ecf20Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 28338c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 28348c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 28358c2ecf20Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 28368c2ecf20Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 28378c2ecf20Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 28388c2ecf20Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 28398c2ecf20Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 28408c2ecf20Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 28418c2ecf20Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 28428c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 28438c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 28448c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 28458c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 28468c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 28478c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 28488c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 28498c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 28508c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 28518c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 28528c2ecf20Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 28538c2ecf20Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR} 28548c2ecf20Sopenharmony_ci}; 28558c2ecf20Sopenharmony_ci 28568c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals qsgmii_100_int_ssc_cmn_vals = { 28578c2ecf20Sopenharmony_ci .reg_pairs = qsgmii_100_int_ssc_cmn_regs, 28588c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(qsgmii_100_int_ssc_cmn_regs), 28598c2ecf20Sopenharmony_ci}; 28608c2ecf20Sopenharmony_ci 28618c2ecf20Sopenharmony_ci/* Single SGMII/QSGMII link configuration */ 28628c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sl_sgmii_link_cmn_regs[] = { 28638c2ecf20Sopenharmony_ci {0x0000, PHY_PLL_CFG}, 28648c2ecf20Sopenharmony_ci {0x0601, CMN_PDIAG_PLL0_CLK_SEL_M0} 28658c2ecf20Sopenharmony_ci}; 28668c2ecf20Sopenharmony_ci 28678c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sl_sgmii_xcvr_diag_ln_regs[] = { 28688c2ecf20Sopenharmony_ci {0x0000, XCVR_DIAG_HSCLK_SEL}, 28698c2ecf20Sopenharmony_ci {0x0003, XCVR_DIAG_HSCLK_DIV}, 28708c2ecf20Sopenharmony_ci {0x0013, XCVR_DIAG_PLLDRC_CTRL} 28718c2ecf20Sopenharmony_ci}; 28728c2ecf20Sopenharmony_ci 28738c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sl_sgmii_link_cmn_vals = { 28748c2ecf20Sopenharmony_ci .reg_pairs = sl_sgmii_link_cmn_regs, 28758c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_sgmii_link_cmn_regs), 28768c2ecf20Sopenharmony_ci}; 28778c2ecf20Sopenharmony_ci 28788c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sl_sgmii_xcvr_diag_ln_vals = { 28798c2ecf20Sopenharmony_ci .reg_pairs = sl_sgmii_xcvr_diag_ln_regs, 28808c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_sgmii_xcvr_diag_ln_regs), 28818c2ecf20Sopenharmony_ci}; 28828c2ecf20Sopenharmony_ci 28838c2ecf20Sopenharmony_ci/* Multi link PCIe, 100 MHz Ref clk, internal SSC */ 28848c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_100_int_ssc_cmn_regs[] = { 28858c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 28868c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 28878c2ecf20Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 28888c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 28898c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 28908c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 28918c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 28928c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 28938c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 28948c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 28958c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 28968c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 28978c2ecf20Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 28988c2ecf20Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 28998c2ecf20Sopenharmony_ci {0x0064, CMN_PLL1_INTDIV_M0}, 29008c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 29018c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 29028c2ecf20Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 29038c2ecf20Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 29048c2ecf20Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 29058c2ecf20Sopenharmony_ci {0x0044, CMN_PLL1_HIGH_THR_M0}, 29068c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 29078c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 29088c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 29098c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 29108c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 29118c2ecf20Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 29128c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 29138c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 29148c2ecf20Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 29158c2ecf20Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 29168c2ecf20Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 29178c2ecf20Sopenharmony_ci {0x006E, CMN_PLL1_SS_CTRL3_M0}, 29188c2ecf20Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 29198c2ecf20Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 29208c2ecf20Sopenharmony_ci {0x000E, CMN_PLL1_SS_CTRL4_M0}, 29218c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 29228c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 29238c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 29248c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 29258c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 29268c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 29278c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 29288c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 29298c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 29308c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 29318c2ecf20Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 29328c2ecf20Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR} 29338c2ecf20Sopenharmony_ci}; 29348c2ecf20Sopenharmony_ci 29358c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_100_int_ssc_cmn_vals = { 29368c2ecf20Sopenharmony_ci .reg_pairs = pcie_100_int_ssc_cmn_regs, 29378c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_int_ssc_cmn_regs), 29388c2ecf20Sopenharmony_ci}; 29398c2ecf20Sopenharmony_ci 29408c2ecf20Sopenharmony_ci/* Single link PCIe, 100 MHz Ref clk, internal SSC */ 29418c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs sl_pcie_100_int_ssc_cmn_regs[] = { 29428c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M0}, 29438c2ecf20Sopenharmony_ci {0x0004, CMN_PLL0_DSM_DIAG_M1}, 29448c2ecf20Sopenharmony_ci {0x0004, CMN_PLL1_DSM_DIAG_M0}, 29458c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M0}, 29468c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL0_CP_PADJ_M1}, 29478c2ecf20Sopenharmony_ci {0x0509, CMN_PDIAG_PLL1_CP_PADJ_M0}, 29488c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M0}, 29498c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL0_CP_IADJ_M1}, 29508c2ecf20Sopenharmony_ci {0x0F00, CMN_PDIAG_PLL1_CP_IADJ_M0}, 29518c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M0}, 29528c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL0_FILT_PADJ_M1}, 29538c2ecf20Sopenharmony_ci {0x0F08, CMN_PDIAG_PLL1_FILT_PADJ_M0}, 29548c2ecf20Sopenharmony_ci {0x0064, CMN_PLL0_INTDIV_M0}, 29558c2ecf20Sopenharmony_ci {0x0050, CMN_PLL0_INTDIV_M1}, 29568c2ecf20Sopenharmony_ci {0x0050, CMN_PLL1_INTDIV_M0}, 29578c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M0}, 29588c2ecf20Sopenharmony_ci {0x0002, CMN_PLL0_FRACDIVH_M1}, 29598c2ecf20Sopenharmony_ci {0x0002, CMN_PLL1_FRACDIVH_M0}, 29608c2ecf20Sopenharmony_ci {0x0044, CMN_PLL0_HIGH_THR_M0}, 29618c2ecf20Sopenharmony_ci {0x0036, CMN_PLL0_HIGH_THR_M1}, 29628c2ecf20Sopenharmony_ci {0x0036, CMN_PLL1_HIGH_THR_M0}, 29638c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M0}, 29648c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL0_CTRL_M1}, 29658c2ecf20Sopenharmony_ci {0x0002, CMN_PDIAG_PLL1_CTRL_M0}, 29668c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M0}, 29678c2ecf20Sopenharmony_ci {0x0001, CMN_PLL0_SS_CTRL1_M1}, 29688c2ecf20Sopenharmony_ci {0x0001, CMN_PLL1_SS_CTRL1_M0}, 29698c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M0}, 29708c2ecf20Sopenharmony_ci {0x011B, CMN_PLL0_SS_CTRL2_M1}, 29718c2ecf20Sopenharmony_ci {0x011B, CMN_PLL1_SS_CTRL2_M0}, 29728c2ecf20Sopenharmony_ci {0x006E, CMN_PLL0_SS_CTRL3_M0}, 29738c2ecf20Sopenharmony_ci {0x0058, CMN_PLL0_SS_CTRL3_M1}, 29748c2ecf20Sopenharmony_ci {0x0058, CMN_PLL1_SS_CTRL3_M0}, 29758c2ecf20Sopenharmony_ci {0x000E, CMN_PLL0_SS_CTRL4_M0}, 29768c2ecf20Sopenharmony_ci {0x0012, CMN_PLL0_SS_CTRL4_M1}, 29778c2ecf20Sopenharmony_ci {0x0012, CMN_PLL1_SS_CTRL4_M0}, 29788c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL0_VCOCAL_REFTIM_START}, 29798c2ecf20Sopenharmony_ci {0x0C5E, CMN_PLL1_VCOCAL_REFTIM_START}, 29808c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL0_VCOCAL_PLLCNT_START}, 29818c2ecf20Sopenharmony_ci {0x0C56, CMN_PLL1_VCOCAL_PLLCNT_START}, 29828c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 29838c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL}, 29848c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_REFCNT_START}, 29858c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_REFCNT_START}, 29868c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL0_LOCK_PLLCNT_START}, 29878c2ecf20Sopenharmony_ci {0x00C7, CMN_PLL1_LOCK_PLLCNT_START}, 29888c2ecf20Sopenharmony_ci {0x0005, CMN_PLL0_LOCK_PLLCNT_THR}, 29898c2ecf20Sopenharmony_ci {0x0005, CMN_PLL1_LOCK_PLLCNT_THR} 29908c2ecf20Sopenharmony_ci}; 29918c2ecf20Sopenharmony_ci 29928c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals sl_pcie_100_int_ssc_cmn_vals = { 29938c2ecf20Sopenharmony_ci .reg_pairs = sl_pcie_100_int_ssc_cmn_regs, 29948c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(sl_pcie_100_int_ssc_cmn_regs), 29958c2ecf20Sopenharmony_ci}; 29968c2ecf20Sopenharmony_ci 29978c2ecf20Sopenharmony_ci/* PCIe, 100 MHz Ref clk, no SSC & external SSC */ 29988c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_100_ext_no_ssc_cmn_regs[] = { 29998c2ecf20Sopenharmony_ci {0x0003, CMN_PLL0_VCOCAL_TCTRL}, 30008c2ecf20Sopenharmony_ci {0x0003, CMN_PLL1_VCOCAL_TCTRL} 30018c2ecf20Sopenharmony_ci}; 30028c2ecf20Sopenharmony_ci 30038c2ecf20Sopenharmony_cistatic struct cdns_reg_pairs pcie_100_ext_no_ssc_rx_ln_regs[] = { 30048c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP1_CLIP}, 30058c2ecf20Sopenharmony_ci {0x0019, RX_REE_TAP2TON_CLIP}, 30068c2ecf20Sopenharmony_ci {0x0001, RX_DIAG_ACYA} 30078c2ecf20Sopenharmony_ci}; 30088c2ecf20Sopenharmony_ci 30098c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_100_no_ssc_cmn_vals = { 30108c2ecf20Sopenharmony_ci .reg_pairs = pcie_100_ext_no_ssc_cmn_regs, 30118c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_cmn_regs), 30128c2ecf20Sopenharmony_ci}; 30138c2ecf20Sopenharmony_ci 30148c2ecf20Sopenharmony_cistatic struct cdns_torrent_vals pcie_100_no_ssc_rx_ln_vals = { 30158c2ecf20Sopenharmony_ci .reg_pairs = pcie_100_ext_no_ssc_rx_ln_regs, 30168c2ecf20Sopenharmony_ci .num_regs = ARRAY_SIZE(pcie_100_ext_no_ssc_rx_ln_regs), 30178c2ecf20Sopenharmony_ci}; 30188c2ecf20Sopenharmony_ci 30198c2ecf20Sopenharmony_cistatic const struct cdns_torrent_data cdns_map_torrent = { 30208c2ecf20Sopenharmony_ci .block_offset_shift = 0x2, 30218c2ecf20Sopenharmony_ci .reg_offset_shift = 0x2, 30228c2ecf20Sopenharmony_ci .link_cmn_vals = { 30238c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 30248c2ecf20Sopenharmony_ci [TYPE_NONE] = { 30258c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 30268c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 30278c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 30288c2ecf20Sopenharmony_ci }, 30298c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 30308c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 30318c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30328c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30338c2ecf20Sopenharmony_ci }, 30348c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 30358c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 30368c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30378c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30388c2ecf20Sopenharmony_ci }, 30398c2ecf20Sopenharmony_ci [TYPE_USB] = { 30408c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_usb_link_cmn_vals, 30418c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_usb_link_cmn_vals, 30428c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_usb_link_cmn_vals, 30438c2ecf20Sopenharmony_ci }, 30448c2ecf20Sopenharmony_ci }, 30458c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 30468c2ecf20Sopenharmony_ci [TYPE_NONE] = { 30478c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_link_cmn_vals, 30488c2ecf20Sopenharmony_ci }, 30498c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 30508c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 30518c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30528c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30538c2ecf20Sopenharmony_ci }, 30548c2ecf20Sopenharmony_ci [TYPE_USB] = { 30558c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 30568c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30578c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30588c2ecf20Sopenharmony_ci }, 30598c2ecf20Sopenharmony_ci }, 30608c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 30618c2ecf20Sopenharmony_ci [TYPE_NONE] = { 30628c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_link_cmn_vals, 30638c2ecf20Sopenharmony_ci }, 30648c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 30658c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 30668c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30678c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 30688c2ecf20Sopenharmony_ci }, 30698c2ecf20Sopenharmony_ci [TYPE_USB] = { 30708c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 30718c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30728c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30738c2ecf20Sopenharmony_ci }, 30748c2ecf20Sopenharmony_ci }, 30758c2ecf20Sopenharmony_ci [TYPE_USB] = { 30768c2ecf20Sopenharmony_ci [TYPE_NONE] = { 30778c2ecf20Sopenharmony_ci [NO_SSC] = &sl_usb_link_cmn_vals, 30788c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sl_usb_link_cmn_vals, 30798c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_link_cmn_vals, 30808c2ecf20Sopenharmony_ci }, 30818c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 30828c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_usb_link_cmn_vals, 30838c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_usb_link_cmn_vals, 30848c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_usb_link_cmn_vals, 30858c2ecf20Sopenharmony_ci }, 30868c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 30878c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 30888c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30898c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30908c2ecf20Sopenharmony_ci }, 30918c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 30928c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 30938c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30948c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 30958c2ecf20Sopenharmony_ci }, 30968c2ecf20Sopenharmony_ci }, 30978c2ecf20Sopenharmony_ci }, 30988c2ecf20Sopenharmony_ci .xcvr_diag_vals = { 30998c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 31008c2ecf20Sopenharmony_ci [TYPE_NONE] = { 31018c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 31028c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 31038c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 31048c2ecf20Sopenharmony_ci }, 31058c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 31068c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 31078c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 31088c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 31098c2ecf20Sopenharmony_ci }, 31108c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 31118c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 31128c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 31138c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 31148c2ecf20Sopenharmony_ci }, 31158c2ecf20Sopenharmony_ci [TYPE_USB] = { 31168c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_usb_xcvr_diag_ln_vals, 31178c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_usb_xcvr_diag_ln_vals, 31188c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_usb_xcvr_diag_ln_vals, 31198c2ecf20Sopenharmony_ci }, 31208c2ecf20Sopenharmony_ci }, 31218c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 31228c2ecf20Sopenharmony_ci [TYPE_NONE] = { 31238c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_xcvr_diag_ln_vals, 31248c2ecf20Sopenharmony_ci }, 31258c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 31268c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 31278c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 31288c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 31298c2ecf20Sopenharmony_ci }, 31308c2ecf20Sopenharmony_ci [TYPE_USB] = { 31318c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 31328c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 31338c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 31348c2ecf20Sopenharmony_ci }, 31358c2ecf20Sopenharmony_ci }, 31368c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 31378c2ecf20Sopenharmony_ci [TYPE_NONE] = { 31388c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_xcvr_diag_ln_vals, 31398c2ecf20Sopenharmony_ci }, 31408c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 31418c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 31428c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 31438c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 31448c2ecf20Sopenharmony_ci }, 31458c2ecf20Sopenharmony_ci [TYPE_USB] = { 31468c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 31478c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 31488c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 31498c2ecf20Sopenharmony_ci }, 31508c2ecf20Sopenharmony_ci }, 31518c2ecf20Sopenharmony_ci [TYPE_USB] = { 31528c2ecf20Sopenharmony_ci [TYPE_NONE] = { 31538c2ecf20Sopenharmony_ci [NO_SSC] = &sl_usb_xcvr_diag_ln_vals, 31548c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sl_usb_xcvr_diag_ln_vals, 31558c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_xcvr_diag_ln_vals, 31568c2ecf20Sopenharmony_ci }, 31578c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 31588c2ecf20Sopenharmony_ci [NO_SSC] = &usb_pcie_xcvr_diag_ln_vals, 31598c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, 31608c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, 31618c2ecf20Sopenharmony_ci }, 31628c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 31638c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 31648c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 31658c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 31668c2ecf20Sopenharmony_ci }, 31678c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 31688c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 31698c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 31708c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 31718c2ecf20Sopenharmony_ci }, 31728c2ecf20Sopenharmony_ci }, 31738c2ecf20Sopenharmony_ci }, 31748c2ecf20Sopenharmony_ci .pcs_cmn_vals = { 31758c2ecf20Sopenharmony_ci [TYPE_USB] = { 31768c2ecf20Sopenharmony_ci [TYPE_NONE] = { 31778c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 31788c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31798c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31808c2ecf20Sopenharmony_ci }, 31818c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 31828c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 31838c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31848c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31858c2ecf20Sopenharmony_ci }, 31868c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 31878c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 31888c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31898c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31908c2ecf20Sopenharmony_ci }, 31918c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 31928c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 31938c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31948c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 31958c2ecf20Sopenharmony_ci }, 31968c2ecf20Sopenharmony_ci }, 31978c2ecf20Sopenharmony_ci }, 31988c2ecf20Sopenharmony_ci .cmn_vals = { 31998c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 32008c2ecf20Sopenharmony_ci [TYPE_NONE] = { 32018c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 32028c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 32038c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_pcie_100_int_ssc_cmn_vals, 32048c2ecf20Sopenharmony_ci }, 32058c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 32068c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 32078c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 32088c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 32098c2ecf20Sopenharmony_ci }, 32108c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 32118c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 32128c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 32138c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 32148c2ecf20Sopenharmony_ci }, 32158c2ecf20Sopenharmony_ci [TYPE_USB] = { 32168c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 32178c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 32188c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 32198c2ecf20Sopenharmony_ci }, 32208c2ecf20Sopenharmony_ci }, 32218c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 32228c2ecf20Sopenharmony_ci [TYPE_NONE] = { 32238c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, 32248c2ecf20Sopenharmony_ci }, 32258c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 32268c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, 32278c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, 32288c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_int_ssc_cmn_vals, 32298c2ecf20Sopenharmony_ci }, 32308c2ecf20Sopenharmony_ci [TYPE_USB] = { 32318c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, 32328c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, 32338c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, 32348c2ecf20Sopenharmony_ci }, 32358c2ecf20Sopenharmony_ci }, 32368c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 32378c2ecf20Sopenharmony_ci [TYPE_NONE] = { 32388c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, 32398c2ecf20Sopenharmony_ci }, 32408c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 32418c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, 32428c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, 32438c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_int_ssc_cmn_vals, 32448c2ecf20Sopenharmony_ci }, 32458c2ecf20Sopenharmony_ci [TYPE_USB] = { 32468c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, 32478c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, 32488c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, 32498c2ecf20Sopenharmony_ci }, 32508c2ecf20Sopenharmony_ci }, 32518c2ecf20Sopenharmony_ci [TYPE_USB] = { 32528c2ecf20Sopenharmony_ci [TYPE_NONE] = { 32538c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 32548c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 32558c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, 32568c2ecf20Sopenharmony_ci }, 32578c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 32588c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 32598c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 32608c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_int_ssc_cmn_vals, 32618c2ecf20Sopenharmony_ci }, 32628c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 32638c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 32648c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 32658c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, 32668c2ecf20Sopenharmony_ci }, 32678c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 32688c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 32698c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 32708c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, 32718c2ecf20Sopenharmony_ci }, 32728c2ecf20Sopenharmony_ci }, 32738c2ecf20Sopenharmony_ci }, 32748c2ecf20Sopenharmony_ci .tx_ln_vals = { 32758c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 32768c2ecf20Sopenharmony_ci [TYPE_NONE] = { 32778c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 32788c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 32798c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 32808c2ecf20Sopenharmony_ci }, 32818c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 32828c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 32838c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 32848c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 32858c2ecf20Sopenharmony_ci }, 32868c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 32878c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 32888c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 32898c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 32908c2ecf20Sopenharmony_ci }, 32918c2ecf20Sopenharmony_ci [TYPE_USB] = { 32928c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 32938c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 32948c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 32958c2ecf20Sopenharmony_ci }, 32968c2ecf20Sopenharmony_ci }, 32978c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 32988c2ecf20Sopenharmony_ci [TYPE_NONE] = { 32998c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33008c2ecf20Sopenharmony_ci }, 33018c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 33028c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33038c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33048c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33058c2ecf20Sopenharmony_ci }, 33068c2ecf20Sopenharmony_ci [TYPE_USB] = { 33078c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33088c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33098c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 33108c2ecf20Sopenharmony_ci }, 33118c2ecf20Sopenharmony_ci }, 33128c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 33138c2ecf20Sopenharmony_ci [TYPE_NONE] = { 33148c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33158c2ecf20Sopenharmony_ci }, 33168c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 33178c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33188c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33198c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33208c2ecf20Sopenharmony_ci }, 33218c2ecf20Sopenharmony_ci [TYPE_USB] = { 33228c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33238c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33248c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 33258c2ecf20Sopenharmony_ci }, 33268c2ecf20Sopenharmony_ci }, 33278c2ecf20Sopenharmony_ci [TYPE_USB] = { 33288c2ecf20Sopenharmony_ci [TYPE_NONE] = { 33298c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 33308c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33318c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33328c2ecf20Sopenharmony_ci }, 33338c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 33348c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 33358c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33368c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33378c2ecf20Sopenharmony_ci }, 33388c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 33398c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 33408c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33418c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33428c2ecf20Sopenharmony_ci }, 33438c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 33448c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 33458c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33468c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 33478c2ecf20Sopenharmony_ci }, 33488c2ecf20Sopenharmony_ci }, 33498c2ecf20Sopenharmony_ci }, 33508c2ecf20Sopenharmony_ci .rx_ln_vals = { 33518c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 33528c2ecf20Sopenharmony_ci [TYPE_NONE] = { 33538c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33548c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33558c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33568c2ecf20Sopenharmony_ci }, 33578c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 33588c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33598c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33608c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33618c2ecf20Sopenharmony_ci }, 33628c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 33638c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33648c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33658c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33668c2ecf20Sopenharmony_ci }, 33678c2ecf20Sopenharmony_ci [TYPE_USB] = { 33688c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33698c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33708c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 33718c2ecf20Sopenharmony_ci }, 33728c2ecf20Sopenharmony_ci }, 33738c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 33748c2ecf20Sopenharmony_ci [TYPE_NONE] = { 33758c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33768c2ecf20Sopenharmony_ci }, 33778c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 33788c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33798c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33808c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33818c2ecf20Sopenharmony_ci }, 33828c2ecf20Sopenharmony_ci [TYPE_USB] = { 33838c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33848c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33858c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 33868c2ecf20Sopenharmony_ci }, 33878c2ecf20Sopenharmony_ci }, 33888c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 33898c2ecf20Sopenharmony_ci [TYPE_NONE] = { 33908c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 33918c2ecf20Sopenharmony_ci }, 33928c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 33938c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 33948c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 33958c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 33968c2ecf20Sopenharmony_ci }, 33978c2ecf20Sopenharmony_ci [TYPE_USB] = { 33988c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 33998c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 34008c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 34018c2ecf20Sopenharmony_ci }, 34028c2ecf20Sopenharmony_ci }, 34038c2ecf20Sopenharmony_ci [TYPE_USB] = { 34048c2ecf20Sopenharmony_ci [TYPE_NONE] = { 34058c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 34068c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34078c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34088c2ecf20Sopenharmony_ci }, 34098c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 34108c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 34118c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34128c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34138c2ecf20Sopenharmony_ci }, 34148c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 34158c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 34168c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34178c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34188c2ecf20Sopenharmony_ci }, 34198c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 34208c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 34218c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34228c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 34238c2ecf20Sopenharmony_ci }, 34248c2ecf20Sopenharmony_ci }, 34258c2ecf20Sopenharmony_ci }, 34268c2ecf20Sopenharmony_ci}; 34278c2ecf20Sopenharmony_ci 34288c2ecf20Sopenharmony_cistatic const struct cdns_torrent_data ti_j721e_map_torrent = { 34298c2ecf20Sopenharmony_ci .block_offset_shift = 0x0, 34308c2ecf20Sopenharmony_ci .reg_offset_shift = 0x1, 34318c2ecf20Sopenharmony_ci .link_cmn_vals = { 34328c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 34338c2ecf20Sopenharmony_ci [TYPE_NONE] = { 34348c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 34358c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 34368c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 34378c2ecf20Sopenharmony_ci }, 34388c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 34398c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 34408c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34418c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34428c2ecf20Sopenharmony_ci }, 34438c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 34448c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 34458c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34468c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34478c2ecf20Sopenharmony_ci }, 34488c2ecf20Sopenharmony_ci [TYPE_USB] = { 34498c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_usb_link_cmn_vals, 34508c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_usb_link_cmn_vals, 34518c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_usb_link_cmn_vals, 34528c2ecf20Sopenharmony_ci }, 34538c2ecf20Sopenharmony_ci }, 34548c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 34558c2ecf20Sopenharmony_ci [TYPE_NONE] = { 34568c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_link_cmn_vals, 34578c2ecf20Sopenharmony_ci }, 34588c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 34598c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 34608c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34618c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34628c2ecf20Sopenharmony_ci }, 34638c2ecf20Sopenharmony_ci [TYPE_USB] = { 34648c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 34658c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 34668c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 34678c2ecf20Sopenharmony_ci }, 34688c2ecf20Sopenharmony_ci }, 34698c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 34708c2ecf20Sopenharmony_ci [TYPE_NONE] = { 34718c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_link_cmn_vals, 34728c2ecf20Sopenharmony_ci }, 34738c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 34748c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_link_cmn_vals, 34758c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34768c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_link_cmn_vals, 34778c2ecf20Sopenharmony_ci }, 34788c2ecf20Sopenharmony_ci [TYPE_USB] = { 34798c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 34808c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 34818c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 34828c2ecf20Sopenharmony_ci }, 34838c2ecf20Sopenharmony_ci }, 34848c2ecf20Sopenharmony_ci [TYPE_USB] = { 34858c2ecf20Sopenharmony_ci [TYPE_NONE] = { 34868c2ecf20Sopenharmony_ci [NO_SSC] = &sl_usb_link_cmn_vals, 34878c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sl_usb_link_cmn_vals, 34888c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_link_cmn_vals, 34898c2ecf20Sopenharmony_ci }, 34908c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 34918c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_usb_link_cmn_vals, 34928c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_usb_link_cmn_vals, 34938c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_usb_link_cmn_vals, 34948c2ecf20Sopenharmony_ci }, 34958c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 34968c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 34978c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 34988c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 34998c2ecf20Sopenharmony_ci }, 35008c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 35018c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_link_cmn_vals, 35028c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 35038c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_link_cmn_vals, 35048c2ecf20Sopenharmony_ci }, 35058c2ecf20Sopenharmony_ci }, 35068c2ecf20Sopenharmony_ci }, 35078c2ecf20Sopenharmony_ci .xcvr_diag_vals = { 35088c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 35098c2ecf20Sopenharmony_ci [TYPE_NONE] = { 35108c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 35118c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 35128c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 35138c2ecf20Sopenharmony_ci }, 35148c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 35158c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 35168c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 35178c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 35188c2ecf20Sopenharmony_ci }, 35198c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 35208c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 35218c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 35228c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_sgmii_xcvr_diag_ln_vals, 35238c2ecf20Sopenharmony_ci }, 35248c2ecf20Sopenharmony_ci [TYPE_USB] = { 35258c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_usb_xcvr_diag_ln_vals, 35268c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_usb_xcvr_diag_ln_vals, 35278c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_usb_xcvr_diag_ln_vals, 35288c2ecf20Sopenharmony_ci }, 35298c2ecf20Sopenharmony_ci }, 35308c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 35318c2ecf20Sopenharmony_ci [TYPE_NONE] = { 35328c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_xcvr_diag_ln_vals, 35338c2ecf20Sopenharmony_ci }, 35348c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 35358c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 35368c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 35378c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 35388c2ecf20Sopenharmony_ci }, 35398c2ecf20Sopenharmony_ci [TYPE_USB] = { 35408c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 35418c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 35428c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 35438c2ecf20Sopenharmony_ci }, 35448c2ecf20Sopenharmony_ci }, 35458c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 35468c2ecf20Sopenharmony_ci [TYPE_NONE] = { 35478c2ecf20Sopenharmony_ci [NO_SSC] = &sl_sgmii_xcvr_diag_ln_vals, 35488c2ecf20Sopenharmony_ci }, 35498c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 35508c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 35518c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 35528c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_pcie_xcvr_diag_ln_vals, 35538c2ecf20Sopenharmony_ci }, 35548c2ecf20Sopenharmony_ci [TYPE_USB] = { 35558c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 35568c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 35578c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_usb_xcvr_diag_ln_vals, 35588c2ecf20Sopenharmony_ci }, 35598c2ecf20Sopenharmony_ci }, 35608c2ecf20Sopenharmony_ci [TYPE_USB] = { 35618c2ecf20Sopenharmony_ci [TYPE_NONE] = { 35628c2ecf20Sopenharmony_ci [NO_SSC] = &sl_usb_xcvr_diag_ln_vals, 35638c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sl_usb_xcvr_diag_ln_vals, 35648c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_xcvr_diag_ln_vals, 35658c2ecf20Sopenharmony_ci }, 35668c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 35678c2ecf20Sopenharmony_ci [NO_SSC] = &usb_pcie_xcvr_diag_ln_vals, 35688c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, 35698c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_pcie_xcvr_diag_ln_vals, 35708c2ecf20Sopenharmony_ci }, 35718c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 35728c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 35738c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 35748c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 35758c2ecf20Sopenharmony_ci }, 35768c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 35778c2ecf20Sopenharmony_ci [NO_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 35788c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 35798c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_sgmii_xcvr_diag_ln_vals, 35808c2ecf20Sopenharmony_ci }, 35818c2ecf20Sopenharmony_ci }, 35828c2ecf20Sopenharmony_ci }, 35838c2ecf20Sopenharmony_ci .pcs_cmn_vals = { 35848c2ecf20Sopenharmony_ci [TYPE_USB] = { 35858c2ecf20Sopenharmony_ci [TYPE_NONE] = { 35868c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 35878c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 35888c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 35898c2ecf20Sopenharmony_ci }, 35908c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 35918c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 35928c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 35938c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 35948c2ecf20Sopenharmony_ci }, 35958c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 35968c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 35978c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 35988c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 35998c2ecf20Sopenharmony_ci }, 36008c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 36018c2ecf20Sopenharmony_ci [NO_SSC] = &usb_phy_pcs_cmn_vals, 36028c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 36038c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_phy_pcs_cmn_vals, 36048c2ecf20Sopenharmony_ci }, 36058c2ecf20Sopenharmony_ci }, 36068c2ecf20Sopenharmony_ci }, 36078c2ecf20Sopenharmony_ci .cmn_vals = { 36088c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 36098c2ecf20Sopenharmony_ci [TYPE_NONE] = { 36108c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 36118c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 36128c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_pcie_100_int_ssc_cmn_vals, 36138c2ecf20Sopenharmony_ci }, 36148c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 36158c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 36168c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 36178c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 36188c2ecf20Sopenharmony_ci }, 36198c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 36208c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 36218c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 36228c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 36238c2ecf20Sopenharmony_ci }, 36248c2ecf20Sopenharmony_ci [TYPE_USB] = { 36258c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_cmn_vals, 36268c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_cmn_vals, 36278c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_int_ssc_cmn_vals, 36288c2ecf20Sopenharmony_ci }, 36298c2ecf20Sopenharmony_ci }, 36308c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 36318c2ecf20Sopenharmony_ci [TYPE_NONE] = { 36328c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, 36338c2ecf20Sopenharmony_ci }, 36348c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 36358c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, 36368c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, 36378c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_int_ssc_cmn_vals, 36388c2ecf20Sopenharmony_ci }, 36398c2ecf20Sopenharmony_ci [TYPE_USB] = { 36408c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_cmn_vals, 36418c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, 36428c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_cmn_vals, 36438c2ecf20Sopenharmony_ci }, 36448c2ecf20Sopenharmony_ci }, 36458c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 36468c2ecf20Sopenharmony_ci [TYPE_NONE] = { 36478c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, 36488c2ecf20Sopenharmony_ci }, 36498c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 36508c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, 36518c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, 36528c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_int_ssc_cmn_vals, 36538c2ecf20Sopenharmony_ci }, 36548c2ecf20Sopenharmony_ci [TYPE_USB] = { 36558c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_cmn_vals, 36568c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, 36578c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_cmn_vals, 36588c2ecf20Sopenharmony_ci }, 36598c2ecf20Sopenharmony_ci }, 36608c2ecf20Sopenharmony_ci [TYPE_USB] = { 36618c2ecf20Sopenharmony_ci [TYPE_NONE] = { 36628c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 36638c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 36648c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, 36658c2ecf20Sopenharmony_ci }, 36668c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 36678c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 36688c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 36698c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_int_ssc_cmn_vals, 36708c2ecf20Sopenharmony_ci }, 36718c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 36728c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 36738c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 36748c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, 36758c2ecf20Sopenharmony_ci }, 36768c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 36778c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_cmn_vals, 36788c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_cmn_vals, 36798c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sl_usb_100_int_ssc_cmn_vals, 36808c2ecf20Sopenharmony_ci }, 36818c2ecf20Sopenharmony_ci }, 36828c2ecf20Sopenharmony_ci }, 36838c2ecf20Sopenharmony_ci .tx_ln_vals = { 36848c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 36858c2ecf20Sopenharmony_ci [TYPE_NONE] = { 36868c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 36878c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 36888c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 36898c2ecf20Sopenharmony_ci }, 36908c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 36918c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 36928c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 36938c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 36948c2ecf20Sopenharmony_ci }, 36958c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 36968c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 36978c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 36988c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 36998c2ecf20Sopenharmony_ci }, 37008c2ecf20Sopenharmony_ci [TYPE_USB] = { 37018c2ecf20Sopenharmony_ci [NO_SSC] = NULL, 37028c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = NULL, 37038c2ecf20Sopenharmony_ci [INTERNAL_SSC] = NULL, 37048c2ecf20Sopenharmony_ci }, 37058c2ecf20Sopenharmony_ci }, 37068c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 37078c2ecf20Sopenharmony_ci [TYPE_NONE] = { 37088c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37098c2ecf20Sopenharmony_ci }, 37108c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 37118c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37128c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37138c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37148c2ecf20Sopenharmony_ci }, 37158c2ecf20Sopenharmony_ci [TYPE_USB] = { 37168c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37178c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37188c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_tx_ln_vals, 37198c2ecf20Sopenharmony_ci }, 37208c2ecf20Sopenharmony_ci }, 37218c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 37228c2ecf20Sopenharmony_ci [TYPE_NONE] = { 37238c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37248c2ecf20Sopenharmony_ci }, 37258c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 37268c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37278c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37288c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37298c2ecf20Sopenharmony_ci }, 37308c2ecf20Sopenharmony_ci [TYPE_USB] = { 37318c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37328c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37338c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_tx_ln_vals, 37348c2ecf20Sopenharmony_ci }, 37358c2ecf20Sopenharmony_ci }, 37368c2ecf20Sopenharmony_ci [TYPE_USB] = { 37378c2ecf20Sopenharmony_ci [TYPE_NONE] = { 37388c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 37398c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37408c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37418c2ecf20Sopenharmony_ci }, 37428c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 37438c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 37448c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37458c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37468c2ecf20Sopenharmony_ci }, 37478c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 37488c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 37498c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37508c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37518c2ecf20Sopenharmony_ci }, 37528c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 37538c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_tx_ln_vals, 37548c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37558c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_tx_ln_vals, 37568c2ecf20Sopenharmony_ci }, 37578c2ecf20Sopenharmony_ci }, 37588c2ecf20Sopenharmony_ci }, 37598c2ecf20Sopenharmony_ci .rx_ln_vals = { 37608c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 37618c2ecf20Sopenharmony_ci [TYPE_NONE] = { 37628c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37638c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37648c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37658c2ecf20Sopenharmony_ci }, 37668c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 37678c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37688c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37698c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37708c2ecf20Sopenharmony_ci }, 37718c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 37728c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37738c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37748c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37758c2ecf20Sopenharmony_ci }, 37768c2ecf20Sopenharmony_ci [TYPE_USB] = { 37778c2ecf20Sopenharmony_ci [NO_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37788c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37798c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &pcie_100_no_ssc_rx_ln_vals, 37808c2ecf20Sopenharmony_ci }, 37818c2ecf20Sopenharmony_ci }, 37828c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 37838c2ecf20Sopenharmony_ci [TYPE_NONE] = { 37848c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37858c2ecf20Sopenharmony_ci }, 37868c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 37878c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37888c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37898c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37908c2ecf20Sopenharmony_ci }, 37918c2ecf20Sopenharmony_ci [TYPE_USB] = { 37928c2ecf20Sopenharmony_ci [NO_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37938c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37948c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &sgmii_100_no_ssc_rx_ln_vals, 37958c2ecf20Sopenharmony_ci }, 37968c2ecf20Sopenharmony_ci }, 37978c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 37988c2ecf20Sopenharmony_ci [TYPE_NONE] = { 37998c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38008c2ecf20Sopenharmony_ci }, 38018c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 38028c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38038c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38048c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38058c2ecf20Sopenharmony_ci }, 38068c2ecf20Sopenharmony_ci [TYPE_USB] = { 38078c2ecf20Sopenharmony_ci [NO_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38088c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38098c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &qsgmii_100_no_ssc_rx_ln_vals, 38108c2ecf20Sopenharmony_ci }, 38118c2ecf20Sopenharmony_ci }, 38128c2ecf20Sopenharmony_ci [TYPE_USB] = { 38138c2ecf20Sopenharmony_ci [TYPE_NONE] = { 38148c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 38158c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38168c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38178c2ecf20Sopenharmony_ci }, 38188c2ecf20Sopenharmony_ci [TYPE_PCIE] = { 38198c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 38208c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38218c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38228c2ecf20Sopenharmony_ci }, 38238c2ecf20Sopenharmony_ci [TYPE_SGMII] = { 38248c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 38258c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38268c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38278c2ecf20Sopenharmony_ci }, 38288c2ecf20Sopenharmony_ci [TYPE_QSGMII] = { 38298c2ecf20Sopenharmony_ci [NO_SSC] = &usb_100_no_ssc_rx_ln_vals, 38308c2ecf20Sopenharmony_ci [EXTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38318c2ecf20Sopenharmony_ci [INTERNAL_SSC] = &usb_100_no_ssc_rx_ln_vals, 38328c2ecf20Sopenharmony_ci }, 38338c2ecf20Sopenharmony_ci }, 38348c2ecf20Sopenharmony_ci }, 38358c2ecf20Sopenharmony_ci}; 38368c2ecf20Sopenharmony_ci 38378c2ecf20Sopenharmony_cistatic const struct of_device_id cdns_torrent_phy_of_match[] = { 38388c2ecf20Sopenharmony_ci { 38398c2ecf20Sopenharmony_ci .compatible = "cdns,torrent-phy", 38408c2ecf20Sopenharmony_ci .data = &cdns_map_torrent, 38418c2ecf20Sopenharmony_ci }, 38428c2ecf20Sopenharmony_ci { 38438c2ecf20Sopenharmony_ci .compatible = "ti,j721e-serdes-10g", 38448c2ecf20Sopenharmony_ci .data = &ti_j721e_map_torrent, 38458c2ecf20Sopenharmony_ci }, 38468c2ecf20Sopenharmony_ci {} 38478c2ecf20Sopenharmony_ci}; 38488c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, cdns_torrent_phy_of_match); 38498c2ecf20Sopenharmony_ci 38508c2ecf20Sopenharmony_cistatic struct platform_driver cdns_torrent_phy_driver = { 38518c2ecf20Sopenharmony_ci .probe = cdns_torrent_phy_probe, 38528c2ecf20Sopenharmony_ci .remove = cdns_torrent_phy_remove, 38538c2ecf20Sopenharmony_ci .driver = { 38548c2ecf20Sopenharmony_ci .name = "cdns-torrent-phy", 38558c2ecf20Sopenharmony_ci .of_match_table = cdns_torrent_phy_of_match, 38568c2ecf20Sopenharmony_ci } 38578c2ecf20Sopenharmony_ci}; 38588c2ecf20Sopenharmony_cimodule_platform_driver(cdns_torrent_phy_driver); 38598c2ecf20Sopenharmony_ci 38608c2ecf20Sopenharmony_ciMODULE_AUTHOR("Cadence Design Systems, Inc."); 38618c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Cadence Torrent PHY driver"); 38628c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 3863