1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef __DWMAC1000_H__
19#define __DWMAC1000_H__
20
21#include <linux/phy.h>
22#include "common.h"
23
24#define GMAC_CONTROL 0x00000000
25#define GMAC_FRAME_FILTER 0x00000004
26#define GMAC_HASH_HIGH 0x00000008
27#define GMAC_HASH_LOW 0x0000000c
28#define GMAC_MII_ADDR 0x00000010
29#define GMAC_MII_DATA 0x00000014
30#define GMAC_FLOW_CTRL 0x00000018
31#define GMAC_VLAN_TAG 0x0000001c
32#define GMAC_DEBUG 0x00000024
33#define GMAC_WAKEUP_FILTER 0x00000028
34
35#define GMAC_INT_STATUS 0x00000038
36#define GMAC_INT_STATUS_PMT BIT(3)
37#define GMAC_INT_STATUS_MMCIS BIT(4)
38#define GMAC_INT_STATUS_MMCRIS BIT(5)
39#define GMAC_INT_STATUS_MMCTIS BIT(6)
40#define GMAC_INT_STATUS_MMCCSUM BIT(7)
41#define GMAC_INT_STATUS_TSTAMP BIT(9)
42#define GMAC_INT_STATUS_LPIIS BIT(10)
43
44
45#define GMAC_INT_MASK 0x0000003c
46#define GMAC_INT_DISABLE_RGMII BIT(0)
47#define GMAC_INT_DISABLE_PCSLINK BIT(1)
48#define GMAC_INT_DISABLE_PCSAN BIT(2)
49#define GMAC_INT_DISABLE_PMT BIT(3)
50#define GMAC_INT_DISABLE_TIMESTAMP BIT(9)
51#define GMAC_INT_DISABLE_PCS (GMAC_INT_DISABLE_RGMII | \
52 GMAC_INT_DISABLE_PCSLINK | \
53 GMAC_INT_DISABLE_PCSAN)
54#define GMAC_INT_DEFAULT_MASK (GMAC_INT_DISABLE_TIMESTAMP | \
55 GMAC_INT_DISABLE_PCS)
56
57
58#define GMAC_PMT 0x0000002c
59enum power_event {
60 pointer_reset = 0x80000000,
61 global_unicast = 0x00000200,
62 wake_up_rx_frame = 0x00000040,
63 magic_frame = 0x00000020,
64 wake_up_frame_en = 0x00000004,
65 magic_pkt_en = 0x00000002,
66 power_down = 0x00000001,
67};
68
69
70
71
72
73#define LPI_CTRL_STATUS 0x0030
74#define LPI_TIMER_CTRL 0x0034
75
76
77#define LPI_CTRL_STATUS_LPITXA 0x00080000
78#define LPI_CTRL_STATUS_PLSEN 0x00040000
79#define LPI_CTRL_STATUS_PLS 0x00020000
80#define LPI_CTRL_STATUS_LPIEN 0x00010000
81#define LPI_CTRL_STATUS_RLPIST 0x00000200
82#define LPI_CTRL_STATUS_TLPIST 0x00000100
83#define LPI_CTRL_STATUS_RLPIEX 0x00000008
84#define LPI_CTRL_STATUS_RLPIEN 0x00000004
85#define LPI_CTRL_STATUS_TLPIEX 0x00000002
86#define LPI_CTRL_STATUS_TLPIEN 0x00000001
87
88
89#define GMAC_ADDR_HIGH(reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \
90 (reg * 8))
91#define GMAC_ADDR_LOW(reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \
92 (reg * 8))
93#define GMAC_MAX_PERFECT_ADDRESSES 1
94
95#define GMAC_PCS_BASE 0x000000c0
96#define GMAC_RGSMIIIS 0x000000d8
97
98
99#define GMAC_RGSMIIIS_LNKMODE BIT(0)
100#define GMAC_RGSMIIIS_SPEED GENMASK(2, 1)
101#define GMAC_RGSMIIIS_SPEED_SHIFT 1
102#define GMAC_RGSMIIIS_LNKSTS BIT(3)
103#define GMAC_RGSMIIIS_JABTO BIT(4)
104#define GMAC_RGSMIIIS_FALSECARDET BIT(5)
105#define GMAC_RGSMIIIS_SMIDRXS BIT(16)
106
107#define GMAC_RGSMIIIS_LNKMOD_MASK 0x1
108
109#define GMAC_RGSMIIIS_SPEED_125 0x2
110#define GMAC_RGSMIIIS_SPEED_25 0x1
111#define GMAC_RGSMIIIS_SPEED_2_5 0x0
112
113
114#define GMAC_CONTROL_2K 0x08000000
115#define GMAC_CONTROL_TC 0x01000000
116#define GMAC_CONTROL_WD 0x00800000
117#define GMAC_CONTROL_JD 0x00400000
118#define GMAC_CONTROL_BE 0x00200000
119#define GMAC_CONTROL_JE 0x00100000
120enum inter_frame_gap {
121 GMAC_CONTROL_IFG_88 = 0x00040000,
122 GMAC_CONTROL_IFG_80 = 0x00020000,
123 GMAC_CONTROL_IFG_40 = 0x000e0000,
124};
125#define GMAC_CONTROL_DCRS 0x00010000
126#define GMAC_CONTROL_PS 0x00008000
127#define GMAC_CONTROL_FES 0x00004000
128#define GMAC_CONTROL_DO 0x00002000
129#define GMAC_CONTROL_LM 0x00001000
130#define GMAC_CONTROL_DM 0x00000800
131#define GMAC_CONTROL_IPC 0x00000400
132#define GMAC_CONTROL_DR 0x00000200
133#define GMAC_CONTROL_LUD 0x00000100
134#define GMAC_CONTROL_ACS 0x00000080
135#define GMAC_CONTROL_DC 0x00000010
136#define GMAC_CONTROL_TE 0x00000008
137#define GMAC_CONTROL_RE 0x00000004
138
139#define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \
140 GMAC_CONTROL_BE | GMAC_CONTROL_DCRS)
141
142
143#define GMAC_FRAME_FILTER_PR 0x00000001
144#define GMAC_FRAME_FILTER_HUC 0x00000002
145#define GMAC_FRAME_FILTER_HMC 0x00000004
146#define GMAC_FRAME_FILTER_DAIF 0x00000008
147#define GMAC_FRAME_FILTER_PM 0x00000010
148#define GMAC_FRAME_FILTER_DBF 0x00000020
149#define GMAC_FRAME_FILTER_SAIF 0x00000100
150#define GMAC_FRAME_FILTER_SAF 0x00000200
151#define GMAC_FRAME_FILTER_HPF 0x00000400
152#define GMAC_FRAME_FILTER_RA 0x80000000
153
154#define GMAC_MII_ADDR_WRITE 0x00000002
155#define GMAC_MII_ADDR_BUSY 0x00000001
156
157#define GMAC_FLOW_CTRL_PT_MASK 0xffff0000
158#define GMAC_FLOW_CTRL_PT_SHIFT 16
159#define GMAC_FLOW_CTRL_UP 0x00000008
160#define GMAC_FLOW_CTRL_RFE 0x00000004
161#define GMAC_FLOW_CTRL_TFE 0x00000002
162#define GMAC_FLOW_CTRL_FCB_BPA 0x00000001
163
164
165
166#define GMAC_DEBUG_TXSTSFSTS BIT(25)
167#define GMAC_DEBUG_TXFSTS BIT(24)
168#define GMAC_DEBUG_TWCSTS BIT(22)
169
170#define GMAC_DEBUG_TRCSTS_MASK GENMASK(21, 20)
171#define GMAC_DEBUG_TRCSTS_SHIFT 20
172#define GMAC_DEBUG_TRCSTS_IDLE 0
173#define GMAC_DEBUG_TRCSTS_READ 1
174#define GMAC_DEBUG_TRCSTS_TXW 2
175#define GMAC_DEBUG_TRCSTS_WRITE 3
176#define GMAC_DEBUG_TXPAUSED BIT(19)
177
178#define GMAC_DEBUG_TFCSTS_MASK GENMASK(18, 17)
179#define GMAC_DEBUG_TFCSTS_SHIFT 17
180#define GMAC_DEBUG_TFCSTS_IDLE 0
181#define GMAC_DEBUG_TFCSTS_WAIT 1
182#define GMAC_DEBUG_TFCSTS_GEN_PAUSE 2
183#define GMAC_DEBUG_TFCSTS_XFER 3
184
185#define GMAC_DEBUG_TPESTS BIT(16)
186#define GMAC_DEBUG_RXFSTS_MASK GENMASK(9, 8)
187#define GMAC_DEBUG_RXFSTS_SHIFT 8
188#define GMAC_DEBUG_RXFSTS_EMPTY 0
189#define GMAC_DEBUG_RXFSTS_BT 1
190#define GMAC_DEBUG_RXFSTS_AT 2
191#define GMAC_DEBUG_RXFSTS_FULL 3
192#define GMAC_DEBUG_RRCSTS_MASK GENMASK(6, 5)
193#define GMAC_DEBUG_RRCSTS_SHIFT 5
194#define GMAC_DEBUG_RRCSTS_IDLE 0
195#define GMAC_DEBUG_RRCSTS_RDATA 1
196#define GMAC_DEBUG_RRCSTS_RSTAT 2
197#define GMAC_DEBUG_RRCSTS_FLUSH 3
198#define GMAC_DEBUG_RWCSTS BIT(4)
199
200#define GMAC_DEBUG_RFCFCSTS_MASK GENMASK(2, 1)
201#define GMAC_DEBUG_RFCFCSTS_SHIFT 1
202
203#define GMAC_DEBUG_RPESTS BIT(0)
204
205
206
207#define DMA_BUS_MODE_DA 0x00000002
208#define DMA_BUS_MODE_DSL_MASK 0x0000007c
209#define DMA_BUS_MODE_DSL_SHIFT 2
210
211#define DMA_BUS_MODE_PBL_MASK 0x00003f00
212#define DMA_BUS_MODE_PBL_SHIFT 8
213#define DMA_BUS_MODE_ATDS 0x00000080
214
215enum rx_tx_priority_ratio {
216 double_ratio = 0x00004000,
217 triple_ratio = 0x00008000,
218 quadruple_ratio = 0x0000c000,
219};
220
221#define DMA_BUS_MODE_FB 0x00010000
222#define DMA_BUS_MODE_MB 0x04000000
223#define DMA_BUS_MODE_RPBL_MASK 0x007e0000
224#define DMA_BUS_MODE_RPBL_SHIFT 17
225#define DMA_BUS_MODE_USP 0x00800000
226#define DMA_BUS_MODE_MAXPBL 0x01000000
227#define DMA_BUS_MODE_AAL 0x02000000
228
229
230#define DMA_HOST_TX_DESC 0x00001048
231#define DMA_HOST_RX_DESC 0x0000104c
232
233#define DMA_BUS_PR_RATIO_MASK 0x0000c000
234#define DMA_BUS_PR_RATIO_SHIFT 14
235#define DMA_BUS_FB 0x00010000
236
237
238
239#define DMA_CONTROL_DT 0x04000000
240#define DMA_CONTROL_RSF 0x02000000
241#define DMA_CONTROL_DFF 0x01000000
242
243enum rfa {
244 act_full_minus_1 = 0x00800000,
245 act_full_minus_2 = 0x00800200,
246 act_full_minus_3 = 0x00800400,
247 act_full_minus_4 = 0x00800600,
248};
249
250enum rfd {
251 deac_full_minus_1 = 0x00400000,
252 deac_full_minus_2 = 0x00400800,
253 deac_full_minus_3 = 0x00401000,
254 deac_full_minus_4 = 0x00401800,
255};
256#define DMA_CONTROL_TSF 0x00200000
257
258enum ttc_control {
259 DMA_CONTROL_TTC_64 = 0x00000000,
260 DMA_CONTROL_TTC_128 = 0x00004000,
261 DMA_CONTROL_TTC_192 = 0x00008000,
262 DMA_CONTROL_TTC_256 = 0x0000c000,
263 DMA_CONTROL_TTC_40 = 0x00010000,
264 DMA_CONTROL_TTC_32 = 0x00014000,
265 DMA_CONTROL_TTC_24 = 0x00018000,
266 DMA_CONTROL_TTC_16 = 0x0001c000,
267};
268#define DMA_CONTROL_TC_TX_MASK 0xfffe3fff
269
270#define DMA_CONTROL_EFC 0x00000100
271#define DMA_CONTROL_FEF 0x00000080
272#define DMA_CONTROL_FUF 0x00000040
273
274
275
276
277#define DMA_CONTROL_RFA_MASK 0x00800600
278
279
280
281
282#define DMA_CONTROL_RFD_MASK 0x00401800
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308#define RFA_FULL_MINUS_1K 0x00000000
309#define RFA_FULL_MINUS_2K 0x00000200
310#define RFA_FULL_MINUS_3K 0x00000400
311#define RFA_FULL_MINUS_4K 0x00000600
312#define RFA_FULL_MINUS_5K 0x00800000
313#define RFA_FULL_MINUS_6K 0x00800200
314#define RFA_FULL_MINUS_7K 0x00800400
315
316#define RFD_FULL_MINUS_1K 0x00000000
317#define RFD_FULL_MINUS_2K 0x00000800
318#define RFD_FULL_MINUS_3K 0x00001000
319#define RFD_FULL_MINUS_4K 0x00001800
320#define RFD_FULL_MINUS_5K 0x00400000
321#define RFD_FULL_MINUS_6K 0x00400800
322#define RFD_FULL_MINUS_7K 0x00401000
323
324enum rtc_control {
325 DMA_CONTROL_RTC_64 = 0x00000000,
326 DMA_CONTROL_RTC_32 = 0x00000008,
327 DMA_CONTROL_RTC_96 = 0x00000010,
328 DMA_CONTROL_RTC_128 = 0x00000018,
329};
330#define DMA_CONTROL_TC_RX_MASK 0xffffffe7
331
332#define DMA_CONTROL_OSF 0x00000004
333
334
335#define GMAC_MMC_CTRL 0x100
336#define GMAC_MMC_RX_INTR 0x104
337#define GMAC_MMC_TX_INTR 0x108
338#define GMAC_MMC_RX_CSUM_OFFLOAD 0x208
339#define GMAC_EXTHASH_BASE 0x500
340
341extern const struct stmmac_dma_ops dwmac1000_dma_ops;
342#endif
343