aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sh_eth.h
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-03-07 16:59:26 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-14 17:10:13 -0400
commit4a55530f38e4eeee3afb06093e81309138fe8360 (patch)
tree176fa77c4eacd0809205bde0b8a171d2d43d69a2 /drivers/net/sh_eth.h
parent201a11c1db82247143f0fbe29b4a97f16fa3a591 (diff)
net: sh_eth: modify the definitions of register
The previous code cannot handle the ETHER and GETHER both as same time because the definitions of register was hardcoded. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sh_eth.h')
-rw-r--r--drivers/net/sh_eth.h623
1 files changed, 364 insertions, 259 deletions
diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h
index efa64221eede..1510a7ca956a 100644
--- a/drivers/net/sh_eth.h
+++ b/drivers/net/sh_eth.h
@@ -2,7 +2,7 @@
2 * SuperH Ethernet device driver 2 * SuperH Ethernet device driver
3 * 3 *
4 * Copyright (C) 2006-2008 Nobuhiro Iwamatsu 4 * Copyright (C) 2006-2008 Nobuhiro Iwamatsu
5 * Copyright (C) 2008-2009 Renesas Solutions Corp. 5 * Copyright (C) 2008-2011 Renesas Solutions Corp.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License, 8 * under the terms and conditions of the GNU General Public License,
@@ -38,162 +38,345 @@
38#define ETHERSMALL 60 38#define ETHERSMALL 60
39#define PKT_BUF_SZ 1538 39#define PKT_BUF_SZ 1538
40 40
41enum {
42 /* E-DMAC registers */
43 EDSR = 0,
44 EDMR,
45 EDTRR,
46 EDRRR,
47 EESR,
48 EESIPR,
49 TDLAR,
50 TDFAR,
51 TDFXR,
52 TDFFR,
53 RDLAR,
54 RDFAR,
55 RDFXR,
56 RDFFR,
57 TRSCER,
58 RMFCR,
59 TFTR,
60 FDR,
61 RMCR,
62 EDOCR,
63 TFUCR,
64 RFOCR,
65 FCFTR,
66 RPADIR,
67 TRIMD,
68 RBWAR,
69 TBRAR,
70
71 /* Ether registers */
72 ECMR,
73 ECSR,
74 ECSIPR,
75 PIR,
76 PSR,
77 RDMLR,
78 PIPR,
79 RFLR,
80 IPGR,
81 APR,
82 MPR,
83 PFTCR,
84 PFRCR,
85 RFCR,
86 RFCF,
87 TPAUSER,
88 TPAUSECR,
89 BCFR,
90 BCFRR,
91 GECMR,
92 BCULR,
93 MAHR,
94 MALR,
95 TROCR,
96 CDCR,
97 LCCR,
98 CNDCR,
99 CEFCR,
100 FRECR,
101 TSFRCR,
102 TLFRCR,
103 CERCR,
104 CEECR,
105 MAFCR,
106 RTRATE,
107
108 /* TSU Absolute address */
109 ARSTR,
110 TSU_CTRST,
111 TSU_FWEN0,
112 TSU_FWEN1,
113 TSU_FCM,
114 TSU_BSYSL0,
115 TSU_BSYSL1,
116 TSU_PRISL0,
117 TSU_PRISL1,
118 TSU_FWSL0,
119 TSU_FWSL1,
120 TSU_FWSLC,
121 TSU_QTAG0,
122 TSU_QTAG1,
123 TSU_QTAGM0,
124 TSU_QTAGM1,
125 TSU_FWSR,
126 TSU_FWINMK,
127 TSU_ADQT0,
128 TSU_ADQT1,
129 TSU_VTAG0,
130 TSU_VTAG1,
131 TSU_ADSBSY,
132 TSU_TEN,
133 TSU_POST1,
134 TSU_POST2,
135 TSU_POST3,
136 TSU_POST4,
137 TSU_ADRH0,
138 TSU_ADRL0,
139 TSU_ADRH31,
140 TSU_ADRL31,
141
142 TXNLCR0,
143 TXALCR0,
144 RXNLCR0,
145 RXALCR0,
146 FWNLCR0,
147 FWALCR0,
148 TXNLCR1,
149 TXALCR1,
150 RXNLCR1,
151 RXALCR1,
152 FWNLCR1,
153 FWALCR1,
154
155 /* This value must be written at last. */
156 SH_ETH_MAX_REGISTER_OFFSET,
157};
158
159static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
160 [EDSR] = 0x0000,
161 [EDMR] = 0x0400,
162 [EDTRR] = 0x0408,
163 [EDRRR] = 0x0410,
164 [EESR] = 0x0428,
165 [EESIPR] = 0x0430,
166 [TDLAR] = 0x0010,
167 [TDFAR] = 0x0014,
168 [TDFXR] = 0x0018,
169 [TDFFR] = 0x001c,
170 [RDLAR] = 0x0030,
171 [RDFAR] = 0x0034,
172 [RDFXR] = 0x0038,
173 [RDFFR] = 0x003c,
174 [TRSCER] = 0x0438,
175 [RMFCR] = 0x0440,
176 [TFTR] = 0x0448,
177 [FDR] = 0x0450,
178 [RMCR] = 0x0458,
179 [RPADIR] = 0x0460,
180 [FCFTR] = 0x0468,
181
182 [ECMR] = 0x0500,
183 [ECSR] = 0x0510,
184 [ECSIPR] = 0x0518,
185 [PIR] = 0x0520,
186 [PSR] = 0x0528,
187 [PIPR] = 0x052c,
188 [RFLR] = 0x0508,
189 [APR] = 0x0554,
190 [MPR] = 0x0558,
191 [PFTCR] = 0x055c,
192 [PFRCR] = 0x0560,
193 [TPAUSER] = 0x0564,
194 [GECMR] = 0x05b0,
195 [BCULR] = 0x05b4,
196 [MAHR] = 0x05c0,
197 [MALR] = 0x05c8,
198 [TROCR] = 0x0700,
199 [CDCR] = 0x0708,
200 [LCCR] = 0x0710,
201 [CEFCR] = 0x0740,
202 [FRECR] = 0x0748,
203 [TSFRCR] = 0x0750,
204 [TLFRCR] = 0x0758,
205 [RFCR] = 0x0760,
206 [CERCR] = 0x0768,
207 [CEECR] = 0x0770,
208 [MAFCR] = 0x0778,
209
210 [TSU_CTRST] = 0x0004,
211 [TSU_FWEN0] = 0x0010,
212 [TSU_FWEN1] = 0x0014,
213 [TSU_FCM] = 0x0018,
214 [TSU_BSYSL0] = 0x0020,
215 [TSU_BSYSL1] = 0x0024,
216 [TSU_PRISL0] = 0x0028,
217 [TSU_PRISL1] = 0x002c,
218 [TSU_FWSL0] = 0x0030,
219 [TSU_FWSL1] = 0x0034,
220 [TSU_FWSLC] = 0x0038,
221 [TSU_QTAG0] = 0x0040,
222 [TSU_QTAG1] = 0x0044,
223 [TSU_FWSR] = 0x0050,
224 [TSU_FWINMK] = 0x0054,
225 [TSU_ADQT0] = 0x0048,
226 [TSU_ADQT1] = 0x004c,
227 [TSU_VTAG0] = 0x0058,
228 [TSU_VTAG1] = 0x005c,
229 [TSU_ADSBSY] = 0x0060,
230 [TSU_TEN] = 0x0064,
231 [TSU_POST1] = 0x0070,
232 [TSU_POST2] = 0x0074,
233 [TSU_POST3] = 0x0078,
234 [TSU_POST4] = 0x007c,
235 [TSU_ADRH0] = 0x0100,
236 [TSU_ADRL0] = 0x0104,
237 [TSU_ADRH31] = 0x01f8,
238 [TSU_ADRL31] = 0x01fc,
239
240 [TXNLCR0] = 0x0080,
241 [TXALCR0] = 0x0084,
242 [RXNLCR0] = 0x0088,
243 [RXALCR0] = 0x008c,
244 [FWNLCR0] = 0x0090,
245 [FWALCR0] = 0x0094,
246 [TXNLCR1] = 0x00a0,
247 [TXALCR1] = 0x00a0,
248 [RXNLCR1] = 0x00a8,
249 [RXALCR1] = 0x00ac,
250 [FWNLCR1] = 0x00b0,
251 [FWALCR1] = 0x00b4,
252};
253
254static const u16 sh_eth_offset_fast_sh4[SH_ETH_MAX_REGISTER_OFFSET] = {
255 [ECMR] = 0x0100,
256 [RFLR] = 0x0108,
257 [ECSR] = 0x0110,
258 [ECSIPR] = 0x0118,
259 [PIR] = 0x0120,
260 [PSR] = 0x0128,
261 [RDMLR] = 0x0140,
262 [IPGR] = 0x0150,
263 [APR] = 0x0154,
264 [MPR] = 0x0158,
265 [TPAUSER] = 0x0164,
266 [RFCF] = 0x0160,
267 [TPAUSECR] = 0x0168,
268 [BCFRR] = 0x016c,
269 [MAHR] = 0x01c0,
270 [MALR] = 0x01c8,
271 [TROCR] = 0x01d0,
272 [CDCR] = 0x01d4,
273 [LCCR] = 0x01d8,
274 [CNDCR] = 0x01dc,
275 [CEFCR] = 0x01e4,
276 [FRECR] = 0x01e8,
277 [TSFRCR] = 0x01ec,
278 [TLFRCR] = 0x01f0,
279 [RFCR] = 0x01f4,
280 [MAFCR] = 0x01f8,
281 [RTRATE] = 0x01fc,
282
283 [EDMR] = 0x0000,
284 [EDTRR] = 0x0008,
285 [EDRRR] = 0x0010,
286 [TDLAR] = 0x0018,
287 [RDLAR] = 0x0020,
288 [EESR] = 0x0028,
289 [EESIPR] = 0x0030,
290 [TRSCER] = 0x0038,
291 [RMFCR] = 0x0040,
292 [TFTR] = 0x0048,
293 [FDR] = 0x0050,
294 [RMCR] = 0x0058,
295 [TFUCR] = 0x0064,
296 [RFOCR] = 0x0068,
297 [FCFTR] = 0x0070,
298 [RPADIR] = 0x0078,
299 [TRIMD] = 0x007c,
300 [RBWAR] = 0x00c8,
301 [RDFAR] = 0x00cc,
302 [TBRAR] = 0x00d4,
303 [TDFAR] = 0x00d8,
304};
305
306static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
307 [ECMR] = 0x0160,
308 [ECSR] = 0x0164,
309 [ECSIPR] = 0x0168,
310 [PIR] = 0x016c,
311 [MAHR] = 0x0170,
312 [MALR] = 0x0174,
313 [RFLR] = 0x0178,
314 [PSR] = 0x017c,
315 [TROCR] = 0x0180,
316 [CDCR] = 0x0184,
317 [LCCR] = 0x0188,
318 [CNDCR] = 0x018c,
319 [CEFCR] = 0x0194,
320 [FRECR] = 0x0198,
321 [TSFRCR] = 0x019c,
322 [TLFRCR] = 0x01a0,
323 [RFCR] = 0x01a4,
324 [MAFCR] = 0x01a8,
325 [IPGR] = 0x01b4,
326 [APR] = 0x01b8,
327 [MPR] = 0x01bc,
328 [TPAUSER] = 0x01c4,
329 [BCFR] = 0x01cc,
330
331 [TSU_CTRST] = 0x0004,
332 [TSU_FWEN0] = 0x0010,
333 [TSU_FWEN1] = 0x0014,
334 [TSU_FCM] = 0x0018,
335 [TSU_BSYSL0] = 0x0020,
336 [TSU_BSYSL1] = 0x0024,
337 [TSU_PRISL0] = 0x0028,
338 [TSU_PRISL1] = 0x002c,
339 [TSU_FWSL0] = 0x0030,
340 [TSU_FWSL1] = 0x0034,
341 [TSU_FWSLC] = 0x0038,
342 [TSU_QTAGM0] = 0x0040,
343 [TSU_QTAGM1] = 0x0044,
344 [TSU_ADQT0] = 0x0048,
345 [TSU_ADQT1] = 0x004c,
346 [TSU_FWSR] = 0x0050,
347 [TSU_FWINMK] = 0x0054,
348 [TSU_ADSBSY] = 0x0060,
349 [TSU_TEN] = 0x0064,
350 [TSU_POST1] = 0x0070,
351 [TSU_POST2] = 0x0074,
352 [TSU_POST3] = 0x0078,
353 [TSU_POST4] = 0x007c,
354
355 [TXNLCR0] = 0x0080,
356 [TXALCR0] = 0x0084,
357 [RXNLCR0] = 0x0088,
358 [RXALCR0] = 0x008c,
359 [FWNLCR0] = 0x0090,
360 [FWALCR0] = 0x0094,
361 [TXNLCR1] = 0x00a0,
362 [TXALCR1] = 0x00a0,
363 [RXNLCR1] = 0x00a8,
364 [RXALCR1] = 0x00ac,
365 [FWNLCR1] = 0x00b0,
366 [FWALCR1] = 0x00b4,
367
368 [TSU_ADRH0] = 0x0100,
369 [TSU_ADRL0] = 0x0104,
370 [TSU_ADRL31] = 0x01fc,
371
372};
373
41#if defined(CONFIG_CPU_SUBTYPE_SH7763) 374#if defined(CONFIG_CPU_SUBTYPE_SH7763)
42/* This CPU register maps is very difference by other SH4 CPU */ 375/* This CPU register maps is very difference by other SH4 CPU */
43
44/* Chip Base Address */ 376/* Chip Base Address */
45# define SH_TSU_ADDR 0xFEE01800 377# define SH_TSU_ADDR 0xFEE01800
46# define ARSTR SH_TSU_ADDR 378# define ARSTR SH_TSU_ADDR
47
48/* Chip Registers */
49/* E-DMAC */
50# define EDSR 0x000
51# define EDMR 0x400
52# define EDTRR 0x408
53# define EDRRR 0x410
54# define EESR 0x428
55# define EESIPR 0x430
56# define TDLAR 0x010
57# define TDFAR 0x014
58# define TDFXR 0x018
59# define TDFFR 0x01C
60# define RDLAR 0x030
61# define RDFAR 0x034
62# define RDFXR 0x038
63# define RDFFR 0x03C
64# define TRSCER 0x438
65# define RMFCR 0x440
66# define TFTR 0x448
67# define FDR 0x450
68# define RMCR 0x458
69# define RPADIR 0x460
70# define FCFTR 0x468
71
72/* Ether Register */
73# define ECMR 0x500
74# define ECSR 0x510
75# define ECSIPR 0x518
76# define PIR 0x520
77# define PSR 0x528
78# define PIPR 0x52C
79# define RFLR 0x508
80# define APR 0x554
81# define MPR 0x558
82# define PFTCR 0x55C
83# define PFRCR 0x560
84# define TPAUSER 0x564
85# define GECMR 0x5B0
86# define BCULR 0x5B4
87# define MAHR 0x5C0
88# define MALR 0x5C8
89# define TROCR 0x700
90# define CDCR 0x708
91# define LCCR 0x710
92# define CEFCR 0x740
93# define FRECR 0x748
94# define TSFRCR 0x750
95# define TLFRCR 0x758
96# define RFCR 0x760
97# define CERCR 0x768
98# define CEECR 0x770
99# define MAFCR 0x778
100
101/* TSU Absolute Address */
102# define TSU_CTRST 0x004
103# define TSU_FWEN0 0x010
104# define TSU_FWEN1 0x014
105# define TSU_FCM 0x18
106# define TSU_BSYSL0 0x20
107# define TSU_BSYSL1 0x24
108# define TSU_PRISL0 0x28
109# define TSU_PRISL1 0x2C
110# define TSU_FWSL0 0x30
111# define TSU_FWSL1 0x34
112# define TSU_FWSLC 0x38
113# define TSU_QTAG0 0x40
114# define TSU_QTAG1 0x44
115# define TSU_FWSR 0x50
116# define TSU_FWINMK 0x54
117# define TSU_ADQT0 0x48
118# define TSU_ADQT1 0x4C
119# define TSU_VTAG0 0x58
120# define TSU_VTAG1 0x5C
121# define TSU_ADSBSY 0x60
122# define TSU_TEN 0x64
123# define TSU_POST1 0x70
124# define TSU_POST2 0x74
125# define TSU_POST3 0x78
126# define TSU_POST4 0x7C
127# define TSU_ADRH0 0x100
128# define TSU_ADRL0 0x104
129# define TSU_ADRH31 0x1F8
130# define TSU_ADRL31 0x1FC
131
132# define TXNLCR0 0x80
133# define TXALCR0 0x84
134# define RXNLCR0 0x88
135# define RXALCR0 0x8C
136# define FWNLCR0 0x90
137# define FWALCR0 0x94
138# define TXNLCR1 0xA0
139# define TXALCR1 0xA4
140# define RXNLCR1 0xA8
141# define RXALCR1 0xAC
142# define FWNLCR1 0xB0
143# define FWALCR1 0x40
144
145#elif defined(CONFIG_CPU_SH4) /* #if defined(CONFIG_CPU_SUBTYPE_SH7763) */ 379#elif defined(CONFIG_CPU_SH4) /* #if defined(CONFIG_CPU_SUBTYPE_SH7763) */
146/* EtherC */
147#define ECMR 0x100
148#define RFLR 0x108
149#define ECSR 0x110
150#define ECSIPR 0x118
151#define PIR 0x120
152#define PSR 0x128
153#define RDMLR 0x140
154#define IPGR 0x150
155#define APR 0x154
156#define MPR 0x158
157#define TPAUSER 0x164
158#define RFCF 0x160
159#define TPAUSECR 0x168
160#define BCFRR 0x16c
161#define MAHR 0x1c0
162#define MALR 0x1c8
163#define TROCR 0x1d0
164#define CDCR 0x1d4
165#define LCCR 0x1d8
166#define CNDCR 0x1dc
167#define CEFCR 0x1e4
168#define FRECR 0x1e8
169#define TSFRCR 0x1ec
170#define TLFRCR 0x1f0
171#define RFCR 0x1f4
172#define MAFCR 0x1f8
173#define RTRATE 0x1fc
174
175/* E-DMAC */
176#define EDMR 0x000
177#define EDTRR 0x008
178#define EDRRR 0x010
179#define TDLAR 0x018
180#define RDLAR 0x020
181#define EESR 0x028
182#define EESIPR 0x030
183#define TRSCER 0x038
184#define RMFCR 0x040
185#define TFTR 0x048
186#define FDR 0x050
187#define RMCR 0x058
188#define TFUCR 0x064
189#define RFOCR 0x068
190#define FCFTR 0x070
191#define RPADIR 0x078
192#define TRIMD 0x07c
193#define RBWAR 0x0c8
194#define RDFAR 0x0cc
195#define TBRAR 0x0d4
196#define TDFAR 0x0d8
197#else /* #elif defined(CONFIG_CPU_SH4) */ 380#else /* #elif defined(CONFIG_CPU_SH4) */
198/* This section is SH3 or SH2 */ 381/* This section is SH3 or SH2 */
199#ifndef CONFIG_CPU_SUBTYPE_SH7619 382#ifndef CONFIG_CPU_SUBTYPE_SH7619
@@ -201,116 +384,8 @@
201# define SH_TSU_ADDR 0xA7000804 384# define SH_TSU_ADDR 0xA7000804
202# define ARSTR 0xA7000800 385# define ARSTR 0xA7000800
203#endif 386#endif
204/* Chip Registers */
205/* E-DMAC */
206# define EDMR 0x0000
207# define EDTRR 0x0004
208# define EDRRR 0x0008
209# define TDLAR 0x000C
210# define RDLAR 0x0010
211# define EESR 0x0014
212# define EESIPR 0x0018
213# define TRSCER 0x001C
214# define RMFCR 0x0020
215# define TFTR 0x0024
216# define FDR 0x0028
217# define RMCR 0x002C
218# define EDOCR 0x0030
219# define FCFTR 0x0034
220# define RPADIR 0x0038
221# define TRIMD 0x003C
222# define RBWAR 0x0040
223# define RDFAR 0x0044
224# define TBRAR 0x004C
225# define TDFAR 0x0050
226
227/* Ether Register */
228# define ECMR 0x0160
229# define ECSR 0x0164
230# define ECSIPR 0x0168
231# define PIR 0x016C
232# define MAHR 0x0170
233# define MALR 0x0174
234# define RFLR 0x0178
235# define PSR 0x017C
236# define TROCR 0x0180
237# define CDCR 0x0184
238# define LCCR 0x0188
239# define CNDCR 0x018C
240# define CEFCR 0x0194
241# define FRECR 0x0198
242# define TSFRCR 0x019C
243# define TLFRCR 0x01A0
244# define RFCR 0x01A4
245# define MAFCR 0x01A8
246# define IPGR 0x01B4
247# if defined(CONFIG_CPU_SUBTYPE_SH7710)
248# define APR 0x01B8
249# define MPR 0x01BC
250# define TPAUSER 0x1C4
251# define BCFR 0x1CC
252# endif /* CONFIG_CPU_SH7710 */
253
254/* TSU */
255# define TSU_CTRST 0x004
256# define TSU_FWEN0 0x010
257# define TSU_FWEN1 0x014
258# define TSU_FCM 0x018
259# define TSU_BSYSL0 0x020
260# define TSU_BSYSL1 0x024
261# define TSU_PRISL0 0x028
262# define TSU_PRISL1 0x02C
263# define TSU_FWSL0 0x030
264# define TSU_FWSL1 0x034
265# define TSU_FWSLC 0x038
266# define TSU_QTAGM0 0x040
267# define TSU_QTAGM1 0x044
268# define TSU_ADQT0 0x048
269# define TSU_ADQT1 0x04C
270# define TSU_FWSR 0x050
271# define TSU_FWINMK 0x054
272# define TSU_ADSBSY 0x060
273# define TSU_TEN 0x064
274# define TSU_POST1 0x070
275# define TSU_POST2 0x074
276# define TSU_POST3 0x078
277# define TSU_POST4 0x07C
278# define TXNLCR0 0x080
279# define TXALCR0 0x084
280# define RXNLCR0 0x088
281# define RXALCR0 0x08C
282# define FWNLCR0 0x090
283# define FWALCR0 0x094
284# define TXNLCR1 0x0A0
285# define TXALCR1 0x0A4
286# define RXNLCR1 0x0A8
287# define RXALCR1 0x0AC
288# define FWNLCR1 0x0B0
289# define FWALCR1 0x0B4
290
291#define TSU_ADRH0 0x0100
292#define TSU_ADRL0 0x0104
293#define TSU_ADRL31 0x01FC
294
295#endif /* CONFIG_CPU_SUBTYPE_SH7763 */ 387#endif /* CONFIG_CPU_SUBTYPE_SH7763 */
296 388
297/* There are avoid compile error... */
298#if !defined(BCULR)
299#define BCULR 0x0fc
300#endif
301#if !defined(TRIMD)
302#define TRIMD 0x0fc
303#endif
304#if !defined(APR)
305#define APR 0x0fc
306#endif
307#if !defined(MPR)
308#define MPR 0x0fc
309#endif
310#if !defined(TPAUSER)
311#define TPAUSER 0x0fc
312#endif
313
314/* Driver's parameters */ 389/* Driver's parameters */
315#if defined(CONFIG_CPU_SH4) 390#if defined(CONFIG_CPU_SH4)
316#define SH4_SKB_RX_ALIGN 32 391#define SH4_SKB_RX_ALIGN 32
@@ -704,6 +779,8 @@ struct sh_eth_cpu_data {
704struct sh_eth_private { 779struct sh_eth_private {
705 struct platform_device *pdev; 780 struct platform_device *pdev;
706 struct sh_eth_cpu_data *cd; 781 struct sh_eth_cpu_data *cd;
782 const u16 *reg_offset;
783 void __iomem *tsu_addr;
707 dma_addr_t rx_desc_dma; 784 dma_addr_t rx_desc_dma;
708 dma_addr_t tx_desc_dma; 785 dma_addr_t tx_desc_dma;
709 struct sh_eth_rxdesc *rx_ring; 786 struct sh_eth_rxdesc *rx_ring;
@@ -746,4 +823,32 @@ static inline void sh_eth_soft_swap(char *src, int len)
746#endif 823#endif
747} 824}
748 825
826static inline void sh_eth_write(struct net_device *ndev, unsigned long data,
827 int enum_index)
828{
829 struct sh_eth_private *mdp = netdev_priv(ndev);
830
831 writel(data, ndev->base_addr + mdp->reg_offset[enum_index]);
832}
833
834static inline unsigned long sh_eth_read(struct net_device *ndev,
835 int enum_index)
836{
837 struct sh_eth_private *mdp = netdev_priv(ndev);
838
839 return readl(ndev->base_addr + mdp->reg_offset[enum_index]);
840}
841
842static inline void sh_eth_tsu_write(struct sh_eth_private *mdp,
843 unsigned long data, int enum_index)
844{
845 writel(data, mdp->tsu_addr + mdp->reg_offset[enum_index]);
846}
847
848static inline unsigned long sh_eth_tsu_read(struct sh_eth_private *mdp,
849 int enum_index)
850{
851 return readl(mdp->tsu_addr + mdp->reg_offset[enum_index]);
852}
853
749#endif /* #ifndef __SH_ETH_H__ */ 854#endif /* #ifndef __SH_ETH_H__ */