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