inbmphyreg.h revision 1.16 1 1.16 msaitoh /* $NetBSD: inbmphyreg.h,v 1.16 2019/01/07 01:43:22 msaitoh Exp $ */
2 1.1 msaitoh /*******************************************************************************
3 1.14 msaitoh Copyright (c) 2001-2015, Intel Corporation
4 1.1 msaitoh All rights reserved.
5 1.1 msaitoh
6 1.1 msaitoh Redistribution and use in source and binary forms, with or without
7 1.1 msaitoh modification, are permitted provided that the following conditions are met:
8 1.1 msaitoh
9 1.1 msaitoh 1. Redistributions of source code must retain the above copyright notice,
10 1.1 msaitoh this list of conditions and the following disclaimer.
11 1.1 msaitoh
12 1.1 msaitoh 2. Redistributions in binary form must reproduce the above copyright
13 1.1 msaitoh notice, this list of conditions and the following disclaimer in the
14 1.1 msaitoh documentation and/or other materials provided with the distribution.
15 1.1 msaitoh
16 1.1 msaitoh 3. Neither the name of the Intel Corporation nor the names of its
17 1.1 msaitoh contributors may be used to endorse or promote products derived from
18 1.1 msaitoh this software without specific prior written permission.
19 1.1 msaitoh
20 1.1 msaitoh THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 1.1 msaitoh AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 1.1 msaitoh IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 1.1 msaitoh ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 1.1 msaitoh LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1 msaitoh CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1 msaitoh SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1 msaitoh INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 msaitoh CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 msaitoh ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 msaitoh POSSIBILITY OF SUCH DAMAGE.
31 1.1 msaitoh *******************************************************************************/
32 1.1 msaitoh
33 1.1 msaitoh /*
34 1.1 msaitoh * Copied from the Intel code, and then modified to match NetBSD
35 1.1 msaitoh * style for MII registers more.
36 1.1 msaitoh */
37 1.1 msaitoh
38 1.1 msaitoh #ifndef _DEV_MII_INBMPHYREG_H_
39 1.1 msaitoh #define _DEV_MII_INBMPHYREG_H_
40 1.1 msaitoh
41 1.1 msaitoh /* Bits...
42 1.14 msaitoh * 31-16: register offset (high)
43 1.14 msaitoh * 15-5: page
44 1.14 msaitoh * 4-0: register offset (low)
45 1.1 msaitoh */
46 1.14 msaitoh #define BME1000_PAGE_SHIFT 5
47 1.14 msaitoh #define BM_PHY_UPPER_SHIFT 21
48 1.1 msaitoh #define BME1000_REG(page, reg) \
49 1.14 msaitoh (((reg) & MII_ADDRMASK) | \
50 1.14 msaitoh (((page) & 0xffff) << BME1000_PAGE_SHIFT) | \
51 1.14 msaitoh (((reg) & ~MII_ADDRMASK) << (BM_PHY_UPPER_SHIFT - BME1000_PAGE_SHIFT)))
52 1.1 msaitoh
53 1.1 msaitoh #define BME1000_MAX_MULTI_PAGE_REG 0xf /* Registers equal on all pages */
54 1.1 msaitoh
55 1.1 msaitoh #define BM_PHY_REG_PAGE(offset) \
56 1.1 msaitoh ((uint16_t)(((offset) >> BME1000_PAGE_SHIFT) & 0xffff))
57 1.7 msaitoh #define BM_PHY_REG_NUM(offset) \
58 1.7 msaitoh ((uint16_t)((offset) & MII_ADDRMASK) \
59 1.14 msaitoh | (((offset) >> (BM_PHY_UPPER_SHIFT - BME1000_PAGE_SHIFT)) & ~MII_ADDRMASK))
60 1.1 msaitoh
61 1.1 msaitoh /* BME1000 Specific Registers */
62 1.1 msaitoh #define BME1000_PHY_SPEC_CTRL BME1000_REG(0, 16) /* PHY Specific Control */
63 1.1 msaitoh #define BME1000_PSCR_DISABLE_JABBER 0x0001 /* 1=Disable Jabber */
64 1.1 msaitoh #define BME1000_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Polarity Reversal Disabled */
65 1.1 msaitoh #define BME1000_PSCR_POWER_DOWN 0x0004 /* 1=Power Down */
66 1.1 msaitoh #define BME1000_PSCR_COPPER_TRANSMITER_DISABLE 0x0008 /* 1=Transmitter Disabled */
67 1.1 msaitoh #define BME1000_PSCR_CROSSOVER_MODE_MASK 0x0060
68 1.1 msaitoh #define BME1000_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI configuration */
69 1.1 msaitoh #define BME1000_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX configuration */
70 1.1 msaitoh #define BME1000_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Automatic crossover */
71 1.1 msaitoh #define BME1000_PSCR_ENALBE_EXTENDED_DISTANCE 0x0080 /* 1=Enable Extended Distance */
72 1.1 msaitoh #define BME1000_PSCR_ENERGY_DETECT_MASK 0x0300
73 1.1 msaitoh #define BME1000_PSCR_ENERGY_DETECT_OFF 0x0000 /* 00,01=Off */
74 1.1 msaitoh #define BME1000_PSCR_ENERGY_DETECT_RX 0x0200 /* 10=Sense on Rx only (Energy Detect) */
75 1.1 msaitoh #define BME1000_PSCR_ENERGY_DETECT_RX_TM 0x0300 /* 11=Sense and Tx NLP */
76 1.1 msaitoh #define BME1000_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force Link Good */
77 1.1 msaitoh #define BME1000_PSCR_DOWNSHIFT_ENABLE 0x0800 /* 1=Enable Downshift */
78 1.1 msaitoh #define BME1000_PSCR_DOWNSHIFT_COUNTER_MASK 0x7000
79 1.1 msaitoh #define BME1000_PSCR_DOWNSHIFT_COUNTER_SHIFT 12
80 1.1 msaitoh
81 1.16 msaitoh /* Extended Management Interface (EMI) Registers */
82 1.16 msaitoh #define I82579_EMI_ADDR 0x10
83 1.16 msaitoh #define I82579_EMI_DATA 0x11
84 1.16 msaitoh #define I82579_EEE_ADVERTISEMENT 0x040e /* IEEE MMD Register 7.60 */
85 1.16 msaitoh #define I82579_EEE_LP_ABILITY 0x040f /* IEEE MMD Register 7.61 */
86 1.16 msaitoh #define I82579_EEE_PCS_STATUS 0x182e
87 1.16 msaitoh #define I82579_LPI_PLL_SHUT 0x4412
88 1.16 msaitoh #define I82579_LPI_PLL_SHUT_100 __BIT(2) /* 100M LPI PLL Shut Enable */
89 1.16 msaitoh #define I217_EEE_PCS_STATUS 0x9401 /* IEEE MMD Register 3.1 */
90 1.16 msaitoh #define I217_EEE_CAPABILITY 0x8000 /* IEEE MMD Register 3.20 */
91 1.16 msaitoh #define I217_EEE_ADVERTISEMENT 0x8001 /* IEEE MMD Register 7.60 */
92 1.16 msaitoh #define I217_EEE_LP_ABILITY 0x8002 /* IEEE MMD Register 7.61 */
93 1.16 msaitoh
94 1.12 msaitoh /* BM PHY Copper Specific Status */
95 1.12 msaitoh #define BM_CS_STATUS BME1000_REG(0, 17)
96 1.12 msaitoh #define BM_CS_STATUS_LINK_UP 0x0400
97 1.12 msaitoh #define BM_CS_STATUS_RESOLVED 0x0800
98 1.12 msaitoh #define BM_CS_STATUS_SPEED_MASK 0xC000
99 1.12 msaitoh #define BM_CS_STATUS_SPEED_1000 0x8000
100 1.12 msaitoh
101 1.1 msaitoh #define BME1000_PHY_PAGE_SELECT BME1000_REG(0, 22) /* Page Select */
102 1.1 msaitoh
103 1.1 msaitoh #define BME1000_BIAS_SETTING 29
104 1.1 msaitoh #define BME1000_BIAS_SETTING2 30
105 1.1 msaitoh
106 1.1 msaitoh #define I82578_ADDR_REG 29
107 1.1 msaitoh #define I82577_ADDR_REG 16
108 1.1 msaitoh #define I82577_CFG_REG 22
109 1.1 msaitoh
110 1.4 msaitoh #define HV_INTC_FC_PAGE_START 768
111 1.4 msaitoh #define BM_PORT_CTRL_PAGE 769
112 1.4 msaitoh
113 1.5 msaitoh #define HV_OEM_BITS BME1000_REG(0, 25)
114 1.1 msaitoh #define HV_OEM_BITS_LPLU (1 << 2)
115 1.1 msaitoh #define HV_OEM_BITS_A1KDIS (1 << 6)
116 1.1 msaitoh #define HV_OEM_BITS_ANEGNOW (1 << 10)
117 1.1 msaitoh
118 1.12 msaitoh /* 82577 Mobile Phy Status Register */
119 1.12 msaitoh #define HV_M_STATUS BME1000_REG(0, 26)
120 1.12 msaitoh #define HV_M_STATUS_AUTONEG_COMPLETE 0x1000
121 1.12 msaitoh #define HV_M_STATUS_SPEED_MASK 0x0300
122 1.12 msaitoh #define HV_M_STATUS_SPEED_1000 0x0200
123 1.12 msaitoh #define HV_M_STATUS_SPEED_100 0x0100
124 1.12 msaitoh #define HV_M_STATUS_LINK_UP 0x0040
125 1.12 msaitoh
126 1.10 msaitoh #define HV_LED_CONFIG BME1000_REG(0, 30)
127 1.10 msaitoh
128 1.3 msaitoh #define HV_KMRN_MODE_CTRL BME1000_REG(BM_PORT_CTRL_PAGE, 16)
129 1.3 msaitoh #define HV_KMRN_MDIO_SLOW 0x0400
130 1.3 msaitoh
131 1.6 msaitoh #define BM_PORT_GEN_CFG BME1000_REG(BM_PORT_CTRL_PAGE, 17)
132 1.6 msaitoh
133 1.9 msaitoh #define CV_SMB_CTRL BME1000_REG(BM_PORT_CTRL_PAGE, 23)
134 1.9 msaitoh #define CV_SMB_CTRL_FORCE_SMBUS __BIT(0)
135 1.9 msaitoh
136 1.9 msaitoh #define HV_PM_CTRL BME1000_REG(770, 17)
137 1.9 msaitoh #define HV_PM_CTRL_K1_ENA __BIT(14)
138 1.9 msaitoh
139 1.11 msaitoh #define I217_INBAND_CTRL BME1000_REG(770, 18)
140 1.11 msaitoh #define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK 0x3f00
141 1.11 msaitoh #define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT 8
142 1.11 msaitoh
143 1.1 msaitoh #define IGP3_KMRN_DIAG BME1000_REG(770, 19)
144 1.2 msaitoh #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS (1 << 1)
145 1.1 msaitoh
146 1.13 msaitoh #define I217_LPI_GPIO_CTRL BME1000_REG(772, 18)
147 1.13 msaitoh #define I217_LPI_GPIO_CTRL_AUTO_EN_LPI __BIT(11)
148 1.13 msaitoh
149 1.13 msaitoh #define I82579_LPI_CTRL BME1000_REG(772, 20)
150 1.13 msaitoh #define I82579_LPI_CTRL_ENABLE __BITS(14, 13)
151 1.13 msaitoh #define I82579_LPI_CTRL_EN_100 __BIT(13)
152 1.13 msaitoh #define I82579_LPI_CTRL_EN_1000 __BIT(14)
153 1.13 msaitoh
154 1.13 msaitoh #define I217_MEMPWR BME1000_REG(772, 26)
155 1.13 msaitoh #define I217_MEMPWR_DISABLE_SMB_RELEASE 0x0010
156 1.13 msaitoh
157 1.13 msaitoh #define I217_CFGREG BME1000_REG(772, 29)
158 1.13 msaitoh #define I217_CGFREG_ENABLE_MTA_RESET 0x0002
159 1.13 msaitoh
160 1.1 msaitoh #define HV_MUX_DATA_CTRL BME1000_REG(776, 16)
161 1.1 msaitoh #define HV_MUX_DATA_CTRL_FORCE_SPEED (1 << 2)
162 1.1 msaitoh #define HV_MUX_DATA_CTRL_GEN_TO_MAC (1 << 10)
163 1.1 msaitoh
164 1.9 msaitoh #define I218_ULP_CONFIG1 BME1000_REG(779, 16)
165 1.9 msaitoh #define I218_ULP_CONFIG1_START __BIT(0)
166 1.9 msaitoh #define I218_ULP_CONFIG1_IND __BIT(2)
167 1.9 msaitoh #define I218_ULP_CONFIG1_STICKY_ULP __BIT(4)
168 1.9 msaitoh #define I218_ULP_CONFIG1_INBAND_EXIT __BIT(5)
169 1.9 msaitoh #define I218_ULP_CONFIG1_WOL_HOST __BIT(6)
170 1.9 msaitoh #define I218_ULP_CONFIG1_RESET_TO_SMBUS __BIT(8)
171 1.9 msaitoh #define I218_ULP_CONFIG1_EN_ULP_LANPHYPC __BIT(10)
172 1.9 msaitoh #define I218_ULP_CONFIG1_DIS_CLR_STICKY_ON_PERST __BIT(11)
173 1.9 msaitoh #define I218_ULP_CONFIG1_DIS_SMB_PERST __BIT(12)
174 1.9 msaitoh
175 1.1 msaitoh #define BM_WUC_PAGE 800
176 1.15 msaitoh
177 1.15 msaitoh #define BM_RCTL BME1000_REG(BM_WUC_PAGE, 0)
178 1.15 msaitoh #define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */
179 1.15 msaitoh #define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */
180 1.15 msaitoh #define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */
181 1.15 msaitoh #define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */
182 1.15 msaitoh #define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */
183 1.15 msaitoh #define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */
184 1.15 msaitoh #define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */
185 1.15 msaitoh
186 1.1 msaitoh #define BM_WUC BME1000_REG(BM_WUC_PAGE, 1)
187 1.1 msaitoh #define BM_WUC_ADDRESS_OPCODE 0x11
188 1.1 msaitoh #define BM_WUC_DATA_OPCODE 0x12
189 1.1 msaitoh #define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE
190 1.1 msaitoh #define BM_WUC_ENABLE_REG 17
191 1.1 msaitoh #define BM_WUC_ENABLE_BIT (1 << 2)
192 1.1 msaitoh #define BM_WUC_HOST_WU_BIT (1 << 4)
193 1.8 msaitoh #define BM_WUC_ME_WU_BIT (1 << 5)
194 1.1 msaitoh
195 1.15 msaitoh #define BM_WUFC BME1000_REG(BM_WUC_PAGE, 2)
196 1.15 msaitoh
197 1.13 msaitoh #define I217_PROXY_CTRL BME1000_REG(BM_WUC_PAGE, 70)
198 1.13 msaitoh #define I217_PROXY_CTRL_AUTO_DISABLE 0x0080
199 1.15 msaitoh
200 1.15 msaitoh #define BM_RAR_L(_i) (BME1000_REG(BM_WUC_PAGE, 16 + ((_i) << 2)))
201 1.15 msaitoh #define BM_RAR_M(_i) (BME1000_REG(BM_WUC_PAGE, 17 + ((_i) << 2)))
202 1.15 msaitoh #define BM_RAR_H(_i) (BME1000_REG(BM_WUC_PAGE, 18 + ((_i) << 2)))
203 1.15 msaitoh #define BM_RAR_CTRL(_i) (BME1000_REG(BM_WUC_PAGE, 19 + ((_i) << 2)))
204 1.15 msaitoh #define BM_MTA(_i) (BME1000_REG(BM_WUC_PAGE, 128 + ((_i) << 1)))
205 1.15 msaitoh
206 1.1 msaitoh #endif /* _DEV_MII_INBMPHYREG_H_ */
207