xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_phy_hw.h (revision 12452:80e5df69a097)
13859Sml29623 /*
23859Sml29623  * CDDL HEADER START
33859Sml29623  *
43859Sml29623  * The contents of this file are subject to the terms of the
53859Sml29623  * Common Development and Distribution License (the "License").
63859Sml29623  * You may not use this file except in compliance with the License.
73859Sml29623  *
83859Sml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93859Sml29623  * or http://www.opensolaris.org/os/licensing.
103859Sml29623  * See the License for the specific language governing permissions
113859Sml29623  * and limitations under the License.
123859Sml29623  *
133859Sml29623  * When distributing Covered Code, include this CDDL HEADER in each
143859Sml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153859Sml29623  * If applicable, add the following below this CDDL HEADER, with the
163859Sml29623  * fields enclosed by brackets "[]" replaced with your own identifying
173859Sml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
183859Sml29623  *
193859Sml29623  * CDDL HEADER END
203859Sml29623  */
213859Sml29623 /*
2212103SSantwona.Behera@Sun.COM  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
233859Sml29623  */
243859Sml29623 
253859Sml29623 #ifndef	_SYS_NXGE_NXGE_PHY_HW_H
263859Sml29623 #define	_SYS_NXGE_NXGE_PHY_HW_H
273859Sml29623 
283859Sml29623 #ifdef	__cplusplus
293859Sml29623 extern "C" {
303859Sml29623 #endif
313859Sml29623 
323859Sml29623 #include <nxge_defs.h>
333859Sml29623 
346835Syc148097 /*
357801SSantwona.Behera@Sun.COM  * Clause 45 and Clause 22 port/phy addresses 0 through 5 are reserved
367801SSantwona.Behera@Sun.COM  * for on-chip serdes. So here the starting port is 6.
376835Syc148097  */
384732Sdavemq #define	NXGE_MAX_PHY_PORTS		32
397801SSantwona.Behera@Sun.COM #define	NXGE_EXT_PHY_PORT_ST		6
404732Sdavemq 
414732Sdavemq #define	NXGE_PMA_PMD_DEV_ADDR		1
424732Sdavemq #define	NXGE_PCS_DEV_ADDR		3
434732Sdavemq #define	NXGE_DEV_ID_REG_1		2
444732Sdavemq #define	NXGE_DEV_ID_REG_2		3
454732Sdavemq #define	NXGE_PHY_ID_REG_1		2
464732Sdavemq #define	NXGE_PHY_ID_REG_2		3
474732Sdavemq 
485572Ssbehera #define	BCM8704_CHIP_ID			0x8704
495572Ssbehera #define	BCM8706_CHIP_ID			0x8706
506604Ssbehera #define	MRVL88X201X_CHIP_ID		0x5043
5112103SSantwona.Behera@Sun.COM #define	NLP2020_CHIP_ID			0x0211
525572Ssbehera 
534782Ssbehera /*
546835Syc148097  * Description of BCM_PHY_ID_MASK:
554782Ssbehera  * The first nibble (bits 0 through 3) is changed with every revision
564782Ssbehera  * of the silicon. So these bits are masked out to support future revisions
574782Ssbehera  * of the same chip. The third nibble (bits 8 through 11) is changed for
584782Ssbehera  * different chips of the same family. So these bits are masked out to
594782Ssbehera  * support chips of the same family.
604782Ssbehera  */
614782Ssbehera #define	BCM_PHY_ID_MASK			0xfffff0f0
624732Sdavemq #define	BCM8704_DEV_ID			0x206033
634732Sdavemq #define	BCM5464R_PHY_ID			0x2060b1
645572Ssbehera #define	BCM8706_DEV_ID			0x206035
656261Sjoycey #define	BCM5482_PHY_ID			0x143bcb1
666604Ssbehera #define	MARVELL_88X_201X_DEV_ID		0x1410d24
676604Ssbehera #define	MARVELL_88X201X_PHY_ID	(MARVELL_88X_201X_DEV_ID & BCM_PHY_ID_MASK)
684782Ssbehera #define	PHY_BCM8704_FAMILY		(BCM8704_DEV_ID & BCM_PHY_ID_MASK)
694782Ssbehera #define	PHY_BCM5464R_FAMILY		(BCM5464R_PHY_ID & BCM_PHY_ID_MASK)
706261Sjoycey #define	PHY_BCM5482_FAMILY		(BCM5482_PHY_ID & BCM_PHY_ID_MASK)
716835Syc148097 /*
726835Syc148097  * The default value is 0xa19410, after masking out model and revision
736835Syc148097  * (bits[9:0]) use 0xa19400 for any model or revision of the TN1010
746835Syc148097  */
756835Syc148097 #define	TN1010_DEV_ID			0xa19400
766835Syc148097 /*
776835Syc148097  * Description of TN1010_DEV_ID_MASK:
786835Syc148097  * The device ID assigned to Teranetics is stored in TN1010 register
796835Syc148097  * 1.2 and register 1.3 except bits[9:4] of register 1.3 for model number
806835Syc148097  * and bits[3:0] of register 1.3 for revision numbers. Use mask 0xfffffc00
816835Syc148097  * to mask off model number and revision number and keep TN1010's device
826835Syc148097  * identifier
836835Syc148097  */
846835Syc148097 #define	TN1010_DEV_ID_MASK		0xfffffc00
8512103SSantwona.Behera@Sun.COM /*
8612103SSantwona.Behera@Sun.COM  * The Netlogic device ID and mask:
8712103SSantwona.Behera@Sun.COM  * The device ID assigned to Netlogic is stored in AEL2020 register
8812103SSantwona.Behera@Sun.COM  * 1.2 and register 1.3 except bits[7:4] of register 1.3 have the model number
8912103SSantwona.Behera@Sun.COM  * and bits[3:0] of register 1.3 have the revision number. Use mask 0xffffff00
9012103SSantwona.Behera@Sun.COM  * to mask off model number and revision number and keep AEL2020 device
9112103SSantwona.Behera@Sun.COM  * identifier
9212103SSantwona.Behera@Sun.COM  */
9312103SSantwona.Behera@Sun.COM #define	NLP2020_DEV_ID			0x3429000
9412103SSantwona.Behera@Sun.COM #define	NLP2020_DEV_ID_MASK		0xffffff00
954732Sdavemq 
964732Sdavemq #define	CLAUSE_45_TYPE	1
974732Sdavemq #define	CLAUSE_22_TYPE	2
984732Sdavemq 
996835Syc148097 /* IEEE802.3 Clause45 and Clause22 MDIO port addresses */
1006835Syc148097 #define	NEPTUNE_CLAUSE22_PORT_ADDR_BASE		10
1016835Syc148097 #define	NEPTUNE_CLAUSE45_PORT_ADDR_BASE		8
1026835Syc148097 #define	N2_CLAUSE45_PORT_ADDR_BASE		16
1036604Ssbehera #define	MRVL88X2011_NEPTUNE_PORT_ADDR_BASE	8
1044732Sdavemq 
1054732Sdavemq /*
1065572Ssbehera  * Phy address for the second NIU port on Goa NEM card can be either
1075572Ssbehera  * 20 or 17
1085572Ssbehera  */
1096835Syc148097 #define	GOA_CLAUSE45_PORT_ADDR_BASE		16
1106835Syc148097 #define	ALT_GOA_CLAUSE45_PORT1_ADDR		20
11112103SSantwona.Behera@Sun.COM 
11212103SSantwona.Behera@Sun.COM /*
11312103SSantwona.Behera@Sun.COM  * Phy addresses for AEL2020 used in QSFP for RF systems
11412103SSantwona.Behera@Sun.COM  */
11512103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT0_ADDR0	0x10
11612103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT0_ADDR1	0x12
11712103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT0_ADDR2	0x15
11812103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT0_ADDR3	0x17
11912103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT1_ADDR0	0x11
12012103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT1_ADDR1	0x13
12112103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT1_ADDR2	0x14
12212103SSantwona.Behera@Sun.COM #define	NLP2020_CL45_PORT1_ADDR3	0x16
12312103SSantwona.Behera@Sun.COM 
1245572Ssbehera /*
1254732Sdavemq  * Phy addresses for Maramba support. Support for P0 will eventually
1264732Sdavemq  * be removed.
1274732Sdavemq  */
1286835Syc148097 #define	MARAMBA_P0_CLAUSE22_PORT_ADDR_BASE	10
1296835Syc148097 #define	MARAMBA_P1_CLAUSE22_PORT_ADDR_BASE	26
1306835Syc148097 #define	MARAMBA_CLAUSE45_PORT_ADDR_BASE		16
1314732Sdavemq 
1323859Sml29623 #define	BCM8704_PMA_PMD_DEV_ADDR		1
1333859Sml29623 #define	BCM8704_PCS_DEV_ADDR			3
1343859Sml29623 #define	BCM8704_USER_DEV3_ADDR			3
1353859Sml29623 #define	BCM8704_PHYXS_ADDR			4
1363859Sml29623 #define	BCM8704_USER_DEV4_ADDR			4
1373859Sml29623 
1383859Sml29623 /* Definitions for BCM 5464R PHY chip */
1393859Sml29623 
1403859Sml29623 #define	BCM5464R_PHY_ECR	16
1413859Sml29623 #define	BCM5464R_PHY_ESR	17
1423859Sml29623 #define	BCM5464R_RXERR_CNT	18
1433859Sml29623 #define	BCM5464R_FALSECS_CNT	19
1443859Sml29623 #define	BCM5464R_RX_NOTOK_CNT	20
1453859Sml29623 #define	BCM5464R_ER_DATA	21
1463859Sml29623 #define	BCM5464R_RES		22
1473859Sml29623 #define	BCM5464R_ER_ACC		23
1483859Sml29623 #define	BCM5464R_AUX_CTL	24
1493859Sml29623 #define	BCM5464R_AUX_S		25
1503859Sml29623 #define	BCM5464R_INTR_S		26
1513859Sml29623 #define	BCM5464R_INTR_M		27
1523859Sml29623 #define	BCM5464R_MISC		28
1533859Sml29623 #define	BCM5464R_MISC1		29
1543859Sml29623 #define	BCM5464R_TESTR1		30
1553859Sml29623 
1563859Sml29623 #define	PHY_BCM_5464R_OUI	0x001018
1573859Sml29623 #define	PHY_BCM_5464R_MODEL	0x0B
1583859Sml29623 
1596604Ssbehera /* MARVELL PHY Definitions */
1606604Ssbehera /* REG Offsets */
1616604Ssbehera #define	MRVL_88X2011_USER_DEV1_ADDR	1
1626604Ssbehera #define	MRVL_88X2011_USER_DEV2_ADDR	2
1636604Ssbehera #define	MRVL_88X2011_USER_DEV3_ADDR	3
1646604Ssbehera #define	MRVL_88X2011_USER_DEV4_ADDR	4
1656604Ssbehera #define	MRVL_88X2011_PMA_PMD_CTL_1	0x0000
1666604Ssbehera #define	MRVL_88X2011_PMA_PMD_STAT_1	0x0001
1676604Ssbehera #define	MRVL_88X2011_10G_PMD_STAT_2	0x0008
1686604Ssbehera #define	MRVL_88X2011_10G_PMD_TX_DIS	0x0009
1696604Ssbehera #define	MRVL_88X2011_10G_XGXS_LANE_STAT	0x0018
1706604Ssbehera #define	MRVL_88X2011_GEN_CTL		0x8300
1716604Ssbehera #define	MRVL_88X2011_LED_BLINK_CTL	0x8303
1726604Ssbehera #define	MRVL_88X2011_LED_8_TO_11_CTL	0x8306
1736604Ssbehera 
1746604Ssbehera /* MRVL88X2011 register control */
1756604Ssbehera #define	MRVL_88X2011_ENA_PMDTX		0x0000
1766604Ssbehera #define	MRVL_88X2011_ENA_XFPREFCLK	0x0001
1776604Ssbehera #define	MRVL_88X2011_LOOPBACK		0x1
1786604Ssbehera #define	MRVL_88X2011_LED_ACT		0x1
1796604Ssbehera #define	MRVL_88X2011_LNK_STATUS_OK	0x4
1806604Ssbehera #define	MRVL_88X2011_LED_BLK_MASK	0x70
1816604Ssbehera #define	MRVL_88X2011_LED_BLK_SHIFT	4
1826604Ssbehera #define	MRVL_88X2011_LED_BLK34MS	0x0
1836604Ssbehera #define	MRVL_88X2011_LED_BLK67MS	0x1
1846604Ssbehera #define	MRVL_88X2011_LED_BLK134MS	0x2
1856604Ssbehera #define	MRVL_88X2011_LED_BLK269MS	0x3
1866604Ssbehera #define	MRVL_88X2011_LED_BLK538MS	0x4
1876604Ssbehera #define	MRVL_88X2011_LED_CTL_OFF	0x0
1886604Ssbehera #define	MRVL_88X2011_LED_CTL_PCS_ERR	0x2
1896604Ssbehera #define	MRVL_88X2011_LED_CTL_PCS_ACT	0x5
1906604Ssbehera #define	MRVL_88X2011_LED_CTL_MASK	0x7
1916604Ssbehera #define	MRVL_88X2011_LED(n, v)		((v)<<((n)*4))
1926604Ssbehera #define	MRVL_88X2011_LED_STAT(n, v)	((v)>>((n)*4))
1936604Ssbehera 
1943859Sml29623 /*
1953859Sml29623  * MII Register 16:  PHY Extended Control Register
1963859Sml29623  */
1973859Sml29623 
1983859Sml29623 typedef	union _mii_phy_ecr_t {
1993859Sml29623 	uint16_t value;
2003859Sml29623 	struct {
2013859Sml29623 #ifdef _BIT_FIELDS_HTOL
2023859Sml29623 		uint16_t mac_phy_if_mode	: 1;
2033859Sml29623 		uint16_t dis_automdicross	: 1;
2043859Sml29623 		uint16_t tx_dis			: 1;
2053859Sml29623 		uint16_t intr_dis		: 1;
2063859Sml29623 		uint16_t force_intr		: 1;
2073859Sml29623 		uint16_t bypass_encdec		: 1;
2083859Sml29623 		uint16_t bypass_scrdes		: 1;
2093859Sml29623 		uint16_t bypass_mlt3		: 1;
2103859Sml29623 		uint16_t bypass_rx_sym		: 1;
2113859Sml29623 		uint16_t reset_scr		: 1;
2123859Sml29623 		uint16_t en_led_traffic		: 1;
2133859Sml29623 		uint16_t force_leds_on		: 1;
2143859Sml29623 		uint16_t force_leds_off		: 1;
2153859Sml29623 		uint16_t res			: 2;
2163859Sml29623 		uint16_t gmii_fifo_elas		: 1;
2173859Sml29623 #else
2183859Sml29623 		uint16_t gmii_fifo_elas		: 1;
2193859Sml29623 		uint16_t res			: 2;
2203859Sml29623 		uint16_t force_leds_off		: 1;
2213859Sml29623 		uint16_t force_leds_on		: 1;
2223859Sml29623 		uint16_t en_led_traffic		: 1;
2233859Sml29623 		uint16_t reset_scr		: 1;
2243859Sml29623 		uint16_t bypass_rx_sym		: 1;
2253859Sml29623 		uint16_t bypass_mlt3		: 1;
2263859Sml29623 		uint16_t bypass_scrdes		: 1;
2273859Sml29623 		uint16_t bypass_encdec		: 1;
2283859Sml29623 		uint16_t force_intr		: 1;
2293859Sml29623 		uint16_t intr_dis		: 1;
2303859Sml29623 		uint16_t tx_dis			: 1;
2313859Sml29623 		uint16_t dis_automdicross	: 1;
2323859Sml29623 		uint16_t mac_phy_if_mode	: 1;
2333859Sml29623 #endif
2343859Sml29623 	} bits;
2353859Sml29623 } mii_phy_ecr_t, *p_mii_phy_ecr_t;
2363859Sml29623 
2373859Sml29623 /*
2383859Sml29623  * MII Register 17:  PHY Extended Status Register
2393859Sml29623  */
2403859Sml29623 typedef	union _mii_phy_esr_t {
2413859Sml29623 	uint16_t value;
2423859Sml29623 	struct {
2433859Sml29623 #ifdef _BIT_FIELDS_HTOL
2443859Sml29623 		uint16_t anbpsfm		: 1;
2453859Sml29623 		uint16_t wsdwngr		: 1;
2463859Sml29623 		uint16_t mdi_crst		: 1;
2473859Sml29623 		uint16_t intr_s			: 1;
2483859Sml29623 		uint16_t rmt_rx_s		: 1;
2493859Sml29623 		uint16_t loc_rx_s		: 1;
2503859Sml29623 		uint16_t locked			: 1;
2513859Sml29623 		uint16_t link_s			: 1;
2523859Sml29623 		uint16_t crc_err		: 1;
2533859Sml29623 		uint16_t cext_err		: 1;
2543859Sml29623 		uint16_t bad_ssd		: 1;
2553859Sml29623 		uint16_t bad_esd		: 1;
2563859Sml29623 		uint16_t rx_err			: 1;
2573859Sml29623 		uint16_t tx_err			: 1;
2583859Sml29623 		uint16_t lock_err		: 1;
2593859Sml29623 		uint16_t mlt3_cerr		: 1;
2603859Sml29623 #else
2613859Sml29623 		uint16_t mlt3_cerr		: 1;
2623859Sml29623 		uint16_t lock_err		: 1;
2633859Sml29623 		uint16_t tx_err			: 1;
2643859Sml29623 		uint16_t rx_err			: 1;
2653859Sml29623 		uint16_t bad_esd		: 1;
2663859Sml29623 		uint16_t bad_ssd		: 1;
2673859Sml29623 		uint16_t cext_err		: 1;
2683859Sml29623 		uint16_t crc_err		: 1;
2693859Sml29623 		uint16_t link_s			: 1;
2703859Sml29623 		uint16_t locked			: 1;
2713859Sml29623 		uint16_t loc_rx_s		: 1;
2723859Sml29623 		uint16_t rmt_rx_s		: 1;
2733859Sml29623 		uint16_t intr_s			: 1;
2743859Sml29623 		uint16_t mdi_crst		: 1;
2753859Sml29623 		uint16_t wsdwngr		: 1;
2763859Sml29623 		uint16_t anbpsfm		: 1;
2773859Sml29623 #endif
2783859Sml29623 	} bits;
2793859Sml29623 } mii_phy_esr_t, *p_mii_phy_esr_t;
2803859Sml29623 
2813859Sml29623 /*
2823859Sml29623  * MII Register 18:  Receive Error Counter Register
2833859Sml29623  */
2843859Sml29623 typedef	union _mii_rxerr_cnt_t {
2853859Sml29623 	uint16_t value;
2863859Sml29623 	struct {
2873859Sml29623 		uint16_t rx_err_cnt		: 16;
2883859Sml29623 	} bits;
2893859Sml29623 } mii_rxerr_cnt_t, *p_mii_rxerr_cnt_t;
2903859Sml29623 
2913859Sml29623 /*
2923859Sml29623  * MII Register 19:  False Carrier Sense Counter Register
2933859Sml29623  */
2943859Sml29623 typedef	union _mii_falsecs_cnt_t {
2953859Sml29623 	uint16_t value;
2963859Sml29623 	struct {
2973859Sml29623 #ifdef _BIT_FIELDS_HTOL
2983859Sml29623 		uint16_t res			: 8;
2993859Sml29623 		uint16_t false_cs_cnt		: 8;
3003859Sml29623 #else
3013859Sml29623 		uint16_t false_cs_cnt		: 8;
3023859Sml29623 		uint16_t res			: 8;
3033859Sml29623 #endif
3043859Sml29623 	} bits;
3053859Sml29623 } mii_falsecs_cnt_t, *p_mii_falsecs_cnt_t;
3063859Sml29623 
3073859Sml29623 /*
3083859Sml29623  * MII Register 20:  Receiver NOT_OK Counter Register
3093859Sml29623  */
3103859Sml29623 typedef	union _mii_rx_notok_cnt_t {
3113859Sml29623 	uint16_t value;
3123859Sml29623 	struct {
3133859Sml29623 #ifdef _BIT_FIELDS_HTOL
3143859Sml29623 		uint16_t l_rx_notok_cnt		: 8;
3153859Sml29623 		uint16_t r_rx_notok_cnt		: 8;
3163859Sml29623 #else
3173859Sml29623 		uint16_t r_rx_notok_cnt		: 8;
3183859Sml29623 		uint16_t l_rx_notok_cnt		: 8;
3193859Sml29623 #endif
3203859Sml29623 	} bits;
3213859Sml29623 } mii_rx_notok_cnt_t, *p_mii_rx_notok_t;
3223859Sml29623 
3233859Sml29623 /*
3243859Sml29623  * MII Register 21:  Expansion Register Data Register
3253859Sml29623  */
3263859Sml29623 typedef	union _mii_er_data_t {
3273859Sml29623 	uint16_t value;
3283859Sml29623 	struct {
3293859Sml29623 		uint16_t reg_data;
3303859Sml29623 	} bits;
3313859Sml29623 } mii_er_data_t, *p_mii_er_data_t;
3323859Sml29623 
3333859Sml29623 /*
3343859Sml29623  * MII Register 23:  Expansion Register Access Register
3353859Sml29623  */
3363859Sml29623 typedef	union _mii_er_acc_t {
3373859Sml29623 	struct {
3383859Sml29623 #ifdef _BIT_FIELDS_HTOL
3393859Sml29623 		uint16_t res			: 4;
3403859Sml29623 		uint16_t er_sel			: 4;
3413859Sml29623 		uint16_t er_acc			: 8;
3423859Sml29623 #else
3433859Sml29623 		uint16_t er_acc			: 8;
3443859Sml29623 		uint16_t er_sel			: 4;
3453859Sml29623 		uint16_t res			: 4;
3463859Sml29623 #endif
3473859Sml29623 	} bits;
3483859Sml29623 } mii_er_acc_t, *p_mii_er_acc_t;
3493859Sml29623 
3503859Sml29623 #define	EXP_RXTX_PKT_CNT		0x0
3513859Sml29623 #define	EXP_INTR_STAT			0x1
3523859Sml29623 #define	MULTICOL_LED_SEL		0x4
3533859Sml29623 #define	MULTICOL_LED_FLASH_RATE_CTL	0x5
3543859Sml29623 #define	MULTICOL_LED_BLINK_CTL		0x6
3553859Sml29623 #define	CABLE_DIAG_CTL			0x10
3563859Sml29623 #define	CABLE_DIAG_RES			0x11
3573859Sml29623 #define	CABLE_DIAG_LEN_CH_2_1		0x12
3583859Sml29623 #define	CABLE_DIAG_LEN_CH_4_3		0x13
3593859Sml29623 
3603859Sml29623 /*
3613859Sml29623  * MII Register 24:  Auxiliary Control Register
3623859Sml29623  */
3633859Sml29623 typedef	union _mii_aux_ctl_t {
3643859Sml29623 	uint16_t value;
3653859Sml29623 	struct {
3663859Sml29623 #ifdef _BIT_FIELDS_HTOL
3673859Sml29623 		uint16_t ext_lb			: 1;
3683859Sml29623 		uint16_t ext_pkt_len		: 1;
3693859Sml29623 		uint16_t edge_rate_ctl_1000	: 2;
3703859Sml29623 		uint16_t res			: 1;
3713859Sml29623 		uint16_t write_1		: 1;
3723859Sml29623 		uint16_t res1			: 2;
3733859Sml29623 		uint16_t dis_partial_resp	: 1;
3743859Sml29623 		uint16_t res2			: 1;
3753859Sml29623 		uint16_t edge_rate_ctl_100	: 2;
3763859Sml29623 		uint16_t diag_mode		: 1;
3773859Sml29623 		uint16_t shadow_reg_sel		: 3;
3783859Sml29623 #else
3793859Sml29623 		uint16_t shadow_reg_sel		: 3;
3803859Sml29623 		uint16_t diag_mode		: 1;
3813859Sml29623 		uint16_t edge_rate_ctl_100	: 2;
3823859Sml29623 		uint16_t res2			: 1;
3833859Sml29623 		uint16_t dis_partial_resp	: 1;
3843859Sml29623 		uint16_t res1			: 2;
3853859Sml29623 		uint16_t write_1		: 1;
3863859Sml29623 		uint16_t res			: 1;
3873859Sml29623 		uint16_t edge_rate_ctl_1000	: 2;
3883859Sml29623 		uint16_t ext_pkt_len		: 1;
3893859Sml29623 		uint16_t ext_lb			: 1;
3903859Sml29623 #endif
3913859Sml29623 	} bits;
3923859Sml29623 } mii_aux_ctl_t, *p_mii_aux_ctl_t;
3933859Sml29623 
3943859Sml29623 #define	AUX_REG				0x0
3953859Sml29623 #define	AUX_10BASET			0x1
3963859Sml29623 #define	AUX_PWR_CTL			0x2
3973859Sml29623 #define	AUX_MISC_TEST			0x4
3983859Sml29623 #define	AUX_MISC_CTL			0x7
3993859Sml29623 
4003859Sml29623 /*
4013859Sml29623  * MII Register 25:  Auxiliary Status Summary Register
4023859Sml29623  */
4033859Sml29623 typedef	union _mii_aux_s_t {
4043859Sml29623 	uint16_t value;
4053859Sml29623 	struct {
4063859Sml29623 #ifdef _BIT_FIELDS_HTOL
4073859Sml29623 		uint16_t an_complete		: 1;
4083859Sml29623 		uint16_t an_complete_ack	: 1;
4093859Sml29623 		uint16_t an_ack_detect		: 1;
4103859Sml29623 		uint16_t an_ability_detect	: 1;
4113859Sml29623 		uint16_t an_np_wait		: 1;
4123859Sml29623 		uint16_t an_hcd			: 3;
4133859Sml29623 		uint16_t pd_fault		: 1;
4143859Sml29623 		uint16_t rmt_fault		: 1;
4153859Sml29623 		uint16_t an_page_rx		: 1;
4163859Sml29623 		uint16_t lp_an_ability		: 1;
4173859Sml29623 		uint16_t lp_np_ability		: 1;
4183859Sml29623 		uint16_t link_s			: 1;
4193859Sml29623 		uint16_t pause_res_rx_dir	: 1;
4203859Sml29623 		uint16_t pause_res_tx_dir	: 1;
4213859Sml29623 #else
4223859Sml29623 		uint16_t pause_res_tx_dir	: 1;
4233859Sml29623 		uint16_t pause_res_rx_dir	: 1;
4243859Sml29623 		uint16_t link_s			: 1;
4253859Sml29623 		uint16_t lp_np_ability		: 1;
4263859Sml29623 		uint16_t lp_an_ability		: 1;
4273859Sml29623 		uint16_t an_page_rx		: 1;
4283859Sml29623 		uint16_t rmt_fault		: 1;
4293859Sml29623 		uint16_t pd_fault		: 1;
4303859Sml29623 		uint16_t an_hcd			: 3;
4313859Sml29623 		uint16_t an_np_wait		: 1;
4323859Sml29623 		uint16_t an_ability_detect	: 1;
4333859Sml29623 		uint16_t an_ack_detect		: 1;
4343859Sml29623 		uint16_t an_complete_ack	: 1;
4353859Sml29623 		uint16_t an_complete		: 1;
4363859Sml29623 #endif
4373859Sml29623 	} bits;
4383859Sml29623 } mii_aux_s_t, *p_mii_aux_s_t;
4393859Sml29623 
4403859Sml29623 /*
4413859Sml29623  * MII Register 26, 27:  Interrupt Status and Mask Registers
4423859Sml29623  */
4433859Sml29623 typedef	union _mii_intr_t {
4443859Sml29623 	uint16_t value;
4453859Sml29623 	struct {
4463859Sml29623 #ifdef _BIT_FIELDS_HTOL
4473859Sml29623 		uint16_t res			: 1;
4483859Sml29623 		uint16_t illegal_pair_swap	: 1;
4493859Sml29623 		uint16_t mdix_status_change	: 1;
4503859Sml29623 		uint16_t exceed_hicnt_thres	: 1;
4513859Sml29623 		uint16_t exceed_locnt_thres	: 1;
4523859Sml29623 		uint16_t an_page_rx		: 1;
4533859Sml29623 		uint16_t hcd_nolink		: 1;
4543859Sml29623 		uint16_t no_hcd			: 1;
4553859Sml29623 		uint16_t neg_unsupported_hcd	: 1;
4563859Sml29623 		uint16_t scr_sync_err		: 1;
4573859Sml29623 		uint16_t rmt_rx_status_change	: 1;
4583859Sml29623 		uint16_t loc_rx_status_change	: 1;
4593859Sml29623 		uint16_t duplex_mode_change	: 1;
4603859Sml29623 		uint16_t link_speed_change	: 1;
4613859Sml29623 		uint16_t link_status_change	: 1;
4623859Sml29623 		uint16_t crc_err		: 1;
4633859Sml29623 #else
4643859Sml29623 		uint16_t crc_err		: 1;
4653859Sml29623 		uint16_t link_status_change	: 1;
4663859Sml29623 		uint16_t link_speed_change	: 1;
4673859Sml29623 		uint16_t duplex_mode_change	: 1;
4683859Sml29623 		uint16_t loc_rx_status_change	: 1;
4693859Sml29623 		uint16_t rmt_rx_status_change	: 1;
4703859Sml29623 		uint16_t scr_sync_err		: 1;
4713859Sml29623 		uint16_t neg_unsupported_hcd	: 1;
4723859Sml29623 		uint16_t no_hcd			: 1;
4733859Sml29623 		uint16_t hcd_nolink		: 1;
4743859Sml29623 		uint16_t an_page_rx		: 1;
4753859Sml29623 		uint16_t exceed_locnt_thres	: 1;
4763859Sml29623 		uint16_t exceed_hicnt_thres	: 1;
4773859Sml29623 		uint16_t mdix_status_change	: 1;
4783859Sml29623 		uint16_t illegal_pair_swap	: 1;
4793859Sml29623 		uint16_t res			: 1;
4803859Sml29623 #endif
4813859Sml29623 	} bits;
4823859Sml29623 } mii_intr_t, *p_mii_intr_t;
4833859Sml29623 
4843859Sml29623 /*
4853859Sml29623  * MII Register 28:  Register 1C Access Register
4863859Sml29623  */
4873859Sml29623 typedef	union _mii_misc_t {
4883859Sml29623 	uint16_t value;
4893859Sml29623 	struct {
4903859Sml29623 #ifdef _BIT_FIELDS_HTOL
4913859Sml29623 		uint16_t w_en			: 1;
4923859Sml29623 		uint16_t shadow_reg_sel		: 5;
4933859Sml29623 		uint16_t data			: 10;
4943859Sml29623 #else
4953859Sml29623 		uint16_t data			: 10;
4963859Sml29623 		uint16_t shadow_reg_sel		: 5;
4973859Sml29623 		uint16_t w_en			: 1;
4983859Sml29623 #endif
4993859Sml29623 	} bits;
5003859Sml29623 } mii_misc_t, *p_mii_misc_t;
5013859Sml29623 
5023859Sml29623 #define	LINK_LED_MODE			0x2
5033859Sml29623 #define	CLK_ALIGN_CTL			0x3
5043859Sml29623 #define	WIRE_SP_RETRY			0x4
5053859Sml29623 #define	CLK125				0x5
5063859Sml29623 #define	LED_STATUS			0x8
5073859Sml29623 #define	LED_CONTROL			0x9
5083859Sml29623 #define	AUTO_PWR_DOWN			0xA
5093859Sml29623 #define	LED_SEL1			0xD
5103859Sml29623 #define	LED_SEL2			0xE
5113859Sml29623 
5123859Sml29623 /*
5133859Sml29623  * MII Register 29:  Master/Slave Seed / HCD Status Register
5143859Sml29623  */
5153859Sml29623 
5163859Sml29623 typedef	union _mii_misc1_t {
5173859Sml29623 	uint16_t value;
5183859Sml29623 	struct {
5193859Sml29623 #ifdef _BIT_FIELDS_HTOL
5203859Sml29623 		uint16_t en_shadow_reg		: 1;
5213859Sml29623 		uint16_t data			: 15;
5223859Sml29623 #else
5233859Sml29623 		uint16_t data			: 15;
5243859Sml29623 		uint16_t en_shadow_reg		: 1;
5253859Sml29623 #endif
5263859Sml29623 	} bits;
5273859Sml29623 } mii_misc1_t, *p_mii_misc1_t;
5283859Sml29623 
5293859Sml29623 /*
5303859Sml29623  * MII Register 30:  Test Register 1
5313859Sml29623  */
5323859Sml29623 
5333859Sml29623 typedef	union _mii_test1_t {
5343859Sml29623 	uint16_t value;
5353859Sml29623 	struct {
5363859Sml29623 #ifdef _BIT_FIELDS_HTOL
5373859Sml29623 		uint16_t crc_err_cnt_sel	: 1;
5383859Sml29623 		uint16_t res			: 7;
5393859Sml29623 		uint16_t manual_swap_mdi_st	: 1;
5403859Sml29623 		uint16_t res1			: 7;
5413859Sml29623 #else
5423859Sml29623 		uint16_t res1			: 7;
5433859Sml29623 		uint16_t manual_swap_mdi_st	: 1;
5443859Sml29623 		uint16_t res			: 7;
5453859Sml29623 		uint16_t crc_err_cnt_sel	: 1;
5463859Sml29623 #endif
5473859Sml29623 	} bits;
5483859Sml29623 } mii_test1_t, *p_mii_test1_t;
5493859Sml29623 
5503859Sml29623 
5513859Sml29623 /* Definitions of BCM8704 */
5523859Sml29623 
5533859Sml29623 #define	BCM8704_PMD_CONTROL_REG			0
5543859Sml29623 #define	BCM8704_PMD_STATUS_REG			0x1
5553859Sml29623 #define	BCM8704_PMD_ID_0_REG			0x2
5563859Sml29623 #define	BCM8704_PMD_ID_1_REG			0x3
5573859Sml29623 #define	BCM8704_PMD_SPEED_ABIL_REG		0x4
5583859Sml29623 #define	BCM8704_PMD_DEV_IN_PKG1_REG		0x5
5593859Sml29623 #define	BCM8704_PMD_DEV_IN_PKG2_REG		0x6
5603859Sml29623 #define	BCM8704_PMD_CONTROL2_REG		0x7
5613859Sml29623 #define	BCM8704_PMD_STATUS2_REG			0x8
5623859Sml29623 #define	BCM8704_PMD_TRANSMIT_DIS_REG		0x9
5633859Sml29623 #define	BCM8704_PMD_RECEIVE_SIG_DETECT		0xa
5643859Sml29623 #define	BCM8704_PMD_ORG_UNIQUE_ID_0_REG		0xe
5653859Sml29623 #define	BCM8704_PMD_ORG_UNIQUE_ID_1_REG		0xf
5663859Sml29623 #define	BCM8704_PCS_CONTROL_REG			0
5673859Sml29623 #define	BCM8704_PCS_STATUS1_REG			0x1
5683859Sml29623 #define	BCM8704_PCS_ID_0_REG			0x2
5693859Sml29623 #define	BCM8704_PCS_ID_1_REG			0x3
5703859Sml29623 #define	BCM8704_PCS_SPEED_ABILITY_REG		0x4
5713859Sml29623 #define	BCM8704_PCS_DEV_IN_PKG1_REG		0x5
5723859Sml29623 #define	BCM8704_PCS_DEV_IN_PKG2_REG		0x6
5733859Sml29623 #define	BCM8704_PCS_CONTROL2_REG		0x7
5743859Sml29623 #define	BCM8704_PCS_STATUS2_REG			0x8
5753859Sml29623 #define	BCM8704_PCS_ORG_UNIQUE_ID_0_REG		0xe
5763859Sml29623 #define	BCM8704_PCS_ORG_UNIQUE_ID_1_REG		0xf
5773859Sml29623 #define	BCM8704_PCS_STATUS_REG			0x18
5783859Sml29623 #define	BCM8704_10GBASE_R_PCS_STATUS_REG	0x20
5793859Sml29623 #define	BCM8704_10GBASE_R_PCS_STATUS2_REG	0x21
5803859Sml29623 #define	BCM8704_PHYXS_CONTROL_REG		0
5813859Sml29623 #define	BCM8704_PHYXS_STATUS_REG		0x1
5823859Sml29623 #define	BCM8704_PHY_ID_0_REG			0x2
5833859Sml29623 #define	BCM8704_PHY_ID_1_REG			0x3
5843859Sml29623 #define	BCM8704_PHYXS_SPEED_ABILITY_REG		0x4
5853859Sml29623 #define	BCM8704_PHYXS_DEV_IN_PKG2_REG		0x5
5863859Sml29623 #define	BCM8704_PHYXS_DEV_IN_PKG1_REG		0x6
5873859Sml29623 #define	BCM8704_PHYXS_STATUS2_REG		0x8
5883859Sml29623 #define	BCM8704_PHYXS_ORG_UNIQUE_ID_0_REG	0xe
5893859Sml29623 #define	BCM8704_PHYXS_ORG_UNIQUE_ID_1_REG	0xf
5903859Sml29623 #define	BCM8704_PHYXS_XGXS_LANE_STATUS_REG	0x18
5913859Sml29623 #define	BCM8704_PHYXS_XGXS_TEST_CONTROL_REG	0x19
5923859Sml29623 #define	BCM8704_USER_CONTROL_REG		0xC800
5933859Sml29623 #define	BCM8704_USER_ANALOG_CLK_REG		0xC801
5943859Sml29623 #define	BCM8704_USER_PMD_RX_CONTROL_REG		0xC802
5953859Sml29623 #define	BCM8704_USER_PMD_TX_CONTROL_REG		0xC803
5963859Sml29623 #define	BCM8704_USER_ANALOG_STATUS0_REG		0xC804
5975572Ssbehera #define	BCM8704_CHIP_ID_REG			0xC807
5983859Sml29623 #define	BCM8704_USER_OPTICS_DIGITAL_CTRL_REG	0xC808
5993859Sml29623 #define	BCM8704_USER_RX2_CONTROL1_REG		0x80C6
6003859Sml29623 #define	BCM8704_USER_RX1_CONTROL1_REG		0x80D6
6013859Sml29623 #define	BCM8704_USER_RX0_CONTROL1_REG		0x80E6
6023859Sml29623 #define	BCM8704_USER_TX_ALARM_STATUS_REG	0x9004
6033859Sml29623 
6043859Sml29623 /* Rx Channel Control1 Register bits */
6053859Sml29623 #define	BCM8704_RXPOL_FLIP			0x20
6063859Sml29623 
6073859Sml29623 typedef	union _phyxs_control {
6083859Sml29623 	uint16_t value;
6093859Sml29623 	struct {
6103859Sml29623 #ifdef _BIT_FIELDS_HTOL
6113859Sml29623 		uint16_t reset			: 1;
6123859Sml29623 		uint16_t loopback		: 1;
6133859Sml29623 		uint16_t speed_sel2		: 1;
6143859Sml29623 		uint16_t res2			: 1;
6153859Sml29623 		uint16_t low_power		: 1;
6163859Sml29623 		uint16_t res1			: 4;
6173859Sml29623 		uint16_t speed_sel1		: 1;
6183859Sml29623 		uint16_t speed_sel0		: 4;
6193859Sml29623 		uint16_t res0			: 2;
6203859Sml29623 #else
6213859Sml29623 		uint16_t res0			: 2;
6223859Sml29623 		uint16_t speed_sel0		: 4;
6233859Sml29623 		uint16_t speed_sel1		: 1;
6243859Sml29623 		uint16_t res1			: 4;
6253859Sml29623 		uint16_t low_power		: 1;
6263859Sml29623 		uint16_t res2			: 1;
6273859Sml29623 		uint16_t speed_sel2		: 1;
6283859Sml29623 		uint16_t loopback		: 1;
6293859Sml29623 		uint16_t reset			: 1;
6303859Sml29623 #endif
6313859Sml29623 	} bits;
6323859Sml29623 } phyxs_control_t, *p_phyxs_control_t, pcs_control_t, *p_pcs_control_t;
6333859Sml29623 
6343859Sml29623 
6353859Sml29623 /* PMD/Optics Digital Control Register (Dev=3 Addr=0xc800) */
6363859Sml29623 
6373859Sml29623 typedef	union _control {
6383859Sml29623 	uint16_t value;
6393859Sml29623 	struct {
6403859Sml29623 #ifdef _BIT_FIELDS_HTOL
6413859Sml29623 		uint16_t optxenb_lvl		: 1;
6423859Sml29623 		uint16_t optxrst_lvl		: 1;
6433859Sml29623 		uint16_t opbiasflt_lvl		: 1;
6443859Sml29623 		uint16_t obtmpflt_lvl		: 1;
6453859Sml29623 		uint16_t opprflt_lvl		: 1;
6463859Sml29623 		uint16_t optxflt_lvl		: 1;
6473859Sml29623 		uint16_t optrxlos_lvl		: 1;
6483859Sml29623 		uint16_t oprxflt_lvl		: 1;
6493859Sml29623 		uint16_t optxon_lvl		: 1;
6503859Sml29623 		uint16_t res1			: 7;
6513859Sml29623 #else
6523859Sml29623 		uint16_t res1			: 7;
6533859Sml29623 		uint16_t optxon_lvl		: 1;
6543859Sml29623 		uint16_t oprxflt_lvl		: 1;
6553859Sml29623 		uint16_t optrxlos_lvl		: 1;
6563859Sml29623 		uint16_t optxflt_lvl		: 1;
6573859Sml29623 		uint16_t opprflt_lvl		: 1;
6583859Sml29623 		uint16_t obtmpflt_lvl		: 1;
6593859Sml29623 		uint16_t opbiasflt_lvl		: 1;
6603859Sml29623 		uint16_t optxrst_lvl		: 1;
6613859Sml29623 		uint16_t optxenb_lvl		: 1;
6623859Sml29623 #endif
6633859Sml29623 	} bits;
6643859Sml29623 } control_t, *p_control_t;
6653859Sml29623 
6663859Sml29623 typedef	union _pmd_tx_control {
6673859Sml29623 	uint16_t value;
6683859Sml29623 	struct {
6693859Sml29623 #ifdef _BIT_FIELDS_HTOL
6703859Sml29623 		uint16_t res1			: 7;
6713859Sml29623 		uint16_t xfp_clken		: 1;
6723859Sml29623 		uint16_t tx_dac_txd		: 2;
6733859Sml29623 		uint16_t tx_dac_txck		: 2;
6743859Sml29623 		uint16_t tsd_lpwren		: 1;
6753859Sml29623 		uint16_t tsck_lpwren		: 1;
6763859Sml29623 		uint16_t cmu_lpwren		: 1;
6773859Sml29623 		uint16_t sfiforst		: 1;
6783859Sml29623 #else
6793859Sml29623 		uint16_t sfiforst		: 1;
6803859Sml29623 		uint16_t cmu_lpwren		: 1;
6813859Sml29623 		uint16_t tsck_lpwren		: 1;
6823859Sml29623 		uint16_t tsd_lpwren		: 1;
6833859Sml29623 		uint16_t tx_dac_txck		: 2;
6843859Sml29623 		uint16_t tx_dac_txd		: 2;
6853859Sml29623 		uint16_t xfp_clken		: 1;
6863859Sml29623 		uint16_t res1			: 7;
6873859Sml29623 #endif
6883859Sml29623 	} bits;
6893859Sml29623 } pmd_tx_control_t, *p_pmd_tx_control_t;
6903859Sml29623 
6913859Sml29623 
6923859Sml29623 /* PMD/Optics Digital Control Register (Dev=3 Addr=0xc808) */
6933859Sml29623 
6943859Sml29623 typedef	union _optics_dcntr {
6953859Sml29623 	uint16_t value;
6963859Sml29623 	struct {
6973859Sml29623 #ifdef _BIT_FIELDS_HTOL
6983859Sml29623 		uint16_t fault_mode		: 1;
6993859Sml29623 		uint16_t tx_pwrdown		: 1;
7003859Sml29623 		uint16_t rx_pwrdown		: 1;
7013859Sml29623 		uint16_t ext_flt_en		: 1;
7023859Sml29623 		uint16_t opt_rst		: 1;
7033859Sml29623 		uint16_t pcs_tx_inv_b		: 1;
7043859Sml29623 		uint16_t pcs_rx_inv		: 1;
7053859Sml29623 		uint16_t res3			: 2;
7063859Sml29623 		uint16_t gpio_sel		: 2;
7073859Sml29623 		uint16_t res2			: 1;
7083859Sml29623 		uint16_t lpbk_err_dis		: 1;
7093859Sml29623 		uint16_t res1			: 2;
7103859Sml29623 		uint16_t txonoff_pwdwn_dis	: 1;
7113859Sml29623 #else
7123859Sml29623 		uint16_t txonoff_pwdwn_dis	: 1;
7133859Sml29623 		uint16_t res1			: 2;
7143859Sml29623 		uint16_t lpbk_err_dis		: 1;
7153859Sml29623 		uint16_t res2			: 1;
7163859Sml29623 		uint16_t gpio_sel		: 2;
7173859Sml29623 		uint16_t res3			: 2;
7183859Sml29623 		uint16_t pcs_rx_inv		: 1;
7193859Sml29623 		uint16_t pcs_tx_inv_b		: 1;
7203859Sml29623 		uint16_t opt_rst		: 1;
7213859Sml29623 		uint16_t ext_flt_en		: 1;
7223859Sml29623 		uint16_t rx_pwrdown		: 1;
7233859Sml29623 		uint16_t tx_pwrdown		: 1;
7243859Sml29623 		uint16_t fault_mode		: 1;
7253859Sml29623 #endif
7263859Sml29623 	} bits;
7273859Sml29623 } optics_dcntr_t, *p_optics_dcntr_t;
7283859Sml29623 
7293859Sml29623 /* PMD Receive Signal Detect Register (Dev = 1 Register Address = 0x000A) */
7303859Sml29623 
7313859Sml29623 #define	PMD_RX_SIG_DET3			0x10
7323859Sml29623 #define	PMD_RX_SIG_DET2			0x08
7333859Sml29623 #define	PMD_RX_SIG_DET1			0x04
7343859Sml29623 #define	PMD_RX_SIG_DET0			0x02
7353859Sml29623 #define	GLOB_PMD_RX_SIG_OK		0x01
7363859Sml29623 
7373859Sml29623 /* 10GBase-R PCS Status Register (Dev = 3, Register Address = 0x0020) */
7383859Sml29623 
7393859Sml29623 #define	PCS_10GBASE_RX_LINK_STATUS	0x1000
7403859Sml29623 #define	PCS_PRBS31_ABLE			0x0004
7413859Sml29623 #define	PCS_10GBASE_R_HI_BER		0x0002
7423859Sml29623 #define	PCS_10GBASE_R_PCS_BLK_LOCK	0x0001
7433859Sml29623 
7443859Sml29623 /* XGXS Lane Status Register (Dev = 4, Register Address = 0x0018) */
7453859Sml29623 
7463859Sml29623 #define	XGXS_LANE_ALIGN_STATUS		0x1000
7473859Sml29623 #define	XGXS_PATTERN_TEST_ABILITY	0x0800
7483859Sml29623 #define	XGXS_LANE3_SYNC			0x0008
7493859Sml29623 #define	XGXS_LANE2_SYNC			0x0004
7503859Sml29623 #define	XGXS_LANE1_SYNC			0x0002
7513859Sml29623 #define	XGXS_LANE0_SYNC			0x0001
7526604Ssbehera #define	XGXS_LANE_STAT_MAGIC		0x0400
7533859Sml29623 
7546835Syc148097 
7556835Syc148097 /* Teranetics TN1010 Definitions */
7566835Syc148097 
7576835Syc148097 /* Teranetics TN1010 PHY MMD Addresses */
7586835Syc148097 #define	TN1010_PMA_PMD_DEV_ADDR		1
7596835Syc148097 #define	TN1010_PCS_DEV_ADDR		3
7606835Syc148097 #define	TN1010_PHYXS_DEV_ADDR		4
7616835Syc148097 #define	TN1010_AUTONEG_DEV_ADDR		7
7626835Syc148097 #define	TN1010_VENDOR_MMD1_DEV_ADDR	30
7636835Syc148097 
7646835Syc148097 /* TN1010 PCS Control Register */
7656835Syc148097 typedef union _tn1010_pcs_ctrl {
7666835Syc148097 	uint16_t value;
7676835Syc148097 	struct {
7686835Syc148097 #ifdef _BIT_FIELDS_HTOL
7696835Syc148097 		uint16_t reset			: 1;    /* bit 15 */
7706835Syc148097 		uint16_t loopback		: 1;	/* bit 14 */
7716835Syc148097 		uint16_t speed_sel2		: 1;
7726835Syc148097 		uint16_t res2			: 1;
7736835Syc148097 		uint16_t low_power		: 1;
7746835Syc148097 		uint16_t res1			: 4;
7756835Syc148097 		uint16_t speed_sel1		: 1;    /* bit 6 */
7766835Syc148097 		uint16_t speed_sel0		: 4;    /* bits[5:2] */
7776835Syc148097 		uint16_t res0			: 2;
7786835Syc148097 #else
7796835Syc148097 		uint16_t res0			: 2;
7806835Syc148097 		uint16_t speed_sel0		: 4;    /* bits[5:2] */
7816835Syc148097 		uint16_t speed_sel1		: 1;    /* bit 6 */
7826835Syc148097 		uint16_t res1			: 4;
7836835Syc148097 		uint16_t low_power		: 1;
7846835Syc148097 		uint16_t res2			: 1;
7856835Syc148097 		uint16_t speed_sel2		: 1;
7866835Syc148097 		uint16_t loopback		: 1;	/* bit 14 */
7876835Syc148097 		uint16_t reset			: 1;    /* bit 15 */
7886835Syc148097 #endif
7896835Syc148097 	} bits;
7906835Syc148097 } tn1010_phyxs_ctrl_t, *p_tn1010_phyxs_ctrl_t;
7916835Syc148097 
7926835Syc148097 /* TN1010 PHY XS Control Register */
7936835Syc148097 typedef union _tn1010_phyxs_ctrl {
7946835Syc148097 	uint16_t value;
7956835Syc148097 	struct {
7966835Syc148097 #ifdef _BIT_FIELDS_HTOL
7976835Syc148097 		uint16_t reset			: 1;    /* bit 15 */
7986835Syc148097 		uint16_t loopback		: 1;	/* bit 14 */
7996835Syc148097 		uint16_t speed_sel2		: 1;
8006835Syc148097 		uint16_t res2			: 1;
8016835Syc148097 		uint16_t low_power		: 1;
8026835Syc148097 		uint16_t res1			: 4;
8036835Syc148097 		uint16_t speed_sel1		: 1;    /* bit 6 */
8046835Syc148097 		uint16_t speed_sel0		: 4;    /* bits[5:2] */
8056835Syc148097 		uint16_t res0			: 2;
8066835Syc148097 #else
8076835Syc148097 		uint16_t res0			: 2;
8086835Syc148097 		uint16_t speed_sel0		: 4;    /* bits[5:2] */
8096835Syc148097 		uint16_t speed_sel1		: 1;    /* bit 6 */
8106835Syc148097 		uint16_t res1			: 4;
8116835Syc148097 		uint16_t low_power		: 1;
8126835Syc148097 		uint16_t res2			: 1;
8136835Syc148097 		uint16_t speed_sel2		: 1;
8146835Syc148097 		uint16_t loopback		: 1;	/* bit 14 */
8156835Syc148097 		uint16_t reset			: 1;    /* bit 15 */
8166835Syc148097 #endif
8176835Syc148097 	} bits;
8186835Syc148097 } tn1010_pcs_ctrl_t, *p_tn1010_pcs_ctrl_t;
8196835Syc148097 
8206835Syc148097 /* TN1010 VENDOR MMD1 GPHY Control register 30.310 */
8216835Syc148097 #define	TN1010_SGMII_LOOPBACK			1
8226835Syc148097 #define	TN1010_DEEP_LOOPBACK			2
8236835Syc148097 
8246835Syc148097 #define	TN1010_PMD_CONTROL_REG			0
8256835Syc148097 #define	TN1010_PMD_STATUS_REG			1
8266835Syc148097 #define	TN1010_PMD_ID_HIGH_REG			2
8276835Syc148097 #define	TN1010_PMD_ID_LOW_REG			3
8286835Syc148097 #define	TN1010_PMD_SPEED_ABIL_REG		4
8296835Syc148097 #define	TN1010_PMD_DEV_IN_PKG1_REG		5
8306835Syc148097 #define	TN1010_PMD_DEV_IN_PKG2_REG		6
8316835Syc148097 #define	TN1010_PMD_CONTROL2_REG			7
8326835Syc148097 #define	TN1010_PMD_STATUS2_REG			8
8336835Syc148097 #define	TN1010_PMD_TRANSMIT_DIS_REG		9
8346835Syc148097 #define	TN1010_PMD_RECEIVE_SIG_DETECT		10
8356835Syc148097 #define	TN1010_PMD_ORG_UNIQUE_ID_0_REG		14
8366835Syc148097 #define	TN1010_PMD_ORG_UNIQUE_ID_1_REG		15
8376835Syc148097 #define	TN1010_PCS_CONTROL_REG			0
8386835Syc148097 #define	TN1010_PCS_STATUS1_REG			1
8396835Syc148097 #define	TN1010_PCS_ID_HIGH_REG			2
8406835Syc148097 #define	TN1010_PCS_ID_LOW_REG			3
8416835Syc148097 #define	TN1010_PCS_SPEED_ABILITY_REG		4
8426835Syc148097 #define	TN1010_PCS_DEV_IN_PKG1_REG		5
8436835Syc148097 #define	TN1010_PCS_DEV_IN_PKG2_REG		6
8446835Syc148097 #define	TN1010_PCS_CONTROL2_REG			7
8456835Syc148097 #define	TN1010_PCS_STATUS2_REG			8
8466835Syc148097 #define	TN1010_PCS_ORG_UNIQUE_ID_0_REG		14
8476835Syc148097 #define	TN1010_PCS_ORG_UNIQUE_ID_1_REG		15
8486835Syc148097 #define	TN1010_PCS_10GBASE_R_T_STATUS1_REG	32
8496835Syc148097 #define	TN1010_PCS_10GBASE_R_T_STATUS2_REG	33
8506835Syc148097 #define	TN1010_PHYXS_CONTROL_REG		0
8516835Syc148097 #define	TN1010_PHYXS_STATUS_REG			1
8526835Syc148097 #define	TN1010_PHY_ID_HIGH_REG			2
8536835Syc148097 #define	TN1010_PHY_ID_LOW_REG			3
8546835Syc148097 #define	TN1010_PHYXS_SPEED_ABILITY_REG		4
8556835Syc148097 #define	TN1010_PHYXS_DEV_IN_PKG2_REG		5
8566835Syc148097 #define	TN1010_PHYXS_DEV_IN_PKG1_REG		6
8576835Syc148097 #define	TN1010_PHYXS_STATUS2_REG		8
8586835Syc148097 #define	TN1010_PHYXS_ORG_UNIQUE_ID_0_REG	14
8596835Syc148097 #define	TN1010_PHYXS_ORG_UNIQUE_ID_1_REG	15
8606835Syc148097 #define	TN1010_PHYXS_XGXS_LANE_STATUS_REG	24
8616835Syc148097 #define	TN1010_PHYXS_XGXS_TEST_CONTROL_REG	25
8626835Syc148097 
8636835Syc148097 #define	TN1010_AUTONEG_CONTROL_REG		0
8646835Syc148097 #define	TN1010_AUTONEG_STATUS_REG		1
8656835Syc148097 #define	TN1010_AUTONEG_ID_HIGH_REG		2
8666835Syc148097 #define	TN1010_AUTONEG_ID_LOW_REG		3
8676835Syc148097 #define	TN1010_AUTONEG_DEV_IN_PKG1_REG		5
8686835Syc148097 #define	TN1010_AUTUNEG_DEV_IN_PKG2_REG		6
8696835Syc148097 #define	TN1010_AUTONEG_ORG_UNIQUE_ID_0_REG	14
8706835Syc148097 #define	TN1010_AUTONEG_ORG_UNIQUE_ID_1_REG	15
8716835Syc148097 #define	TN1010_AUTONEG_ADVERTISE_REG		16
8726835Syc148097 #define	TN1010_AUTONEG_PARTNER_ABILITY_REG	19
8736835Syc148097 
8746835Syc148097 #define	TN1010_VENDOR_MMD1_CONTROL_REG		0
8756835Syc148097 #define	TN1010_VENDOR_MMD1_STATUS_REG		1
8766835Syc148097 #define	TN1010_VENDOR_MMD1_ID_HIGH		2
8776835Syc148097 #define	TN1010_VENDOR_MMD1_ID_LOW		3
8786835Syc148097 #define	TN1010_VENDOR_MMD1_DEV_STATUS_REG	8
8796835Syc148097 #define	TN1010_VENDOR_MMD1_FNS_CONTROL_RER	9
8806835Syc148097 #define	TN1010_VENDOR_MMD1_PKG_ID_0_REG		14
8816835Syc148097 #define	TN1010_VENDOR_MMD1_PKG_ID_1_REG		15
8826835Syc148097 #define	TN1010_VENDOR_MMD1_GPHY_CTRL		310
8836835Syc148097 
8846835Syc148097 /* Bits definitions of TN1010_AUTONEG_CONTROL_REG */
8856835Syc148097 #define	TN1010_AN_CTRL_RESET_BIT	0x8000	/* Reset */
8866835Syc148097 #define	TN1010_AN_CTRL_EN_BIT		0x1000	/* Enable autoneg */
8876835Syc148097 #define	TN1010_AN_CTRL_RESTART_BIT	0x200	/* Restart autoneg */
8886835Syc148097 #define	TN1010_AN_LINK_STAT_BIT		0x4	/* Link status */
8896835Syc148097 
8906835Syc148097 /* Bits definitions of TN1010_PHYXS_CONTROL_REG	*/
8916835Syc148097 #define	TN1010_VENDOR_MMD1_AN_STAT_BITS		0xC0
8926835Syc148097 
8936835Syc148097 /*
8946835Syc148097  * Shift right 6 bits so bits[7:6] becomes [1:0].
8956835Syc148097  * Bits[7:6] of TN1010_VENDOR_MND1_STATUS_REG are for autoneg status
8966835Syc148097  * 00 in progress
8976835Syc148097  * 01 completed
8986835Syc148097  * 10 reserved
8996835Syc148097  * 11 failed
9006835Syc148097  */
9016835Syc148097 #define	TN1010_VENDOR_MMD1_AN_STAT_SHIFT	6
9026835Syc148097 
9036835Syc148097 /* Bit 4 of TN1010_VENDOR_MMD1_STATUS_REG is speed. 0: 10G, 1: 1G */
9046835Syc148097 #define	TN1010_VENDOR_MMD1_AN_SPEED_BIT		0x10
9056835Syc148097 
9066835Syc148097 /* Shift right 4 bits so bit4 becomes bit0 */
9076835Syc148097 #define	TN1010_VENDOR_MMD1_AN_SPEED_SHIFT	4
9086835Syc148097 
90912103SSantwona.Behera@Sun.COM /*
91012103SSantwona.Behera@Sun.COM  * Definitions for Netlogic AEL2020 PHY
91112103SSantwona.Behera@Sun.COM  */
91212103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_ADDR		1
91312103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_CTL_REG		0
91412103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_PHY_RST		0x8000
91512103SSantwona.Behera@Sun.COM 
91612103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_STAT1_REG	0x0001
91712103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_LINK_UP		0x0004
91812103SSantwona.Behera@Sun.COM 
91912103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_RX_SIG_DET_REG	0x000A
92012103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_RX_SIG_ON	0x0001
92112103SSantwona.Behera@Sun.COM 
92212103SSantwona.Behera@Sun.COM #define	NLP2020_PMA_PMD_STAT2_REG	0x0008
92312103SSantwona.Behera@Sun.COM 
92412103SSantwona.Behera@Sun.COM #define	NLP2020_OPT_SET_REG		0xC017
92512103SSantwona.Behera@Sun.COM #define	NLP2020_RXLOS_ACT_H		0x0020
92612103SSantwona.Behera@Sun.COM 
92712103SSantwona.Behera@Sun.COM #define	NLP2020_TX_DRV_CTL1_REG		0xC241
92812103SSantwona.Behera@Sun.COM #define	NLP2020_TX_DRV_CTL1_PREEMP_EN	0xA000
92912103SSantwona.Behera@Sun.COM 
93012103SSantwona.Behera@Sun.COM #define	NLP2020_TX_DRV_CTL2_REG		0xC243
93112103SSantwona.Behera@Sun.COM #define	NLP2020_TX_DRV_CTL2_EMP_VAL	0xFFD3
93212103SSantwona.Behera@Sun.COM 
93312103SSantwona.Behera@Sun.COM #define	NLP2020_UC_CTL_REG		0xD092
93412103SSantwona.Behera@Sun.COM #define	NLP2020_UC_CTL_STOP		1
93512103SSantwona.Behera@Sun.COM #define	NLP2020_UC_CTL_START		0
93612103SSantwona.Behera@Sun.COM 
93712103SSantwona.Behera@Sun.COM #define	NLP2020_UC_PC_START_REG		0xD080
93812103SSantwona.Behera@Sun.COM #define	NLP2020_UC_PC_START_VAL		0x100
93912103SSantwona.Behera@Sun.COM 
94012103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_PCS_ADDR		3
94112103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_PCS_STAT1_REG	0x0001
94212103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_PCS_LINK_UP		0x0004
94312103SSantwona.Behera@Sun.COM 
94412103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_PCS_10GBR_STAT1_REG		0x0020
94512103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_PCS_10GBR_RX_LINK_UP	0x1000
94612103SSantwona.Behera@Sun.COM 
94712103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_PCS_STAT2_REG	0x0008
94812103SSantwona.Behera@Sun.COM 
94912103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_XS_ADDR		4
95012103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_XS_STAT1_REG	0x0001
95112103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_XS_LINK_UP		0x0004
95212103SSantwona.Behera@Sun.COM 
95312103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_XS_LN_ST_REG	0x0018
95412103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_XS_LN_ALIGN_SYNC	0x100f
95512103SSantwona.Behera@Sun.COM 
95612103SSantwona.Behera@Sun.COM #define	NLP2020_PHY_XS_STAT2_REG	0x0008
95712103SSantwona.Behera@Sun.COM 
95812103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_ADDR		1
95912103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_CTL_REG		0xC108
96012103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_STAT_REG		0xC10C
96112103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_STAT_MD_SHIFT	0x0004
96212103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_STAT_MD_MASK	0x00f0
96312103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_PT3_CFG_REG	0xC113
96412103SSantwona.Behera@Sun.COM 
96512103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_ACT		0x0a00
96612103SSantwona.Behera@Sun.COM #define	NLP2020_GPIO_INACT		0x0b00
96712103SSantwona.Behera@Sun.COM 
96812103SSantwona.Behera@Sun.COM #define	NLP2020_I2C_SNOOP_DEV_ADDR	1
96912103SSantwona.Behera@Sun.COM #define	NLP2020_I2C_SNOOP_ADDR_REG	0xC30A
97012103SSantwona.Behera@Sun.COM #define	NLP2020_I2C_SNOOP_DATA_REG	0xC30B
97112103SSantwona.Behera@Sun.COM #define	NLP2020_I2C_SNOOP_STAT_REG	0xC30C
97212103SSantwona.Behera@Sun.COM #define	NLP2020_XCVR_I2C_ADDR		0x00A0
97312103SSantwona.Behera@Sun.COM #define	NLP2020_XCVR_I2C_ADDR_SH	0x0008
97412103SSantwona.Behera@Sun.COM 
97512103SSantwona.Behera@Sun.COM /*
97612103SSantwona.Behera@Sun.COM  * QSFP defines
97712103SSantwona.Behera@Sun.COM  */
97812103SSantwona.Behera@Sun.COM #define	SFPP_COPPER_TWINAX	0x21
97912103SSantwona.Behera@Sun.COM #define	SFPP_FIBER		0x7
98012103SSantwona.Behera@Sun.COM #define	QSFP_FIBER		0xC
98112103SSantwona.Behera@Sun.COM #define	QSFP_COPPER_TWINAX	0x21
98212103SSantwona.Behera@Sun.COM 
98312103SSantwona.Behera@Sun.COM #define	QSFP_MSA_CONN_REG	 130
98412103SSantwona.Behera@Sun.COM #define	QSFP_MSA_LPM_REG	 93
98512103SSantwona.Behera@Sun.COM #define	QSFP_MSA_LEN_REG	 0x92
98612103SSantwona.Behera@Sun.COM #define	QSFP_MSA_LPM_HIGH	 0x1
98712103SSantwona.Behera@Sun.COM 
98812103SSantwona.Behera@Sun.COM typedef enum {
98912103SSantwona.Behera@Sun.COM 	NXGE_NLP_CONN_FIBER,
99012103SSantwona.Behera@Sun.COM 	NXGE_NLP_CONN_COPPER_LT_7M,
99112103SSantwona.Behera@Sun.COM 	NXGE_NLP_CONN_COPPER_7M_ABOVE
99212103SSantwona.Behera@Sun.COM } nxge_nlp_conn_t;
99312103SSantwona.Behera@Sun.COM 
99412103SSantwona.Behera@Sun.COM /*
99512103SSantwona.Behera@Sun.COM  * struct for PHY addr-value pairs
99612103SSantwona.Behera@Sun.COM  */
99712103SSantwona.Behera@Sun.COM typedef struct _nxge_nlp_initseq_t {
99812103SSantwona.Behera@Sun.COM 	uint32_t	dev_reg;
99912103SSantwona.Behera@Sun.COM 	uint16_t	val;
100012103SSantwona.Behera@Sun.COM } nxge_nlp_initseq_t, *p_nxge_nlp_initseq_t;
10016835Syc148097 
1002*12452SSantwona.Behera@oracle.COM /*
1003*12452SSantwona.Behera@oracle.COM  * struct for PHY dev, register and value triple properties
1004*12452SSantwona.Behera@oracle.COM  */
1005*12452SSantwona.Behera@oracle.COM typedef struct _nxge_phy_mdio_val_t {
1006*12452SSantwona.Behera@oracle.COM 	uint16_t	dev;
1007*12452SSantwona.Behera@oracle.COM 	uint16_t	reg;
1008*12452SSantwona.Behera@oracle.COM 	uint16_t	val;
1009*12452SSantwona.Behera@oracle.COM } nxge_phy_mdio_val_t, *p_nxge_phy_mdio_val_t;
1010*12452SSantwona.Behera@oracle.COM 
1011*12452SSantwona.Behera@oracle.COM /*
1012*12452SSantwona.Behera@oracle.COM  * struct for PHY register configurable property
1013*12452SSantwona.Behera@oracle.COM  */
1014*12452SSantwona.Behera@oracle.COM typedef struct _nxge_phy_prop_t {
1015*12452SSantwona.Behera@oracle.COM 	int	cnt;
1016*12452SSantwona.Behera@oracle.COM 	p_nxge_phy_mdio_val_t arr;
1017*12452SSantwona.Behera@oracle.COM } nxge_phy_prop_t, *p_nxge_phy_prop_t;
1018*12452SSantwona.Behera@oracle.COM 
10193859Sml29623 #ifdef	__cplusplus
10203859Sml29623 }
10213859Sml29623 #endif
10223859Sml29623 
10233859Sml29623 #endif	/* _SYS_NXGE_NXGE_PHY_HW_H */
1024