diff options
Diffstat (limited to 'drivers/net/ibm_newemac/emac.h')
-rw-r--r-- | drivers/net/ibm_newemac/emac.h | 268 |
1 files changed, 268 insertions, 0 deletions
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h new file mode 100644 index 000000000000..bef92efeeadc --- /dev/null +++ b/drivers/net/ibm_newemac/emac.h | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * drivers/net/ibm_newemac/emac.h | ||
3 | * | ||
4 | * Register definitions for PowerPC 4xx on-chip ethernet contoller | ||
5 | * | ||
6 | * Copyright (c) 2004, 2005 Zultys Technologies. | ||
7 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | ||
8 | * | ||
9 | * Based on original work by | ||
10 | * Matt Porter <mporter@kernel.crashing.org> | ||
11 | * Armin Kuster <akuster@mvista.com> | ||
12 | * Copyright 2002-2004 MontaVista Software Inc. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify it | ||
15 | * under the terms of the GNU General Public License as published by the | ||
16 | * Free Software Foundation; either version 2 of the License, or (at your | ||
17 | * option) any later version. | ||
18 | * | ||
19 | */ | ||
20 | #ifndef __IBM_NEWEMAC_H | ||
21 | #define __IBM_NEWEMAC_H | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | /* EMAC registers Write Access rules */ | ||
26 | struct emac_regs { | ||
27 | u32 mr0; /* special */ | ||
28 | u32 mr1; /* Reset */ | ||
29 | u32 tmr0; /* special */ | ||
30 | u32 tmr1; /* special */ | ||
31 | u32 rmr; /* Reset */ | ||
32 | u32 isr; /* Always */ | ||
33 | u32 iser; /* Reset */ | ||
34 | u32 iahr; /* Reset, R, T */ | ||
35 | u32 ialr; /* Reset, R, T */ | ||
36 | u32 vtpid; /* Reset, R, T */ | ||
37 | u32 vtci; /* Reset, R, T */ | ||
38 | u32 ptr; /* Reset, T */ | ||
39 | u32 iaht1; /* Reset, R */ | ||
40 | u32 iaht2; /* Reset, R */ | ||
41 | u32 iaht3; /* Reset, R */ | ||
42 | u32 iaht4; /* Reset, R */ | ||
43 | u32 gaht1; /* Reset, R */ | ||
44 | u32 gaht2; /* Reset, R */ | ||
45 | u32 gaht3; /* Reset, R */ | ||
46 | u32 gaht4; /* Reset, R */ | ||
47 | u32 lsah; | ||
48 | u32 lsal; | ||
49 | u32 ipgvr; /* Reset, T */ | ||
50 | u32 stacr; /* special */ | ||
51 | u32 trtr; /* special */ | ||
52 | u32 rwmr; /* Reset */ | ||
53 | u32 octx; | ||
54 | u32 ocrx; | ||
55 | u32 ipcr; | ||
56 | }; | ||
57 | |||
58 | /* | ||
59 | * PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY) | ||
60 | */ | ||
61 | #define PHY_MODE_NA 0 | ||
62 | #define PHY_MODE_MII 1 | ||
63 | #define PHY_MODE_RMII 2 | ||
64 | #define PHY_MODE_SMII 3 | ||
65 | #define PHY_MODE_RGMII 4 | ||
66 | #define PHY_MODE_TBI 5 | ||
67 | #define PHY_MODE_GMII 6 | ||
68 | #define PHY_MODE_RTBI 7 | ||
69 | #define PHY_MODE_SGMII 8 | ||
70 | |||
71 | |||
72 | #define EMAC_ETHTOOL_REGS_VER 0 | ||
73 | #define EMAC_ETHTOOL_REGS_SIZE (sizeof(struct emac_regs) - sizeof(u32)) | ||
74 | #define EMAC4_ETHTOOL_REGS_VER 1 | ||
75 | #define EMAC4_ETHTOOL_REGS_SIZE sizeof(struct emac_regs) | ||
76 | |||
77 | /* EMACx_MR0 */ | ||
78 | #define EMAC_MR0_RXI 0x80000000 | ||
79 | #define EMAC_MR0_TXI 0x40000000 | ||
80 | #define EMAC_MR0_SRST 0x20000000 | ||
81 | #define EMAC_MR0_TXE 0x10000000 | ||
82 | #define EMAC_MR0_RXE 0x08000000 | ||
83 | #define EMAC_MR0_WKE 0x04000000 | ||
84 | |||
85 | /* EMACx_MR1 */ | ||
86 | #define EMAC_MR1_FDE 0x80000000 | ||
87 | #define EMAC_MR1_ILE 0x40000000 | ||
88 | #define EMAC_MR1_VLE 0x20000000 | ||
89 | #define EMAC_MR1_EIFC 0x10000000 | ||
90 | #define EMAC_MR1_APP 0x08000000 | ||
91 | #define EMAC_MR1_IST 0x01000000 | ||
92 | |||
93 | #define EMAC_MR1_MF_MASK 0x00c00000 | ||
94 | #define EMAC_MR1_MF_10 0x00000000 | ||
95 | #define EMAC_MR1_MF_100 0x00400000 | ||
96 | #define EMAC_MR1_MF_1000 0x00800000 | ||
97 | #define EMAC_MR1_MF_1000GPCS 0x00c00000 | ||
98 | #define EMAC_MR1_MF_IPPA(id) (((id) & 0x1f) << 6) | ||
99 | |||
100 | #define EMAC_MR1_RFS_4K 0x00300000 | ||
101 | #define EMAC_MR1_RFS_16K 0x00000000 | ||
102 | #define EMAC_MR1_TFS_2K 0x00080000 | ||
103 | #define EMAC_MR1_TR0_MULT 0x00008000 | ||
104 | #define EMAC_MR1_JPSM 0x00000000 | ||
105 | #define EMAC_MR1_MWSW_001 0x00000000 | ||
106 | #define EMAC_MR1_BASE(opb) (EMAC_MR1_TFS_2K | EMAC_MR1_TR0_MULT) | ||
107 | |||
108 | |||
109 | #define EMAC4_MR1_RFS_2K 0x00100000 | ||
110 | #define EMAC4_MR1_RFS_4K 0x00180000 | ||
111 | #define EMAC4_MR1_RFS_16K 0x00280000 | ||
112 | #define EMAC4_MR1_TFS_2K 0x00020000 | ||
113 | #define EMAC4_MR1_TFS_4K 0x00030000 | ||
114 | #define EMAC4_MR1_TR 0x00008000 | ||
115 | #define EMAC4_MR1_MWSW_001 0x00001000 | ||
116 | #define EMAC4_MR1_JPSM 0x00000800 | ||
117 | #define EMAC4_MR1_OBCI_MASK 0x00000038 | ||
118 | #define EMAC4_MR1_OBCI_50 0x00000000 | ||
119 | #define EMAC4_MR1_OBCI_66 0x00000008 | ||
120 | #define EMAC4_MR1_OBCI_83 0x00000010 | ||
121 | #define EMAC4_MR1_OBCI_100 0x00000018 | ||
122 | #define EMAC4_MR1_OBCI_100P 0x00000020 | ||
123 | #define EMAC4_MR1_OBCI(freq) ((freq) <= 50 ? EMAC4_MR1_OBCI_50 : \ | ||
124 | (freq) <= 66 ? EMAC4_MR1_OBCI_66 : \ | ||
125 | (freq) <= 83 ? EMAC4_MR1_OBCI_83 : \ | ||
126 | (freq) <= 100 ? EMAC4_MR1_OBCI_100 : \ | ||
127 | EMAC4_MR1_OBCI_100P) | ||
128 | |||
129 | /* EMACx_TMR0 */ | ||
130 | #define EMAC_TMR0_GNP 0x80000000 | ||
131 | #define EMAC_TMR0_DEFAULT 0x00000000 | ||
132 | #define EMAC4_TMR0_TFAE_2_32 0x00000001 | ||
133 | #define EMAC4_TMR0_TFAE_4_64 0x00000002 | ||
134 | #define EMAC4_TMR0_TFAE_8_128 0x00000003 | ||
135 | #define EMAC4_TMR0_TFAE_16_256 0x00000004 | ||
136 | #define EMAC4_TMR0_TFAE_32_512 0x00000005 | ||
137 | #define EMAC4_TMR0_TFAE_64_1024 0x00000006 | ||
138 | #define EMAC4_TMR0_TFAE_128_2048 0x00000007 | ||
139 | #define EMAC4_TMR0_DEFAULT EMAC4_TMR0_TFAE_2_32 | ||
140 | #define EMAC_TMR0_XMIT (EMAC_TMR0_GNP | EMAC_TMR0_DEFAULT) | ||
141 | #define EMAC4_TMR0_XMIT (EMAC_TMR0_GNP | EMAC4_TMR0_DEFAULT) | ||
142 | |||
143 | /* EMACx_TMR1 */ | ||
144 | |||
145 | #define EMAC_TMR1(l,h) (((l) << 27) | (((h) & 0xff) << 16)) | ||
146 | #define EMAC4_TMR1(l,h) (((l) << 27) | (((h) & 0x3ff) << 14)) | ||
147 | |||
148 | /* EMACx_RMR */ | ||
149 | #define EMAC_RMR_SP 0x80000000 | ||
150 | #define EMAC_RMR_SFCS 0x40000000 | ||
151 | #define EMAC_RMR_RRP 0x20000000 | ||
152 | #define EMAC_RMR_RFP 0x10000000 | ||
153 | #define EMAC_RMR_ROP 0x08000000 | ||
154 | #define EMAC_RMR_RPIR 0x04000000 | ||
155 | #define EMAC_RMR_PPP 0x02000000 | ||
156 | #define EMAC_RMR_PME 0x01000000 | ||
157 | #define EMAC_RMR_PMME 0x00800000 | ||
158 | #define EMAC_RMR_IAE 0x00400000 | ||
159 | #define EMAC_RMR_MIAE 0x00200000 | ||
160 | #define EMAC_RMR_BAE 0x00100000 | ||
161 | #define EMAC_RMR_MAE 0x00080000 | ||
162 | #define EMAC_RMR_BASE 0x00000000 | ||
163 | #define EMAC4_RMR_RFAF_2_32 0x00000001 | ||
164 | #define EMAC4_RMR_RFAF_4_64 0x00000002 | ||
165 | #define EMAC4_RMR_RFAF_8_128 0x00000003 | ||
166 | #define EMAC4_RMR_RFAF_16_256 0x00000004 | ||
167 | #define EMAC4_RMR_RFAF_32_512 0x00000005 | ||
168 | #define EMAC4_RMR_RFAF_64_1024 0x00000006 | ||
169 | #define EMAC4_RMR_RFAF_128_2048 0x00000007 | ||
170 | #define EMAC4_RMR_BASE EMAC4_RMR_RFAF_128_2048 | ||
171 | |||
172 | /* EMACx_ISR & EMACx_ISER */ | ||
173 | #define EMAC4_ISR_TXPE 0x20000000 | ||
174 | #define EMAC4_ISR_RXPE 0x10000000 | ||
175 | #define EMAC4_ISR_TXUE 0x08000000 | ||
176 | #define EMAC4_ISR_RXOE 0x04000000 | ||
177 | #define EMAC_ISR_OVR 0x02000000 | ||
178 | #define EMAC_ISR_PP 0x01000000 | ||
179 | #define EMAC_ISR_BP 0x00800000 | ||
180 | #define EMAC_ISR_RP 0x00400000 | ||
181 | #define EMAC_ISR_SE 0x00200000 | ||
182 | #define EMAC_ISR_ALE 0x00100000 | ||
183 | #define EMAC_ISR_BFCS 0x00080000 | ||
184 | #define EMAC_ISR_PTLE 0x00040000 | ||
185 | #define EMAC_ISR_ORE 0x00020000 | ||
186 | #define EMAC_ISR_IRE 0x00010000 | ||
187 | #define EMAC_ISR_SQE 0x00000080 | ||
188 | #define EMAC_ISR_TE 0x00000040 | ||
189 | #define EMAC_ISR_MOS 0x00000002 | ||
190 | #define EMAC_ISR_MOF 0x00000001 | ||
191 | |||
192 | /* EMACx_STACR */ | ||
193 | #define EMAC_STACR_PHYD_MASK 0xffff | ||
194 | #define EMAC_STACR_PHYD_SHIFT 16 | ||
195 | #define EMAC_STACR_OC 0x00008000 | ||
196 | #define EMAC_STACR_PHYE 0x00004000 | ||
197 | #define EMAC_STACR_STAC_MASK 0x00003000 | ||
198 | #define EMAC_STACR_STAC_READ 0x00001000 | ||
199 | #define EMAC_STACR_STAC_WRITE 0x00002000 | ||
200 | #define EMAC_STACR_OPBC_MASK 0x00000C00 | ||
201 | #define EMAC_STACR_OPBC_50 0x00000000 | ||
202 | #define EMAC_STACR_OPBC_66 0x00000400 | ||
203 | #define EMAC_STACR_OPBC_83 0x00000800 | ||
204 | #define EMAC_STACR_OPBC_100 0x00000C00 | ||
205 | #define EMAC_STACR_OPBC(freq) ((freq) <= 50 ? EMAC_STACR_OPBC_50 : \ | ||
206 | (freq) <= 66 ? EMAC_STACR_OPBC_66 : \ | ||
207 | (freq) <= 83 ? EMAC_STACR_OPBC_83 : EMAC_STACR_OPBC_100) | ||
208 | #define EMAC_STACR_BASE(opb) EMAC_STACR_OPBC(opb) | ||
209 | #define EMAC4_STACR_BASE(opb) 0x00000000 | ||
210 | #define EMAC_STACR_PCDA_MASK 0x1f | ||
211 | #define EMAC_STACR_PCDA_SHIFT 5 | ||
212 | #define EMAC_STACR_PRA_MASK 0x1f | ||
213 | #define EMACX_STACR_STAC_MASK 0x00003800 | ||
214 | #define EMACX_STACR_STAC_READ 0x00001000 | ||
215 | #define EMACX_STACR_STAC_WRITE 0x00000800 | ||
216 | #define EMACX_STACR_STAC_IND_ADDR 0x00002000 | ||
217 | #define EMACX_STACR_STAC_IND_READ 0x00003800 | ||
218 | #define EMACX_STACR_STAC_IND_READINC 0x00003000 | ||
219 | #define EMACX_STACR_STAC_IND_WRITE 0x00002800 | ||
220 | |||
221 | |||
222 | /* EMACx_TRTR */ | ||
223 | #define EMAC_TRTR_SHIFT_EMAC4 27 | ||
224 | #define EMAC_TRTR_SHIFT 24 | ||
225 | |||
226 | /* EMAC specific TX descriptor control fields (write access) */ | ||
227 | #define EMAC_TX_CTRL_GFCS 0x0200 | ||
228 | #define EMAC_TX_CTRL_GP 0x0100 | ||
229 | #define EMAC_TX_CTRL_ISA 0x0080 | ||
230 | #define EMAC_TX_CTRL_RSA 0x0040 | ||
231 | #define EMAC_TX_CTRL_IVT 0x0020 | ||
232 | #define EMAC_TX_CTRL_RVT 0x0010 | ||
233 | #define EMAC_TX_CTRL_TAH_CSUM 0x000e | ||
234 | |||
235 | /* EMAC specific TX descriptor status fields (read access) */ | ||
236 | #define EMAC_TX_ST_BFCS 0x0200 | ||
237 | #define EMAC_TX_ST_LCS 0x0080 | ||
238 | #define EMAC_TX_ST_ED 0x0040 | ||
239 | #define EMAC_TX_ST_EC 0x0020 | ||
240 | #define EMAC_TX_ST_LC 0x0010 | ||
241 | #define EMAC_TX_ST_MC 0x0008 | ||
242 | #define EMAC_TX_ST_SC 0x0004 | ||
243 | #define EMAC_TX_ST_UR 0x0002 | ||
244 | #define EMAC_TX_ST_SQE 0x0001 | ||
245 | #define EMAC_IS_BAD_TX (EMAC_TX_ST_LCS | EMAC_TX_ST_ED | \ | ||
246 | EMAC_TX_ST_EC | EMAC_TX_ST_LC | \ | ||
247 | EMAC_TX_ST_MC | EMAC_TX_ST_UR) | ||
248 | #define EMAC_IS_BAD_TX_TAH (EMAC_TX_ST_LCS | EMAC_TX_ST_ED | \ | ||
249 | EMAC_TX_ST_EC | EMAC_TX_ST_LC) | ||
250 | |||
251 | /* EMAC specific RX descriptor status fields (read access) */ | ||
252 | #define EMAC_RX_ST_OE 0x0200 | ||
253 | #define EMAC_RX_ST_PP 0x0100 | ||
254 | #define EMAC_RX_ST_BP 0x0080 | ||
255 | #define EMAC_RX_ST_RP 0x0040 | ||
256 | #define EMAC_RX_ST_SE 0x0020 | ||
257 | #define EMAC_RX_ST_AE 0x0010 | ||
258 | #define EMAC_RX_ST_BFCS 0x0008 | ||
259 | #define EMAC_RX_ST_PTL 0x0004 | ||
260 | #define EMAC_RX_ST_ORE 0x0002 | ||
261 | #define EMAC_RX_ST_IRE 0x0001 | ||
262 | #define EMAC_RX_TAH_BAD_CSUM 0x0003 | ||
263 | #define EMAC_BAD_RX_MASK (EMAC_RX_ST_OE | EMAC_RX_ST_BP | \ | ||
264 | EMAC_RX_ST_RP | EMAC_RX_ST_SE | \ | ||
265 | EMAC_RX_ST_AE | EMAC_RX_ST_BFCS | \ | ||
266 | EMAC_RX_ST_PTL | EMAC_RX_ST_ORE | \ | ||
267 | EMAC_RX_ST_IRE ) | ||
268 | #endif /* __IBM_NEWEMAC_H */ | ||