Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / gmac_core.h
blob8c45cde07191f9c9a5fa6c3d270160ed8137ee35
1 /*
2 * gmacdefs - Broadcom gmac (Unimac) specific definitions
4 * Copyright (C) 2010, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
11 * $Id: gmac_core.h,v 13.4 2009-03-13 22:43:20 Exp $
14 #ifndef _gmac_core_h_
15 #define _gmac_core_h_
18 /* cpp contortions to concatenate w/arg prescan */
19 #ifndef PAD
20 #define _PADLINE(line) pad ## line
21 #define _XSTR(line) _PADLINE(line)
22 #define PAD _XSTR(__LINE__)
23 #endif /* PAD */
25 /* We have 4 DMA TX channels */
26 #define GMAC_NUM_DMA_TX 4
28 typedef volatile struct {
29 dma64regs_t dmaxmt; /* dma tx */
30 uint32 PAD[2];
31 dma64regs_t dmarcv; /* dma rx */
32 uint32 PAD[2];
33 } dma64_t;
36 * Host Interface Registers
38 typedef volatile struct _gmacregs {
39 uint32 devcontrol; /* 0x000 */
40 uint32 devstatus; /* 0x004 */
41 uint32 PAD;
42 uint32 biststatus; /* 0x00c */
43 uint32 PAD[4];
44 uint32 intstatus; /* 0x020 */
45 uint32 intmask; /* 0x024 */
46 uint32 gptimer; /* 0x028 */
47 uint32 PAD[53];
48 uint32 intrecvlazy; /* 0x100 */
49 uint32 flowctlthresh; /* 0x104 */
50 uint32 wrrthresh; /* 0x108 */
51 uint32 gmac_idle_cnt_thresh; /* 0x10c */
52 uint32 PAD[28];
53 uint32 phyaccess; /* 0x180 */
54 uint32 PAD;
55 uint32 phycontrol; /* 0x188 */
56 uint32 txqctl; /* 0x18c */
57 uint32 rxqctl; /* 0x190 */
58 uint32 gpioselect; /* 0x194 */
59 uint32 gpio_output_en; /* 0x198 */
60 uint32 PAD[17];
61 uint32 clk_ctl_st; /* 0x1e0 */
62 uint32 hw_war; /* 0x1e4 */
63 uint32 pwrctl; /* 0x1e8 */
64 uint32 PAD[5];
66 dma64_t dmaregs[GMAC_NUM_DMA_TX];
68 /* GAMC MIB counters */
69 gmacmib_t mib;
70 uint32 PAD[245];
72 uint32 unimacversion; /* 0x800 */
73 uint32 hdbkpctl; /* 0x804 */
74 uint32 cmdcfg; /* 0x808 */
75 uint32 macaddrhigh; /* 0x80c */
76 uint32 macaddrlow; /* 0x810 */
77 uint32 rxmaxlength; /* 0x814 */
78 uint32 pausequanta; /* 0x818 */
79 uint32 PAD[10];
80 uint32 macmode; /* 0x844 */
81 uint32 outertag; /* 0x848 */
82 uint32 innertag; /* 0x84c */
83 uint32 PAD[3];
84 uint32 txipg; /* 0x85c */
85 uint32 PAD[180];
86 uint32 pausectl; /* 0xb30 */
87 uint32 txflush; /* 0xb34 */
88 uint32 rxstatus; /* 0xb38 */
89 uint32 txstatus; /* 0xb3c */
90 } gmacregs_t;
92 #define GM_MIB_BASE 0x300
93 #define GM_MIB_LIMIT 0x800
96 * register-specific flag definitions
99 /* device control */
100 #define DC_TSM 0x00000002
101 #define DC_CFCO 0x00000004
102 #define DC_RLSS 0x00000008
103 #define DC_MROR 0x00000010
104 #define DC_FCM_MASK 0x00000060
105 #define DC_FCM_SHIFT 5
106 #define DC_NAE 0x00000080
107 #define DC_TF 0x00000100
108 #define DC_RDS_MASK 0x00030000
109 #define DC_RDS_SHIFT 16
110 #define DC_TDS_MASK 0x000c0000
111 #define DC_TDS_SHIFT 18
113 /* device status */
114 #define DS_RBF 0x00000001
115 #define DS_RDF 0x00000002
116 #define DS_RIF 0x00000004
117 #define DS_TBF 0x00000008
118 #define DS_TDF 0x00000010
119 #define DS_TIF 0x00000020
120 #define DS_PO 0x00000040
121 #define DS_MM_MASK 0x00000300
122 #define DS_MM_SHIFT 8
124 /* bist status */
125 #define BS_MTF 0x00000001
126 #define BS_MRF 0x00000002
127 #define BS_TDB 0x00000004
128 #define BS_TIB 0x00000008
129 #define BS_TBF 0x00000010
130 #define BS_RDB 0x00000020
131 #define BS_RIB 0x00000040
132 #define BS_RBF 0x00000080
133 #define BS_URTF 0x00000100
134 #define BS_UTF 0x00000200
135 #define BS_URF 0x00000400
137 /* interrupt status and mask registers */
138 #define I_MRO 0x00000001
139 #define I_MTO 0x00000002
140 #define I_TFD 0x00000004
141 #define I_LS 0x00000008
142 #define I_MDIO 0x00000010
143 #define I_MR 0x00000020
144 #define I_MT 0x00000040
145 #define I_TO 0x00000080
146 #define I_PDEE 0x00000400
147 #define I_PDE 0x00000800
148 #define I_DE 0x00001000
149 #define I_RDU 0x00002000
150 #define I_RFO 0x00004000
151 #define I_XFU 0x00008000
152 #define I_RI 0x00010000
153 #define I_XI0 0x01000000
154 #define I_XI1 0x02000000
155 #define I_XI2 0x04000000
156 #define I_XI3 0x08000000
157 #define I_INTMASK 0x0f01fcff
158 #define I_ERRMASK 0x0000fc00
160 /* interrupt receive lazy */
161 #define IRL_TO_MASK 0x00ffffff
162 #define IRL_FC_MASK 0xff000000
163 #define IRL_FC_SHIFT 24
165 /* flow control thresholds */
166 #define FCT_TT_MASK 0x00000fff
167 #define FCT_RT_MASK 0x0fff0000
168 #define FCT_RT_SHIFT 16
170 /* txq aribter wrr thresholds */
171 #define WRRT_Q0T_MASK 0x000000ff
172 #define WRRT_Q1T_MASK 0x0000ff00
173 #define WRRT_Q1T_SHIFT 8
174 #define WRRT_Q2T_MASK 0x00ff0000
175 #define WRRT_Q2T_SHIFT 16
176 #define WRRT_Q3T_MASK 0xff000000
177 #define WRRT_Q3T_SHIFT 24
179 /* phy access */
180 #define PA_DATA_MASK 0x0000ffff
181 #define PA_ADDR_MASK 0x001f0000
182 #define PA_ADDR_SHIFT 16
183 #define PA_REG_MASK 0x1f000000
184 #define PA_REG_SHIFT 24
185 #define PA_WRITE 0x20000000
186 #define PA_START 0x40000000
188 /* phy control */
189 #define PC_EPA_MASK 0x0000001f
190 #define PC_MCT_MASK 0x007f0000
191 #define PC_MCT_SHIFT 16
192 #define PC_MTE 0x00800000
194 /* rxq control */
195 #define RC_DBT_MASK 0x00000fff
196 #define RC_DBT_SHIFT 0
197 #define RC_PTE 0x00001000
198 #define RC_MDP_MASK 0x3f000000
199 #define RC_MDP_SHIFT 24
201 #define RC_MAC_DATA_PERIOD 9
203 /* txq control */
204 #define TC_DBT_MASK 0x00000fff
205 #define TC_DBT_SHIFT 0
207 /* gpio select */
208 #define GS_GSC_MASK 0x0000000f
209 #define GS_GSC_SHIFT 0
211 /* gpio output enable */
212 #define GS_GOE_MASK 0x0000ffff
213 #define GS_GOE_SHIFT 0
215 /* clk control status */
216 #define CS_FA 0x00000001
217 #define CS_FH 0x00000002
218 #define CS_FI 0x00000004
219 #define CS_AQ 0x00000008
220 #define CS_HQ 0x00000010
221 #define CS_FC 0x00000020
222 #define CS_ER 0x00000100
223 #define CS_AA 0x00010000
224 #define CS_HA 0x00020000
225 #define CS_BA 0x00040000
226 #define CS_BH 0x00080000
227 #define CS_ES 0x01000000
229 /* command config */
230 #define CC_TE 0x00000001
231 #define CC_RE 0x00000002
232 #define CC_ES_MASK 0x0000000c
233 #define CC_ES_SHIFT 2
234 #define CC_PROM 0x00000010
235 #define CC_PAD_EN 0x00000020
236 #define CC_CF 0x00000040
237 #define CC_PF 0x00000080
238 #define CC_RPI 0x00000100
239 #define CC_TAI 0x00000200
240 #define CC_HD 0x00000400
241 #define CC_HD_SHIFT 10
242 #define CC_SR 0x00000800
243 #define CC_ML 0x00008000
244 #define CC_AE 0x00400000
245 #define CC_CFE 0x00800000
246 #define CC_NLC 0x01000000
247 #define CC_RL 0x02000000
248 #define CC_RED 0x04000000
249 #define CC_PE 0x08000000
250 #define CC_TPI 0x10000000
251 #define CC_AT 0x20000000
253 /* mac addr high */
254 #define MH_HI_MASK 0xffff
255 #define MH_HI_SHIFT 16
256 #define MH_MID_MASK 0xffff
257 #define MH_MID_SHIFT 0
259 /* mac addr low */
260 #define ML_LO_MASK 0xffff
261 #define ML_LO_SHIFT 0
263 /* Core specific control flags */
264 #define SICF_SWCLKE 0x0004
265 #define SICF_SWRST 0x0008
267 /* Core specific status flags */
268 #define SISF_SW_ATTACHED 0x0800
270 #endif /* _gmac_core_h_ */