Home | History | Annotate | Line # | Download | only in mii
makphyreg.h revision 1.9.4.3
      1  1.9.4.3    martin /*	$NetBSD: makphyreg.h,v 1.9.4.3 2020/04/08 14:08:08 martin Exp $	*/
      2  1.9.4.2  christos 
      3  1.9.4.2  christos /*-
      4  1.9.4.2  christos  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  1.9.4.2  christos  * All rights reserved.
      6  1.9.4.2  christos  *
      7  1.9.4.2  christos  * This code is derived from software contributed to The NetBSD Foundation
      8  1.9.4.2  christos  * by Jason R. Thorpe.
      9  1.9.4.2  christos  *
     10  1.9.4.2  christos  * Redistribution and use in source and binary forms, with or without
     11  1.9.4.2  christos  * modification, are permitted provided that the following conditions
     12  1.9.4.2  christos  * are met:
     13  1.9.4.2  christos  * 1. Redistributions of source code must retain the above copyright
     14  1.9.4.2  christos  *    notice, this list of conditions and the following disclaimer.
     15  1.9.4.2  christos  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.9.4.2  christos  *    notice, this list of conditions and the following disclaimer in the
     17  1.9.4.2  christos  *    documentation and/or other materials provided with the distribution.
     18  1.9.4.2  christos  *
     19  1.9.4.2  christos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.9.4.2  christos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.9.4.2  christos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.9.4.2  christos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.9.4.2  christos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.9.4.2  christos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.9.4.2  christos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.9.4.2  christos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.9.4.2  christos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.9.4.2  christos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.9.4.2  christos  * POSSIBILITY OF SUCH DAMAGE.
     30  1.9.4.2  christos  */
     31  1.9.4.2  christos 
     32  1.9.4.2  christos #ifndef _DEV_MII_MAKPHYREG_H_
     33  1.9.4.2  christos #define	_DEV_MII_MAKPHYREG_H_
     34  1.9.4.2  christos 
     35  1.9.4.2  christos /*
     36  1.9.4.2  christos  * Marvell 88E1000 ``Alaska'' 10/100/1000 PHY registers.
     37  1.9.4.2  christos  */
     38  1.9.4.2  christos 
     39  1.9.4.2  christos #define	MAKPHY_PSCR		0x10	/* PHY specific control register */
     40  1.9.4.2  christos #define	PSCR_DIS_JABBER		(1U << 0)   /* disable jabber */
     41  1.9.4.2  christos #define	PSCR_POL_REV		(1U << 1)   /* polarity reversal */
     42  1.9.4.2  christos #define	PSCR_SQE_TEST		(1U << 2)   /* SQE test */
     43  1.9.4.2  christos #define	PSCR_MBO		(1U << 3)   /* must be one */
     44  1.9.4.2  christos #define	PSCR_DIS_125CLK		(1U << 4)   /* 125CLK low */
     45  1.9.4.2  christos #define	PSCR_MDI_XOVER_MODE(x)	((x) << 5)  /* crossover mode */
     46  1.9.4.2  christos #define	PSCR_LOW_10T_THRESH	(1U << 7)   /* lower 10BASE-T Rx threshold */
     47  1.9.4.2  christos #define	PSCR_EN_DETECT(x)	((x) << 8)  /* Energy Detect */
     48  1.9.4.2  christos #define	PSCR_FORCE_LINK_GOOD	(1U << 10)  /* force link good */
     49  1.9.4.2  christos #define	PSCR_CRS_ON_TX		(1U << 11)  /* assert CRS on transmit */
     50  1.9.4.2  christos #define	PSCR_RX_FIFO(x)		((x) << 12) /* Rx FIFO depth */
     51  1.9.4.2  christos #define	PSCR_TX_FIFO(x)		((x) << 14) /* Tx FIFO depth */
     52  1.9.4.2  christos 
     53  1.9.4.2  christos #define	XOVER_MODE_MDI		0
     54  1.9.4.2  christos #define	XOVER_MODE_MDIX		1
     55  1.9.4.2  christos #define	XOVER_MODE_AUTO		2
     56  1.9.4.2  christos 
     57  1.9.4.2  christos /* 88E3016 */
     58  1.9.4.2  christos /* bit 2 and 3 are reserved */
     59  1.9.4.2  christos #define	E3016_PSCR_MDI_XOVER_MODE(x) ((x) << 4)  /* crossover mode */
     60  1.9.4.2  christos #define	E3016_PSCR_SIGDET_POLARITY (1U << 6)  /* 0: Active H, 1: Active L */
     61  1.9.4.2  christos #define	E3016_PSCR_EXTDIST	(1U << 7)  /* Enable Extended Distance */
     62  1.9.4.2  christos #define	E3016_PSCR_FEFI_DIS	(1U << 8)  /* Disable FEFI */
     63  1.9.4.2  christos #define	E3016_PSCR_SCRAMBLE_DIS	(1U << 9)  /* Disable Scrambler */
     64  1.9.4.2  christos /* bit 10 is reserved */
     65  1.9.4.2  christos #define	E3016_PSCR_NLPGEN_DIS	(1U << 11)  /* Disable Linkpulse Generation */
     66  1.9.4.2  christos #define	E3016_PSCR_REG8NXTPG	(1U << 12)  /* En. Link Partner Next Page R */
     67  1.9.4.2  christos #define	E3016_PSCR_NLPCHK_DIS	(1U << 13)  /* Disable NLP check */
     68  1.9.4.2  christos #define	E3016_PSCR_EN_DETECT	(1U << 14)  /* Energy Detect */
     69  1.9.4.2  christos /* bit 15 is reserved */
     70  1.9.4.2  christos 
     71  1.9.4.2  christos /* 88E1112 page 1 */
     72  1.9.4.2  christos #define	MAKPHY_FSCR		0x10	/* Fiber specific control register */
     73  1.9.4.2  christos #define	FSCR_XMITTER_DIS	0x0008	/* Transmitter Disable */
     74  1.9.4.2  christos 
     75  1.9.4.2  christos /* 88E1112 page 2 */
     76  1.9.4.2  christos #define	MAKPHY_MSCR		0x10	/* MAC specific control register */
     77  1.9.4.2  christos #define	MSCR_TX_FIFODEPTH	0xc000	/* Transmi FIFO Depth */
     78  1.9.4.2  christos #define	MSCR_RX_FIFODEPTH	0x3000	/* Receive FIFO Depth */
     79  1.9.4.2  christos #define	MSCR_AUTOPREF_MASK	0x0c00	/* Autoselect preferred media mask */
     80  1.9.4.2  christos #define	MSCR_AUTOPREF_NO	0x0000	/*  No preference */
     81  1.9.4.2  christos #define	MSCR_AUTOPREF_FIBER	0x0400	/*  Preferred Fiber */
     82  1.9.4.2  christos #define	MSCR_AUTOPREF_COPPER	0x0800	/*  Preferred Copper */
     83  1.9.4.2  christos #define	MSCR_MODE_MASK		0x0380	/* Mode select mask */
     84  1.9.4.2  christos #define	MSCR_M_100FX		0x0000	/*  100BASE-FX */
     85  1.9.4.2  christos #define	MSCR_M_COOPER_GBIC	0x0080	/*  Copper GBIC */
     86  1.9.4.2  christos #define	MSCR_M_AUTO_COPPER_SGMII 0x0100	/*  Auto Copper/SGMII */
     87  1.9.4.2  christos #define	MSCR_M_AUTO_COPPER_1000X 0x0180	/*  Auto Copper/1000BASE-X */
     88  1.9.4.2  christos #define	MSCR_M_COPPER		0x0280	/*  Copper only */
     89  1.9.4.2  christos #define	MSCR_M_SGMII		0x0300	/*  SGMII only */
     90  1.9.4.2  christos #define	MSCR_M_1000X		0x0380	/*  1000BASE-X only */
     91  1.9.4.2  christos #define	MSCR_SGMII_PDOWN	0x0008	/* SGMII MAC Interface Power Down */
     92  1.9.4.2  christos #define	MSCR_ENHANCED_SGMII	0x0004	/* Enhanced SGMII */
     93  1.9.4.2  christos 
     94  1.9.4.2  christos #define	MAKPHY_PSSR		0x11	/* PHY specific status register */
     95  1.9.4.2  christos #define	PSSR_JABBER		(1U << 0)   /* jabber indication */
     96  1.9.4.2  christos #define	PSSR_POLARITY		(1U << 1)   /* polarity indiciation */
     97  1.9.4.2  christos #define	PSSR_MDIX		(1U << 6)   /* 1 = MIDX, 0 = MDI */
     98  1.9.4.2  christos #define	PSSR_CABLE_LENGTH_get(x) (((x) >> 7) & 0x3)
     99  1.9.4.2  christos #define	PSSR_LINK		(1U << 10)  /* link indication */
    100  1.9.4.2  christos #define	PSSR_RESOLVED		(1U << 11)  /* speed and duplex resolved */
    101  1.9.4.2  christos #define	PSSR_PAGE_RECEIVED	(1U << 12)  /* page received */
    102  1.9.4.2  christos #define	PSSR_DUPLEX		(1U << 13)  /* 1 = FDX */
    103  1.9.4.2  christos #define	PSSR_SPEED_get(x)	(((x) >> 14) & 0x3)
    104  1.9.4.2  christos 
    105  1.9.4.2  christos #define	SPEED_10		0
    106  1.9.4.2  christos #define	SPEED_100		1
    107  1.9.4.2  christos #define	SPEED_1000		2
    108  1.9.4.2  christos #define	SPEED_reserved		3
    109  1.9.4.2  christos 
    110  1.9.4.3    martin /* For 88E1112 */
    111  1.9.4.3    martin #define	PSSR_RESOLUTION_FIBER	(1U << 7)   /*
    112  1.9.4.3    martin 					     * Fiber/Copper resolution
    113  1.9.4.3    martin 					     * 1 = Fiber, 0 = Copper
    114  1.9.4.3    martin 					     */
    115  1.9.4.3    martin 
    116  1.9.4.2  christos #define	MAKPHY_IE		0x12	/* Interrupt enable */
    117  1.9.4.2  christos #define	IE_JABBER		(1U << 0)   /* jabber indication */
    118  1.9.4.2  christos #define	IE_POL_CHANGED		(1U << 1)   /* polarity changed */
    119  1.9.4.2  christos #define	IE_MDI_XOVER_CHANGED	(1U << 6)   /* MDI/MDIX changed */
    120  1.9.4.2  christos #define	IE_FIFO_OVER_UNDER	(1U << 7)   /* FIFO over/underflow */
    121  1.9.4.2  christos #define	IE_FALSE_CARRIER	(1U << 8)   /* false carrier detected */
    122  1.9.4.2  christos #define	IE_SYMBOL_ERROR		(1U << 9)   /* symbol error occurred */
    123  1.9.4.2  christos #define	IE_LINK_CHANGED		(1U << 10)  /* link status changed */
    124  1.9.4.2  christos #define	IE_ANEG_COMPLETE	(1U << 11)  /* autonegotiation completed */
    125  1.9.4.2  christos #define	IE_PAGE_RECEIVED	(1U << 12)  /* page received */
    126  1.9.4.2  christos #define	IE_DUPLEX_CHANGED	(1U << 13)  /* duplex changed */
    127  1.9.4.2  christos #define	IE_SPEED_CHANGED	(1U << 14)  /* speed changed */
    128  1.9.4.2  christos #define	IE_ANEG_ERROR		(1U << 15)  /* autonegotiation error occurred */
    129  1.9.4.2  christos 
    130  1.9.4.2  christos #define	MAKPHY_IS		0x13	/* Interrupt status */
    131  1.9.4.2  christos 	/* See Interrupt enable bits */
    132  1.9.4.2  christos 
    133  1.9.4.2  christos #define	MAKPHY_EPSC		0x14	/* extended PHY specific control */
    134  1.9.4.2  christos #define	EPSC_TX_CLK(x)		((x) << 4)  /* transmit clock */
    135  1.9.4.2  christos #define	EPSC_TBI_RCLK_DIS	(1U << 12)  /* TBI RCLK disable */
    136  1.9.4.2  christos #define	EPSC_TBI_RX_CLK125_EN	(1U << 13)  /* TBI RX_CLK125 enable */
    137  1.9.4.2  christos #define	EPSC_LINK_DOWN_NO_IDLES	(1U << 15)  /* 1 = lost lock detect */
    138  1.9.4.2  christos 
    139  1.9.4.2  christos #define	MAKPHY_REC		0x15	/* receive error counter */
    140  1.9.4.2  christos 
    141  1.9.4.2  christos #define	MAKPHY_EADR		0x16	/* extended address register */
    142  1.9.4.2  christos 
    143  1.9.4.2  christos #define	MAKPHY_LEDCTRL	0x18	/* LED control */
    144  1.9.4.2  christos #define	LEDCTRL_LED_TX		(1U << 0)   /* 1 = activ/link, 0 = xmit */
    145  1.9.4.2  christos #define	LEDCTRL_LED_RX		(1U << 1)   /* 1 = activ/link, 1 = recv */
    146  1.9.4.2  christos #define	LEDCTRL_LED_DUPLEX	(1U << 2)   /* 1 = duplex, 0 = dup/coll */
    147  1.9.4.2  christos #define	LEDCTRL_LED_LINK	(1U << 3)   /* 1 = spd/link, 0 = link */
    148  1.9.4.2  christos #define	LEDCTRL_BLINK_RATE(x)	((x) << 8)
    149  1.9.4.2  christos #define	LEDCTRL_PULSE_STRCH(x)	((x) << 12)
    150  1.9.4.2  christos #define	LEDCTRL_DISABLE		(1U << 15)  /* disable LED */
    151  1.9.4.2  christos 
    152  1.9.4.3    martin /* For 88E1011, 88E1111 */
    153  1.9.4.2  christos #define MAKPHY_ESSR		0x1b    /* Extended PHY specific status */
    154  1.9.4.2  christos #define ESSR_AUTOSEL_DISABLE	0x8000	/* Fiber/Copper autoselect disable */
    155  1.9.4.2  christos #define ESSR_FIBER_LINK		0x2000	/* Fiber/Copper resolution */
    156  1.9.4.2  christos #define ESSR_SER_ANEG_BYPASS	0x1000	/* Serial Iface Aneg bypass enable */
    157  1.9.4.2  christos #define ESSR_SER_ANEG_BYPASS_ST	0x0800	/* Serial Iface Aneg bypass status */
    158  1.9.4.2  christos #define ESSR_INTR_POLARITY	0x0400	/* Interrupt Polarity */
    159  1.9.4.2  christos #define ESSR_AUTO_MEDIAREG_SEL	0x0200	/* Auto Medium Register Selection */
    160  1.9.4.2  christos #define ESSR_DTE_DROP_HYST	0x01e0	/* DTE detect status drop hysteresis */
    161  1.9.4.2  christos #define ESSR_DTE_POWER		0x0010
    162  1.9.4.2  christos #define ESSR_HWCFG_MODE		0x000f
    163  1.9.4.3    martin #define ESSR_SGMII_WC_COPPER	 0x0000 /* SGMII w/ Clock w/ SGMII AN Copper */
    164  1.9.4.3    martin #define ESSR_RTBI_FIBER		 0x0001 /* RTBI to Fiber */
    165  1.9.4.3    martin #define ESSR_RGMII_FIBER	 0x0003 /* RGMII to Fiber */
    166  1.9.4.3    martin #define ESSR_SGMII_WOC_COPPER	 0x0004 /* SGMII w/o Clock w/ SGMII AN Copp. */
    167  1.9.4.3    martin #define ESSR_TBI_FIBER		 0x0005 /* TBI to Fiber */
    168  1.9.4.3    martin #define ESSR_RGMII_SGMII	 0x0006 /* RGMII to SGMII */
    169  1.9.4.3    martin #define ESSR_GMII_FIBER		 0x0007 /* GMII to Fiber */
    170  1.9.4.3    martin #define ESSR_SERIAL_WAN		 0x0008 /* 88E1011: Serial w 1000KX AN */
    171  1.9.4.3    martin #define ESSR_GBIC		 0x0008 /* 88E1111: GBIC */
    172  1.9.4.3    martin #define ESSR_RTBI_COPPER	 0x0009 /* RTBI to Copper */
    173  1.9.4.3    martin #define ESSR_RGMII_COPPER	 0x000b /* RGMII to Copper */
    174  1.9.4.3    martin #define ESSR_RGMII_AUTOSEL	 0x000b /* RGMII with Auto-Selection */
    175  1.9.4.3    martin #define ESSR_SERIAL_WOAN	 0x000c /* 88E1011: Serial w/o 1000KX AN */
    176  1.9.4.3    martin #define ESSR_1000X_WOAN		 0x000c /* 88E1111: 1000X w/o AN Copper */
    177  1.9.4.3    martin #define ESSR_TBI_COPPER		 0x000d /* TBI to Copper */
    178  1.9.4.3    martin #define ESSR_GMII_SGMII		 0x000e /* GMII to SGMII */
    179  1.9.4.3    martin #define ESSR_GMII_COPPER	 0x000f /* GMII to Copper */
    180  1.9.4.3    martin #define ESSR_GMII_AUTOSEL	 0x000f /* GMII with Auto-Selection */
    181  1.9.4.2  christos 
    182  1.9.4.2  christos #endif /* _DEV_MII_MAKPHYREG_H_ */
    183