]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/dwc/if_dwc.h
MFV r285970:
[FreeBSD/FreeBSD.git] / sys / dev / dwc / if_dwc.h
1 /*-
2  * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
3  * All rights reserved.
4  *
5  * This software was developed by SRI International and the University of
6  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7  * ("CTSRD"), as part of the DARPA CRASH research programme.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * $FreeBSD$
31  */
32
33 /*
34  * Register names were taken almost as is from the documentation.
35  */
36
37 #define MAC_CONFIGURATION       0x0
38 #define  CONF_JD                (1 << 22)       /* jabber timer disable */
39 #define  CONF_BE                (1 << 21)       /* Frame Burst Enable */
40 #define  CONF_PS                (1 << 15)       /* GMII/MII */
41 #define  CONF_FES               (1 << 14)       /* MII speed select */
42 #define  CONF_DM                (1 << 11)       /* Full Duplex Enable */
43 #define  CONF_ACS               (1 << 7)
44 #define  CONF_TE                (1 << 3)
45 #define  CONF_RE                (1 << 2)
46 #define MAC_FRAME_FILTER        0x4
47 #define  FRAME_FILTER_RA        (1U << 31)      /* Receive All */
48 #define  FRAME_FILTER_HPF       (1 << 10)       /* Hash or Perfect Filter */
49 #define  FRAME_FILTER_PM        (1 << 4)        /* Pass multicast */
50 #define  FRAME_FILTER_HMC       (1 << 2)
51 #define  FRAME_FILTER_HUC       (1 << 1)
52 #define  FRAME_FILTER_PR        (1 << 0)        /* All Incoming Frames */
53 #define GMII_ADDRESS            0x10
54 #define  GMII_ADDRESS_PA_MASK   0x1f            /* Phy device */
55 #define  GMII_ADDRESS_PA_SHIFT  11
56 #define  GMII_ADDRESS_GR_MASK   0x1f            /* Phy register */
57 #define  GMII_ADDRESS_GR_SHIFT  6
58 #define  GMII_ADDRESS_CR_MASK   0xf
59 #define  GMII_ADDRESS_CR_SHIFT  2               /* Clock */
60 #define  GMII_ADDRESS_GW        (1 << 1)        /* Write operation */
61 #define  GMII_ADDRESS_GB        (1 << 0)        /* Busy */
62 #define GMII_DATA               0x14
63 #define FLOW_CONTROL            0x18
64 #define GMAC_VLAN_TAG           0x1C
65 #define VERSION                 0x20
66 #define DEBUG                   0x24
67 #define LPI_CONTROL_STATUS      0x30
68 #define LPI_TIMERS_CONTROL      0x34
69 #define INTERRUPT_STATUS        0x38
70 #define INTERRUPT_MASK          0x3C
71 #define MAC_ADDRESS_HIGH(n)     ((n > 15 ? 0x800 : 0x40) + 0x8 * n)
72 #define MAC_ADDRESS_LOW(n)      ((n > 15 ? 0x804 : 0x44) + 0x8 * n)
73
74 #define SGMII_RGMII_SMII_CTRL_STATUS    0xD8
75 #define MMC_CONTROL                     0x100
76 #define  MMC_CONTROL_CNTRST             (1 << 0)
77 #define MMC_RECEIVE_INTERRUPT           0x104
78 #define MMC_TRANSMIT_INTERRUPT          0x108
79 #define MMC_RECEIVE_INTERRUPT_MASK      0x10C
80 #define MMC_TRANSMIT_INTERRUPT_MASK     0x110
81 #define TXOCTETCOUNT_GB                 0x114
82 #define TXFRAMECOUNT_GB                 0x118
83 #define TXBROADCASTFRAMES_G             0x11C
84 #define TXMULTICASTFRAMES_G             0x120
85 #define TX64OCTETS_GB                   0x124
86 #define TX65TO127OCTETS_GB              0x128
87 #define TX128TO255OCTETS_GB             0x12C
88 #define TX256TO511OCTETS_GB             0x130
89 #define TX512TO1023OCTETS_GB            0x134
90 #define TX1024TOMAXOCTETS_GB            0x138
91 #define TXUNICASTFRAMES_GB              0x13C
92 #define TXMULTICASTFRAMES_GB            0x140
93 #define TXBROADCASTFRAMES_GB            0x144
94 #define TXUNDERFLOWERROR                0x148
95 #define TXSINGLECOL_G                   0x14C
96 #define TXMULTICOL_G                    0x150
97 #define TXDEFERRED                      0x154
98 #define TXLATECOL                       0x158
99 #define TXEXESSCOL                      0x15C
100 #define TXCARRIERERR                    0x160
101 #define TXOCTETCNT                      0x164
102 #define TXFRAMECOUNT_G                  0x168
103 #define TXEXCESSDEF                     0x16C
104 #define TXPAUSEFRAMES                   0x170
105 #define TXVLANFRAMES_G                  0x174
106 #define TXOVERSIZE_G                    0x178
107 #define RXFRAMECOUNT_GB                 0x180
108 #define RXOCTETCOUNT_GB                 0x184
109 #define RXOCTETCOUNT_G                  0x188
110 #define RXBROADCASTFRAMES_G             0x18C
111 #define RXMULTICASTFRAMES_G             0x190
112 #define RXCRCERROR                      0x194
113 #define RXALIGNMENTERROR                0x198
114 #define RXRUNTERROR                     0x19C
115 #define RXJABBERERROR                   0x1A0
116 #define RXUNDERSIZE_G                   0x1A4
117 #define RXOVERSIZE_G                    0x1A8
118 #define RX64OCTETS_GB                   0x1AC
119 #define RX65TO127OCTETS_GB              0x1B0
120 #define RX128TO255OCTETS_GB             0x1B4
121 #define RX256TO511OCTETS_GB             0x1B8
122 #define RX512TO1023OCTETS_GB            0x1BC
123 #define RX1024TOMAXOCTETS_GB            0x1C0
124 #define RXUNICASTFRAMES_G               0x1C4
125 #define RXLENGTHERROR                   0x1C8
126 #define RXOUTOFRANGETYPE                0x1CC
127 #define RXPAUSEFRAMES                   0x1D0
128 #define RXFIFOOVERFLOW                  0x1D4
129 #define RXVLANFRAMES_GB                 0x1D8
130 #define RXWATCHDOGERROR                 0x1DC
131 #define RXRCVERROR                      0x1E0
132 #define RXCTRLFRAMES_G                  0x1E4
133 #define MMC_IPC_RECEIVE_INT_MASK        0x200
134 #define MMC_IPC_RECEIVE_INT             0x208
135 #define RXIPV4_GD_FRMS                  0x210
136 #define RXIPV4_HDRERR_FRMS              0x214
137 #define RXIPV4_NOPAY_FRMS               0x218
138 #define RXIPV4_FRAG_FRMS                0x21C
139 #define RXIPV4_UDSBL_FRMS               0x220
140 #define RXIPV6_GD_FRMS                  0x224
141 #define RXIPV6_HDRERR_FRMS              0x228
142 #define RXIPV6_NOPAY_FRMS               0x22C
143 #define RXUDP_GD_FRMS                   0x230
144 #define RXUDP_ERR_FRMS                  0x234
145 #define RXTCP_GD_FRMS                   0x238
146 #define RXTCP_ERR_FRMS                  0x23C
147 #define RXICMP_GD_FRMS                  0x240
148 #define RXICMP_ERR_FRMS                 0x244
149 #define RXIPV4_GD_OCTETS                0x250
150 #define RXIPV4_HDRERR_OCTETS            0x254
151 #define RXIPV4_NOPAY_OCTETS             0x258
152 #define RXIPV4_FRAG_OCTETS              0x25C
153 #define RXIPV4_UDSBL_OCTETS             0x260
154 #define RXIPV6_GD_OCTETS                0x264
155 #define RXIPV6_HDRERR_OCTETS            0x268
156 #define RXIPV6_NOPAY_OCTETS             0x26C
157 #define RXUDP_GD_OCTETS                 0x270
158 #define RXUDP_ERR_OCTETS                0x274
159 #define RXTCP_GD_OCTETS                 0x278
160 #define RXTCPERROCTETS                  0x27C
161 #define RXICMP_GD_OCTETS                0x280
162 #define RXICMP_ERR_OCTETS               0x284
163 #define L3_L4_CONTROL0                  0x400
164 #define LAYER4_ADDRESS0                 0x404
165 #define LAYER3_ADDR0_REG0               0x410
166 #define LAYER3_ADDR1_REG0               0x414
167 #define LAYER3_ADDR2_REG0               0x418
168 #define LAYER3_ADDR3_REG0               0x41C
169 #define L3_L4_CONTROL1                  0x430
170 #define LAYER4_ADDRESS1                 0x434
171 #define LAYER3_ADDR0_REG1               0x440
172 #define LAYER3_ADDR1_REG1               0x444
173 #define LAYER3_ADDR2_REG1               0x448
174 #define LAYER3_ADDR3_REG1               0x44C
175 #define L3_L4_CONTROL2                  0x460
176 #define LAYER4_ADDRESS2                 0x464
177 #define LAYER3_ADDR0_REG2               0x470
178 #define LAYER3_ADDR1_REG2               0x474
179 #define LAYER3_ADDR2_REG2               0x478
180 #define LAYER3_ADDR3_REG2               0x47C
181 #define L3_L4_CONTROL3                  0x490
182 #define LAYER4_ADDRESS3                 0x494
183 #define LAYER3_ADDR0_REG3               0x4A0
184 #define LAYER3_ADDR1_REG3               0x4A4
185 #define LAYER3_ADDR2_REG3               0x4A8
186 #define LAYER3_ADDR3_REG3               0x4AC
187 #define HASH_TABLE_REG(n)               0x500 + (0x4 * n)
188 #define VLAN_INCL_REG                   0x584
189 #define VLAN_HASH_TABLE_REG             0x588
190 #define TIMESTAMP_CONTROL               0x700
191 #define SUB_SECOND_INCREMENT            0x704
192 #define SYSTEM_TIME_SECONDS             0x708
193 #define SYSTEM_TIME_NANOSECONDS         0x70C
194 #define SYSTEM_TIME_SECONDS_UPDATE      0x710
195 #define SYSTEM_TIME_NANOSECONDS_UPDATE  0x714
196 #define TIMESTAMP_ADDEND                0x718
197 #define TARGET_TIME_SECONDS             0x71C
198 #define TARGET_TIME_NANOSECONDS         0x720
199 #define SYSTEM_TIME_HIGHER_WORD_SECONDS 0x724
200 #define TIMESTAMP_STATUS                0x728
201 #define PPS_CONTROL                     0x72C
202 #define AUXILIARY_TIMESTAMP_NANOSECONDS 0x730
203 #define AUXILIARY_TIMESTAMP_SECONDS     0x734
204 #define PPS0_INTERVAL                   0x760
205 #define PPS0_WIDTH                      0x764
206
207 /* DMA */
208 #define BUS_MODE                0x1000
209 #define  BUS_MODE_EIGHTXPBL     (1 << 24) /* Multiplies PBL by 8 */
210 #define  BUS_MODE_PBL_SHIFT     8 /* Single block transfer size */
211 #define  BUS_MODE_PBL_BEATS_8   8
212 #define  BUS_MODE_SWR           (1 << 0) /* Reset */
213 #define TRANSMIT_POLL_DEMAND    0x1004
214 #define RECEIVE_POLL_DEMAND     0x1008
215 #define RX_DESCR_LIST_ADDR      0x100C
216 #define TX_DESCR_LIST_ADDR      0x1010
217 #define DMA_STATUS              0x1014
218 #define  DMA_STATUS_NIS         (1 << 16)
219 #define  DMA_STATUS_AIS         (1 << 15)
220 #define  DMA_STATUS_FBI         (1 << 13)
221 #define  DMA_STATUS_RI          (1 << 6)
222 #define  DMA_STATUS_TI          (1 << 0)
223 #define  DMA_STATUS_INTR_MASK   0x1ffff
224 #define OPERATION_MODE          0x1018
225 #define  MODE_RSF               (1 << 25) /* RX Full Frame */
226 #define  MODE_TSF               (1 << 21) /* TX Full Frame */
227 #define  MODE_FTF               (1 << 20) /* Flush TX FIFO */
228 #define  MODE_ST                (1 << 13) /* Start DMA TX */
229 #define  MODE_FUF               (1 << 6)  /* TX frames < 64bytes */
230 #define  MODE_RTC_LEV32         0x1
231 #define  MODE_RTC_SHIFT         3
232 #define  MODE_OSF               (1 << 2) /* Process Second frame */
233 #define  MODE_SR                (1 << 1) /* Start DMA RX */
234 #define INTERRUPT_ENABLE        0x101C
235 #define  INT_EN_NIE             (1 << 16) /* Normal/Summary */
236 #define  INT_EN_AIE             (1 << 15) /* Abnormal/Summary */
237 #define  INT_EN_ERE             (1 << 14) /* Early receive */
238 #define  INT_EN_FBE             (1 << 13) /* Fatal bus error */
239 #define  INT_EN_ETE             (1 << 10) /* Early transmit */
240 #define  INT_EN_RWE             (1 << 9)  /* Receive watchdog */
241 #define  INT_EN_RSE             (1 << 8)  /* Receive stopped */
242 #define  INT_EN_RUE             (1 << 7)  /* Recv buf unavailable */
243 #define  INT_EN_RIE             (1 << 6)  /* Receive interrupt */
244 #define  INT_EN_UNE             (1 << 5)  /* Tx underflow */
245 #define  INT_EN_OVE             (1 << 4)  /* Receive overflow */
246 #define  INT_EN_TJE             (1 << 3)  /* Transmit jabber */
247 #define  INT_EN_TUE             (1 << 2)  /* Tx. buf unavailable */
248 #define  INT_EN_TSE             (1 << 1)  /* Transmit stopped */
249 #define  INT_EN_TIE             (1 << 0)  /* Transmit interrupt */
250 #define  INT_EN_DEFAULT         (INT_EN_TIE|INT_EN_RIE| \
251             INT_EN_NIE|INT_EN_AIE|                      \
252             INT_EN_FBE|INT_EN_UNE)
253
254 #define MISSED_FRAMEBUF_OVERFLOW_CNTR   0x1020
255 #define RECEIVE_INT_WATCHDOG_TMR        0x1024
256 #define AXI_BUS_MODE                    0x1028
257 #define AHB_OR_AXI_STATUS               0x102C
258 #define CURRENT_HOST_TRANSMIT_DESCR     0x1048
259 #define CURRENT_HOST_RECEIVE_DESCR      0x104C
260 #define CURRENT_HOST_TRANSMIT_BUF_ADDR  0x1050
261 #define CURRENT_HOST_RECEIVE_BUF_ADDR   0x1054
262 #define HW_FEATURE                      0x1058