16f45ec7bSml29623 /* 26f45ec7bSml29623 * CDDL HEADER START 36f45ec7bSml29623 * 46f45ec7bSml29623 * The contents of this file are subject to the terms of the 56f45ec7bSml29623 * Common Development and Distribution License (the "License"). 66f45ec7bSml29623 * You may not use this file except in compliance with the License. 76f45ec7bSml29623 * 86f45ec7bSml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 96f45ec7bSml29623 * or http://www.opensolaris.org/os/licensing. 106f45ec7bSml29623 * See the License for the specific language governing permissions 116f45ec7bSml29623 * and limitations under the License. 126f45ec7bSml29623 * 136f45ec7bSml29623 * When distributing Covered Code, include this CDDL HEADER in each 146f45ec7bSml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 156f45ec7bSml29623 * If applicable, add the following below this CDDL HEADER, with the 166f45ec7bSml29623 * fields enclosed by brackets "[]" replaced with your own identifying 176f45ec7bSml29623 * information: Portions Copyright [yyyy] [name of copyright owner] 186f45ec7bSml29623 * 196f45ec7bSml29623 * CDDL HEADER END 206f45ec7bSml29623 */ 216f45ec7bSml29623 /* 2289282175SSantwona Behera * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 236f45ec7bSml29623 */ 246f45ec7bSml29623 256f45ec7bSml29623 #ifndef _SYS_NXGE_NXGE_PHY_HW_H 266f45ec7bSml29623 #define _SYS_NXGE_NXGE_PHY_HW_H 276f45ec7bSml29623 286f45ec7bSml29623 #ifdef __cplusplus 296f45ec7bSml29623 extern "C" { 306f45ec7bSml29623 #endif 316f45ec7bSml29623 326f45ec7bSml29623 #include <nxge_defs.h> 336f45ec7bSml29623 3400161856Syc148097 /* 3523b952a3SSantwona Behera * Clause 45 and Clause 22 port/phy addresses 0 through 5 are reserved 3623b952a3SSantwona Behera * for on-chip serdes. So here the starting port is 6. 3700161856Syc148097 */ 3859ac0c16Sdavemq #define NXGE_MAX_PHY_PORTS 32 3923b952a3SSantwona Behera #define NXGE_EXT_PHY_PORT_ST 6 4059ac0c16Sdavemq 4159ac0c16Sdavemq #define NXGE_PMA_PMD_DEV_ADDR 1 4259ac0c16Sdavemq #define NXGE_PCS_DEV_ADDR 3 4359ac0c16Sdavemq #define NXGE_DEV_ID_REG_1 2 4459ac0c16Sdavemq #define NXGE_DEV_ID_REG_2 3 4559ac0c16Sdavemq #define NXGE_PHY_ID_REG_1 2 4659ac0c16Sdavemq #define NXGE_PHY_ID_REG_2 3 4759ac0c16Sdavemq 482d17280bSsbehera #define BCM8704_CHIP_ID 0x8704 492d17280bSsbehera #define BCM8706_CHIP_ID 0x8706 5052cdd236Ssbehera #define MRVL88X201X_CHIP_ID 0x5043 5189282175SSantwona Behera #define NLP2020_CHIP_ID 0x0211 522d17280bSsbehera 5330505775Ssbehera /* 5400161856Syc148097 * Description of BCM_PHY_ID_MASK: 5530505775Ssbehera * The first nibble (bits 0 through 3) is changed with every revision 5630505775Ssbehera * of the silicon. So these bits are masked out to support future revisions 5730505775Ssbehera * of the same chip. The third nibble (bits 8 through 11) is changed for 5830505775Ssbehera * different chips of the same family. So these bits are masked out to 5930505775Ssbehera * support chips of the same family. 6030505775Ssbehera */ 6130505775Ssbehera #define BCM_PHY_ID_MASK 0xfffff0f0 6259ac0c16Sdavemq #define BCM8704_DEV_ID 0x206033 6359ac0c16Sdavemq #define BCM5464R_PHY_ID 0x2060b1 642d17280bSsbehera #define BCM8706_DEV_ID 0x206035 6559a835ddSjoycey #define BCM5482_PHY_ID 0x143bcb1 6652cdd236Ssbehera #define MARVELL_88X_201X_DEV_ID 0x1410d24 6752cdd236Ssbehera #define MARVELL_88X201X_PHY_ID (MARVELL_88X_201X_DEV_ID & BCM_PHY_ID_MASK) 6830505775Ssbehera #define PHY_BCM8704_FAMILY (BCM8704_DEV_ID & BCM_PHY_ID_MASK) 6930505775Ssbehera #define PHY_BCM5464R_FAMILY (BCM5464R_PHY_ID & BCM_PHY_ID_MASK) 7059a835ddSjoycey #define PHY_BCM5482_FAMILY (BCM5482_PHY_ID & BCM_PHY_ID_MASK) 7100161856Syc148097 /* 7200161856Syc148097 * The default value is 0xa19410, after masking out model and revision 7300161856Syc148097 * (bits[9:0]) use 0xa19400 for any model or revision of the TN1010 7400161856Syc148097 */ 7500161856Syc148097 #define TN1010_DEV_ID 0xa19400 7600161856Syc148097 /* 7700161856Syc148097 * Description of TN1010_DEV_ID_MASK: 7800161856Syc148097 * The device ID assigned to Teranetics is stored in TN1010 register 7900161856Syc148097 * 1.2 and register 1.3 except bits[9:4] of register 1.3 for model number 8000161856Syc148097 * and bits[3:0] of register 1.3 for revision numbers. Use mask 0xfffffc00 8100161856Syc148097 * to mask off model number and revision number and keep TN1010's device 8200161856Syc148097 * identifier 8300161856Syc148097 */ 8400161856Syc148097 #define TN1010_DEV_ID_MASK 0xfffffc00 8589282175SSantwona Behera /* 8689282175SSantwona Behera * The Netlogic device ID and mask: 8789282175SSantwona Behera * The device ID assigned to Netlogic is stored in AEL2020 register 8889282175SSantwona Behera * 1.2 and register 1.3 except bits[7:4] of register 1.3 have the model number 8989282175SSantwona Behera * and bits[3:0] of register 1.3 have the revision number. Use mask 0xffffff00 9089282175SSantwona Behera * to mask off model number and revision number and keep AEL2020 device 9189282175SSantwona Behera * identifier 9289282175SSantwona Behera */ 9389282175SSantwona Behera #define NLP2020_DEV_ID 0x3429000 9489282175SSantwona Behera #define NLP2020_DEV_ID_MASK 0xffffff00 9559ac0c16Sdavemq 9659ac0c16Sdavemq #define CLAUSE_45_TYPE 1 9759ac0c16Sdavemq #define CLAUSE_22_TYPE 2 9859ac0c16Sdavemq 9900161856Syc148097 /* IEEE802.3 Clause45 and Clause22 MDIO port addresses */ 10000161856Syc148097 #define NEPTUNE_CLAUSE22_PORT_ADDR_BASE 10 10100161856Syc148097 #define NEPTUNE_CLAUSE45_PORT_ADDR_BASE 8 10200161856Syc148097 #define N2_CLAUSE45_PORT_ADDR_BASE 16 10352cdd236Ssbehera #define MRVL88X2011_NEPTUNE_PORT_ADDR_BASE 8 10459ac0c16Sdavemq 10559ac0c16Sdavemq /* 1062d17280bSsbehera * Phy address for the second NIU port on Goa NEM card can be either 1072d17280bSsbehera * 20 or 17 1082d17280bSsbehera */ 10900161856Syc148097 #define GOA_CLAUSE45_PORT_ADDR_BASE 16 11000161856Syc148097 #define ALT_GOA_CLAUSE45_PORT1_ADDR 20 11189282175SSantwona Behera 11289282175SSantwona Behera /* 11389282175SSantwona Behera * Phy addresses for AEL2020 used in QSFP for RF systems 11489282175SSantwona Behera */ 11589282175SSantwona Behera #define NLP2020_CL45_PORT0_ADDR0 0x10 11689282175SSantwona Behera #define NLP2020_CL45_PORT0_ADDR1 0x12 11789282175SSantwona Behera #define NLP2020_CL45_PORT0_ADDR2 0x15 11889282175SSantwona Behera #define NLP2020_CL45_PORT0_ADDR3 0x17 11989282175SSantwona Behera #define NLP2020_CL45_PORT1_ADDR0 0x11 12089282175SSantwona Behera #define NLP2020_CL45_PORT1_ADDR1 0x13 12189282175SSantwona Behera #define NLP2020_CL45_PORT1_ADDR2 0x14 12289282175SSantwona Behera #define NLP2020_CL45_PORT1_ADDR3 0x16 12389282175SSantwona Behera 1242d17280bSsbehera /* 12559ac0c16Sdavemq * Phy addresses for Maramba support. Support for P0 will eventually 12659ac0c16Sdavemq * be removed. 12759ac0c16Sdavemq */ 12800161856Syc148097 #define MARAMBA_P0_CLAUSE22_PORT_ADDR_BASE 10 12900161856Syc148097 #define MARAMBA_P1_CLAUSE22_PORT_ADDR_BASE 26 13000161856Syc148097 #define MARAMBA_CLAUSE45_PORT_ADDR_BASE 16 13159ac0c16Sdavemq 1326f45ec7bSml29623 #define BCM8704_PMA_PMD_DEV_ADDR 1 1336f45ec7bSml29623 #define BCM8704_PCS_DEV_ADDR 3 1346f45ec7bSml29623 #define BCM8704_USER_DEV3_ADDR 3 1356f45ec7bSml29623 #define BCM8704_PHYXS_ADDR 4 1366f45ec7bSml29623 #define BCM8704_USER_DEV4_ADDR 4 1376f45ec7bSml29623 1386f45ec7bSml29623 /* Definitions for BCM 5464R PHY chip */ 1396f45ec7bSml29623 1406f45ec7bSml29623 #define BCM5464R_PHY_ECR 16 1416f45ec7bSml29623 #define BCM5464R_PHY_ESR 17 1426f45ec7bSml29623 #define BCM5464R_RXERR_CNT 18 1436f45ec7bSml29623 #define BCM5464R_FALSECS_CNT 19 1446f45ec7bSml29623 #define BCM5464R_RX_NOTOK_CNT 20 1456f45ec7bSml29623 #define BCM5464R_ER_DATA 21 1466f45ec7bSml29623 #define BCM5464R_RES 22 1476f45ec7bSml29623 #define BCM5464R_ER_ACC 23 1486f45ec7bSml29623 #define BCM5464R_AUX_CTL 24 1496f45ec7bSml29623 #define BCM5464R_AUX_S 25 1506f45ec7bSml29623 #define BCM5464R_INTR_S 26 1516f45ec7bSml29623 #define BCM5464R_INTR_M 27 1526f45ec7bSml29623 #define BCM5464R_MISC 28 1536f45ec7bSml29623 #define BCM5464R_MISC1 29 1546f45ec7bSml29623 #define BCM5464R_TESTR1 30 1556f45ec7bSml29623 1566f45ec7bSml29623 #define PHY_BCM_5464R_OUI 0x001018 1576f45ec7bSml29623 #define PHY_BCM_5464R_MODEL 0x0B 1586f45ec7bSml29623 15952cdd236Ssbehera /* MARVELL PHY Definitions */ 16052cdd236Ssbehera /* REG Offsets */ 16152cdd236Ssbehera #define MRVL_88X2011_USER_DEV1_ADDR 1 16252cdd236Ssbehera #define MRVL_88X2011_USER_DEV2_ADDR 2 16352cdd236Ssbehera #define MRVL_88X2011_USER_DEV3_ADDR 3 16452cdd236Ssbehera #define MRVL_88X2011_USER_DEV4_ADDR 4 16552cdd236Ssbehera #define MRVL_88X2011_PMA_PMD_CTL_1 0x0000 16652cdd236Ssbehera #define MRVL_88X2011_PMA_PMD_STAT_1 0x0001 16752cdd236Ssbehera #define MRVL_88X2011_10G_PMD_STAT_2 0x0008 16852cdd236Ssbehera #define MRVL_88X2011_10G_PMD_TX_DIS 0x0009 16952cdd236Ssbehera #define MRVL_88X2011_10G_XGXS_LANE_STAT 0x0018 17052cdd236Ssbehera #define MRVL_88X2011_GEN_CTL 0x8300 17152cdd236Ssbehera #define MRVL_88X2011_LED_BLINK_CTL 0x8303 17252cdd236Ssbehera #define MRVL_88X2011_LED_8_TO_11_CTL 0x8306 17352cdd236Ssbehera 17452cdd236Ssbehera /* MRVL88X2011 register control */ 17552cdd236Ssbehera #define MRVL_88X2011_ENA_PMDTX 0x0000 17652cdd236Ssbehera #define MRVL_88X2011_ENA_XFPREFCLK 0x0001 17752cdd236Ssbehera #define MRVL_88X2011_LOOPBACK 0x1 17852cdd236Ssbehera #define MRVL_88X2011_LED_ACT 0x1 17952cdd236Ssbehera #define MRVL_88X2011_LNK_STATUS_OK 0x4 18052cdd236Ssbehera #define MRVL_88X2011_LED_BLK_MASK 0x70 18152cdd236Ssbehera #define MRVL_88X2011_LED_BLK_SHIFT 4 18252cdd236Ssbehera #define MRVL_88X2011_LED_BLK34MS 0x0 18352cdd236Ssbehera #define MRVL_88X2011_LED_BLK67MS 0x1 18452cdd236Ssbehera #define MRVL_88X2011_LED_BLK134MS 0x2 18552cdd236Ssbehera #define MRVL_88X2011_LED_BLK269MS 0x3 18652cdd236Ssbehera #define MRVL_88X2011_LED_BLK538MS 0x4 18752cdd236Ssbehera #define MRVL_88X2011_LED_CTL_OFF 0x0 18852cdd236Ssbehera #define MRVL_88X2011_LED_CTL_PCS_ERR 0x2 18952cdd236Ssbehera #define MRVL_88X2011_LED_CTL_PCS_ACT 0x5 19052cdd236Ssbehera #define MRVL_88X2011_LED_CTL_MASK 0x7 19152cdd236Ssbehera #define MRVL_88X2011_LED(n, v) ((v)<<((n)*4)) 19252cdd236Ssbehera #define MRVL_88X2011_LED_STAT(n, v) ((v)>>((n)*4)) 19352cdd236Ssbehera 1946f45ec7bSml29623 /* 1956f45ec7bSml29623 * MII Register 16: PHY Extended Control Register 1966f45ec7bSml29623 */ 1976f45ec7bSml29623 1986f45ec7bSml29623 typedef union _mii_phy_ecr_t { 1996f45ec7bSml29623 uint16_t value; 2006f45ec7bSml29623 struct { 2016f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 2026f45ec7bSml29623 uint16_t mac_phy_if_mode : 1; 2036f45ec7bSml29623 uint16_t dis_automdicross : 1; 2046f45ec7bSml29623 uint16_t tx_dis : 1; 2056f45ec7bSml29623 uint16_t intr_dis : 1; 2066f45ec7bSml29623 uint16_t force_intr : 1; 2076f45ec7bSml29623 uint16_t bypass_encdec : 1; 2086f45ec7bSml29623 uint16_t bypass_scrdes : 1; 2096f45ec7bSml29623 uint16_t bypass_mlt3 : 1; 2106f45ec7bSml29623 uint16_t bypass_rx_sym : 1; 2116f45ec7bSml29623 uint16_t reset_scr : 1; 2126f45ec7bSml29623 uint16_t en_led_traffic : 1; 2136f45ec7bSml29623 uint16_t force_leds_on : 1; 2146f45ec7bSml29623 uint16_t force_leds_off : 1; 2156f45ec7bSml29623 uint16_t res : 2; 2166f45ec7bSml29623 uint16_t gmii_fifo_elas : 1; 2176f45ec7bSml29623 #else 2186f45ec7bSml29623 uint16_t gmii_fifo_elas : 1; 2196f45ec7bSml29623 uint16_t res : 2; 2206f45ec7bSml29623 uint16_t force_leds_off : 1; 2216f45ec7bSml29623 uint16_t force_leds_on : 1; 2226f45ec7bSml29623 uint16_t en_led_traffic : 1; 2236f45ec7bSml29623 uint16_t reset_scr : 1; 2246f45ec7bSml29623 uint16_t bypass_rx_sym : 1; 2256f45ec7bSml29623 uint16_t bypass_mlt3 : 1; 2266f45ec7bSml29623 uint16_t bypass_scrdes : 1; 2276f45ec7bSml29623 uint16_t bypass_encdec : 1; 2286f45ec7bSml29623 uint16_t force_intr : 1; 2296f45ec7bSml29623 uint16_t intr_dis : 1; 2306f45ec7bSml29623 uint16_t tx_dis : 1; 2316f45ec7bSml29623 uint16_t dis_automdicross : 1; 2326f45ec7bSml29623 uint16_t mac_phy_if_mode : 1; 2336f45ec7bSml29623 #endif 2346f45ec7bSml29623 } bits; 2356f45ec7bSml29623 } mii_phy_ecr_t, *p_mii_phy_ecr_t; 2366f45ec7bSml29623 2376f45ec7bSml29623 /* 2386f45ec7bSml29623 * MII Register 17: PHY Extended Status Register 2396f45ec7bSml29623 */ 2406f45ec7bSml29623 typedef union _mii_phy_esr_t { 2416f45ec7bSml29623 uint16_t value; 2426f45ec7bSml29623 struct { 2436f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 2446f45ec7bSml29623 uint16_t anbpsfm : 1; 2456f45ec7bSml29623 uint16_t wsdwngr : 1; 2466f45ec7bSml29623 uint16_t mdi_crst : 1; 2476f45ec7bSml29623 uint16_t intr_s : 1; 2486f45ec7bSml29623 uint16_t rmt_rx_s : 1; 2496f45ec7bSml29623 uint16_t loc_rx_s : 1; 2506f45ec7bSml29623 uint16_t locked : 1; 2516f45ec7bSml29623 uint16_t link_s : 1; 2526f45ec7bSml29623 uint16_t crc_err : 1; 2536f45ec7bSml29623 uint16_t cext_err : 1; 2546f45ec7bSml29623 uint16_t bad_ssd : 1; 2556f45ec7bSml29623 uint16_t bad_esd : 1; 2566f45ec7bSml29623 uint16_t rx_err : 1; 2576f45ec7bSml29623 uint16_t tx_err : 1; 2586f45ec7bSml29623 uint16_t lock_err : 1; 2596f45ec7bSml29623 uint16_t mlt3_cerr : 1; 2606f45ec7bSml29623 #else 2616f45ec7bSml29623 uint16_t mlt3_cerr : 1; 2626f45ec7bSml29623 uint16_t lock_err : 1; 2636f45ec7bSml29623 uint16_t tx_err : 1; 2646f45ec7bSml29623 uint16_t rx_err : 1; 2656f45ec7bSml29623 uint16_t bad_esd : 1; 2666f45ec7bSml29623 uint16_t bad_ssd : 1; 2676f45ec7bSml29623 uint16_t cext_err : 1; 2686f45ec7bSml29623 uint16_t crc_err : 1; 2696f45ec7bSml29623 uint16_t link_s : 1; 2706f45ec7bSml29623 uint16_t locked : 1; 2716f45ec7bSml29623 uint16_t loc_rx_s : 1; 2726f45ec7bSml29623 uint16_t rmt_rx_s : 1; 2736f45ec7bSml29623 uint16_t intr_s : 1; 2746f45ec7bSml29623 uint16_t mdi_crst : 1; 2756f45ec7bSml29623 uint16_t wsdwngr : 1; 2766f45ec7bSml29623 uint16_t anbpsfm : 1; 2776f45ec7bSml29623 #endif 2786f45ec7bSml29623 } bits; 2796f45ec7bSml29623 } mii_phy_esr_t, *p_mii_phy_esr_t; 2806f45ec7bSml29623 2816f45ec7bSml29623 /* 2826f45ec7bSml29623 * MII Register 18: Receive Error Counter Register 2836f45ec7bSml29623 */ 2846f45ec7bSml29623 typedef union _mii_rxerr_cnt_t { 2856f45ec7bSml29623 uint16_t value; 2866f45ec7bSml29623 struct { 2876f45ec7bSml29623 uint16_t rx_err_cnt : 16; 2886f45ec7bSml29623 } bits; 2896f45ec7bSml29623 } mii_rxerr_cnt_t, *p_mii_rxerr_cnt_t; 2906f45ec7bSml29623 2916f45ec7bSml29623 /* 2926f45ec7bSml29623 * MII Register 19: False Carrier Sense Counter Register 2936f45ec7bSml29623 */ 2946f45ec7bSml29623 typedef union _mii_falsecs_cnt_t { 2956f45ec7bSml29623 uint16_t value; 2966f45ec7bSml29623 struct { 2976f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 2986f45ec7bSml29623 uint16_t res : 8; 2996f45ec7bSml29623 uint16_t false_cs_cnt : 8; 3006f45ec7bSml29623 #else 3016f45ec7bSml29623 uint16_t false_cs_cnt : 8; 3026f45ec7bSml29623 uint16_t res : 8; 3036f45ec7bSml29623 #endif 3046f45ec7bSml29623 } bits; 3056f45ec7bSml29623 } mii_falsecs_cnt_t, *p_mii_falsecs_cnt_t; 3066f45ec7bSml29623 3076f45ec7bSml29623 /* 3086f45ec7bSml29623 * MII Register 20: Receiver NOT_OK Counter Register 3096f45ec7bSml29623 */ 3106f45ec7bSml29623 typedef union _mii_rx_notok_cnt_t { 3116f45ec7bSml29623 uint16_t value; 3126f45ec7bSml29623 struct { 3136f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 3146f45ec7bSml29623 uint16_t l_rx_notok_cnt : 8; 3156f45ec7bSml29623 uint16_t r_rx_notok_cnt : 8; 3166f45ec7bSml29623 #else 3176f45ec7bSml29623 uint16_t r_rx_notok_cnt : 8; 3186f45ec7bSml29623 uint16_t l_rx_notok_cnt : 8; 3196f45ec7bSml29623 #endif 3206f45ec7bSml29623 } bits; 3216f45ec7bSml29623 } mii_rx_notok_cnt_t, *p_mii_rx_notok_t; 3226f45ec7bSml29623 3236f45ec7bSml29623 /* 3246f45ec7bSml29623 * MII Register 21: Expansion Register Data Register 3256f45ec7bSml29623 */ 3266f45ec7bSml29623 typedef union _mii_er_data_t { 3276f45ec7bSml29623 uint16_t value; 3286f45ec7bSml29623 struct { 3296f45ec7bSml29623 uint16_t reg_data; 3306f45ec7bSml29623 } bits; 3316f45ec7bSml29623 } mii_er_data_t, *p_mii_er_data_t; 3326f45ec7bSml29623 3336f45ec7bSml29623 /* 3346f45ec7bSml29623 * MII Register 23: Expansion Register Access Register 3356f45ec7bSml29623 */ 3366f45ec7bSml29623 typedef union _mii_er_acc_t { 3376f45ec7bSml29623 struct { 3386f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 3396f45ec7bSml29623 uint16_t res : 4; 3406f45ec7bSml29623 uint16_t er_sel : 4; 3416f45ec7bSml29623 uint16_t er_acc : 8; 3426f45ec7bSml29623 #else 3436f45ec7bSml29623 uint16_t er_acc : 8; 3446f45ec7bSml29623 uint16_t er_sel : 4; 3456f45ec7bSml29623 uint16_t res : 4; 3466f45ec7bSml29623 #endif 3476f45ec7bSml29623 } bits; 3486f45ec7bSml29623 } mii_er_acc_t, *p_mii_er_acc_t; 3496f45ec7bSml29623 3506f45ec7bSml29623 #define EXP_RXTX_PKT_CNT 0x0 3516f45ec7bSml29623 #define EXP_INTR_STAT 0x1 3526f45ec7bSml29623 #define MULTICOL_LED_SEL 0x4 3536f45ec7bSml29623 #define MULTICOL_LED_FLASH_RATE_CTL 0x5 3546f45ec7bSml29623 #define MULTICOL_LED_BLINK_CTL 0x6 3556f45ec7bSml29623 #define CABLE_DIAG_CTL 0x10 3566f45ec7bSml29623 #define CABLE_DIAG_RES 0x11 3576f45ec7bSml29623 #define CABLE_DIAG_LEN_CH_2_1 0x12 3586f45ec7bSml29623 #define CABLE_DIAG_LEN_CH_4_3 0x13 3596f45ec7bSml29623 3606f45ec7bSml29623 /* 3616f45ec7bSml29623 * MII Register 24: Auxiliary Control Register 3626f45ec7bSml29623 */ 3636f45ec7bSml29623 typedef union _mii_aux_ctl_t { 3646f45ec7bSml29623 uint16_t value; 3656f45ec7bSml29623 struct { 3666f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 3676f45ec7bSml29623 uint16_t ext_lb : 1; 3686f45ec7bSml29623 uint16_t ext_pkt_len : 1; 3696f45ec7bSml29623 uint16_t edge_rate_ctl_1000 : 2; 3706f45ec7bSml29623 uint16_t res : 1; 3716f45ec7bSml29623 uint16_t write_1 : 1; 3726f45ec7bSml29623 uint16_t res1 : 2; 3736f45ec7bSml29623 uint16_t dis_partial_resp : 1; 3746f45ec7bSml29623 uint16_t res2 : 1; 3756f45ec7bSml29623 uint16_t edge_rate_ctl_100 : 2; 3766f45ec7bSml29623 uint16_t diag_mode : 1; 3776f45ec7bSml29623 uint16_t shadow_reg_sel : 3; 3786f45ec7bSml29623 #else 3796f45ec7bSml29623 uint16_t shadow_reg_sel : 3; 3806f45ec7bSml29623 uint16_t diag_mode : 1; 3816f45ec7bSml29623 uint16_t edge_rate_ctl_100 : 2; 3826f45ec7bSml29623 uint16_t res2 : 1; 3836f45ec7bSml29623 uint16_t dis_partial_resp : 1; 3846f45ec7bSml29623 uint16_t res1 : 2; 3856f45ec7bSml29623 uint16_t write_1 : 1; 3866f45ec7bSml29623 uint16_t res : 1; 3876f45ec7bSml29623 uint16_t edge_rate_ctl_1000 : 2; 3886f45ec7bSml29623 uint16_t ext_pkt_len : 1; 3896f45ec7bSml29623 uint16_t ext_lb : 1; 3906f45ec7bSml29623 #endif 3916f45ec7bSml29623 } bits; 3926f45ec7bSml29623 } mii_aux_ctl_t, *p_mii_aux_ctl_t; 3936f45ec7bSml29623 3946f45ec7bSml29623 #define AUX_REG 0x0 3956f45ec7bSml29623 #define AUX_10BASET 0x1 3966f45ec7bSml29623 #define AUX_PWR_CTL 0x2 3976f45ec7bSml29623 #define AUX_MISC_TEST 0x4 3986f45ec7bSml29623 #define AUX_MISC_CTL 0x7 3996f45ec7bSml29623 4006f45ec7bSml29623 /* 4016f45ec7bSml29623 * MII Register 25: Auxiliary Status Summary Register 4026f45ec7bSml29623 */ 4036f45ec7bSml29623 typedef union _mii_aux_s_t { 4046f45ec7bSml29623 uint16_t value; 4056f45ec7bSml29623 struct { 4066f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 4076f45ec7bSml29623 uint16_t an_complete : 1; 4086f45ec7bSml29623 uint16_t an_complete_ack : 1; 4096f45ec7bSml29623 uint16_t an_ack_detect : 1; 4106f45ec7bSml29623 uint16_t an_ability_detect : 1; 4116f45ec7bSml29623 uint16_t an_np_wait : 1; 4126f45ec7bSml29623 uint16_t an_hcd : 3; 4136f45ec7bSml29623 uint16_t pd_fault : 1; 4146f45ec7bSml29623 uint16_t rmt_fault : 1; 4156f45ec7bSml29623 uint16_t an_page_rx : 1; 4166f45ec7bSml29623 uint16_t lp_an_ability : 1; 4176f45ec7bSml29623 uint16_t lp_np_ability : 1; 4186f45ec7bSml29623 uint16_t link_s : 1; 4196f45ec7bSml29623 uint16_t pause_res_rx_dir : 1; 4206f45ec7bSml29623 uint16_t pause_res_tx_dir : 1; 4216f45ec7bSml29623 #else 4226f45ec7bSml29623 uint16_t pause_res_tx_dir : 1; 4236f45ec7bSml29623 uint16_t pause_res_rx_dir : 1; 4246f45ec7bSml29623 uint16_t link_s : 1; 4256f45ec7bSml29623 uint16_t lp_np_ability : 1; 4266f45ec7bSml29623 uint16_t lp_an_ability : 1; 4276f45ec7bSml29623 uint16_t an_page_rx : 1; 4286f45ec7bSml29623 uint16_t rmt_fault : 1; 4296f45ec7bSml29623 uint16_t pd_fault : 1; 4306f45ec7bSml29623 uint16_t an_hcd : 3; 4316f45ec7bSml29623 uint16_t an_np_wait : 1; 4326f45ec7bSml29623 uint16_t an_ability_detect : 1; 4336f45ec7bSml29623 uint16_t an_ack_detect : 1; 4346f45ec7bSml29623 uint16_t an_complete_ack : 1; 4356f45ec7bSml29623 uint16_t an_complete : 1; 4366f45ec7bSml29623 #endif 4376f45ec7bSml29623 } bits; 4386f45ec7bSml29623 } mii_aux_s_t, *p_mii_aux_s_t; 4396f45ec7bSml29623 4406f45ec7bSml29623 /* 4416f45ec7bSml29623 * MII Register 26, 27: Interrupt Status and Mask Registers 4426f45ec7bSml29623 */ 4436f45ec7bSml29623 typedef union _mii_intr_t { 4446f45ec7bSml29623 uint16_t value; 4456f45ec7bSml29623 struct { 4466f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 4476f45ec7bSml29623 uint16_t res : 1; 4486f45ec7bSml29623 uint16_t illegal_pair_swap : 1; 4496f45ec7bSml29623 uint16_t mdix_status_change : 1; 4506f45ec7bSml29623 uint16_t exceed_hicnt_thres : 1; 4516f45ec7bSml29623 uint16_t exceed_locnt_thres : 1; 4526f45ec7bSml29623 uint16_t an_page_rx : 1; 4536f45ec7bSml29623 uint16_t hcd_nolink : 1; 4546f45ec7bSml29623 uint16_t no_hcd : 1; 4556f45ec7bSml29623 uint16_t neg_unsupported_hcd : 1; 4566f45ec7bSml29623 uint16_t scr_sync_err : 1; 4576f45ec7bSml29623 uint16_t rmt_rx_status_change : 1; 4586f45ec7bSml29623 uint16_t loc_rx_status_change : 1; 4596f45ec7bSml29623 uint16_t duplex_mode_change : 1; 4606f45ec7bSml29623 uint16_t link_speed_change : 1; 4616f45ec7bSml29623 uint16_t link_status_change : 1; 4626f45ec7bSml29623 uint16_t crc_err : 1; 4636f45ec7bSml29623 #else 4646f45ec7bSml29623 uint16_t crc_err : 1; 4656f45ec7bSml29623 uint16_t link_status_change : 1; 4666f45ec7bSml29623 uint16_t link_speed_change : 1; 4676f45ec7bSml29623 uint16_t duplex_mode_change : 1; 4686f45ec7bSml29623 uint16_t loc_rx_status_change : 1; 4696f45ec7bSml29623 uint16_t rmt_rx_status_change : 1; 4706f45ec7bSml29623 uint16_t scr_sync_err : 1; 4716f45ec7bSml29623 uint16_t neg_unsupported_hcd : 1; 4726f45ec7bSml29623 uint16_t no_hcd : 1; 4736f45ec7bSml29623 uint16_t hcd_nolink : 1; 4746f45ec7bSml29623 uint16_t an_page_rx : 1; 4756f45ec7bSml29623 uint16_t exceed_locnt_thres : 1; 4766f45ec7bSml29623 uint16_t exceed_hicnt_thres : 1; 4776f45ec7bSml29623 uint16_t mdix_status_change : 1; 4786f45ec7bSml29623 uint16_t illegal_pair_swap : 1; 4796f45ec7bSml29623 uint16_t res : 1; 4806f45ec7bSml29623 #endif 4816f45ec7bSml29623 } bits; 4826f45ec7bSml29623 } mii_intr_t, *p_mii_intr_t; 4836f45ec7bSml29623 4846f45ec7bSml29623 /* 4856f45ec7bSml29623 * MII Register 28: Register 1C Access Register 4866f45ec7bSml29623 */ 4876f45ec7bSml29623 typedef union _mii_misc_t { 4886f45ec7bSml29623 uint16_t value; 4896f45ec7bSml29623 struct { 4906f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 4916f45ec7bSml29623 uint16_t w_en : 1; 4926f45ec7bSml29623 uint16_t shadow_reg_sel : 5; 4936f45ec7bSml29623 uint16_t data : 10; 4946f45ec7bSml29623 #else 4956f45ec7bSml29623 uint16_t data : 10; 4966f45ec7bSml29623 uint16_t shadow_reg_sel : 5; 4976f45ec7bSml29623 uint16_t w_en : 1; 4986f45ec7bSml29623 #endif 4996f45ec7bSml29623 } bits; 5006f45ec7bSml29623 } mii_misc_t, *p_mii_misc_t; 5016f45ec7bSml29623 5026f45ec7bSml29623 #define LINK_LED_MODE 0x2 5036f45ec7bSml29623 #define CLK_ALIGN_CTL 0x3 5046f45ec7bSml29623 #define WIRE_SP_RETRY 0x4 5056f45ec7bSml29623 #define CLK125 0x5 5066f45ec7bSml29623 #define LED_STATUS 0x8 5076f45ec7bSml29623 #define LED_CONTROL 0x9 5086f45ec7bSml29623 #define AUTO_PWR_DOWN 0xA 5096f45ec7bSml29623 #define LED_SEL1 0xD 5106f45ec7bSml29623 #define LED_SEL2 0xE 5116f45ec7bSml29623 5126f45ec7bSml29623 /* 5136f45ec7bSml29623 * MII Register 29: Master/Slave Seed / HCD Status Register 5146f45ec7bSml29623 */ 5156f45ec7bSml29623 5166f45ec7bSml29623 typedef union _mii_misc1_t { 5176f45ec7bSml29623 uint16_t value; 5186f45ec7bSml29623 struct { 5196f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 5206f45ec7bSml29623 uint16_t en_shadow_reg : 1; 5216f45ec7bSml29623 uint16_t data : 15; 5226f45ec7bSml29623 #else 5236f45ec7bSml29623 uint16_t data : 15; 5246f45ec7bSml29623 uint16_t en_shadow_reg : 1; 5256f45ec7bSml29623 #endif 5266f45ec7bSml29623 } bits; 5276f45ec7bSml29623 } mii_misc1_t, *p_mii_misc1_t; 5286f45ec7bSml29623 5296f45ec7bSml29623 /* 5306f45ec7bSml29623 * MII Register 30: Test Register 1 5316f45ec7bSml29623 */ 5326f45ec7bSml29623 5336f45ec7bSml29623 typedef union _mii_test1_t { 5346f45ec7bSml29623 uint16_t value; 5356f45ec7bSml29623 struct { 5366f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 5376f45ec7bSml29623 uint16_t crc_err_cnt_sel : 1; 5386f45ec7bSml29623 uint16_t res : 7; 5396f45ec7bSml29623 uint16_t manual_swap_mdi_st : 1; 5406f45ec7bSml29623 uint16_t res1 : 7; 5416f45ec7bSml29623 #else 5426f45ec7bSml29623 uint16_t res1 : 7; 5436f45ec7bSml29623 uint16_t manual_swap_mdi_st : 1; 5446f45ec7bSml29623 uint16_t res : 7; 5456f45ec7bSml29623 uint16_t crc_err_cnt_sel : 1; 5466f45ec7bSml29623 #endif 5476f45ec7bSml29623 } bits; 5486f45ec7bSml29623 } mii_test1_t, *p_mii_test1_t; 5496f45ec7bSml29623 5506f45ec7bSml29623 5516f45ec7bSml29623 /* Definitions of BCM8704 */ 5526f45ec7bSml29623 5536f45ec7bSml29623 #define BCM8704_PMD_CONTROL_REG 0 5546f45ec7bSml29623 #define BCM8704_PMD_STATUS_REG 0x1 5556f45ec7bSml29623 #define BCM8704_PMD_ID_0_REG 0x2 5566f45ec7bSml29623 #define BCM8704_PMD_ID_1_REG 0x3 5576f45ec7bSml29623 #define BCM8704_PMD_SPEED_ABIL_REG 0x4 5586f45ec7bSml29623 #define BCM8704_PMD_DEV_IN_PKG1_REG 0x5 5596f45ec7bSml29623 #define BCM8704_PMD_DEV_IN_PKG2_REG 0x6 5606f45ec7bSml29623 #define BCM8704_PMD_CONTROL2_REG 0x7 5616f45ec7bSml29623 #define BCM8704_PMD_STATUS2_REG 0x8 5626f45ec7bSml29623 #define BCM8704_PMD_TRANSMIT_DIS_REG 0x9 5636f45ec7bSml29623 #define BCM8704_PMD_RECEIVE_SIG_DETECT 0xa 5646f45ec7bSml29623 #define BCM8704_PMD_ORG_UNIQUE_ID_0_REG 0xe 5656f45ec7bSml29623 #define BCM8704_PMD_ORG_UNIQUE_ID_1_REG 0xf 5666f45ec7bSml29623 #define BCM8704_PCS_CONTROL_REG 0 5676f45ec7bSml29623 #define BCM8704_PCS_STATUS1_REG 0x1 5686f45ec7bSml29623 #define BCM8704_PCS_ID_0_REG 0x2 5696f45ec7bSml29623 #define BCM8704_PCS_ID_1_REG 0x3 5706f45ec7bSml29623 #define BCM8704_PCS_SPEED_ABILITY_REG 0x4 5716f45ec7bSml29623 #define BCM8704_PCS_DEV_IN_PKG1_REG 0x5 5726f45ec7bSml29623 #define BCM8704_PCS_DEV_IN_PKG2_REG 0x6 5736f45ec7bSml29623 #define BCM8704_PCS_CONTROL2_REG 0x7 5746f45ec7bSml29623 #define BCM8704_PCS_STATUS2_REG 0x8 5756f45ec7bSml29623 #define BCM8704_PCS_ORG_UNIQUE_ID_0_REG 0xe 5766f45ec7bSml29623 #define BCM8704_PCS_ORG_UNIQUE_ID_1_REG 0xf 5776f45ec7bSml29623 #define BCM8704_PCS_STATUS_REG 0x18 5786f45ec7bSml29623 #define BCM8704_10GBASE_R_PCS_STATUS_REG 0x20 5796f45ec7bSml29623 #define BCM8704_10GBASE_R_PCS_STATUS2_REG 0x21 5806f45ec7bSml29623 #define BCM8704_PHYXS_CONTROL_REG 0 5816f45ec7bSml29623 #define BCM8704_PHYXS_STATUS_REG 0x1 5826f45ec7bSml29623 #define BCM8704_PHY_ID_0_REG 0x2 5836f45ec7bSml29623 #define BCM8704_PHY_ID_1_REG 0x3 5846f45ec7bSml29623 #define BCM8704_PHYXS_SPEED_ABILITY_REG 0x4 5856f45ec7bSml29623 #define BCM8704_PHYXS_DEV_IN_PKG2_REG 0x5 5866f45ec7bSml29623 #define BCM8704_PHYXS_DEV_IN_PKG1_REG 0x6 5876f45ec7bSml29623 #define BCM8704_PHYXS_STATUS2_REG 0x8 5886f45ec7bSml29623 #define BCM8704_PHYXS_ORG_UNIQUE_ID_0_REG 0xe 5896f45ec7bSml29623 #define BCM8704_PHYXS_ORG_UNIQUE_ID_1_REG 0xf 5906f45ec7bSml29623 #define BCM8704_PHYXS_XGXS_LANE_STATUS_REG 0x18 5916f45ec7bSml29623 #define BCM8704_PHYXS_XGXS_TEST_CONTROL_REG 0x19 5926f45ec7bSml29623 #define BCM8704_USER_CONTROL_REG 0xC800 5936f45ec7bSml29623 #define BCM8704_USER_ANALOG_CLK_REG 0xC801 5946f45ec7bSml29623 #define BCM8704_USER_PMD_RX_CONTROL_REG 0xC802 5956f45ec7bSml29623 #define BCM8704_USER_PMD_TX_CONTROL_REG 0xC803 5966f45ec7bSml29623 #define BCM8704_USER_ANALOG_STATUS0_REG 0xC804 5972d17280bSsbehera #define BCM8704_CHIP_ID_REG 0xC807 5986f45ec7bSml29623 #define BCM8704_USER_OPTICS_DIGITAL_CTRL_REG 0xC808 5996f45ec7bSml29623 #define BCM8704_USER_RX2_CONTROL1_REG 0x80C6 6006f45ec7bSml29623 #define BCM8704_USER_RX1_CONTROL1_REG 0x80D6 6016f45ec7bSml29623 #define BCM8704_USER_RX0_CONTROL1_REG 0x80E6 6026f45ec7bSml29623 #define BCM8704_USER_TX_ALARM_STATUS_REG 0x9004 6036f45ec7bSml29623 6046f45ec7bSml29623 /* Rx Channel Control1 Register bits */ 6056f45ec7bSml29623 #define BCM8704_RXPOL_FLIP 0x20 6066f45ec7bSml29623 6076f45ec7bSml29623 typedef union _phyxs_control { 6086f45ec7bSml29623 uint16_t value; 6096f45ec7bSml29623 struct { 6106f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 6116f45ec7bSml29623 uint16_t reset : 1; 6126f45ec7bSml29623 uint16_t loopback : 1; 6136f45ec7bSml29623 uint16_t speed_sel2 : 1; 6146f45ec7bSml29623 uint16_t res2 : 1; 6156f45ec7bSml29623 uint16_t low_power : 1; 6166f45ec7bSml29623 uint16_t res1 : 4; 6176f45ec7bSml29623 uint16_t speed_sel1 : 1; 6186f45ec7bSml29623 uint16_t speed_sel0 : 4; 6196f45ec7bSml29623 uint16_t res0 : 2; 6206f45ec7bSml29623 #else 6216f45ec7bSml29623 uint16_t res0 : 2; 6226f45ec7bSml29623 uint16_t speed_sel0 : 4; 6236f45ec7bSml29623 uint16_t speed_sel1 : 1; 6246f45ec7bSml29623 uint16_t res1 : 4; 6256f45ec7bSml29623 uint16_t low_power : 1; 6266f45ec7bSml29623 uint16_t res2 : 1; 6276f45ec7bSml29623 uint16_t speed_sel2 : 1; 6286f45ec7bSml29623 uint16_t loopback : 1; 6296f45ec7bSml29623 uint16_t reset : 1; 6306f45ec7bSml29623 #endif 6316f45ec7bSml29623 } bits; 6326f45ec7bSml29623 } phyxs_control_t, *p_phyxs_control_t, pcs_control_t, *p_pcs_control_t; 6336f45ec7bSml29623 6346f45ec7bSml29623 6356f45ec7bSml29623 /* PMD/Optics Digital Control Register (Dev=3 Addr=0xc800) */ 6366f45ec7bSml29623 6376f45ec7bSml29623 typedef union _control { 6386f45ec7bSml29623 uint16_t value; 6396f45ec7bSml29623 struct { 6406f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 6416f45ec7bSml29623 uint16_t optxenb_lvl : 1; 6426f45ec7bSml29623 uint16_t optxrst_lvl : 1; 6436f45ec7bSml29623 uint16_t opbiasflt_lvl : 1; 6446f45ec7bSml29623 uint16_t obtmpflt_lvl : 1; 6456f45ec7bSml29623 uint16_t opprflt_lvl : 1; 6466f45ec7bSml29623 uint16_t optxflt_lvl : 1; 6476f45ec7bSml29623 uint16_t optrxlos_lvl : 1; 6486f45ec7bSml29623 uint16_t oprxflt_lvl : 1; 6496f45ec7bSml29623 uint16_t optxon_lvl : 1; 6506f45ec7bSml29623 uint16_t res1 : 7; 6516f45ec7bSml29623 #else 6526f45ec7bSml29623 uint16_t res1 : 7; 6536f45ec7bSml29623 uint16_t optxon_lvl : 1; 6546f45ec7bSml29623 uint16_t oprxflt_lvl : 1; 6556f45ec7bSml29623 uint16_t optrxlos_lvl : 1; 6566f45ec7bSml29623 uint16_t optxflt_lvl : 1; 6576f45ec7bSml29623 uint16_t opprflt_lvl : 1; 6586f45ec7bSml29623 uint16_t obtmpflt_lvl : 1; 6596f45ec7bSml29623 uint16_t opbiasflt_lvl : 1; 6606f45ec7bSml29623 uint16_t optxrst_lvl : 1; 6616f45ec7bSml29623 uint16_t optxenb_lvl : 1; 6626f45ec7bSml29623 #endif 6636f45ec7bSml29623 } bits; 6646f45ec7bSml29623 } control_t, *p_control_t; 6656f45ec7bSml29623 6666f45ec7bSml29623 typedef union _pmd_tx_control { 6676f45ec7bSml29623 uint16_t value; 6686f45ec7bSml29623 struct { 6696f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 6706f45ec7bSml29623 uint16_t res1 : 7; 6716f45ec7bSml29623 uint16_t xfp_clken : 1; 6726f45ec7bSml29623 uint16_t tx_dac_txd : 2; 6736f45ec7bSml29623 uint16_t tx_dac_txck : 2; 6746f45ec7bSml29623 uint16_t tsd_lpwren : 1; 6756f45ec7bSml29623 uint16_t tsck_lpwren : 1; 6766f45ec7bSml29623 uint16_t cmu_lpwren : 1; 6776f45ec7bSml29623 uint16_t sfiforst : 1; 6786f45ec7bSml29623 #else 6796f45ec7bSml29623 uint16_t sfiforst : 1; 6806f45ec7bSml29623 uint16_t cmu_lpwren : 1; 6816f45ec7bSml29623 uint16_t tsck_lpwren : 1; 6826f45ec7bSml29623 uint16_t tsd_lpwren : 1; 6836f45ec7bSml29623 uint16_t tx_dac_txck : 2; 6846f45ec7bSml29623 uint16_t tx_dac_txd : 2; 6856f45ec7bSml29623 uint16_t xfp_clken : 1; 6866f45ec7bSml29623 uint16_t res1 : 7; 6876f45ec7bSml29623 #endif 6886f45ec7bSml29623 } bits; 6896f45ec7bSml29623 } pmd_tx_control_t, *p_pmd_tx_control_t; 6906f45ec7bSml29623 6916f45ec7bSml29623 6926f45ec7bSml29623 /* PMD/Optics Digital Control Register (Dev=3 Addr=0xc808) */ 6936f45ec7bSml29623 6946f45ec7bSml29623 typedef union _optics_dcntr { 6956f45ec7bSml29623 uint16_t value; 6966f45ec7bSml29623 struct { 6976f45ec7bSml29623 #ifdef _BIT_FIELDS_HTOL 6986f45ec7bSml29623 uint16_t fault_mode : 1; 6996f45ec7bSml29623 uint16_t tx_pwrdown : 1; 7006f45ec7bSml29623 uint16_t rx_pwrdown : 1; 7016f45ec7bSml29623 uint16_t ext_flt_en : 1; 7026f45ec7bSml29623 uint16_t opt_rst : 1; 7036f45ec7bSml29623 uint16_t pcs_tx_inv_b : 1; 7046f45ec7bSml29623 uint16_t pcs_rx_inv : 1; 7056f45ec7bSml29623 uint16_t res3 : 2; 7066f45ec7bSml29623 uint16_t gpio_sel : 2; 7076f45ec7bSml29623 uint16_t res2 : 1; 7086f45ec7bSml29623 uint16_t lpbk_err_dis : 1; 7096f45ec7bSml29623 uint16_t res1 : 2; 7106f45ec7bSml29623 uint16_t txonoff_pwdwn_dis : 1; 7116f45ec7bSml29623 #else 7126f45ec7bSml29623 uint16_t txonoff_pwdwn_dis : 1; 7136f45ec7bSml29623 uint16_t res1 : 2; 7146f45ec7bSml29623 uint16_t lpbk_err_dis : 1; 7156f45ec7bSml29623 uint16_t res2 : 1; 7166f45ec7bSml29623 uint16_t gpio_sel : 2; 7176f45ec7bSml29623 uint16_t res3 : 2; 7186f45ec7bSml29623 uint16_t pcs_rx_inv : 1; 7196f45ec7bSml29623 uint16_t pcs_tx_inv_b : 1; 7206f45ec7bSml29623 uint16_t opt_rst : 1; 7216f45ec7bSml29623 uint16_t ext_flt_en : 1; 7226f45ec7bSml29623 uint16_t rx_pwrdown : 1; 7236f45ec7bSml29623 uint16_t tx_pwrdown : 1; 7246f45ec7bSml29623 uint16_t fault_mode : 1; 7256f45ec7bSml29623 #endif 7266f45ec7bSml29623 } bits; 7276f45ec7bSml29623 } optics_dcntr_t, *p_optics_dcntr_t; 7286f45ec7bSml29623 7296f45ec7bSml29623 /* PMD Receive Signal Detect Register (Dev = 1 Register Address = 0x000A) */ 7306f45ec7bSml29623 7316f45ec7bSml29623 #define PMD_RX_SIG_DET3 0x10 7326f45ec7bSml29623 #define PMD_RX_SIG_DET2 0x08 7336f45ec7bSml29623 #define PMD_RX_SIG_DET1 0x04 7346f45ec7bSml29623 #define PMD_RX_SIG_DET0 0x02 7356f45ec7bSml29623 #define GLOB_PMD_RX_SIG_OK 0x01 7366f45ec7bSml29623 7376f45ec7bSml29623 /* 10GBase-R PCS Status Register (Dev = 3, Register Address = 0x0020) */ 7386f45ec7bSml29623 7396f45ec7bSml29623 #define PCS_10GBASE_RX_LINK_STATUS 0x1000 7406f45ec7bSml29623 #define PCS_PRBS31_ABLE 0x0004 7416f45ec7bSml29623 #define PCS_10GBASE_R_HI_BER 0x0002 7426f45ec7bSml29623 #define PCS_10GBASE_R_PCS_BLK_LOCK 0x0001 7436f45ec7bSml29623 7446f45ec7bSml29623 /* XGXS Lane Status Register (Dev = 4, Register Address = 0x0018) */ 7456f45ec7bSml29623 7466f45ec7bSml29623 #define XGXS_LANE_ALIGN_STATUS 0x1000 7476f45ec7bSml29623 #define XGXS_PATTERN_TEST_ABILITY 0x0800 7486f45ec7bSml29623 #define XGXS_LANE3_SYNC 0x0008 7496f45ec7bSml29623 #define XGXS_LANE2_SYNC 0x0004 7506f45ec7bSml29623 #define XGXS_LANE1_SYNC 0x0002 7516f45ec7bSml29623 #define XGXS_LANE0_SYNC 0x0001 75252cdd236Ssbehera #define XGXS_LANE_STAT_MAGIC 0x0400 7536f45ec7bSml29623 75400161856Syc148097 75500161856Syc148097 /* Teranetics TN1010 Definitions */ 75600161856Syc148097 75700161856Syc148097 /* Teranetics TN1010 PHY MMD Addresses */ 75800161856Syc148097 #define TN1010_PMA_PMD_DEV_ADDR 1 75900161856Syc148097 #define TN1010_PCS_DEV_ADDR 3 76000161856Syc148097 #define TN1010_PHYXS_DEV_ADDR 4 76100161856Syc148097 #define TN1010_AUTONEG_DEV_ADDR 7 76200161856Syc148097 #define TN1010_VENDOR_MMD1_DEV_ADDR 30 76300161856Syc148097 76400161856Syc148097 /* TN1010 PCS Control Register */ 76500161856Syc148097 typedef union _tn1010_pcs_ctrl { 76600161856Syc148097 uint16_t value; 76700161856Syc148097 struct { 76800161856Syc148097 #ifdef _BIT_FIELDS_HTOL 76900161856Syc148097 uint16_t reset : 1; /* bit 15 */ 77000161856Syc148097 uint16_t loopback : 1; /* bit 14 */ 77100161856Syc148097 uint16_t speed_sel2 : 1; 77200161856Syc148097 uint16_t res2 : 1; 77300161856Syc148097 uint16_t low_power : 1; 77400161856Syc148097 uint16_t res1 : 4; 77500161856Syc148097 uint16_t speed_sel1 : 1; /* bit 6 */ 77600161856Syc148097 uint16_t speed_sel0 : 4; /* bits[5:2] */ 77700161856Syc148097 uint16_t res0 : 2; 77800161856Syc148097 #else 77900161856Syc148097 uint16_t res0 : 2; 78000161856Syc148097 uint16_t speed_sel0 : 4; /* bits[5:2] */ 78100161856Syc148097 uint16_t speed_sel1 : 1; /* bit 6 */ 78200161856Syc148097 uint16_t res1 : 4; 78300161856Syc148097 uint16_t low_power : 1; 78400161856Syc148097 uint16_t res2 : 1; 78500161856Syc148097 uint16_t speed_sel2 : 1; 78600161856Syc148097 uint16_t loopback : 1; /* bit 14 */ 78700161856Syc148097 uint16_t reset : 1; /* bit 15 */ 78800161856Syc148097 #endif 78900161856Syc148097 } bits; 79000161856Syc148097 } tn1010_phyxs_ctrl_t, *p_tn1010_phyxs_ctrl_t; 79100161856Syc148097 79200161856Syc148097 /* TN1010 PHY XS Control Register */ 79300161856Syc148097 typedef union _tn1010_phyxs_ctrl { 79400161856Syc148097 uint16_t value; 79500161856Syc148097 struct { 79600161856Syc148097 #ifdef _BIT_FIELDS_HTOL 79700161856Syc148097 uint16_t reset : 1; /* bit 15 */ 79800161856Syc148097 uint16_t loopback : 1; /* bit 14 */ 79900161856Syc148097 uint16_t speed_sel2 : 1; 80000161856Syc148097 uint16_t res2 : 1; 80100161856Syc148097 uint16_t low_power : 1; 80200161856Syc148097 uint16_t res1 : 4; 80300161856Syc148097 uint16_t speed_sel1 : 1; /* bit 6 */ 80400161856Syc148097 uint16_t speed_sel0 : 4; /* bits[5:2] */ 80500161856Syc148097 uint16_t res0 : 2; 80600161856Syc148097 #else 80700161856Syc148097 uint16_t res0 : 2; 80800161856Syc148097 uint16_t speed_sel0 : 4; /* bits[5:2] */ 80900161856Syc148097 uint16_t speed_sel1 : 1; /* bit 6 */ 81000161856Syc148097 uint16_t res1 : 4; 81100161856Syc148097 uint16_t low_power : 1; 81200161856Syc148097 uint16_t res2 : 1; 81300161856Syc148097 uint16_t speed_sel2 : 1; 81400161856Syc148097 uint16_t loopback : 1; /* bit 14 */ 81500161856Syc148097 uint16_t reset : 1; /* bit 15 */ 81600161856Syc148097 #endif 81700161856Syc148097 } bits; 81800161856Syc148097 } tn1010_pcs_ctrl_t, *p_tn1010_pcs_ctrl_t; 81900161856Syc148097 82000161856Syc148097 /* TN1010 VENDOR MMD1 GPHY Control register 30.310 */ 82100161856Syc148097 #define TN1010_SGMII_LOOPBACK 1 82200161856Syc148097 #define TN1010_DEEP_LOOPBACK 2 82300161856Syc148097 82400161856Syc148097 #define TN1010_PMD_CONTROL_REG 0 82500161856Syc148097 #define TN1010_PMD_STATUS_REG 1 82600161856Syc148097 #define TN1010_PMD_ID_HIGH_REG 2 82700161856Syc148097 #define TN1010_PMD_ID_LOW_REG 3 82800161856Syc148097 #define TN1010_PMD_SPEED_ABIL_REG 4 82900161856Syc148097 #define TN1010_PMD_DEV_IN_PKG1_REG 5 83000161856Syc148097 #define TN1010_PMD_DEV_IN_PKG2_REG 6 83100161856Syc148097 #define TN1010_PMD_CONTROL2_REG 7 83200161856Syc148097 #define TN1010_PMD_STATUS2_REG 8 83300161856Syc148097 #define TN1010_PMD_TRANSMIT_DIS_REG 9 83400161856Syc148097 #define TN1010_PMD_RECEIVE_SIG_DETECT 10 83500161856Syc148097 #define TN1010_PMD_ORG_UNIQUE_ID_0_REG 14 83600161856Syc148097 #define TN1010_PMD_ORG_UNIQUE_ID_1_REG 15 83700161856Syc148097 #define TN1010_PCS_CONTROL_REG 0 83800161856Syc148097 #define TN1010_PCS_STATUS1_REG 1 83900161856Syc148097 #define TN1010_PCS_ID_HIGH_REG 2 84000161856Syc148097 #define TN1010_PCS_ID_LOW_REG 3 84100161856Syc148097 #define TN1010_PCS_SPEED_ABILITY_REG 4 84200161856Syc148097 #define TN1010_PCS_DEV_IN_PKG1_REG 5 84300161856Syc148097 #define TN1010_PCS_DEV_IN_PKG2_REG 6 84400161856Syc148097 #define TN1010_PCS_CONTROL2_REG 7 84500161856Syc148097 #define TN1010_PCS_STATUS2_REG 8 84600161856Syc148097 #define TN1010_PCS_ORG_UNIQUE_ID_0_REG 14 84700161856Syc148097 #define TN1010_PCS_ORG_UNIQUE_ID_1_REG 15 84800161856Syc148097 #define TN1010_PCS_10GBASE_R_T_STATUS1_REG 32 84900161856Syc148097 #define TN1010_PCS_10GBASE_R_T_STATUS2_REG 33 85000161856Syc148097 #define TN1010_PHYXS_CONTROL_REG 0 85100161856Syc148097 #define TN1010_PHYXS_STATUS_REG 1 85200161856Syc148097 #define TN1010_PHY_ID_HIGH_REG 2 85300161856Syc148097 #define TN1010_PHY_ID_LOW_REG 3 85400161856Syc148097 #define TN1010_PHYXS_SPEED_ABILITY_REG 4 85500161856Syc148097 #define TN1010_PHYXS_DEV_IN_PKG2_REG 5 85600161856Syc148097 #define TN1010_PHYXS_DEV_IN_PKG1_REG 6 85700161856Syc148097 #define TN1010_PHYXS_STATUS2_REG 8 85800161856Syc148097 #define TN1010_PHYXS_ORG_UNIQUE_ID_0_REG 14 85900161856Syc148097 #define TN1010_PHYXS_ORG_UNIQUE_ID_1_REG 15 86000161856Syc148097 #define TN1010_PHYXS_XGXS_LANE_STATUS_REG 24 86100161856Syc148097 #define TN1010_PHYXS_XGXS_TEST_CONTROL_REG 25 86200161856Syc148097 86300161856Syc148097 #define TN1010_AUTONEG_CONTROL_REG 0 86400161856Syc148097 #define TN1010_AUTONEG_STATUS_REG 1 86500161856Syc148097 #define TN1010_AUTONEG_ID_HIGH_REG 2 86600161856Syc148097 #define TN1010_AUTONEG_ID_LOW_REG 3 86700161856Syc148097 #define TN1010_AUTONEG_DEV_IN_PKG1_REG 5 86800161856Syc148097 #define TN1010_AUTUNEG_DEV_IN_PKG2_REG 6 86900161856Syc148097 #define TN1010_AUTONEG_ORG_UNIQUE_ID_0_REG 14 87000161856Syc148097 #define TN1010_AUTONEG_ORG_UNIQUE_ID_1_REG 15 87100161856Syc148097 #define TN1010_AUTONEG_ADVERTISE_REG 16 87200161856Syc148097 #define TN1010_AUTONEG_PARTNER_ABILITY_REG 19 87300161856Syc148097 87400161856Syc148097 #define TN1010_VENDOR_MMD1_CONTROL_REG 0 87500161856Syc148097 #define TN1010_VENDOR_MMD1_STATUS_REG 1 87600161856Syc148097 #define TN1010_VENDOR_MMD1_ID_HIGH 2 87700161856Syc148097 #define TN1010_VENDOR_MMD1_ID_LOW 3 87800161856Syc148097 #define TN1010_VENDOR_MMD1_DEV_STATUS_REG 8 87900161856Syc148097 #define TN1010_VENDOR_MMD1_FNS_CONTROL_RER 9 88000161856Syc148097 #define TN1010_VENDOR_MMD1_PKG_ID_0_REG 14 88100161856Syc148097 #define TN1010_VENDOR_MMD1_PKG_ID_1_REG 15 88200161856Syc148097 #define TN1010_VENDOR_MMD1_GPHY_CTRL 310 88300161856Syc148097 88400161856Syc148097 /* Bits definitions of TN1010_AUTONEG_CONTROL_REG */ 88500161856Syc148097 #define TN1010_AN_CTRL_RESET_BIT 0x8000 /* Reset */ 88600161856Syc148097 #define TN1010_AN_CTRL_EN_BIT 0x1000 /* Enable autoneg */ 88700161856Syc148097 #define TN1010_AN_CTRL_RESTART_BIT 0x200 /* Restart autoneg */ 88800161856Syc148097 #define TN1010_AN_LINK_STAT_BIT 0x4 /* Link status */ 88900161856Syc148097 89000161856Syc148097 /* Bits definitions of TN1010_PHYXS_CONTROL_REG */ 89100161856Syc148097 #define TN1010_VENDOR_MMD1_AN_STAT_BITS 0xC0 89200161856Syc148097 89300161856Syc148097 /* 89400161856Syc148097 * Shift right 6 bits so bits[7:6] becomes [1:0]. 89500161856Syc148097 * Bits[7:6] of TN1010_VENDOR_MND1_STATUS_REG are for autoneg status 89600161856Syc148097 * 00 in progress 89700161856Syc148097 * 01 completed 89800161856Syc148097 * 10 reserved 89900161856Syc148097 * 11 failed 90000161856Syc148097 */ 90100161856Syc148097 #define TN1010_VENDOR_MMD1_AN_STAT_SHIFT 6 90200161856Syc148097 90300161856Syc148097 /* Bit 4 of TN1010_VENDOR_MMD1_STATUS_REG is speed. 0: 10G, 1: 1G */ 90400161856Syc148097 #define TN1010_VENDOR_MMD1_AN_SPEED_BIT 0x10 90500161856Syc148097 90600161856Syc148097 /* Shift right 4 bits so bit4 becomes bit0 */ 90700161856Syc148097 #define TN1010_VENDOR_MMD1_AN_SPEED_SHIFT 4 90800161856Syc148097 90989282175SSantwona Behera /* 91089282175SSantwona Behera * Definitions for Netlogic AEL2020 PHY 91189282175SSantwona Behera */ 91289282175SSantwona Behera #define NLP2020_PMA_PMD_ADDR 1 91389282175SSantwona Behera #define NLP2020_PMA_PMD_CTL_REG 0 91489282175SSantwona Behera #define NLP2020_PMA_PMD_PHY_RST 0x8000 91589282175SSantwona Behera 91689282175SSantwona Behera #define NLP2020_PMA_PMD_STAT1_REG 0x0001 91789282175SSantwona Behera #define NLP2020_PMA_PMD_LINK_UP 0x0004 91889282175SSantwona Behera 91989282175SSantwona Behera #define NLP2020_PMA_PMD_RX_SIG_DET_REG 0x000A 92089282175SSantwona Behera #define NLP2020_PMA_PMD_RX_SIG_ON 0x0001 92189282175SSantwona Behera 92289282175SSantwona Behera #define NLP2020_PMA_PMD_STAT2_REG 0x0008 92389282175SSantwona Behera 92489282175SSantwona Behera #define NLP2020_OPT_SET_REG 0xC017 92589282175SSantwona Behera #define NLP2020_RXLOS_ACT_H 0x0020 92689282175SSantwona Behera 92789282175SSantwona Behera #define NLP2020_TX_DRV_CTL1_REG 0xC241 92889282175SSantwona Behera #define NLP2020_TX_DRV_CTL1_PREEMP_EN 0xA000 92989282175SSantwona Behera 93089282175SSantwona Behera #define NLP2020_TX_DRV_CTL2_REG 0xC243 93189282175SSantwona Behera #define NLP2020_TX_DRV_CTL2_EMP_VAL 0xFFD3 93289282175SSantwona Behera 93389282175SSantwona Behera #define NLP2020_UC_CTL_REG 0xD092 93489282175SSantwona Behera #define NLP2020_UC_CTL_STOP 1 93589282175SSantwona Behera #define NLP2020_UC_CTL_START 0 93689282175SSantwona Behera 93789282175SSantwona Behera #define NLP2020_UC_PC_START_REG 0xD080 93889282175SSantwona Behera #define NLP2020_UC_PC_START_VAL 0x100 93989282175SSantwona Behera 94089282175SSantwona Behera #define NLP2020_PHY_PCS_ADDR 3 94189282175SSantwona Behera #define NLP2020_PHY_PCS_STAT1_REG 0x0001 94289282175SSantwona Behera #define NLP2020_PHY_PCS_LINK_UP 0x0004 94389282175SSantwona Behera 94489282175SSantwona Behera #define NLP2020_PHY_PCS_10GBR_STAT1_REG 0x0020 94589282175SSantwona Behera #define NLP2020_PHY_PCS_10GBR_RX_LINK_UP 0x1000 94689282175SSantwona Behera 94789282175SSantwona Behera #define NLP2020_PHY_PCS_STAT2_REG 0x0008 94889282175SSantwona Behera 94989282175SSantwona Behera #define NLP2020_PHY_XS_ADDR 4 95089282175SSantwona Behera #define NLP2020_PHY_XS_STAT1_REG 0x0001 95189282175SSantwona Behera #define NLP2020_PHY_XS_LINK_UP 0x0004 95289282175SSantwona Behera 95389282175SSantwona Behera #define NLP2020_PHY_XS_LN_ST_REG 0x0018 95489282175SSantwona Behera #define NLP2020_PHY_XS_LN_ALIGN_SYNC 0x100f 95589282175SSantwona Behera 95689282175SSantwona Behera #define NLP2020_PHY_XS_STAT2_REG 0x0008 95789282175SSantwona Behera 95889282175SSantwona Behera #define NLP2020_GPIO_ADDR 1 95989282175SSantwona Behera #define NLP2020_GPIO_CTL_REG 0xC108 96089282175SSantwona Behera #define NLP2020_GPIO_STAT_REG 0xC10C 96189282175SSantwona Behera #define NLP2020_GPIO_STAT_MD_SHIFT 0x0004 96289282175SSantwona Behera #define NLP2020_GPIO_STAT_MD_MASK 0x00f0 96389282175SSantwona Behera #define NLP2020_GPIO_PT3_CFG_REG 0xC113 96489282175SSantwona Behera 96589282175SSantwona Behera #define NLP2020_GPIO_ACT 0x0a00 96689282175SSantwona Behera #define NLP2020_GPIO_INACT 0x0b00 96789282175SSantwona Behera 96889282175SSantwona Behera #define NLP2020_I2C_SNOOP_DEV_ADDR 1 96989282175SSantwona Behera #define NLP2020_I2C_SNOOP_ADDR_REG 0xC30A 97089282175SSantwona Behera #define NLP2020_I2C_SNOOP_DATA_REG 0xC30B 97189282175SSantwona Behera #define NLP2020_I2C_SNOOP_STAT_REG 0xC30C 97289282175SSantwona Behera #define NLP2020_XCVR_I2C_ADDR 0x00A0 97389282175SSantwona Behera #define NLP2020_XCVR_I2C_ADDR_SH 0x0008 97489282175SSantwona Behera 97589282175SSantwona Behera /* 97689282175SSantwona Behera * QSFP defines 97789282175SSantwona Behera */ 97889282175SSantwona Behera #define SFPP_COPPER_TWINAX 0x21 97989282175SSantwona Behera #define SFPP_FIBER 0x7 98089282175SSantwona Behera #define QSFP_FIBER 0xC 98189282175SSantwona Behera #define QSFP_COPPER_TWINAX 0x21 98289282175SSantwona Behera 98389282175SSantwona Behera #define QSFP_MSA_CONN_REG 130 98489282175SSantwona Behera #define QSFP_MSA_LPM_REG 93 98589282175SSantwona Behera #define QSFP_MSA_LEN_REG 0x92 98689282175SSantwona Behera #define QSFP_MSA_LPM_HIGH 0x1 98789282175SSantwona Behera 98889282175SSantwona Behera typedef enum { 98989282175SSantwona Behera NXGE_NLP_CONN_FIBER, 99089282175SSantwona Behera NXGE_NLP_CONN_COPPER_LT_7M, 99189282175SSantwona Behera NXGE_NLP_CONN_COPPER_7M_ABOVE 99289282175SSantwona Behera } nxge_nlp_conn_t; 99389282175SSantwona Behera 99489282175SSantwona Behera /* 99589282175SSantwona Behera * struct for PHY addr-value pairs 99689282175SSantwona Behera */ 99789282175SSantwona Behera typedef struct _nxge_nlp_initseq_t { 99889282175SSantwona Behera uint32_t dev_reg; 99989282175SSantwona Behera uint16_t val; 100089282175SSantwona Behera } nxge_nlp_initseq_t, *p_nxge_nlp_initseq_t; 100100161856Syc148097 1002*9d587972SSantwona Behera /* 1003*9d587972SSantwona Behera * struct for PHY dev, register and value triple properties 1004*9d587972SSantwona Behera */ 1005*9d587972SSantwona Behera typedef struct _nxge_phy_mdio_val_t { 1006*9d587972SSantwona Behera uint16_t dev; 1007*9d587972SSantwona Behera uint16_t reg; 1008*9d587972SSantwona Behera uint16_t val; 1009*9d587972SSantwona Behera } nxge_phy_mdio_val_t, *p_nxge_phy_mdio_val_t; 1010*9d587972SSantwona Behera 1011*9d587972SSantwona Behera /* 1012*9d587972SSantwona Behera * struct for PHY register configurable property 1013*9d587972SSantwona Behera */ 1014*9d587972SSantwona Behera typedef struct _nxge_phy_prop_t { 1015*9d587972SSantwona Behera int cnt; 1016*9d587972SSantwona Behera p_nxge_phy_mdio_val_t arr; 1017*9d587972SSantwona Behera } nxge_phy_prop_t, *p_nxge_phy_prop_t; 1018*9d587972SSantwona Behera 10196f45ec7bSml29623 #ifdef __cplusplus 10206f45ec7bSml29623 } 10216f45ec7bSml29623 #endif 10226f45ec7bSml29623 10236f45ec7bSml29623 #endif /* _SYS_NXGE_NXGE_PHY_HW_H */ 1024