remove hardcoded package names; use wildcard
[openwrt.git] / target / linux / aruba-2.6 / patches / 000-aruba.patch
1 diff -Nur linux-2.6.15/arch/mips/aruba/flash_lock.c linux-2.6.15-openwrt/arch/mips/aruba/flash_lock.c
2 --- linux-2.6.15/arch/mips/aruba/flash_lock.c   1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.15-openwrt/arch/mips/aruba/flash_lock.c   2006-01-10 00:32:32.000000000 +0100
4 @@ -0,0 +1,27 @@
5 +#include <linux/module.h>
6 +#include <linux/types.h>
7 +#include <asm/bootinfo.h>
8 +
9 +#define AP70_PROT_ADDR 0xb8010008
10 +#define AP70_PROT_DATA 0x8
11 +#define AP60_PROT_ADDR 0xB8400000
12 +#define AP60_PROT_DATA 0x04000000
13 +
14 +void unlock_ap60_70_flash(void)
15 +{
16 +       volatile __u32 val;
17 +       switch (mips_machtype) {
18 +               case MACH_ARUBA_AP70:
19 +                       val = *(volatile __u32 *)AP70_PROT_ADDR;
20 +                       val &= ~(AP70_PROT_DATA);
21 +                       *(volatile __u32 *)AP70_PROT_ADDR = val;
22 +                       break;
23 +               case MACH_ARUBA_AP65:
24 +               case MACH_ARUBA_AP60:
25 +               default:
26 +                       val = *(volatile __u32 *)AP60_PROT_ADDR;
27 +                       val &= ~(AP60_PROT_DATA);
28 +                       *(volatile __u32 *)AP60_PROT_ADDR = val;
29 +                       break;
30 +       }
31 +}
32 diff -Nur linux-2.6.15/arch/mips/aruba/idtIRQ.S linux-2.6.15-openwrt/arch/mips/aruba/idtIRQ.S
33 --- linux-2.6.15/arch/mips/aruba/idtIRQ.S       1970-01-01 01:00:00.000000000 +0100
34 +++ linux-2.6.15-openwrt/arch/mips/aruba/idtIRQ.S       2006-01-10 00:32:32.000000000 +0100
35 @@ -0,0 +1,87 @@
36 +/**************************************************************************
37 + *
38 + *  BRIEF MODULE DESCRIPTION
39 + *     Intterrupt dispatcher code for IDT boards
40 + *
41 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
42 + *         
43 + *  This program is free software; you can redistribute  it and/or modify it
44 + *  under  the terms of  the GNU General  Public License as published by the
45 + *  Free Software Foundation;  either version 2 of the  License, or (at your
46 + *  option) any later version.
47 + *
48 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
49 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
50 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
51 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
52 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
54 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
55 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
56 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 + *
59 + *  You should have received a copy of the  GNU General Public License along
60 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
61 + *  675 Mass Ave, Cambridge, MA 02139, USA.
62 + *
63 + *
64 + **************************************************************************
65 + * May 2004 rkt, neb
66 + *
67 + * Initial Release
68 + *
69 + * 
70 + *
71 + **************************************************************************
72 + */
73 +               
74 +       
75 +#include <asm/asm.h>
76 +#include <asm/mipsregs.h>
77 +#include <asm/regdef.h>
78 +#include <asm/stackframe.h>
79 +
80 +       .text
81 +       .set    noreorder
82 +       .set    noat
83 +       .align  5
84 +       NESTED(idtIRQ, PT_SIZE, sp)
85 +       .set noat
86 +       SAVE_ALL
87 +       CLI
88 +
89 +       .set    at
90 +       .set    noreorder
91 +
92 +       /* Get the pending interrupts */
93 +       mfc0    t0, CP0_CAUSE
94 +       nop
95 +                        
96 +       /* Isolate the allowed ones by anding the irq mask */
97 +       mfc0    t2, CP0_STATUS
98 +       move    a1, sp          /* need a nop here, hence we anticipate */
99 +       andi    t0, CAUSEF_IP
100 +       and     t0, t2
101 +                                                                 
102 +       /* check for r4k counter/timer IRQ. */
103 +       
104 +       andi    t1, t0, CAUSEF_IP7
105 +       beqz    t1, 1f
106 +       nop
107 +
108 +       jal     aruba_timer_interrupt   
109 +
110 +       li      a0, 7
111 +
112 +       j       ret_from_irq
113 +       nop
114 +1:
115 +       jal     aruba_irqdispatch
116 +       move    a0, t0
117 +       j       ret_from_irq
118 +       nop
119 +
120 +       END(idtIRQ)
121 +
122 +
123 diff -Nur linux-2.6.15/arch/mips/aruba/irq.c linux-2.6.15-openwrt/arch/mips/aruba/irq.c
124 --- linux-2.6.15/arch/mips/aruba/irq.c  1970-01-01 01:00:00.000000000 +0100
125 +++ linux-2.6.15-openwrt/arch/mips/aruba/irq.c  2006-01-10 00:32:32.000000000 +0100
126 @@ -0,0 +1,394 @@
127 +/**************************************************************************
128 + *
129 + *  BRIEF MODULE DESCRIPTION
130 + *     Interrupt routines for IDT EB434 boards
131 + *
132 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
133 + *         
134 + *  This program is free software; you can redistribute  it and/or modify it
135 + *  under  the terms of  the GNU General  Public License as published by the
136 + *  Free Software Foundation;  either version 2 of the  License, or (at your
137 + *  option) any later version.
138 + *
139 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
140 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
141 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
142 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
143 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
144 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
145 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
146 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
147 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
148 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
149 + *
150 + *  You should have received a copy of the  GNU General Public License along
151 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
152 + *  675 Mass Ave, Cambridge, MA 02139, USA.
153 + *
154 + *
155 + **************************************************************************
156 + * May 2004 rkt, neb
157 + *
158 + * Initial Release
159 + *
160 + * 
161 + *
162 + **************************************************************************
163 + */
164 +
165 +#include <linux/errno.h>
166 +#include <linux/init.h>
167 +#include <linux/kernel_stat.h>
168 +#include <linux/module.h>
169 +#include <linux/signal.h>
170 +#include <linux/sched.h>
171 +#include <linux/types.h>
172 +#include <linux/interrupt.h>
173 +#include <linux/ioport.h>
174 +#include <linux/timex.h>
175 +#include <linux/slab.h>
176 +#include <linux/random.h>
177 +#include <linux/delay.h>
178 +
179 +#include <asm/bitops.h>
180 +#include <asm/bootinfo.h>
181 +#include <asm/io.h>
182 +#include <asm/mipsregs.h>
183 +#include <asm/system.h>
184 +#include <asm/idt-boards/rc32434/rc32434.h>
185 +#include <asm/idt-boards/rc32434/rc32434_gpio.h>
186 +
187 +#include <asm/irq.h>
188 +
189 +#undef DEBUG_IRQ
190 +#ifdef DEBUG_IRQ
191 +/* note: prints function name for you */
192 +#define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
193 +#else
194 +#define DPRINTK(fmt, args...)
195 +#endif
196 +
197 +extern asmlinkage void idtIRQ(void);
198 +static unsigned int startup_irq(unsigned int irq);
199 +static void end_irq(unsigned int irq_nr);
200 +static void mask_and_ack_irq(unsigned int irq_nr);
201 +static void aruba_enable_irq(unsigned int irq_nr);
202 +static void aruba_disable_irq(unsigned int irq_nr);
203 +
204 +extern void __init init_generic_irq(void);
205 +
206 +typedef struct {
207 +       u32 mask;
208 +       volatile u32 *base_addr;
209 +} intr_group_t;
210 +
211 +static const intr_group_t intr_group_merlot[NUM_INTR_GROUPS] = {
212 +       {0xffffffff, (u32 *) KSEG1ADDR(IC_GROUP0_PEND + 0)},
213 +};
214 +
215 +#define READ_PEND_MERLOT(base) (*((volatile unsigned long *)(0xbc003010)))
216 +#define READ_MASK_MERLOT(base) (*((volatile unsigned long *)(0xbc003010 + 4)))
217 +#define WRITE_MASK_MERLOT(base, val) ((*((volatile unsigned long *)((0xbc003010) + 4))) = (val))
218 +
219 +static const intr_group_t intr_group_muscat[NUM_INTR_GROUPS] = {
220 +       {0x0000efff, (u32 *) KSEG1ADDR(IC_GROUP0_PEND + 0 * IC_GROUP_OFFSET)},
221 +       {0x00001fff, (u32 *) KSEG1ADDR(IC_GROUP0_PEND + 1 * IC_GROUP_OFFSET)},
222 +       {0x00000007, (u32 *) KSEG1ADDR(IC_GROUP0_PEND + 2 * IC_GROUP_OFFSET)},
223 +       {0x0003ffff, (u32 *) KSEG1ADDR(IC_GROUP0_PEND + 3 * IC_GROUP_OFFSET)},
224 +       {0xffffffff, (u32 *) KSEG1ADDR(IC_GROUP0_PEND + 4 * IC_GROUP_OFFSET)}
225 +};
226 +
227 +#define READ_PEND_MUSCAT(base) (*(base))
228 +#define READ_MASK_MUSCAT(base) (*(base + 2))
229 +#define WRITE_MASK_MUSCAT(base, val) (*(base + 2) = (val))
230 +
231 +static inline int irq_to_group(unsigned int irq_nr)
232 +{
233 +       switch (mips_machtype) {
234 +               case MACH_ARUBA_AP70:
235 +                       return ((irq_nr - GROUP0_IRQ_BASE) >> 5);
236 +               case MACH_ARUBA_AP65:
237 +               case MACH_ARUBA_AP60:
238 +               default:
239 +                       return 0;
240 +       }
241 +}
242 +
243 +static inline int group_to_ip(unsigned int group)
244 +{
245 +       switch (mips_machtype) {
246 +               case MACH_ARUBA_AP70:
247 +                       return group + 2;
248 +               case MACH_ARUBA_AP65:
249 +               case MACH_ARUBA_AP60:
250 +               default:
251 +                       return 6;
252 +       }
253 +}
254 +
255 +static inline void enable_local_irq(unsigned int ip)
256 +{
257 +       int ipnum = 0x100 << ip;
258 +       clear_c0_cause(ipnum);
259 +       set_c0_status(ipnum);
260 +}
261 +
262 +static inline void disable_local_irq(unsigned int ip)
263 +{
264 +       int ipnum = 0x100 << ip;
265 +       clear_c0_status(ipnum);
266 +}
267 +
268 +static inline void ack_local_irq(unsigned int ip)
269 +{
270 +       int ipnum = 0x100 << ip;
271 +       clear_c0_cause(ipnum);
272 +}
273 +
274 +static void aruba_enable_irq(unsigned int irq_nr)
275 +{
276 +       int ip = irq_nr - GROUP0_IRQ_BASE;
277 +       unsigned int group, intr_bit;
278 +       volatile unsigned int *addr;
279 +       if (ip < 0) {
280 +               enable_local_irq(irq_nr);
281 +       } else {
282 +               // calculate group
283 +               switch (mips_machtype) {
284 +                       case MACH_ARUBA_AP70:
285 +                               group = ip >> 5;
286 +                               break;
287 +                       case MACH_ARUBA_AP65:
288 +                       case MACH_ARUBA_AP60:
289 +                       default:
290 +                               group = 0;
291 +                               break;
292 +               }
293 +
294 +               // calc interrupt bit within group
295 +               ip -= (group << 5);
296 +               intr_bit = 1 << ip;
297 +
298 +               // first enable the IP mapped to this IRQ
299 +               enable_local_irq(group_to_ip(group));
300 +
301 +               switch (mips_machtype) {
302 +                       case MACH_ARUBA_AP70:
303 +                               addr = intr_group_muscat[group].base_addr;
304 +                               // unmask intr within group
305 +                               WRITE_MASK_MUSCAT(addr, READ_MASK_MUSCAT(addr) & ~intr_bit);
306 +                               break;
307 +                       case MACH_ARUBA_AP65:
308 +                       case MACH_ARUBA_AP60:
309 +                       default:
310 +                               addr = intr_group_merlot[group].base_addr;
311 +                               WRITE_MASK_MERLOT(addr, (READ_MASK_MERLOT(addr) | intr_bit));
312 +                               break;
313 +               }
314 +       }
315 +}
316 +
317 +static void aruba_disable_irq(unsigned int irq_nr)
318 +{
319 +       int ip = irq_nr - GROUP0_IRQ_BASE;
320 +       unsigned int group, intr_bit, mask;
321 +       volatile unsigned int *addr;
322 +
323 +       // calculate group
324 +       switch (mips_machtype) {
325 +               case MACH_ARUBA_AP70:
326 +                       group = ip >> 5;
327 +                       break;
328 +               case MACH_ARUBA_AP65:
329 +               case MACH_ARUBA_AP60:
330 +               default:
331 +                       group = 0;
332 +                       break;
333 +       }
334 +
335 +       // calc interrupt bit within group
336 +       ip -= group << 5;
337 +       intr_bit = 1 << ip;
338 +
339 +       switch (mips_machtype) {
340 +               case MACH_ARUBA_AP70:
341 +                       addr = intr_group_muscat[group].base_addr;
342 +                       // mask intr within group
343 +                       mask = READ_MASK_MUSCAT(addr);
344 +                       mask |= intr_bit;
345 +                       WRITE_MASK_MUSCAT(addr, mask);
346 +       
347 +                       /*
348 +                          if there are no more interrupts enabled in this
349 +                          group, disable corresponding IP
350 +                        */
351 +                       if (mask == intr_group_muscat[group].mask)
352 +                               disable_local_irq(group_to_ip(group));
353 +                       break;
354 +               case MACH_ARUBA_AP65:
355 +               case MACH_ARUBA_AP60:
356 +               default:
357 +                       addr = intr_group_merlot[group].base_addr;
358 +                       addr = intr_group_merlot[group].base_addr;
359 +                       // mask intr within group
360 +                       WRITE_MASK_MERLOT(addr, (READ_MASK_MERLOT(addr) & ~intr_bit));
361 +                       if (READ_MASK_MERLOT(addr))
362 +                               disable_local_irq(group_to_ip(group));
363 +                       break;
364 +       }
365 +}
366 +
367 +static unsigned int startup_irq(unsigned int irq_nr)
368 +{
369 +       aruba_enable_irq(irq_nr);
370 +       return 0;
371 +}
372 +
373 +static void shutdown_irq(unsigned int irq_nr)
374 +{
375 +       aruba_disable_irq(irq_nr);
376 +       return;
377 +}
378 +
379 +static void mask_and_ack_irq(unsigned int irq_nr)
380 +{
381 +       aruba_disable_irq(irq_nr);
382 +       ack_local_irq(group_to_ip(irq_to_group(irq_nr)));
383 +}
384 +
385 +static void end_irq(unsigned int irq_nr)
386 +{
387 +
388 +       int ip = irq_nr - GROUP0_IRQ_BASE;
389 +       unsigned int intr_bit, group;
390 +       volatile unsigned int *addr;
391 +
392 +       if (irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS)) {
393 +               printk("warning: end_irq %d did not enable (%x)\n",
394 +                      irq_nr, irq_desc[irq_nr].status);
395 +       }
396 +
397 +       switch (mips_machtype) {
398 +               case MACH_ARUBA_AP70:
399 +                       if (irq_nr == GROUP4_IRQ_BASE + 9)       idt_gpio->gpioistat &= 0xfffffdff;
400 +                       else if (irq_nr == GROUP4_IRQ_BASE + 10) idt_gpio->gpioistat &= 0xfffffbff;
401 +                       else if (irq_nr == GROUP4_IRQ_BASE + 11) idt_gpio->gpioistat &= 0xfffff7ff;
402 +                       else if (irq_nr == GROUP4_IRQ_BASE + 12) idt_gpio->gpioistat &= 0xffffefff;
403 +       
404 +                       group = ip >> 5;
405 +       
406 +                       // calc interrupt bit within group
407 +                       ip -= (group << 5);
408 +                       intr_bit = 1 << ip;
409 +       
410 +                       // first enable the IP mapped to this IRQ
411 +                       enable_local_irq(group_to_ip(group));
412 +       
413 +                       addr = intr_group_muscat[group].base_addr;
414 +                       // unmask intr within group
415 +                       WRITE_MASK_MUSCAT(addr, READ_MASK_MUSCAT(addr) & ~intr_bit);
416 +                       break;
417 +               case MACH_ARUBA_AP65:
418 +               case MACH_ARUBA_AP60:
419 +                       group = 0;
420 +                       // calc interrupt bit within group
421 +                       intr_bit = 1 << ip;
422 +                       // first enable the IP mapped to this IRQ
423 +                       enable_local_irq(group_to_ip(group));
424 +                       addr = intr_group_merlot[group].base_addr;
425 +                       // unmask intr within group
426 +                       WRITE_MASK_MERLOT(addr, (READ_MASK_MERLOT(addr) | intr_bit));
427 +                       break;
428 +       }
429 +}
430 +
431 +static struct hw_interrupt_type aruba_irq_type = {
432 +       .typename = "IDT434",
433 +       .startup = startup_irq,
434 +       .shutdown = shutdown_irq,
435 +       .enable = aruba_enable_irq,
436 +       .disable = aruba_disable_irq,
437 +       .ack = mask_and_ack_irq,
438 +       .end = end_irq,
439 +};
440 +
441 +void __init arch_init_irq(void)
442 +{
443 +       int i;
444 +       printk("Initializing IRQ's: %d out of %d\n", RC32434_NR_IRQS, NR_IRQS);
445 +       memset(irq_desc, 0, sizeof(irq_desc));
446 +       set_except_vector(0, idtIRQ);
447 +
448 +       for (i = 0; i < RC32434_NR_IRQS; i++) {
449 +               irq_desc[i].status = IRQ_DISABLED;
450 +               irq_desc[i].action = NULL;
451 +               irq_desc[i].depth = 1;
452 +               irq_desc[i].handler = &aruba_irq_type;
453 +               spin_lock_init(&irq_desc[i].lock);
454 +       }
455 +
456 +       switch (mips_machtype) {
457 +               case MACH_ARUBA_AP70:
458 +                       break;
459 +               case MACH_ARUBA_AP65:
460 +               case MACH_ARUBA_AP60:
461 +               default:
462 +                       WRITE_MASK_MERLOT(intr_group_merlot[0].base_addr, 0);
463 +                       *((volatile unsigned long *)0xbc003014) = 0x10;
464 +                       break;
465 +       }
466 +}
467 +
468 +/* Main Interrupt dispatcher */
469 +void aruba_irqdispatch(unsigned long cp0_cause, struct pt_regs *regs)
470 +{
471 +       unsigned int pend, group, ip;
472 +       volatile unsigned int *addr;
473 +       switch (mips_machtype) {
474 +               case MACH_ARUBA_AP70:
475 +                       if ((ip = (cp0_cause & 0x7c00))) {
476 +                               group = 21 - rc32434_clz(ip);
477 +               
478 +                               addr = intr_group_muscat[group].base_addr;
479 +               
480 +                               pend = READ_PEND_MUSCAT(addr);
481 +                               pend &= ~READ_MASK_MUSCAT(addr);        // only unmasked interrupts
482 +                               pend = 39 - rc32434_clz(pend);
483 +                               do_IRQ((group << 5) + pend, regs);
484 +                       }
485 +                       break;
486 +               case MACH_ARUBA_AP65:
487 +               case MACH_ARUBA_AP60:
488 +               default:
489 +                       #define MERLOT_WLAN1_IRQ   2    // bit 10 in CP0_status register
490 +                       #define MERLOT_ENET_IRQ    4    // bit 11 in CP0_status register
491 +                       #define MERLOT_WLAN_IRQ    5    // bit 13 in CP0_status register
492 +                       #define MERLOT_MISC_IRQ    6    // bit 14 in CP0_status register = GROUP 0
493 +       
494 +                       if (cp0_cause & (1 << (8 + MERLOT_MISC_IRQ))) {
495 +                               // Misc Interrupt
496 +                               group = 0;
497 +                               addr = intr_group_merlot[group].base_addr;
498 +                               pend = READ_PEND_MERLOT(addr);
499 +                               pend &= READ_MASK_MERLOT(addr); // only unmasked interrupts
500 +                               /* handle one misc interrupt at a time */
501 +                               while (pend) {
502 +                                       unsigned int intr_bit, irq_nr;
503 +                                       intr_bit = pend ^ (pend - 1);
504 +                                       irq_nr = ((31 - rc32434_clz(pend)) + GROUP0_IRQ_BASE);
505 +                                       do_IRQ(irq_nr, regs);
506 +                                       do_IRQ(irq_nr, regs);
507 +                                       pend &= ~intr_bit;
508 +                               }
509 +                       }
510 +       
511 +                       if (cp0_cause & (1 << (8 + MERLOT_WLAN_IRQ))) {
512 +                               do_IRQ(MERLOT_WLAN_IRQ, regs);
513 +                       }
514 +       
515 +                       if (cp0_cause & (1 << (8 + MERLOT_ENET_IRQ))) {
516 +                               do_IRQ(MERLOT_ENET_IRQ, regs);
517 +                       }
518 +                       break;
519 +       }
520 +}
521 diff -Nur linux-2.6.15/arch/mips/aruba/Makefile linux-2.6.15-openwrt/arch/mips/aruba/Makefile
522 --- linux-2.6.15/arch/mips/aruba/Makefile       1970-01-01 01:00:00.000000000 +0100
523 +++ linux-2.6.15-openwrt/arch/mips/aruba/Makefile       2006-01-10 00:32:32.000000000 +0100
524 @@ -0,0 +1,49 @@
525 +###############################################################################
526 +#
527 +#  BRIEF MODULE DESCRIPTION
528 +#     Makefile for IDT EB434 BSP
529 +#
530 +#  Copyright 2004 IDT Inc. (rischelp@idt.com)
531 +#
532 +#  This program is free software; you can redistribute  it and/or modify it
533 +#  under  the terms of  the GNU General  Public License as published by the
534 +#  Free Software Foundation;  either version 2 of the  License, or (at your
535 +#  option) any later version.
536 +#
537 +#  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
538 +#  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
539 +#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
540 +#   NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
541 +#   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
542 +#   NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
543 +#   USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
544 +#   ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
545 +#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
546 +#   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
547 +#
548 +#   You should have received a copy of the  GNU General Public License along
549 +#   with this program; if not, write  to the Free Software Foundation, Inc.,
550 +#   675 Mass Ave, Cambridge, MA 02139, USA.
551 +# 
552 +# 
553 +###############################################################################
554 +#  May 2004 rkt, neb
555 +# 
556 +#  Initial Release
557 +# 
558 +#  
559 +# 
560 +###############################################################################
561 +
562 +
563 +# .S.s:
564 +#      $(CPP) $(CFLAGS) $< -o $*.s
565 +# .S.o:
566 +#      $(CC) $(CFLAGS) -c $< -o $*.o
567 +
568 +obj-y   := prom.o setup.o idtIRQ.o irq.o time.o flash_lock.o wdt_merlot.o
569 +obj-$(CONFIG_SERIAL_8250)              += serial.o
570 +
571 +subdir-y         += nvram
572 +obj-y            += nvram/built-in.o
573 +
574 diff -Nur linux-2.6.15/arch/mips/aruba/nvram/Makefile linux-2.6.15-openwrt/arch/mips/aruba/nvram/Makefile
575 --- linux-2.6.15/arch/mips/aruba/nvram/Makefile 1970-01-01 01:00:00.000000000 +0100
576 +++ linux-2.6.15-openwrt/arch/mips/aruba/nvram/Makefile 2006-01-10 00:32:32.000000000 +0100
577 @@ -0,0 +1,46 @@
578 +###############################################################################
579 +#
580 +#  BRIEF MODULE DESCRIPTION
581 +#     Makefile for IDT EB434 nvram access routines
582 +#
583 +#  Copyright 2004 IDT Inc. (rischelp@idt.com)
584 +#
585 +#  This program is free software; you can redistribute  it and/or modify it
586 +#  under  the terms of  the GNU General  Public License as published by the
587 +#  Free Software Foundation;  either version 2 of the  License, or (at your
588 +#  option) any later version.
589 +#
590 +#  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
591 +#  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
592 +#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
593 +#   NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
594 +#   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
595 +#   NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
596 +#   USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
597 +#   ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
598 +#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
599 +#   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
600 +#
601 +#   You should have received a copy of the  GNU General Public License along
602 +#   with this program; if not, write  to the Free Software Foundation, Inc.,
603 +#   675 Mass Ave, Cambridge, MA 02139, USA.
604 +#
605 +#
606 +###############################################################################
607 +#  May 2004  rkt, neb
608 +#
609 +#  Initial Release
610 +#
611 +#
612 +#
613 +###############################################################################
614 +
615 +obj-y   := nvram434.o
616 +obj-m   := $(O_TARGET)
617 +
618 +
619 +
620 +
621 +
622 +
623 +
624 diff -Nur linux-2.6.15/arch/mips/aruba/nvram/nvram434.c linux-2.6.15-openwrt/arch/mips/aruba/nvram/nvram434.c
625 --- linux-2.6.15/arch/mips/aruba/nvram/nvram434.c       1970-01-01 01:00:00.000000000 +0100
626 +++ linux-2.6.15-openwrt/arch/mips/aruba/nvram/nvram434.c       2006-01-10 00:32:32.000000000 +0100
627 @@ -0,0 +1,392 @@
628 +/**************************************************************************
629 + *
630 + *  BRIEF MODULE DESCRIPTION
631 + *     nvram interface routines.
632 + *
633 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
634 + *         
635 + *  This program is free software; you can redistribute  it and/or modify it
636 + *  under  the terms of  the GNU General  Public License as published by the
637 + *  Free Software Foundation;  either version 2 of the  License, or (at your
638 + *  option) any later version.
639 + *
640 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
641 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
642 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
643 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
644 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
645 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
646 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
647 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
648 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
649 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
650 + *
651 + *  You should have received a copy of the  GNU General Public License along
652 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
653 + *  675 Mass Ave, Cambridge, MA 02139, USA.
654 + *
655 + *
656 + **************************************************************************
657 + * May 2004 rkt, neb
658 + *
659 + * Initial Release
660 + *
661 + * 
662 + *
663 + **************************************************************************
664 + */
665 +
666 +#include <linux/ctype.h>
667 +#include <linux/string.h>
668 +
669 +//#include <asm/ds1553rtc.h>
670 +#include "nvram434.h"
671 +#define  NVRAM_BASE 0xbfff8000
672 +
673 +extern void setenv (char *e, char *v, int rewrite);
674 +extern void unsetenv (char *e);
675 +extern void mapenv (int (*func)(char *, char *));
676 +extern char *getenv (char *s);
677 +extern void purgeenv(void);
678 +
679 +static void nvram_initenv(void);
680 +
681 +static unsigned char
682 +nvram_getbyte(int offs)
683 +{
684 +  return(*((unsigned char*)(NVRAM_BASE + offs)));
685 +}
686 +
687 +static void
688 +nvram_setbyte(int offs, unsigned char val)
689 +{
690 +  unsigned char* nvramDataPointer = (unsigned char*)(NVRAM_BASE + offs);
691 +
692 +  *nvramDataPointer = val;
693 +}
694 +
695 +/*
696 + * BigEndian!
697 + */
698 +static unsigned short
699 +nvram_getshort(int offs)
700 +{
701 +  return((nvram_getbyte(offs) << 8) | nvram_getbyte(offs + 1));
702 +}
703 +
704 +static void
705 +nvram_setshort(int offs, unsigned short val)
706 +{
707 +  nvram_setbyte(offs, (unsigned char)((val >> 8) & 0xff));
708 +  nvram_setbyte(offs + 1, (unsigned char)(val & 0xff));
709 +}
710 +#if 0
711 +static unsigned int
712 +nvram_getint(int offs)
713 +{
714 +  unsigned int val;
715 +  val = nvram_getbyte(offs) << 24;
716 +  val |= nvram_getbyte(offs + 1) << 16;
717 +  val |= nvram_getbyte(offs + 2) << 8;
718 +  val |= nvram_getbyte(offs + 3);
719 +  return(val);
720 +}
721 +
722 +static void
723 +nvram_setint(int offs, unsigned int val)
724 +{
725 +  nvram_setbyte(offs, val >> 24);
726 +  nvram_setbyte(offs + 1, val >> 16);
727 +  nvram_setbyte(offs + 2, val >> 8);
728 +  nvram_setbyte(offs + 3, val);
729 +}
730 +#endif
731 +/*
732 + * calculate NVRAM checksum
733 + */
734 +static unsigned short
735 +nvram_calcsum(void)
736 +{
737 +  unsigned short sum = NV_MAGIC;
738 +  int     i;
739 +
740 +  for (i = ENV_BASE; i < ENV_TOP; i += 2)
741 +    sum += nvram_getshort(i);
742 +  return(sum);
743 +}
744 +
745 +/*
746 + * update the nvram checksum
747 + */
748 +static void
749 +nvram_updatesum (void)
750 +{
751 +  nvram_setshort(NVOFF_CSUM, nvram_calcsum());
752 +}
753 +
754 +/*
755 + * test validity of nvram by checksumming it
756 + */
757 +static int
758 +nvram_isvalid(void)
759 +{
760 +  static int  is_valid;
761 +
762 +  if (is_valid)
763 +    return(1);
764 +
765 +  if (nvram_getshort(NVOFF_MAGIC) != NV_MAGIC) {
766 +       printk("nvram_isvalid FAILED\n");
767 +    //nvram_initenv();
768 +  }
769 +  is_valid = 1;
770 +  return(1);
771 +}
772 +
773 +/* return nvram address of environment string */
774 +static int
775 +nvram_matchenv(char *s)
776 +{
777 +  int envsize, envp, n, i, varsize;
778 +  char *var;
779 +
780 +  envsize = nvram_getshort(NVOFF_ENVSIZE);
781 +
782 +  if (envsize > ENV_AVAIL)
783 +    return(0);     /* sanity */
784 +    
785 +  envp = ENV_BASE;
786 +
787 +  if ((n = strlen (s)) > 255)
788 +    return(0);
789 +    
790 +  while (envsize > 0) {
791 +    varsize = nvram_getbyte(envp);
792 +    if (varsize == 0 || (envp + varsize) > ENV_TOP)
793 +      return(0);   /* sanity */
794 +    for (i = envp + 1, var = s; i <= envp + n; i++, var++) {
795 +      char c1 = nvram_getbyte(i);
796 +      char c2 = *var;
797 +      if (islower(c1))
798 +        c1 = toupper(c1);
799 +      if (islower(c2))
800 +        c2 = toupper(c2);
801 +      if (c1 != c2)
802 +        break;
803 +    }
804 +    if (i > envp + n) {       /* match so far */
805 +      if (n == varsize - 1)   /* match on boolean */
806 +        return(envp);
807 +      if (nvram_getbyte(i) == '=')  /* exact match on variable */
808 +        return(envp);
809 +    }
810 +    envsize -= varsize;
811 +    envp += varsize;
812 +  }
813 +  return(0);
814 +}
815 +
816 +static void nvram_initenv(void)
817 +{
818 +  nvram_setshort(NVOFF_MAGIC, NV_MAGIC);
819 +  nvram_setshort(NVOFF_ENVSIZE, 0);
820 +
821 +  nvram_updatesum();
822 +}
823 +
824 +static void
825 +nvram_delenv(char *s)
826 +{
827 +  int nenvp, envp, envsize, nbytes;
828 +
829 +  envp = nvram_matchenv(s);
830 +  if (envp == 0)
831 +    return;
832 +
833 +  nenvp = envp + nvram_getbyte(envp);
834 +  envsize = nvram_getshort(NVOFF_ENVSIZE);
835 +  nbytes = envsize - (nenvp - ENV_BASE);
836 +  nvram_setshort(NVOFF_ENVSIZE, envsize - (nenvp - envp));
837 +  while (nbytes--) {
838 +    nvram_setbyte(envp, nvram_getbyte(nenvp));
839 +    envp++;
840 +    nenvp++;
841 +  }
842 +  nvram_updatesum();
843 +}
844 +
845 +static int
846 +nvram_setenv(char *s, char *v)
847 +{
848 +  int ns, nv, total;
849 +  int envp;
850 +
851 +  if (!nvram_isvalid())
852 +    return(-1);
853 +
854 +  nvram_delenv(s);
855 +  ns = strlen(s);
856 +  if (ns == 0)
857 +    return (-1);
858 +  if (v && *v) {
859 +    nv = strlen(v);
860 +    total = ns + nv + 2;
861 +  }
862 +  else {
863 +    nv = 0;
864 +    total = ns + 1;
865 +  }
866 +  if (total > 255 || total > ENV_AVAIL - nvram_getshort(NVOFF_ENVSIZE))
867 +    return(-1);
868 +
869 +  envp = ENV_BASE + nvram_getshort(NVOFF_ENVSIZE);
870 +
871 +  nvram_setbyte(envp, (unsigned char) total); 
872 +  envp++;
873 +
874 +  while (ns--) {
875 +    nvram_setbyte(envp, *s); 
876 +    envp++; 
877 +    s++;
878 +  }
879 +
880 +  if (nv) {
881 +    nvram_setbyte(envp, '='); 
882 +    envp++;
883 +    while (nv--) {
884 +      nvram_setbyte(envp, *v); 
885 +      envp++; 
886 +      v++;
887 +    }
888 +  }
889 +  nvram_setshort(NVOFF_ENVSIZE, envp-ENV_BASE);
890 +  nvram_updatesum();
891 +  return 0;
892 +}
893 +
894 +static char *
895 +nvram_getenv(char *s)
896 +{
897 +  static char buf[256];   /* FIXME: this cannot be static */
898 +  int envp, ns, nbytes, i;
899 +
900 +  if (!nvram_isvalid())
901 +    return "INVALID NVRAM"; //((char *)0);
902 +
903 +  envp = nvram_matchenv(s);
904 +  if (envp == 0)
905 +    return "NOT FOUND"; //((char *)0);
906 +  ns = strlen(s);
907 +  if (nvram_getbyte(envp) == ns + 1)  /* boolean */
908 +    buf[0] = '\0';
909 +  else {
910 +    nbytes = nvram_getbyte(envp) - (ns + 2);
911 +    envp += ns + 2;
912 +    for (i = 0; i < nbytes; i++)
913 +      buf[i] = nvram_getbyte(envp++);
914 +    buf[i] = '\0';
915 +  }
916 +  return(buf);
917 +}
918 +
919 +static void
920 +nvram_unsetenv(char *s)
921 +{
922 +  if (!nvram_isvalid())
923 +    return;
924 +
925 +  nvram_delenv(s);
926 +}
927 +
928 +/*
929 + * apply func to each string in environment
930 + */
931 +static void
932 +nvram_mapenv(int (*func)(char *, char *))
933 +{
934 +  int envsize, envp, n, i, seeneql;
935 +  char name[256], value[256];
936 +  char c, *s;
937 +
938 +  if (!nvram_isvalid())
939 +    return;
940 +
941 +  envsize = nvram_getshort(NVOFF_ENVSIZE);
942 +  envp = ENV_BASE;
943 +
944 +  while (envsize > 0) {
945 +    value[0] = '\0';
946 +    seeneql = 0;
947 +    s = name;
948 +    n = nvram_getbyte(envp);
949 +    for (i = envp + 1; i < envp + n; i++) {
950 +      c = nvram_getbyte(i);
951 +      if ((c == '=') && !seeneql) {
952 +        *s = '\0';
953 +        s = value;
954 +        seeneql = 1;
955 +        continue;
956 +      }
957 +      *s++ = c;
958 +    }
959 +    *s = '\0';
960 +    (*func)(name, value);
961 +    envsize -= n;
962 +    envp += n;
963 +  }
964 +}
965 +#if 0
966 +static unsigned int
967 +digit(char c)
968 +{
969 +  if ('0' <= c && c <= '9')
970 +    return (c - '0');
971 +  if ('A' <= c && c <= 'Z')
972 +    return (10 + c - 'A');
973 +  if ('a' <= c && c <= 'z')
974 +    return (10 + c - 'a');
975 +  return (~0);
976 +}
977 +#endif
978 +/*
979 + * Wrappers to allow 'special' environment variables to get processed
980 + */
981 +void
982 +setenv(char *e, char *v, int rewrite)
983 +{
984 +  if (nvram_getenv(e) && !rewrite)
985 +    return;
986 +    
987 +  nvram_setenv(e, v);
988 +}
989 +
990 +char *
991 +getenv(char *e)
992 +{
993 +  return(nvram_getenv(e));
994 +}
995 +
996 +void
997 +unsetenv(char *e)
998 +{
999 +  nvram_unsetenv(e);
1000 +}
1001 +
1002 +void
1003 +purgeenv()
1004 +{
1005 +  int i;
1006 +  unsigned char* nvramDataPointer = (unsigned char*)(NVRAM_BASE);
1007 +  
1008 +  for (i = ENV_BASE; i < ENV_TOP; i++)
1009 +    *nvramDataPointer++ = 0;
1010 +  nvram_setshort(NVOFF_MAGIC, NV_MAGIC);
1011 +  nvram_setshort(NVOFF_ENVSIZE, 0);
1012 +  nvram_setshort(NVOFF_CSUM, NV_MAGIC);
1013 +}
1014 +
1015 +void
1016 +mapenv(int (*func)(char *, char *))
1017 +{
1018 +  nvram_mapenv(func);
1019 +}
1020 diff -Nur linux-2.6.15/arch/mips/aruba/nvram/nvram434.h linux-2.6.15-openwrt/arch/mips/aruba/nvram/nvram434.h
1021 --- linux-2.6.15/arch/mips/aruba/nvram/nvram434.h       1970-01-01 01:00:00.000000000 +0100
1022 +++ linux-2.6.15-openwrt/arch/mips/aruba/nvram/nvram434.h       2006-01-10 00:32:32.000000000 +0100
1023 @@ -0,0 +1,66 @@
1024 +/**************************************************************************
1025 + *
1026 + *  BRIEF MODULE DESCRIPTION
1027 + *     nvram definitions.
1028 + *
1029 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1030 + *         
1031 + *  This program is free software; you can redistribute  it and/or modify it
1032 + *  under  the terms of  the GNU General  Public License as published by the
1033 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1034 + *  option) any later version.
1035 + *
1036 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1037 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1038 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1039 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1040 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1041 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1042 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1043 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1044 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1045 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1046 + *
1047 + *  You should have received a copy of the  GNU General Public License along
1048 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1049 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1050 + *
1051 + *
1052 + **************************************************************************
1053 + * May 2004 rkt, neb
1054 + *
1055 + * Initial Release
1056 + *
1057 + * 
1058 + *
1059 + **************************************************************************
1060 + */
1061 +
1062 +
1063 +#ifndef _NVRAM_
1064 +#define _NVRAM_
1065 +#define NVOFFSET        0                 /* use all of NVRAM */
1066 +
1067 +/* Offsets to reserved locations */
1068 +              /* size description */
1069 +#define NVOFF_MAGIC     (NVOFFSET + 0)    /* 2 magic value */
1070 +#define NVOFF_CSUM      (NVOFFSET + 2)    /* 2 NVRAM environment checksum */
1071 +#define NVOFF_ENVSIZE   (NVOFFSET + 4)    /* 2 size of 'environment' */
1072 +#define NVOFF_TEST      (NVOFFSET + 5)    /* 1 cold start test byte */
1073 +#define NVOFF_ETHADDR   (NVOFFSET + 6)    /* 6 decoded ethernet address */
1074 +#define NVOFF_UNUSED    (NVOFFSET + 12)   /* 0 current end of table */
1075 +
1076 +#define NV_MAGIC        0xdeaf            /* nvram magic number */
1077 +#define NV_RESERVED     6                 /* number of reserved bytes */
1078 +
1079 +#undef  NVOFF_ETHADDR
1080 +#define NVOFF_ETHADDR   (NVOFFSET + NV_RESERVED - 6)
1081 +
1082 +/* number of bytes available for environment */
1083 +#define ENV_BASE        (NVOFFSET + NV_RESERVED)
1084 +#define ENV_TOP         0x2000
1085 +#define ENV_AVAIL       (ENV_TOP - ENV_BASE)
1086 +
1087 +#endif /* _NVRAM_ */
1088 +
1089 +
1090 diff -Nur linux-2.6.15/arch/mips/aruba/prom.c linux-2.6.15-openwrt/arch/mips/aruba/prom.c
1091 --- linux-2.6.15/arch/mips/aruba/prom.c 1970-01-01 01:00:00.000000000 +0100
1092 +++ linux-2.6.15-openwrt/arch/mips/aruba/prom.c 2006-01-10 00:32:32.000000000 +0100
1093 @@ -0,0 +1,111 @@
1094 +/**************************************************************************
1095 + *
1096 + *  BRIEF MODULE DESCRIPTION
1097 + *     prom interface routines
1098 + *
1099 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1100 + *         
1101 + *  This program is free software; you can redistribute  it and/or modify it
1102 + *  under  the terms of  the GNU General  Public License as published by the
1103 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1104 + *  option) any later version.
1105 + *
1106 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1107 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1108 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1109 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1110 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1111 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1112 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1113 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1114 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1115 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1116 + *
1117 + *  You should have received a copy of the  GNU General Public License along
1118 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1119 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1120 + *
1121 + *
1122 + **************************************************************************
1123 + * May 2004 rkt, neb
1124 + *
1125 + * Initial Release
1126 + *
1127 + * 
1128 + *
1129 + **************************************************************************
1130 + */
1131 +
1132 +#include <linux/config.h>
1133 +#include <linux/init.h>
1134 +#include <linux/mm.h>
1135 +#include <linux/module.h>
1136 +#include <linux/string.h>
1137 +#include <linux/console.h>
1138 +#include <asm/bootinfo.h>
1139 +#include <linux/bootmem.h>
1140 +#include <linux/ioport.h>
1141 +#include <linux/serial.h>
1142 +#include <linux/serialP.h>
1143 +#include <asm/serial.h>
1144 +#include <linux/ioport.h>
1145 +
1146 +unsigned int idt_cpu_freq;
1147 +EXPORT_SYMBOL(idt_cpu_freq);
1148 +
1149 +unsigned int arch_has_pci=0;
1150 +
1151 +/* Kernel Boot parameters */
1152 +static unsigned char bootparm[] = "console=ttyS0,9600 root=/dev/mtdblock1 rootfstype=jffs2";
1153 +
1154 +extern unsigned long mips_machgroup;
1155 +extern unsigned long mips_machtype;
1156 +
1157 +extern void setup_serial_port(void);
1158 +extern char * getenv(char *e);
1159 +
1160 +/* IDT 79EB434 memory map -- we really should be auto sizing it */
1161 +#define RAM_SIZE        32*1024*1024
1162 +
1163 +char *__init prom_getcmdline(void)
1164 +{
1165 +       return &(arcs_cmdline[0]);
1166 +}
1167 +
1168 +void __init prom_init(void)
1169 +{
1170 +       char *boardname;
1171 +       sprintf(arcs_cmdline, "%s", bootparm);
1172 +
1173 +       /* set our arch type */
1174 +       mips_machgroup = MACH_GROUP_ARUBA;
1175 +       mips_machtype = MACH_ARUBA_UNKNOWN;
1176 +
1177 +       boardname=getenv("boardname");
1178 +
1179 +       if (!strcmp(boardname,"Muscat")) {
1180 +               mips_machtype = MACH_ARUBA_AP70;
1181 +               idt_cpu_freq = 133000000;
1182 +               arch_has_pci=1;
1183 +       } else if (!strcmp(boardname,"Mataro")) {
1184 +               mips_machtype = MACH_ARUBA_AP65;
1185 +               idt_cpu_freq = 110000000;
1186 +       } else if (!strcmp(boardname,"Merlot")) {
1187 +               mips_machtype = MACH_ARUBA_AP60;
1188 +               idt_cpu_freq = 90000000;
1189 +       }
1190 +
1191 +       /* turn on the console */
1192 +       setup_serial_port();
1193 +
1194 +       /*
1195 +        * give all RAM to boot allocator,
1196 +        * except where the kernel was loaded
1197 +        */
1198 +       add_memory_region(0,RAM_SIZE,BOOT_MEM_RAM);
1199 +}
1200 +
1201 +void prom_free_prom_memory(void)
1202 +{
1203 +       printk("stubbed prom_free_prom_memory()\n");
1204 +}
1205 diff -Nur linux-2.6.15/arch/mips/aruba/serial.c linux-2.6.15-openwrt/arch/mips/aruba/serial.c
1206 --- linux-2.6.15/arch/mips/aruba/serial.c       1970-01-01 01:00:00.000000000 +0100
1207 +++ linux-2.6.15-openwrt/arch/mips/aruba/serial.c       2006-01-10 00:32:32.000000000 +0100
1208 @@ -0,0 +1,94 @@
1209 +/**************************************************************************
1210 + *
1211 + *  BRIEF MODULE DESCRIPTION
1212 + *     Serial port initialisation.
1213 + *
1214 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1215 + *         
1216 + *  This program is free software; you can redistribute  it and/or modify it
1217 + *  under  the terms of  the GNU General  Public License as published by the
1218 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1219 + *  option) any later version.
1220 + *
1221 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1222 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1223 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1224 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1225 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1226 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1227 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1228 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1229 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1230 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1231 + *
1232 + *  You should have received a copy of the  GNU General Public License along
1233 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1234 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1235 + *
1236 + *
1237 + **************************************************************************
1238 + * May 2004 rkt, neb
1239 + *
1240 + * Initial Release
1241 + *
1242 + * 
1243 + *
1244 + **************************************************************************
1245 + */
1246 +
1247 +
1248 +#include <linux/config.h>
1249 +#include <linux/init.h>
1250 +#include <linux/sched.h>
1251 +#include <linux/pci.h>
1252 +#include <linux/interrupt.h>
1253 +#include <linux/tty.h>
1254 +#include <linux/serial.h>
1255 +#include <linux/serial_core.h>
1256 +
1257 +#include <asm/time.h>
1258 +#include <asm/cpu.h>
1259 +#include <asm/bootinfo.h>
1260 +#include <asm/irq.h>
1261 +#include <asm/serial.h>
1262 +
1263 +#include <asm/idt-boards/rc32434/rc32434.h>
1264 +
1265 +extern int __init early_serial_setup(struct uart_port *port);
1266 +
1267 +#define BASE_BAUD (1843200 / 16)
1268 +
1269 +extern unsigned int idt_cpu_freq;
1270 +
1271 +extern int __init setup_serial_port(void)
1272 +{
1273 +       static struct uart_port serial_req[2];
1274 +       
1275 +       memset(serial_req, 0, sizeof(serial_req));
1276 +       serial_req[0].type       = PORT_16550A;
1277 +       serial_req[0].line       = 0;
1278 +       serial_req[0].flags      = STD_COM_FLAGS;
1279 +       serial_req[0].iotype     = SERIAL_IO_MEM;
1280 +       serial_req[0].regshift   = 2;
1281 +       
1282 +       switch (mips_machtype) {
1283 +               case MACH_ARUBA_AP70:
1284 +                       serial_req[0].irq        = 104;
1285 +                       serial_req[0].mapbase    = KSEG1ADDR(0x18058003);
1286 +                       serial_req[0].membase    = (char *) KSEG1ADDR(0x18058003);
1287 +                       serial_req[0].uartclk    = idt_cpu_freq;
1288 +                       break;
1289 +               case MACH_ARUBA_AP65:
1290 +               case MACH_ARUBA_AP60:
1291 +               default:
1292 +                       serial_req[0].irq        = 12;
1293 +                       serial_req[0].mapbase    = KSEG1ADDR(0xbc000003);
1294 +                       serial_req[0].membase    = (char *) KSEG1ADDR(0xbc000003);
1295 +                       serial_req[0].uartclk    = idt_cpu_freq / 2;
1296 +                       break;
1297 +       }
1298 +
1299 +       early_serial_setup(&serial_req[0]);
1300 +       
1301 +       return(0);
1302 +}
1303 diff -Nur linux-2.6.15/arch/mips/aruba/setup.c linux-2.6.15-openwrt/arch/mips/aruba/setup.c
1304 --- linux-2.6.15/arch/mips/aruba/setup.c        1970-01-01 01:00:00.000000000 +0100
1305 +++ linux-2.6.15-openwrt/arch/mips/aruba/setup.c        2006-01-10 00:32:32.000000000 +0100
1306 @@ -0,0 +1,124 @@
1307 +/**************************************************************************
1308 + *
1309 + *  BRIEF MODULE DESCRIPTION
1310 + *     setup routines for IDT EB434 boards
1311 + *
1312 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1313 + *         
1314 + *  This program is free software; you can redistribute  it and/or modify it
1315 + *  under  the terms of  the GNU General  Public License as published by the
1316 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1317 + *  option) any later version.
1318 + *
1319 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1320 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1321 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1322 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1323 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1324 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1325 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1326 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1327 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1328 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1329 + *
1330 + *  You should have received a copy of the  GNU General Public License along
1331 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1332 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1333 + *
1334 + *
1335 + **************************************************************************
1336 + * May 2004 rkt, neb
1337 + *
1338 + * Initial Release
1339 + *
1340 + * 
1341 + *
1342 + **************************************************************************
1343 + */
1344 +
1345 +#include <linux/init.h>
1346 +#include <linux/mm.h>
1347 +#include <linux/sched.h>
1348 +#include <linux/irq.h>
1349 +#include <asm/bootinfo.h>
1350 +#include <asm/io.h>
1351 +#include <linux/ioport.h>
1352 +#include <asm/mipsregs.h>
1353 +#include <asm/pgtable.h>
1354 +#include <asm/reboot.h>
1355 +#include <asm/addrspace.h>     /* for KSEG1ADDR() */
1356 +#include <asm/idt-boards/rc32434/rc32434.h>
1357 +
1358 +extern char *__init prom_getcmdline(void);
1359 +
1360 +extern void (*board_time_init) (void);
1361 +extern void (*board_timer_setup) (struct irqaction * irq);
1362 +extern void aruba_time_init(void);
1363 +extern void aruba_timer_setup(struct irqaction *irq);
1364 +extern void aruba_reset(void);
1365 +
1366 +#define epldMask ((volatile unsigned char *)0xB900000d)
1367 +
1368 +static void aruba_machine_restart(char *command)
1369 +{
1370 +       switch (mips_machtype) {
1371 +               case MACH_ARUBA_AP70:
1372 +                       *(volatile u32 *)KSEG1ADDR(0x18008000) = 0x80000001;
1373 +                       break;
1374 +               case MACH_ARUBA_AP65:
1375 +               case MACH_ARUBA_AP60:
1376 +               default:
1377 +                       /* Reset*/
1378 +                       *((volatile u32 *)KSEG1ADDR(0x1c003020)) = 0x00080350; // reset everything in sight
1379 +                       udelay(100);
1380 +                       *((volatile u32 *)KSEG1ADDR(0x1c003020)) = 0; // reset everything in sight
1381 +                       udelay(100);
1382 +                       *((volatile u32 *)KSEG1ADDR(0x1c003020)) = 0x3; // cold reset the cpu & system
1383 +                       break;
1384 +       }
1385 +}
1386 +
1387 +static void aruba_machine_halt(void)
1388 +{
1389 +       for (;;) continue;
1390 +}
1391 +
1392 +extern char * getenv(char *e);
1393 +extern void unlock_ap60_70_flash(void);
1394 +extern void wdt_merlot_disable(void);
1395 +
1396 +void __init plat_setup(void)
1397 +{
1398 +       board_time_init = aruba_time_init;
1399 +
1400 +       board_timer_setup = aruba_timer_setup;
1401 +
1402 +       _machine_restart = aruba_machine_restart;
1403 +       _machine_halt = aruba_machine_halt;
1404 +       _machine_power_off = aruba_machine_halt;
1405 +
1406 +       set_io_port_base(KSEG1);
1407 +
1408 +       /* Enable PCI interrupts in EPLD Mask register */
1409 +       *epldMask = 0x0;
1410 +       *(epldMask + 1) = 0x0;
1411 +
1412 +       write_c0_wired(0);
1413 +       unlock_ap60_70_flash();
1414 +
1415 +       printk("BOARD - %s\n",getenv("boardname"));
1416 +
1417 +       wdt_merlot_disable();
1418 +
1419 +       return 0;
1420 +}
1421 +
1422 +int page_is_ram(unsigned long pagenr)
1423 +{
1424 +       return 1;
1425 +}
1426 +
1427 +const char *get_system_type(void)
1428 +{
1429 +       return "MIPS IDT32434 - ARUBA";
1430 +}
1431 diff -Nur linux-2.6.15/arch/mips/aruba/time.c linux-2.6.15-openwrt/arch/mips/aruba/time.c
1432 --- linux-2.6.15/arch/mips/aruba/time.c 1970-01-01 01:00:00.000000000 +0100
1433 +++ linux-2.6.15-openwrt/arch/mips/aruba/time.c 2006-01-10 00:32:32.000000000 +0100
1434 @@ -0,0 +1,108 @@
1435 +/**************************************************************************
1436 + *
1437 + *  BRIEF MODULE DESCRIPTION
1438 + *     timer routines for IDT EB434 boards
1439 + *
1440 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1441 + *         
1442 + *  This program is free software; you can redistribute  it and/or modify it
1443 + *  under  the terms of  the GNU General  Public License as published by the
1444 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1445 + *  option) any later version.
1446 + *
1447 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1448 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1449 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1450 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1451 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1452 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1453 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1454 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1455 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1456 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1457 + *
1458 + *  You should have received a copy of the  GNU General Public License along
1459 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1460 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1461 + *
1462 + *
1463 + **************************************************************************
1464 + * May 2004 rkt, neb
1465 + *
1466 + * Initial Release
1467 + *
1468 + * 
1469 + *
1470 + **************************************************************************
1471 + */
1472 +
1473 +#include <linux/config.h>
1474 +#include <linux/init.h>
1475 +#include <linux/kernel_stat.h>
1476 +#include <linux/sched.h>
1477 +#include <linux/spinlock.h>
1478 +#include <linux/mc146818rtc.h>
1479 +#include <linux/irq.h>
1480 +#include <linux/timex.h>
1481 +
1482 +#include <linux/param.h>
1483 +#include <asm/mipsregs.h>
1484 +#include <asm/ptrace.h>
1485 +#include <asm/time.h>
1486 +#include <asm/hardirq.h>
1487 +
1488 +#include <asm/mipsregs.h>
1489 +#include <asm/ptrace.h>
1490 +#include <asm/debug.h>
1491 +#include <asm/time.h>
1492 +
1493 +#include <asm/idt-boards/rc32434/rc32434.h>
1494 +
1495 +static unsigned long r4k_offset;       /* Amount to incr compare reg each time */
1496 +static unsigned long r4k_cur;  /* What counter should be at next timer irq */
1497 +
1498 +extern unsigned int idt_cpu_freq;
1499 +
1500 +static unsigned long __init cal_r4koff(void)
1501 +{
1502 +       mips_hpt_frequency = idt_cpu_freq * IDT_CLOCK_MULT / 2;
1503 +       return (mips_hpt_frequency / HZ);
1504 +}
1505 +
1506 +void __init aruba_time_init(void)
1507 +{
1508 +       unsigned int est_freq, flags;
1509 +       local_irq_save(flags);
1510 +
1511 +       printk("calculating r4koff... ");
1512 +       r4k_offset = cal_r4koff();
1513 +       printk("%08lx(%d)\n", r4k_offset, (int)r4k_offset);
1514 +
1515 +       est_freq = 2 * r4k_offset * HZ;
1516 +       est_freq += 5000;       /* round */
1517 +       est_freq -= est_freq % 10000;
1518 +       printk("CPU frequency %d.%02d MHz\n", est_freq / 1000000,
1519 +              (est_freq % 1000000) * 100 / 1000000);
1520 +       local_irq_restore(flags);
1521 +
1522 +}
1523 +
1524 +void __init aruba_timer_setup(struct irqaction *irq)
1525 +{
1526 +       /* we are using the cpu counter for timer interrupts */
1527 +       setup_irq(MIPS_CPU_TIMER_IRQ, irq);
1528 +
1529 +       /* to generate the first timer interrupt */
1530 +       r4k_cur = (read_c0_count() + r4k_offset);
1531 +       write_c0_compare(r4k_cur);
1532 +
1533 +}
1534 +
1535 +asmlinkage void aruba_timer_interrupt(int irq, struct pt_regs *regs)
1536 +{
1537 +       irq_enter();
1538 +       kstat_this_cpu.irqs[irq]++;
1539 +
1540 +       timer_interrupt(irq, NULL, regs);
1541 +       irq_exit();
1542 +}
1543 diff -Nur linux-2.6.15/arch/mips/aruba/wdt_merlot.c linux-2.6.15-openwrt/arch/mips/aruba/wdt_merlot.c
1544 --- linux-2.6.15/arch/mips/aruba/wdt_merlot.c   1970-01-01 01:00:00.000000000 +0100
1545 +++ linux-2.6.15-openwrt/arch/mips/aruba/wdt_merlot.c   2006-01-10 00:32:32.000000000 +0100
1546 @@ -0,0 +1,30 @@
1547 +#include <linux/config.h>
1548 +#include <linux/kernel.h>
1549 +#include <asm/bootinfo.h>
1550 +
1551 +void wdt_merlot_disable()
1552 +{
1553 +       volatile __u32 *wdt_errcs;
1554 +       volatile __u32 *wdt_wtc;
1555 +       volatile __u32 *wdt_ctl;
1556 +       volatile __u32 val;
1557 +
1558 +       switch (mips_machtype) {
1559 +               case MACH_ARUBA_AP70:
1560 +                       wdt_errcs = (__u32 *) 0xb8030030;
1561 +                       wdt_wtc = (__u32 *) 0xb803003c;
1562 +                       val = *wdt_errcs;
1563 +                       val &= ~0x201;
1564 +                       *wdt_errcs = val;
1565 +                       val = *wdt_wtc;
1566 +                       val &= ~0x1;
1567 +                       *wdt_wtc = val;
1568 +                       break;
1569 +               case MACH_ARUBA_AP65:
1570 +               case MACH_ARUBA_AP60:
1571 +               default:
1572 +                       wdt_ctl = (__u32 *) 0xbc003008;
1573 +                       *wdt_ctl = 0;
1574 +                       break;
1575 +       }
1576 +}
1577 diff -Nur linux-2.6.15/arch/mips/Kconfig linux-2.6.15-openwrt/arch/mips/Kconfig
1578 --- linux-2.6.15/arch/mips/Kconfig      2006-01-03 04:21:10.000000000 +0100
1579 +++ linux-2.6.15-openwrt/arch/mips/Kconfig      2006-01-10 00:32:32.000000000 +0100
1580 @@ -227,6 +227,18 @@
1581           either a NEC Vr5432 or QED RM5231. Say Y here if you wish to build
1582           a kernel for this platform.
1583  
1584 +config MACH_ARUBA
1585 +       bool "Support for the ARUBA product line"
1586 +       select DMA_NONCOHERENT
1587 +       select IRQ_CPU
1588 +       select CPU_HAS_PREFETCH
1589 +       select HW_HAS_PCI
1590 +       select SWAP_IO_SPACE
1591 +       select SYS_SUPPORTS_32BIT_KERNEL
1592 +       select SYS_HAS_CPU_MIPS32_R1
1593 +       select SYS_SUPPORTS_BIG_ENDIAN
1594 +
1595 +
1596  config MACH_JAZZ
1597         bool "Support for the Jazz family of machines"
1598         select ARC
1599 diff -Nur linux-2.6.15/arch/mips/Makefile linux-2.6.15-openwrt/arch/mips/Makefile
1600 --- linux-2.6.15/arch/mips/Makefile     2006-01-03 04:21:10.000000000 +0100
1601 +++ linux-2.6.15-openwrt/arch/mips/Makefile     2006-01-10 00:32:32.000000000 +0100
1602 @@ -258,6 +258,14 @@
1603  #
1604  
1605  #
1606 +# Aruba
1607 +#
1608 +
1609 +core-$(CONFIG_MACH_ARUBA)      += arch/mips/aruba/
1610 +cflags-$(CONFIG_MACH_ARUBA)    += -Iinclude/asm-mips/aruba
1611 +load-$(CONFIG_MACH_ARUBA)      += 0x80100000
1612 +
1613 +#
1614  # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
1615  #
1616  core-$(CONFIG_MACH_JAZZ)       += arch/mips/jazz/
1617 diff -Nur linux-2.6.15/arch/mips/mm/tlbex.c linux-2.6.15-openwrt/arch/mips/mm/tlbex.c
1618 --- linux-2.6.15/arch/mips/mm/tlbex.c   2006-01-03 04:21:10.000000000 +0100
1619 +++ linux-2.6.15-openwrt/arch/mips/mm/tlbex.c   2006-01-10 00:32:32.000000000 +0100
1620 @@ -852,7 +852,6 @@
1621  
1622         case CPU_R10000:
1623         case CPU_R12000:
1624 -       case CPU_4KC:
1625         case CPU_SB1:
1626         case CPU_SB1A:
1627         case CPU_4KSC:
1628 @@ -880,6 +879,7 @@
1629                 tlbw(p);
1630                 break;
1631  
1632 +       case CPU_4KC:
1633         case CPU_4KEC:
1634         case CPU_24K:
1635         case CPU_34K:
1636 diff -Nur linux-2.6.15/arch/mips/pci/fixup-aruba.c linux-2.6.15-openwrt/arch/mips/pci/fixup-aruba.c
1637 --- linux-2.6.15/arch/mips/pci/fixup-aruba.c    1970-01-01 01:00:00.000000000 +0100
1638 +++ linux-2.6.15-openwrt/arch/mips/pci/fixup-aruba.c    2006-01-10 00:34:41.000000000 +0100
1639 @@ -0,0 +1,115 @@
1640 +/**************************************************************************
1641 + *
1642 + *  BRIEF MODULE DESCRIPTION
1643 + *     PCI fixups for IDT EB434 board
1644 + *
1645 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1646 + *         
1647 + *  This program is free software; you can redistribute  it and/or modify it
1648 + *  under  the terms of  the GNU General  Public License as published by the
1649 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1650 + *  option) any later version.
1651 + *
1652 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1653 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1654 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1655 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1656 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1657 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1658 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1659 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1660 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1661 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1662 + *
1663 + *  You should have received a copy of the  GNU General Public License along
1664 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1665 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1666 + *
1667 + *
1668 + **************************************************************************
1669 + * May 2004 rkt, neb
1670 + *
1671 + * Initial Release
1672 + *
1673 + * 
1674 + *
1675 + **************************************************************************
1676 + */
1677 +
1678 +#include <linux/config.h>
1679 +#include <linux/types.h>
1680 +#include <linux/pci.h>
1681 +#include <linux/kernel.h>
1682 +#include <linux/init.h>
1683 +#include <asm/idt-boards/rc32434/rc32434.h>
1684 +#include <asm/idt-boards/rc32434/rc32434_pci.h> 
1685 +
1686 +int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
1687 +{
1688 +       
1689 +       if (dev->bus->number != 0) {
1690 +               return 0;
1691 +       }
1692 +       
1693 +       slot = PCI_SLOT(dev->devfn);
1694 +       dev->irq = 0;
1695 +       
1696 +       if (slot > 0 && slot <= 15) {
1697 +#if 1
1698 +               if(slot == 10) {
1699 +                       if(pin == 1) dev->irq = GROUP4_IRQ_BASE + 9; // intA
1700 +               } else if(slot == 11) {
1701 +                       if(pin == 1) dev->irq = GROUP4_IRQ_BASE + 10; // intA
1702 +                       if(pin == 2) dev->irq = GROUP4_IRQ_BASE + 10; // intA
1703 +                       if(pin == 3) dev->irq = GROUP4_IRQ_BASE + 10; // intA
1704 +               } else if(slot == 12) {
1705 +                       if(pin == 1) dev->irq = GROUP4_IRQ_BASE + 11; // intA
1706 +                       if(pin == 2) dev->irq = GROUP4_IRQ_BASE + 12; // intB
1707 +               } else if (slot == 13) {
1708 +                       if(pin == 1) dev->irq = GROUP4_IRQ_BASE + 12; // intA
1709 +                       if(pin == 2) dev->irq = GROUP4_IRQ_BASE + 11; // intB
1710 +               } else {
1711 +                       dev->irq = GROUP4_IRQ_BASE + 11;
1712 +               }
1713 +#else
1714 +                                switch (pin) {
1715 +                                case 1: /* INTA*/
1716 +                                        dev->irq = GROUP4_IRQ_BASE + 11;
1717 +                                        break;
1718 +                                case 2: /* INTB */
1719 +                                        dev->irq = GROUP4_IRQ_BASE + 11;
1720 +                                        break;
1721 +                                case 3: /* INTC */
1722 +                                        dev->irq = GROUP4_IRQ_BASE + 11;
1723 +                                        break;
1724 +                                case 4: /* INTD */
1725 +                                        dev->irq = GROUP4_IRQ_BASE + 11;
1726 +                                        break;
1727 +                                default:
1728 +                                        dev->irq = 0xff;
1729 +                                        break;
1730 +                                }
1731 +#endif
1732 +#ifdef DEBUG
1733 +               printk("irq fixup: slot %d, pin %d, irq %d\n",
1734 +                      slot, pin, dev->irq);
1735 +#endif
1736 +               pci_write_config_byte(dev, PCI_INTERRUPT_LINE,dev->irq);
1737 +       }
1738 +       return (dev->irq);
1739 +}
1740 +
1741 +struct pci_fixup pcibios_fixups[] = {
1742 +       {0}
1743 +};
1744 +
1745 +
1746 +
1747 +
1748 +
1749 +
1750 +
1751 +
1752 +
1753 +
1754 +
1755 diff -Nur linux-2.6.15/arch/mips/pci/Makefile linux-2.6.15-openwrt/arch/mips/pci/Makefile
1756 --- linux-2.6.15/arch/mips/pci/Makefile 2006-01-03 04:21:10.000000000 +0100
1757 +++ linux-2.6.15-openwrt/arch/mips/pci/Makefile 2006-01-10 00:32:32.000000000 +0100
1758 @@ -56,3 +56,4 @@
1759  obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-tx4938.o ops-tx4938.o
1760  obj-$(CONFIG_VICTOR_MPC30X)    += fixup-mpc30x.o
1761  obj-$(CONFIG_ZAO_CAPCELLA)     += fixup-capcella.o
1762 +obj-$(CONFIG_MACH_ARUBA)        += fixup-aruba.o ops-aruba.o pci-aruba.o
1763 diff -Nur linux-2.6.15/arch/mips/pci/ops-aruba.c linux-2.6.15-openwrt/arch/mips/pci/ops-aruba.c
1764 --- linux-2.6.15/arch/mips/pci/ops-aruba.c      1970-01-01 01:00:00.000000000 +0100
1765 +++ linux-2.6.15-openwrt/arch/mips/pci/ops-aruba.c      2006-01-10 00:32:32.000000000 +0100
1766 @@ -0,0 +1,204 @@
1767 +/**************************************************************************
1768 + *
1769 + *  BRIEF MODULE DESCRIPTION
1770 + *     pci_ops for IDT EB434 board
1771 + *
1772 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1773 + *         
1774 + *  This program is free software; you can redistribute  it and/or modify it
1775 + *  under  the terms of  the GNU General  Public License as published by the
1776 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1777 + *  option) any later version.
1778 + *
1779 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1780 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1781 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1782 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1783 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1784 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1785 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1786 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1787 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1788 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1789 + *
1790 + *  You should have received a copy of the  GNU General Public License along
1791 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
1792 + *  675 Mass Ave, Cambridge, MA 02139, USA.
1793 + *
1794 + *
1795 + **************************************************************************
1796 + * May 2004 rkt, neb
1797 + *
1798 + * Initial Release
1799 + *
1800 + * 
1801 + *
1802 + **************************************************************************
1803 + */
1804 +
1805 +#include <linux/config.h>
1806 +#include <linux/init.h>
1807 +#include <linux/pci.h>
1808 +#include <linux/types.h>
1809 +#include <linux/delay.h>
1810 +
1811 +#include <asm/cpu.h>
1812 +#include <asm/io.h>
1813 +
1814 +#include <asm/idt-boards/rc32434/rc32434.h>
1815 +#include <asm/idt-boards/rc32434/rc32434_pci.h>
1816 +
1817 +#define PCI_ACCESS_READ  0
1818 +#define PCI_ACCESS_WRITE 1
1819 +
1820 +
1821 +#define PCI_CFG_SET(slot,func,off) \
1822 +       (rc32434_pci->pcicfga = (0x80000000 | ((slot)<<11) | \
1823 +                           ((func)<<8) | (off)))
1824 +
1825 +static int config_access(unsigned char access_type, struct pci_bus *bus,
1826 +                         unsigned int devfn, unsigned char where,
1827 +                         u32 * data)
1828 +{ 
1829 +       /*
1830 +        * config cycles are on 4 byte boundary only
1831 +        */
1832 +       unsigned int slot = PCI_SLOT(devfn);
1833 +       u8 func = PCI_FUNC(devfn);
1834 +       
1835 +       if (slot < 2 || slot > 15) {
1836 +               *data = 0xFFFFFFFF;
1837 +               return -1;
1838 +       }
1839 +       /* Setup address */
1840 +       PCI_CFG_SET(slot, func, where);
1841 +       rc32434_sync();
1842 +       
1843 +       if (access_type == PCI_ACCESS_WRITE) {
1844 +               rc32434_sync(); 
1845 +               rc32434_pci->pcicfgd = *data;
1846 +       } else {
1847 +               rc32434_sync(); 
1848 +               *data = rc32434_pci->pcicfgd;
1849 +       }
1850 +       
1851 +       rc32434_sync();
1852 +       
1853 +       return 0;
1854 +}
1855 +
1856 +
1857 +/*
1858 + * We can't address 8 and 16 bit words directly.  Instead we have to
1859 + * read/write a 32bit word and mask/modify the data we actually want.
1860 + */
1861 +static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
1862 +                            int where, u8 * val)
1863 +{
1864 +       u32 data;
1865 +       int ret;
1866 +       
1867 +       ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
1868 +       *val = (data >> ((where & 3) << 3)) & 0xff;
1869 +       return ret;
1870 +}
1871 +
1872 +static int read_config_word(struct pci_bus *bus, unsigned int devfn,
1873 +                            int where, u16 * val)
1874 +{
1875 +       u32 data;
1876 +       int ret;
1877 +       
1878 +       ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
1879 +       *val = (data >> ((where & 3) << 3)) & 0xffff;
1880 +       return ret;
1881 +}
1882 +
1883 +static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
1884 +                             int where, u32 * val)
1885 +{
1886 +       int ret;
1887 +       
1888 +       ret = config_access(PCI_ACCESS_READ, bus, devfn, where, val);
1889 +       return ret;
1890 +}
1891 +
1892 +static int
1893 +write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
1894 +                  u8 val)
1895 +{
1896 +       u32 data = 0;
1897 +       
1898 +       if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
1899 +               return -1;
1900 +       
1901 +       data = (data & ~(0xff << ((where & 3) << 3))) |
1902 +               (val << ((where & 3) << 3));
1903 +       
1904 +       if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
1905 +               return -1;
1906 +       
1907 +       return PCIBIOS_SUCCESSFUL;
1908 +}
1909 +
1910 +
1911 +static int
1912 +write_config_word(struct pci_bus *bus, unsigned int devfn, int where,
1913 +                  u16 val)
1914 +{
1915 +       u32 data = 0;
1916 +       
1917 +       if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
1918 +               return -1;
1919 +       
1920 +       data = (data & ~(0xffff << ((where & 3) << 3))) |
1921 +               (val << ((where & 3) << 3));
1922 +       
1923 +       if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
1924 +               return -1;
1925 +       
1926 +       
1927 +       return PCIBIOS_SUCCESSFUL;
1928 +}
1929 +
1930 +
1931 +static int 
1932 +write_config_dword(struct pci_bus *bus, unsigned int devfn, int where,
1933 +                   u32 val)
1934 +{
1935 +       if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
1936 +               return -1;
1937 +       
1938 +       return PCIBIOS_SUCCESSFUL;
1939 +}
1940 +
1941 +static int pci_config_read(struct pci_bus *bus, unsigned int devfn,
1942 +                          int where, int size, u32 * val)
1943 +{
1944 +       switch (size) {
1945 +       case 1: 
1946 +               return read_config_byte(bus, devfn, where, (u8 *) val);
1947 +       case 2: 
1948 +               return read_config_word(bus, devfn, where, (u16 *) val);
1949 +       default:
1950 +               return read_config_dword(bus, devfn, where, val);
1951 +       }
1952 +}
1953 +
1954 +static int pci_config_write(struct pci_bus *bus, unsigned int devfn,
1955 +                           int where, int size, u32 val)
1956 +{
1957 +       switch (size) {
1958 +       case 1: 
1959 +               return write_config_byte(bus, devfn, where, (u8) val);
1960 +       case 2: 
1961 +               return write_config_word(bus, devfn, where, (u16) val);
1962 +       default:
1963 +               return write_config_dword(bus, devfn, where, val);
1964 +       }
1965 +}
1966 +
1967 +struct pci_ops rc32434_pci_ops = {
1968 +       .read =  pci_config_read,
1969 +       .write = pci_config_write,
1970 +};
1971 diff -Nur linux-2.6.15/arch/mips/pci/pci-aruba.c linux-2.6.15-openwrt/arch/mips/pci/pci-aruba.c
1972 --- linux-2.6.15/arch/mips/pci/pci-aruba.c      1970-01-01 01:00:00.000000000 +0100
1973 +++ linux-2.6.15-openwrt/arch/mips/pci/pci-aruba.c      2006-01-10 00:32:32.000000000 +0100
1974 @@ -0,0 +1,235 @@
1975 +/**************************************************************************
1976 + *
1977 + *  BRIEF MODULE DESCRIPTION
1978 + *     PCI initialization for IDT EB434 board
1979 + *
1980 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
1981 + *         
1982 + *  This program is free software; you can redistribute  it and/or modify it
1983 + *  under  the terms of  the GNU General  Public License as published by the
1984 + *  Free Software Foundation;  either version 2 of the  License, or (at your
1985 + *  option) any later version.
1986 + *
1987 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
1988 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
1989 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
1990 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
1991 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1992 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
1993 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1994 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
1995 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1996 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1997 + *
1998 + *  You should have received a copy of the  GNU General Public License along
1999 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
2000 + *  675 Mass Ave, Cambridge, MA 02139, USA.
2001 + *
2002 + *
2003 + **************************************************************************
2004 + * May 2004 rkt, neb
2005 + *
2006 + * Initial Release
2007 + *
2008 + * 
2009 + *
2010 + **************************************************************************
2011 + */
2012 +
2013 +#include <linux/config.h>
2014 +#include <linux/types.h>
2015 +#include <linux/pci.h>
2016 +#include <linux/kernel.h>
2017 +#include <linux/init.h>
2018 +#include <asm/idt-boards/rc32434/rc32434.h>
2019 +#include <asm/idt-boards/rc32434/rc32434_pci.h> 
2020 +
2021 +#define PCI_ACCESS_READ  0
2022 +#define PCI_ACCESS_WRITE 1
2023 +
2024 +#undef DEBUG
2025 +#ifdef DEBUG
2026 +#define DBG(x...) printk(x)
2027 +#else
2028 +#define DBG(x...)
2029 +#endif
2030 +/* define an unsigned array for the PCI registers */
2031 +unsigned int korinaCnfgRegs[25] = {
2032 +       KORINA_CNFG1,    KORINA_CNFG2,  KORINA_CNFG3,  KORINA_CNFG4,
2033 +       KORINA_CNFG5,    KORINA_CNFG6,  KORINA_CNFG7,  KORINA_CNFG8,
2034 +       KORINA_CNFG9,    KORINA_CNFG10, KORINA_CNFG11, KORINA_CNFG12,
2035 +       KORINA_CNFG13, KORINA_CNFG14, KORINA_CNFG15, KORINA_CNFG16,
2036 +       KORINA_CNFG17, KORINA_CNFG18, KORINA_CNFG19, KORINA_CNFG20,
2037 +       KORINA_CNFG21, KORINA_CNFG22, KORINA_CNFG23, KORINA_CNFG24
2038 +};
2039 +
2040 +static struct resource rc32434_res_pci_mem2;
2041 +
2042 +static struct resource rc32434_res_pci_mem1 = {
2043 +       .name = "PCI MEM1",
2044 +       .start = 0x50000000,
2045 +       .end = 0x5FFFFFFF,
2046 +       .flags = IORESOURCE_MEM,
2047 +       .child = &rc32434_res_pci_mem2,
2048 +};
2049 +static struct resource rc32434_res_pci_mem2 = {
2050 +       .name = "PCI MEM2",
2051 +       .start = 0x60000000,
2052 +       .end = 0x6FFFFFFF,
2053 +       .flags = IORESOURCE_MEM,
2054 +       .parent = &rc32434_res_pci_mem1,
2055 +};
2056 +static struct resource rc32434_res_pci_io1 = {
2057 +       .name = "PCI I/O1",
2058 +       .start = 0x18800000,
2059 +       .end = 0x188FFFFF,
2060 +       .flags = IORESOURCE_IO,
2061 +};
2062 +
2063 +extern struct pci_ops rc32434_pci_ops;
2064 +
2065 +struct pci_controller rc32434_controller = {
2066 +       .pci_ops = &rc32434_pci_ops,
2067 +       .mem_resource = &rc32434_res_pci_mem1,
2068 +       .io_resource = &rc32434_res_pci_io1,
2069 +       .mem_offset     = 0x00000000UL,
2070 +       .io_offset      = 0x00000000UL,
2071 +};
2072 +
2073 +extern unsigned int arch_has_pci;
2074 +
2075 +static int __init rc32434_pcibridge_init(void)
2076 +{
2077 +       
2078 +       unsigned int pciConfigAddr = 0;/*used for writing pci config values */
2079 +       int          loopCount=0    ;/*used for the loop */
2080 +       
2081 +       unsigned int pcicValue, pcicData=0;
2082 +       unsigned int dummyRead, pciCntlVal = 0;
2083 +
2084 +       if (!arch_has_pci) return 0;
2085 +
2086 +       printk("PCI: Initializing PCI\n");
2087 +       
2088 +       /* Disable the IP bus error for PCI scaning */
2089 +       pciCntlVal=rc32434_pci->pcic;
2090 +       pciCntlVal &= 0xFFFFFF7;
2091 +       rc32434_pci->pcic = pciCntlVal;
2092 +       
2093 +       ioport_resource.start = rc32434_res_pci_io1.start;
2094 +       ioport_resource.end = rc32434_res_pci_io1.end;
2095 +/*
2096 +       iomem_resource.start = rc32434_res_pci_mem1.start;
2097 +       iomem_resource.end = rc32434_res_pci_mem1.end;
2098 +*/
2099 +       
2100 +       pcicValue = rc32434_pci->pcic;
2101 +       pcicValue = (pcicValue >> PCIM_SHFT) & PCIM_BIT_LEN;
2102 +       if (!((pcicValue == PCIM_H_EA) ||
2103 +             (pcicValue == PCIM_H_IA_FIX) ||
2104 +             (pcicValue == PCIM_H_IA_RR))) {
2105 +               /* Not in Host Mode, return ERROR */
2106 +               return -1;
2107 +       }
2108 +       
2109 +       /* Enables the Idle Grant mode, Arbiter Parking */
2110 +       pcicData |=(PCIC_igm_m|PCIC_eap_m|PCIC_en_m);
2111 +       rc32434_pci->pcic = pcicData; /* Enable the PCI bus Interface */
2112 +       /* Zero out the PCI status & PCI Status Mask */
2113 +       for(;;) {
2114 +               pcicData = rc32434_pci->pcis;
2115 +               if (!(pcicData & PCIS_rip_m))
2116 +                       break;
2117 +       }
2118 +       
2119 +       rc32434_pci->pcis = 0;
2120 +       rc32434_pci->pcism = 0xFFFFFFFF;
2121 +       /* Zero out the PCI decoupled registers */
2122 +       rc32434_pci->pcidac=0; /* disable PCI decoupled accesses at initialization */
2123 +       rc32434_pci->pcidas=0; /* clear the status */
2124 +       rc32434_pci->pcidasm=0x0000007F; /* Mask all the interrupts */
2125 +       /* Mask PCI Messaging Interrupts */
2126 +       rc32434_pci_msg->pciiic = 0;
2127 +       rc32434_pci_msg->pciiim = 0xFFFFFFFF;
2128 +       rc32434_pci_msg->pciioic = 0;
2129 +       rc32434_pci_msg->pciioim = 0;
2130 +       
2131 +       /* Setup PCILB0 as Memory Window */
2132 +       rc32434_pci->pcilba[0].a = (unsigned int) (PCI_ADDR_START);
2133 +       
2134 +       /* setup the PCI map address as same as the local address */
2135 +       
2136 +       rc32434_pci->pcilba[0].m = (unsigned int) (PCI_ADDR_START);
2137 +       
2138 +       /* Setup PCILBA1 as MEM */
2139 +#ifdef __MIPSEB__
2140 +       rc32434_pci->pcilba[0].c = ( ((SIZE_16MB & 0x1f) << PCILBAC_size_b) | PCILBAC_sb_m);
2141 +#else
2142 +       rc32434_pci->pcilba[0].c = ( ((SIZE_16MB & 0x1f) << PCILBAC_size_b));
2143 +#endif
2144 +       dummyRead = rc32434_pci->pcilba[0].c; /* flush the CPU write Buffers */
2145 +       
2146 +       rc32434_pci->pcilba[1].a = 0x60000000;
2147 +       
2148 +       rc32434_pci->pcilba[1].m = 0x60000000;
2149 +       /* setup PCILBA2 as IO Window*/
2150 +#ifdef __MIPSEB__
2151 +       rc32434_pci->pcilba[1].c = ( ((SIZE_256MB & 0x1f) << PCILBAC_size_b) |  PCILBAC_sb_m);
2152 +#else
2153 +       rc32434_pci->pcilba[1].c = ((SIZE_256MB & 0x1f) << PCILBAC_size_b);
2154 +#endif
2155 +       dummyRead = rc32434_pci->pcilba[1].c; /* flush the CPU write Buffers */
2156 +       rc32434_pci->pcilba[2].a = 0x18C00000;
2157 +       
2158 +       rc32434_pci->pcilba[2].m = 0x18FFFFFF;
2159 +       /* setup PCILBA2 as IO Window*/
2160 +#ifdef __MIPSEB__
2161 +       rc32434_pci->pcilba[2].c = ( ((SIZE_4MB & 0x1f) << PCILBAC_size_b)  |  PCILBAC_sb_m);
2162 +#else
2163 +       rc32434_pci->pcilba[2].c = ((SIZE_4MB & 0x1f) << PCILBAC_size_b);
2164 +#endif  
2165 +       
2166 +       dummyRead = rc32434_pci->pcilba[2].c; /* flush the CPU write Buffers */
2167 +       
2168 +       
2169 +       rc32434_pci->pcilba[3].a = 0x18800000;
2170 +       
2171 +       rc32434_pci->pcilba[3].m = 0x18800000;
2172 +       /* Setup PCILBA3 as IO Window */
2173 +       
2174 +#ifdef __MIPSEB__
2175 +       rc32434_pci->pcilba[3].c = ( (((SIZE_1MB & 0x1ff) << PCILBAC_size_b) | PCILBAC_msi_m)   |  PCILBAC_sb_m);
2176 +#else
2177 +       rc32434_pci->pcilba[3].c = (((SIZE_1MB & 0x1ff) << PCILBAC_size_b) | PCILBAC_msi_m);
2178 +#endif
2179 +       dummyRead = rc32434_pci->pcilba[2].c; /* flush the CPU write Buffers */
2180 +       
2181 +       pciConfigAddr = (unsigned int)(0x80000004);
2182 +       for(loopCount = 0; loopCount < 24; loopCount++){
2183 +               rc32434_pci->pcicfga = pciConfigAddr;
2184 +               dummyRead = rc32434_pci->pcicfga;
2185 +               rc32434_pci->pcicfgd = korinaCnfgRegs[loopCount];
2186 +               dummyRead=rc32434_pci->pcicfgd;
2187 +               pciConfigAddr += 4;
2188 +       }
2189 +       rc32434_pci->pcitc=(unsigned int)((PCITC_RTIMER_VAL&0xff) << PCITC_rtimer_b) |
2190 +               ((PCITC_DTIMER_VAL&0xff)<<PCITC_dtimer_b);
2191 +       
2192 +       pciCntlVal = rc32434_pci->pcic;
2193 +       pciCntlVal &= ~(PCIC_tnr_m);
2194 +       rc32434_pci->pcic = pciCntlVal;
2195 +       pciCntlVal = rc32434_pci->pcic;
2196 +       
2197 +       register_pci_controller(&rc32434_controller);
2198 +       
2199 +       rc32434_sync();  
2200 +       return 0;
2201 +}
2202 +
2203 +arch_initcall(rc32434_pcibridge_init);
2204 +
2205 +/* Do platform specific device initialization at pci_enable_device() time */
2206 +int pcibios_plat_dev_init(struct pci_dev *dev)
2207 +{
2208 +        return 0;
2209 +}
2210 diff -Nur linux-2.6.15/drivers/mtd/chips/cfi_probe.c linux-2.6.15-openwrt/drivers/mtd/chips/cfi_probe.c
2211 --- linux-2.6.15/drivers/mtd/chips/cfi_probe.c  2006-01-03 04:21:10.000000000 +0100
2212 +++ linux-2.6.15-openwrt/drivers/mtd/chips/cfi_probe.c  2006-01-10 00:32:32.000000000 +0100
2213 @@ -26,6 +26,74 @@
2214  static void print_cfi_ident(struct cfi_ident *);
2215  #endif
2216  
2217 +#if 1
2218 +
2219 +#define AMD_AUTOSEL_OFF1       0xAAA
2220 +#define AMD_AUTOSEL_OFF2       0x555
2221 +#define AMD_MANUF_ID           0x1
2222 +#define AMD_DEVICE_ID1         0xF6 /* T */
2223 +#define AMD_DEVICE_ID2         0xF9 /* B */
2224 +/* Foll. are definitions for Macronix Flash Part */
2225 +#define MCX_MANUF_ID           0xC2
2226 +#define MCX_DEVICE_ID1         0xA7
2227 +#define MCX_DEVICE_ID2         0xA8
2228 +/* Foll. common to both AMD and Macronix */
2229 +#define FACTORY_LOCKED         0x99
2230 +#define USER_LOCKED            0x19
2231 +
2232 +/* NOTE: AP-70/6x use BYTE mode flash access. Therefore the
2233 + * lowest Addr. pin in the flash is not A0 but A-1 (A minus 1).
2234 + * CPU's A0 is tied to Flash's A-1, A1 to A0 and so on. This
2235 + * gives 4MB of byte-addressable mem. In byte mode, all addr
2236 + * need to be multiplied by 2 (i.e compared to word mode).
2237 + * NOTE: AMD_AUTOSEL_OFF1 and OFF2 are already mult. by 2
2238 + * Just blindly use the addr offsets suggested in the manual
2239 + * for byte mode and you'll be OK. Offs. in Table 6 need to
2240 + * be mult by 2 (for getting autosel params)
2241 + */
2242 +void
2243 +flash_detect(struct map_info *map, __u32 base, struct cfi_private *cfi)
2244 +{
2245 +       map_word val[3];
2246 +       int osf = cfi->interleave * cfi->device_type; // =2 for AP70/6x
2247 +       char *manuf, *part, *lock ;
2248 +
2249 +       if (osf != 1) return ;
2250 +
2251 +       cfi_send_gen_cmd(0xAA, AMD_AUTOSEL_OFF1, base, map, cfi, cfi->device_type, NULL);
2252 +       cfi_send_gen_cmd(0x55, AMD_AUTOSEL_OFF2, base, map, cfi, cfi->device_type, NULL);
2253 +       cfi_send_gen_cmd(0x90, AMD_AUTOSEL_OFF1, base, map, cfi, cfi->device_type, NULL);
2254 +       val[0] = map_read(map, base) ; // manuf ID
2255 +       val[1] = map_read(map, base+2) ; // device ID
2256 +       val[2] = map_read(map, base+6) ; // lock indicator
2257 +#if 0
2258 +printk("v1=0x%x v2=0x%x v3=0x%x\n", val[0], val[1], val[2]) ;
2259 +#endif
2260 +       if (val[0].x[0] == AMD_MANUF_ID) {
2261 +               manuf = "AMD Flash" ;
2262 +               if (val[1].x[0] == AMD_DEVICE_ID1)
2263 +                       part = "AM29LV320D (Top)" ;
2264 +               else if (val[1].x[0] == AMD_DEVICE_ID2)
2265 +                       part = "AM29LV320D (Bot)" ;
2266 +               else part = "Unknown" ;
2267 +       } else if (val[0].x[0] == MCX_MANUF_ID) {
2268 +               manuf = "Macronix Flash" ;
2269 +               if (val[1].x[0] == MCX_DEVICE_ID1)
2270 +                       part = "MX29LV320A (Top)" ;
2271 +               else if (val[1].x[0] == MCX_DEVICE_ID2)
2272 +                       part = "MX29LV320A (Bot)" ;
2273 +               else part = "Unknown" ;
2274 +       } else
2275 +               return ;
2276 +       if (val[2].x[0] == FACTORY_LOCKED)
2277 +               lock = "Factory Locked" ;
2278 +       else if (val[2].x[0] == USER_LOCKED)
2279 +               lock = "User Locked" ;
2280 +       else lock = "Unknown locking" ;
2281 +       printk("%s %s (%s)\n", manuf, part, lock) ;
2282 +}
2283 +#endif
2284 +
2285  static int cfi_probe_chip(struct map_info *map, __u32 base,
2286                           unsigned long *chip_map, struct cfi_private *cfi);
2287  static int cfi_chip_setup(struct map_info *map, struct cfi_private *cfi);
2288 @@ -118,6 +186,10 @@
2289         }
2290  
2291         xip_disable();
2292 +#if 1
2293 +       //cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
2294 +       flash_detect(map, base, cfi) ;
2295 +#endif
2296         cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
2297         cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
2298         cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
2299 diff -Nur linux-2.6.15/drivers/mtd/maps/physmap.c linux-2.6.15-openwrt/drivers/mtd/maps/physmap.c
2300 --- linux-2.6.15/drivers/mtd/maps/physmap.c     2006-01-03 04:21:10.000000000 +0100
2301 +++ linux-2.6.15-openwrt/drivers/mtd/maps/physmap.c     2006-01-10 00:32:32.000000000 +0100
2302 @@ -34,15 +34,31 @@
2303  static struct mtd_partition *mtd_parts;
2304  static int                   mtd_parts_nb;
2305  
2306 -static int num_physmap_partitions;
2307 -static struct mtd_partition *physmap_partitions;
2308 +static int num_physmap_partitions = 3;
2309 +static struct mtd_partition physmap_partitions[] = {
2310 +       {
2311 +                name:           "zImage",
2312 +                size:           0x3f0000-0x80000,
2313 +                offset:         0x80000,
2314 +        },
2315 +       {
2316 +                name:           "JFFS2",
2317 +                size:           0x3f0000-0x120000,
2318 +                offset:         0x120000,
2319 +       },
2320 +       {
2321 +               name:           "NVRAM",
2322 +               size:           0x2000,
2323 +               offset:         0x3f8000,
2324 +       }
2325 +};
2326  
2327  static const char *part_probes[] __initdata = {"cmdlinepart", "RedBoot", NULL};
2328  
2329  void physmap_set_partitions(struct mtd_partition *parts, int num_parts)
2330  {
2331 -       physmap_partitions=parts;
2332 -       num_physmap_partitions=num_parts;
2333 +//     physmap_partitions=parts;
2334 +//     num_physmap_partitions=num_parts;
2335  }
2336  #endif /* CONFIG_MTD_PARTITIONS */
2337  
2338 diff -Nur linux-2.6.15/drivers/net/Kconfig linux-2.6.15-openwrt/drivers/net/Kconfig
2339 --- linux-2.6.15/drivers/net/Kconfig    2006-01-03 04:21:10.000000000 +0100
2340 +++ linux-2.6.15-openwrt/drivers/net/Kconfig    2006-01-10 00:32:32.000000000 +0100
2341 @@ -176,6 +176,13 @@
2342  
2343  source "drivers/net/arm/Kconfig"
2344  
2345 +config IDT_RC32434_ETH
2346 +        tristate "IDT RC32434 Local Ethernet support"
2347 +        depends on NET_ETHERNET
2348 +        help
2349 +        IDT RC32434 has one local ethernet port. Say Y here to enable it.
2350 +        To compile this driver as a module, choose M here.
2351 +
2352  config MACE
2353         tristate "MACE (Power Mac ethernet) support"
2354         depends on NET_ETHERNET && PPC_PMAC && PPC32
2355 diff -Nur linux-2.6.15/drivers/net/Makefile linux-2.6.15-openwrt/drivers/net/Makefile
2356 --- linux-2.6.15/drivers/net/Makefile   2006-01-03 04:21:10.000000000 +0100
2357 +++ linux-2.6.15-openwrt/drivers/net/Makefile   2006-01-10 00:32:33.000000000 +0100
2358 @@ -190,6 +190,7 @@
2359  obj-$(CONFIG_SMC91X) += smc91x.o
2360  obj-$(CONFIG_DM9000) += dm9000.o
2361  obj-$(CONFIG_FEC_8XX) += fec_8xx/
2362 +obj-$(CONFIG_IDT_RC32434_ETH) += rc32434_eth.o
2363  
2364  obj-$(CONFIG_ARM) += arm/
2365  obj-$(CONFIG_DEV_APPLETALK) += appletalk/
2366 diff -Nur linux-2.6.15/drivers/net/rc32434_eth.c linux-2.6.15-openwrt/drivers/net/rc32434_eth.c
2367 --- linux-2.6.15/drivers/net/rc32434_eth.c      1970-01-01 01:00:00.000000000 +0100
2368 +++ linux-2.6.15-openwrt/drivers/net/rc32434_eth.c      2006-01-10 00:32:33.000000000 +0100
2369 @@ -0,0 +1,1268 @@
2370 +/**************************************************************************
2371 + *
2372 + *  BRIEF MODULE DESCRIPTION
2373 + *     Driver for the IDT RC32434 on-chip ethernet controller.
2374 + *
2375 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
2376 + *         
2377 + *  This program is free software; you can redistribute  it and/or modify it
2378 + *  under  the terms of  the GNU General  Public License as published by the
2379 + *  Free Software Foundation;  either version 2 of the  License, or (at your
2380 + *  option) any later version.
2381 + *
2382 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
2383 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
2384 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
2385 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
2386 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2387 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
2388 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2389 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
2390 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2391 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2392 + *
2393 + *  You should have received a copy of the  GNU General Public License along
2394 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
2395 + *  675 Mass Ave, Cambridge, MA 02139, USA.
2396 + *
2397 + *
2398 + **************************************************************************
2399 + * May 2004 rkt, neb
2400 + *
2401 + * Based on the driver developed by B. Maruthanayakam, H. Kou and others.
2402 + *
2403 + * Aug 2004 Sadik
2404 + *
2405 + * Added NAPI
2406 + *
2407 + **************************************************************************
2408 + */
2409 +
2410 +#include <linux/config.h>
2411 +#include <linux/module.h>
2412 +#include <linux/kernel.h>
2413 +#include <linux/moduleparam.h>
2414 +#include <linux/sched.h>
2415 +#include <linux/ctype.h>
2416 +#include <linux/types.h>
2417 +#include <linux/fcntl.h>
2418 +#include <linux/interrupt.h>
2419 +#include <linux/ptrace.h>
2420 +#include <linux/init.h>
2421 +#include <linux/ioport.h>
2422 +#include <linux/proc_fs.h>
2423 +#include <linux/in.h>
2424 +#include <linux/slab.h>
2425 +#include <linux/string.h>
2426 +#include <linux/delay.h>
2427 +#include <linux/netdevice.h>
2428 +#include <linux/etherdevice.h>
2429 +#include <linux/skbuff.h>
2430 +#include <linux/errno.h>
2431 +#include <asm/bootinfo.h>
2432 +#include <asm/system.h>
2433 +#include <asm/bitops.h>
2434 +#include <asm/pgtable.h>
2435 +#include <asm/segment.h>
2436 +#include <asm/io.h>
2437 +#include <asm/dma.h>
2438 +
2439 +#include "rc32434_eth.h"
2440 +
2441 +#define DRIVER_VERSION "(mar2904)"
2442 +
2443 +#define DRIVER_NAME "rc32434 Ethernet driver. " DRIVER_VERSION
2444 +
2445 +
2446 +#define STATION_ADDRESS_HIGH(dev) (((dev)->dev_addr[0] << 8) | \
2447 +                                  ((dev)->dev_addr[1]))
2448 +#define STATION_ADDRESS_LOW(dev)  (((dev)->dev_addr[2] << 24) | \
2449 +                                  ((dev)->dev_addr[3] << 16) | \
2450 +                                  ((dev)->dev_addr[4] << 8)  | \
2451 +                                  ((dev)->dev_addr[5]))
2452 +
2453 +#define MII_CLOCK 1250000                              /* no more than 2.5MHz */
2454 +static char mac0[18] = "08:00:06:05:40:01"; 
2455 +
2456 +MODULE_PARM(mac0, "c18");
2457 +MODULE_PARM_DESC(mac0, "MAC address for RC32434 ethernet0");
2458 +
2459 +static struct rc32434_if_t {
2460 +       char *name;
2461 +       struct net_device *dev;
2462 +       char* mac_str;
2463 +       int weight;
2464 +       u32 iobase;
2465 +       u32 rxdmabase;
2466 +       u32 txdmabase;
2467 +       int rx_dma_irq;
2468 +       int tx_dma_irq;
2469 +       int rx_ovr_irq;
2470 +       int tx_und_irq;                 
2471 +} rc32434_iflist[] = 
2472 +{
2473 +       {
2474 +               "rc32434_eth0",      NULL,       mac0, 
2475 +               64,
2476 +               ETH0_PhysicalAddress,
2477 +               ETH0_RX_DMA_ADDR,
2478 +               ETH0_TX_DMA_ADDR,
2479 +               ETH0_DMA_RX_IRQ,
2480 +               ETH0_DMA_TX_IRQ,
2481 +               ETH0_RX_OVR_IRQ,
2482 +               ETH0_TX_UND_IRQ
2483 +       }
2484 +};
2485 +
2486 +
2487 +static int parse_mac_addr(struct net_device *dev, char* macstr)
2488 +{
2489 +       int i, j;
2490 +       unsigned char result, value;
2491 +       
2492 +       for (i=0; i<6; i++) {
2493 +               result = 0;
2494 +               if (i != 5 && *(macstr+2) != ':') {
2495 +                       ERR("invalid mac address format: %d %c\n",
2496 +                           i, *(macstr+2));
2497 +                       return -EINVAL;
2498 +               }                               
2499 +               for (j=0; j<2; j++) {
2500 +                       if (isxdigit(*macstr) && (value = isdigit(*macstr) ? *macstr-'0' : 
2501 +                                                 toupper(*macstr)-'A'+10) < 16) {
2502 +                               result = result*16 + value;
2503 +                               macstr++;
2504 +                       } 
2505 +                       else {
2506 +                               ERR("invalid mac address "
2507 +                                   "character: %c\n", *macstr);
2508 +                               return -EINVAL;
2509 +                       }
2510 +               }
2511 +               
2512 +               macstr++; 
2513 +               dev->dev_addr[i] = result;
2514 +       }
2515 +       
2516 +       return 0;
2517 +}
2518 +
2519 +
2520 +
2521 +static inline void rc32434_abort_tx(struct net_device *dev)
2522 +{
2523 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2524 +       rc32434_abort_dma(dev, lp->tx_dma_regs);
2525 +       
2526 +}
2527 +
2528 +static inline void rc32434_abort_rx(struct net_device *dev)
2529 +{
2530 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2531 +       rc32434_abort_dma(dev, lp->rx_dma_regs);
2532 +       
2533 +}
2534 +
2535 +static inline void rc32434_start_tx(struct rc32434_local *lp,  volatile DMAD_t td)
2536 +{
2537 +       rc32434_start_dma(lp->tx_dma_regs, CPHYSADDR(td));
2538 +}
2539 +
2540 +static inline void rc32434_start_rx(struct rc32434_local *lp, volatile DMAD_t rd)
2541 +{
2542 +       rc32434_start_dma(lp->rx_dma_regs, CPHYSADDR(rd));
2543 +}
2544 +
2545 +static inline void rc32434_chain_tx(struct rc32434_local *lp, volatile DMAD_t td)
2546 +{
2547 +       rc32434_chain_dma(lp->tx_dma_regs, CPHYSADDR(td));
2548 +}
2549 +
2550 +static inline void rc32434_chain_rx(struct rc32434_local *lp, volatile DMAD_t rd)
2551 +{
2552 +       rc32434_chain_dma(lp->rx_dma_regs, CPHYSADDR(rd));
2553 +}
2554 +
2555 +#ifdef RC32434_PROC_DEBUG
2556 +static int rc32434_read_proc(char *buf, char **start, off_t fpos,
2557 +                            int length, int *eof, void *data)
2558 +{
2559 +       struct net_device *dev = (struct net_device *)data;
2560 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2561 +       int len = 0;
2562 +       
2563 +       /* print out header */
2564 +       len += sprintf(buf + len, "\n\tRC32434 Ethernet Debug\n\n");
2565 +       len += sprintf (buf + len,
2566 +                       "DMA halt count      = %10d, DMA run count = %10d\n",
2567 +                       lp->dma_halt_cnt, lp->dma_run_cnt);
2568 +       
2569 +       if (fpos >= len) {
2570 +               *start = buf;
2571 +               *eof = 1;
2572 +               return 0;
2573 +       }
2574 +       *start = buf + fpos;
2575 +       
2576 +       if ((len -= fpos) > length) 
2577 +               return length;  
2578 +       *eof = 1;
2579 +       
2580 +       return len;
2581 +       
2582 +}
2583 +#endif
2584 +
2585 +
2586 +/*
2587 + * Restart the RC32434 ethernet controller. 
2588 + */
2589 +static int rc32434_restart(struct net_device *dev)
2590 +{
2591 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2592 +       
2593 +       /*
2594 +        * Disable interrupts
2595 +        */
2596 +       disable_irq(lp->rx_irq);
2597 +       disable_irq(lp->tx_irq);
2598 +#ifdef RC32434_REVISION
2599 +       disable_irq(lp->ovr_irq);
2600 +#endif 
2601 +       disable_irq(lp->und_irq);
2602 +       
2603 +       /* Mask F E bit in Tx DMA */
2604 +       rc32434_writel(rc32434_readl(&lp->tx_dma_regs->dmasm) | DMASM_f_m | DMASM_e_m, &lp->tx_dma_regs->dmasm);
2605 +       /* Mask D H E bit in Rx DMA */
2606 +       rc32434_writel(rc32434_readl(&lp->rx_dma_regs->dmasm) | DMASM_d_m | DMASM_h_m | DMASM_e_m, &lp->rx_dma_regs->dmasm);
2607 +       
2608 +       rc32434_init(dev);
2609 +       rc32434_multicast_list(dev);
2610 +       
2611 +       enable_irq(lp->und_irq);
2612 +#ifdef RC32434_REVISION
2613 +       enable_irq(lp->ovr_irq);
2614 +#endif
2615 +       enable_irq(lp->tx_irq);
2616 +       enable_irq(lp->rx_irq);
2617 +       
2618 +       return 0;
2619 +}
2620 +
2621 +int rc32434_init_module(void)
2622 +{
2623 +#ifdef CONFIG_MACH_ARUBA
2624 +       if (mips_machtype != MACH_ARUBA_AP70)
2625 +               return 1;
2626 +#endif
2627 +
2628 +       printk(KERN_INFO DRIVER_NAME " \n");
2629 +       return rc32434_probe(0);
2630 +}
2631 +
2632 +static int rc32434_probe(int port_num)
2633 +{
2634 +       struct rc32434_if_t *bif = &rc32434_iflist[port_num];
2635 +       struct rc32434_local *lp = NULL;
2636 +       struct net_device *dev = NULL;
2637 +       int i, retval,err;
2638 +       
2639 +       dev = alloc_etherdev(sizeof(struct rc32434_local));
2640 +       if(!dev) {
2641 +               ERR("rc32434_eth: alloc_etherdev failed\n");
2642 +               return -1;
2643 +       }
2644 +       
2645 +       SET_MODULE_OWNER(dev);
2646 +       bif->dev = dev;
2647 +
2648 +#ifdef CONFIG_MACH_ARUBA
2649 +       {
2650 +               extern char * getenv(char *e);
2651 +               memcpy(bif->mac_str, getenv("ethaddr"), 17);
2652 +       }
2653 +#endif
2654 +       
2655 +       printk("mac: %s\n", bif->mac_str);
2656 +       if ((retval = parse_mac_addr(dev, bif->mac_str))) {
2657 +               ERR("MAC address parse failed\n");
2658 +               free_netdev(dev);
2659 +               return -1;
2660 +       }
2661 +       
2662 +       
2663 +       /* Initialize the device structure. */
2664 +       if (dev->priv == NULL) {
2665 +               lp = (struct rc32434_local *)kmalloc(sizeof(*lp), GFP_KERNEL);
2666 +               memset(lp, 0, sizeof(struct rc32434_local));
2667 +       } 
2668 +       else {
2669 +               lp = (struct rc32434_local *)dev->priv;
2670 +       }
2671 +       
2672 +       lp->rx_irq = bif->rx_dma_irq;
2673 +       lp->tx_irq = bif->tx_dma_irq;
2674 +       lp->ovr_irq = bif->rx_ovr_irq;
2675 +       lp->und_irq = bif->tx_und_irq;
2676 +       
2677 +       lp->eth_regs = ioremap_nocache(bif->iobase, sizeof(*lp->eth_regs));
2678 +
2679 +       if (!lp->eth_regs) {
2680 +               ERR("Can't remap eth registers\n");
2681 +               retval = -ENXIO;
2682 +               goto probe_err_out;
2683 +       }
2684 +       
2685 +       lp->rx_dma_regs = ioremap_nocache(bif->rxdmabase, sizeof(struct DMA_Chan_s));
2686 +       
2687 +       if (!lp->rx_dma_regs) {
2688 +               ERR("Can't remap Rx DMA registers\n");
2689 +               retval = -ENXIO;
2690 +               goto probe_err_out;
2691 +       }
2692 +       lp->tx_dma_regs = ioremap_nocache(bif->txdmabase,sizeof(struct DMA_Chan_s));
2693 +       
2694 +       if (!lp->tx_dma_regs) {
2695 +               ERR("Can't remap Tx DMA registers\n");
2696 +               retval = -ENXIO;
2697 +               goto probe_err_out;
2698 +       }
2699 +       
2700 +#ifdef RC32434_PROC_DEBUG
2701 +       lp->ps = create_proc_read_entry (bif->name, 0, proc_net,
2702 +                                        rc32434_read_proc, dev);
2703 +#endif
2704 +       
2705 +       lp->td_ring =   (DMAD_t)kmalloc(TD_RING_SIZE + RD_RING_SIZE, GFP_KERNEL);
2706 +       if (!lp->td_ring) {
2707 +               ERR("Can't allocate descriptors\n");
2708 +               retval = -ENOMEM;
2709 +               goto probe_err_out;
2710 +       }
2711 +       
2712 +       dma_cache_inv((unsigned long)(lp->td_ring), TD_RING_SIZE + RD_RING_SIZE);
2713 +       
2714 +       /* now convert TD_RING pointer to KSEG1 */
2715 +       lp->td_ring = (DMAD_t )KSEG1ADDR(lp->td_ring);
2716 +       lp->rd_ring = &lp->td_ring[RC32434_NUM_TDS];
2717 +       
2718 +       
2719 +       spin_lock_init(&lp->lock);
2720 +       
2721 +       dev->base_addr = bif->iobase;
2722 +       /* just use the rx dma irq */
2723 +       dev->irq = bif->rx_dma_irq; 
2724 +       
2725 +       dev->priv = lp;
2726 +       
2727 +       dev->open = rc32434_open;
2728 +       dev->stop = rc32434_close;
2729 +       dev->hard_start_xmit = rc32434_send_packet;
2730 +       dev->get_stats  = rc32434_get_stats;
2731 +       dev->set_multicast_list = &rc32434_multicast_list;
2732 +       dev->tx_timeout = rc32434_tx_timeout;
2733 +       dev->watchdog_timeo = RC32434_TX_TIMEOUT;
2734 +
2735 +#ifdef CONFIG_IDT_USE_NAPI
2736 +       dev->poll = rc32434_poll;
2737 +       dev->weight = bif->weight;
2738 +       printk("Using NAPI with weight %d\n",dev->weight);
2739 +#else
2740 +       lp->rx_tasklet = kmalloc(sizeof(struct tasklet_struct), GFP_KERNEL);
2741 +       tasklet_init(lp->rx_tasklet, rc32434_rx_tasklet, (unsigned long)dev);
2742 +#endif
2743 +       lp->tx_tasklet = kmalloc(sizeof(struct tasklet_struct), GFP_KERNEL);
2744 +       tasklet_init(lp->tx_tasklet, rc32434_tx_tasklet, (unsigned long)dev);
2745 +       
2746 +       if ((err = register_netdev(dev))) {
2747 +               printk(KERN_ERR "rc32434 ethernet. Cannot register net device %d\n", err);
2748 +               free_netdev(dev);
2749 +               retval = -EINVAL;
2750 +               goto probe_err_out;
2751 +       }
2752 +       
2753 +       INFO("Rx IRQ %d, Tx IRQ %d, ", bif->rx_dma_irq, bif->tx_dma_irq);
2754 +       for (i = 0; i < 6; i++) {
2755 +               printk("%2.2x", dev->dev_addr[i]);
2756 +               if (i<5)
2757 +                       printk(":");
2758 +       }
2759 +       printk("\n");
2760 +       
2761 +       return 0;
2762 +       
2763 + probe_err_out:
2764 +       rc32434_cleanup_module();
2765 +       ERR(" failed.  Returns %d\n", retval);
2766 +       return retval;
2767 +       
2768 +}
2769 +
2770 +
2771 +static void rc32434_cleanup_module(void)
2772 +{
2773 +       int i;
2774 +       
2775 +       for (i = 0; rc32434_iflist[i].iobase; i++) {
2776 +               struct rc32434_if_t * bif = &rc32434_iflist[i];
2777 +               if (bif->dev != NULL) {
2778 +                       struct rc32434_local *lp = (struct rc32434_local *)bif->dev->priv;
2779 +                       if (lp != NULL) {
2780 +                               if (lp->eth_regs)
2781 +                                       iounmap((void*)lp->eth_regs);
2782 +                               if (lp->rx_dma_regs)
2783 +                                       iounmap((void*)lp->rx_dma_regs);
2784 +                               if (lp->tx_dma_regs)
2785 +                                       iounmap((void*)lp->tx_dma_regs);
2786 +                               if (lp->td_ring)
2787 +                                       kfree((void*)KSEG0ADDR(lp->td_ring));
2788 +                               
2789 +#ifdef RC32434_PROC_DEBUG
2790 +                               if (lp->ps) {
2791 +                                       remove_proc_entry(bif->name, proc_net);
2792 +                               }
2793 +#endif
2794 +                               kfree(lp);
2795 +                       }
2796 +                       
2797 +                       unregister_netdev(bif->dev);
2798 +                       free_netdev(bif->dev);
2799 +                       kfree(bif->dev);
2800 +               }
2801 +       }
2802 +}
2803 +
2804 +
2805 +
2806 +static int rc32434_open(struct net_device *dev)
2807 +{
2808 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2809 +       
2810 +       /* Initialize */
2811 +       if (rc32434_init(dev)) {
2812 +               ERR("Error: cannot open the Ethernet device\n");
2813 +               return -EAGAIN;
2814 +       }
2815 +       
2816 +       /* Install the interrupt handler that handles the Done Finished Ovr and Und Events */   
2817 +       if (request_irq(lp->rx_irq, &rc32434_rx_dma_interrupt,
2818 +                 SA_SHIRQ | SA_INTERRUPT,
2819 +                       "rc32434 ethernet Rx", dev)) {
2820 +               ERR(": unable to get Rx DMA IRQ %d\n",
2821 +                   lp->rx_irq);
2822 +               return -EAGAIN;
2823 +       }
2824 +       if (request_irq(lp->tx_irq, &rc32434_tx_dma_interrupt,
2825 +                 SA_SHIRQ | SA_INTERRUPT,
2826 +                       "rc32434 ethernet Tx", dev)) {
2827 +               ERR(": unable to get Tx DMA IRQ %d\n",
2828 +                   lp->tx_irq);
2829 +               free_irq(lp->rx_irq, dev);
2830 +               return -EAGAIN;
2831 +       }
2832 +       
2833 +#ifdef RC32434_REVISION
2834 +       /* Install handler for overrun error. */
2835 +       if (request_irq(lp->ovr_irq, &rc32434_ovr_interrupt,
2836 +                       SA_SHIRQ | SA_INTERRUPT,
2837 +                       "Ethernet Overflow", dev)) {
2838 +               ERR(": unable to get OVR IRQ %d\n",
2839 +                   lp->ovr_irq);
2840 +               free_irq(lp->rx_irq, dev);
2841 +               free_irq(lp->tx_irq, dev);
2842 +               return -EAGAIN;
2843 +       }
2844 +#endif
2845 +       
2846 +       /* Install handler for underflow error. */
2847 +       if (request_irq(lp->und_irq, &rc32434_und_interrupt,
2848 +                       SA_SHIRQ | SA_INTERRUPT,
2849 +                       "Ethernet Underflow", dev)) {
2850 +               ERR(": unable to get UND IRQ %d\n",
2851 +                   lp->und_irq);
2852 +               free_irq(lp->rx_irq, dev);
2853 +               free_irq(lp->tx_irq, dev);
2854 +#ifdef RC32434_REVISION                
2855 +               free_irq(lp->ovr_irq, dev);             
2856 +#endif
2857 +               return -EAGAIN;
2858 +       }
2859 +       
2860 +       
2861 +       return 0;
2862 +}
2863 +
2864 +
2865 +
2866 +
2867 +static int rc32434_close(struct net_device *dev)
2868 +{
2869 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2870 +       u32 tmp;
2871 +       
2872 +       /* Disable interrupts */
2873 +       disable_irq(lp->rx_irq);
2874 +       disable_irq(lp->tx_irq);
2875 +#ifdef RC32434_REVISION
2876 +       disable_irq(lp->ovr_irq);
2877 +#endif
2878 +       disable_irq(lp->und_irq);
2879 +       
2880 +       tmp = rc32434_readl(&lp->tx_dma_regs->dmasm);
2881 +       tmp = tmp | DMASM_f_m | DMASM_e_m;
2882 +       rc32434_writel(tmp, &lp->tx_dma_regs->dmasm);
2883 +       
2884 +       tmp = rc32434_readl(&lp->rx_dma_regs->dmasm);
2885 +       tmp = tmp | DMASM_d_m | DMASM_h_m | DMASM_e_m;
2886 +       rc32434_writel(tmp, &lp->rx_dma_regs->dmasm);
2887 +       
2888 +       free_irq(lp->rx_irq, dev);
2889 +       free_irq(lp->tx_irq, dev);
2890 +#ifdef RC32434_REVISION        
2891 +       free_irq(lp->ovr_irq, dev);
2892 +#endif
2893 +       free_irq(lp->und_irq, dev);
2894 +       return 0;
2895 +}
2896 +
2897 +
2898 +/* transmit packet */
2899 +static int rc32434_send_packet(struct sk_buff *skb, struct net_device *dev)
2900 +{
2901 +       struct rc32434_local            *lp = (struct rc32434_local *)dev->priv;
2902 +       unsigned long                   flags;
2903 +       u32                                     length;
2904 +       DMAD_t                          td;
2905 +       
2906 +       
2907 +       spin_lock_irqsave(&lp->lock, flags);
2908 +       
2909 +       td = &lp->td_ring[lp->tx_chain_tail];
2910 +       
2911 +       /* stop queue when full, drop pkts if queue already full */
2912 +       if(lp->tx_count >= (RC32434_NUM_TDS - 2)) {
2913 +               lp->tx_full = 1;
2914 +               
2915 +               if(lp->tx_count == (RC32434_NUM_TDS - 2)) {
2916 +                       netif_stop_queue(dev);
2917 +               }
2918 +               else {
2919 +                       lp->stats.tx_dropped++;
2920 +                       dev_kfree_skb_any(skb);
2921 +                       spin_unlock_irqrestore(&lp->lock, flags);
2922 +                       return 1;
2923 +               }          
2924 +       }        
2925 +       
2926 +       lp->tx_count ++;
2927 +       
2928 +       lp->tx_skb[lp->tx_chain_tail] = skb;
2929 +       
2930 +       length = skb->len;
2931 +       
2932 +       /* Setup the transmit descriptor. */
2933 +       td->ca = CPHYSADDR(skb->data);
2934 +       
2935 +       if(rc32434_readl(&(lp->tx_dma_regs->dmandptr)) == 0) {
2936 +               if( lp->tx_chain_status == empty ) {
2937 +                       td->control = DMA_COUNT(length) |DMAD_cof_m |DMAD_iof_m;                                /*  Update tail      */
2938 +                       lp->tx_chain_tail = (lp->tx_chain_tail + 1) & RC32434_TDS_MASK;                          /*   Move tail       */
2939 +                       rc32434_writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), &(lp->tx_dma_regs->dmandptr)); /* Write to NDPTR    */
2940 +                       lp->tx_chain_head = lp->tx_chain_tail;                                                  /* Move head to tail */
2941 +               }
2942 +               else {
2943 +                       td->control = DMA_COUNT(length) |DMAD_cof_m|DMAD_iof_m;                                 /* Update tail */
2944 +                       lp->td_ring[(lp->tx_chain_tail-1)& RC32434_TDS_MASK].control &=  ~(DMAD_cof_m);          /* Link to prev */
2945 +                       lp->td_ring[(lp->tx_chain_tail-1)& RC32434_TDS_MASK].link =  CPHYSADDR(td);              /* Link to prev */
2946 +                       lp->tx_chain_tail = (lp->tx_chain_tail + 1) & RC32434_TDS_MASK;                          /* Move tail */
2947 +                       rc32434_writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), &(lp->tx_dma_regs->dmandptr)); /* Write to NDPTR */
2948 +                       lp->tx_chain_head = lp->tx_chain_tail;                                                  /* Move head to tail */
2949 +                       lp->tx_chain_status = empty;
2950 +               }
2951 +       }
2952 +       else {
2953 +               if( lp->tx_chain_status == empty ) {
2954 +                       td->control = DMA_COUNT(length) |DMAD_cof_m |DMAD_iof_m;                                /* Update tail */
2955 +                       lp->tx_chain_tail = (lp->tx_chain_tail + 1) & RC32434_TDS_MASK;                          /* Move tail */
2956 +                       lp->tx_chain_status = filled;
2957 +               }
2958 +               else {
2959 +                       td->control = DMA_COUNT(length) |DMAD_cof_m |DMAD_iof_m;                                /* Update tail */
2960 +                       lp->td_ring[(lp->tx_chain_tail-1)& RC32434_TDS_MASK].control &=  ~(DMAD_cof_m);          /* Link to prev */
2961 +                       lp->td_ring[(lp->tx_chain_tail-1)& RC32434_TDS_MASK].link =  CPHYSADDR(td);              /* Link to prev */
2962 +                       lp->tx_chain_tail = (lp->tx_chain_tail + 1) & RC32434_TDS_MASK;                          /* Move tail */
2963 +               }
2964 +       }
2965 +       
2966 +       dev->trans_start = jiffies;                             
2967 +       
2968 +       spin_unlock_irqrestore(&lp->lock, flags);
2969 +       
2970 +       return 0;
2971 +}
2972 +
2973 +
2974 +/* Ethernet MII-PHY Handler */
2975 +static void rc32434_mii_handler(unsigned long data)
2976 +{
2977 +       struct net_device *dev = (struct net_device *)data;             
2978 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
2979 +       unsigned long   flags;
2980 +       unsigned long duplex_status;
2981 +       int port_addr = (lp->rx_irq == 0x2c? 1:0) << 8;
2982 +       
2983 +       spin_lock_irqsave(&lp->lock, flags);
2984 +       
2985 +       /* Two ports are using the same MII, the difference is the PHY address */
2986 +       rc32434_writel(0, &rc32434_eth0_regs->miimcfg);  
2987 +       rc32434_writel(0, &rc32434_eth0_regs->miimcmd);  
2988 +       rc32434_writel(port_addr |0x05, &rc32434_eth0_regs->miimaddr);  
2989 +       rc32434_writel(MIIMCMD_scn_m, &rc32434_eth0_regs->miimcmd);  
2990 +       while(rc32434_readl(&rc32434_eth0_regs->miimind) & MIIMIND_nv_m);
2991 +       
2992 +       ERR("irq:%x             port_addr:%x    RDD:%x\n", 
2993 +           lp->rx_irq, port_addr, rc32434_readl(&rc32434_eth0_regs->miimrdd));
2994 +       duplex_status = (rc32434_readl(&rc32434_eth0_regs->miimrdd) & 0x140)? ETHMAC2_fd_m: 0;
2995 +       if(duplex_status != lp->duplex_mode) {
2996 +               ERR("The MII-PHY is Auto-negotiated to %s-Duplex mode for Eth-%x\n", duplex_status? "Full":"Half", lp->rx_irq == 0x2c? 1:0);            
2997 +               lp->duplex_mode = duplex_status;
2998 +               rc32434_restart(dev);           
2999 +       }
3000 +       
3001 +       lp->mii_phy_timer.expires = jiffies + 10 * HZ;  
3002 +       add_timer(&lp->mii_phy_timer);
3003 +       
3004 +       spin_unlock_irqrestore(&lp->lock, flags);
3005 +       
3006 +}
3007 +
3008 +#ifdef RC32434_REVISION        
3009 +/* Ethernet Rx Overflow interrupt */
3010 +static irqreturn_t
3011 +rc32434_ovr_interrupt(int irq, void *dev_id, struct pt_regs * regs)
3012 +{
3013 +       struct net_device *dev = (struct net_device *)dev_id;
3014 +       struct rc32434_local *lp;
3015 +       unsigned int ovr;
3016 +       irqreturn_t retval = IRQ_NONE;
3017 +       
3018 +       ASSERT(dev != NULL);
3019 +       
3020 +       lp = (struct rc32434_local *)dev->priv;
3021 +       spin_lock(&lp->lock);
3022 +       ovr = rc32434_readl(&lp->eth_regs->ethintfc);
3023 +       
3024 +       if(ovr & ETHINTFC_ovr_m) {
3025 +               netif_stop_queue(dev);
3026 +               
3027 +               /* clear OVR bit */
3028 +               rc32434_writel((ovr & ~ETHINTFC_ovr_m), &lp->eth_regs->ethintfc);
3029 +               
3030 +               /* Restart interface */
3031 +               rc32434_restart(dev);
3032 +               retval = IRQ_HANDLED;
3033 +       }
3034 +       spin_unlock(&lp->lock);
3035 +       
3036 +       return retval;
3037 +}
3038 +
3039 +#endif
3040 +
3041 +
3042 +/* Ethernet Tx Underflow interrupt */
3043 +static irqreturn_t
3044 +rc32434_und_interrupt(int irq, void *dev_id, struct pt_regs * regs)
3045 +{
3046 +       struct net_device *dev = (struct net_device *)dev_id;
3047 +       struct rc32434_local *lp;
3048 +       unsigned int und;
3049 +       irqreturn_t retval = IRQ_NONE;
3050 +       
3051 +       ASSERT(dev != NULL);
3052 +       
3053 +       lp = (struct rc32434_local *)dev->priv;
3054 +       
3055 +       spin_lock(&lp->lock);
3056 +       
3057 +       und = rc32434_readl(&lp->eth_regs->ethintfc);
3058 +       
3059 +       if(und & ETHINTFC_und_m) {
3060 +               netif_stop_queue(dev);
3061 +               
3062 +               rc32434_writel((und & ~ETHINTFC_und_m), &lp->eth_regs->ethintfc);
3063 +               
3064 +               /* Restart interface */
3065 +               rc32434_restart(dev);
3066 +               retval = IRQ_HANDLED;
3067 +       }
3068 +       
3069 +       spin_unlock(&lp->lock);
3070 +       
3071 +       return retval;
3072 +}
3073 +
3074 +
3075 +/* Ethernet Rx DMA interrupt */
3076 +static irqreturn_t
3077 +rc32434_rx_dma_interrupt(int irq, void *dev_id, struct pt_regs * regs)
3078 +{
3079 +       struct net_device *dev = (struct net_device *)dev_id;
3080 +       struct rc32434_local* lp;
3081 +       volatile u32 dmas,dmasm;
3082 +       irqreturn_t retval;
3083 +       
3084 +       ASSERT(dev != NULL);
3085 +       
3086 +       lp = (struct rc32434_local *)dev->priv;
3087 +       
3088 +       spin_lock(&lp->lock);
3089 +       dmas = rc32434_readl(&lp->rx_dma_regs->dmas);
3090 +       if(dmas & (DMAS_d_m|DMAS_h_m|DMAS_e_m)) {
3091 +               /* Mask D H E bit in Rx DMA */
3092 +               dmasm = rc32434_readl(&lp->rx_dma_regs->dmasm);
3093 +               rc32434_writel(dmasm | (DMASM_d_m | DMASM_h_m | DMASM_e_m), &lp->rx_dma_regs->dmasm);
3094 +#ifdef CONFIG_IDT_USE_NAPI
3095 +               if(netif_rx_schedule_prep(dev))
3096 +                        __netif_rx_schedule(dev);
3097 +#else
3098 +               tasklet_hi_schedule(lp->rx_tasklet);
3099 +#endif
3100 +               
3101 +               if (dmas & DMAS_e_m)
3102 +                       ERR(": DMA error\n");
3103 +               
3104 +               retval = IRQ_HANDLED;
3105 +       }
3106 +       else
3107 +               retval = IRQ_NONE;
3108 +       
3109 +       spin_unlock(&lp->lock);
3110 +       return retval;
3111 +}
3112 +
3113 +#ifdef CONFIG_IDT_USE_NAPI
3114 +static int rc32434_poll(struct net_device *rx_data_dev, int *budget)
3115 +#else
3116 +static void rc32434_rx_tasklet(unsigned long rx_data_dev)
3117 +#endif
3118 +{
3119 +       struct net_device *dev = (struct net_device *)rx_data_dev;      
3120 +       struct rc32434_local* lp = netdev_priv(dev);
3121 +       volatile DMAD_t  rd = &lp->rd_ring[lp->rx_next_done];
3122 +       struct sk_buff *skb, *skb_new;
3123 +       u8* pkt_buf;
3124 +       u32 devcs, count, pkt_len, pktuncrc_len;
3125 +       volatile u32 dmas;
3126 +#ifdef CONFIG_IDT_USE_NAPI
3127 +       u32 received = 0;
3128 +       int rx_work_limit = min(*budget,dev->quota);
3129 +#else
3130 +       unsigned long   flags;
3131 +       spin_lock_irqsave(&lp->lock, flags);
3132 +#endif
3133 +       
3134 +       while ( (count = RC32434_RBSIZE - (u32)DMA_COUNT(rd->control)) != 0) {
3135 +#ifdef CONFIG_IDT_USE_NAPI
3136 +               if(--rx_work_limit <0)
3137 +                {
3138 +                        break;
3139 +                }
3140 +#endif
3141 +               /* init the var. used for the later operations within the while loop */
3142 +               skb_new = NULL;
3143 +               devcs = rd->devcs;
3144 +               pkt_len = RCVPKT_LENGTH(devcs);
3145 +               skb = lp->rx_skb[lp->rx_next_done];
3146 +      
3147 +               if (count < 64) {
3148 +                       lp->stats.rx_errors++;
3149 +                       lp->stats.rx_dropped++;                 
3150 +               }
3151 +               else if ((devcs & ( ETHRX_ld_m)) !=     ETHRX_ld_m) {
3152 +                       /* check that this is a whole packet */
3153 +                       /* WARNING: DMA_FD bit incorrectly set in Rc32434 (errata ref #077) */
3154 +                       lp->stats.rx_errors++;
3155 +                       lp->stats.rx_dropped++;
3156 +               }
3157 +               else if ( (devcs & ETHRX_rok_m)  ) {
3158 +                       
3159 +                       {
3160 +                               /* must be the (first and) last descriptor then */
3161 +                               pkt_buf = (u8*)lp->rx_skb[lp->rx_next_done]->data;
3162 +                               
3163 +                               pktuncrc_len = pkt_len - 4;
3164 +                               /* invalidate the cache */
3165 +                               dma_cache_inv((unsigned long)pkt_buf, pktuncrc_len);
3166 +                               
3167 +                               /* Malloc up new buffer. */                                       
3168 +                               skb_new = dev_alloc_skb(RC32434_RBSIZE + 2);                                                    
3169 +                               
3170 +                               if (skb_new != NULL){
3171 +                                       /* Make room */
3172 +                                       skb_put(skb, pktuncrc_len);                 
3173 +                                       
3174 +                                       skb->protocol = eth_type_trans(skb, dev);
3175 +                                       
3176 +                                       /* pass the packet to upper layers */
3177 +#ifdef CONFIG_IDT_USE_NAPI
3178 +                                       netif_receive_skb(skb);
3179 +#else
3180 +                                       netif_rx(skb);
3181 +#endif
3182 +                                       
3183 +                                       dev->last_rx = jiffies;
3184 +                                       lp->stats.rx_packets++;
3185 +                                       lp->stats.rx_bytes += pktuncrc_len;
3186 +                                       
3187 +                                       if (IS_RCV_MP(devcs))
3188 +                                               lp->stats.multicast++;
3189 +                                       
3190 +                                       /* 16 bit align */                                                
3191 +                                       skb_reserve(skb_new, 2);        
3192 +                                       
3193 +                                       skb_new->dev = dev;
3194 +                                       lp->rx_skb[lp->rx_next_done] = skb_new;
3195 +                               }
3196 +                               else {
3197 +                                       ERR("no memory, dropping rx packet.\n");
3198 +                                       lp->stats.rx_errors++;          
3199 +                                       lp->stats.rx_dropped++;                                 
3200 +                               }
3201 +                       }
3202 +                       
3203 +               }                       
3204 +               else {
3205 +                       /* This should only happen if we enable accepting broken packets */
3206 +                       lp->stats.rx_errors++;
3207 +                       lp->stats.rx_dropped++;
3208 +                       
3209 +                       /* add statistics counters */
3210 +                       if (IS_RCV_CRC_ERR(devcs)) {
3211 +                               DBG(2, "RX CRC error\n");
3212 +                               lp->stats.rx_crc_errors++;
3213 +                       } 
3214 +                       else if (IS_RCV_LOR_ERR(devcs)) {
3215 +                               DBG(2, "RX LOR error\n");
3216 +                               lp->stats.rx_length_errors++;
3217 +                       }                               
3218 +                       else if (IS_RCV_LE_ERR(devcs)) {
3219 +                               DBG(2, "RX LE error\n");
3220 +                               lp->stats.rx_length_errors++;
3221 +                       }
3222 +                       else if (IS_RCV_OVR_ERR(devcs)) {
3223 +                               lp->stats.rx_over_errors++;
3224 +                       }
3225 +                       else if (IS_RCV_CV_ERR(devcs)) {
3226 +                               /* code violation */
3227 +                               DBG(2, "RX CV error\n");
3228 +                               lp->stats.rx_frame_errors++;
3229 +                       }
3230 +                       else if (IS_RCV_CES_ERR(devcs)) {
3231 +                               DBG(2, "RX Preamble error\n");
3232 +                       }
3233 +               }
3234 +               
3235 +               rd->devcs = 0;
3236 +               
3237 +               /* restore descriptor's curr_addr */
3238 +               if(skb_new)
3239 +                       rd->ca = CPHYSADDR(skb_new->data); 
3240 +               else
3241 +                       rd->ca = CPHYSADDR(skb->data);
3242 +               
3243 +               rd->control = DMA_COUNT(RC32434_RBSIZE) |DMAD_cod_m |DMAD_iod_m;
3244 +               lp->rd_ring[(lp->rx_next_done-1)& RC32434_RDS_MASK].control &=  ~(DMAD_cod_m);  
3245 +               
3246 +               lp->rx_next_done = (lp->rx_next_done + 1) & RC32434_RDS_MASK;
3247 +               rd = &lp->rd_ring[lp->rx_next_done];
3248 +               rc32434_writel( ~DMAS_d_m, &lp->rx_dma_regs->dmas);
3249 +       }       
3250 +#ifdef CONFIG_IDT_USE_NAPI
3251 +        dev->quota -= received;
3252 +        *budget =- received;
3253 +        if(rx_work_limit < 0)
3254 +                goto not_done;
3255 +#endif
3256 +       
3257 +       dmas = rc32434_readl(&lp->rx_dma_regs->dmas);
3258 +       
3259 +       if(dmas & DMAS_h_m) {
3260 +               rc32434_writel( ~(DMAS_h_m | DMAS_e_m), &lp->rx_dma_regs->dmas);
3261 +#ifdef RC32434_PROC_DEBUG
3262 +               lp->dma_halt_cnt++;
3263 +#endif
3264 +               rd->devcs = 0;
3265 +               skb = lp->rx_skb[lp->rx_next_done];
3266 +               rd->ca = CPHYSADDR(skb->data);
3267 +               rc32434_chain_rx(lp,rd);
3268 +       }
3269 +       
3270 +#ifdef CONFIG_IDT_USE_NAPI
3271 +       netif_rx_complete(dev);
3272 +#endif
3273 +       /* Enable D H E bit in Rx DMA */
3274 +       rc32434_writel(rc32434_readl(&lp->rx_dma_regs->dmasm) & ~(DMASM_d_m | DMASM_h_m |DMASM_e_m), &lp->rx_dma_regs->dmasm); 
3275 +#ifdef CONFIG_IDT_USE_NAPI
3276 +       return 0;
3277 + not_done:
3278 +       return 1;
3279 +#else
3280 +       spin_unlock_irqrestore(&lp->lock, flags);
3281 +       return;
3282 +#endif
3283 +
3284 +       
3285 +}      
3286 +
3287 +
3288 +
3289 +/* Ethernet Tx DMA interrupt */
3290 +static irqreturn_t
3291 +rc32434_tx_dma_interrupt(int irq, void *dev_id, struct pt_regs * regs)
3292 +{
3293 +       struct net_device *dev = (struct net_device *)dev_id;
3294 +       struct rc32434_local *lp;
3295 +       volatile u32 dmas,dmasm;
3296 +       irqreturn_t retval;
3297 +       
3298 +       ASSERT(dev != NULL);
3299 +       
3300 +       lp = (struct rc32434_local *)dev->priv;
3301 +       
3302 +       spin_lock(&lp->lock);
3303 +       
3304 +       dmas = rc32434_readl(&lp->tx_dma_regs->dmas);
3305 +       
3306 +       if (dmas & (DMAS_f_m | DMAS_e_m)) {
3307 +               dmasm = rc32434_readl(&lp->tx_dma_regs->dmasm);
3308 +               /* Mask F E bit in Tx DMA */
3309 +               rc32434_writel(dmasm | (DMASM_f_m | DMASM_e_m), &lp->tx_dma_regs->dmasm);
3310 +               
3311 +               tasklet_hi_schedule(lp->tx_tasklet);
3312 +               
3313 +               if(lp->tx_chain_status == filled && (rc32434_readl(&(lp->tx_dma_regs->dmandptr)) == 0)) {
3314 +                       rc32434_writel(CPHYSADDR(&lp->td_ring[lp->tx_chain_head]), &(lp->tx_dma_regs->dmandptr));                       
3315 +                       lp->tx_chain_status = empty;
3316 +                       lp->tx_chain_head = lp->tx_chain_tail;
3317 +                       dev->trans_start = jiffies;
3318 +               }
3319 +               
3320 +               if (dmas & DMAS_e_m)
3321 +                       ERR(": DMA error\n");
3322 +               
3323 +               retval = IRQ_HANDLED;
3324 +       }
3325 +       else
3326 +               retval = IRQ_NONE;
3327 +       
3328 +       spin_unlock(&lp->lock);
3329 +       
3330 +       return retval;
3331 +}
3332 +
3333 +
3334 +static void rc32434_tx_tasklet(unsigned long tx_data_dev)
3335 +{
3336 +       struct net_device *dev = (struct net_device *)tx_data_dev;      
3337 +       struct rc32434_local* lp = (struct rc32434_local *)dev->priv;
3338 +       volatile DMAD_t td = &lp->td_ring[lp->tx_next_done];
3339 +       u32 devcs;
3340 +       unsigned long   flags;
3341 +       volatile u32 dmas;
3342 +       
3343 +       spin_lock_irqsave(&lp->lock, flags);
3344 +       
3345 +       /* process all desc that are done */
3346 +       while(IS_DMA_FINISHED(td->control)) {
3347 +               if(lp->tx_full == 1) {
3348 +                       netif_wake_queue(dev);
3349 +                       lp->tx_full = 0;
3350 +               }
3351 +               
3352 +               devcs = lp->td_ring[lp->tx_next_done].devcs;    
3353 +               if ((devcs & (ETHTX_fd_m | ETHTX_ld_m)) != (ETHTX_fd_m | ETHTX_ld_m)) {
3354 +                       lp->stats.tx_errors++;
3355 +                       lp->stats.tx_dropped++;                         
3356 +                       
3357 +                       /* should never happen */
3358 +                       DBG(1, __FUNCTION__ ": split tx ignored\n");
3359 +               }
3360 +               else if (IS_TX_TOK(devcs)) {
3361 +                       lp->stats.tx_packets++;
3362 +               }
3363 +               else {
3364 +                       lp->stats.tx_errors++;
3365 +                       lp->stats.tx_dropped++;                         
3366 +                       
3367 +                       /* underflow */
3368 +                       if (IS_TX_UND_ERR(devcs)) 
3369 +                               lp->stats.tx_fifo_errors++;
3370 +                       
3371 +                       /* oversized frame */
3372 +                       if (IS_TX_OF_ERR(devcs))
3373 +                               lp->stats.tx_aborted_errors++;
3374 +                       
3375 +                       /* excessive deferrals */
3376 +                       if (IS_TX_ED_ERR(devcs))
3377 +                               lp->stats.tx_carrier_errors++;
3378 +                       
3379 +                       /* collisions: medium busy */
3380 +                       if (IS_TX_EC_ERR(devcs))
3381 +                               lp->stats.collisions++;
3382 +                       
3383 +                       /* late collision */
3384 +                       if (IS_TX_LC_ERR(devcs))
3385 +                               lp->stats.tx_window_errors++;
3386 +                       
3387 +               }
3388 +               
3389 +               /* We must always free the original skb */
3390 +               if (lp->tx_skb[lp->tx_next_done] != NULL) {
3391 +                       dev_kfree_skb_any(lp->tx_skb[lp->tx_next_done]);
3392 +                       lp->tx_skb[lp->tx_next_done] = NULL;
3393 +               }
3394 +               
3395 +               lp->td_ring[lp->tx_next_done].control = DMAD_iof_m;
3396 +               lp->td_ring[lp->tx_next_done].devcs = ETHTX_fd_m | ETHTX_ld_m;  
3397 +               lp->td_ring[lp->tx_next_done].link = 0;
3398 +               lp->td_ring[lp->tx_next_done].ca = 0;
3399 +               lp->tx_count --;
3400 +               
3401 +               /* go on to next transmission */
3402 +               lp->tx_next_done = (lp->tx_next_done + 1) & RC32434_TDS_MASK;
3403 +               td = &lp->td_ring[lp->tx_next_done];
3404 +               
3405 +       }
3406 +       
3407 +       dmas = rc32434_readl(&lp->tx_dma_regs->dmas);
3408 +       rc32434_writel( ~dmas, &lp->tx_dma_regs->dmas);
3409 +       
3410 +       /* Enable F E bit in Tx DMA */
3411 +       rc32434_writel(rc32434_readl(&lp->tx_dma_regs->dmasm) & ~(DMASM_f_m | DMASM_e_m), &lp->tx_dma_regs->dmasm); 
3412 +       spin_unlock_irqrestore(&lp->lock, flags);
3413 +       
3414 +}
3415 +
3416 +
3417 +static struct net_device_stats * rc32434_get_stats(struct net_device *dev)
3418 +{
3419 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
3420 +       return &lp->stats;
3421 +}
3422 +
3423 +
3424 +/*
3425 + * Set or clear the multicast filter for this adaptor.
3426 + */
3427 +static void rc32434_multicast_list(struct net_device *dev)
3428 +{   
3429 +       /* listen to broadcasts always and to treat     */
3430 +       /*       IFF bits independantly */
3431 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
3432 +       unsigned long flags;
3433 +       u32 recognise = ETHARC_ab_m;            /* always accept broadcasts */
3434 +       
3435 +       if (dev->flags & IFF_PROMISC)                   /* set promiscuous mode */
3436 +               recognise |= ETHARC_pro_m;
3437 +       
3438 +       if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 15))
3439 +               recognise |= ETHARC_am_m;               /* all multicast & bcast */
3440 +       else if (dev->mc_count > 0) {
3441 +               DBG(2, __FUNCTION__ ": mc_count %d\n", dev->mc_count);
3442 +               recognise |= ETHARC_am_m;               /* for the time being */
3443 +       }
3444 +       
3445 +       spin_lock_irqsave(&lp->lock, flags);
3446 +       rc32434_writel(recognise, &lp->eth_regs->etharc);
3447 +       spin_unlock_irqrestore(&lp->lock, flags);
3448 +}
3449 +
3450 +
3451 +static void rc32434_tx_timeout(struct net_device *dev)
3452 +{
3453 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
3454 +       unsigned long flags;
3455 +       
3456 +       spin_lock_irqsave(&lp->lock, flags);
3457 +       rc32434_restart(dev);
3458 +       spin_unlock_irqrestore(&lp->lock, flags);
3459 +       
3460 +}
3461 +
3462 +
3463 +/*
3464 + * Initialize the RC32434 ethernet controller.
3465 + */
3466 +static int rc32434_init(struct net_device *dev)
3467 +{
3468 +       struct rc32434_local *lp = (struct rc32434_local *)dev->priv;
3469 +       int i, j;
3470 +       
3471 +       /* Disable DMA */       
3472 +       rc32434_abort_tx(dev);
3473 +       rc32434_abort_rx(dev); 
3474 +       
3475 +       /* reset ethernet logic */ 
3476 +       rc32434_writel(0, &lp->eth_regs->ethintfc);
3477 +       while((rc32434_readl(&lp->eth_regs->ethintfc) & ETHINTFC_rip_m))
3478 +               dev->trans_start = jiffies;     
3479 +       
3480 +       /* Enable Ethernet Interface */ 
3481 +       rc32434_writel(ETHINTFC_en_m, &lp->eth_regs->ethintfc); 
3482 +       
3483 +#ifndef CONFIG_IDT_USE_NAPI
3484 +       tasklet_disable(lp->rx_tasklet);
3485 +#endif
3486 +       tasklet_disable(lp->tx_tasklet);
3487 +       
3488 +       /* Initialize the transmit Descriptors */
3489 +       for (i = 0; i < RC32434_NUM_TDS; i++) {
3490 +               lp->td_ring[i].control = DMAD_iof_m;
3491 +               lp->td_ring[i].devcs = ETHTX_fd_m | ETHTX_ld_m;
3492 +               lp->td_ring[i].ca = 0;
3493 +               lp->td_ring[i].link = 0;
3494 +               if (lp->tx_skb[i] != NULL) {
3495 +                       dev_kfree_skb_any(lp->tx_skb[i]);
3496 +                       lp->tx_skb[i] = NULL;
3497 +               }
3498 +       }
3499 +       lp->tx_next_done = lp->tx_chain_head = lp->tx_chain_tail =      lp->tx_full = lp->tx_count = 0;
3500 +       lp->    tx_chain_status = empty;
3501 +       
3502 +       /*
3503 +        * Initialize the receive descriptors so that they
3504 +        * become a circular linked list, ie. let the last
3505 +        * descriptor point to the first again.
3506 +        */
3507 +       for (i=0; i<RC32434_NUM_RDS; i++) {
3508 +               struct sk_buff *skb = lp->rx_skb[i];
3509 +               
3510 +               if (lp->rx_skb[i] == NULL) {
3511 +                       skb = dev_alloc_skb(RC32434_RBSIZE + 2);
3512 +                       if (skb == NULL) {
3513 +                               ERR("No memory in the system\n");
3514 +                               for (j = 0; j < RC32434_NUM_RDS; j ++)
3515 +                                       if (lp->rx_skb[j] != NULL) 
3516 +                                               dev_kfree_skb_any(lp->rx_skb[j]);
3517 +                               
3518 +                               return 1;
3519 +                       }
3520 +                       else {
3521 +                               skb->dev = dev;
3522 +                               skb_reserve(skb, 2);
3523 +                               lp->rx_skb[i] = skb;
3524 +                               lp->rd_ring[i].ca = CPHYSADDR(skb->data); 
3525 +                               
3526 +                       }
3527 +               }
3528 +               lp->rd_ring[i].control =        DMAD_iod_m | DMA_COUNT(RC32434_RBSIZE);
3529 +               lp->rd_ring[i].devcs = 0;
3530 +               lp->rd_ring[i].ca = CPHYSADDR(skb->data);
3531 +               lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]);
3532 +               
3533 +       }
3534 +       /* loop back */
3535 +       lp->rd_ring[RC32434_NUM_RDS-1].link = CPHYSADDR(&lp->rd_ring[0]);
3536 +       lp->rx_next_done   = 0;
3537 +       
3538 +       lp->rd_ring[RC32434_NUM_RDS-1].control |= DMAD_cod_m;
3539 +       lp->rx_chain_head = 0;
3540 +       lp->rx_chain_tail = 0;
3541 +       lp->rx_chain_status = empty;
3542 +       
3543 +       rc32434_writel(0, &lp->rx_dma_regs->dmas);
3544 +       /* Start Rx DMA */
3545 +       rc32434_start_rx(lp, &lp->rd_ring[0]);
3546 +       
3547 +       /* Enable F E bit in Tx DMA */
3548 +       rc32434_writel(rc32434_readl(&lp->tx_dma_regs->dmasm) & ~(DMASM_f_m | DMASM_e_m), &lp->tx_dma_regs->dmasm); 
3549 +       /* Enable D H E bit in Rx DMA */
3550 +       rc32434_writel(rc32434_readl(&lp->rx_dma_regs->dmasm) & ~(DMASM_d_m | DMASM_h_m | DMASM_e_m), &lp->rx_dma_regs->dmasm); 
3551 +       
3552 +       /* Accept only packets destined for this Ethernet device address */
3553 +       rc32434_writel(ETHARC_ab_m, &lp->eth_regs->etharc); 
3554 +       
3555 +       /* Set all Ether station address registers to their initial values */ 
3556 +       rc32434_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal0); 
3557 +       rc32434_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah0);
3558 +       
3559 +       rc32434_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal1); 
3560 +       rc32434_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah1);
3561 +       
3562 +       rc32434_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal2); 
3563 +       rc32434_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah2);
3564 +       
3565 +       rc32434_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal3); 
3566 +       rc32434_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah3); 
3567 +       
3568 +       
3569 +       /* Frame Length Checking, Pad Enable, CRC Enable, Full Duplex set */ 
3570 +       rc32434_writel(ETHMAC2_pe_m | ETHMAC2_cen_m | ETHMAC2_fd_m, &lp->eth_regs->ethmac2);  
3571 +       //ETHMAC2_flc_m         ETHMAC2_fd_m    lp->duplex_mode
3572 +       
3573 +       /* Back to back inter-packet-gap */ 
3574 +       rc32434_writel(0x15, &lp->eth_regs->ethipgt); 
3575 +       /* Non - Back to back inter-packet-gap */ 
3576 +       rc32434_writel(0x12, &lp->eth_regs->ethipgr); 
3577 +       
3578 +       /* Management Clock Prescaler Divisor */
3579 +       /* Clock independent setting */
3580 +       rc32434_writel(((idt_cpu_freq)/MII_CLOCK+1) & ~1,
3581 +                      &lp->eth_regs->ethmcp);
3582 +       
3583 +       /* don't transmit until fifo contains 48b */
3584 +       rc32434_writel(48, &lp->eth_regs->ethfifott);
3585 +       
3586 +       rc32434_writel(ETHMAC1_re_m, &lp->eth_regs->ethmac1);
3587 +       
3588 +#ifndef CONFIG_IDT_USE_NAPI
3589 +       tasklet_enable(lp->rx_tasklet);
3590 +#endif
3591 +       tasklet_enable(lp->tx_tasklet);
3592 +       
3593 +       netif_start_queue(dev);
3594 +       
3595 +       
3596 +       return 0; 
3597 +       
3598 +}
3599 +
3600 +
3601 +#ifndef MODULE
3602 +
3603 +static int __init rc32434_setup(char *options)
3604 +{
3605 +       /* no options yet */
3606 +       return 1;
3607 +}
3608 +
3609 +static int __init rc32434_setup_ethaddr0(char *options)
3610 +{
3611 +       memcpy(mac0, options, 17);
3612 +       mac0[17]= '\0';
3613 +       return 1;
3614 +}
3615 +
3616 +__setup("rc32434eth=", rc32434_setup);
3617 +__setup("ethaddr0=", rc32434_setup_ethaddr0);
3618 +
3619 +
3620 +#endif /* MODULE */
3621 +
3622 +module_init(rc32434_init_module);
3623 +module_exit(rc32434_cleanup_module);
3624 +
3625 +
3626 +
3627 +
3628 +
3629 +
3630 +
3631 +
3632 +
3633 +
3634 +
3635 +
3636 +
3637 +
3638 diff -Nur linux-2.6.15/drivers/net/rc32434_eth.h linux-2.6.15-openwrt/drivers/net/rc32434_eth.h
3639 --- linux-2.6.15/drivers/net/rc32434_eth.h      1970-01-01 01:00:00.000000000 +0100
3640 +++ linux-2.6.15-openwrt/drivers/net/rc32434_eth.h      2006-01-10 00:32:33.000000000 +0100
3641 @@ -0,0 +1,187 @@
3642 +/**************************************************************************
3643 + *
3644 + *  BRIEF MODULE DESCRIPTION
3645 + *     Definitions for IDT RC32434 on-chip ethernet controller.
3646 + *
3647 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
3648 + *         
3649 + *  This program is free software; you can redistribute  it and/or modify it
3650 + *  under  the terms of  the GNU General  Public License as published by the
3651 + *  Free Software Foundation;  either version 2 of the  License, or (at your
3652 + *  option) any later version.
3653 + *
3654 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
3655 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
3656 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
3657 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
3658 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3659 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
3660 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
3661 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
3662 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3663 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3664 + *
3665 + *  You should have received a copy of the  GNU General Public License along
3666 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
3667 + *  675 Mass Ave, Cambridge, MA 02139, USA.
3668 + *
3669 + *
3670 + **************************************************************************
3671 + * May 2004 rkt, neb
3672 + *
3673 + * Initial Release
3674 + *
3675 + * Aug 2004
3676 + *
3677 + * Added NAPI
3678 + *
3679 + **************************************************************************
3680 + */
3681 +
3682 +
3683 +#include  <asm/idt-boards/rc32434/rc32434.h>
3684 +#include  <asm/idt-boards/rc32434/rc32434_dma_v.h>
3685 +#include  <asm/idt-boards/rc32434/rc32434_eth_v.h>
3686 +
3687 +#define RC32434_DEBUG  2
3688 +//#define RC32434_PROC_DEBUG
3689 +#undef RC32434_DEBUG
3690 +
3691 +#ifdef RC32434_DEBUG
3692 +
3693 +/* use 0 for production, 1 for verification, >2 for debug */
3694 +static int rc32434_debug = RC32434_DEBUG;
3695 +#define ASSERT(expr) \
3696 +       if(!(expr)) {   \
3697 +               printk( "Assertion failed! %s,%s,%s,line=%d\n", \
3698 +               #expr,__FILE__,__FUNCTION__,__LINE__);          }
3699 +#define DBG(lvl, format, arg...) if (rc32434_debug > lvl) printk(KERN_INFO "%s: " format, dev->name , ## arg)
3700 +#else
3701 +#define ASSERT(expr) do {} while (0)
3702 +#define DBG(lvl, format, arg...) do {} while (0)
3703 +#endif
3704 +
3705 +#define INFO(format, arg...) printk(KERN_INFO "%s: " format, dev->name , ## arg)
3706 +#define ERR(format, arg...) printk(KERN_ERR "%s: " format, dev->name , ## arg)
3707 +#define WARN(format, arg...) printk(KERN_WARNING "%s: " format, dev->name , ## arg)            
3708 +
3709 +#define ETH0_DMA_RX_IRQ        GROUP1_IRQ_BASE + 0
3710 +#define ETH0_DMA_TX_IRQ        GROUP1_IRQ_BASE + 1 
3711 +#define ETH0_RX_OVR_IRQ        GROUP3_IRQ_BASE + 9
3712 +#define ETH0_TX_UND_IRQ        GROUP3_IRQ_BASE + 10
3713 +
3714 +#define ETH0_RX_DMA_ADDR  (DMA0_PhysicalAddress + 0*DMA_CHAN_OFFSET)
3715 +#define ETH0_TX_DMA_ADDR  (DMA0_PhysicalAddress + 1*DMA_CHAN_OFFSET)
3716 +
3717 +/* the following must be powers of two */
3718 +#ifdef CONFIG_IDT_USE_NAPI
3719 +#define RC32434_NUM_RDS    64                  /* number of receive descriptors */
3720 +#define RC32434_NUM_TDS    64                  /* number of transmit descriptors */
3721 +#else
3722 +#define RC32434_NUM_RDS    128                 /* number of receive descriptors */
3723 +#define RC32434_NUM_TDS    128                 /* number of transmit descriptors */
3724 +#endif
3725 +
3726 +#define RC32434_RBSIZE     1536                /* size of one resource buffer = Ether MTU */
3727 +#define RC32434_RDS_MASK   (RC32434_NUM_RDS-1)
3728 +#define RC32434_TDS_MASK   (RC32434_NUM_TDS-1)
3729 +#define RD_RING_SIZE (RC32434_NUM_RDS * sizeof(struct DMAD_s))
3730 +#define TD_RING_SIZE (RC32434_NUM_TDS * sizeof(struct DMAD_s))
3731 +
3732 +#define RC32434_TX_TIMEOUT HZ * 100
3733 +
3734 +#define rc32434_eth0_regs ((ETH_t)(ETH0_VirtualAddress))
3735 +#define rc32434_eth1_regs ((ETH_t)(ETH1_VirtualAddress))
3736 +
3737 +enum status    { filled,       empty};
3738 +#define IS_DMA_FINISHED(X)   (((X) & (DMAD_f_m)) != 0)
3739 +#define IS_DMA_DONE(X)   (((X) & (DMAD_d_m)) != 0)
3740 +
3741 +
3742 +/* Information that need to be kept for each board. */
3743 +struct rc32434_local {
3744 +       ETH_t  eth_regs;
3745 +       DMA_Chan_t  rx_dma_regs;
3746 +       DMA_Chan_t  tx_dma_regs;
3747 +       volatile DMAD_t   td_ring;                      /* transmit descriptor ring */ 
3748 +       volatile DMAD_t   rd_ring;                      /* receive descriptor ring  */
3749 +       
3750 +       struct sk_buff* tx_skb[RC32434_NUM_TDS];        /* skbuffs for pkt to trans */
3751 +       struct sk_buff* rx_skb[RC32434_NUM_RDS];        /* skbuffs for pkt to trans */
3752 +       
3753 +#ifndef CONFIG_IDT_USE_NAPI
3754 +       struct tasklet_struct * rx_tasklet;
3755 +#endif
3756 +       struct tasklet_struct * tx_tasklet;
3757 +       
3758 +       int     rx_next_done;
3759 +       int     rx_chain_head;
3760 +       int     rx_chain_tail;
3761 +       enum status     rx_chain_status;
3762 +       
3763 +       int     tx_next_done;
3764 +       int     tx_chain_head;
3765 +       int     tx_chain_tail;
3766 +       enum status     tx_chain_status;
3767 +       int tx_count;                   
3768 +       int     tx_full;
3769 +       
3770 +       struct timer_list    mii_phy_timer;
3771 +       unsigned long duplex_mode;
3772 +       
3773 +       int     rx_irq;
3774 +       int    tx_irq;
3775 +       int    ovr_irq;
3776 +       int    und_irq;
3777 +       
3778 +       struct net_device_stats stats;
3779 +       spinlock_t lock; 
3780 +       
3781 +       /* debug /proc entry */
3782 +       struct proc_dir_entry *ps;
3783 +       int dma_halt_cnt;  int dma_run_cnt;
3784 +};
3785 +
3786 +extern unsigned int idt_cpu_freq;
3787 +
3788 +/* Index to functions, as function prototypes. */
3789 +static int rc32434_open(struct net_device *dev);
3790 +static int rc32434_send_packet(struct sk_buff *skb, struct net_device *dev);
3791 +static void rc32434_mii_handler(unsigned long data);
3792 +static irqreturn_t  rc32434_und_interrupt(int irq, void *dev_id, struct pt_regs * regs);
3793 +static irqreturn_t rc32434_rx_dma_interrupt(int irq, void *dev_id, struct pt_regs * regs);
3794 +static irqreturn_t rc32434_tx_dma_interrupt(int irq, void *dev_id, struct pt_regs * regs);
3795 +#ifdef RC32434_REVISION        
3796 +static irqreturn_t rc32434_ovr_interrupt(int irq, void *dev_id, struct pt_regs * regs);
3797 +#endif
3798 +static int  rc32434_close(struct net_device *dev);
3799 +static struct net_device_stats *rc32434_get_stats(struct net_device *dev);
3800 +static void rc32434_multicast_list(struct net_device *dev);
3801 +static int  rc32434_init(struct net_device *dev);
3802 +static void rc32434_tx_timeout(struct net_device *dev);
3803 +
3804 +static void rc32434_tx_tasklet(unsigned long tx_data_dev);
3805 +#ifdef CONFIG_IDT_USE_NAPI
3806 +static int rc32434_poll(struct net_device *rx_data_dev, int *budget);
3807 +#else
3808 +static void rc32434_rx_tasklet(unsigned long rx_data_dev);
3809 +#endif
3810 +static void rc32434_cleanup_module(void);
3811 +static int rc32434_probe(int port_num);
3812 +int rc32434_init_module(void);
3813 +
3814 +
3815 +static inline void rc32434_abort_dma(struct net_device *dev, DMA_Chan_t ch)
3816 +{
3817 +       if (rc32434_readl(&ch->dmac) & DMAC_run_m) {
3818 +               rc32434_writel(0x10, &ch->dmac); 
3819 +               
3820 +               while (!(rc32434_readl(&ch->dmas) & DMAS_h_m))
3821 +                       dev->trans_start = jiffies;             
3822 +               
3823 +               rc32434_writel(0, &ch->dmas);  
3824 +       }
3825 +       
3826 +       rc32434_writel(0, &ch->dmadptr); 
3827 +       rc32434_writel(0, &ch->dmandptr); 
3828 +}
3829 diff -Nur linux-2.6.15/drivers/pci/access.c linux-2.6.15-openwrt/drivers/pci/access.c
3830 --- linux-2.6.15/drivers/pci/access.c   2006-01-03 04:21:10.000000000 +0100
3831 +++ linux-2.6.15-openwrt/drivers/pci/access.c   2006-01-10 00:43:10.000000000 +0100
3832 @@ -21,6 +21,7 @@
3833  #define PCI_word_BAD (pos & 1)
3834  #define PCI_dword_BAD (pos & 3)
3835  
3836 +#ifdef __MIPSEB__
3837  #define PCI_OP_READ(size,type,len) \
3838  int pci_bus_read_config_##size \
3839         (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
3840 @@ -31,11 +32,32 @@
3841         if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER;       \
3842         spin_lock_irqsave(&pci_lock, flags);                            \
3843         res = bus->ops->read(bus, devfn, pos, len, &data);              \
3844 +       if (len == 1)                                                   \
3845 +        *value = (type)((data >> 24) & 0xff);                          \
3846 +        else if (len == 2)                                             \
3847 +        *value = (type)((data >> 16) & 0xffff);                        \
3848 +       else                                                            \
3849         *value = (type)data;                                            \
3850         spin_unlock_irqrestore(&pci_lock, flags);                       \
3851         return res;                                                     \
3852  }
3853 +#else
3854  
3855 +#define PCI_OP_READ(size,type,len) \
3856 +int pci_bus_read_config_##size \
3857 +       (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
3858 +{                                                                      \
3859 +       int res;                                                        \
3860 +       unsigned long flags;                                            \
3861 +       u32 data = 0;                                                   \
3862 +       if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER;       \
3863 +       spin_lock_irqsave(&pci_lock, flags);                            \
3864 +       res = bus->ops->read(bus, devfn, pos, len, &data);              \
3865 +       *value = (type)data;                                            \
3866 +       spin_unlock_irqrestore(&pci_lock, flags);                       \
3867 +       return res;                                                     \
3868 +}
3869 +#endif
3870  #define PCI_OP_WRITE(size,type,len) \
3871  int pci_bus_write_config_##size \
3872         (struct pci_bus *bus, unsigned int devfn, int pos, type value)  \
3873 diff -Nur linux-2.6.15/include/asm-mips/bootinfo.h linux-2.6.15-openwrt/include/asm-mips/bootinfo.h
3874 --- linux-2.6.15/include/asm-mips/bootinfo.h    2006-01-03 04:21:10.000000000 +0100
3875 +++ linux-2.6.15-openwrt/include/asm-mips/bootinfo.h    2006-01-10 00:32:33.000000000 +0100
3876 @@ -218,6 +218,17 @@
3877  #define MACH_GROUP_TITAN       22      /* PMC-Sierra Titan             */
3878  #define  MACH_TITAN_YOSEMITE   1       /* PMC-Sierra Yosemite          */
3879  
3880 +
3881 +/*
3882 + * Valid machtype for group ARUBA
3883 + */
3884 +#define MACH_GROUP_ARUBA       23
3885 +#define  MACH_ARUBA_UNKNOWN    0
3886 +#define  MACH_ARUBA_AP60       1
3887 +#define  MACH_ARUBA_AP65       2
3888 +#define  MACH_ARUBA_AP70       3
3889 +#define  MACH_ARUBA_AP40       4
3890 +
3891  #define CL_SIZE                        COMMAND_LINE_SIZE
3892  
3893  const char *get_system_type(void);
3894 diff -Nur linux-2.6.15/include/asm-mips/cpu.h linux-2.6.15-openwrt/include/asm-mips/cpu.h
3895 --- linux-2.6.15/include/asm-mips/cpu.h 2006-01-03 04:21:10.000000000 +0100
3896 +++ linux-2.6.15-openwrt/include/asm-mips/cpu.h 2006-01-10 00:32:33.000000000 +0100
3897 @@ -53,6 +53,9 @@
3898  #define PRID_IMP_R12000                0x0e00
3899  #define PRID_IMP_R8000         0x1000
3900  #define PRID_IMP_PR4450                0x1200
3901 +#define PRID_IMP_RC32334       0x1800
3902 +#define PRID_IMP_RC32355       0x1900
3903 +#define PRID_IMP_RC32365       0x1900
3904  #define PRID_IMP_R4600         0x2000
3905  #define PRID_IMP_R4700         0x2100
3906  #define PRID_IMP_TX39          0x2200
3907 @@ -196,7 +199,8 @@
3908  #define CPU_34K                        60
3909  #define CPU_PR4450             61
3910  #define CPU_SB1A               62
3911 -#define CPU_LAST               62
3912 +#define CPU_RC32300            63
3913 +#define CPU_LAST               63
3914  
3915  /*
3916   * ISA Level encodings
3917 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32300.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32300.h
3918 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32300.h  1970-01-01 01:00:00.000000000 +0100
3919 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32300.h  2006-01-10 00:32:33.000000000 +0100
3920 @@ -0,0 +1,142 @@
3921 +/**************************************************************************
3922 + *
3923 + *  BRIEF MODULE DESCRIPTION
3924 + *   RC32300 helper routines
3925 + *
3926 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
3927 + *         
3928 + *  This program is free software; you can redistribute  it and/or modify it
3929 + *  under  the terms of  the GNU General  Public License as published by the
3930 + *  Free Software Foundation;  either version 2 of the  License, or (at your
3931 + *  option) any later version.
3932 + *
3933 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
3934 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
3935 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
3936 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
3937 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3938 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
3939 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
3940 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
3941 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3942 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3943 + *
3944 + *  You should have received a copy of the  GNU General Public License along
3945 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
3946 + *  675 Mass Ave, Cambridge, MA 02139, USA.
3947 + *
3948 + *
3949 + **************************************************************************
3950 + * May 2004 P. Sadik.
3951 + *
3952 + * Initial Release
3953 + *
3954 + * 
3955 + *
3956 + **************************************************************************
3957 + */
3958 +
3959 +#ifndef __IDT_RC32300_H__
3960 +#define __IDT_RC32300_H__
3961 +
3962 +#include <linux/delay.h>
3963 +#include <asm/io.h>
3964 +
3965 +
3966 +/* cpu pipeline flush */
3967 +static inline void rc32300_sync(void)
3968 +{
3969 +       __asm__ volatile ("sync");
3970 +}
3971 +
3972 +static inline void rc32300_sync_udelay(int us)
3973 +{
3974 +       __asm__ volatile ("sync");
3975 +       udelay(us);
3976 +}
3977 +
3978 +static inline void rc32300_sync_delay(int ms)
3979 +{
3980 +       __asm__ volatile ("sync");
3981 +       mdelay(ms);
3982 +}
3983 +
3984 +/*
3985 + * Macros to access internal RC32300 registers. No byte
3986 + * swapping should be done when accessing the internal
3987 + * registers.
3988 + */
3989 +
3990 +static inline u8 rc32300_readb(unsigned long pa)
3991 +{
3992 +       return *((volatile u8 *)KSEG1ADDR(pa));
3993 +}
3994 +static inline u16 rc32300_readw(unsigned long pa)
3995 +{
3996 +       return *((volatile u16 *)KSEG1ADDR(pa));
3997 +}
3998 +static inline u32 rc32300_readl(unsigned long pa)
3999 +{
4000 +       return *((volatile u32 *)KSEG1ADDR(pa));
4001 +}
4002 +static inline void rc32300_writeb(u8 val, unsigned long pa)
4003 +{
4004 +       *((volatile u8 *)KSEG1ADDR(pa)) = val;
4005 +}
4006 +static inline void rc32300_writew(u16 val, unsigned long pa)
4007 +{
4008 +       *((volatile u16 *)KSEG1ADDR(pa)) = val;
4009 +}
4010 +static inline void rc32300_writel(u32 val, unsigned long pa)
4011 +{
4012 +       *((volatile u32 *)KSEG1ADDR(pa)) = val;
4013 +}
4014 +
4015 +
4016 +#define local_readb __raw_readb
4017 +#define local_readw __raw_readw
4018 +#define local_readl __raw_readl
4019 +
4020 +#define local_writeb __raw_writeb
4021 +#define local_writew __raw_writew
4022 +#define local_writel __raw_writel
4023 +
4024 +
4025 +/*
4026 + * C access to CLZ and CLO instructions
4027 + * (count leading zeroes/ones).
4028 + */
4029 +static inline int rc32300_clz(unsigned long val)
4030 +{
4031 +       int ret;
4032 +       __asm__ volatile (
4033 +               ".set\tnoreorder\n\t"
4034 +               ".set\tnoat\n\t"
4035 +               ".set\tmips32\n\t"
4036 +               "clz\t%0,%1\n\t"
4037 +               ".set\tmips0\n\t"
4038 +               ".set\tat\n\t"
4039 +               ".set\treorder"
4040 +               : "=r" (ret)
4041 +               : "r" (val));
4042 +       
4043 +       return ret;
4044 +}
4045 +static inline int rc32300_clo(unsigned long val)
4046 +{
4047 +       int ret;
4048 +       __asm__ volatile (
4049 +                   ".set\tnoreorder\n\t"
4050 +                   ".set\tnoat\n\t"
4051 +                   ".set\tmips32\n\t"
4052 +                   "clo\t%0,%1\n\t"
4053 +                   ".set\tmips0\n\t"
4054 +                   ".set\tat\n\t"
4055 +                   ".set\treorder"
4056 +                   : "=r" (ret)
4057 +                   : "r" (val));
4058 +       
4059 +       return ret;
4060 +}
4061 +
4062 +#endif  // __IDT_RC32300_H__
4063 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32334.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32334.h
4064 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32334.h  1970-01-01 01:00:00.000000000 +0100
4065 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32334.h  2006-01-10 00:32:33.000000000 +0100
4066 @@ -0,0 +1,207 @@
4067 +/**************************************************************************
4068 + *
4069 + *  BRIEF MODULE DESCRIPTION
4070 + *   Definitions for IDT RC32334 CPU.
4071 + *
4072 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
4073 + *         
4074 + *  This program is free software; you can redistribute  it and/or modify it
4075 + *  under  the terms of  the GNU General  Public License as published by the
4076 + *  Free Software Foundation;  either version 2 of the  License, or (at your
4077 + *  option) any later version.
4078 + *
4079 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
4080 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
4081 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
4082 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
4083 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4084 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
4085 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
4086 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
4087 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4088 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4089 + *
4090 + *  You should have received a copy of the  GNU General Public License along
4091 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
4092 + *  675 Mass Ave, Cambridge, MA 02139, USA.
4093 + *
4094 + *
4095 + **************************************************************************
4096 + * May 2004 P. Sadik.
4097 + *
4098 + * Initial Release
4099 + *
4100 + * 
4101 + *
4102 + **************************************************************************
4103 + */
4104 +
4105 +
4106 +#ifndef __IDT_RC32334_H__
4107 +#define __IDT_RC32334_H__
4108 +
4109 +#include <linux/delay.h>
4110 +#include <asm/io.h>
4111 +
4112 +/* Base address of internal registers */
4113 +#define RC32334_REG_BASE   0x18000000
4114 +
4115 +/* CPU and IP Bus Control */
4116 +#define CPU_PORT_WIDTH     0xffffe200 // virtual!
4117 +#define CPU_BTA            0xffffe204 // virtual!
4118 +#define CPU_BUSERR_ADDR    0xffffe208 // virtual!
4119 +#define CPU_IP_BTA         (RC32334_REG_BASE + 0x0000)
4120 +#define CPU_IP_ADDR_LATCH  (RC32334_REG_BASE + 0x0004)
4121 +#define CPU_IP_ARBITRATION (RC32334_REG_BASE + 0x0008)
4122 +#define CPU_IP_BUSERR_CNTL (RC32334_REG_BASE + 0x0010)
4123 +#define CPU_IP_BUSERR_ADDR (RC32334_REG_BASE + 0x0014)
4124 +#define CPU_IP_SYSID       (RC32334_REG_BASE + 0x0018)
4125 +
4126 +/* Memory Controller */
4127 +#define MEM_BASE_BANK0     (RC32334_REG_BASE + 0x0080)
4128 +#define MEM_MASK_BANK0     (RC32334_REG_BASE + 0x0084)
4129 +#define MEM_CNTL_BANK0     (RC32334_REG_BASE + 0x0200)
4130 +#define MEM_BASE_BANK1     (RC32334_REG_BASE + 0x0088)
4131 +#define MEM_MASK_BANK1     (RC32334_REG_BASE + 0x008c)
4132 +#define MEM_CNTL_BANK1     (RC32334_REG_BASE + 0x0204)
4133 +#define MEM_CNTL_BANK2     (RC32334_REG_BASE + 0x0208)
4134 +#define MEM_CNTL_BANK3     (RC32334_REG_BASE + 0x020c)
4135 +#define MEM_CNTL_BANK4     (RC32334_REG_BASE + 0x0210)
4136 +#define MEM_CNTL_BANK5     (RC32334_REG_BASE + 0x0214)
4137 +
4138 +/* PCI Controller */
4139 +#define PCI_INTR_PEND      (RC32334_REG_BASE + 0x05b0)
4140 +#define PCI_INTR_MASK      (RC32334_REG_BASE + 0x05b4)
4141 +#define PCI_INTR_CLEAR     (RC32334_REG_BASE + 0x05b8)
4142 +#define CPU2PCI_INTR_PEND  (RC32334_REG_BASE + 0x05c0)
4143 +#define CPU2PCI_INTR_MASK  (RC32334_REG_BASE + 0x05c4)
4144 +#define CPU2PCI_INTR_CLEAR (RC32334_REG_BASE + 0x05c8)
4145 +#define PCI2CPU_INTR_PEND  (RC32334_REG_BASE + 0x05d0)
4146 +#define PCI2CPU_INTR_MASK  (RC32334_REG_BASE + 0x05d4)
4147 +#define PCI2CPU_INTR_CLEAR (RC32334_REG_BASE + 0x05d8)
4148 +#define PCI_MEM1_BASE      (RC32334_REG_BASE + 0x20b0)
4149 +#define PCI_MEM2_BASE      (RC32334_REG_BASE + 0x20b8)
4150 +#define PCI_MEM3_BASE      (RC32334_REG_BASE + 0x20c0)
4151 +#define PCI_IO1_BASE       (RC32334_REG_BASE + 0x20c8)
4152 +#define PCI_ARBITRATION    (RC32334_REG_BASE + 0x20e0)
4153 +#define PCI_CPU_MEM1_BASE  (RC32334_REG_BASE + 0x20e8)
4154 +#define PCI_CPU_IO_BASE    (RC32334_REG_BASE + 0x2100)
4155 +#define PCI_CFG_CNTL      (RC32334_REG_BASE + 0x2cf8)
4156 +#define PCI_CFG_DATA      (RC32334_REG_BASE + 0x2cfc)
4157 +
4158 +/* Timers */
4159 +#define TIMER0_CNTL        (RC32334_REG_BASE + 0x0700)
4160 +#define TIMER0_COUNT       (RC32334_REG_BASE + 0x0704)
4161 +#define TIMER0_COMPARE     (RC32334_REG_BASE + 0x0708)
4162 +#define TIMER_REG_OFFSET   0x10
4163 +
4164 +/* Programmable I/O */
4165 +#define PIO_DATA0          (RC32334_REG_BASE + 0x0600)
4166 +#define PIO_DATA1          (RC32334_REG_BASE + 0x0610)
4167 +
4168 +/*
4169 + * DMA
4170 + *
4171 + * NOTE: DMA_IO is a trick for non linear RC32300_IO_DMA stuff
4172 + *
4173 + * DMA0: 18001400
4174 + * DMA1: 18001440
4175 + * DMA2: 18001900
4176 + * DMA3: 18001940
4177 + * NB: dma number must be immediate value or variable.
4178 + *      It MUST NOT be a function since it would get called twice!
4179 + */
4180 +#define DMA_IO(n)       (((n)>1?0x500:0)+((n)&1?0x40:0))
4181
4182 +#define RC32300_IO_DMA(n)       (RC32334_REG_BASE + 0x1400 + DMA_IO(n))
4183 +#define RC32300_DMA_CONFREG(n)  RC32300_IO_DMA(n)
4184 +#define RC32300_DMA_BASEREG(n)  (RC32300_IO_DMA(n)+0x4)
4185 +
4186 +#define RC32300_DMA_CURRREG(n)  (RC32300_IO_DMA(n)+0x8)
4187 +#define RC32300_DMA_STATREG(n)  (RC32300_IO_DMA(n)+0x10)
4188 +#define RC32300_DMA_SRCREG(n)   (RC32300_IO_DMA(n)+0x14)
4189 +#define RC32300_DMA_DSTREG(n)   (RC32300_IO_DMA(n)+0x18)
4190 +#define RC32300_DMA_NEXTREG(n)  (RC32300_IO_DMA(n)+0x1c)
4191 +
4192 +#define RC32300_DMA_IRQ(n)  (GROUP7_IRQ_BASE+5*(n))
4193 +
4194 +/* Expansion Interrupt Controller */
4195 +#define IC_GROUP0_PEND     (RC32334_REG_BASE + 0x0500)
4196 +#define IC_GROUP0_MASK     (RC32334_REG_BASE + 0x0504)
4197 +#define IC_GROUP0_CLEAR    (RC32334_REG_BASE + 0x0508)
4198 +#define IC_GROUP_OFFSET    0x10
4199 +
4200 +#define NUM_INTR_GROUPS    15
4201 +/*
4202 + * The IRQ mapping is as follows:
4203 + *
4204 + *    IRQ         Mapped To
4205 + *    ---     -------------------
4206 + *     0      SW0  (IP0) SW0 intr
4207 + *     1      SW1  (IP1) SW1 intr
4208 + *     2      Int0 (IP2) board-specific
4209 + *     3      Int1 (IP3) board-specific
4210 + *     4      Int2 (IP4) board-specific
4211 + *     -      Int3 (IP5) not used, mapped to IRQ's 8 and up
4212 + *     6      Int4 (IP6) board-specific
4213 + *     7      Int5 (IP7) CP0 Timer
4214 + *
4215 + * IRQ's 8 and up are all mapped to Int3 (IP5), which
4216 + * internally on the RC32334 is routed to the Expansion
4217 + * Interrupt Controller.
4218 + */
4219 +#define MIPS_CPU_TIMER_IRQ 7
4220 +
4221 +#define GROUP1_IRQ_BASE  8                       // bus error
4222 +#define GROUP2_IRQ_BASE  (GROUP1_IRQ_BASE + 1)   // PIO active low
4223 +#define GROUP3_IRQ_BASE  (GROUP2_IRQ_BASE + 12)  // PIO active high
4224 +#define GROUP4_IRQ_BASE  (GROUP3_IRQ_BASE + 8)   // Timer Rollovers
4225 +#define GROUP5_IRQ_BASE  (GROUP4_IRQ_BASE + 8)   // UART0
4226 +#define GROUP6_IRQ_BASE  (GROUP5_IRQ_BASE + 3)   // UART1
4227 +#define GROUP7_IRQ_BASE  (GROUP6_IRQ_BASE + 3)   // DMA Ch0
4228 +#define GROUP8_IRQ_BASE  (GROUP7_IRQ_BASE + 5)   // DMA Ch1
4229 +#define GROUP9_IRQ_BASE  (GROUP8_IRQ_BASE + 5)   // DMA Ch2
4230 +#define GROUP10_IRQ_BASE (GROUP9_IRQ_BASE + 5)   // DMA Ch3
4231 +#define GROUP11_IRQ_BASE (GROUP10_IRQ_BASE + 5)  // PCI Ctlr errors
4232 +#define GROUP12_IRQ_BASE (GROUP11_IRQ_BASE + 4)  // PCI Satellite Mode
4233 +#define GROUP13_IRQ_BASE (GROUP12_IRQ_BASE + 16) // PCI to CPU Mailbox
4234 +#define GROUP14_IRQ_BASE (GROUP13_IRQ_BASE + 4)  // SPI
4235 +
4236 +#define RC32334_NR_IRQS  (GROUP14_IRQ_BASE + 1)
4237 +
4238 +/* 16550 UARTs */
4239 +#ifdef __MIPSEB__
4240 +#define RC32300_UART0_BASE (RC32334_REG_BASE + 0x0803)
4241 +#define RC32300_UART1_BASE (RC32334_REG_BASE + 0x0823)
4242 +#else
4243 +#define RC32300_UART0_BASE (RC32334_REG_BASE + 0x0800)
4244 +#define RC32300_UART1_BASE (RC32334_REG_BASE + 0x0820)
4245 +#endif
4246 +
4247 +#define RC32300_UART0_IRQ  GROUP5_IRQ_BASE
4248 +#define RC32300_UART1_IRQ  GROUP6_IRQ_BASE
4249 +
4250 +#define IDT_CLOCK_MULT 2
4251 +
4252 +/* NVRAM */
4253 +#define NVRAM_BASE         0x12000000
4254 +#define NVRAM_ENVSIZE_OFF  4
4255 +#define NVRAM_ENVSTART_OFF 0x40
4256 +
4257 +/* LCD 4-digit display */
4258 +#define LCD_CLEAR          0x14000400
4259 +#define LCD_DIGIT0         0x1400000f
4260 +#define LCD_DIGIT1         0x14000008
4261 +#define LCD_DIGIT2         0x14000007
4262 +#define LCD_DIGIT3         0x14000003
4263 +
4264 +/* Interrupts routed on 79S334A board (see rc32334.h) */
4265 +#define RC32334_SCC8530_IRQ  2
4266 +#define RC32334_PCI_INTA_IRQ 3
4267 +#define RC32334_PCI_INTB_IRQ 4
4268 +#define RC32334_PCI_INTC_IRQ 6
4269 +#define RC32334_PCI_INTD_IRQ 7
4270 +
4271 +#define RAM_SIZE       (32*1024*1024)
4272 +
4273 +#endif // __IDT_RC32334_H__
4274 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32355_dma.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32355_dma.h
4275 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32355_dma.h      1970-01-01 01:00:00.000000000 +0100
4276 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32355_dma.h      2006-01-10 00:32:33.000000000 +0100
4277 @@ -0,0 +1,206 @@
4278 +/**************************************************************************
4279 + *
4280 + *  BRIEF MODULE DESCRIPTION
4281 + *     DMA controller defines on IDT RC32355
4282 + *
4283 + *  Copyright 2004 IDT Inc.
4284 + *  Author: Integrated Device Technology Inc. rischelp@idt.com
4285 + *
4286 + *         
4287 + *  This program is free software; you can redistribute  it and/or modify it
4288 + *  under  the terms of  the GNU General  Public License as published by the
4289 + *  Free Software Foundation;  either version 2 of the  License, or (at your
4290 + *  option) any later version.
4291 + *
4292 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
4293 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
4294 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
4295 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
4296 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4297 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
4298 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
4299 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
4300 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4301 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4302 + *
4303 + *  You should have received a copy of the  GNU General Public License along
4304 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
4305 + *  675 Mass Ave, Cambridge, MA 02139, USA.
4306 + *
4307 + *
4308 + *  May 2004 rkt
4309 + *  Initial Release
4310 + *
4311 + **************************************************************************
4312 + */
4313 +
4314 +#ifndef BANYAN_DMA_H
4315 +#define BANYAN_DMA_H
4316 +#include  <asm/idt-boards/rc32300/rc32300.h>
4317 +
4318 +/*
4319 + * An image of one RC32355 dma channel registers
4320 + */
4321 +typedef struct {
4322 +       u32 dmac;
4323 +       u32 dmas;
4324 +       u32 dmasm;
4325 +       u32 dmadptr;
4326 +       u32 dmandptr;
4327 +} rc32355_dma_ch_t;
4328 +
4329 +/*
4330 + * An image of all RC32355 dma channel registers
4331 + */
4332 +typedef struct {
4333 +       rc32355_dma_ch_t ch[16];
4334 +} rc32355_dma_regs_t;
4335 +
4336 +
4337 +#define rc32355_dma_regs ((rc32355_dma_regs_t*)KSEG1ADDR(RC32355_DMA_BASE))
4338 +
4339 +
4340 +/* DMAC register layout */
4341 +
4342 +#define DMAC_RUN       0x1     /* Halts processing when cleared        */
4343 +#define DMAC_DM                0x2     /* Done Mask, ignore DMA events         */
4344 +#define DMAC_MODE_MASK 0xC     /* DMA operating mode                   */
4345 +
4346 +#define DMAC_MODE_AUTO 0x0     /* DMA Auto Request Mode                */
4347 +#define DMAC_MODE_BURST        0x4     /* DMA Burst Request Mode               */
4348 +#define DMAC_MODE_TFER 0x8     /* DMA Transfer Request Mode            */
4349 +
4350 +/* DMAS and DMASM register layout */
4351 +
4352 +#define DMAS_F         0x01    /* Finished */
4353 +#define DMAS_D         0x02    /* Done */
4354 +#define DMAS_C         0x04    /* Chain */
4355 +#define DMAS_E         0x08    /* Error */
4356 +#define DMAS_H         0x10    /* Halt */
4357 +
4358 +/* Polling count for DMAS_H bit in DMAS register after halting DMA */
4359 +#define DMA_HALT_TIMEOUT 500
4360 +
4361 +
4362 +static inline int rc32355_halt_dma(rc32355_dma_ch_t* ch)
4363 +{
4364 +       int timeout=1;
4365 +       
4366 +       if (local_readl(&ch->dmac) & DMAC_RUN) {
4367 +               local_writel(0, &ch->dmac); 
4368 +               for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
4369 +                       if (local_readl(&ch->dmas) & DMAS_H) {
4370 +                               local_writel(0, &ch->dmas);  
4371 +                               break;
4372 +                       }
4373 +               }
4374 +       }
4375 +
4376 +       return timeout ? 0 : 1;
4377 +}
4378 +
4379 +static inline void rc32355_start_dma(rc32355_dma_ch_t* ch, u32 dma_addr)
4380 +{
4381 +       local_writel(0, &ch->dmandptr); 
4382 +       local_writel(dma_addr, &ch->dmadptr);
4383 +}
4384 +
4385 +static inline void rc32355_chain_dma(rc32355_dma_ch_t* ch, u32 dma_addr)
4386 +{
4387 +       local_writel(dma_addr, &ch->dmandptr);
4388 +}
4389 +
4390 +
4391 +/* The following can be used to describe DMA channels 0 to 15, and the */
4392 +/* sub device's needed to select them in the DMADESC_DS_MASK field     */
4393 +
4394 +#define DMA_CHAN_ATM01         0            /* ATM interface 0,1 chan  */
4395 +
4396 +#define DMA_CHAN_ATM0IN                0            /* ATM interface 0 input   */
4397 +#define DMA_DEV_ATM0IN         0            /* ATM interface 0 input   */
4398 +
4399 +#define DMA_CHAN_ATM1IN                0            /* ATM interface 1 input   */
4400 +#define DMA_DEV_ATM1IN         1            /* ATM interface 1 input   */
4401 +
4402 +#define DMA_CHAN_ATM0OUT       0            /* ATM interface 0 output  */
4403 +#define DMA_DEV_ATM0OUT                2            /* ATM interface 0 output  */
4404 +
4405 +#define DMA_CHAN_ATM1OUT       0            /* ATM interface 1 output  */
4406 +#define DMA_DEV_ATM1OUT                3            /* ATM interface 1 output  */
4407 +
4408 +/* for entry in {0,1,2,3,4,5,6,7} - note 5,6,7 share with those below */
4409 +#define DMA_CHAN_ATMVCC(entry) ((entry)+1)  /* ATM VC cache entry      */
4410 +#define DMA_DEV_ATMVCC(entry)  0
4411 +
4412 +#define DMA_CHAN_MEMTOMEM      6            /* Memory to memory DMA    */
4413 +#define DMA_DEV_MEMTOMEM       1            /* Memory to memory DMA    */
4414 +
4415 +#define DMA_CHAN_ATMFMB0       7            /* ATM Frame Mode Buffer 0 */
4416 +#define DMA_DEV_ATMFMB0                1            /* ATM Frame Mode Buffer 0 */
4417 +
4418 +#define DMA_CHAN_ATMFMB1       8            /* ATM Frame Mode Buffer 1 */
4419 +#define DMA_DEV_ATMFMB1                1            /* ATM Frame Mode Buffer 1 */
4420 +
4421 +#define DMA_CHAN_ETHERIN       9            /* Ethernet input          */
4422 +#define DMA_DEV_ETHERIN                0            /* Ethernet input          */
4423 +
4424 +#define DMA_CHAN_ETHEROUT      10           /* Ethernet output         */
4425 +#define DMA_DEV_ETHEROUT       0            /* Ethernet output         */
4426 +
4427 +#define DMA_CHAN_TDMIN         11           /* TDM Bus input           */
4428 +#define DMA_DEV_TDMIN          0            /* TDM Bus input           */
4429 +
4430 +#define DMA_CHAN_TDMOUT                12           /* TDM Bus output          */
4431 +#define DMA_DEV_TDMOUT         0            /* TDM Bus output          */
4432 +
4433 +#define DMA_CHAN_USBIN         13           /* USB input               */
4434 +#define DMA_DEV_USBIN          0            /* USB input               */
4435 +
4436 +#define DMA_CHAN_USBOUT                14           /* USB output              */
4437 +#define DMA_DEV_USBOUT         0            /* USB output              */
4438 +
4439 +#define DMA_CHAN_EXTERN                15           /* External DMA            */
4440 +#define DMA_DEV_EXTERN         0            /* External DMA            */
4441 +
4442 +/*
4443 + * An RC32355 dma descriptor in system memory
4444 + */
4445 +typedef struct {
4446 +       u32 cmdstat;    /* control and status */
4447 +       u32 curr_addr;  /* current address of data */
4448 +       u32 devcs;      /* peripheral-specific control and status */
4449 +       u32 link;       /* link to next descriptor */
4450 +} rc32355_dma_desc_t;
4451 +
4452 +/* Values for the descriptor cmdstat word */
4453 +
4454 +#define DMADESC_F              0x80000000u  /* Finished bit            */
4455 +#define DMADESC_D              0x40000000u  /* Done bit                */
4456 +#define DMADESC_T              0x20000000u  /* Terminated bit          */
4457 +#define DMADESC_IOD            0x10000000u  /* Interrupt On Done       */
4458 +#define DMADESC_IOF            0x08000000u  /* Interrupt On Finished   */
4459 +#define DMADESC_COD            0x04000000u  /* Chain On Done           */
4460 +#define DMADESC_COF            0x02000000u  /* Chain On Finished       */
4461 +
4462 +#define DMADESC_DEVCMD_MASK    0x01C00000u  /* Device Command mask     */
4463 +#define DMADESC_DEVCMD_SHIFT   22           /* Device Command shift    */
4464 +
4465 +#define DMADESC_DS_MASK                0x00300000u  /* Device Select mask      */
4466 +#define DMADESC_DS_SHIFT       20           /* Device Select shift     */
4467 +
4468 +#define DMADESC_COUNT_MASK     0x0003FFFFu  /* Byte Count mask         */
4469 +#define DMADESC_COUNT_SHIFT    0            /* Byte Count shift        */
4470 +
4471 +#define IS_DMA_FINISHED(X)   ( ( (X) & DMADESC_F ) >> 31)   /* F Bit    */
4472 +#define IS_DMA_DONE(X)       ( ( (X) & DMADESC_D ) >> 30)   /* D Bit    */
4473 +#define IS_DMA_TERMINATED(X) ( ( (X) & DMADESC_T ) >> 29)   /* T Bit    */
4474 +#define IS_DMA_USED(X) (((X) & (DMADESC_F | DMADESC_D | DMADESC_T)) != 0)
4475 +
4476 +#define DMA_DEVCMD(devcmd) \
4477 +  (((devcmd) << DMADESC_DEVCMD_SHIFT) & DMADESC_DS_MASK)
4478 +#define DMA_DS(ds)         \
4479 +  (((ds) << DMADESC_DS_SHIFT) & DMADESC_DS_MASK)
4480 +#define DMA_COUNT(count)   \
4481 +  ((count) & DMADESC_COUNT_MASK)
4482 +
4483 +#endif /* RC32355_DMA_H */
4484 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32355_eth.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32355_eth.h
4485 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32355_eth.h      1970-01-01 01:00:00.000000000 +0100
4486 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32355_eth.h      2006-01-10 00:32:33.000000000 +0100
4487 @@ -0,0 +1,442 @@
4488 +/**************************************************************************
4489 + *
4490 + *  BRIEF MODULE DESCRIPTION
4491 + *     Ethernet registers on IDT RC32355
4492 + *
4493 + *  Copyright 2004 IDT Inc.
4494 + *  Author: Integrated Device Technology Inc. rischelp@idt.com
4495 + *
4496 + *         
4497 + *  This program is free software; you can redistribute  it and/or modify it
4498 + *  under  the terms of  the GNU General  Public License as published by the
4499 + *  Free Software Foundation;  either version 2 of the  License, or (at your
4500 + *  option) any later version.
4501 + *
4502 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
4503 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
4504 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
4505 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
4506 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4507 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
4508 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
4509 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
4510 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4511 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4512 + *
4513 + *  You should have received a copy of the  GNU General Public License along
4514 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
4515 + *  675 Mass Ave, Cambridge, MA 02139, USA.
4516 + *
4517 + *
4518 + *  May 2004 rkt
4519 + *  Initial Release
4520 + *
4521 + **************************************************************************
4522 + */
4523 +
4524 +
4525 +#ifndef RC32355_ETHER_H
4526 +#define RC32355_ETHER_H
4527 +
4528 +#include <asm/idt-boards/rc32300/rc32355_dma.h>
4529 +
4530 +/*
4531 + * A partial image of the RC32355 ethernet registers
4532 + */
4533 +typedef struct {
4534 +       u32 ethintfc;
4535 +       u32 ethfifott;
4536 +       u32 etharc;
4537 +       u32 ethhash0;
4538 +       u32 ethhash1;
4539 +       u32 ethfifost;
4540 +       u32 ethfifos;
4541 +       u32 ethodeops;
4542 +       u32 ethis;
4543 +       u32 ethos;
4544 +       u32 ethmcp;
4545 +       u32 _u1;
4546 +       u32 ethid;
4547 +       u32 _u2;
4548 +       u32 _u3;
4549 +       u32 _u4;
4550 +       u32 ethod;
4551 +       u32 _u5;
4552 +       u32 _u6;
4553 +       u32 _u7;
4554 +       u32 ethodeop;
4555 +       u32 _u8[43]; 
4556 +       u32 ethsal0;
4557 +       u32 ethsah0;
4558 +       u32 ethsal1;
4559 +       u32 ethsah1;
4560 +       u32 ethsal2;
4561 +       u32 ethsah2;
4562 +       u32 ethsal3;
4563 +       u32 ethsah3;
4564 +       u32 ethrbc;
4565 +       u32 ethrpc;
4566 +       u32 ethrupc;
4567 +       u32 ethrfc;
4568 +       u32 ethtbc;
4569 +       u32 ethgpf;
4570 +       u32 _u9[50];
4571 +       u32 ethmac1;
4572 +       u32 ethmac2;
4573 +       u32 ethipgt;
4574 +       u32 ethipgr;
4575 +       u32 ethclrt;
4576 +       u32 ethmaxf;
4577 +       u32 _u10;
4578 +       u32 ethmtest;
4579 +       u32 miimcfg;
4580 +       u32 miimcmd;
4581 +       u32 miimaddr;
4582 +       u32 miimwtd;
4583 +       u32 miimrdd;
4584 +       u32 miimind;
4585 +       u32 _u11;
4586 +       u32 _u12;
4587 +       u32 ethcfsa0;
4588 +       u32 ethcfsa1;
4589 +       u32 ethcfsa2;
4590 +} rc32355_eth_regs_t;
4591
4592 +#define rc32355_eth_regs ((rc32355_eth_regs_t*)KSEG1ADDR(RC32355_ETH_BASE))
4593 +
4594 +#define ETH_INTFC   (RC32355_ETH_BASE + 0x000) /* INTerFace Control  */
4595 +#define ETH_FIFOTT  (RC32355_ETH_BASE + 0x004) /* FIFO Transmit Threshold  */
4596 +#define ETH_ARC     (RC32355_ETH_BASE + 0x008) /* Address Recognition Ctrl  */
4597 +#define ETH_HASH0   (RC32355_ETH_BASE + 0x00C) /* 32 multicast Hash bits */
4598 +#define ETH_HASH1   (RC32355_ETH_BASE + 0x010) /* another 32 Hash bits */
4599 +#define ETH_FIFOST  (RC32355_ETH_BASE + 0x014) /* FIFO Status Threshold */
4600 +#define ETH_FIFOS   (RC32355_ETH_BASE + 0x018) /* FIFO Status Register */
4601 +#define ETH_ODEOPS  (RC32355_ETH_BASE + 0x01C) /* Out Data End-Of-Pkt Size */
4602 +#define ETH_IS      (RC32355_ETH_BASE + 0x020) /* Input Status */
4603 +#define ETH_OS      (RC32355_ETH_BASE + 0x024) /* Output Status  */
4604 +#define ETH_MCP     (RC32355_ETH_BASE + 0x028) /* Managemt Clock Prescaler */
4605 +#define ETH_ID      (RC32355_ETH_BASE + 0x030) /* Input Data register */
4606 +#define ETH_OD      (RC32355_ETH_BASE + 0x040) /* Output Data register */
4607 +#define ETH_ODEOP   (RC32355_ETH_BASE + 0x050) /* OD End-Of-Packet Size */
4608 +
4609 +/* for n in { 0, 1, 2, 3 } */
4610 +#define ETH_SAL(n)  (RC32355_ETH_BASE + 0x100 + (n * 8)) /* Stn Address 2-5 */
4611 +#define ETH_SAH(n)  (RC32355_ETH_BASE + 0x104 + (n * 8)) /* Stn Address 0-1 */
4612 +
4613 +#define ETH_RBC     (RC32355_ETH_BASE + 0x120) /* Receive Byte Count */
4614 +#define ETH_RPC     (RC32355_ETH_BASE + 0x124) /* Receive Packet Count */
4615 +#define ETH_RUPC    (RC32355_ETH_BASE + 0x128) /* Rx Undersized Pkt count */
4616 +#define ETH_RFC     (RC32355_ETH_BASE + 0x12C) /* Receive Fragment Count */
4617 +#define ETH_TBC     (RC32355_ETH_BASE + 0x130) /* Transmit Byte Count */
4618 +#define ETH_GPF     (RC32355_ETH_BASE + 0x134) /* Generate Pause Frame */
4619 +#define ETH_MAC1    (RC32355_ETH_BASE + 0x200) /* Medium Access Control 1 */
4620 +#define ETH_MAC2    (RC32355_ETH_BASE + 0x204) /* Medium Access Control 2 */
4621 +#define ETH_IPGT    (RC32355_ETH_BASE + 0x208) /* Back-to-back InterPkt Gap */
4622 +#define ETH_IPGR    (RC32355_ETH_BASE + 0x20C) /* Non " InterPkt Gap */
4623 +#define ETH_CLRT    (RC32355_ETH_BASE + 0x210) /* Collis'n Window and Retry */
4624 +#define ETH_MAXF    (RC32355_ETH_BASE + 0x214) /* Maximum Frame Length */
4625 +#define ETH_MTEST   (RC32355_ETH_BASE + 0x21C) /* MAC Test */
4626 +
4627 +#define ETHMIIM_CFG (RC32355_ETH_BASE + 0x220) /* MII Mgmt Configuration */
4628 +#define ETHMIIM_CMD (RC32355_ETH_BASE + 0x224) /* MII Mgmt Command  */
4629 +#define ETHMIIM_ADDR (RC32355_ETH_BASE + 0x228) /* MII Mgmt Address */
4630 +#define ETHMIIM_WTD (RC32355_ETH_BASE + 0x22C) /* MII Mgmt Write Data */
4631 +#define ETHMIIM_RDD (RC32355_ETH_BASE + 0x230) /* MII Mgmt Read Data */
4632 +#define ETHMIIM_IND (RC32355_ETH_BASE + 0x234) /* MII Mgmt Indicators */
4633 +
4634 +/* for n in { 0, 1, 2 } */
4635 +#define ETH_CFSA(n) (RC32355_ETH_BASE + 0x240 + ((n) * 4))  /* Station Addr */
4636 +
4637 +
4638 +/*
4639 + * Register Interpretations follow
4640 + */
4641 +
4642 +/******************************************************************************
4643 + * ETHINTFC register
4644 + *****************************************************************************/
4645 +
4646 +#define ETHERINTFC_EN            (1<<0)
4647 +#define ETHERINTFC_ITS           (1<<1)
4648 +#define ETHERINTFC_RES           (1<<2)
4649 +#define ETHERINTFC_RIP           (1<<2)
4650 +#define ETHERINTFC_JAM           (1<<3)
4651 +
4652 +/******************************************************************************
4653 + * ETHFIFOTT register
4654 + *****************************************************************************/
4655 +
4656 +#define ETHERFIFOTT_TTH(v)      (((v)&0x3f)<<0)
4657 +
4658 +/******************************************************************************
4659 + * ETHARC register
4660 + *****************************************************************************/
4661 +
4662 +#define ETHERARC_PRO             (1<<0)
4663 +#define ETHERARC_AM              (1<<1)
4664 +#define ETHERARC_AFM             (1<<2)
4665 +#define ETHERARC_AB              (1<<3)
4666 +
4667 +/******************************************************************************
4668 + * ETHHASH registers
4669 + *****************************************************************************/
4670 +
4671 +#define ETHERHASH0(v)            (((v)&0xffff)<<0)
4672 +#define ETHERHASH1(v)            (((v)&0xffff)<<0)
4673 +
4674 +/******************************************************************************
4675 + * ETHSA registers
4676 + *****************************************************************************/
4677 +
4678 +#define ETHERSAL0(v)             (((v)&0xffff)<<0)
4679 +#define ETHERSAL1(v)             (((v)&0xffff)<<0)
4680 +#define ETHERSAL2(v)             (((v)&0xffff)<<0)
4681 +#define ETHERSAL3(v)             (((v)&0xffff)<<0)
4682 +#define ETHERSAH0(v)             (((v)&0xff)<<0)
4683 +#define ETHERSAH1(v)             (((v)&0xff)<<0)
4684 +#define ETHERSAH2(v)             (((v)&0xff)<<0)
4685 +#define ETHERSAH3(v)             (((v)&0xff)<<0)
4686 +
4687 +/******************************************************************************
4688 + * ETHFIFOST register
4689 + *****************************************************************************/
4690 +
4691 +#define ETHERFIFOST_IRTH(v)      (((v)&0x3f)<<0)
4692 +#define ETHERFIFOST_ORTH(v)      (((v)&0x3f)<<16)
4693 +
4694 +/******************************************************************************
4695 + * ETHFIFOS register
4696 + *****************************************************************************/
4697 +
4698 +#define ETHERFIFOS_IR            (1<<0)
4699 +#define ETHERFIFOS_OR            (1<<1)  
4700 +#define ETHERFIFOS_OVR           (1<<2)  
4701 +#define ETHERFIFOS_UND           (1<<3)  
4702 +
4703 +/******************************************************************************
4704 + * DATA registers
4705 + *****************************************************************************/
4706 +
4707 +#define ETHERID(v)               (((v)&0xffff)<<0)
4708 +#define ETHEROD(v)               (((v)&0xffff)<<0)
4709 +
4710 +/******************************************************************************
4711 + * ETHODEOPS register
4712 + *****************************************************************************/
4713 +
4714 +#define ETHERODEOPS_SIZE(v)      (((v)&0x3)<<0)
4715 +
4716 +/******************************************************************************
4717 + * ETHODEOP register
4718 + *****************************************************************************/
4719 +
4720 +#define ETHERODEOP(v)            (((v)&0xffff)<<0)
4721 +
4722 +/******************************************************************************
4723 + * ETHIS register
4724 + *****************************************************************************/
4725 +
4726 +#define ETHERIS_EOP              (1<<0)  
4727 +#define ETHERIS_ROK              (1<<2)  
4728 +#define ETHERIS_FM               (1<<3)  
4729 +#define ETHERIS_MP               (1<<4)  
4730 +#define ETHERIS_BP               (1<<5)  
4731 +#define ETHERIS_VLT              (1<<6)  
4732 +#define ETHERIS_CF               (1<<7)  
4733 +#define ETHERIS_OVR              (1<<8)  
4734 +#define ETHERIS_CRC              (1<<9)  
4735 +#define ETHERIS_CV               (1<<10)  
4736 +#define ETHERIS_DB               (1<<11)  
4737 +#define ETHERIS_LE               (1<<12)  
4738 +#define ETHERIS_LOR              (1<<13)  
4739 +#define ETHERIS_SIZE(v)          (((v)&0x3)<<14)
4740 +#define ETHERIS_LENGTH(v)        (((v)&0xff)<<16)
4741 +
4742 +/******************************************************************************
4743 + * ETHOS register
4744 + *****************************************************************************/
4745 +
4746 +#define ETHEROS_T                (1<<0)  
4747 +#define ETHEROS_TOK              (1<<6)  
4748 +#define ETHEROS_MP               (1<<7)  
4749 +#define ETHEROS_BP               (1<<8)  
4750 +#define ETHEROS_UND              (1<<9)  
4751 +#define ETHEROS_OF               (1<<10)  
4752 +#define ETHEROS_ED               (1<<11)  
4753 +#define ETHEROS_EC               (1<<12)  
4754 +#define ETHEROS_LC               (1<<13)  
4755 +#define ETHEROS_TD               (1<<14)  
4756 +#define ETHEROS_CRC              (1<<15)  
4757 +#define ETHEROS_LE               (1<<16)  
4758 +#define ETHEROS_CC(v)            (((v)&0xf)<<17)
4759 +#define ETHEROS_PFD              (1<<21)  
4760 +
4761 +/******************************************************************************
4762 + * Statistics registers
4763 + *****************************************************************************/
4764 +
4765 +#define ETHERRBC(v)              (((v)&0xffff)<<0)
4766 +#define ETHERRPC(v)              (((v)&0xffff)<<0)
4767 +#define ETHERRUPC(v)             (((v)&0xffff)<<0)
4768 +#define ETHERRFC(v)              (((v)&0xffff)<<0)
4769 +#define ETHERTBC(v)              (((v)&0xffff)<<0)
4770 +
4771 +/******************************************************************************
4772 + * ETHGPF register
4773 + *****************************************************************************/
4774 +
4775 +#define ETHERGPF_PTV(v)          (((v)&0xff)<<0)
4776 +
4777 +/******************************************************************************
4778 + * MAC registers
4779 + *****************************************************************************/
4780 +//ETHMAC1
4781 +#define ETHERMAC1_RE             (1<<0)
4782 +#define ETHERMAC1_PAF            (1<<1)
4783 +#define ETHERMAC1_RFC            (1<<2)
4784 +#define ETHERMAC1_TFC            (1<<3)
4785 +#define ETHERMAC1_LB             (1<<4)
4786 +#define ETHERMAC1_MR             (1<<15)
4787 +
4788 +//ETHMAC2
4789 +#define ETHERMAC2_FD             (1<<0)
4790 +#define ETHERMAC2_FLC            (1<<1)
4791 +#define ETHERMAC2_HFE            (1<<2)
4792 +#define ETHERMAC2_DC             (1<<3)
4793 +#define ETHERMAC2_CEN            (1<<4)
4794 +#define ETHERMAC2_PE             (1<<5)
4795 +#define ETHERMAC2_VPE            (1<<6)
4796 +#define ETHERMAC2_APE            (1<<7)
4797 +#define ETHERMAC2_PPE            (1<<8)
4798 +#define ETHERMAC2_LPE            (1<<9)
4799 +#define ETHERMAC2_NB             (1<<12)
4800 +#define ETHERMAC2_BP             (1<<13)
4801 +#define ETHERMAC2_ED             (1<<14)
4802 +
4803 +//ETHIPGT
4804 +#define ETHERIPGT(v)             (((v)&0x3f)<<0)
4805 +
4806 +//ETHIPGR
4807 +#define ETHERIPGR_IPGR1(v)       (((v)&0x3f)<<0)
4808 +#define ETHERIPGR_IPGR2(v)       (((v)&0x3f)<<8)
4809 +
4810 +//ETHCLRT
4811 +#define ETHERCLRT_MAXRET(v)      (((v)&0x3f)<<0)
4812 +#define ETHERCLRT_COLWIN(v)      (((v)&0x3f)<<8)
4813 +
4814 +//ETHMAXF
4815 +#define ETHERMAXF(v)             (((v)&0x3f)<<0)
4816 +
4817 +//ETHMTEST
4818 +#define ETHERMTEST_TB            (1<<2)
4819 +
4820 +//ETHMCP
4821 +#define ETHERMCP_DIV(v)          (((v)&0xff)<<0)
4822 +
4823 +//MIIMCFG
4824 +#define ETHERMIIMCFG_CS(v)          (((v)&0x3)<<2)
4825 +#define ETHERMIIMCFG_R              (1<<15)
4826 +
4827 +//MIIMCMD
4828 +#define ETHERMIIMCMD_RD             (1<<0)
4829 +#define ETHERMIIMCMD_SCN            (1<<1)
4830 +
4831 +//MIIMADDR
4832 +#define ETHERMIIMADDR_REGADDR(v)    (((v)&0x1f)<<0)
4833 +#define ETHERMIIMADDR_PHYADDR(v)    (((v)&0x1f)<<8)
4834 +
4835 +//MIIMWTD
4836 +#define ETHERMIIMWTD(v)             (((v)&0xff)<<0)
4837 +
4838 +//MIIMRDD
4839 +#define ETHERMIIMRDD(v)             (((v)&0xff)<<0)
4840 +
4841 +//MIIMIND
4842 +#define ETHERMIIMIND_BSY            (1<<0)
4843 +#define ETHERMIIMIND_SCN            (1<<1)
4844 +#define ETHERMIIMIND_NV             (1<<2)
4845 +
4846 +//DMA DEVCS IN
4847 +#define ETHERDMA_IN_LENGTH(v)  (((v)&0xffff)<<16)
4848 +#define ETHERDMA_IN_CES                (1<<14)
4849 +#define ETHERDMA_IN_LOR                (1<<13)
4850 +#define ETHERDMA_IN_LE         (1<<12)
4851 +#define ETHERDMA_IN_DB         (1<<11)
4852 +#define ETHERDMA_IN_CV         (1<<10)
4853 +#define ETHERDMA_IN_CRC                (1<<9)
4854 +#define ETHERDMA_IN_OVR                (1<<8)
4855 +#define ETHERDMA_IN_CF         (1<<7)
4856 +#define ETHERDMA_IN_VLT                (1<<6)
4857 +#define ETHERDMA_IN_BP         (1<<5)
4858 +#define ETHERDMA_IN_MP         (1<<4)
4859 +#define ETHERDMA_IN_FM         (1<<3)
4860 +#define ETHERDMA_IN_ROK                (1<<2)
4861 +#define ETHERDMA_IN_LD         (1<<1)
4862 +#define ETHERDMA_IN_FD         (1<<0)
4863 +
4864 +//DMA DEVCS OUT
4865 +#define ETHERDMA_OUT_CC(v)     (((v)&0xf)<<17)
4866 +#define ETHERDMA_OUT_CNT         0x001e0000
4867 +#define ETHERDMA_OUT_SHFT       17
4868 +#define ETHERDMA_OUT_LE                (1<<16)
4869 +
4870 +#define ETHERDMA_OUT_CRC       (1<<15)
4871 +#define ETHERDMA_OUT_TD                (1<<14)
4872 +#define ETHERDMA_OUT_LC                (1<<13)
4873 +#define ETHERDMA_OUT_EC                (1<<12)
4874 +#define ETHERDMA_OUT_ED                (1<<11)
4875 +#define ETHERDMA_OUT_OF                (1<<10)
4876 +#define ETHERDMA_OUT_UND       (1<<9)
4877 +#define ETHERDMA_OUT_BP                (1<<8)
4878 +#define ETHERDMA_OUT_MP                (1<<7)
4879 +#define ETHERDMA_OUT_TOK       (1<<6)
4880 +#define ETHERDMA_OUT_HEN       (1<<5)
4881 +#define ETHERDMA_OUT_CEN       (1<<4)
4882 +#define ETHERDMA_OUT_PEN       (1<<3)
4883 +#define ETHERDMA_OUT_OEN       (1<<2)
4884 +#define ETHERDMA_OUT_LD                (1<<1)
4885 +#define ETHERDMA_OUT_FD                (1<<0)
4886 +
4887 +#define RCV_ERRS \
4888 +  (ETHERDMA_IN_OVR | ETHERDMA_IN_CRC | ETHERDMA_IN_CV | ETHERDMA_IN_LE)
4889 +#define TX_ERRS  \
4890 +  (ETHERDMA_OUT_LC | ETHERDMA_OUT_EC | ETHERDMA_OUT_ED | \
4891 +   ETHERDMA_OUT_OF | ETHERDMA_OUT_UND)
4892 +
4893 +#define IS_RCV_ROK(X)        (((X) & (1<<2)) >> 2)       /* Receive Okay     */
4894 +#define IS_RCV_FM(X)         (((X) & (1<<3)) >> 3)       /* Is Filter Match  */
4895 +#define IS_RCV_MP(X)         (((X) & (1<<4)) >> 4)       /* Is it MP         */
4896 +#define IS_RCV_BP(X)         (((X) & (1<<5)) >> 5)       /* Is it BP         */
4897 +#define IS_RCV_VLT(X)        (((X) & (1<<6)) >> 6)       /* VLAN Tag Detect  */
4898 +#define IS_RCV_CF(X)         (((X) & (1<<7)) >> 7)       /* Control Frame    */
4899 +#define IS_RCV_OVR_ERR(X)    (((X) & (1<<8)) >> 8)       /* Receive Overflow */
4900 +#define IS_RCV_CRC_ERR(X)    (((X) & (1<<9)) >> 9)       /* CRC Error        */
4901 +#define IS_RCV_CV_ERR(X)     (((X) & (1<<10))>>10)       /* Code Violation   */
4902 +#define IS_RCV_DB_ERR(X)     (((X) & (1<<11))>>11)       /* Dribble Bits     */
4903 +#define IS_RCV_LE_ERR(X)     (((X) & (1<<12))>>12)       /* Length error     */
4904 +#define IS_RCV_LOR_ERR(X)    (((X) & (1<<13))>>13)       /* Length Out of
4905 +                                                            Range            */
4906 +#define IS_RCV_CES_ERR(X)    (((X) & (1<<14))>>14)       /* Preamble error   */
4907 +#define RCVPKT_LENGTH(X)     (((X) & 0xFFFF0000)>>16)    /* Length of the
4908 +                                                            received packet  */
4909 +
4910 +#define IS_TX_TOK(X)         (((X) & (1<<6) ) >> 6 )     /* Transmit Okay    */
4911 +#define IS_TX_MP(X)          (((X) & (1<<7) ) >> 7 )     /* Multicast        */
4912 +
4913 +#define IS_TX_BP(X)          (((X) & (1<<8) ) >> 8 )     /* Broadcast        */
4914 +#define IS_TX_UND_ERR(X)     (((X) & (1<<9) ) >> 9 )     /* Transmit FIFO
4915 +                                                            Underflow        */
4916 +#define IS_TX_OF_ERR(X)      (((X) & (1<<10)) >>10 )     /* Oversized frame  */
4917 +#define IS_TX_ED_ERR(X)      (((X) & (1<<11)) >>11 )     /* Excessive
4918 +                                                           deferral        */
4919 +#define IS_TX_EC_ERR(X)      (((X) & (1<<12)) >>12 )     /* Excessive
4920 +                                                           collisions      */
4921 +#define IS_TX_LC_ERR(X)      (((X) & (1<<13)) >>13 )     /* Late Collision   */
4922 +#define IS_TX_TD_ERR(X)      (((X) & (1<<14)) >>14 )     /* Transmit deferred*/
4923 +#define IS_TX_CRC_ERR(X)     (((X) & (1<<15)) >>15 )     /* CRC Error        */
4924 +#define IS_TX_LE_ERR(X)      (((X) & (1<<16)) >>16 )     /* Length Error     */
4925 +
4926 +#define TX_COLLISION_COUNT(X) (((X) & 0x001E0000u)>>17)  /* Collision Count  */
4927 +
4928 +#endif /* RC32355_ETHER_H */
4929 +
4930 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32355.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32355.h
4931 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32355.h  1970-01-01 01:00:00.000000000 +0100
4932 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32355.h  2006-01-10 00:32:33.000000000 +0100
4933 @@ -0,0 +1,177 @@
4934 +/**************************************************************************
4935 + *
4936 + *  BRIEF MODULE DESCRIPTION
4937 + *     Definitions for IDT RC32355 CPU.
4938 + *
4939 + *  Copyright 2004 IDT Inc.
4940 + *  Author: Integrated Device Technology Inc. rischelp@idt.com
4941 + *
4942 + *         
4943 + *  This program is free software; you can redistribute  it and/or modify it
4944 + *  under  the terms of  the GNU General  Public License as published by the
4945 + *  Free Software Foundation;  either version 2 of the  License, or (at your
4946 + *  option) any later version.
4947 + *
4948 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
4949 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
4950 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
4951 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
4952 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4953 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
4954 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
4955 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
4956 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
4957 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4958 + *
4959 + *  You should have received a copy of the  GNU General Public License along
4960 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
4961 + *  675 Mass Ave, Cambridge, MA 02139, USA.
4962 + *
4963 + *
4964 + *  May 2004 rkt
4965 + *  Initial Release
4966 + *
4967 + **************************************************************************
4968 + */
4969 +
4970 +
4971 +#ifndef _RC32355_H_
4972 +#define _RC32355_H_
4973 +
4974 +#include <linux/delay.h>
4975 +#include <asm/io.h>
4976 +
4977 +/* Base address of internal registers */
4978 +#define RC32355_REG_BASE   0x18000000
4979 +
4980 +/* System ID Registers */
4981 +#define CPU_SYSID          (RC32355_REG_BASE + 0x00018)
4982 +#define CPU_BTADDR         (RC32355_REG_BASE + 0x0001c)
4983 +#define CPU_REV            (RC32355_REG_BASE + 0x0002c)
4984 +
4985 +/* Reset Controller */
4986 +#define RESET_CNTL         (RC32355_REG_BASE + 0x08000)
4987 +
4988 +/* Device Controller */
4989 +#define DEV0_BASE          (RC32355_REG_BASE + 0x10000)
4990 +#define DEV0_MASK          (RC32355_REG_BASE + 0x10004)
4991 +#define DEV0_CNTL          (RC32355_REG_BASE + 0x10008)
4992 +#define DEV0_TIMING        (RC32355_REG_BASE + 0x1000c)
4993 +#define DEV_REG_OFFSET     0x10
4994 +
4995 +/* SDRAM Controller */
4996 +#define SDRAM0_BASE        (RC32355_REG_BASE + 0x18000)
4997 +#define SDRAM0_MASK        (RC32355_REG_BASE + 0x18004)
4998 +#define SDRAM1_BASE        (RC32355_REG_BASE + 0x18008)
4999 +#define SDRAM1_MASK        (RC32355_REG_BASE + 0x1800c)
5000 +#define SDRAM_CNTL         (RC32355_REG_BASE + 0x18010)
5001 +
5002 +/* Bus Arbiter */
5003 +#define BUS_ARB_CNTL0      (RC32355_REG_BASE + 0x20000)
5004 +#define BUS_ARB_CNTL1      (RC32355_REG_BASE + 0x20004)
5005 +
5006 +/* Counters/Timers */
5007 +#define TIMER0_COUNT       (RC32355_REG_BASE + 0x28000)
5008 +#define TIMER0_COMPARE     (RC32355_REG_BASE + 0x28004)
5009 +#define TIMER0_CNTL        (RC32355_REG_BASE + 0x28008)
5010 +#define TIMER_REG_OFFSET   0x0C
5011 +
5012 +/* System Integrity */
5013 +
5014 +/* Interrupt Controller */
5015 +#define IC_GROUP0_PEND     (RC32355_REG_BASE + 0x30000)
5016 +#define IC_GROUP0_MASK     (RC32355_REG_BASE + 0x30004)
5017 +#define IC_GROUP_OFFSET    0x08
5018 +
5019 +#define NUM_INTR_GROUPS    5
5020 +/*
5021 + * The IRQ mapping is as follows:
5022 + *
5023 + *    IRQ         Mapped To
5024 + *    ---     -------------------
5025 + *     0      SW0  (IP0) SW0 intr
5026 + *     1      SW1  (IP1) SW1 intr
5027 + *     -      Int0 (IP2) mapped to GROUP0_IRQ_BASE
5028 + *     -      Int1 (IP3) mapped to GROUP1_IRQ_BASE
5029 + *     -      Int2 (IP4) mapped to GROUP2_IRQ_BASE
5030 + *     -      Int3 (IP5) mapped to GROUP3_IRQ_BASE
5031 + *     -      Int4 (IP6) mapped to GROUP4_IRQ_BASE
5032 + *     7      Int5 (IP7) CP0 Timer
5033 + *
5034 + * IRQ's 8 and up are all mapped to Int0-4 (IP2-IP6), which
5035 + * internally on the RC32355 is routed to the Expansion
5036 + * Interrupt Controller.
5037 + */
5038 +#define MIPS_CPU_TIMER_IRQ 7
5039 +
5040 +#define GROUP0_IRQ_BASE  8                      // Counter/Timers, UCW
5041 +#define GROUP1_IRQ_BASE  (GROUP0_IRQ_BASE + 32) // DMA
5042 +#define GROUP2_IRQ_BASE  (GROUP1_IRQ_BASE + 32) // ATM
5043 +#define GROUP3_IRQ_BASE  (GROUP2_IRQ_BASE + 32) // TDM, Eth, USB, UARTs, I2C
5044 +#define GROUP4_IRQ_BASE  (GROUP3_IRQ_BASE + 32) // GPIO
5045 +
5046 +#define RC32355_NR_IRQS  (GROUP4_IRQ_BASE + 32)
5047 +
5048 +/* DMA - see rc32355_dma.h for full list of registers */
5049 +
5050 +#define RC32355_DMA_BASE (RC32355_REG_BASE + 0x38000)
5051 +#define DMA_CHAN_OFFSET  0x14
5052 +
5053 +/* GPIO Controller */
5054 +
5055 +/* TDM Bus */
5056 +
5057 +/* 16550 UARTs */
5058 +#ifdef __MIPSEB__
5059 +#define RC32300_UART0_BASE (RC32355_REG_BASE + 0x50003)
5060 +#define RC32300_UART1_BASE (RC32355_REG_BASE + 0x50023)
5061 +#else
5062 +#define RC32300_UART0_BASE (RC32355_REG_BASE + 0x50000)
5063 +#define RC32300_UART1_BASE (RC32355_REG_BASE + 0x50020)
5064 +#endif
5065 +
5066 +#define RC32300_UART0_IRQ  (GROUP3_IRQ_BASE + 14)
5067 +#define RC32300_UART1_IRQ  (GROUP3_IRQ_BASE + 17)
5068 +
5069 +/* ATM */
5070 +
5071 +/* Ethernet - see rc32355_eth.h for full list of registers */
5072 +
5073 +#define RC32355_ETH_BASE   (RC32355_REG_BASE + 0x60000)
5074 +
5075 +
5076 +#define IDT_CLOCK_MULT 2
5077 +
5078 +/* Memory map of 79EB355 board */
5079 +
5080 +/* DRAM */
5081 +#define RAM_BASE        0x00000000
5082 +#define RAM_SIZE       (32*1024*1024)
5083 +
5084 +/* SRAM (device 1) */
5085 +#define SRAM_BASE       0x02000000
5086 +#define SRAM_SIZE       0x00100000
5087 +
5088 +/* FLASH (device 2) */
5089 +#define FLASH_BASE      0x0C000000
5090 +#define FLASH_SIZE      0x00C00000
5091 +
5092 +/* ATM PHY (device 4) */
5093 +#define ATM_PHY_BASE    0x14000000
5094 +
5095 +/* TDM switch (device 3) */
5096 +#define TDM_BASE        0x1A000000
5097 +
5098 +/* LCD panel (device 3) */
5099 +#define LCD_BASE        0x1A002000
5100 +
5101 +/* RTC (DS1511W) (device 3) */
5102 +#define RTC_BASE        0x1A004000
5103 +
5104 +/* NVRAM (256 bytes internal to the DS1511 RTC) */
5105 +#define NVRAM_ADDR      RTC_BASE + 0x10
5106 +#define NVRAM_DATA      RTC_BASE + 0x13
5107 +#define NVRAM_ENVSIZE_OFF  4
5108 +#define NVRAM_ENVSTART_OFF 32
5109 +
5110 +#endif /* _RC32355_H_ */
5111 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_dma.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_dma.h
5112 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_dma.h      1970-01-01 01:00:00.000000000 +0100
5113 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_dma.h      2006-01-10 00:32:33.000000000 +0100
5114 @@ -0,0 +1,226 @@
5115 +/**************************************************************************
5116 + *
5117 + *  BRIEF MODULE DESCRIPTION
5118 + *   RC32365/336 DMA hardware abstraction.
5119 + *
5120 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
5121 + *         
5122 + *  This program is free software; you can redistribute  it and/or modify it
5123 + *  under  the terms of  the GNU General  Public License as published by the
5124 + *  Free Software Foundation;  either version 2 of the  License, or (at your
5125 + *  option) any later version.
5126 + *
5127 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
5128 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
5129 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
5130 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
5131 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5132 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
5133 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5134 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
5135 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5136 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5137 + *
5138 + *  You should have received a copy of the  GNU General Public License along
5139 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
5140 + *  675 Mass Ave, Cambridge, MA 02139, USA.
5141 + *
5142 + *
5143 + **************************************************************************
5144 + * May 2004 P. Sadik.
5145 + *
5146 + * Initial Release
5147 + *
5148 + * 
5149 + *
5150 + **************************************************************************
5151 + */
5152 +
5153 +#ifndef __IDT_RC32365_DMA_H__
5154 +#define __IDT_RC32365_DMA_H__
5155 +
5156 +enum
5157 +{
5158 +       DMA0_PhysicalAddress    = 0x18038000,
5159 +       DMA_PhysicalAddress     = DMA0_PhysicalAddress,         // Default
5160 +
5161 +       DMA0_VirtualAddress     = 0xb8038000,
5162 +       DMA_VirtualAddress      = DMA0_VirtualAddress,          // Default
5163 +} ;
5164 +
5165 +/*
5166 + * DMA descriptor (in physical memory).
5167 + */
5168 +
5169 +typedef struct DMAD_s
5170 +{
5171 +       u32                     control ;       // Control. use DMAD_*
5172 +       u32                     ca ;            // Current Address.
5173 +       u32                     devcs ;         // Device control and status.
5174 +       u32                     link ;          // Next descriptor in chain.
5175 +} volatile *DMAD_t ;
5176 +
5177 +enum
5178 +{
5179 +       DMAD_size               = sizeof (struct DMAD_s),
5180 +       DMAD_count_b            = 0,            // in DMAD_t -> control
5181 +       DMAD_count_m            = 0x0003ffff,   // in DMAD_t -> control
5182 +       DMAD_ds_b               = 20,           // in DMAD_t -> control
5183 +       DMAD_ds_m               = 0x00300000,   // in DMAD_t -> control
5184 +       DMAD_ds_extToMem0_v     = 0,
5185 +       DMAD_ds_memToExt0_v     = 1,
5186 +       DMAD_ds_extToMem1_v     = 0,
5187 +       DMAD_ds_memToExt1_v     = 1,
5188 +       DMAD_ds_ethRcv0_v       = 0,
5189 +       DMAD_ds_ethXmt0_v       = 0,
5190 +       DMAD_ds_ethRcv1_v       = 0,
5191 +       DMAD_ds_ethXmt2_v       = 0,
5192 +       DMAD_ds_memToFifo_v     = 0,
5193 +       DMAD_ds_fifoToMem_v     = 0,
5194 +       DMAD_ds_rng_de_v           = 1,//randomNumberGenerator on LC/DE
5195 +       DMAD_ds_pciToMem_v      = 0,
5196 +       DMAD_ds_memToPci_v      = 0,
5197 +       DMAD_ds_securityInput_v = 0,
5198 +       DMAD_ds_securityOutput_v = 0,
5199 +       DMAD_ds_rng_se_v        = 0,//randomNumberGenerator on SE
5200 +       
5201 +       DMAD_devcmd_b           = 22,           // in DMAD_t -> control
5202 +       DMAD_devcmd_m           = 0x01c00000,   // in DMAD_t -> control
5203 +       DMAD_devcmd_byte_v      = 0,    //memory-to-memory
5204 +       DMAD_devcmd_halfword_v  = 1,    //memory-to-memory
5205 +       DMAD_devcmd_word_v      = 2,    //memory-to-memory
5206 +       DMAD_devcmd_2words_v    = 3,    //memory-to-memory
5207 +       DMAD_devcmd_4words_v    = 4,    //memory-to-memory
5208 +       DMAD_devcmd_6words_v    = 5,    //memory-to-memory
5209 +       DMAD_devcmd_8words_v    = 6,    //memory-to-memory
5210 +       DMAD_devcmd_16words_v   = 7,    //memory-to-memory
5211 +       DMAD_cof_b              = 25,           // chain on finished
5212 +       DMAD_cof_m              = 0x02000000,   // 
5213 +       DMAD_cod_b              = 26,           // chain on done
5214 +       DMAD_cod_m              = 0x04000000,   // 
5215 +       DMAD_iof_b              = 27,           // interrupt on finished
5216 +       DMAD_iof_m              = 0x08000000,   // 
5217 +       DMAD_iod_b              = 28,           // interrupt on done
5218 +       DMAD_iod_m              = 0x10000000,   // 
5219 +       DMAD_t_b                = 29,           // terminated
5220 +       DMAD_t_m                = 0x20000000,   // 
5221 +       DMAD_d_b                = 30,           // done
5222 +       DMAD_d_m                = 0x40000000,   // 
5223 +       DMAD_f_b                = 31,           // finished
5224 +       DMAD_f_m                = 0x80000000,   // 
5225 +} ;
5226 +
5227 +/*
5228 + * DMA register (within Internal Register Map).
5229 + */
5230 +
5231 +struct DMA_Chan_s
5232 +{
5233 +       u32             dmac ;          // Control.
5234 +       u32             dmas ;          // Status.      
5235 +       u32             dmasm ;         // Mask.
5236 +       u32             dmadptr ;       // Descriptor pointer.
5237 +       u32             dmandptr ;      // Next descriptor pointer.
5238 +};
5239 +
5240 +typedef struct DMA_Chan_s volatile *DMA_Chan_t ;
5241 +
5242 +//DMA_Channels   use DMACH_count instead
5243 +
5244 +enum
5245 +{
5246 +       DMAC_run_b      = 0,            // 
5247 +       DMAC_run_m      = 0x00000001,   // 
5248 +       DMAC_dm_b       = 1,            // done mask
5249 +       DMAC_dm_m       = 0x00000002,   // 
5250 +       DMAC_mode_b     = 2,            // 
5251 +       DMAC_mode_m     = 0x0000000c,   // 
5252 +       DMAC_mode_auto_v        = 0,
5253 +       DMAC_mode_burst_v       = 1,
5254 +       DMAC_mode_transfer_v    = 2, //usually used
5255 +       DMAC_mode_reserved_v    = 3,
5256 +       DMAC_a_b        = 4,            // 
5257 +       DMAC_a_m        = 0x00000010,   // 
5258 +       
5259 +       DMAS_f_b        = 0,            // finished (sticky) 
5260 +       DMAS_f_m        = 0x00000001,   //                   
5261 +       DMAS_d_b        = 1,            // done (sticky)     
5262 +       DMAS_d_m        = 0x00000002,   //                   
5263 +       DMAS_c_b        = 2,            // chain (sticky)    
5264 +       DMAS_c_m        = 0x00000004,   //                   
5265 +       DMAS_e_b        = 3,            // error (sticky)    
5266 +       DMAS_e_m        = 0x00000008,   //                   
5267 +       DMAS_h_b        = 4,            // halt (sticky)     
5268 +       DMAS_h_m        = 0x00000010,   //                   
5269 +
5270 +       DMASM_f_b       = 0,            // finished (1=mask)
5271 +       DMASM_f_m       = 0x00000001,   // 
5272 +       DMASM_d_b       = 1,            // done (1=mask)
5273 +       DMASM_d_m       = 0x00000002,   // 
5274 +       DMASM_c_b       = 2,            // chain (1=mask)
5275 +       DMASM_c_m       = 0x00000004,   // 
5276 +       DMASM_e_b       = 3,            // error (1=mask)
5277 +       DMASM_e_m       = 0x00000008,   // 
5278 +       DMASM_h_b       = 4,            // halt (1=mask)
5279 +       DMASM_h_m       = 0x00000010,   // 
5280 +} ;
5281 +
5282 +/*
5283 + * DMA channel definitions
5284 + */
5285 +
5286 +enum
5287 +{
5288 +       DMACH_ethRcv0 = 0,
5289 +       DMACH_ethXmt0 = 1,
5290 +       DMACH_ethRcv1 = 2,
5291 +       DMACH_ethXmt2 = 3,
5292 +       DMACH_pciToMem = 4,
5293 +       DMACH_memToPci = 5,
5294 +       DMACH_securityInput = 6,
5295 +       DMACH_securityOutput = 7,
5296 +       DMACH_rng = 8, 
5297 +       
5298 +       DMACH_count //must be last
5299 +};
5300 +
5301 +
5302 +typedef struct DMAC_s
5303 +{
5304 +       struct DMA_Chan_s ch [DMACH_count] ; //use ch[DMACH_]
5305 +} volatile *DMA_t ;
5306 +
5307 +
5308 +/*
5309 + * External DMA parameters
5310 +*/
5311 +
5312 +enum
5313 +{
5314 +       DMADEVCMD_ts_b  = 0,            // ts field in devcmd
5315 +       DMADEVCMD_ts_m  = 0x00000007,   // ts field in devcmd
5316 +       DMADEVCMD_ts_byte_v     = 0,
5317 +       DMADEVCMD_ts_halfword_v = 1,
5318 +       DMADEVCMD_ts_word_v     = 2,
5319 +       DMADEVCMD_ts_2word_v    = 3,
5320 +       DMADEVCMD_ts_4word_v    = 4,
5321 +       DMADEVCMD_ts_6word_v    = 5,
5322 +       DMADEVCMD_ts_8word_v    = 6,
5323 +       DMADEVCMD_ts_16word_v   = 7
5324 +};
5325 +
5326 +
5327 +#if 1  // aws - Compatibility.
5328 +#      define  EXTDMA_ts_b             DMADEVCMD_ts_b
5329 +#      define  EXTDMA_ts_m             DMADEVCMD_ts_m
5330 +#      define  EXTDMA_ts_byte_v        DMADEVCMD_ts_byte_v
5331 +#      define  EXTDMA_ts_halfword_v    DMADEVCMD_ts_halfword_v
5332 +#      define  EXTDMA_ts_word_v        DMADEVCMD_ts_word_v
5333 +#      define  EXTDMA_ts_2word_v       DMADEVCMD_ts_2word_v
5334 +#      define  EXTDMA_ts_4word_v       DMADEVCMD_ts_4word_v
5335 +#      define  EXTDMA_ts_6word_v       DMADEVCMD_ts_6word_v
5336 +#      define  EXTDMA_ts_8word_v       DMADEVCMD_ts_8word_v
5337 +#      define  EXTDMA_ts_16word_v      DMADEVCMD_ts_16word_v
5338 +#endif // aws - Compatibility.
5339 +
5340 +#endif // __IDT_RC32365_DMA_H__
5341 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_dma_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_dma_v.h
5342 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_dma_v.h    1970-01-01 01:00:00.000000000 +0100
5343 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_dma_v.h    2006-01-10 00:32:33.000000000 +0100
5344 @@ -0,0 +1,86 @@
5345 +/**************************************************************************
5346 + *
5347 + *  BRIEF MODULE DESCRIPTION
5348 + *   RC32365/336 DMA interface routines.
5349 + *
5350 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
5351 + *         
5352 + *  This program is free software; you can redistribute  it and/or modify it
5353 + *  under  the terms of  the GNU General  Public License as published by the
5354 + *  Free Software Foundation;  either version 2 of the  License, or (at your
5355 + *  option) any later version.
5356 + *
5357 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
5358 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
5359 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
5360 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
5361 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5362 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
5363 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5364 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
5365 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5366 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5367 + *
5368 + *  You should have received a copy of the  GNU General Public License along
5369 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
5370 + *  675 Mass Ave, Cambridge, MA 02139, USA.
5371 + *
5372 + *
5373 + **************************************************************************
5374 + * May 2004 P. Sadik.
5375 + *
5376 + * Initial Release
5377 + *
5378 + * 
5379 + *
5380 + **************************************************************************
5381 + */
5382 +
5383 +#ifndef __IDT_RC32365_DMA_V_H__
5384 +#define __IDT_RC32365_DMA_V_H__
5385 +
5386 +
5387 +#include  <asm/idt-boards/rc32300/rc32300.h>
5388 +#include  <asm/idt-boards/rc32300/rc32365_dma.h> 
5389 +#include  <asm/idt-boards/rc32300/rc32365.h>
5390 +
5391 +#define DMA_CHAN_OFFSET  0x14
5392 +#define IS_DMA_USED(X) (((X) & (DMAD_f_m | DMAD_d_m | DMAD_t_m)) != 0)
5393 +#define IS_DMA_FINISHED(X)   (((X) & (DMAD_f_m)) != 0)
5394 +#define IS_DMA_DONE(X)   (((X) & (DMAD_d_m)) != 0)
5395 +
5396 +#define DMA_COUNT(count)   \
5397 +  ((count) & DMAD_count_m)
5398 +
5399 +#define DMA_HALT_TIMEOUT 500
5400 +
5401 +static inline int rc32365_halt_dma(DMA_Chan_t ch)
5402 +{
5403 +       int timeout=1;
5404 +       if (local_readl(&ch->dmac) & DMAC_run_m) {
5405 +               local_writel(0, &ch->dmac); 
5406 +               
5407 +               for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
5408 +                       if (local_readl(&ch->dmas) & DMAS_h_m) {
5409 +                               local_writel(0, &ch->dmas);  
5410 +                               break;
5411 +                       }
5412 +               }
5413 +
5414 +       }
5415 +
5416 +       return timeout ? 0 : 1;
5417 +}
5418 +
5419 +
5420 +static inline void rc32365_start_dma(DMA_Chan_t ch, u32 dma_addr)
5421 +{
5422 +       local_writel(0, &ch->dmandptr); 
5423 +       local_writel(dma_addr, &ch->dmadptr);
5424 +}
5425 +
5426 +static inline void rc32365_chain_dma(DMA_Chan_t ch, u32 dma_addr)
5427 +{
5428 +       local_writel(dma_addr, &ch->dmandptr);
5429 +}
5430 +#endif //__IDT_RC32365_DMA_V_H__
5431 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_eth.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_eth.h
5432 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_eth.h      1970-01-01 01:00:00.000000000 +0100
5433 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_eth.h      2006-01-10 00:32:33.000000000 +0100
5434 @@ -0,0 +1,344 @@
5435 +/**************************************************************************
5436 + *
5437 + *  BRIEF MODULE DESCRIPTION
5438 + *   RC32365/336 Ethernet hardware abstraction.
5439 + *
5440 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
5441 + *         
5442 + *  This program is free software; you can redistribute  it and/or modify it
5443 + *  under  the terms of  the GNU General  Public License as published by the
5444 + *  Free Software Foundation;  either version 2 of the  License, or (at your
5445 + *  option) any later version.
5446 + *
5447 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
5448 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
5449 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
5450 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
5451 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5452 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
5453 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5454 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
5455 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5456 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5457 + *
5458 + *  You should have received a copy of the  GNU General Public License along
5459 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
5460 + *  675 Mass Ave, Cambridge, MA 02139, USA.
5461 + *
5462 + *
5463 + **************************************************************************
5464 + * May 2004 P. Sadik.
5465 + *
5466 + * Initial Release
5467 + *
5468 + * 
5469 + *
5470 + **************************************************************************
5471 + */
5472 +
5473 +#ifndef        __IDT_RC32365_ETH_H__
5474 +#define        __IDT_RC32365_ETH_H__
5475 +
5476 +enum
5477 +{
5478 +       ETH0_PhysicalAddress    = 0x18058000,
5479 +       ETH_PhysicalAddress     = ETH0_PhysicalAddress,         // Default
5480 +       ETH0_VirtualAddress     = 0xb8058000,
5481 +
5482 +       ETH_VirtualAddress      = ETH0_VirtualAddress,          // Default
5483 +
5484 +       ETH1_PhysicalAddress    = 0x18060000,
5485 +       ETH1_VirtualAddress     = 0xb8060000,                   // Default
5486 +} ;
5487 +
5488 +typedef struct
5489 +{
5490 +       u32 ethintfc            ;
5491 +       u32 ethfifott           ;
5492 +       u32 etharc              ;
5493 +       u32 ethhash0            ;
5494 +       u32 ethhash1            ;
5495 +       u32 ethu0 [4]           ;       // Reserved.    
5496 +       u32 ethpfs              ;
5497 +       u32 ethmcp              ;
5498 +       u32 eth_u1 [10]         ;       // Reserved.
5499 +       u32 ethspare            ;
5500 +       u32 eth_u2 [42]         ;       // Reserved. 
5501 +       u32 ethsal0             ;
5502 +       u32 ethsah0             ;
5503 +       u32 ethsal1             ;
5504 +       u32 ethsah1             ;
5505 +       u32 ethsal2             ;
5506 +       u32 ethsah2             ;
5507 +       u32 ethsal3             ;
5508 +       u32 ethsah3             ;
5509 +       u32 ethrbc              ;
5510 +       u32 ethrpc              ;
5511 +       u32 ethrupc             ;
5512 +       u32 ethrfc              ;
5513 +       u32 ethtbc              ;
5514 +       u32 ethgpf              ;
5515 +       u32 eth_u9 [50]         ;       // Reserved.    
5516 +       u32 ethmac1             ;
5517 +       u32 ethmac2             ;
5518 +       u32 ethipgt             ;
5519 +       u32 ethipgr             ;
5520 +       u32 ethclrt             ;
5521 +       u32 ethmaxf             ;
5522 +       u32 eth_u10             ;       // Reserved.    
5523 +       u32 ethmtest            ;
5524 +       u32 miimcfg             ;
5525 +       u32 miimcmd             ;
5526 +       u32 miimaddr            ;
5527 +       u32 miimwtd             ;
5528 +       u32 miimrdd             ;
5529 +       u32 miimind             ;
5530 +       u32 eth_u11             ;       // Reserved.
5531 +       u32 eth_u12             ;       // Reserved.
5532 +       u32 ethcfsa0            ;
5533 +       u32 ethcfsa1            ;
5534 +       u32 ethcfsa2            ;
5535 +} volatile *ETH_t;
5536 +
5537 +enum
5538 +{
5539 +       ETHINTFC_en_b           = 0,
5540 +       ETHINTFC_en_m           = 0x00000001,
5541 +       ETHINTFC_its_b          = 1,
5542 +       ETHINTFC_its_m          = 0x00000002,
5543 +       ETHINTFC_rip_b          = 2,
5544 +       ETHINTFC_rip_m          = 0x00000004,
5545 +       ETHINTFC_jam_b          = 3,
5546 +       ETHINTFC_jam_m          = 0x00000008,
5547 +       ETHINTFC_ovr_b          = 4,
5548 +       ETHINTFC_ovr_m          = 0x00000010,
5549 +       ETHINTFC_und_b          = 5,
5550 +       ETHINTFC_und_m          = 0x00000020,
5551 +
5552 +       ETHFIFOTT_tth_b         = 0,
5553 +       ETHFIFOTT_tth_m         = 0x0000007f,
5554 +
5555 +       ETHARC_pro_b            = 0,
5556 +       ETHARC_pro_m            = 0x00000001,
5557 +       ETHARC_am_b             = 1,
5558 +       ETHARC_am_m             = 0x00000002,
5559 +       ETHARC_afm_b            = 2,
5560 +       ETHARC_afm_m            = 0x00000004,
5561 +       ETHARC_ab_b             = 3,
5562 +       ETHARC_ab_m             = 0x00000008,
5563 +
5564 +       ETHSAL_byte5_b          = 0,
5565 +       ETHSAL_byte5_m          = 0x000000ff,
5566 +       ETHSAL_byte4_b          = 8,
5567 +       ETHSAL_byte4_m          = 0x0000ff00,
5568 +       ETHSAL_byte3_b          = 16,
5569 +       ETHSAL_byte3_m          = 0x00ff0000,
5570 +       ETHSAL_byte2_b          = 24,
5571 +       ETHSAL_byte2_m          = 0xff000000,
5572 +
5573 +       ETHSAH_byte1_b          = 0,
5574 +       ETHSAH_byte1_m          = 0x000000ff,
5575 +       ETHSAH_byte0_b          = 8,
5576 +       ETHSAH_byte0_m          = 0x0000ff00,
5577 +       
5578 +       ETHGPF_ptv_b            = 0,
5579 +       ETHGPF_ptv_m            = 0x0000ffff,
5580 +
5581 +       ETHPFS_pfd_b            = 0,
5582 +       ETHPFS_pfd_m            = 0x00000001,
5583 +
5584 +       ETHCFSA0_cfsa4_b        = 0,
5585 +       ETHCFSA0_cfsa4_m        = 0x000000ff,
5586 +       ETHCFSA0_cfsa5_b        = 8,
5587 +       ETHCFSA0_cfsa5_m        = 0x0000ff00,
5588 +
5589 +       ETHCFSA1_cfsa2_b        = 0,
5590 +       ETHCFSA1_cfsa2_m        = 0x000000ff,
5591 +       ETHCFSA1_cfsa3_b        = 8,
5592 +       ETHCFSA1_cfsa3_m        = 0x0000ff00,
5593 +
5594 +       ETHCFSA2_cfsa0_b        = 0,
5595 +       ETHCFSA2_cfsa0_m        = 0x000000ff,
5596 +       ETHCFSA2_cfsa1_b        = 8,
5597 +       ETHCFSA2_cfsa1_m        = 0x0000ff00,
5598 +
5599 +       ETHMAC1_re_b            = 0,
5600 +       ETHMAC1_re_m            = 0x00000001,
5601 +       ETHMAC1_paf_b           = 1,
5602 +       ETHMAC1_paf_m           = 0x00000002,
5603 +       ETHMAC1_rfc_b           = 2,
5604 +       ETHMAC1_rfc_m           = 0x00000004,
5605 +       ETHMAC1_tfc_b           = 3,
5606 +       ETHMAC1_tfc_m           = 0x00000008,
5607 +       ETHMAC1_lb_b            = 4,
5608 +       ETHMAC1_lb_m            = 0x00000010,
5609 +       ETHMAC1_mr_b            = 31,
5610 +       ETHMAC1_mr_m            = 0x80000000,
5611 +
5612 +       ETHMAC2_fd_b            = 0,
5613 +       ETHMAC2_fd_m            = 0x00000001,
5614 +       ETHMAC2_flc_b           = 1,
5615 +       ETHMAC2_flc_m           = 0x00000002,
5616 +       ETHMAC2_hfe_b           = 2,
5617 +       ETHMAC2_hfe_m           = 0x00000004,
5618 +       ETHMAC2_dc_b            = 3,
5619 +       ETHMAC2_dc_m            = 0x00000008,
5620 +       ETHMAC2_cen_b           = 4,
5621 +       ETHMAC2_cen_m           = 0x00000010,
5622 +       ETHMAC2_pe_b            = 5,
5623 +       ETHMAC2_pe_m            = 0x00000020,
5624 +       ETHMAC2_vpe_b           = 6,
5625 +       ETHMAC2_vpe_m           = 0x00000040,
5626 +       ETHMAC2_ape_b           = 7,
5627 +       ETHMAC2_ape_m           = 0x00000080,
5628 +       ETHMAC2_ppe_b           = 8,
5629 +       ETHMAC2_ppe_m           = 0x00000100,
5630 +       ETHMAC2_lpe_b           = 9,
5631 +       ETHMAC2_lpe_m           = 0x00000200,
5632 +       ETHMAC2_nb_b            = 12,
5633 +       ETHMAC2_nb_m            = 0x00001000,
5634 +       ETHMAC2_bp_b            = 13,
5635 +       ETHMAC2_bp_m            = 0x00002000,
5636 +       ETHMAC2_ed_b            = 14,
5637 +       ETHMAC2_ed_m            = 0x00004000,
5638 +
5639 +       ETHIPGT_ipgt_b          = 0,
5640 +       ETHIPGT_ipgt_m          = 0x0000007f,
5641 +
5642 +       ETHIPGR_ipgr2_b         = 0,
5643 +       ETHIPGR_ipgr2_m         = 0x0000007f,
5644 +       ETHIPGR_ipgr1_b         = 8,
5645 +       ETHIPGR_ipgr1_m         = 0x00007f00,
5646 +
5647 +       ETHCLRT_maxret_b        = 0,
5648 +       ETHCLRT_maxret_m        = 0x0000000f,
5649 +       ETHCLRT_colwin_b        = 8,
5650 +       ETHCLRT_colwin_m        = 0x00003f00,
5651 +
5652 +       ETHMAXF_maxf_b          = 0,
5653 +       ETHMAXF_maxf_m          = 0x0000ffff,
5654 +
5655 +       ETHMTEST_tb_b           = 2,
5656 +       ETHMTEST_tb_m           = 0x00000004,
5657 +
5658 +       ETHMCP_div_b            = 0,
5659 +       ETHMCP_div_m            = 0x000000ff,
5660 +       
5661 +       MIIMCFG_rsv_b           = 0,
5662 +       MIIMCFG_rsv_m           = 0x0000000c,
5663 +
5664 +       MIIMCMD_rd_b            = 0,
5665 +       MIIMCMD_rd_m            = 0x00000001,
5666 +       MIIMCMD_scn_b           = 1,
5667 +       MIIMCMD_scn_m           = 0x00000002,
5668 +
5669 +       MIIMADDR_regaddr_b      = 0,
5670 +       MIIMADDR_regaddr_m      = 0x0000001f,
5671 +       MIIMADDR_phyaddr_b      = 8,
5672 +       MIIMADDR_phyaddr_m      = 0x00001f00,
5673 +
5674 +       MIIMWTD_wdata_b         = 0,
5675 +       MIIMWTD_wdata_m         = 0x0000ffff,
5676 +
5677 +       MIIMRDD_rdata_b         = 0,
5678 +       MIIMRDD_rdata_m         = 0x0000ffff,
5679 +
5680 +       MIIMIND_bsy_b           = 0,
5681 +       MIIMIND_bsy_m           = 0x00000001,
5682 +       MIIMIND_scn_b           = 1,
5683 +       MIIMIND_scn_m           = 0x00000002,
5684 +       MIIMIND_nv_b            = 2,
5685 +       MIIMIND_nv_m            = 0x00000004,
5686 +
5687 +} ;
5688 +
5689 +/*
5690 + * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
5691 + */
5692 +enum
5693 +{
5694 +       ETHRX_fd_b              = 0,
5695 +       ETHRX_fd_m              = 0x00000001,
5696 +       ETHRX_ld_b              = 1,
5697 +       ETHRX_ld_m              = 0x00000002,
5698 +       ETHRX_rok_b             = 2,
5699 +       ETHRX_rok_m             = 0x00000004,
5700 +       ETHRX_fm_b              = 3,
5701 +       ETHRX_fm_m              = 0x00000008,
5702 +       ETHRX_mp_b              = 4,
5703 +       ETHRX_mp_m              = 0x00000010,
5704 +       ETHRX_bp_b              = 5,
5705 +       ETHRX_bp_m              = 0x00000020,
5706 +       ETHRX_vlt_b             = 6,
5707 +       ETHRX_vlt_m             = 0x00000040,
5708 +       ETHRX_cf_b              = 7,
5709 +       ETHRX_cf_m              = 0x00000080,
5710 +       ETHRX_ovr_b             = 8,
5711 +       ETHRX_ovr_m             = 0x00000100,
5712 +       ETHRX_crc_b             = 9,
5713 +       ETHRX_crc_m             = 0x00000200,
5714 +       ETHRX_cv_b              = 10,
5715 +       ETHRX_cv_m              = 0x00000400,
5716 +       ETHRX_db_b              = 11,
5717 +       ETHRX_db_m              = 0x00000800,
5718 +       ETHRX_le_b              = 12,
5719 +       ETHRX_le_m              = 0x00001000,
5720 +       ETHRX_lor_b             = 13,
5721 +       ETHRX_lor_m             = 0x00002000,
5722 +       ETHRX_ces_b             = 14,
5723 +       ETHRX_ces_m             = 0x00004000,
5724 +       ETHRX_length_b          = 16,
5725 +       ETHRX_length_m          = 0xffff0000,
5726 +
5727 +       ETHTX_fd_b              = 0,
5728 +       ETHTX_fd_m              = 0x00000001,
5729 +       ETHTX_ld_b              = 1,
5730 +       ETHTX_ld_m              = 0x00000002,
5731 +       ETHTX_oen_b             = 2,
5732 +       ETHTX_oen_m             = 0x00000004,
5733 +       ETHTX_pen_b             = 3,
5734 +       ETHTX_pen_m             = 0x00000008,
5735 +       ETHTX_cen_b             = 4,
5736 +       ETHTX_cen_m             = 0x00000010,
5737 +       ETHTX_hen_b             = 5,
5738 +       ETHTX_hen_m             = 0x00000020,
5739 +       ETHTX_tok_b             = 6,
5740 +       ETHTX_tok_m             = 0x00000040,
5741 +       ETHTX_mp_b              = 7,
5742 +       ETHTX_mp_m              = 0x00000080,
5743 +       ETHTX_bp_b              = 8,
5744 +       ETHTX_bp_m              = 0x00000100,
5745 +       ETHTX_und_b             = 9,
5746 +       ETHTX_und_m             = 0x00000200,
5747 +       ETHTX_of_b              = 10,
5748 +       ETHTX_of_m              = 0x00000400,
5749 +       ETHTX_ed_b              = 11,
5750 +       ETHTX_ed_m              = 0x00000800,
5751 +       ETHTX_ec_b              = 12,
5752 +       ETHTX_ec_m              = 0x00001000,
5753 +       ETHTX_lc_b              = 13,
5754 +       ETHTX_lc_m              = 0x00002000,
5755 +       ETHTX_td_b              = 14,
5756 +       ETHTX_td_m              = 0x00004000,
5757 +       ETHTX_crc_b             = 15,
5758 +       ETHTX_crc_m             = 0x00008000,
5759 +       ETHTX_le_b              = 16,
5760 +       ETHTX_le_m              = 0x00010000,
5761 +       ETHTX_cc_b              = 17,
5762 +       ETHTX_cc_m              = 0x001E0000,
5763 +} ;
5764 +
5765 +enum
5766 +{
5767 +       ETH0_IPABMC_PhysicalAddress     = 0x18040010,
5768 +       ETH0_IPABMC_VirtualAddress      = 0xb8040000,
5769 +       ETH1_IPABMC_PhysicalAddress     = 0x18040018,
5770 +       ETH1_IPABMC_VirtualAddress      = 0xb8040018,
5771 +} ;
5772 +
5773 +typedef struct
5774 +{
5775 +       u32 ipabmcrx            ;
5776 +       u32 ipabmctx            ;
5777 +}volatile *IPABM_ETH_t;
5778 +#endif //__IDT_RC32365_ETH_H__
5779 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_eth_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_eth_v.h
5780 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_eth_v.h    1970-01-01 01:00:00.000000000 +0100
5781 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_eth_v.h    2006-01-10 00:32:33.000000000 +0100
5782 @@ -0,0 +1,72 @@
5783 +/**************************************************************************
5784 + *
5785 + *  BRIEF MODULE DESCRIPTION
5786 + *   RC32365/336 Ethernet status checking.
5787 + *
5788 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
5789 + *         
5790 + *  This program is free software; you can redistribute  it and/or modify it
5791 + *  under  the terms of  the GNU General  Public License as published by the
5792 + *  Free Software Foundation;  either version 2 of the  License, or (at your
5793 + *  option) any later version.
5794 + *
5795 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
5796 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
5797 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
5798 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
5799 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5800 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
5801 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5802 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
5803 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5804 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5805 + *
5806 + *  You should have received a copy of the  GNU General Public License along
5807 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
5808 + *  675 Mass Ave, Cambridge, MA 02139, USA.
5809 + *
5810 + *
5811 + **************************************************************************
5812 + * May 2004 P. Sadik.
5813 + *
5814 + * Initial Release
5815 + *
5816 + * 
5817 + *
5818 + **************************************************************************
5819 + */
5820 +
5821 +#ifndef __IDT_RC32365_ETH_V_H__
5822 +#define __IDT_RC32365_ETH_V_H__
5823 +#include  <asm/idt-boards/rc32300/rc32365_eth.h> 
5824 +
5825 +#define IS_TX_TOK(X)         (((X) & (1<<ETHTX_tok_b)) >> ETHTX_tok_b )   /* Transmit Okay    */
5826 +#define IS_TX_MP(X)          (((X) & (1<<ETHTX_mp_b))  >> ETHTX_mp_b )    /* Multicast        */
5827 +#define IS_TX_BP(X)          (((X) & (1<<ETHTX_bp_b))  >> ETHTX_bp_b )    /* Broadcast        */
5828 +#define IS_TX_UND_ERR(X)     (((X) & (1<<ETHTX_und_b)) >> ETHTX_und_b )   /* Transmit FIFO Underflow */
5829 +#define IS_TX_OF_ERR(X)      (((X) & (1<<ETHTX_of_b))  >> ETHTX_of_b )    /* Oversized frame  */
5830 +#define IS_TX_ED_ERR(X)      (((X) & (1<<ETHTX_ed_b))  >> ETHTX_ed_b )    /* Excessive deferral  */
5831 +#define IS_TX_EC_ERR(X)      (((X) & (1<<ETHTX_ec_b))  >> ETHTX_ec_b)     /* Excessive collisions  */
5832 +#define IS_TX_LC_ERR(X)      (((X) & (1<<ETHTX_lc_b))  >> ETHTX_lc_b )    /* Late Collision   */
5833 +#define IS_TX_TD_ERR(X)      (((X) & (1<<ETHTX_td_b))  >> ETHTX_td_b )    /* Transmit deferred*/
5834 +#define IS_TX_CRC_ERR(X)     (((X) & (1<<ETHTX_crc_b)) >> ETHTX_crc_b )   /* CRC Error        */
5835 +#define IS_TX_LE_ERR(X)      (((X) & (1<<ETHTX_le_b))  >>  ETHTX_le_b )    /* Length Error     */
5836 +
5837 +#define TX_COLLISION_COUNT(X) (((X) & ETHTX_cc_m)>>ETHTX_cc_b)  /* Collision Count  */
5838 +
5839 +#define IS_RCV_ROK(X)        (((X) & (1<<ETHRX_rok_b)) >> ETHRX_rok_b)    /* Receive Okay     */
5840 +#define IS_RCV_FM(X)         (((X) & (1<<ETHRX_fm_b))  >> ETHRX_fm_b)     /* Is Filter Match  */
5841 +#define IS_RCV_MP(X)         (((X) & (1<<ETHRX_mp_b))  >> ETHRX_mp_b)     /* Is it MP         */
5842 +#define IS_RCV_BP(X)         (((X) & (1<<ETHRX_bp_b))  >> ETHRX_bp_b)     /* Is it BP         */
5843 +#define IS_RCV_VLT(X)        (((X) & (1<<ETHRX_vlt_b)) >> ETHRX_vlt_b)    /* VLAN Tag Detect  */
5844 +#define IS_RCV_CF(X)         (((X) & (1<<ETHRX_cf_b))  >> ETHRX_cf_b)     /* Control Frame    */
5845 +#define IS_RCV_OVR_ERR(X)    (((X) & (1<<ETHRX_ovr_b)) >> ETHRX_ovr_b)    /* Receive Overflow */
5846 +#define IS_RCV_CRC_ERR(X)    (((X) & (1<<ETHRX_crc_b)) >> ETHRX_crc_b)    /* CRC Error        */
5847 +#define IS_RCV_CV_ERR(X)     (((X) & (1<<ETHRX_cv_b))  >> ETHRX_cv_b)     /* Code Violation   */
5848 +#define IS_RCV_DB_ERR(X)     (((X) & (1<<ETHRX_db_b))  >> ETHRX_db_b)     /* Dribble Bits     */
5849 +#define IS_RCV_LE_ERR(X)     (((X) & (1<<ETHRX_le_b))  >> ETHRX_le_b)     /* Length error     */
5850 +#define IS_RCV_LOR_ERR(X)    (((X) & (1<<ETHRX_lor_b)) >> ETHRX_lor_b)    /* Length Out of Range */
5851 +#define IS_RCV_CES_ERR(X)    (((X) & (1<<ETHRX_ces_b)) >> ETHRX_ces_b)  /* Preamble error   */
5852 +#define RCVPKT_LENGTH(X)     (((X) & ETHRX_length_m) >> ETHRX_length_b)   /* Length of the received packet */
5853 +
5854 +#endif //__IDT_RC32365_ETH_V_H__
5855 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_gpio.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_gpio.h
5856 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_gpio.h     1970-01-01 01:00:00.000000000 +0100
5857 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_gpio.h     2006-01-10 00:32:33.000000000 +0100
5858 @@ -0,0 +1,181 @@
5859 +/**************************************************************************
5860 + *
5861 + *  BRIEF MODULE DESCRIPTION
5862 + *   RC32365/336 GPIO hardware abstraction.
5863 + *
5864 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
5865 + *         
5866 + *  This program is free software; you can redistribute  it and/or modify it
5867 + *  under  the terms of  the GNU General  Public License as published by the
5868 + *  Free Software Foundation;  either version 2 of the  License, or (at your
5869 + *  option) any later version.
5870 + *
5871 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
5872 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
5873 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
5874 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
5875 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5876 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
5877 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5878 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
5879 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5880 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5881 + *
5882 + *  You should have received a copy of the  GNU General Public License along
5883 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
5884 + *  675 Mass Ave, Cambridge, MA 02139, USA.
5885 + *
5886 + *
5887 + **************************************************************************
5888 + * May 2004 P. Sadik.
5889 + *
5890 + * Initial Release
5891 + *
5892 + * 
5893 + *
5894 + **************************************************************************
5895 + */
5896 +
5897 +#ifndef        __IDT_RC32365_GPIO_H__
5898 +#define        __IDT_RC32365_GPIO_H__
5899 +
5900 +enum
5901 +{
5902 +       GPIO0_PhysicalAddress   = 0x18048000,
5903 +       GPIO_PhysicalAddress    = GPIO0_PhysicalAddress,        // Default
5904 +       
5905 +       GPIO0_VirtualAddress    = 0xb8048000,
5906 +       GPIO_VirtualAddress     = GPIO0_VirtualAddress,         // Default
5907 +} ;
5908 +
5909 +typedef struct
5910 +{
5911 +       u32   gpiofunc;   /* GPIO Function Register
5912 +                          * gpiofunc[x]==0 bit = gpio
5913 +                          * func[x]==1  bit = altfunc
5914 +                          */
5915 +       u32   gpiocfg;    /* GPIO Configuration Register
5916 +                          * gpiocfg[x]==0 bit = input
5917 +                          * gpiocfg[x]==1 bit = output
5918 +                          */
5919 +       u32   gpiod;        /* GPIO Data Register
5920 +                            * gpiod[x] read/write gpio pinX status
5921 +                            */
5922 +       u32   gpioilevel; /* GPIO Interrupt Status Register
5923 +                          * interrupt level (see gpioistat)
5924 +                          */
5925 +       u32   gpioistat;  /* Gpio Interrupt Status Register
5926 +                          * istat[x] = (gpiod[x] == level[x])
5927 +                          * cleared in ISR (STICKY bits)
5928 +                          */
5929 +       u32   gpionmien;  /* GPIO Non-maskable Interrupt Enable Register */
5930 +} volatile * GPIO_t ;
5931 +
5932 +typedef enum
5933 +{
5934 +       GPIO_gpio_v         = 0,                // gpiofunc use pin as GPIO.
5935 +       GPIO_alt_v          = 1,                // gpiofunc use pin as alt.
5936 +       GPIO_input_v        = 0,                // gpiocfg use pin as input.
5937 +       GPIO_output_v       = 1,                // gpiocfg use pin as output.
5938 +       GPIO_pin0_b         = 0,
5939 +       GPIO_pin0_m         = 0x00000001,
5940 +       GPIO_pin1_b         = 1,
5941 +       GPIO_pin1_m         = 0x00000002,
5942 +       GPIO_pin2_b         = 2,
5943 +       GPIO_pin2_m         = 0x00000004,
5944 +       GPIO_pin3_b         = 3,
5945 +       GPIO_pin3_m         = 0x00000008,
5946 +       GPIO_pin4_b         = 4,
5947 +       GPIO_pin4_m         = 0x00000010,
5948 +       GPIO_pin5_b         = 5,
5949 +       GPIO_pin5_m         = 0x00000020,
5950 +       GPIO_pin6_b         = 6,
5951 +       GPIO_pin6_m         = 0x00000040,
5952 +       GPIO_pin7_b         = 7,
5953 +       GPIO_pin7_m         = 0x00000080,
5954 +       GPIO_pin8_b         = 8,
5955 +       GPIO_pin8_m         = 0x00000100,
5956 +       GPIO_pin9_b         = 9,
5957 +       GPIO_pin9_m         = 0x00000200,
5958 +       GPIO_pin10_b        = 10,
5959 +       GPIO_pin10_m        = 0x00000400,
5960 +       GPIO_pin11_b        = 11,
5961 +       GPIO_pin11_m        = 0x00000800,
5962 +       GPIO_pin12_b        = 12,
5963 +       GPIO_pin12_m        = 0x00001000,
5964 +       GPIO_pin13_b        = 13,
5965 +       GPIO_pin13_m        = 0x00002000,
5966 +       GPIO_pin14_b        = 14,
5967 +       GPIO_pin14_m        = 0x00004000,
5968 +       GPIO_pin15_b        = 15,
5969 +       GPIO_pin15_m        = 0x00008000,
5970 +       
5971 +// Alternate function pins.  Corrsponding gpiofunc bit set to GPIO_alt_v.
5972 +       
5973 +       GPIO_u0sout_b       = GPIO_pin0_b,              // UART 0 serial out.
5974 +       GPIO_u0sout_m       = GPIO_pin0_m,
5975 +       GPIO_u0sout_cfg_v   = GPIO_output_v,
5976 +       
5977 +       GPIO_u0sinp_b       = GPIO_pin1_b,                      // UART 0 serial in.
5978 +       GPIO_u0sinp_m       = GPIO_pin1_m,
5979 +       GPIO_u0sinp_cfg_v   = GPIO_input_v,
5980 +       
5981 +       GPIO_maddr22_b      = GPIO_pin2_b,      // M&P bus bit 22.
5982 +       GPIO_maddr22_m      = GPIO_pin2_m,
5983 +       GPIO_maddr22_cfg_v  = GPIO_output_v,
5984 +       
5985 +       GPIO_maddr23_b      = GPIO_pin3_b,      // M&P bus bit 23.
5986 +       GPIO_maddr23_m      = GPIO_pin3_m,
5987 +       GPIO_maddr23_cfg_v  = GPIO_output_v,
5988 +       
5989 +       GPIO_maddr24_b      = GPIO_pin4_b,      // M&P bus bit 24.
5990 +       GPIO_maddr24_m      = GPIO_pin4_m,
5991 +       GPIO_maddr24_cfg_v  = GPIO_output_v,
5992 +       
5993 +       GPIO_maddr25_b      = GPIO_pin5_b,      // M&P bus bit 25.
5994 +       GPIO_maddr25_m      = GPIO_pin5_m,
5995 +       GPIO_maddr25_cfg_v  = GPIO_output_v,
5996 +       
5997 +       GPIO_rngclk_b       = GPIO_pin6_b,      // reserved.
5998 +       GPIO_rngclk_m       = GPIO_pin6_m,
5999 +       GPIO_rngclk_cfg_v   = GPIO_input_v,
6000 +
6001 +       GPIO_sdckenp_b      = GPIO_pin7_b,      // reserved.
6002 +       GPIO_sdckenp_m      = GPIO_pin7_m,
6003 +       GPIO_sdckenp_cfg_v  = GPIO_output_v,
6004 +
6005 +       GPIO_cen1_b         = GPIO_pin8_b,      // reserved.
6006 +       GPIO_cen1_m         = GPIO_pin8_m,
6007 +       GPIO_cen1_cfg_v     = GPIO_output_v,
6008 +
6009 +       GPIO_cen2_b         = GPIO_pin9_b,      // reserved.
6010 +       GPIO_cen2_m         = GPIO_pin9_m,
6011 +       GPIO_cen2_cfg_v     = GPIO_output_v,
6012 +       
6013 +       GPIO_regn_b         = GPIO_pin10_b,     // reserved.
6014 +       GPIO_regn_m         = GPIO_pin10_m,
6015 +       GPIO_regn_cfg_v     = GPIO_output_v,
6016 +       
6017 +       GPIO_iordn_b        = GPIO_pin11_b,     // reserved.
6018 +       GPIO_iordn_m        = GPIO_pin11_m,
6019 +       GPIO_iordn_cfg_v    = GPIO_output_v,
6020 +       
6021 +       GPIO_iowrn_b        = GPIO_pin12_b,     // reserved.
6022 +       GPIO_iowrn_m        = GPIO_pin12_m,
6023 +       GPIO_iowrn_cfg_v    = GPIO_output_v,
6024 +    
6025 +       GPIO_pcireqn2_b     = GPIO_pin13_b,     // PCI messaging int.
6026 +       GPIO_pcireqn2_m     = GPIO_pin13_m,
6027 +       GPIO_pcireqn2_cfg_v = GPIO_input_v,
6028 +       
6029 +       GPIO_pcigntn2_b     = GPIO_pin14_b,     // PCI messaging int.
6030 +       GPIO_pcigntn2_m     = GPIO_pin14_m,
6031 +       GPIO_pcigntn2_cfg_v = GPIO_output_v,
6032 +       
6033 +       GPIO_pcimuintn_b    = GPIO_pin15_b,     // PCI messaging int.
6034 +       GPIO_pcimuintn_m    = GPIO_pin15_m,
6035 +       GPIO_pcimuintn_cfg_v= GPIO_output_v,
6036 +       
6037 +} GPIO_DEFS_t;
6038 +
6039 +#endif //__IDT_RC32365_GPIO_H__
6040 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_gpio_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_gpio_v.h
6041 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_gpio_v.h   1970-01-01 01:00:00.000000000 +0100
6042 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_gpio_v.h   2006-01-10 00:32:33.000000000 +0100
6043 @@ -0,0 +1,91 @@
6044 +/**************************************************************************
6045 + *
6046 + *  BRIEF MODULE DESCRIPTION
6047 + *   Routines to set/clear/toggle GPIO on RC32365
6048 + *
6049 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
6050 + *         
6051 + *  This program is free software; you can redistribute  it and/or modify it
6052 + *  under  the terms of  the GNU General  Public License as published by the
6053 + *  Free Software Foundation;  either version 2 of the  License, or (at your
6054 + *  option) any later version.
6055 + *
6056 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
6057 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
6058 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
6059 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
6060 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6061 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
6062 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
6063 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
6064 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6065 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6066 + *
6067 + *  You should have received a copy of the  GNU General Public License along
6068 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
6069 + *  675 Mass Ave, Cambridge, MA 02139, USA.
6070 + *
6071 + *
6072 + **************************************************************************
6073 + * May 2004 P. Sadik.
6074 + *
6075 + * Initial Release
6076 + *
6077 + * 
6078 + *
6079 + **************************************************************************
6080 + */
6081 +#ifndef        __IDT_RC32365_GPIO_V_H__
6082 +#define        __IDT_RC32365_GPIO_V_H__
6083 +
6084 +
6085 +#ifdef _LANGUAGE_ASSEMBLY
6086 +#define SET_GPIO(pin) \
6087 +       lui t5,0xb804 ; \
6088 +       ori t5,t5,0x8000 ; \
6089 +       lw  t4,8(t5) ; \
6090 +       ori t4,t4,pin ; \
6091 +       sw  t4,8(t5) ;
6092 +
6093 +#define CLEAR_GPIO(pin) \
6094 +       lui t5,0xb804 ; \
6095 +       ori t5,t5,0x8000 ; \
6096 +       lw  t4,8(t5) ; \
6097 +        lui t6,0xFFFF; \
6098 +        ori t6,t6,0xFFFF; \
6099 +       xori t6,t6,pin ; \
6100 +        and  t4,t6 ; \
6101 +       sw  t4,8(t5) ;
6102 +
6103 +#define TOGGLE_GPIO(pin) \
6104 +       lui t5,0xb804 ; \
6105 +       ori t5,t5,0x8000 ; \
6106 +       lw  t4,8(t5) ; \
6107 +       xori t4,t4,pin ; \
6108 +       sw  t4,8(t5) ;
6109 +
6110 +#else // !_LANGUAGE_ASSEMBLY 
6111 +#include  <asm/rc32300/types.h> 
6112 +#include  <asm/rc32300/rc32365_gpio.h> 
6113 +#include  <asm/rc32300/rc32365.h>
6114 +
6115 +static inline void set_gpio(unsigned long pin)
6116 +{
6117 +  idt_gpio->gpiod |= pin;
6118 +}
6119
6120 +static inline void clear_gpio(unsigned long pin)
6121 +{
6122 +  idt_gpio->gpiod &= ~pin;
6123 +}
6124 +static inline void toggle_gpio(unsigned long pin)
6125 +{
6126 +  idt_gpio->gpiod ^= pin;
6127 +}
6128 +#define SET_GPIO(pin) set_gpio(pin)
6129 +#define CLEAR_GPIO(pin) clear_gpio(pin)
6130 +#define TOGGLE_GPIO(pin) toggle_gpio(pin)
6131 +#endif // _LANGUAGE_ASSEMBLY 
6132 +
6133 +#endif //__IDT_RC32365_GPIO_V_H__
6134 +
6135 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365.h
6136 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365.h  1970-01-01 01:00:00.000000000 +0100
6137 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365.h  2006-01-10 00:32:33.000000000 +0100
6138 @@ -0,0 +1,160 @@
6139 +/**************************************************************************
6140 + *
6141 + *  BRIEF MODULE DESCRIPTION
6142 + *   Definitions for IDT RC32365 CPU.
6143 + *
6144 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
6145 + *         
6146 + *  This program is free software; you can redistribute  it and/or modify it
6147 + *  under  the terms of  the GNU General  Public License as published by the
6148 + *  Free Software Foundation;  either version 2 of the  License, or (at your
6149 + *  option) any later version.
6150 + *
6151 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
6152 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
6153 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
6154 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
6155 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6156 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
6157 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
6158 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
6159 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6160 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6161 + *
6162 + *  You should have received a copy of the  GNU General Public License along
6163 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
6164 + *  675 Mass Ave, Cambridge, MA 02139, USA.
6165 + *
6166 + *
6167 + **************************************************************************
6168 + * May 2004 P. Sadik.
6169 + *
6170 + * Initial Release
6171 + *
6172 + * 
6173 + *
6174 + **************************************************************************
6175 + */
6176 +
6177 +#ifndef __IDT_RC32365_H__
6178 +#define __IDT_RC32365_H__
6179 +
6180 +extern unsigned int cedar_za;
6181 +
6182 +/* Base address of internal registers */
6183 +#define RC32365_REG_BASE   0x18000000
6184 +
6185 +/* System ID Registers */
6186 +#define CPU_SYSID          (RC32365_REG_BASE + 0x00018)
6187 +#define CPU_DEVTYPE        (RC32365_REG_BASE + 0x0001c)
6188 +
6189 +/* Reset Controller */
6190 +#define RESET_CNTL         (RC32365_REG_BASE + 0x08000)
6191 +#define BOOT_VECTOR        (RC32365_REG_BASE + 0x08004)
6192 +
6193 +/* Device Controller */
6194 +#define DEV0_BASE          (RC32365_REG_BASE + 0x10000)
6195 +#define DEV0_MASK          (RC32365_REG_BASE + 0x10004)
6196 +#define DEV0_CNTL          (RC32365_REG_BASE + 0x10008)
6197 +#define DEV0_TIMING        (RC32365_REG_BASE + 0x1000c)
6198 +#define DEV_REG_OFFSET     0x10
6199 +
6200 +/* SDRAM Controller */
6201 +#define SDRAM0_BASE        (RC32365_REG_BASE + 0x18000)
6202 +#define SDRAM0_MASK        (RC32365_REG_BASE + 0x18004)
6203 +#define SDRAM1_BASE        (RC32365_REG_BASE + 0x18008)
6204 +#define SDRAM1_MASK        (RC32365_REG_BASE + 0x1800c)
6205 +#define SDRAM_CNTL         (RC32365_REG_BASE + 0x18010)
6206 +
6207 +/* Counters/Timers */
6208 +#define TIMER0_COUNT       (RC32365_REG_BASE + 0x20000)
6209 +#define TIMER0_COMPARE     (RC32365_REG_BASE + 0x20004)
6210 +#define TIMER0_CNTL        (RC32365_REG_BASE + 0x20008)
6211 +#define TIMER0_SELECT      (RC32365_REG_BASE + 0x2000c)
6212 +#define TIMER_REG_OFFSET   0x10
6213 +
6214 +/* System Integrity */
6215 +
6216 +/* Interrupt Controller */
6217 +#define IC_GROUP0_PEND     (RC32365_REG_BASE + 0x30000)
6218 +#define IC_GROUP0_TEST     (RC32365_REG_BASE + 0x30004)
6219 +#define IC_GROUP0_MASK     (RC32365_REG_BASE + 0x30008)
6220 +#define IC_GROUP_OFFSET    0x0c
6221 +
6222 +#define NUM_INTR_GROUPS    5
6223 +/*
6224 + * The IRQ mapping is as follows:
6225 + *
6226 + *    IRQ         Mapped To
6227 + *    ---     -------------------
6228 + *     0      SW0  (IP0) SW0 intr
6229 + *     1      SW1  (IP1) SW1 intr
6230 + *     -      Int0 (IP2) mapped to GROUP0_IRQ_BASE
6231 + *     -      Int1 (IP3) mapped to GROUP1_IRQ_BASE
6232 + *     -      Int2 (IP4) mapped to GROUP2_IRQ_BASE
6233 + *     -      Int3 (IP5) mapped to GROUP3_IRQ_BASE
6234 + *     -      Int4 (IP6) mapped to GROUP4_IRQ_BASE
6235 + *     7      Int5 (IP7) CP0 Timer
6236 + *
6237 + * IRQ's 8 and up are all mapped to Int0-4 (IP2-IP6), which
6238 + * internally on the RC32365 is routed to the Expansion
6239 + * Interrupt Controller.
6240 + */
6241 +#define MIPS_CPU_TIMER_IRQ 7
6242 +
6243 +#define GROUP0_IRQ_BASE  8                      // Counter/Timers, UCW
6244 +#define GROUP1_IRQ_BASE  (GROUP0_IRQ_BASE + 32) // DMA
6245 +#define GROUP2_IRQ_BASE  (GROUP1_IRQ_BASE + 32) // RNG, SEC
6246 +#define GROUP3_IRQ_BASE  (GROUP2_IRQ_BASE + 32) // Eth, PCI, UARTs
6247 +#define GROUP4_IRQ_BASE  (GROUP3_IRQ_BASE + 32) // GPIO
6248 +
6249 +#define RC32365_NR_IRQS  (GROUP4_IRQ_BASE + 32)
6250 +
6251 +/* DMA - see rc32365_dma.h for full list of registers */
6252 +
6253 +#define RC32365_DMA_BASE (RC32365_REG_BASE + 0x38000)
6254 +#define DMA_CHAN_OFFSET  0x14
6255 +
6256 +/* GPIO Controller */
6257 +#define idt_gpio              ((volatile GPIO_t) GPIO0_VirtualAddress)
6258 +
6259 +/* 16550 UARTs */
6260 +#ifdef __MIPSEB__
6261 +#define RC32300_UART0_BASE (RC32365_REG_BASE + 0x50003)
6262 +#else
6263 +#define RC32300_UART0_BASE (RC32365_REG_BASE + 0x50000)
6264 +#endif
6265 +#define RC32300_UART0_IRQ  (GROUP3_IRQ_BASE + 0)
6266 +
6267 +/* Ethernet - see rc32365_eth.h for full list of registers */
6268 +
6269 +#define RC32365_ETH_BASE   (RC32365_REG_BASE + 0x58000)
6270 +
6271 +#define IDT_CLOCK_MULT     2
6272 +
6273 +/* FLASH (device 1) */
6274 +#define FLASH_BASE         0x08000000
6275 +#define FLASH_SIZE         0x00800000
6276 +
6277 +/* LCD 4-digit display (device 2) */
6278 +#define LCD_DIGIT0         0x0C000003
6279 +#define LCD_DIGIT1         0x0C000002
6280 +#define LCD_DIGIT2         0x0C000001
6281 +#define LCD_DIGIT3         0x0C000000
6282 +
6283 +/* RTC (DS1553) (device 2) */
6284 +#define RTC_BASE           0x0c800000
6285 +/* NVRAM */
6286 +#define NVRAM_BASE         RTC_BASE
6287 +#define NVRAM_ENVSIZE_OFF  4
6288 +#define NVRAM_ENVSTART_OFF 32
6289 +
6290 +/* Interrupts routed on 79EB365 board */
6291 +#define RC32365_PCI_INTA_IRQ (GROUP4_IRQ_BASE +  8)
6292 +#define RC32365_PCI_INTB_IRQ (GROUP4_IRQ_BASE +  9)
6293 +#define RC32365_PCI_INTC_IRQ (GROUP4_IRQ_BASE + 10)
6294 +#define RC32365_PCI_INTD_IRQ (GROUP4_IRQ_BASE + 11)
6295 +
6296 +#define RAM_SIZE          (32 * 1024 * 1024)
6297 +
6298 +#endif //__IDT_RC32365_H__
6299 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_pci.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_pci.h
6300 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_pci.h      1970-01-01 01:00:00.000000000 +0100
6301 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_pci.h      2006-01-10 00:32:33.000000000 +0100
6302 @@ -0,0 +1,515 @@
6303 +/**************************************************************************
6304 + *
6305 + *  BRIEF MODULE DESCRIPTION
6306 + *   Datatype declaration for IDT 79EB365/336 PCI
6307 + *
6308 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
6309 + *         
6310 + *  This program is free software; you can redistribute  it and/or modify it
6311 + *  under  the terms of  the GNU General  Public License as published by the
6312 + *  Free Software Foundation;  either version 2 of the  License, or (at your
6313 + *  option) any later version.
6314 + *
6315 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
6316 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
6317 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
6318 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
6319 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6320 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
6321 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
6322 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
6323 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6324 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6325 + *
6326 + *  You should have received a copy of the  GNU General Public License along
6327 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
6328 + *  675 Mass Ave, Cambridge, MA 02139, USA.
6329 + *
6330 + *
6331 + **************************************************************************
6332 + * May 2004 P. Sadik.
6333 + *
6334 + * Initial Release
6335 + *
6336 + * 
6337 + *
6338 + **************************************************************************
6339 + */
6340 +
6341 +#ifndef __IDT_RC32365_PCI_H__
6342 +#define __IDT_RC32365_PCI_H__
6343 +
6344 +enum
6345 +{
6346 +       PCI0_PhysicalAddress    = 0x18068000,
6347 +       PCI_PhysicalAddress     = PCI0_PhysicalAddress,
6348 +       
6349 +       PCI0_VirtualAddress     = 0xb8068000,
6350 +       PCI_VirtualAddress      = PCI0_VirtualAddress,
6351 +} ;
6352 +
6353 +enum
6354 +{
6355 +       PCI_LbaCount    = 4,            // Local base addresses.
6356 +} ;
6357 +
6358 +typedef struct
6359 +{
6360 +       u32     a ;             // Address.
6361 +       u32     c ;             // Control.
6362 +       u32     m ;             // mapping.
6363 +} PCI_Map_s ;
6364 +
6365 +typedef struct
6366 +{
6367 +       u32             pcic ;
6368 +       u32             pcis ;
6369 +       u32             pcism ;
6370 +       u32             pcicfga ;
6371 +       u32             pcicfgd ;
6372 +       PCI_Map_s       pcilba [PCI_LbaCount] ;
6373 +       u32             pcidac ;
6374 +       u32             pcidas ;
6375 +       u32             pcidasm ;
6376 +       u32             pcidad ;
6377 +       u32             pcidma8c ;
6378 +       u32             pcidma9c ;
6379 +       u32             pcitc ;
6380 +} volatile *PCI_t ;
6381 +
6382 +// PCI messaging unit.
6383 +enum
6384 +{
6385 +       PCIM_Count      = 2,
6386 +} ;
6387 +typedef struct
6388 +{
6389 +       u32             pciim [PCIM_Count] ;
6390 +       u32             pciom [PCIM_Count] ;
6391 +       u32             pciid ;
6392 +       u32             pciiic ;
6393 +       u32             pciiim ;
6394 +       u32             pciiod ;
6395 +       u32             pciioic ;
6396 +       u32             pciioim ;
6397 +} volatile *PCIM_t ;
6398 +
6399 +/*******************************************************************************
6400 + *
6401 + * PCI Control Register
6402 + *
6403 + ******************************************************************************/
6404 +enum
6405 +{
6406 +       PCIC_en_b       = 0,
6407 +       PCIC_en_m       = 0x00000001,
6408 +       PCIC_tnr_b      = 1,
6409 +       PCIC_tnr_m      = 0x00000002,
6410 +       PCIC_sce_b      = 2,
6411 +       PCIC_sce_m      = 0x00000004,
6412 +       PCIC_ien_b      = 3,
6413 +       PCIC_ien_m      = 0x00000008,
6414 +       PCIC_aaa_b      = 4,
6415 +       PCIC_aaa_m      = 0x00000010,
6416 +       PCIC_eap_b      = 5,
6417 +       PCIC_eap_m      = 0x00000020,
6418 +       PCIC_pcim_b     = 6,
6419 +       PCIC_pcim_m     = 0x000001c0,
6420 +               PCIC_pcim_disabled_v    = 0,
6421 +               PCIC_pcim_tnr_v         = 1,    // Satellite - target not ready
6422 +               PCIC_pcim_suspend_v     = 2,    // Satellite - suspended CPU.
6423 +               PCIC_pcim_extern_v      = 3,    // Host - external arbiter.
6424 +               PCIC_pcim_fixed_v       = 4,    // Host - fixed priority arb.
6425 +               PCIC_pcim_roundrobin_v  = 5,    // Host - round robin priority.
6426 +               PCIC_pcim_reserved6_v   = 6,
6427 +               PCIC_pcim_reserved7_v   = 7,
6428 +       PCIC_igm_b      = 9,
6429 +       PCIC_igm_m      = 0x00000200,
6430 +} ;
6431 +
6432 +/*******************************************************************************
6433 + *
6434 + * PCI Status Register
6435 + *
6436 + ******************************************************************************/
6437 +enum {
6438 +       PCIS_eed_b      = 0,
6439 +       PCIS_eed_m      = 0x00000001,
6440 +       PCIS_wr_b       = 1,
6441 +       PCIS_wr_m       = 0x00000002,
6442 +       PCIS_nmi_b      = 2,
6443 +       PCIS_nmi_m      = 0x00000004,
6444 +       PCIS_ii_b       = 3,
6445 +       PCIS_ii_m       = 0x00000008,
6446 +       PCIS_cwe_b      = 4,
6447 +       PCIS_cwe_m      = 0x00000010,
6448 +       PCIS_cre_b      = 5,
6449 +       PCIS_cre_m      = 0x00000020,
6450 +       PCIS_mdpe_b     = 6,
6451 +       PCIS_mdpe_m     = 0x00000040,
6452 +       PCIS_sta_b      = 7,
6453 +       PCIS_sta_m      = 0x00000080,
6454 +       PCIS_rta_b      = 8,
6455 +       PCIS_rta_m      = 0x00000100,
6456 +       PCIS_rma_b      = 9,
6457 +       PCIS_rma_m      = 0x00000200,
6458 +       PCIS_sse_b      = 10,
6459 +       PCIS_sse_m      = 0x00000400,
6460 +       PCIS_ose_b      = 11,
6461 +       PCIS_ose_m      = 0x00000800,
6462 +       PCIS_pe_b       = 12,
6463 +       PCIS_pe_m       = 0x00001000,
6464 +       PCIS_tae_b      = 13,
6465 +       PCIS_tae_m      = 0x00002000,
6466 +       PCIS_rle_b      = 14,
6467 +       PCIS_rle_m      = 0x00004000,
6468 +       PCIS_bme_b      = 15,
6469 +       PCIS_bme_m      = 0x00008000,
6470 +       PCIS_prd_b      = 16,
6471 +       PCIS_prd_m      = 0x00010000,
6472 +       PCIS_rip_b      = 17,
6473 +       PCIS_rip_m      = 0x00020000,
6474 +} ;
6475 +
6476 +/*******************************************************************************
6477 + *
6478 + * PCI Status Mask Register
6479 + *
6480 + ******************************************************************************/
6481 +enum {
6482 +       PCISM_eed_b             = 0,
6483 +       PCISM_eed_m             = 0x00000001,
6484 +       PCISM_wr_b              = 1,
6485 +       PCISM_wr_m              = 0x00000002,
6486 +       PCISM_nmi_b             = 2,
6487 +       PCISM_nmi_m             = 0x00000004,
6488 +       PCISM_ii_b              = 3,
6489 +       PCISM_ii_m              = 0x00000008,
6490 +       PCISM_cwe_b             = 4,
6491 +       PCISM_cwe_m             = 0x00000010,
6492 +       PCISM_cre_b             = 5,
6493 +       PCISM_cre_m             = 0x00000020,
6494 +       PCISM_mdpe_b            = 6,
6495 +       PCISM_mdpe_m            = 0x00000040,
6496 +       PCISM_sta_b             = 7,
6497 +       PCISM_sta_m             = 0x00000080,
6498 +       PCISM_rta_b             = 8,
6499 +       PCISM_rta_m             = 0x00000100,
6500 +       PCISM_rma_b             = 9,
6501 +       PCISM_rma_m             = 0x00000200,
6502 +       PCISM_sse_b             = 10,
6503 +       PCISM_sse_m             = 0x00000400,
6504 +       PCISM_ose_b             = 11,
6505 +       PCISM_ose_m             = 0x00000800,
6506 +       PCISM_pe_b              = 12,
6507 +       PCISM_pe_m              = 0x00001000,
6508 +       PCISM_tae_b             = 13,
6509 +       PCISM_tae_m             = 0x00002000,
6510 +       PCISM_rle_b             = 14,
6511 +       PCISM_rle_m             = 0x00004000,
6512 +       PCISM_bme_b             = 15,
6513 +       PCISM_bme_m             = 0x00008000,
6514 +       PCISM_prd_b             = 16,
6515 +       PCISM_prd_m             = 0x00010000,
6516 +       PCISM_rip_b             = 17,
6517 +       PCISM_rip_m             = 0x00020000,
6518 +} ;
6519 +
6520 +/*******************************************************************************
6521 + *
6522 + * PCI Configuration Address Register
6523 + *
6524 + ******************************************************************************/
6525 +enum {
6526 +       PCICFGA_reg_b           = 2,
6527 +       PCICFGA_reg_m           = 0x000000fc,
6528 +       PCICFGA_reg_id_v        = 0x00>>2, //use PCFGID_
6529 +       PCICFGA_reg_04_v        = 0x04>>2, //use PCFG04_
6530 +       PCICFGA_reg_08_v        = 0x08>>2, //use PCFG08_
6531 +       PCICFGA_reg_0C_v        = 0x0C>>2, //use PCFG0C_
6532 +       PCICFGA_reg_pba0_v      = 0x10>>2, //use PCIPBA_
6533 +       PCICFGA_reg_pba1_v      = 0x14>>2, //use PCIPBA_
6534 +       PCICFGA_reg_pba2_v      = 0x18>>2, //use PCIPBA_
6535 +       PCICFGA_reg_pba3_v      = 0x1c>>2, //use PCIPBA_
6536 +       PCICFGA_reg_subsystem_v = 0x2c>>2, //use PCFGSS_
6537 +       PCICFGA_reg_3C_v        = 0x3C>>2, //use PCFG3C_
6538 +       PCICFGA_reg_pba0c_v     = 0x44>>2, //use PCIPBAC_
6539 +       PCICFGA_reg_pba0m_v     = 0x48>>2,
6540 +       PCICFGA_reg_pba1c_v     = 0x4c>>2, //use PCIPBAC_
6541 +       PCICFGA_reg_pba1m_v     = 0x50>>2,
6542 +       PCICFGA_reg_pba2c_v     = 0x54>>2, //use PCIPBAC_
6543 +       PCICFGA_reg_pba2m_v     = 0x58>>2,
6544 +       PCICFGA_reg_pba3c_v     = 0x5c>>2, //use PCIPBAC_
6545 +       PCICFGA_reg_pba3m_v     = 0x60>>2,
6546 +       PCICFGA_reg_pmgt_v      = 0x64>>2,
6547 +       PCICFGA_func_b          = 8,
6548 +       PCICFGA_func_m          = 0x00000700,
6549 +       PCICFGA_dev_b           = 11,
6550 +       PCICFGA_dev_m           = 0x0000f800,
6551 +       PCICFGA_dev_internal_v  = 0,
6552 +       PCICFGA_bus_b           = 16,
6553 +       PCICFGA_bus_m           = 0x00ff0000,
6554 +       PCICFGA_bus_type0_v     = 0,    //local bus
6555 +       PCICFGA_en_b            = 31,           // read only
6556 +       PCICFGA_en_m            = 0x80000000,
6557 +} ;
6558 +
6559 +enum {
6560 +       PCFGID_vendor_b         = 0,
6561 +       PCFGID_vendor_m         = 0x0000ffff,
6562 +       PCFGID_vendor_IDT_v             = 0x111d,
6563 +       PCFGID_device_b         = 16,
6564 +       PCFGID_device_m         = 0xffff0000,
6565 +       PCFGID_device_Acaciade_v        = 0x0207,
6566 +
6567 +       PCFG04_command_ioena_b          = 1,
6568 +       PCFG04_command_ioena_m          = 0x00000001,
6569 +       PCFG04_command_memena_b         = 2,
6570 +       PCFG04_command_memena_m         = 0x00000002,
6571 +       PCFG04_command_bmena_b          = 3,
6572 +       PCFG04_command_bmena_m          = 0x00000004,
6573 +       PCFG04_command_mwinv_b          = 5,
6574 +       PCFG04_command_mwinv_m          = 0x00000010,
6575 +       PCFG04_command_parena_b         = 7,
6576 +       PCFG04_command_parena_m         = 0x00000040,
6577 +       PCFG04_command_serrena_b        = 9,
6578 +       PCFG04_command_serrena_m        = 0x00000100,
6579 +       PCFG04_command_fastbbena_b      = 10,
6580 +       PCFG04_command_fastbbena_m      = 0x00000200,
6581 +       PCFG04_status_b                 = 16,
6582 +       PCFG04_status_m                 = 0xffff0000,
6583 +       PCFG04_status_66MHz_b           = 21,   // 66 MHz enable
6584 +       PCFG04_status_66MHz_m           = 0x00200000,
6585 +       PCFG04_status_fbb_b             = 23,
6586 +       PCFG04_status_fbb_m             = 0x00800000,
6587 +       PCFG04_status_mdpe_b            = 24,
6588 +       PCFG04_status_mdpe_m            = 0x01000000,
6589 +       PCFG04_status_dst_b             = 25,
6590 +       PCFG04_status_dst_m             = 0x06000000,
6591 +       PCFG04_status_sta_b             = 27,
6592 +       PCFG04_status_sta_m             = 0x08000000,
6593 +       PCFG04_status_rta_b             = 28,
6594 +       PCFG04_status_rta_m             = 0x10000000,
6595 +       PCFG04_status_rma_b             = 29,
6596 +       PCFG04_status_rma_m             = 0x20000000,
6597 +       PCFG04_status_sse_b             = 30,
6598 +       PCFG04_status_sse_m             = 0x40000000,
6599 +       PCFG04_status_pe_b              = 31,
6600 +       PCFG04_status_pe_m              = 0x40000000,
6601 +
6602 +       PCFG08_revId_b                  = 0,
6603 +       PCFG08_revId_m                  = 0x000000ff,
6604 +       PCFG08_classCode_b              = 0,
6605 +       PCFG08_classCode_m              = 0xffffff00,
6606 +       PCFG08_classCode_bridge_v       = 06,
6607 +       PCFG08_classCode_proc_v         = 0x0b3000, // processor-MIPS
6608 +       PCFG0C_cacheline_b              = 0,
6609 +       PCFG0C_cacheline_m              = 0x000000ff,
6610 +       PCFG0C_masterLatency_b          = 8,
6611 +       PCFG0C_masterLatency_m          = 0x0000ff00,
6612 +       PCFG0C_headerType_b             = 16,
6613 +       PCFG0C_headerType_m             = 0x00ff0000,
6614 +       PCFG0C_bist_b                   = 24,
6615 +       PCFG0C_bist_m                   = 0xff000000,
6616 +
6617 +       PCIPBA_msi_b                    = 0,
6618 +       PCIPBA_msi_m                    = 0x00000001,
6619 +       PCIPBA_p_b                      = 3,
6620 +       PCIPBA_p_m                      = 0x00000004,
6621 +       PCIPBA_baddr_b                  = 8,
6622 +       PCIPBA_baddr_m                  = 0xffffff00,
6623 +
6624 +       PCFGSS_vendorId_b               = 0,
6625 +       PCFGSS_vendorId_m               = 0x0000ffff,
6626 +       PCFGSS_id_b                     = 16,
6627 +       PCFGSS_id_m                     = 0xffff0000,
6628 +
6629 +       PCFG3C_interruptLine_b          = 0,
6630 +       PCFG3C_interruptLine_m          = 0x000000ff,
6631 +       PCFG3C_interruptPin_b           = 8,
6632 +       PCFG3C_interruptPin_m           = 0x0000ff00,
6633 +       PCFG3C_minGrant_b               = 16,
6634 +       PCFG3C_minGrant_m               = 0x00ff0000,
6635 +       PCFG3C_maxLat_b                 = 24,
6636 +       PCFG3C_maxLat_m                 = 0xff000000,
6637 +
6638 +       PCIPBAC_msi_b                   = 0,
6639 +       PCIPBAC_msi_m                   = 0x00000001,
6640 +       PCIPBAC_p_b                     = 1,
6641 +       PCIPBAC_p_m                     = 0x00000002,
6642 +       PCIPBAC_size_b                  = 2,
6643 +       PCIPBAC_size_m                  = 0x0000007c,
6644 +       PCIPBAC_sb_b                    = 7,
6645 +       PCIPBAC_sb_m                    = 0x00000080,
6646 +       PCIPBAC_pp_b                    = 8,
6647 +       PCIPBAC_pp_m                    = 0x00000100,
6648 +       PCIPBAC_mr_b                    = 9,
6649 +       PCIPBAC_mr_m                    = 0x00000600,
6650 +       PCIPBAC_mr_read_v       =0,     //no prefetching
6651 +       PCIPBAC_mr_readLine_v   =1,
6652 +       PCIPBAC_mr_readMult_v   =2,
6653 +       PCIPBAC_mrl_b                   = 11,
6654 +       PCIPBAC_mrl_m                   = 0x00000800,
6655 +       PCIPBAC_mrm_b                   = 12,
6656 +       PCIPBAC_mrm_m                   = 0x00001000,
6657 +       PCIPBAC_trp_b                   = 13,
6658 +       PCIPBAC_trp_m                   = 0x00002000,
6659 +
6660 +       PCFG40_trdyTimeout_b            = 0,
6661 +       PCFG40_trdyTimeout_m            = 0x000000ff,
6662 +       PCFG40_retryLim_b               = 8,
6663 +       PCFG40_retryLim_m               = 0x0000ff00,
6664 +};
6665 +
6666 +/*******************************************************************************
6667 + *
6668 + * PCI Local Base Address [0|1|2|3] Register
6669 + *
6670 + ******************************************************************************/
6671 +enum {
6672 +       PCILBA_baddr_b          = 0,            // In PCI_t -> pcilba [] .a
6673 +       PCILBA_baddr_m          = 0xffffff00,
6674 +} ;
6675 +/*******************************************************************************
6676 + *
6677 + * PCI Local Base Address Control Register
6678 + *
6679 + ******************************************************************************/
6680 +enum {
6681 +       PCILBAC_msi_b           = 0,            // In pPci->pcilba[i].c
6682 +       PCILBAC_msi_m           = 0x00000001,
6683 +       PCILBAC_msi_mem_v       = 0,
6684 +       PCILBAC_msi_io_v        = 1,
6685 +       PCILBAC_size_b          = 2,    // In pPci->pcilba[i].c
6686 +       PCILBAC_size_m          = 0x0000007c,
6687 +       PCILBAC_sb_b            = 7,    // In pPci->pcilba[i].c
6688 +       PCILBAC_sb_m            = 0x00000080,
6689 +       PCILBAC_rt_b            = 8,    // In pPci->pcilba[i].c
6690 +       PCILBAC_rt_m            = 0x00000100,
6691 +       PCILBAC_rt_noprefetch_v = 0, // mem read
6692 +       PCILBAC_rt_prefetch_v   = 1, // mem readline
6693 +} ;
6694 +
6695 +/*******************************************************************************
6696 + *
6697 + * PCI Local Base Address [0|1|2|3] Mapping Register
6698 + *
6699 + ******************************************************************************/
6700 +enum {
6701 +       PCILBAM_maddr_b         = 8,
6702 +       PCILBAM_maddr_m         = 0xffffff00,
6703 +} ;
6704 +
6705 +/*******************************************************************************
6706 + *
6707 + * PCI Decoupled Access Control Register
6708 + *
6709 + ******************************************************************************/
6710 +enum {
6711 +       PCIDAC_den_b            = 0,
6712 +       PCIDAC_den_m            = 0x00000001,
6713 +} ;
6714 +
6715 +/*******************************************************************************
6716 + *
6717 + * PCI Decoupled Access Status Register
6718 + *
6719 + ******************************************************************************/
6720 +enum {
6721 +       PCIDAS_d_b      = 0,
6722 +       PCIDAS_d_m      = 0x00000001,
6723 +       PCIDAS_b_b      = 1,
6724 +       PCIDAS_b_m      = 0x00000002,
6725 +       PCIDAS_e_b      = 2,
6726 +       PCIDAS_e_m      = 0x00000004,
6727 +       PCIDAS_ofe_b    = 3,
6728 +       PCIDAS_ofe_m    = 0x00000008,
6729 +       PCIDAS_off_b    = 4,
6730 +       PCIDAS_off_m    = 0x00000010,
6731 +       PCIDAS_ife_b    = 5,
6732 +       PCIDAS_ife_m    = 0x00000020,
6733 +       PCIDAS_iff_b    = 6,
6734 +       PCIDAS_iff_m    = 0x00000040,
6735 +} ;
6736 +
6737 +/*******************************************************************************
6738 + *
6739 + * PCI DMA Channel 8 Configuration Register
6740 + *
6741 + ******************************************************************************/
6742 +enum
6743 +{
6744 +       PCIDMA8C_mbs_b  = 0,            // Maximum Burst Size.
6745 +       PCIDMA8C_mbs_m  = 0x00000fff,   // { pcidma8c }
6746 +       PCIDMA8C_our_b  = 12,           // Optimize Unaligned Burst Reads.
6747 +       PCIDMA8C_our_m  = 0x00001000,   // { pcidma8c }
6748 +} ;
6749 +
6750 +/*******************************************************************************
6751 + *
6752 + * PCI DMA Channel 9 Configuration Register
6753 + *
6754 + ******************************************************************************/
6755 +enum
6756 +{
6757 +       PCIDMA9C_mbs_b  = 0,            // Maximum Burst Size.
6758 +       PCIDMA9C_mbs_m  = 0x00000fff, // { pcidma9c }
6759 +} ;
6760 +
6761 +/*******************************************************************************
6762 + *
6763 + * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors
6764 + *
6765 + ******************************************************************************/
6766 +enum {
6767 +       PCIDMAD_pt_b            = 22,           // in DEVCMD field (descriptor)
6768 +       PCIDMAD_pt_m            = 0x00c00000,   // preferred transaction field
6769 +       // These are for reads (DMA channel 8)
6770 +       PCIDMAD_devcmd_mr_v     = 0,    //memory read
6771 +       PCIDMAD_devcmd_mrl_v    = 1,    //memory read line
6772 +       PCIDMAD_devcmd_mrm_v    = 2,    //memory read multiple
6773 +       PCIDMAD_devcmd_ior_v    = 3,    //I/O read
6774 +       // These are for writes (DMA channel 9)
6775 +       PCIDMAD_devcmd_mw_v     = 0,    //memory write
6776 +       PCIDMAD_devcmd_mwi_v    = 1,    //memory write invalidate
6777 +       PCIDMAD_devcmd_iow_v    = 3,    //I/O write
6778 +       
6779 +       // Swap byte field applies to both DMA channel 8 and 9
6780 +       PCIDMAD_sb_b            = 24,           // in DEVCMD field (descriptor)
6781 +       PCIDMAD_sb_m            = 0x01000000,   // swap byte field
6782 +} ;
6783 +
6784 +
6785 +/*******************************************************************************
6786 + *
6787 + * PCI Target Control Register
6788 + *
6789 + ******************************************************************************/
6790 +enum
6791 +{
6792 +       PCITC_rtimer_b          = 0,            // In PCITC_t -> pcitc
6793 +       PCITC_rtimer_m          = 0x000000ff,
6794 +       PCITC_dtimer_b          = 8,            // In PCITC_t -> pcitc
6795 +       PCITC_dtimer_m          = 0x0000ff00,
6796 +       PCITC_rdr_b             = 18,           // In PCITC_t -> pcitc
6797 +       PCITC_rdr_m             = 0x00040000,
6798 +       PCITC_ddt_b             = 19,           // In PCITC_t -> pcitc
6799 +       PCITC_ddt_m             = 0x00080000,
6800 +} ;
6801 +/*******************************************************************************
6802 + *
6803 + * PCI messaging unit [applies to both inbound and outbound registers ]
6804 + *
6805 + ******************************************************************************/
6806 +enum
6807 +{
6808 +       PCIM_m0_b       = 0,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
6809 +       PCIM_m0_m       = 0x00000001,   // inbound or outbound message 0
6810 +       PCIM_m1_b       = 1,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
6811 +       PCIM_m1_m       = 0x00000002,   // inbound or outbound message 1
6812 +       PCIM_db_b       = 2,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
6813 +       PCIM_db_m       = 0x00000004,   // inbound or outbound doorbell
6814 +};
6815 +
6816 +
6817 +#endif // __IDT_RC32365_PCI_H__
6818 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_pci_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_pci_v.h
6819 --- linux-2.6.15/include/asm-mips/idt-boards/rc32300/rc32365_pci_v.h    1970-01-01 01:00:00.000000000 +0100
6820 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32300/rc32365_pci_v.h    2006-01-10 00:32:33.000000000 +0100
6821 @@ -0,0 +1,217 @@
6822 +/**************************************************************************
6823 + *
6824 + *  BRIEF MODULE DESCRIPTION
6825 + *   PCI header values for IDT 79EB365/336                                                   
6826 + *
6827 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
6828 + *         
6829 + *  This program is free software; you can redistribute  it and/or modify it
6830 + *  under  the terms of  the GNU General  Public License as published by the
6831 + *  Free Software Foundation;  either version 2 of the  License, or (at your
6832 + *  option) any later version.
6833 + *
6834 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
6835 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
6836 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
6837 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
6838 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
6839 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
6840 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
6841 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
6842 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
6843 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6844 + *
6845 + *  You should have received a copy of the  GNU General Public License along
6846 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
6847 + *  675 Mass Ave, Cambridge, MA 02139, USA.
6848 + *
6849 + *
6850 + **************************************************************************
6851 + * May 2004 P. Sadik.
6852 + *
6853 + * Initial Release
6854 + *
6855 + * 
6856 + *
6857 + **************************************************************************
6858 + */
6859 +
6860 +#ifndef __IDT_RC32365_PCI_V_H__
6861 +#define __IDT_RC32365_PCI_V_H__
6862 +
6863 +
6864 +#define PCI_MSG_VirtualAddress 0xB806C010
6865 +#define rc32365_pci ((volatile PCI_t) PCI0_VirtualAddress)
6866 +#define rc32365_pci_msg ((volatile PCIM_t) PCI_MSG_VirtualAddress)
6867 +
6868 +#define PCIM_SHFT              0x6
6869 +#define PCIM_BIT_LEN           0x7
6870 +#define PCIM_H_EA              0x3
6871 +#define PCIM_H_IA_FIX          0x4
6872 +#define PCIM_H_IA_RR           0x5
6873 +
6874 +#define PCI_ADDR_START         0x50000000
6875 +
6876 +#define CPUTOPCI_MEM_WIN       0x02000000
6877 +#define CPUTOPCI_IO_WIN                0x00100000
6878 +#define PCILBA_SIZE_SHFT       2
6879 +#define PCILBA_SIZE_MASK       0x1F
6880 +#define SIZE_256MB             0x1C
6881 +#define SIZE_128MB             0x1B
6882 +#define SIZE_64MB               0x1A
6883 +#define SIZE_32MB              0x19
6884 +#define SIZE_16MB               0x18
6885 +#define SIZE_4MB               0x16
6886 +#define SIZE_2MB               0x15
6887 +#define SIZE_1MB               0x14
6888 +#define CEDAR_CONFIG0_ADDR     0x80000000
6889 +#define CEDAR_CONFIG1_ADDR     0x80000004
6890 +#define CEDAR_CONFIG2_ADDR     0x80000008
6891 +#define CEDAR_CONFIG3_ADDR     0x8000000C
6892 +#define CEDAR_CONFIG4_ADDR     0x80000010
6893 +#define CEDAR_CONFIG5_ADDR     0x80000014
6894 +#define CEDAR_CONFIG6_ADDR     0x80000018
6895 +#define CEDAR_CONFIG7_ADDR     0x8000001C
6896 +#define CEDAR_CONFIG8_ADDR     0x80000020
6897 +#define CEDAR_CONFIG9_ADDR     0x80000024
6898 +#define CEDAR_CONFIG10_ADDR    0x80000028
6899 +#define CEDAR_CONFIG11_ADDR    0x8000002C
6900 +#define CEDAR_CONFIG12_ADDR    0x80000030
6901 +#define CEDAR_CONFIG13_ADDR    0x80000034
6902 +#define CEDAR_CONFIG14_ADDR    0x80000038
6903 +#define CEDAR_CONFIG15_ADDR    0x8000003C
6904 +#define CEDAR_CONFIG16_ADDR    0x80000040
6905 +#define CEDAR_CONFIG17_ADDR    0x80000044
6906 +#define CEDAR_CONFIG18_ADDR    0x80000048
6907 +#define CEDAR_CONFIG19_ADDR    0x8000004C
6908 +#define CEDAR_CONFIG20_ADDR    0x80000050
6909 +#define CEDAR_CONFIG21_ADDR    0x80000054
6910 +#define CEDAR_CONFIG22_ADDR    0x80000058
6911 +#define CEDAR_CONFIG23_ADDR    0x8000005C
6912 +#define CEDAR_CONFIG24_ADDR    0x80000060
6913 +#define CEDAR_CONFIG25_ADDR    0x80000064
6914 +#define CEDAR_CMD             (PCFG04_command_ioena_m  | \
6915 +                               PCFG04_command_memena_m | \
6916 +                               PCFG04_command_bmena_m  | \
6917 +                               PCFG04_command_mwinv_m  | \
6918 +                               PCFG04_command_parena_m | \
6919 +                               PCFG04_command_serrena_m )
6920 +
6921 +#define CEDAR_STAT            (PCFG04_status_mdpe_m | \
6922 +                               PCFG04_status_sta_m  | \
6923 +                               PCFG04_status_rta_m  | \
6924 +                               PCFG04_status_rma_m  | \
6925 +                               PCFG04_status_sse_m  | \
6926 +                               PCFG04_status_pe_m)
6927 +
6928 +#define CEDAR_CNFG1          ((CEDAR_STAT << 16) | \
6929 +                                CEDAR_CMD)
6930 +
6931 +#define CEDAR_REVID            0
6932 +#define CEDAR_CLASS_CODE       0
6933 +#define CEDAR_CNFG2          ((CEDAR_CLASS_CODE << 8) | \
6934 +                               CEDAR_REVID)
6935 +
6936 +#define CEDAR_CACHE_LINE_SIZE  4
6937 +#define CEDAR_MASTER_LAT       0x3c
6938 +#define CEDAR_HEADER_TYPE      0
6939 +#define CEDAR_BIST             0
6940 +
6941 +#define CEDAR_CNFG3           ((CEDAR_BIST        << 24) | \
6942 +                              (CEDAR_HEADER_TYPE << 16) | \
6943 +                              (CEDAR_MASTER_LAT  <<  8) | \
6944 +                               CEDAR_CACHE_LINE_SIZE)
6945 +
6946 +#define CEDAR_BAR0             0x00000008 /* 128 MB Memory */
6947 +#define CEDAR_BAR1             0x18800001 /* 1 MB IO */
6948 +#define CEDAR_BAR2             0x18000001 /* 2 MB IO window for Cedar
6949 +                                             internal Registers */
6950 +#define CEDAR_BAR3             0x48000008 /* Spare 128 MB Memory */
6951 +
6952 +#define CEDAR_CNFG4            CEDAR_BAR0
6953 +#define CEDAR_CNFG5             CEDAR_BAR1
6954 +#define CEDAR_CNFG6            CEDAR_BAR2
6955 +#define CEDAR_CNFG7            CEDAR_BAR3
6956 +
6957 +#define CEDAR_SUBSYS_VENDOR_ID  0
6958 +#define CEDAR_SUBSYSTEM_ID     0
6959 +#define CEDAR_CNFG8            0
6960 +#define CEDAR_CNFG9            0
6961 +#define CEDAR_CNFG10           0
6962 +#define CEDAR_CNFG11         ((CEDAR_SUBSYS_VENDOR_ID << 16) | \
6963 +                               CEDAR_SUBSYSTEM_ID)
6964 +#define CEDAR_INT_LINE         1
6965 +#define CEDAR_INT_PIN          1
6966 +#define CEDAR_MIN_GNT          8
6967 +#define CEDAR_MAX_LAT          0x38
6968 +#define CEDAR_CNFG12           0
6969 +#define CEDAR_CNFG13           0
6970 +#define CEDAR_CNFG14           0
6971 +#define CEDAR_CNFG15         ((CEDAR_MAX_LAT << 24) | \
6972 +                              (CEDAR_MIN_GNT << 16) | \
6973 +                              (CEDAR_INT_PIN <<  8) | \
6974 +                               CEDAR_INT_LINE)
6975 +#define        CEDAR_RETRY_LIMIT       0x80
6976 +#define CEDAR_TRDY_LIMIT       0x80
6977 +#define CEDAR_CNFG16          ((CEDAR_RETRY_LIMIT << 8) | \
6978 +                               CEDAR_TRDY_LIMIT)
6979 +#define PCI_PBAxC_R            0x0
6980 +#define PCI_PBAxC_RL           0x1
6981 +#define PCI_PBAxC_RM           0x2
6982 +#define SIZE_SHFT              2
6983 +#ifdef __MIPSEB__
6984 +#define CEDAR_PBA0C           (((1 & 0x3) << PCIPBAC_mr_b) | \
6985 +                               PCIPBAC_pp_m | \
6986 +                               PCIPBAC_sb_m | \
6987 +                              (SIZE_128MB << SIZE_SHFT) | \
6988 +                               PCIPBAC_p_m)
6989 +#else
6990 +
6991 +#define CEDAR_PBA0C           (((1 & 0x3) << PCIPBAC_mr_b) | \
6992 +                               PCIPBAC_pp_m | \
6993 +                              (SIZE_128MB << SIZE_SHFT) | \
6994 +                               PCIPBAC_p_m)
6995 +#endif
6996 +#define CEDAR_CNFG17           CEDAR_PBA0C
6997 +#define CEDAR_PBA0M            0x0
6998 +#define CEDAR_CNFG18           CEDAR_PBA0M
6999 +
7000 +#ifdef __MIPSEB__
7001 +#define CEDAR_PBA1C          ((SIZE_1MB << SIZE_SHFT) | \
7002 +                               PCIPBAC_sb_m | \
7003 +                               PCIPBAC_msi_m)
7004 +#else
7005 +#define CEDAR_PBA1C          ((SIZE_1MB << SIZE_SHFT) | \
7006 +                               PCIPBAC_msi_m)
7007 +#endif
7008 +#define CEDAR_CNFG19           CEDAR_PBA1C
7009 +#define CEDAR_PBA1M            0x0
7010 +#define CEDAR_CNFG20           CEDAR_PBA1M
7011 +
7012 +#ifdef __MIPSEB__
7013 +#define CEDAR_PBA2C          ((SIZE_2MB << SIZE_SHFT) |  \
7014 +                               PCIPBAC_sb_m | \
7015 +                               PCIPBAC_msi_m)
7016 +#else
7017 +#define CEDAR_PBA2C          ((SIZE_2MB << SIZE_SHFT) |  \
7018 +                               PCIPBAC_msi_m)
7019 +#endif
7020 +
7021 +#define CEDAR_CNFG21           CEDAR_PBA2C
7022 +#define CEDAR_PBA2M            0x18000000
7023 +#define CEDAR_CNFG22           CEDAR_PBA2M
7024 +
7025 +#ifdef __MIPSEB__
7026 +#define CEDAR_PBA3C            PCIPBAC_sb_m
7027 +#else
7028 +#define CEDAR_PBA3C            0 
7029 +#endif
7030 +
7031 +#define CEDAR_CNFG23           CEDAR_PBA3C
7032 +#define CEDAR_PBA3M            0
7033 +#define CEDAR_CNFG24           CEDAR_PBA3M
7034 +
7035 +#define        PCITC_DTIMER_VAL        8
7036 +#define PCITC_RTIMER_VAL       0x10
7037 +
7038 +#endif //__IDT_RC32365_PCI_V_H__
7039 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_dma.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_dma.h
7040 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_dma.h      1970-01-01 01:00:00.000000000 +0100
7041 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_dma.h      2006-01-10 00:32:33.000000000 +0100
7042 @@ -0,0 +1,205 @@
7043 +/**************************************************************************
7044 + *
7045 + *  BRIEF MODULE DESCRIPTION
7046 + *   DMA register definition
7047 + *
7048 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7049 + *         
7050 + *  This program is free software; you can redistribute  it and/or modify it
7051 + *  under  the terms of  the GNU General  Public License as published by the
7052 + *  Free Software Foundation;  either version 2 of the  License, or (at your
7053 + *  option) any later version.
7054 + *
7055 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
7056 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
7057 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
7058 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
7059 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
7060 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
7061 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
7062 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
7063 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7064 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7065 + *
7066 + *  You should have received a copy of the  GNU General Public License along
7067 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
7068 + *  675 Mass Ave, Cambridge, MA 02139, USA.
7069 + *
7070 + *
7071 + **************************************************************************
7072 + * May 2004 rkt, neb
7073 + *
7074 + * Initial Release
7075 + *
7076 + * 
7077 + *
7078 + **************************************************************************
7079 + */
7080 +
7081 +#ifndef __IDT_DMA_H__
7082 +#define __IDT_DMA_H__
7083 +
7084 +enum
7085 +{
7086 +       DMA0_PhysicalAddress    = 0x18040000,
7087 +       DMA_PhysicalAddress     = DMA0_PhysicalAddress,         // Default
7088 +
7089 +       DMA0_VirtualAddress     = 0xb8040000,
7090 +       DMA_VirtualAddress      = DMA0_VirtualAddress,          // Default
7091 +} ;
7092 +
7093 +/*
7094 + * DMA descriptor (in physical memory).
7095 + */
7096 +
7097 +typedef struct DMAD_s
7098 +{
7099 +       u32                     control ;       // Control. use DMAD_*
7100 +       u32                     ca ;            // Current Address.
7101 +       u32                     devcs ;         // Device control and status.
7102 +       u32                     link ;          // Next descriptor in chain.
7103 +} volatile *DMAD_t ;
7104 +
7105 +enum
7106 +{
7107 +       DMAD_size               = sizeof (struct DMAD_s),
7108 +       DMAD_count_b            = 0,            // in DMAD_t -> control
7109 +       DMAD_count_m            = 0x0003ffff,   // in DMAD_t -> control
7110 +       DMAD_ds_b               = 20,           // in DMAD_t -> control
7111 +       DMAD_ds_m               = 0x00300000,   // in DMAD_t -> control
7112 +               DMAD_ds_ethRcv0_v       = 0,
7113 +               DMAD_ds_ethXmt0_v       = 0,
7114 +               DMAD_ds_memToFifo_v     = 0,
7115 +               DMAD_ds_fifoToMem_v     = 0,
7116 +               DMAD_ds_pciToMem_v      = 0,
7117 +               DMAD_ds_memToPci_v      = 0,
7118 +       
7119 +       DMAD_devcmd_b           = 22,           // in DMAD_t -> control
7120 +       DMAD_devcmd_m           = 0x01c00000,   // in DMAD_t -> control
7121 +               DMAD_devcmd_byte_v      = 0,    //memory-to-memory
7122 +               DMAD_devcmd_halfword_v  = 1,    //memory-to-memory
7123 +               DMAD_devcmd_word_v      = 2,    //memory-to-memory
7124 +               DMAD_devcmd_2words_v    = 3,    //memory-to-memory
7125 +               DMAD_devcmd_4words_v    = 4,    //memory-to-memory
7126 +               DMAD_devcmd_6words_v    = 5,    //memory-to-memory
7127 +               DMAD_devcmd_8words_v    = 6,    //memory-to-memory
7128 +               DMAD_devcmd_16words_v   = 7,    //memory-to-memory
7129 +       DMAD_cof_b              = 25,           // chain on finished
7130 +       DMAD_cof_m              = 0x02000000,   // 
7131 +       DMAD_cod_b              = 26,           // chain on done
7132 +       DMAD_cod_m              = 0x04000000,   // 
7133 +       DMAD_iof_b              = 27,           // interrupt on finished
7134 +       DMAD_iof_m              = 0x08000000,   // 
7135 +       DMAD_iod_b              = 28,           // interrupt on done
7136 +       DMAD_iod_m              = 0x10000000,   // 
7137 +       DMAD_t_b                = 29,           // terminated
7138 +       DMAD_t_m                = 0x20000000,   // 
7139 +       DMAD_d_b                = 30,           // done
7140 +       DMAD_d_m                = 0x40000000,   // 
7141 +       DMAD_f_b                = 31,           // finished
7142 +       DMAD_f_m                = 0x80000000,   // 
7143 +} ;
7144 +
7145 +/*
7146 + * DMA register (within Internal Register Map).
7147 + */
7148 +
7149 +struct DMA_Chan_s
7150 +{
7151 +       u32             dmac ;          // Control.
7152 +       u32             dmas ;          // Status.      
7153 +       u32             dmasm ;         // Mask.
7154 +       u32             dmadptr ;       // Descriptor pointer.
7155 +       u32             dmandptr ;      // Next descriptor pointer.
7156 +};
7157 +
7158 +typedef struct DMA_Chan_s volatile *DMA_Chan_t ;
7159 +
7160 +//DMA_Channels   use DMACH_count instead
7161 +
7162 +enum
7163 +{
7164 +       DMAC_run_b      = 0,            // 
7165 +       DMAC_run_m      = 0x00000001,   // 
7166 +       DMAC_dm_b       = 1,            // done mask
7167 +       DMAC_dm_m       = 0x00000002,   // 
7168 +       DMAC_mode_b     = 2,            // 
7169 +       DMAC_mode_m     = 0x0000000c,   // 
7170 +               DMAC_mode_auto_v        = 0,
7171 +               DMAC_mode_burst_v       = 1,
7172 +               DMAC_mode_transfer_v    = 2, //usually used
7173 +               DMAC_mode_reserved_v    = 3,
7174 +       DMAC_a_b        = 4,            // 
7175 +       DMAC_a_m        = 0x00000010,   // 
7176 +
7177 +       DMAS_f_b        = 0,            // finished (sticky) 
7178 +       DMAS_f_m        = 0x00000001,   //                   
7179 +       DMAS_d_b        = 1,            // done (sticky)     
7180 +       DMAS_d_m        = 0x00000002,   //                   
7181 +       DMAS_c_b        = 2,            // chain (sticky)    
7182 +       DMAS_c_m        = 0x00000004,   //                   
7183 +       DMAS_e_b        = 3,            // error (sticky)    
7184 +       DMAS_e_m        = 0x00000008,   //                   
7185 +       DMAS_h_b        = 4,            // halt (sticky)     
7186 +       DMAS_h_m        = 0x00000010,   //                   
7187 +
7188 +       DMASM_f_b       = 0,            // finished (1=mask)
7189 +       DMASM_f_m       = 0x00000001,   // 
7190 +       DMASM_d_b       = 1,            // done (1=mask)
7191 +       DMASM_d_m       = 0x00000002,   // 
7192 +       DMASM_c_b       = 2,            // chain (1=mask)
7193 +       DMASM_c_m       = 0x00000004,   // 
7194 +       DMASM_e_b       = 3,            // error (1=mask)
7195 +       DMASM_e_m       = 0x00000008,   // 
7196 +       DMASM_h_b       = 4,            // halt (1=mask)
7197 +       DMASM_h_m       = 0x00000010,   // 
7198 +} ;
7199 +
7200 +/*
7201 + * DMA channel definitions
7202 + */
7203 +
7204 +enum
7205 +{
7206 +       DMACH_ethRcv0 = 0,
7207 +       DMACH_ethXmt0 = 1,
7208 +       DMACH_memToFifo = 2,
7209 +       DMACH_fifoToMem = 3,
7210 +       DMACH_pciToMem = 4,
7211 +       DMACH_memToPci = 5,
7212 +
7213 +       DMACH_count //must be last
7214 +};
7215 +
7216 +
7217 +typedef struct DMAC_s
7218 +{
7219 +       struct DMA_Chan_s ch [DMACH_count] ; //use ch[DMACH_]
7220 +} volatile *DMA_t ;
7221 +
7222 +
7223 +/*
7224 + * External DMA parameters
7225 +*/
7226 +
7227 +enum
7228 +{
7229 +       DMADEVCMD_ts_b  = 0,            // ts field in devcmd
7230 +       DMADEVCMD_ts_m  = 0x00000007,   // ts field in devcmd
7231 +               DMADEVCMD_ts_byte_v     = 0,
7232 +               DMADEVCMD_ts_halfword_v = 1,
7233 +               DMADEVCMD_ts_word_v     = 2,
7234 +               DMADEVCMD_ts_2word_v    = 3,
7235 +               DMADEVCMD_ts_4word_v    = 4,
7236 +               DMADEVCMD_ts_6word_v    = 5,
7237 +               DMADEVCMD_ts_8word_v    = 6,
7238 +               DMADEVCMD_ts_16word_v   = 7
7239 +};
7240 +
7241 +
7242 +#endif // __IDT_DMA_H__
7243 +
7244 +
7245 +
7246 +
7247 +
7248 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_dma_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_dma_v.h
7249 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_dma_v.h    1970-01-01 01:00:00.000000000 +0100
7250 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_dma_v.h    2006-01-10 00:32:33.000000000 +0100
7251 @@ -0,0 +1,89 @@
7252 +/**************************************************************************
7253 + *
7254 + *  BRIEF MODULE DESCRIPTION
7255 + *   Definitions for DMA controller.
7256 + *
7257 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7258 + *         
7259 + *  This program is free software; you can redistribute  it and/or modify it
7260 + *  under  the terms of  the GNU General  Public License as published by the
7261 + *  Free Software Foundation;  either version 2 of the  License, or (at your
7262 + *  option) any later version.
7263 + *
7264 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
7265 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
7266 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
7267 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
7268 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
7269 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
7270 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
7271 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
7272 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7273 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7274 + *
7275 + *  You should have received a copy of the  GNU General Public License along
7276 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
7277 + *  675 Mass Ave, Cambridge, MA 02139, USA.
7278 + *
7279 + *
7280 + **************************************************************************
7281 + * May 2004 rkt, neb.
7282 + *
7283 + * Initial Release
7284 + *
7285 + * 
7286 + *
7287 + **************************************************************************
7288 + */
7289 +
7290 +#ifndef __IDT_DMA_V_H__
7291 +#define __IDT_DMA_V_H__
7292 +
7293 +#include  <asm/idt-boards/rc32434/rc32434_dma.h> 
7294 +#include  <asm/idt-boards/rc32434/rc32434.h>
7295 +
7296 +#define DMA_CHAN_OFFSET  0x14
7297 +#define IS_DMA_USED(X) (((X) & (DMAD_f_m | DMAD_d_m | DMAD_t_m)) != 0)
7298 +#define DMA_COUNT(count)   \
7299 +  ((count) & DMAD_count_m)
7300 +
7301 +#define DMA_HALT_TIMEOUT 500
7302 +
7303 +
7304 +static inline int rc32434_halt_dma(DMA_Chan_t ch)
7305 +{
7306 +       int timeout=1;
7307 +       if (rc32434_readl(&ch->dmac) & DMAC_run_m) {
7308 +               rc32434_writel(0, &ch->dmac); 
7309 +               
7310 +               for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
7311 +                       if (rc32434_readl(&ch->dmas) & DMAS_h_m) {
7312 +                               rc32434_writel(0, &ch->dmas);  
7313 +                               break;
7314 +                       }
7315 +               }
7316 +
7317 +       }
7318 +       
7319 +       return timeout ? 0 : 1;
7320 +}
7321 +
7322 +static inline void rc32434_start_dma(DMA_Chan_t ch, u32 dma_addr)
7323 +{
7324 +       rc32434_writel(0, &ch->dmandptr); 
7325 +       rc32434_writel(dma_addr, &ch->dmadptr);
7326 +}
7327 +
7328 +static inline void rc32434_chain_dma(DMA_Chan_t ch, u32 dma_addr)
7329 +{
7330 +       rc32434_writel(dma_addr, &ch->dmandptr);
7331 +}
7332 +
7333 +#endif // __IDT_DMA_V_H__
7334 +
7335 +
7336 +
7337 +
7338 +
7339 +
7340 +
7341 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_eth.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_eth.h
7342 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_eth.h      1970-01-01 01:00:00.000000000 +0100
7343 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_eth.h      2006-01-10 00:32:33.000000000 +0100
7344 @@ -0,0 +1,333 @@
7345 +/**************************************************************************
7346 + *
7347 + *  BRIEF MODULE DESCRIPTION
7348 + *   Ethernet register definition
7349 + *
7350 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7351 + *         
7352 + *  This program is free software; you can redistribute  it and/or modify it
7353 + *  under  the terms of  the GNU General  Public License as published by the
7354 + *  Free Software Foundation;  either version 2 of the  License, or (at your
7355 + *  option) any later version.
7356 + *
7357 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
7358 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
7359 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
7360 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
7361 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
7362 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
7363 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
7364 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
7365 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7366 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7367 + *
7368 + *  You should have received a copy of the  GNU General Public License along
7369 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
7370 + *  675 Mass Ave, Cambridge, MA 02139, USA.
7371 + *
7372 + *
7373 + **************************************************************************
7374 + * May 2004 rkt, neb.
7375 + *
7376 + * Initial Release
7377 + *
7378 + * 
7379 + *
7380 + **************************************************************************
7381 + */
7382 +
7383 +#ifndef        __IDT_ETH_H__
7384 +#define        __IDT_ETH_H__
7385 +
7386 +
7387 +enum
7388 +{
7389 +       ETH0_PhysicalAddress    = 0x18060000,
7390 +       ETH_PhysicalAddress     = ETH0_PhysicalAddress,         // Default
7391 +
7392 +       ETH0_VirtualAddress     = 0xb8060000,
7393 +       ETH_VirtualAddress      = ETH0_VirtualAddress,          // Default
7394 +} ;
7395 +
7396 +typedef struct
7397 +{
7398 +       u32 ethintfc            ;
7399 +       u32 ethfifott           ;
7400 +       u32 etharc              ;
7401 +       u32 ethhash0            ;
7402 +       u32 ethhash1            ;
7403 +       u32 ethu0 [4]           ;       // Reserved.    
7404 +       u32 ethpfs              ;
7405 +       u32 ethmcp              ;
7406 +       u32 eth_u1 [10]         ;       // Reserved.
7407 +       u32 ethspare            ;
7408 +       u32 eth_u2 [42]         ;       // Reserved. 
7409 +       u32 ethsal0             ;
7410 +       u32 ethsah0             ;
7411 +       u32 ethsal1             ;
7412 +       u32 ethsah1             ;
7413 +       u32 ethsal2             ;
7414 +       u32 ethsah2             ;
7415 +       u32 ethsal3             ;
7416 +       u32 ethsah3             ;
7417 +       u32 ethrbc              ;
7418 +       u32 ethrpc              ;
7419 +       u32 ethrupc             ;
7420 +       u32 ethrfc              ;
7421 +       u32 ethtbc              ;
7422 +       u32 ethgpf              ;
7423 +       u32 eth_u9 [50]         ;       // Reserved.    
7424 +       u32 ethmac1             ;
7425 +       u32 ethmac2             ;
7426 +       u32 ethipgt             ;
7427 +       u32 ethipgr             ;
7428 +       u32 ethclrt             ;
7429 +       u32 ethmaxf             ;
7430 +       u32 eth_u10             ;       // Reserved.    
7431 +       u32 ethmtest            ;
7432 +       u32 miimcfg             ;
7433 +       u32 miimcmd             ;
7434 +       u32 miimaddr            ;
7435 +       u32 miimwtd             ;
7436 +       u32 miimrdd             ;
7437 +       u32 miimind             ;
7438 +       u32 eth_u11             ;       // Reserved.
7439 +       u32 eth_u12             ;       // Reserved.
7440 +       u32 ethcfsa0            ;
7441 +       u32 ethcfsa1            ;
7442 +       u32 ethcfsa2            ;
7443 +} volatile *ETH_t;
7444 +
7445 +enum
7446 +{
7447 +       ETHINTFC_en_b           = 0,
7448 +       ETHINTFC_en_m           = 0x00000001,
7449 +       ETHINTFC_its_b          = 1,
7450 +       ETHINTFC_its_m          = 0x00000002,
7451 +       ETHINTFC_rip_b          = 2,
7452 +       ETHINTFC_rip_m          = 0x00000004,
7453 +       ETHINTFC_jam_b          = 3,
7454 +       ETHINTFC_jam_m          = 0x00000008,
7455 +       ETHINTFC_ovr_b          = 4,
7456 +       ETHINTFC_ovr_m          = 0x00000010,
7457 +       ETHINTFC_und_b          = 5,
7458 +       ETHINTFC_und_m          = 0x00000020,
7459 +
7460 +       ETHFIFOTT_tth_b         = 0,
7461 +       ETHFIFOTT_tth_m         = 0x0000007f,
7462 +
7463 +       ETHARC_pro_b            = 0,
7464 +       ETHARC_pro_m            = 0x00000001,
7465 +       ETHARC_am_b             = 1,
7466 +       ETHARC_am_m             = 0x00000002,
7467 +       ETHARC_afm_b            = 2,
7468 +       ETHARC_afm_m            = 0x00000004,
7469 +       ETHARC_ab_b             = 3,
7470 +       ETHARC_ab_m             = 0x00000008,
7471 +
7472 +       ETHSAL_byte5_b          = 0,
7473 +       ETHSAL_byte5_m          = 0x000000ff,
7474 +       ETHSAL_byte4_b          = 8,
7475 +       ETHSAL_byte4_m          = 0x0000ff00,
7476 +       ETHSAL_byte3_b          = 16,
7477 +       ETHSAL_byte3_m          = 0x00ff0000,
7478 +       ETHSAL_byte2_b          = 24,
7479 +       ETHSAL_byte2_m          = 0xff000000,
7480 +
7481 +       ETHSAH_byte1_b          = 0,
7482 +       ETHSAH_byte1_m          = 0x000000ff,
7483 +       ETHSAH_byte0_b          = 8,
7484 +       ETHSAH_byte0_m          = 0x0000ff00,
7485 +       
7486 +       ETHGPF_ptv_b            = 0,
7487 +       ETHGPF_ptv_m            = 0x0000ffff,
7488 +
7489 +       ETHPFS_pfd_b            = 0,
7490 +       ETHPFS_pfd_m            = 0x00000001,
7491 +
7492 +       ETHCFSA0_cfsa4_b        = 0,
7493 +       ETHCFSA0_cfsa4_m        = 0x000000ff,
7494 +       ETHCFSA0_cfsa5_b        = 8,
7495 +       ETHCFSA0_cfsa5_m        = 0x0000ff00,
7496 +
7497 +       ETHCFSA1_cfsa2_b        = 0,
7498 +       ETHCFSA1_cfsa2_m        = 0x000000ff,
7499 +       ETHCFSA1_cfsa3_b        = 8,
7500 +       ETHCFSA1_cfsa3_m        = 0x0000ff00,
7501 +
7502 +       ETHCFSA2_cfsa0_b        = 0,
7503 +       ETHCFSA2_cfsa0_m        = 0x000000ff,
7504 +       ETHCFSA2_cfsa1_b        = 8,
7505 +       ETHCFSA2_cfsa1_m        = 0x0000ff00,
7506 +
7507 +       ETHMAC1_re_b            = 0,
7508 +       ETHMAC1_re_m            = 0x00000001,
7509 +       ETHMAC1_paf_b           = 1,
7510 +       ETHMAC1_paf_m           = 0x00000002,
7511 +       ETHMAC1_rfc_b           = 2,
7512 +       ETHMAC1_rfc_m           = 0x00000004,
7513 +       ETHMAC1_tfc_b           = 3,
7514 +       ETHMAC1_tfc_m           = 0x00000008,
7515 +       ETHMAC1_lb_b            = 4,
7516 +       ETHMAC1_lb_m            = 0x00000010,
7517 +       ETHMAC1_mr_b            = 31,
7518 +       ETHMAC1_mr_m            = 0x80000000,
7519 +
7520 +       ETHMAC2_fd_b            = 0,
7521 +       ETHMAC2_fd_m            = 0x00000001,
7522 +       ETHMAC2_flc_b           = 1,
7523 +       ETHMAC2_flc_m           = 0x00000002,
7524 +       ETHMAC2_hfe_b           = 2,
7525 +       ETHMAC2_hfe_m           = 0x00000004,
7526 +       ETHMAC2_dc_b            = 3,
7527 +       ETHMAC2_dc_m            = 0x00000008,
7528 +       ETHMAC2_cen_b           = 4,
7529 +       ETHMAC2_cen_m           = 0x00000010,
7530 +       ETHMAC2_pe_b            = 5,
7531 +       ETHMAC2_pe_m            = 0x00000020,
7532 +       ETHMAC2_vpe_b           = 6,
7533 +       ETHMAC2_vpe_m           = 0x00000040,
7534 +       ETHMAC2_ape_b           = 7,
7535 +       ETHMAC2_ape_m           = 0x00000080,
7536 +       ETHMAC2_ppe_b           = 8,
7537 +       ETHMAC2_ppe_m           = 0x00000100,
7538 +       ETHMAC2_lpe_b           = 9,
7539 +       ETHMAC2_lpe_m           = 0x00000200,
7540 +       ETHMAC2_nb_b            = 12,
7541 +       ETHMAC2_nb_m            = 0x00001000,
7542 +       ETHMAC2_bp_b            = 13,
7543 +       ETHMAC2_bp_m            = 0x00002000,
7544 +       ETHMAC2_ed_b            = 14,
7545 +       ETHMAC2_ed_m            = 0x00004000,
7546 +
7547 +       ETHIPGT_ipgt_b          = 0,
7548 +       ETHIPGT_ipgt_m          = 0x0000007f,
7549 +
7550 +       ETHIPGR_ipgr2_b         = 0,
7551 +       ETHIPGR_ipgr2_m         = 0x0000007f,
7552 +       ETHIPGR_ipgr1_b         = 8,
7553 +       ETHIPGR_ipgr1_m         = 0x00007f00,
7554 +
7555 +       ETHCLRT_maxret_b        = 0,
7556 +       ETHCLRT_maxret_m        = 0x0000000f,
7557 +       ETHCLRT_colwin_b        = 8,
7558 +       ETHCLRT_colwin_m        = 0x00003f00,
7559 +
7560 +       ETHMAXF_maxf_b          = 0,
7561 +       ETHMAXF_maxf_m          = 0x0000ffff,
7562 +
7563 +       ETHMTEST_tb_b           = 2,
7564 +       ETHMTEST_tb_m           = 0x00000004,
7565 +
7566 +       ETHMCP_div_b            = 0,
7567 +       ETHMCP_div_m            = 0x000000ff,
7568 +       
7569 +       MIIMCFG_rsv_b           = 0,
7570 +       MIIMCFG_rsv_m           = 0x0000000c,
7571 +
7572 +       MIIMCMD_rd_b            = 0,
7573 +       MIIMCMD_rd_m            = 0x00000001,
7574 +       MIIMCMD_scn_b           = 1,
7575 +       MIIMCMD_scn_m           = 0x00000002,
7576 +
7577 +       MIIMADDR_regaddr_b      = 0,
7578 +       MIIMADDR_regaddr_m      = 0x0000001f,
7579 +       MIIMADDR_phyaddr_b      = 8,
7580 +       MIIMADDR_phyaddr_m      = 0x00001f00,
7581 +
7582 +       MIIMWTD_wdata_b         = 0,
7583 +       MIIMWTD_wdata_m         = 0x0000ffff,
7584 +
7585 +       MIIMRDD_rdata_b         = 0,
7586 +       MIIMRDD_rdata_m         = 0x0000ffff,
7587 +
7588 +       MIIMIND_bsy_b           = 0,
7589 +       MIIMIND_bsy_m           = 0x00000001,
7590 +       MIIMIND_scn_b           = 1,
7591 +       MIIMIND_scn_m           = 0x00000002,
7592 +       MIIMIND_nv_b            = 2,
7593 +       MIIMIND_nv_m            = 0x00000004,
7594 +
7595 +} ;
7596 +
7597 +/*
7598 + * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
7599 + */
7600 +enum
7601 +{
7602 +       ETHRX_fd_b              = 0,
7603 +       ETHRX_fd_m              = 0x00000001,
7604 +       ETHRX_ld_b              = 1,
7605 +       ETHRX_ld_m              = 0x00000002,
7606 +       ETHRX_rok_b             = 2,
7607 +       ETHRX_rok_m             = 0x00000004,
7608 +       ETHRX_fm_b              = 3,
7609 +       ETHRX_fm_m              = 0x00000008,
7610 +       ETHRX_mp_b              = 4,
7611 +       ETHRX_mp_m              = 0x00000010,
7612 +       ETHRX_bp_b              = 5,
7613 +       ETHRX_bp_m              = 0x00000020,
7614 +       ETHRX_vlt_b             = 6,
7615 +       ETHRX_vlt_m             = 0x00000040,
7616 +       ETHRX_cf_b              = 7,
7617 +       ETHRX_cf_m              = 0x00000080,
7618 +       ETHRX_ovr_b             = 8,
7619 +       ETHRX_ovr_m             = 0x00000100,
7620 +       ETHRX_crc_b             = 9,
7621 +       ETHRX_crc_m             = 0x00000200,
7622 +       ETHRX_cv_b              = 10,
7623 +       ETHRX_cv_m              = 0x00000400,
7624 +       ETHRX_db_b              = 11,
7625 +       ETHRX_db_m              = 0x00000800,
7626 +       ETHRX_le_b              = 12,
7627 +       ETHRX_le_m              = 0x00001000,
7628 +       ETHRX_lor_b             = 13,
7629 +       ETHRX_lor_m             = 0x00002000,
7630 +       ETHRX_ces_b             = 14,
7631 +       ETHRX_ces_m             = 0x00004000,
7632 +       ETHRX_length_b          = 16,
7633 +       ETHRX_length_m          = 0xffff0000,
7634 +
7635 +       ETHTX_fd_b              = 0,
7636 +       ETHTX_fd_m              = 0x00000001,
7637 +       ETHTX_ld_b              = 1,
7638 +       ETHTX_ld_m              = 0x00000002,
7639 +       ETHTX_oen_b             = 2,
7640 +       ETHTX_oen_m             = 0x00000004,
7641 +       ETHTX_pen_b             = 3,
7642 +       ETHTX_pen_m             = 0x00000008,
7643 +       ETHTX_cen_b             = 4,
7644 +       ETHTX_cen_m             = 0x00000010,
7645 +       ETHTX_hen_b             = 5,
7646 +       ETHTX_hen_m             = 0x00000020,
7647 +       ETHTX_tok_b             = 6,
7648 +       ETHTX_tok_m             = 0x00000040,
7649 +       ETHTX_mp_b              = 7,
7650 +       ETHTX_mp_m              = 0x00000080,
7651 +       ETHTX_bp_b              = 8,
7652 +       ETHTX_bp_m              = 0x00000100,
7653 +       ETHTX_und_b             = 9,
7654 +       ETHTX_und_m             = 0x00000200,
7655 +       ETHTX_of_b              = 10,
7656 +       ETHTX_of_m              = 0x00000400,
7657 +       ETHTX_ed_b              = 11,
7658 +       ETHTX_ed_m              = 0x00000800,
7659 +       ETHTX_ec_b              = 12,
7660 +       ETHTX_ec_m              = 0x00001000,
7661 +       ETHTX_lc_b              = 13,
7662 +       ETHTX_lc_m              = 0x00002000,
7663 +       ETHTX_td_b              = 14,
7664 +       ETHTX_td_m              = 0x00004000,
7665 +       ETHTX_crc_b             = 15,
7666 +       ETHTX_crc_m             = 0x00008000,
7667 +       ETHTX_le_b              = 16,
7668 +       ETHTX_le_m              = 0x00010000,
7669 +       ETHTX_cc_b              = 17,
7670 +       ETHTX_cc_m              = 0x001E0000,
7671 +} ;
7672 +
7673 +#endif // __IDT_ETH_H__
7674 +
7675 +
7676 +
7677 +
7678 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_eth_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_eth_v.h
7679 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_eth_v.h    1970-01-01 01:00:00.000000000 +0100
7680 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_eth_v.h    2006-01-10 00:32:33.000000000 +0100
7681 @@ -0,0 +1,77 @@
7682 +/**************************************************************************
7683 + *
7684 + *  BRIEF MODULE DESCRIPTION
7685 + *   Ethernet register definition
7686 + *
7687 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7688 + *         
7689 + *  This program is free software; you can redistribute  it and/or modify it
7690 + *  under  the terms of  the GNU General  Public License as published by the
7691 + *  Free Software Foundation;  either version 2 of the  License, or (at your
7692 + *  option) any later version.
7693 + *
7694 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
7695 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
7696 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
7697 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
7698 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
7699 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
7700 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
7701 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
7702 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7703 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7704 + *
7705 + *  You should have received a copy of the  GNU General Public License along
7706 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
7707 + *  675 Mass Ave, Cambridge, MA 02139, USA.
7708 + *
7709 + *
7710 + **************************************************************************
7711 + * May 2004 rkt, neb.
7712 + *
7713 + * Initial Release
7714 + *
7715 + * 
7716 + *
7717 + **************************************************************************
7718 + */
7719 +
7720 +#ifndef        __IDT_ETH_V_H__
7721 +#define        __IDT_ETH_V_H__
7722 +
7723 +#include  <asm/idt-boards/rc32434/rc32434_eth.h> 
7724 +
7725 +#define IS_TX_TOK(X)         (((X) & (1<<ETHTX_tok_b)) >> ETHTX_tok_b )   /* Transmit Okay    */
7726 +#define IS_TX_MP(X)          (((X) & (1<<ETHTX_mp_b))  >> ETHTX_mp_b )    /* Multicast        */
7727 +#define IS_TX_BP(X)          (((X) & (1<<ETHTX_bp_b))  >> ETHTX_bp_b )    /* Broadcast        */
7728 +#define IS_TX_UND_ERR(X)     (((X) & (1<<ETHTX_und_b)) >> ETHTX_und_b )   /* Transmit FIFO Underflow */
7729 +#define IS_TX_OF_ERR(X)      (((X) & (1<<ETHTX_of_b))  >> ETHTX_of_b )    /* Oversized frame  */
7730 +#define IS_TX_ED_ERR(X)      (((X) & (1<<ETHTX_ed_b))  >> ETHTX_ed_b )    /* Excessive deferral  */
7731 +#define IS_TX_EC_ERR(X)      (((X) & (1<<ETHTX_ec_b))  >> ETHTX_ec_b)     /* Excessive collisions  */
7732 +#define IS_TX_LC_ERR(X)      (((X) & (1<<ETHTX_lc_b))  >> ETHTX_lc_b )    /* Late Collision   */
7733 +#define IS_TX_TD_ERR(X)      (((X) & (1<<ETHTX_td_b))  >> ETHTX_td_b )    /* Transmit deferred*/
7734 +#define IS_TX_CRC_ERR(X)     (((X) & (1<<ETHTX_crc_b)) >> ETHTX_crc_b )   /* CRC Error        */
7735 +#define IS_TX_LE_ERR(X)      (((X) & (1<<ETHTX_le_b))  >>  ETHTX_le_b )    /* Length Error     */
7736 +
7737 +#define TX_COLLISION_COUNT(X) (((X) & ETHTX_cc_m)>>ETHTX_cc_b)  /* Collision Count  */
7738 +
7739 +#define IS_RCV_ROK(X)        (((X) & (1<<ETHRX_rok_b)) >> ETHRX_rok_b)    /* Receive Okay     */
7740 +#define IS_RCV_FM(X)         (((X) & (1<<ETHRX_fm_b))  >> ETHRX_fm_b)     /* Is Filter Match  */
7741 +#define IS_RCV_MP(X)         (((X) & (1<<ETHRX_mp_b))  >> ETHRX_mp_b)     /* Is it MP         */
7742 +#define IS_RCV_BP(X)         (((X) & (1<<ETHRX_bp_b))  >> ETHRX_bp_b)     /* Is it BP         */
7743 +#define IS_RCV_VLT(X)        (((X) & (1<<ETHRX_vlt_b)) >> ETHRX_vlt_b)    /* VLAN Tag Detect  */
7744 +#define IS_RCV_CF(X)         (((X) & (1<<ETHRX_cf_b))  >> ETHRX_cf_b)     /* Control Frame    */
7745 +#define IS_RCV_OVR_ERR(X)    (((X) & (1<<ETHRX_ovr_b)) >> ETHRX_ovr_b)    /* Receive Overflow */
7746 +#define IS_RCV_CRC_ERR(X)    (((X) & (1<<ETHRX_crc_b)) >> ETHRX_crc_b)    /* CRC Error        */
7747 +#define IS_RCV_CV_ERR(X)     (((X) & (1<<ETHRX_cv_b))  >> ETHRX_cv_b)     /* Code Violation   */
7748 +#define IS_RCV_DB_ERR(X)     (((X) & (1<<ETHRX_db_b))  >> ETHRX_db_b)     /* Dribble Bits     */
7749 +#define IS_RCV_LE_ERR(X)     (((X) & (1<<ETHRX_le_b))  >> ETHRX_le_b)     /* Length error     */
7750 +#define IS_RCV_LOR_ERR(X)    (((X) & (1<<ETHRX_lor_b)) >> ETHRX_lor_b)    /* Length Out of Range */
7751 +#define IS_RCV_CES_ERR(X)    (((X) & (1<<ETHRX_ces_b)) >> ETHRX_ces_b)  /* Preamble error   */
7752 +#define RCVPKT_LENGTH(X)     (((X) & ETHRX_length_m) >> ETHRX_length_b)   /* Length of the received packet */
7753 +#endif // __IDT_ETH_V_H__
7754 +
7755 +
7756 +
7757 +
7758 +
7759 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_gpio.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_gpio.h
7760 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_gpio.h     1970-01-01 01:00:00.000000000 +0100
7761 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_gpio.h     2006-01-10 00:32:33.000000000 +0100
7762 @@ -0,0 +1,167 @@
7763 +/**************************************************************************
7764 + *
7765 + *  BRIEF MODULE DESCRIPTION
7766 + *   GPIO register definition
7767 + *
7768 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7769 + *         
7770 + *  This program is free software; you can redistribute  it and/or modify it
7771 + *  under  the terms of  the GNU General  Public License as published by the
7772 + *  Free Software Foundation;  either version 2 of the  License, or (at your
7773 + *  option) any later version.
7774 + *
7775 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
7776 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
7777 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
7778 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
7779 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
7780 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
7781 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
7782 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
7783 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7784 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7785 + *
7786 + *  You should have received a copy of the  GNU General Public License along
7787 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
7788 + *  675 Mass Ave, Cambridge, MA 02139, USA.
7789 + *
7790 + *
7791 + **************************************************************************
7792 + * May 2004 rkt, neb.
7793 + *
7794 + * Initial Release
7795 + *
7796 + * 
7797 + *
7798 + **************************************************************************
7799 + */
7800 +
7801 +#ifndef __IDT_GPIO_H__
7802 +#define __IDT_GPIO_H__
7803 +
7804 +enum
7805 +{
7806 +       GPIO0_PhysicalAddress   = 0x18050000,
7807 +       GPIO_PhysicalAddress    = GPIO0_PhysicalAddress,        // Default
7808 +
7809 +       GPIO0_VirtualAddress    = 0xb8050000,
7810 +       GPIO_VirtualAddress     = GPIO0_VirtualAddress,         // Default
7811 +} ;
7812 +
7813 +typedef struct
7814 +{
7815 +       u32   gpiofunc;   /* GPIO Function Register
7816 +                          * gpiofunc[x]==0 bit = gpio
7817 +                          * func[x]==1  bit = altfunc
7818 +                          */
7819 +       u32   gpiocfg;    /* GPIO Configuration Register
7820 +                          * gpiocfg[x]==0 bit = input
7821 +                          * gpiocfg[x]==1 bit = output
7822 +                          */
7823 +       u32   gpiod;      /* GPIO Data Register
7824 +                          * gpiod[x] read/write gpio pinX status
7825 +                          */
7826 +       u32   gpioilevel; /* GPIO Interrupt Status Register
7827 +                          * interrupt level (see gpioistat)
7828 +                          */
7829 +       u32   gpioistat;  /* Gpio Interrupt Status Register
7830 +                          * istat[x] = (gpiod[x] == level[x])
7831 +                          * cleared in ISR (STICKY bits)
7832 +                          */
7833 +       u32   gpionmien;  /* GPIO Non-maskable Interrupt Enable Register */
7834 +} volatile * GPIO_t ;
7835 +
7836 +typedef enum
7837 +{
7838 +       GPIO_gpio_v             = 0,            // gpiofunc use pin as GPIO.
7839 +       GPIO_alt_v              = 1,            // gpiofunc use pin as alt.
7840 +       GPIO_input_v            = 0,            // gpiocfg use pin as input.
7841 +       GPIO_output_v           = 1,            // gpiocfg use pin as output.
7842 +       GPIO_pin0_b             = 0,
7843 +       GPIO_pin0_m             = 0x00000001,
7844 +       GPIO_pin1_b             = 1,
7845 +       GPIO_pin1_m             = 0x00000002,
7846 +       GPIO_pin2_b             = 2,
7847 +       GPIO_pin2_m             = 0x00000004,
7848 +       GPIO_pin3_b             = 3,
7849 +       GPIO_pin3_m             = 0x00000008,
7850 +       GPIO_pin4_b             = 4,
7851 +       GPIO_pin4_m             = 0x00000010,
7852 +       GPIO_pin5_b             = 5,
7853 +       GPIO_pin5_m             = 0x00000020,
7854 +       GPIO_pin6_b             = 6,
7855 +       GPIO_pin6_m             = 0x00000040,
7856 +       GPIO_pin7_b             = 7,
7857 +       GPIO_pin7_m             = 0x00000080,
7858 +       GPIO_pin8_b             = 8,
7859 +       GPIO_pin8_m             = 0x00000100,
7860 +       GPIO_pin9_b             = 9,
7861 +       GPIO_pin9_m             = 0x00000200,
7862 +       GPIO_pin10_b            = 10,
7863 +       GPIO_pin10_m            = 0x00000400,
7864 +       GPIO_pin11_b            = 11,
7865 +       GPIO_pin11_m            = 0x00000800,
7866 +       GPIO_pin12_b            = 12,
7867 +       GPIO_pin12_m            = 0x00001000,
7868 +       GPIO_pin13_b            = 13,
7869 +       GPIO_pin13_m            = 0x00002000,
7870 +
7871 +// Alternate function pins.  Corrsponding gpiofunc bit set to GPIO_alt_v.
7872 +
7873 +       GPIO_u0sout_b           = GPIO_pin0_b,          // UART 0 serial out.
7874 +       GPIO_u0sout_m           = GPIO_pin0_m,
7875 +               GPIO_u0sout_cfg_v       = GPIO_output_v,
7876 +       GPIO_u0sinp_b   = GPIO_pin1_b,                  // UART 0 serial in.
7877 +       GPIO_u0sinp_m   = GPIO_pin1_m,
7878 +               GPIO_u0sinp_cfg_v       = GPIO_input_v,
7879 +       GPIO_u0rtsn_b   = GPIO_pin2_b,                  // UART 0 req. to send.
7880 +       GPIO_u0rtsn_m   = GPIO_pin2_m,
7881 +               GPIO_u0rtsn_cfg_v       = GPIO_output_v,
7882 +       GPIO_u0ctsn_b   = GPIO_pin3_b,                  // UART 0 clear to send.
7883 +       GPIO_u0ctsn_m   = GPIO_pin3_m,
7884 +               GPIO_u0ctsn_cfg_v       = GPIO_input_v,
7885 +
7886 +       GPIO_maddr22_b          = GPIO_pin4_b,  // M&P bus bit 22.
7887 +       GPIO_maddr22_m          = GPIO_pin4_m,
7888 +               GPIO_maddr22_cfg_v      = GPIO_output_v,
7889 +
7890 +       GPIO_maddr23_b          = GPIO_pin5_b,  // M&P bus bit 23.
7891 +       GPIO_maddr23_m          = GPIO_pin5_m,
7892 +               GPIO_maddr23_cfg_v      = GPIO_output_v,
7893 +
7894 +       GPIO_maddr24_b          = GPIO_pin6_b,  // M&P bus bit 24.
7895 +       GPIO_maddr24_m          = GPIO_pin6_m,
7896 +               GPIO_maddr24_cfg_v      = GPIO_output_v,
7897 +
7898 +       GPIO_maddr25_b          = GPIO_pin7_b,  // M&P bus bit 25.
7899 +       GPIO_maddr25_m          = GPIO_pin7_m,
7900 +               GPIO_maddr25_cfg_v      = GPIO_output_v,
7901 +
7902 +       GPIO_cpudmadebug_b      = GPIO_pin8_b,  // CPU or DMA debug pin
7903 +       GPIO_cpudmadebug_m      = GPIO_pin8_m,
7904 +               GPIO_cpudmadebug_cfg_v  = GPIO_output_v,
7905 +
7906 +       GPIO_pcireq4_b  = GPIO_pin9_b,  // PCI Request 4
7907 +       GPIO_pcireq4_m  = GPIO_pin9_m,
7908 +               GPIO_pcireq4_cfg_v      = GPIO_input_v,
7909 +
7910 +       GPIO_pcigrant4_b        = GPIO_pin10_b,         // PCI Grant 4
7911 +       GPIO_pcigrant4_m        = GPIO_pin10_m,
7912 +               GPIO_pcigrant4_cfg_v    = GPIO_output_v,
7913 +
7914 +       GPIO_pcireq5_b  = GPIO_pin11_b,         // PCI Request 5
7915 +       GPIO_pcireq5_m  = GPIO_pin11_m,
7916 +               GPIO_pcireq5_cfg_v      = GPIO_input_v,
7917 +
7918 +       GPIO_pcigrant5_b        = GPIO_pin12_b,         // PCI Grant 5
7919 +       GPIO_pcigrant5_m        = GPIO_pin12_m,
7920 +               GPIO_pcigrant5_cfg_v    = GPIO_output_v,
7921 +
7922 +       GPIO_pcimuintn_b        = GPIO_pin13_b,         // PCI messaging int.
7923 +       GPIO_pcimuintn_m        = GPIO_pin13_m,
7924 +               GPIO_pcimuintn_cfg_v    = GPIO_output_v,
7925 +
7926 +} GPIO_DEFS_t;
7927 +
7928 +#endif // __IDT_GPIO_H__
7929 +
7930 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434.h
7931 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434.h  1970-01-01 01:00:00.000000000 +0100
7932 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434.h  2006-01-10 00:32:33.000000000 +0100
7933 @@ -0,0 +1,199 @@
7934 + /**************************************************************************
7935 + *
7936 + *  BRIEF MODULE DESCRIPTION
7937 + *   Definitions for IDT RC32434 CPU
7938 + *
7939 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
7940 + *         
7941 + *  This program is free software; you can redistribute  it and/or modify it
7942 + *  under  the terms of  the GNU General  Public License as published by the
7943 + *  Free Software Foundation;  either version 2 of the  License, or (at your
7944 + *  option) any later version.
7945 + *
7946 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
7947 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
7948 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
7949 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
7950 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
7951 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
7952 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
7953 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
7954 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
7955 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7956 + *
7957 + *  You should have received a copy of the  GNU General Public License along
7958 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
7959 + *  675 Mass Ave, Cambridge, MA 02139, USA.
7960 + *
7961 + *
7962 + **************************************************************************
7963 + * May 2004 rkt, neb.
7964 + *
7965 + * Initial Release
7966 + *
7967 + * 
7968 + *
7969 + **************************************************************************
7970 + */
7971 +
7972 +#ifndef _RC32434_H_
7973 +#define _RC32434_H_
7974 +
7975 +#include <linux/config.h>
7976 +#include <linux/delay.h>
7977 +#include <asm/io.h>
7978 +#include <asm/idt-boards/rc32434/rc32434_timer.h>
7979 +
7980 +#define RC32434_REG_BASE   0x18000000
7981 +
7982 +
7983 +#define interrupt ((volatile INT_t ) INT0_VirtualAddress)
7984 +#define idt_timer     ((volatile TIM_t)  TIM0_VirtualAddress)
7985 +#define idt_gpio         ((volatile GPIO_t) GPIO0_VirtualAddress)
7986 +
7987 +#define IDT_CLOCK_MULT 2
7988 +#define MIPS_CPU_TIMER_IRQ 7
7989 +/* Interrupt Controller */
7990 +#define IC_GROUP0_PEND     (RC32434_REG_BASE + 0x38000)
7991 +#define IC_GROUP0_MASK     (RC32434_REG_BASE + 0x38008)
7992 +#define IC_GROUP_OFFSET    0x0C
7993 +#define RTC_BASE           0xBA001FF0
7994 +
7995 +#define NUM_INTR_GROUPS    5
7996 +/* 16550 UARTs */
7997 +
7998 +#define GROUP0_IRQ_BASE 8              /* GRP2 IRQ numbers start here */
7999 +#define GROUP1_IRQ_BASE (GROUP0_IRQ_BASE + 32) /* GRP3 IRQ numbers start here */
8000 +#define GROUP2_IRQ_BASE (GROUP1_IRQ_BASE + 32) /* GRP4 IRQ numbers start here */
8001 +#define GROUP3_IRQ_BASE (GROUP2_IRQ_BASE + 32) /* GRP5 IRQ numbers start here */
8002 +#define GROUP4_IRQ_BASE (GROUP3_IRQ_BASE + 32)
8003 +
8004 +#ifdef __MIPSEB__
8005 +
8006 +#define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58003)
8007 +#define EB434_UART1_BASE   (0x19800003)
8008 +
8009 +#else
8010 +
8011 +#define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58000)
8012 +#define EB434_UART1_BASE   (0x19800000)
8013 +
8014 +#endif
8015 +
8016 +#define RC32434_UART0_IRQ  GROUP3_IRQ_BASE + 0
8017 +#define EB434_UART1_IRQ    GROUP4_IRQ_BASE + 11
8018 +
8019 +#define RC32434_NR_IRQS  (GROUP4_IRQ_BASE + 32)
8020 +
8021 +/* cpu pipeline flush */
8022 +static inline void rc32434_sync(void)
8023 +{
8024 +        __asm__ volatile ("sync");
8025 +}
8026 +
8027 +static inline void rc32434_sync_udelay(int us)
8028 +{
8029 +        __asm__ volatile ("sync");
8030 +        udelay(us);
8031 +}
8032 +
8033 +static inline void rc32434_sync_delay(int ms)
8034 +{
8035 +        __asm__ volatile ("sync");
8036 +        mdelay(ms);
8037 +}
8038 +
8039 +
8040 +
8041 +/*
8042 + * Macros to access internal RC32434 registers. No byte
8043 + * swapping should be done when accessing the internal
8044 + * registers.
8045 + */
8046 +
8047 +#define rc32434_readb __raw_readb
8048 +#define rc32434_readw __raw_readw
8049 +#define rc32434_readl __raw_readl
8050 +
8051 +#define rc32434_writeb __raw_writeb
8052 +#define rc32434_writew __raw_writew
8053 +#define rc32434_writel __raw_writel
8054 +
8055 +#if 0
8056 +static inline u8 rc32434_readb(unsigned long pa)
8057 +{
8058 +       return *((volatile u8 *)KSEG1ADDR(pa));
8059 +}
8060 +static inline u16 rc32434_readw(unsigned long pa)
8061 +{
8062 +       return *((volatile u16 *)KSEG1ADDR(pa));
8063 +}
8064 +static inline u32 rc32434_readl(unsigned long pa)
8065 +{
8066 +       return *((volatile u32 *)KSEG1ADDR(pa));
8067 +}
8068 +static inline void rc32434_writeb(u8 val, unsigned long pa)
8069 +{
8070 +       *((volatile u8 *)KSEG1ADDR(pa)) = val;
8071 +}
8072 +static inline void rc32434_writew(u16 val, unsigned long pa)
8073 +{
8074 +       *((volatile u16 *)KSEG1ADDR(pa)) = val;
8075 +}
8076 +static inline void rc32434_writel(u32 val, unsigned long pa)
8077 +{
8078 +       *((volatile u32 *)KSEG1ADDR(pa)) = val;
8079 +}
8080 +
8081 +#endif
8082 +
8083 +
8084 +/*
8085 + * C access to CLZ and CLO instructions
8086 + * (count leading zeroes/ones).
8087 + */
8088 +static inline int rc32434_clz(unsigned long val)
8089 +{
8090 +       int ret;
8091 +        __asm__ volatile (
8092 +               ".set\tnoreorder\n\t"
8093 +               ".set\tnoat\n\t"
8094 +               ".set\tmips32\n\t"
8095 +               "clz\t%0,%1\n\t"
8096 +                ".set\tmips0\n\t"
8097 +                ".set\tat\n\t"
8098 +                ".set\treorder"
8099 +                : "=r" (ret)
8100 +               : "r" (val));
8101 +
8102 +       return ret;
8103 +}
8104 +static inline int rc32434_clo(unsigned long val)
8105 +{
8106 +       int ret;
8107 +        __asm__ volatile (
8108 +               ".set\tnoreorder\n\t"
8109 +               ".set\tnoat\n\t"
8110 +               ".set\tmips32\n\t"
8111 +               "clo\t%0,%1\n\t"
8112 +                ".set\tmips0\n\t"
8113 +                ".set\tat\n\t"
8114 +                ".set\treorder"
8115 +                : "=r" (ret)
8116 +               : "r" (val));
8117 +
8118 +       return ret;
8119 +}
8120 +#endif /* _RC32434_H_ */
8121 +
8122 +
8123 +
8124 +
8125 +
8126 +
8127 +
8128 +
8129 +
8130 +
8131 +
8132 +
8133 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_integ.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_integ.h
8134 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_integ.h    1970-01-01 01:00:00.000000000 +0100
8135 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_integ.h    2006-01-10 00:32:33.000000000 +0100
8136 @@ -0,0 +1,90 @@
8137 +/**************************************************************************
8138 + *
8139 + *  BRIEF MODULE DESCRIPTION
8140 + *   System Integrity register definition
8141 + *
8142 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
8143 + *         
8144 + *  This program is free software; you can redistribute  it and/or modify it
8145 + *  under  the terms of  the GNU General  Public License as published by the
8146 + *  Free Software Foundation;  either version 2 of the  License, or (at your
8147 + *  option) any later version.
8148 + *
8149 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
8150 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
8151 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
8152 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
8153 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
8154 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
8155 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8156 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
8157 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8158 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8159 + *
8160 + *  You should have received a copy of the  GNU General Public License along
8161 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
8162 + *  675 Mass Ave, Cambridge, MA 02139, USA.
8163 + *
8164 + *
8165 + **************************************************************************
8166 + * May 2004 rkt, neb
8167 + *
8168 + * Initial Release
8169 + *
8170 + * 
8171 + *
8172 + **************************************************************************
8173 + */
8174 +
8175 +#ifndef __IDT_INTEG_H__
8176 +#define __IDT_INTEG_H__
8177 +
8178 +enum
8179 +{
8180 +       INTEG0_PhysicalAddress  = 0x18030000,
8181 +       INTEG_PhysicalAddress   = INTEG0_PhysicalAddress,       // Default
8182 +
8183 +       INTEG0_VirtualAddress   = 0xB8030000,
8184 +       INTEG_VirtualAddress    = INTEG0_VirtualAddress,        // Default
8185 +} ;
8186 +
8187 +// if you are looking for CEA, try rst.h
8188 +typedef struct
8189 +{
8190 +       u32 filler [0xc] ;              // 0x30 bytes unused.
8191 +       u32 errcs ;                     // sticky use ERRCS_
8192 +       u32 wtcount ;                   // Watchdog timer count reg.
8193 +       u32 wtcompare ;                 // Watchdog timer timeout value.
8194 +       u32 wtc ;                       // Watchdog timer control. use WTC_
8195 +} volatile *INTEG_t ;
8196 +
8197 +enum
8198 +{
8199 +       ERRCS_wto_b             = 0,            // In INTEG_t -> errcs
8200 +       ERRCS_wto_m             = 0x00000001,
8201 +       ERRCS_wne_b             = 1,            // In INTEG_t -> errcs
8202 +       ERRCS_wne_m             = 0x00000002,
8203 +       ERRCS_ucw_b             = 2,            // In INTEG_t -> errcs
8204 +       ERRCS_ucw_m             = 0x00000004,
8205 +       ERRCS_ucr_b             = 3,            // In INTEG_t -> errcs
8206 +       ERRCS_ucr_m             = 0x00000008,
8207 +       ERRCS_upw_b             = 4,            // In INTEG_t -> errcs
8208 +       ERRCS_upw_m             = 0x00000010,
8209 +       ERRCS_upr_b             = 5,            // In INTEG_t -> errcs
8210 +       ERRCS_upr_m             = 0x00000020,
8211 +       ERRCS_udw_b             = 6,            // In INTEG_t -> errcs
8212 +       ERRCS_udw_m             = 0x00000040,
8213 +       ERRCS_udr_b             = 7,            // In INTEG_t -> errcs
8214 +       ERRCS_udr_m             = 0x00000080,
8215 +       ERRCS_sae_b             = 8,            // In INTEG_t -> errcs
8216 +       ERRCS_sae_m             = 0x00000100,
8217 +       ERRCS_wre_b             = 9,            // In INTEG_t -> errcs
8218 +       ERRCS_wre_m             = 0x00000200,
8219 +
8220 +       WTC_en_b                = 0,            // In INTEG_t -> wtc
8221 +       WTC_en_m                = 0x00000001,
8222 +       WTC_to_b                = 1,            // In INTEG_t -> wtc
8223 +       WTC_to_m                = 0x00000002,
8224 +} ;
8225 +
8226 +#endif // __IDT_INTEG_H__
8227 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_int.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_int.h
8228 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_int.h      1970-01-01 01:00:00.000000000 +0100
8229 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_int.h      2006-01-10 00:32:33.000000000 +0100
8230 @@ -0,0 +1,174 @@
8231 +/**************************************************************************
8232 + *
8233 + *  BRIEF MODULE DESCRIPTION
8234 + *   Interrupt Controller register definition.
8235 + *
8236 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
8237 + *         
8238 + *  This program is free software; you can redistribute  it and/or modify it
8239 + *  under  the terms of  the GNU General  Public License as published by the
8240 + *  Free Software Foundation;  either version 2 of the  License, or (at your
8241 + *  option) any later version.
8242 + *
8243 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
8244 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
8245 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
8246 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
8247 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
8248 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
8249 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8250 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
8251 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8252 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8253 + *
8254 + *  You should have received a copy of the  GNU General Public License along
8255 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
8256 + *  675 Mass Ave, Cambridge, MA 02139, USA.
8257 + *
8258 + *
8259 + **************************************************************************
8260 + * May 2004 rkt, neb.
8261 + *
8262 + * Initial Release
8263 + *
8264 + * 
8265 + *
8266 + **************************************************************************
8267 + */
8268 +
8269 +#ifndef __IDT_INT_H__
8270 +#define __IDT_INT_H__
8271 +
8272 +enum
8273 +{
8274 +       INT0_PhysicalAddress    = 0x18038000,
8275 +       INT_PhysicalAddress     = INT0_PhysicalAddress,         // Default
8276 +
8277 +       INT0_VirtualAddress     = 0xB8038000,
8278 +       INT_VirtualAddress      = INT0_VirtualAddress,          // Default
8279 +} ;
8280 +
8281 +struct INT_s
8282 +{
8283 +       u32             ipend ;         //Pending interrupts. use INT?_
8284 +       u32             itest ;         //Test bits.            use INT?_
8285 +       u32             imask ;         //Interrupt disabled when set. use INT?_
8286 +} ;
8287 +
8288 +enum
8289 +{
8290 +       IPEND2  = 0,                    // HW 2 interrupt to core. use INT2_
8291 +       IPEND3  = 1,                    // HW 3 interrupt to core. use INT3_
8292 +       IPEND4  = 2,                    // HW 4 interrupt to core. use INT4_
8293 +       IPEND5  = 3,                    // HW 5 interrupt to core. use INT5_
8294 +       IPEND6  = 4,                    // HW 6 interrupt to core. use INT6_
8295 +
8296 +       IPEND_count,                    // must be last (used in loops)
8297 +       IPEND_min       = IPEND2        // min IPEND (used in loops)
8298 +};
8299 +
8300 +typedef struct INTC_s
8301 +{
8302 +       struct INT_s    i [IPEND_count] ;// use i[IPEND?] = INT?_
8303 +       u32             nmips ;         // use NMIPS_
8304 +} volatile *INT_t ;
8305 +
8306 +enum
8307 +{
8308 +       INT2_timer0_b                   = 0,
8309 +       INT2_timer0_m                   = 0x00000001,
8310 +       INT2_timer1_b                   = 1,
8311 +       INT2_timer1_m                   = 0x00000002,
8312 +       INT2_timer2_b                   = 2,
8313 +       INT2_timer2_m                   = 0x00000004,
8314 +       INT2_refresh_b                  = 3,
8315 +       INT2_refresh_m                  = 0x00000008,
8316 +       INT2_watchdogTimeout_b          = 4,
8317 +       INT2_watchdogTimeout_m          = 0x00000010,
8318 +       INT2_undecodedCpuWrite_b        = 5,
8319 +       INT2_undecodedCpuWrite_m        = 0x00000020,
8320 +       INT2_undecodedCpuRead_b         = 6,
8321 +       INT2_undecodedCpuRead_m         = 0x00000040,
8322 +       INT2_undecodedPciWrite_b        = 7,
8323 +       INT2_undecodedPciWrite_m        = 0x00000080,
8324 +       INT2_undecodedPciRead_b         = 8,
8325 +       INT2_undecodedPciRead_m         = 0x00000100,
8326 +       INT2_undecodedDmaWrite_b        = 9,
8327 +       INT2_undecodedDmaWrite_m        = 0x00000200,
8328 +       INT2_undecodedDmaRead_b         = 10,
8329 +       INT2_undecodedDmaRead_m         = 0x00000400,
8330 +       INT2_ipBusSlaveAckError_b       = 11,
8331 +       INT2_ipBusSlaveAckError_m       = 0x00000800,
8332 +
8333 +       INT3_dmaChannel0_b              = 0,
8334 +       INT3_dmaChannel0_m              = 0x00000001,
8335 +       INT3_dmaChannel1_b              = 1,
8336 +       INT3_dmaChannel1_m              = 0x00000002,
8337 +       INT3_dmaChannel2_b              = 2,
8338 +       INT3_dmaChannel2_m              = 0x00000004,
8339 +       INT3_dmaChannel3_b              = 3,
8340 +       INT3_dmaChannel3_m              = 0x00000008,
8341 +       INT3_dmaChannel4_b              = 4,
8342 +       INT3_dmaChannel4_m              = 0x00000010,
8343 +       INT3_dmaChannel5_b              = 5,
8344 +       INT3_dmaChannel5_m              = 0x00000020,
8345 +
8346 +       INT5_uartGeneral0_b             = 0,
8347 +       INT5_uartGeneral0_m             = 0x00000001,
8348 +       INT5_uartTxrdy0_b               = 1,
8349 +       INT5_uartTxrdy0_m               = 0x00000002,
8350 +       INT5_uartRxrdy0_b               = 2,
8351 +       INT5_uartRxrdy0_m               = 0x00000004,
8352 +       INT5_pci_b                      = 3,
8353 +       INT5_pci_m                      = 0x00000008,
8354 +       INT5_pciDecoupled_b             = 4,
8355 +       INT5_pciDecoupled_m             = 0x00000010,
8356 +       INT5_spi_b                      = 5,
8357 +       INT5_spi_m                      = 0x00000020,
8358 +       INT5_deviceDecoupled_b          = 6,
8359 +       INT5_deviceDecoupled_m          = 0x00000040,
8360 +       INT5_eth0Ovr_b                  = 9,
8361 +       INT5_eth0Ovr_m                  = 0x00000200,
8362 +       INT5_eth0Und_b                  = 10,
8363 +       INT5_eth0Und_m                  = 0x00000400,
8364 +       INT5_eth0Pfd_b                  = 11,
8365 +       INT5_eth0Pfd_m                  = 0x00000800,
8366 +       INT5_nvram_b                    = 12,
8367 +       INT5_nvram_m                    = 0x00001000,
8368 +
8369 +       INT6_gpio0_b                    = 0,
8370 +       INT6_gpio0_m                    = 0x00000001,
8371 +       INT6_gpio1_b                    = 1,
8372 +       INT6_gpio1_m                    = 0x00000002,
8373 +       INT6_gpio2_b                    = 2,
8374 +       INT6_gpio2_m                    = 0x00000004,
8375 +       INT6_gpio3_b                    = 3,
8376 +       INT6_gpio3_m                    = 0x00000008,
8377 +       INT6_gpio4_b                    = 4,
8378 +       INT6_gpio4_m                    = 0x00000010,
8379 +       INT6_gpio5_b                    = 5,
8380 +       INT6_gpio5_m                    = 0x00000020,
8381 +       INT6_gpio6_b                    = 6,
8382 +       INT6_gpio6_m                    = 0x00000040,
8383 +       INT6_gpio7_b                    = 7,
8384 +       INT6_gpio7_m                    = 0x00000080,
8385 +       INT6_gpio8_b                    = 8,
8386 +       INT6_gpio8_m                    = 0x00000100,
8387 +       INT6_gpio9_b                    = 9,
8388 +       INT6_gpio9_m                    = 0x00000200,
8389 +       INT6_gpio10_b                   = 10,
8390 +       INT6_gpio10_m                   = 0x00000400,
8391 +       INT6_gpio11_b                   = 11,
8392 +       INT6_gpio11_m                   = 0x00000800,
8393 +       INT6_gpio12_b                   = 12,
8394 +       INT6_gpio12_m                   = 0x00001000,
8395 +       INT6_gpio13_b                   = 13,
8396 +       INT6_gpio13_m                   = 0x00002000,
8397 +
8398 +       NMIPS_gpio_b                    = 0,
8399 +       NMIPS_gpio_m                    = 0x00000001,
8400 +} ;
8401 +
8402 +#endif // __IDT_INT_H__
8403 +
8404 +
8405 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_iparb.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_iparb.h
8406 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_iparb.h    1970-01-01 01:00:00.000000000 +0100
8407 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_iparb.h    2006-01-10 00:32:33.000000000 +0100
8408 @@ -0,0 +1,111 @@
8409 +/**************************************************************************
8410 + *
8411 + *  BRIEF MODULE DESCRIPTION
8412 + *   IP Arbiter register definitions
8413 + *
8414 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
8415 + *         
8416 + *  This program is free software; you can redistribute  it and/or modify it
8417 + *  under  the terms of  the GNU General  Public License as published by the
8418 + *  Free Software Foundation;  either version 2 of the  License, or (at your
8419 + *  option) any later version.
8420 + *
8421 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
8422 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
8423 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
8424 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
8425 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
8426 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
8427 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8428 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
8429 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8430 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8431 + *
8432 + *  You should have received a copy of the  GNU General Public License along
8433 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
8434 + *  675 Mass Ave, Cambridge, MA 02139, USA.
8435 + *
8436 + *
8437 + **************************************************************************
8438 + * May 2004 rkt,neb
8439 + *
8440 + * Initial Release
8441 + *
8442 + * 
8443 + *
8444 + **************************************************************************
8445 + */
8446 +
8447 +#ifndef __IDT_IPARB_H__
8448 +#define __IDT_IPARB_H__
8449 +
8450 +enum
8451 +{
8452 +       IPARB0_PhysicalAddress  = 0x18048000,
8453 +       IPARB_PhysicalAddress   = IPARB0_PhysicalAddress,       // Default
8454 +
8455 +       IPARB0_VirtualAddress   = 0xB8048000,
8456 +       IPARB_VirtualAddress    = IPARB0_VirtualAddress,        // Default
8457 +} ;
8458 +
8459 +enum
8460 +{
8461 +       IPABMXC_ethernet0Receive        = 0,
8462 +       IPABMXC_ethernet0Transmit       = 1,
8463 +       IPABMXC_memoryToHoldFifo        = 2,
8464 +       IPABMXC_holdFifoToMemory        = 3,
8465 +       IPABMXC_pciToMemory             = 4,
8466 +       IPABMXC_memoryToPci             = 5,
8467 +       IPABMXC_pciTarget               = 6,
8468 +       IPABMXC_pciTargetStart          = 7,
8469 +       IPABMXC_cpuToIpBus              = 8,
8470 +
8471 +       IPABMXC_Count,                          // Must be last in list !
8472 +       IPABMXC_Min                     = IPABMXC_ethernet0Receive,
8473 +
8474 +       IPAPXC_PriorityCount    = 4,            // 3-highest, 0-lowest.
8475 +} ;
8476 +
8477 +typedef struct
8478 +{
8479 +       u32     ipapc [IPAPXC_PriorityCount] ;  // ipapc[IPAPXC_] = IPAPC_
8480 +       u32     ipabmc [IPABMXC_Count] ;        // ipabmc[IPABMXC_] = IPABMC_
8481 +       u32     ipac ;                          // use IPAC_
8482 +       u32     ipaitcc;                        // use IPAITCC_
8483 +       u32     ipaspare ;
8484 +} volatile * IPARB_t ;
8485 +
8486 +enum
8487 +{
8488 +       IPAC_dp_b                       = 0,
8489 +       IPAC_dp_m                       = 0x00000001,
8490 +       IPAC_dep_b                      = 1,
8491 +       IPAC_dep_m                      = 0x00000002,
8492 +       IPAC_drm_b                      = 2,
8493 +       IPAC_drm_m                      = 0x00000004,
8494 +       IPAC_dwm_b                      = 3,
8495 +       IPAC_dwm_m                      = 0x00000008,
8496 +       IPAC_msk_b                      = 4,
8497 +       IPAC_msk_m                      = 0x00000010,
8498 +
8499 +       IPAPC_ptc_b                     = 0,
8500 +       IPAPC_ptc_m                     = 0x00003fff,
8501 +       IPAPC_mf_b                      = 14,
8502 +       IPAPC_mf_m                      = 0x00004000,
8503 +       IPAPC_cptc_b                    = 16,
8504 +       IPAPC_cptc_m                    = 0x3fff0000,
8505 +
8506 +       IPAITCC_itcc                    = 0,
8507 +       IPAITCC_itcc,                   = 0x000001ff,
8508 +
8509 +       IPABMC_mtc_b                    = 0,
8510 +       IPABMC_mtc_m                    = 0x00000fff,
8511 +       IPABMC_p_b                      = 12,
8512 +       IPABMC_p_m                      = 0x00003000,
8513 +       IPABMC_msk_b                    = 14,
8514 +       IPABMC_msk_m                    = 0x00004000,
8515 +       IPABMC_cmtc_b                   = 16,
8516 +       IPABMC_cmtc_m                   = 0x0fff0000,
8517 +};
8518 +
8519 +#endif // __IDT_IPARB_H__
8520 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_pci.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_pci.h
8521 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_pci.h      1970-01-01 01:00:00.000000000 +0100
8522 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_pci.h      2006-01-10 00:32:33.000000000 +0100
8523 @@ -0,0 +1,695 @@
8524 +/**************************************************************************
8525 + *
8526 + *  BRIEF MODULE DESCRIPTION
8527 + *   PCI register definitio
8528 + *
8529 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
8530 + *         
8531 + *  This program is free software; you can redistribute  it and/or modify it
8532 + *  under  the terms of  the GNU General  Public License as published by the
8533 + *  Free Software Foundation;  either version 2 of the  License, or (at your
8534 + *  option) any later version.
8535 + *
8536 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
8537 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
8538 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
8539 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
8540 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
8541 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
8542 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8543 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
8544 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8545 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8546 + *
8547 + *  You should have received a copy of the  GNU General Public License along
8548 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
8549 + *  675 Mass Ave, Cambridge, MA 02139, USA.
8550 + *
8551 + *
8552 + **************************************************************************
8553 + * May 2004 rkt, neb.
8554 + *
8555 + * Initial Release
8556 + *
8557 + * 
8558 + *
8559 + **************************************************************************
8560 + */
8561 +
8562 +#ifndef __IDT_PCI_H__
8563 +#define __IDT_PCI_H__
8564 +
8565 +enum
8566 +{
8567 +       PCI0_PhysicalAddress    = 0x18080000,
8568 +       PCI_PhysicalAddress     = PCI0_PhysicalAddress,
8569 +
8570 +       PCI0_VirtualAddress     = 0xB8080000,
8571 +       PCI_VirtualAddress      = PCI0_VirtualAddress,
8572 +} ;
8573 +
8574 +enum
8575 +{
8576 +       PCI_LbaCount    = 4,            // Local base addresses.
8577 +} ;
8578 +
8579 +typedef struct
8580 +{
8581 +       u32     a ;             // Address.
8582 +       u32     c ;             // Control.
8583 +       u32     m ;             // mapping.
8584 +} PCI_Map_s ;
8585 +
8586 +typedef struct
8587 +{
8588 +       u32             pcic ;
8589 +       u32             pcis ;
8590 +       u32             pcism ;
8591 +       u32             pcicfga ;
8592 +       u32             pcicfgd ;
8593 +       PCI_Map_s       pcilba [PCI_LbaCount] ;
8594 +       u32             pcidac ;
8595 +       u32             pcidas ;
8596 +       u32             pcidasm ;
8597 +       u32             pcidad ;
8598 +       u32             pcidma8c ;
8599 +       u32             pcidma9c ;
8600 +       u32             pcitc ;
8601 +} volatile *PCI_t ;
8602 +
8603 +// PCI messaging unit.
8604 +enum
8605 +{
8606 +       PCIM_Count      = 2,
8607 +} ;
8608 +typedef struct
8609 +{
8610 +       u32             pciim [PCIM_Count] ;
8611 +       u32             pciom [PCIM_Count] ;
8612 +       u32             pciid ;
8613 +       u32             pciiic ;
8614 +       u32             pciiim ;
8615 +       u32             pciiod ;
8616 +       u32             pciioic ;
8617 +       u32             pciioim ;
8618 +} volatile *PCIM_t ;
8619 +
8620 +/*******************************************************************************
8621 + *
8622 + * PCI Control Register
8623 + *
8624 + ******************************************************************************/
8625 +enum
8626 +{
8627 +       PCIC_en_b       = 0,
8628 +       PCIC_en_m       = 0x00000001,
8629 +       PCIC_tnr_b      = 1,
8630 +       PCIC_tnr_m      = 0x00000002,
8631 +       PCIC_sce_b      = 2,
8632 +       PCIC_sce_m      = 0x00000004,
8633 +       PCIC_ien_b      = 3,
8634 +       PCIC_ien_m      = 0x00000008,
8635 +       PCIC_aaa_b      = 4,
8636 +       PCIC_aaa_m      = 0x00000010,
8637 +       PCIC_eap_b      = 5,
8638 +       PCIC_eap_m      = 0x00000020,
8639 +       PCIC_pcim_b     = 6,
8640 +       PCIC_pcim_m     = 0x000001c0,
8641 +               PCIC_pcim_disabled_v    = 0,
8642 +               PCIC_pcim_tnr_v         = 1,    // Satellite - target not ready
8643 +               PCIC_pcim_suspend_v     = 2,    // Satellite - suspended CPU.
8644 +               PCIC_pcim_extern_v      = 3,    // Host - external arbiter.
8645 +               PCIC_pcim_fixed_v       = 4,    // Host - fixed priority arb.
8646 +               PCIC_pcim_roundrobin_v  = 5,    // Host - round robin priority.
8647 +               PCIC_pcim_reserved6_v   = 6,
8648 +               PCIC_pcim_reserved7_v   = 7,
8649 +       PCIC_igm_b      = 9,
8650 +       PCIC_igm_m      = 0x00000200,
8651 +} ;
8652 +
8653 +/*******************************************************************************
8654 + *
8655 + * PCI Status Register
8656 + *
8657 + ******************************************************************************/
8658 +enum {
8659 +       PCIS_eed_b      = 0,
8660 +       PCIS_eed_m      = 0x00000001,
8661 +       PCIS_wr_b       = 1,
8662 +       PCIS_wr_m       = 0x00000002,
8663 +       PCIS_nmi_b      = 2,
8664 +       PCIS_nmi_m      = 0x00000004,
8665 +       PCIS_ii_b       = 3,
8666 +       PCIS_ii_m       = 0x00000008,
8667 +       PCIS_cwe_b      = 4,
8668 +       PCIS_cwe_m      = 0x00000010,
8669 +       PCIS_cre_b      = 5,
8670 +       PCIS_cre_m      = 0x00000020,
8671 +       PCIS_mdpe_b     = 6,
8672 +       PCIS_mdpe_m     = 0x00000040,
8673 +       PCIS_sta_b      = 7,
8674 +       PCIS_sta_m      = 0x00000080,
8675 +       PCIS_rta_b      = 8,
8676 +       PCIS_rta_m      = 0x00000100,
8677 +       PCIS_rma_b      = 9,
8678 +       PCIS_rma_m      = 0x00000200,
8679 +       PCIS_sse_b      = 10,
8680 +       PCIS_sse_m      = 0x00000400,
8681 +       PCIS_ose_b      = 11,
8682 +       PCIS_ose_m      = 0x00000800,
8683 +       PCIS_pe_b       = 12,
8684 +       PCIS_pe_m       = 0x00001000,
8685 +       PCIS_tae_b      = 13,
8686 +       PCIS_tae_m      = 0x00002000,
8687 +       PCIS_rle_b      = 14,
8688 +       PCIS_rle_m      = 0x00004000,
8689 +       PCIS_bme_b      = 15,
8690 +       PCIS_bme_m      = 0x00008000,
8691 +       PCIS_prd_b      = 16,
8692 +       PCIS_prd_m      = 0x00010000,
8693 +       PCIS_rip_b      = 17,
8694 +       PCIS_rip_m      = 0x00020000,
8695 +} ;
8696 +
8697 +/*******************************************************************************
8698 + *
8699 + * PCI Status Mask Register
8700 + *
8701 + ******************************************************************************/
8702 +enum {
8703 +       PCISM_eed_b             = 0,
8704 +       PCISM_eed_m             = 0x00000001,
8705 +       PCISM_wr_b              = 1,
8706 +       PCISM_wr_m              = 0x00000002,
8707 +       PCISM_nmi_b             = 2,
8708 +       PCISM_nmi_m             = 0x00000004,
8709 +       PCISM_ii_b              = 3,
8710 +       PCISM_ii_m              = 0x00000008,
8711 +       PCISM_cwe_b             = 4,
8712 +       PCISM_cwe_m             = 0x00000010,
8713 +       PCISM_cre_b             = 5,
8714 +       PCISM_cre_m             = 0x00000020,
8715 +       PCISM_mdpe_b            = 6,
8716 +       PCISM_mdpe_m            = 0x00000040,
8717 +       PCISM_sta_b             = 7,
8718 +       PCISM_sta_m             = 0x00000080,
8719 +       PCISM_rta_b             = 8,
8720 +       PCISM_rta_m             = 0x00000100,
8721 +       PCISM_rma_b             = 9,
8722 +       PCISM_rma_m             = 0x00000200,
8723 +       PCISM_sse_b             = 10,
8724 +       PCISM_sse_m             = 0x00000400,
8725 +       PCISM_ose_b             = 11,
8726 +       PCISM_ose_m             = 0x00000800,
8727 +       PCISM_pe_b              = 12,
8728 +       PCISM_pe_m              = 0x00001000,
8729 +       PCISM_tae_b             = 13,
8730 +       PCISM_tae_m             = 0x00002000,
8731 +       PCISM_rle_b             = 14,
8732 +       PCISM_rle_m             = 0x00004000,
8733 +       PCISM_bme_b             = 15,
8734 +       PCISM_bme_m             = 0x00008000,
8735 +       PCISM_prd_b             = 16,
8736 +       PCISM_prd_m             = 0x00010000,
8737 +       PCISM_rip_b             = 17,
8738 +       PCISM_rip_m             = 0x00020000,
8739 +} ;
8740 +
8741 +/*******************************************************************************
8742 + *
8743 + * PCI Configuration Address Register
8744 + *
8745 + ******************************************************************************/
8746 +enum {
8747 +       PCICFGA_reg_b           = 2,
8748 +       PCICFGA_reg_m           = 0x000000fc,
8749 +               PCICFGA_reg_id_v        = 0x00>>2, //use PCFGID_
8750 +               PCICFGA_reg_04_v        = 0x04>>2, //use PCFG04_
8751 +               PCICFGA_reg_08_v        = 0x08>>2, //use PCFG08_
8752 +               PCICFGA_reg_0C_v        = 0x0C>>2, //use PCFG0C_
8753 +               PCICFGA_reg_pba0_v      = 0x10>>2, //use PCIPBA_
8754 +               PCICFGA_reg_pba1_v      = 0x14>>2, //use PCIPBA_
8755 +               PCICFGA_reg_pba2_v      = 0x18>>2, //use PCIPBA_
8756 +               PCICFGA_reg_pba3_v      = 0x1c>>2, //use PCIPBA_
8757 +               PCICFGA_reg_subsystem_v = 0x2c>>2, //use PCFGSS_
8758 +               PCICFGA_reg_3C_v        = 0x3C>>2, //use PCFG3C_
8759 +               PCICFGA_reg_pba0c_v     = 0x44>>2, //use PCIPBAC_
8760 +               PCICFGA_reg_pba0m_v     = 0x48>>2,
8761 +               PCICFGA_reg_pba1c_v     = 0x4c>>2, //use PCIPBAC_
8762 +               PCICFGA_reg_pba1m_v     = 0x50>>2,
8763 +               PCICFGA_reg_pba2c_v     = 0x54>>2, //use PCIPBAC_
8764 +               PCICFGA_reg_pba2m_v     = 0x58>>2,
8765 +               PCICFGA_reg_pba3c_v     = 0x5c>>2, //use PCIPBAC_
8766 +               PCICFGA_reg_pba3m_v     = 0x60>>2,
8767 +               PCICFGA_reg_pmgt_v      = 0x64>>2,
8768 +       PCICFGA_func_b          = 8,
8769 +       PCICFGA_func_m          = 0x00000700,
8770 +       PCICFGA_dev_b           = 11,
8771 +       PCICFGA_dev_m           = 0x0000f800,
8772 +               PCICFGA_dev_internal_v  = 0,
8773 +       PCICFGA_bus_b           = 16,
8774 +       PCICFGA_bus_m           = 0x00ff0000,
8775 +               PCICFGA_bus_type0_v     = 0,    //local bus
8776 +       PCICFGA_en_b            = 31,           // read only
8777 +       PCICFGA_en_m            = 0x80000000,
8778 +} ;
8779 +
8780 +enum {
8781 +       PCFGID_vendor_b         = 0,
8782 +       PCFGID_vendor_m         = 0x0000ffff,
8783 +               PCFGID_vendor_IDT_v             = 0x111d,
8784 +       PCFGID_device_b         = 16,
8785 +       PCFGID_device_m         = 0xffff0000,
8786 +               PCFGID_device_Korinade_v        = 0x0214,
8787 +
8788 +       PCFG04_command_ioena_b          = 1,
8789 +       PCFG04_command_ioena_m          = 0x00000001,
8790 +       PCFG04_command_memena_b         = 2,
8791 +       PCFG04_command_memena_m         = 0x00000002,
8792 +       PCFG04_command_bmena_b          = 3,
8793 +       PCFG04_command_bmena_m          = 0x00000004,
8794 +       PCFG04_command_mwinv_b          = 5,
8795 +       PCFG04_command_mwinv_m          = 0x00000010,
8796 +       PCFG04_command_parena_b         = 7,
8797 +       PCFG04_command_parena_m         = 0x00000040,
8798 +       PCFG04_command_serrena_b        = 9,
8799 +       PCFG04_command_serrena_m        = 0x00000100,
8800 +       PCFG04_command_fastbbena_b      = 10,
8801 +       PCFG04_command_fastbbena_m      = 0x00000200,
8802 +       PCFG04_status_b                 = 16,
8803 +       PCFG04_status_m                 = 0xffff0000,
8804 +       PCFG04_status_66MHz_b           = 21,   // 66 MHz enable
8805 +       PCFG04_status_66MHz_m           = 0x00200000,
8806 +       PCFG04_status_fbb_b             = 23,
8807 +       PCFG04_status_fbb_m             = 0x00800000,
8808 +       PCFG04_status_mdpe_b            = 24,
8809 +       PCFG04_status_mdpe_m            = 0x01000000,
8810 +       PCFG04_status_dst_b             = 25,
8811 +       PCFG04_status_dst_m             = 0x06000000,
8812 +       PCFG04_status_sta_b             = 27,
8813 +       PCFG04_status_sta_m             = 0x08000000,
8814 +       PCFG04_status_rta_b             = 28,
8815 +       PCFG04_status_rta_m             = 0x10000000,
8816 +       PCFG04_status_rma_b             = 29,
8817 +       PCFG04_status_rma_m             = 0x20000000,
8818 +       PCFG04_status_sse_b             = 30,
8819 +       PCFG04_status_sse_m             = 0x40000000,
8820 +       PCFG04_status_pe_b              = 31,
8821 +       PCFG04_status_pe_m              = 0x40000000,
8822 +
8823 +       PCFG08_revId_b                  = 0,
8824 +       PCFG08_revId_m                  = 0x000000ff,
8825 +       PCFG08_classCode_b              = 0,
8826 +       PCFG08_classCode_m              = 0xffffff00,
8827 +               PCFG08_classCode_bridge_v       = 06,
8828 +               PCFG08_classCode_proc_v         = 0x0b3000, // processor-MIPS
8829 +       PCFG0C_cacheline_b              = 0,
8830 +       PCFG0C_cacheline_m              = 0x000000ff,
8831 +       PCFG0C_masterLatency_b          = 8,
8832 +       PCFG0C_masterLatency_m          = 0x0000ff00,
8833 +       PCFG0C_headerType_b             = 16,
8834 +       PCFG0C_headerType_m             = 0x00ff0000,
8835 +       PCFG0C_bist_b                   = 24,
8836 +       PCFG0C_bist_m                   = 0xff000000,
8837 +
8838 +       PCIPBA_msi_b                    = 0,
8839 +       PCIPBA_msi_m                    = 0x00000001,
8840 +       PCIPBA_p_b                      = 3,
8841 +       PCIPBA_p_m                      = 0x00000004,
8842 +       PCIPBA_baddr_b                  = 8,
8843 +       PCIPBA_baddr_m                  = 0xffffff00,
8844 +
8845 +       PCFGSS_vendorId_b               = 0,
8846 +       PCFGSS_vendorId_m               = 0x0000ffff,
8847 +       PCFGSS_id_b                     = 16,
8848 +       PCFGSS_id_m                     = 0xffff0000,
8849 +
8850 +       PCFG3C_interruptLine_b          = 0,
8851 +       PCFG3C_interruptLine_m          = 0x000000ff,
8852 +       PCFG3C_interruptPin_b           = 8,
8853 +       PCFG3C_interruptPin_m           = 0x0000ff00,
8854 +       PCFG3C_minGrant_b               = 16,
8855 +       PCFG3C_minGrant_m               = 0x00ff0000,
8856 +       PCFG3C_maxLat_b                 = 24,
8857 +       PCFG3C_maxLat_m                 = 0xff000000,
8858 +
8859 +       PCIPBAC_msi_b                   = 0,
8860 +       PCIPBAC_msi_m                   = 0x00000001,
8861 +       PCIPBAC_p_b                     = 1,
8862 +       PCIPBAC_p_m                     = 0x00000002,
8863 +       PCIPBAC_size_b                  = 2,
8864 +       PCIPBAC_size_m                  = 0x0000007c,
8865 +       PCIPBAC_sb_b                    = 7,
8866 +       PCIPBAC_sb_m                    = 0x00000080,
8867 +       PCIPBAC_pp_b                    = 8,
8868 +       PCIPBAC_pp_m                    = 0x00000100,
8869 +       PCIPBAC_mr_b                    = 9,
8870 +       PCIPBAC_mr_m                    = 0x00000600,
8871 +               PCIPBAC_mr_read_v       =0,     //no prefetching
8872 +               PCIPBAC_mr_readLine_v   =1,
8873 +               PCIPBAC_mr_readMult_v   =2,
8874 +       PCIPBAC_mrl_b                   = 11,
8875 +       PCIPBAC_mrl_m                   = 0x00000800,
8876 +       PCIPBAC_mrm_b                   = 12,
8877 +       PCIPBAC_mrm_m                   = 0x00001000,
8878 +       PCIPBAC_trp_b                   = 13,
8879 +       PCIPBAC_trp_m                   = 0x00002000,
8880 +
8881 +       PCFG40_trdyTimeout_b            = 0,
8882 +       PCFG40_trdyTimeout_m            = 0x000000ff,
8883 +       PCFG40_retryLim_b               = 8,
8884 +       PCFG40_retryLim_m               = 0x0000ff00,
8885 +};
8886 +
8887 +/*******************************************************************************
8888 + *
8889 + * PCI Local Base Address [0|1|2|3] Register
8890 + *
8891 + ******************************************************************************/
8892 +enum {
8893 +       PCILBA_baddr_b          = 0,            // In PCI_t -> pcilba [] .a
8894 +       PCILBA_baddr_m          = 0xffffff00,
8895 +} ;
8896 +/*******************************************************************************
8897 + *
8898 + * PCI Local Base Address Control Register
8899 + *
8900 + ******************************************************************************/
8901 +enum {
8902 +       PCILBAC_msi_b           = 0,            // In pPci->pcilba[i].c
8903 +       PCILBAC_msi_m           = 0x00000001,
8904 +               PCILBAC_msi_mem_v       = 0,
8905 +               PCILBAC_msi_io_v        = 1,
8906 +       PCILBAC_size_b          = 2,    // In pPci->pcilba[i].c
8907 +       PCILBAC_size_m          = 0x0000007c,
8908 +       PCILBAC_sb_b            = 7,    // In pPci->pcilba[i].c
8909 +       PCILBAC_sb_m            = 0x00000080,
8910 +       PCILBAC_rt_b            = 8,    // In pPci->pcilba[i].c
8911 +       PCILBAC_rt_m            = 0x00000100,
8912 +               PCILBAC_rt_noprefetch_v = 0, // mem read
8913 +               PCILBAC_rt_prefetch_v   = 1, // mem readline
8914 +} ;
8915 +
8916 +/*******************************************************************************
8917 + *
8918 + * PCI Local Base Address [0|1|2|3] Mapping Register
8919 + *
8920 + ******************************************************************************/
8921 +enum {
8922 +       PCILBAM_maddr_b         = 8,
8923 +       PCILBAM_maddr_m         = 0xffffff00,
8924 +} ;
8925 +
8926 +/*******************************************************************************
8927 + *
8928 + * PCI Decoupled Access Control Register
8929 + *
8930 + ******************************************************************************/
8931 +enum {
8932 +       PCIDAC_den_b            = 0,
8933 +       PCIDAC_den_m            = 0x00000001,
8934 +} ;
8935 +
8936 +/*******************************************************************************
8937 + *
8938 + * PCI Decoupled Access Status Register
8939 + *
8940 + ******************************************************************************/
8941 +enum {
8942 +       PCIDAS_d_b      = 0,
8943 +       PCIDAS_d_m      = 0x00000001,
8944 +       PCIDAS_b_b      = 1,
8945 +       PCIDAS_b_m      = 0x00000002,
8946 +       PCIDAS_e_b      = 2,
8947 +       PCIDAS_e_m      = 0x00000004,
8948 +       PCIDAS_ofe_b    = 3,
8949 +       PCIDAS_ofe_m    = 0x00000008,
8950 +       PCIDAS_off_b    = 4,
8951 +       PCIDAS_off_m    = 0x00000010,
8952 +       PCIDAS_ife_b    = 5,
8953 +       PCIDAS_ife_m    = 0x00000020,
8954 +       PCIDAS_iff_b    = 6,
8955 +       PCIDAS_iff_m    = 0x00000040,
8956 +} ;
8957 +
8958 +/*******************************************************************************
8959 + *
8960 + * PCI DMA Channel 8 Configuration Register
8961 + *
8962 + ******************************************************************************/
8963 +enum
8964 +{
8965 +       PCIDMA8C_mbs_b  = 0,            // Maximum Burst Size.
8966 +       PCIDMA8C_mbs_m  = 0x00000fff,   // { pcidma8c }
8967 +       PCIDMA8C_our_b  = 12,           // Optimize Unaligned Burst Reads.
8968 +       PCIDMA8C_our_m  = 0x00001000,   // { pcidma8c }
8969 +} ;
8970 +
8971 +/*******************************************************************************
8972 + *
8973 + * PCI DMA Channel 9 Configuration Register
8974 + *
8975 + ******************************************************************************/
8976 +enum
8977 +{
8978 +       PCIDMA9C_mbs_b  = 0,            // Maximum Burst Size.
8979 +       PCIDMA9C_mbs_m  = 0x00000fff, // { pcidma9c }
8980 +} ;
8981 +
8982 +/*******************************************************************************
8983 + *
8984 + * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors
8985 + *
8986 + ******************************************************************************/
8987 +enum {
8988 +       PCIDMAD_pt_b            = 22,           // in DEVCMD field (descriptor)
8989 +       PCIDMAD_pt_m            = 0x00c00000,   // preferred transaction field
8990 +               // These are for reads (DMA channel 8)
8991 +               PCIDMAD_devcmd_mr_v     = 0,    //memory read
8992 +               PCIDMAD_devcmd_mrl_v    = 1,    //memory read line
8993 +               PCIDMAD_devcmd_mrm_v    = 2,    //memory read multiple
8994 +               PCIDMAD_devcmd_ior_v    = 3,    //I/O read
8995 +               // These are for writes (DMA channel 9)
8996 +               PCIDMAD_devcmd_mw_v     = 0,    //memory write
8997 +               PCIDMAD_devcmd_mwi_v    = 1,    //memory write invalidate
8998 +               PCIDMAD_devcmd_iow_v    = 3,    //I/O write
8999 +
9000 +       // Swap byte field applies to both DMA channel 8 and 9
9001 +       PCIDMAD_sb_b            = 24,           // in DEVCMD field (descriptor)
9002 +       PCIDMAD_sb_m            = 0x01000000,   // swap byte field
9003 +} ;
9004 +
9005 +
9006 +/*******************************************************************************
9007 + *
9008 + * PCI Target Control Register
9009 + *
9010 + ******************************************************************************/
9011 +enum
9012 +{
9013 +       PCITC_rtimer_b          = 0,            // In PCITC_t -> pcitc
9014 +       PCITC_rtimer_m          = 0x000000ff,
9015 +       PCITC_dtimer_b          = 8,            // In PCITC_t -> pcitc
9016 +       PCITC_dtimer_m          = 0x0000ff00,
9017 +       PCITC_rdr_b             = 18,           // In PCITC_t -> pcitc
9018 +       PCITC_rdr_m             = 0x00040000,
9019 +       PCITC_ddt_b             = 19,           // In PCITC_t -> pcitc
9020 +       PCITC_ddt_m             = 0x00080000,
9021 +} ;
9022 +/*******************************************************************************
9023 + *
9024 + * PCI messaging unit [applies to both inbound and outbound registers ]
9025 + *
9026 + ******************************************************************************/
9027 +enum
9028 +{
9029 +       PCIM_m0_b       = 0,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
9030 +       PCIM_m0_m       = 0x00000001,   // inbound or outbound message 0
9031 +       PCIM_m1_b       = 1,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
9032 +       PCIM_m1_m       = 0x00000002,   // inbound or outbound message 1
9033 +       PCIM_db_b       = 2,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
9034 +       PCIM_db_m       = 0x00000004,   // inbound or outbound doorbell
9035 +};
9036 +
9037 +
9038 +
9039 +
9040 +
9041 +
9042 +#define PCI_MSG_VirtualAddress      0xB8088010
9043 +#define rc32434_pci ((volatile PCI_t) PCI0_VirtualAddress)
9044 +#define rc32434_pci_msg ((volatile PCIM_t) PCI_MSG_VirtualAddress)
9045 +
9046 +#define PCIM_SHFT              0x6
9047 +#define PCIM_BIT_LEN           0x7
9048 +#define PCIM_H_EA              0x3
9049 +#define PCIM_H_IA_FIX          0x4
9050 +#define PCIM_H_IA_RR           0x5
9051 +#if 0
9052 +#define PCI_ADDR_START         0x13000000
9053 +#endif
9054 +
9055 +#define PCI_ADDR_START         0x50000000
9056 +
9057 +#define CPUTOPCI_MEM_WIN       0x02000000
9058 +#define CPUTOPCI_IO_WIN                0x00100000
9059 +#define PCILBA_SIZE_SHFT       2
9060 +#define PCILBA_SIZE_MASK       0x1F
9061 +#define SIZE_256MB             0x1C
9062 +#define SIZE_128MB             0x1B
9063 +#define SIZE_64MB               0x1A
9064 +#define SIZE_32MB              0x19
9065 +#define SIZE_16MB               0x18
9066 +#define SIZE_4MB               0x16
9067 +#define SIZE_2MB               0x15
9068 +#define SIZE_1MB               0x14
9069 +#define KORINA_CONFIG0_ADDR    0x80000000
9070 +#define KORINA_CONFIG1_ADDR    0x80000004
9071 +#define KORINA_CONFIG2_ADDR    0x80000008
9072 +#define KORINA_CONFIG3_ADDR    0x8000000C
9073 +#define KORINA_CONFIG4_ADDR    0x80000010
9074 +#define KORINA_CONFIG5_ADDR    0x80000014
9075 +#define KORINA_CONFIG6_ADDR    0x80000018
9076 +#define KORINA_CONFIG7_ADDR    0x8000001C
9077 +#define KORINA_CONFIG8_ADDR    0x80000020
9078 +#define KORINA_CONFIG9_ADDR    0x80000024
9079 +#define KORINA_CONFIG10_ADDR   0x80000028
9080 +#define KORINA_CONFIG11_ADDR   0x8000002C
9081 +#define KORINA_CONFIG12_ADDR   0x80000030
9082 +#define KORINA_CONFIG13_ADDR   0x80000034
9083 +#define KORINA_CONFIG14_ADDR   0x80000038
9084 +#define KORINA_CONFIG15_ADDR   0x8000003C
9085 +#define KORINA_CONFIG16_ADDR   0x80000040
9086 +#define KORINA_CONFIG17_ADDR   0x80000044
9087 +#define KORINA_CONFIG18_ADDR   0x80000048
9088 +#define KORINA_CONFIG19_ADDR   0x8000004C
9089 +#define KORINA_CONFIG20_ADDR   0x80000050
9090 +#define KORINA_CONFIG21_ADDR   0x80000054
9091 +#define KORINA_CONFIG22_ADDR   0x80000058
9092 +#define KORINA_CONFIG23_ADDR   0x8000005C
9093 +#define KORINA_CONFIG24_ADDR   0x80000060
9094 +#define KORINA_CONFIG25_ADDR   0x80000064
9095 +#define KORINA_CMD             (PCFG04_command_ioena_m | \
9096 +                                PCFG04_command_memena_m | \
9097 +                                PCFG04_command_bmena_m | \
9098 +                                PCFG04_command_mwinv_m | \
9099 +                                PCFG04_command_parena_m | \
9100 +                                PCFG04_command_serrena_m )
9101 +
9102 +#define KORINA_STAT            (PCFG04_status_mdpe_m | \
9103 +                                PCFG04_status_sta_m  | \
9104 +                                PCFG04_status_rta_m  | \
9105 +                                PCFG04_status_rma_m  | \
9106 +                                PCFG04_status_sse_m  | \
9107 +                                PCFG04_status_pe_m)
9108 +
9109 +#define KORINA_CNFG1           ((KORINA_STAT<<16)|KORINA_CMD)
9110 +
9111 +#define KORINA_REVID           0
9112 +#define KORINA_CLASS_CODE      0
9113 +#define KORINA_CNFG2           ((KORINA_CLASS_CODE<<8) | \
9114 +                                 KORINA_REVID)
9115 +
9116 +#define KORINA_CACHE_LINE_SIZE 4
9117 +#define KORINA_MASTER_LAT      0x3c
9118 +#define KORINA_HEADER_TYPE     0
9119 +#define KORINA_BIST            0
9120 +
9121 +#define KORINA_CNFG3 ((KORINA_BIST << 24) | \
9122 +                     (KORINA_HEADER_TYPE<<16) | \
9123 +                     (KORINA_MASTER_LAT<<8) | \
9124 +                     KORINA_CACHE_LINE_SIZE )
9125 +
9126 +#define KORINA_BAR0    0x00000008 /* 128 MB Memory */
9127 +#define KORINA_BAR1    0x18800001 /* 1 MB IO */
9128 +#define KORINA_BAR2    0x18000001 /* 2 MB IO window for Korina
9129 +                                       internal Registers */
9130 +#define KORINA_BAR3    0x48000008 /* Spare 128 MB Memory */
9131 +
9132 +#define KORINA_CNFG4   KORINA_BAR0
9133 +#define KORINA_CNFG5    KORINA_BAR1
9134 +#define KORINA_CNFG6   KORINA_BAR2
9135 +#define KORINA_CNFG7   KORINA_BAR3
9136 +
9137 +#define KORINA_SUBSYS_VENDOR_ID 0x011d
9138 +#define KORINA_SUBSYSTEM_ID    0x0214
9139 +#define KORINA_CNFG8           0
9140 +#define KORINA_CNFG9           0
9141 +#define KORINA_CNFG10          0
9142 +#define KORINA_CNFG11  ((KORINA_SUBSYS_VENDOR_ID<<16) | \
9143 +                         KORINA_SUBSYSTEM_ID)
9144 +#define KORINA_INT_LINE                1
9145 +#define KORINA_INT_PIN         1
9146 +#define KORINA_MIN_GNT         8
9147 +#define KORINA_MAX_LAT         0x38
9148 +#define KORINA_CNFG12          0
9149 +#define KORINA_CNFG13          0
9150 +#define KORINA_CNFG14          0
9151 +#define KORINA_CNFG15  ((KORINA_MAX_LAT<<24) | \
9152 +                        (KORINA_MIN_GNT<<16) | \
9153 +                        (KORINA_INT_PIN<<8)  | \
9154 +                         KORINA_INT_LINE)
9155 +#define        KORINA_RETRY_LIMIT      0x80
9156 +#define KORINA_TRDY_LIMIT      0x80
9157 +#define KORINA_CNFG16 ((KORINA_RETRY_LIMIT<<8) | \
9158 +                       KORINA_TRDY_LIMIT)
9159 +#define PCI_PBAxC_R            0x0
9160 +#define PCI_PBAxC_RL           0x1
9161 +#define PCI_PBAxC_RM           0x2
9162 +#define SIZE_SHFT              2
9163 +
9164 +#if defined(__MIPSEB__)
9165 +#define KORINA_PBA0C   ( PCIPBAC_mrl_m | PCIPBAC_sb_m | \
9166 +                         ((PCI_PBAxC_RM &0x3) << PCIPBAC_mr_b) | \
9167 +                         PCIPBAC_pp_m | \
9168 +                         (SIZE_128MB<<SIZE_SHFT) | \
9169 +                          PCIPBAC_p_m)
9170 +#else
9171 +#define KORINA_PBA0C   ( PCIPBAC_mrl_m | \
9172 +                         ((PCI_PBAxC_RM &0x3) << PCIPBAC_mr_b) | \
9173 +                         PCIPBAC_pp_m | \
9174 +                         (SIZE_128MB<<SIZE_SHFT) | \
9175 +                          PCIPBAC_p_m)
9176 +#endif
9177 +#define KORINA_CNFG17  KORINA_PBA0C
9178 +#define KORINA_PBA0M   0x0
9179 +#define KORINA_CNFG18  KORINA_PBA0M
9180 +
9181 +#if defined(__MIPSEB__)
9182 +#define KORINA_PBA1C   ((SIZE_1MB<<SIZE_SHFT) | PCIPBAC_sb_m | \
9183 +                         PCIPBAC_msi_m)
9184 +#else
9185 +#define KORINA_PBA1C   ((SIZE_1MB<<SIZE_SHFT) | \
9186 +                         PCIPBAC_msi_m)
9187 +#endif
9188 +#define KORINA_CNFG19  KORINA_PBA1C
9189 +#define KORINA_PBA1M   0x0
9190 +#define KORINA_CNFG20  KORINA_PBA1M
9191 +
9192 +#if defined(__MIPSEB__)
9193 +#define KORINA_PBA2C   ((SIZE_2MB<<SIZE_SHFT) | PCIPBAC_sb_m | \
9194 +                         PCIPBAC_msi_m)
9195 +#else
9196 +#define KORINA_PBA2C   ((SIZE_2MB<<SIZE_SHFT) | \
9197 +                         PCIPBAC_msi_m)
9198 +#endif
9199 +#define KORINA_CNFG21  KORINA_PBA2C
9200 +#define KORINA_PBA2M   0x18000000
9201 +#define KORINA_CNFG22  KORINA_PBA2M
9202 +#define KORINA_PBA3C   0
9203 +#define KORINA_CNFG23  KORINA_PBA3C
9204 +#define KORINA_PBA3M   0
9205 +#define KORINA_CNFG24  KORINA_PBA3M
9206 +
9207 +
9208 +
9209 +#define        PCITC_DTIMER_VAL        8
9210 +#define PCITC_RTIMER_VAL       0x10
9211 +
9212 +
9213 +
9214 +
9215 +#endif // __IDT_PCI_H__
9216 +
9217 +
9218 +
9219 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_rst.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_rst.h
9220 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_rst.h      1970-01-01 01:00:00.000000000 +0100
9221 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_rst.h      2006-01-10 00:32:33.000000000 +0100
9222 @@ -0,0 +1,119 @@
9223 +/**************************************************************************
9224 + *
9225 + *  BRIEF MODULE DESCRIPTION
9226 + *   Reset register definitions.
9227 + *
9228 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
9229 + *         
9230 + *  This program is free software; you can redistribute  it and/or modify it
9231 + *  under  the terms of  the GNU General  Public License as published by the
9232 + *  Free Software Foundation;  either version 2 of the  License, or (at your
9233 + *  option) any later version.
9234 + *
9235 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
9236 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
9237 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
9238 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
9239 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
9240 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
9241 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9242 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
9243 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9244 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9245 + *
9246 + *  You should have received a copy of the  GNU General Public License along
9247 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
9248 + *  675 Mass Ave, Cambridge, MA 02139, USA.
9249 + *
9250 + *
9251 + **************************************************************************
9252 + * May 2004 rkt, neb.
9253 + *
9254 + * Initial Release
9255 + *
9256 + * 
9257 + *
9258 + **************************************************************************
9259 + */
9260 +
9261 +#ifndef __IDT_RST_H__
9262 +#define __IDT_RST_H__
9263 +
9264 +enum
9265 +{
9266 +       RST0_PhysicalAddress    = 0x18000000,
9267 +       RST_PhysicalAddress     = RST0_PhysicalAddress,         // Default
9268 +
9269 +       RST0_VirtualAddress     = 0xb8000000,
9270 +       RST_VirtualAddress      = RST0_VirtualAddress,          // Default
9271 +} ;
9272 +
9273 +typedef struct RST_s
9274 +{
9275 +       u32     filler [0x0006] ;
9276 +       u32     sysid ;
9277 +       u32     filler2 [0x2000-8] ;            // Pad out to offset 0x8000
9278 +       u32     reset ;
9279 +       u32     bcv ;
9280 +       u32     cea ;
9281 +} volatile * RST_t ;
9282 +
9283 +enum
9284 +{
9285 +       SYSID_rev_b             = 0,
9286 +       SYSID_rev_m             = 0x000000ff,
9287 +       SYSID_imp_b             = 8,
9288 +       SYSID_imp_m             = 0x000fff00,
9289 +       SYSID_vendor_b          = 8,
9290 +       SYSID_vendor_m          = 0xfff00000,
9291 +
9292 +       BCV_pll_b               = 0,
9293 +       BCV_pll_m               = 0x0000000f,
9294 +               BCV_pll_PLLBypass_v     = 0x0,  // PCLK=1*CLK.
9295 +               BCV_pll_Mul3_v          = 0x1,  // PCLK=3*CLK.
9296 +               BCV_pll_Mul4_v          = 0x2,  // PCLK=4*CLK.
9297 +               BCV_pll_SlowMul5_v      = 0x3,  // PCLK=5*CLK.
9298 +               BCV_pll_Mul5_v          = 0x4,  // PCLK=5*CLK.
9299 +               BCV_pll_SlowMul6_v      = 0x5,  // PCLK=6*CLK.
9300 +               BCV_pll_Mul6_v          = 0x6,  // PCLK=6*CLK.
9301 +               BCV_pll_Mul8_v          = 0x7,  // PCLK=8*CLK.
9302 +               BCV_pll_Mul10_v         = 0x8,  // PCLK=10*CLK.
9303 +               BCV_pll_Res9_v          = 0x9,
9304 +               BCV_pll_Res10_v         = 0xa,
9305 +               BCV_pll_Res11_v         = 0xb,
9306 +               BCV_pll_Res12_v         = 0xc,
9307 +               BCV_pll_Res13_v         = 0xd,
9308 +               BCV_pll_Res14_v         = 0xe,
9309 +               BCV_pll_Res15_v         = 0xf,
9310 +       BCV_clkDiv_b            = 4,
9311 +       BCV_clkDiv_m            = 0x00000030,
9312 +               BCV_clkDiv_Div1_v       = 0x0,
9313 +               BCV_clkDiv_Div2_v       = 0x1,
9314 +               BCV_clkDiv_Div4_v       = 0x2,
9315 +               BCV_clkDiv_Res3_v       = 0x3,
9316 +       BCV_bigEndian_b         = 6,
9317 +       BCV_bigEndian_m         = 0x00000040,
9318 +       BCV_resetFast_b         = 7,
9319 +       BCV_resetFast_m         = 0x00000080,
9320 +       BCV_pciMode_b           = 8,
9321 +       BCV_pciMode_m           = 0x00000700,
9322 +               BCV_pciMode_disabled_v  = 0,    // PCI is disabled.
9323 +               BCV_pciMode_tnr_v       = 1,    // satellite Target Not Ready.
9324 +               BCV_pciMode_suspended_v = 2,    // satellite with suspended CPU.
9325 +               BCV_pciMode_external_v  = 3,    // host, external arbiter.
9326 +               BCV_pciMode_fixed_v     = 4,    // host, fixed priority arbiter.
9327 +               BCV_pciMode_roundRobin_v= 5,    // host, round robin arbiter.
9328 +               BCV_pciMode_res6_v      = 6,
9329 +               BCV_pciMode_res7_v      = 7,
9330 +       BCV_watchDisable_b      = 11,
9331 +       BCV_watchDisable_m      = 0x00000800,
9332 +       BCV_res12_b             = 12,
9333 +       BCV_res12_m             = 0x00001000,
9334 +       BCV_res13_b             = 13,
9335 +       BCV_res13_m             = 0x00002000,
9336 +       BCV_res14_b             = 14,
9337 +       BCV_res14_m             = 0x00004000,
9338 +       BCV_res15_b             = 15,
9339 +       BCV_res15_m             = 0x00008000,
9340 +} ;
9341 +#endif // __IDT_RST_H__
9342 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_spi.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_spi.h
9343 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_spi.h      1970-01-01 01:00:00.000000000 +0100
9344 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_spi.h      2006-01-10 00:32:33.000000000 +0100
9345 @@ -0,0 +1,120 @@
9346 +/**************************************************************************
9347 + *
9348 + *  BRIEF MODULE DESCRIPTION
9349 + *   Serial Peripheral Interface register definitions.
9350 + *
9351 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
9352 + *         
9353 + *  This program is free software; you can redistribute  it and/or modify it
9354 + *  under  the terms of  the GNU General  Public License as published by the
9355 + *  Free Software Foundation;  either version 2 of the  License, or (at your
9356 + *  option) any later version.
9357 + *
9358 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
9359 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
9360 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
9361 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
9362 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
9363 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
9364 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9365 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
9366 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9367 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9368 + *
9369 + *  You should have received a copy of the  GNU General Public License along
9370 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
9371 + *  675 Mass Ave, Cambridge, MA 02139, USA.
9372 + *
9373 + *
9374 + **************************************************************************
9375 + * May 2004 rkt, neb.
9376 + *
9377 + * Initial Release
9378 + *
9379 + * 
9380 + *
9381 + **************************************************************************
9382 + */
9383 +
9384 +#ifndef __IDT_SPI_H__
9385 +#define __IDT_SPI_H__
9386 +
9387 +enum
9388 +{
9389 +       SPI0_PhysicalAddress    = 0x18070000,
9390 +       SPI_PhysicalAddress     = SPI0_PhysicalAddress,
9391 +
9392 +       SPI0_VirtualAddress     = 0xB8070000,
9393 +       SPI_VirtualAddress      = SPI0_VirtualAddress,
9394 +} ;
9395 +
9396 +typedef struct
9397 +{
9398 +       u32 spcp ;      // prescalar. 0=off, * spiClk = sysClk/(2*(spcp+1)*SPR)
9399 +       u32 spc ;       // spi control reg use SPC_
9400 +       u32 sps ;       // spi status reg use SPS_
9401 +       u32 spd ;       // spi data reg use SPD_
9402 +       u32 siofunc ;   // serial IO function use SIOFUNC_
9403 +       u32 siocfg ;    // serial IO config use SIOCFG_
9404 +       u32 siod;       // serial IO data use SIOD_
9405 +} volatile *SPI_t ;
9406 +
9407 +enum
9408 +{
9409 +       SPCP_div_b       = 0,          
9410 +       SPCP_div_m       = 0x000000ff,
9411 +       SPC_spr_b       = 0,           
9412 +       SPC_spr_m       = 0x00000003,
9413 +            SPC_spr_div2_v  = 0,
9414 +            SPC_spr_div4_v  = 1,
9415 +            SPC_spr_div16_v = 2,
9416 +            SPC_spr_div32_v = 3,
9417 +       SPC_cpha_b      = 2,           
9418 +       SPC_cpha_m      = 0x00000004,
9419 +       SPC_cpol_b      = 3,           
9420 +       SPC_cpol_m      = 0x00000008,
9421 +       SPC_mstr_b      = 4,           
9422 +       SPC_mstr_m      = 0x00000010,
9423 +       SPC_spe_b       = 6,           
9424 +       SPC_spe_m       = 0x00000040,
9425 +       SPC_spie_b      = 7,           
9426 +       SPC_spie_m      = 0x00000080,
9427 +
9428 +       SPS_modf_b      = 4,           
9429 +       SPS_modf_m      = 0x00000010,
9430 +       SPS_wcol_b      = 6,           
9431 +       SPS_wcol_m      = 0x00000040,
9432 +       SPS_spif_b      = 7,           
9433 +       SPS_spif_m      = 0x00000070,
9434 +
9435 +       SPD_data_b      = 0,           
9436 +       SPD_data_m      = 0x000000ff,
9437 +
9438 +       SIOFUNC_sdo_b       = 0,           
9439 +       SIOFUNC_sdo_m       = 0x00000001,
9440 +       SIOFUNC_sdi_b       = 1,           
9441 +       SIOFUNC_sdi_m       = 0x00000002,
9442 +       SIOFUNC_sck_b       = 2,           
9443 +       SIOFUNC_sck_m       = 0x00000004,
9444 +       SIOFUNC_pci_b       = 3,           
9445 +       SIOFUNC_pci_m       = 0x00000008,
9446 +       
9447 +       SIOCFG_sdo_b       = 0,            
9448 +       SIOCFG_sdo_m       = 0x00000001,
9449 +       SIOCFG_sdi_b       = 1,            
9450 +       SIOCFG_sdi_m       = 0x00000002,
9451 +       SIOCFG_sck_b       = 2,            
9452 +       SIOCFG_sck_m       = 0x00000004,
9453 +       SIOCFG_pci_b       = 3,            
9454 +       SIOCFG_pci_m       = 0x00000008,
9455 +       
9456 +       SIOD_sdo_b       = 0,            
9457 +       SIOD_sdo_m       = 0x00000001,
9458 +       SIOD_sdi_b       = 1,            
9459 +       SIOD_sdi_m       = 0x00000002,
9460 +       SIOD_sck_b       = 2,            
9461 +       SIOD_sck_m       = 0x00000004,
9462 +       SIOD_pci_b       = 3,            
9463 +       SIOD_pci_m       = 0x00000008,
9464 +} ;
9465 +#endif // __IDT_SPI_H__
9466 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_timer.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_timer.h
9467 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_timer.h    1970-01-01 01:00:00.000000000 +0100
9468 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_timer.h    2006-01-10 00:32:33.000000000 +0100
9469 @@ -0,0 +1,91 @@
9470 +/**************************************************************************
9471 + *
9472 + *  BRIEF MODULE DESCRIPTION
9473 + *   Definitions for timer registers
9474 + *
9475 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
9476 + *         
9477 + *  This program is free software; you can redistribute  it and/or modify it
9478 + *  under  the terms of  the GNU General  Public License as published by the
9479 + *  Free Software Foundation;  either version 2 of the  License, or (at your
9480 + *  option) any later version.
9481 + *
9482 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
9483 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
9484 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
9485 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
9486 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
9487 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
9488 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9489 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
9490 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9491 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9492 + *
9493 + *  You should have received a copy of the  GNU General Public License along
9494 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
9495 + *  675 Mass Ave, Cambridge, MA 02139, USA.
9496 + *
9497 + *
9498 + **************************************************************************
9499 + * May 2004 rkt,neb.
9500 + *
9501 + * Initial Release
9502 + *
9503 + * 
9504 + *
9505 + **************************************************************************
9506 + */
9507 +
9508 +#ifndef __IDT_TIM_H__
9509 +#define __IDT_TIM_H__
9510 +
9511 +enum
9512 +{
9513 +       TIM0_PhysicalAddress    = 0x18028000,
9514 +       TIM_PhysicalAddress     = TIM0_PhysicalAddress,         // Default
9515 +
9516 +       TIM0_VirtualAddress     = 0xb8028000,
9517 +       TIM_VirtualAddress      = TIM0_VirtualAddress,          // Default
9518 +} ;
9519 +
9520 +enum
9521 +{
9522 +       TIM_Count = 3,
9523 +} ;
9524 +
9525 +struct TIM_CNTR_s
9526 +{
9527 +  u32 count ;
9528 +  u32 compare ;
9529 +  u32 ctc ;    //use CTC_
9530 +} ;
9531 +
9532 +typedef struct TIM_s
9533 +{
9534 +  struct TIM_CNTR_s    tim [TIM_Count] ;
9535 +  u32                  rcount ;        //use RCOUNT_
9536 +  u32                  rcompare ;      //use RCOMPARE_
9537 +  u32                  rtc ;           //use RTC_
9538 +} volatile * TIM_t ;
9539 +
9540 +enum
9541 +{
9542 +  CTC_en_b     = 0,            
9543 +  CTC_en_m     = 0x00000001,
9544 +  CTC_to_b     = 1,             
9545 +  CTC_to_m     = 0x00000002,
9546 +  
9547 +  RCOUNT_count_b               = 0,         
9548 +  RCOUNT_count_m               = 0x0000ffff,
9549 +  RCOMPARE_compare_b   = 0,       
9550 +  RCOMPARE_compare_m   = 0x0000ffff,
9551 +  RTC_ce_b             = 0,            
9552 +  RTC_ce_m             = 0x00000001,
9553 +  RTC_to_b             = 1,            
9554 +  RTC_to_m             = 0x00000002,
9555 +  RTC_rqe_b            = 2,            
9556 +  RTC_rqe_m            = 0x00000004,
9557 +  
9558 +} ;
9559 +#endif // __IDT_TIM_H__
9560 +
9561 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_uart.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_uart.h
9562 --- linux-2.6.15/include/asm-mips/idt-boards/rc32434/rc32434_uart.h     1970-01-01 01:00:00.000000000 +0100
9563 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32434/rc32434_uart.h     2006-01-10 00:32:33.000000000 +0100
9564 @@ -0,0 +1,189 @@
9565 +/**************************************************************************
9566 + *
9567 + *  BRIEF MODULE DESCRIPTION
9568 + *   UART register definitions
9569 + *
9570 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
9571 + *         
9572 + *  This program is free software; you can redistribute  it and/or modify it
9573 + *  under  the terms of  the GNU General  Public License as published by the
9574 + *  Free Software Foundation;  either version 2 of the  License, or (at your
9575 + *  option) any later version.
9576 + *
9577 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
9578 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
9579 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
9580 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
9581 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
9582 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
9583 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9584 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
9585 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9586 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9587 + *
9588 + *  You should have received a copy of the  GNU General Public License along
9589 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
9590 + *  675 Mass Ave, Cambridge, MA 02139, USA.
9591 + *
9592 + *
9593 + **************************************************************************
9594 + * May 2004 rkt, neb.
9595 + *
9596 + * Initial Release
9597 + *
9598 + * 
9599 + *
9600 + **************************************************************************
9601 + */
9602 +
9603 +#ifndef __IDT_UART_H__
9604 +#define __IDT_UART_H__
9605 +
9606 +enum
9607 +{
9608 +       UART0_PhysicalAddress   = 0x1c000000,
9609 +       UART_PhysicalAddress    = UART0_PhysicalAddress,        // Default
9610 +
9611 +       UART0_VirtualAddress    = 0xbc000000,
9612 +       UART_VirtualAddress     = UART0_VirtualAddress,         // Default
9613 +} ;
9614 +
9615 +/*
9616 + * Register definitions are in bytes so we can handle endian problems.
9617 + */
9618 +
9619 +typedef struct UART_s
9620 +{
9621 +       union
9622 +       {
9623 +               u32 const       uartrb ;        // 0x00 - DLAB=0, read.
9624 +               u32             uartth ;        // 0x00 - DLAB=0, write.
9625 +               u32             uartdll ;       // 0x00 - DLAB=1, read/write.
9626 +       } ;
9627 +
9628 +       union
9629 +       {
9630 +               u32             uartie ;        // 0x04 - DLAB=0, read/write.
9631 +               u32             uartdlh ;       // 0x04 - DLAB=1, read/write.
9632 +       } ;
9633 +       union
9634 +       {
9635 +               u32 const       uartii ;        // 0x08 - DLAB=0, read.
9636 +               u32             uartfc ;        // 0x08 - DLAB=0, write.
9637 +       } ;
9638 +
9639 +       u32             uartlc ;                // 0x0c
9640 +       u32             uartmc ;                // 0x10
9641 +       u32             uartls ;                // 0x14
9642 +       u32             uartms ;                // 0x18
9643 +       u32             uarts ;                 // 0x1c
9644 +} volatile *UART_t ;
9645 +
9646 +// Reset registers.
9647 +typedef u32    volatile *UARTRR_t ;
9648 +
9649 +enum
9650 +{
9651 +       UARTIE_rda_b    = 0,
9652 +       UARTIE_rda_m    = 0x00000001,
9653 +       UARTIE_the_b    = 1,
9654 +       UARTIE_the_m    = 0x00000002,
9655 +       UARTIE_rls_b    = 2,
9656 +       UARTIE_rls_m    = 0x00000004,
9657 +       UARTIE_ems_b    = 3,
9658 +       UARTIE_ems_m    = 0x00000008,
9659 +
9660 +       UARTII_pi_b     = 0,
9661 +       UARTII_pi_m     = 0x00000001,
9662 +       UARTII_iid_b    = 1,
9663 +       UARTII_iid_m    = 0x0000000e,
9664 +               UARTII_iid_ms_v         = 0,    // Modem stat-CTS,DSR,RI or DCD.
9665 +               UARTII_iid_thre_v       = 1,    // Trans. Holding Reg. empty.
9666 +               UARTII_iid_rda_v        = 2,    // Receive data available
9667 +               UARTII_iid_rls_v        = 3,    // Overrun, parity, etc, error.
9668 +               UARTII_iid_res4_v       = 4,    // reserved.
9669 +               UARTII_iid_res5_v       = 5,    // reserved.
9670 +               UARTII_iid_cto_v        = 6,    // Character timeout.
9671 +               UARTII_iid_res7_v       = 7,    // reserved.
9672 +
9673 +       UARTFC_en_b     = 0,
9674 +       UARTFC_en_m     = 0x00000001,
9675 +       UARTFC_rr_b     = 1,
9676 +       UARTFC_rr_m     = 0x00000002,
9677 +       UARTFC_tr_b     = 2,
9678 +       UARTFC_tr_m     = 0x00000004,
9679 +       UARTFC_dms_b    = 3,
9680 +       UARTFC_dms_m    = 0x00000008,
9681 +       UARTFC_rt_b     = 6,
9682 +       UARTFC_rt_m     = 0x000000c0,
9683 +               UARTFC_rt_1Byte_v       = 0,
9684 +               UARTFC_rt_4Byte_v       = 1,
9685 +               UARTFC_rt_8Byte_v       = 2,
9686 +               UARTFC_rt_14Byte_v      = 3,
9687 +
9688 +       UARTLC_wls_b    = 0,
9689 +       UARTLC_wls_m    = 0x00000003,
9690 +               UARTLC_wls_5Bits_v      = 0,
9691 +               UARTLC_wls_6Bits_v      = 1,
9692 +               UARTLC_wls_7Bits_v      = 2,
9693 +               UARTLC_wls_8Bits_v      = 3,
9694 +       UARTLC_stb_b    = 2,
9695 +       UARTLC_stb_m    = 0x00000004,
9696 +       UARTLC_pen_b    = 3,
9697 +       UARTLC_pen_m    = 0x00000008,
9698 +       UARTLC_eps_b    = 4,
9699 +       UARTLC_eps_m    = 0x00000010,
9700 +       UARTLC_sp_b     = 5,
9701 +       UARTLC_sp_m     = 0x00000020,
9702 +       UARTLC_sb_b     = 6,
9703 +       UARTLC_sb_m     = 0x00000040,
9704 +       UARTLC_dlab_b   = 7,
9705 +       UARTLC_dlab_m   = 0x00000080,
9706 +
9707 +       UARTMC_dtr_b    = 0,
9708 +       UARTMC_dtr_m    = 0x00000001,
9709 +       UARTMC_rts_b    = 1,
9710 +       UARTMC_rts_m    = 0x00000002,
9711 +       UARTMC_o1_b     = 2,
9712 +       UARTMC_o1_m     = 0x00000004,
9713 +       UARTMC_o2_b     = 3,
9714 +       UARTMC_o2_m     = 0x00000008,
9715 +       UARTMC_lp_b     = 4,
9716 +       UARTMC_lp_m     = 0x00000010,
9717 +
9718 +       UARTLS_dr_b     = 0,
9719 +       UARTLS_dr_m     = 0x00000001,
9720 +       UARTLS_oe_b     = 1,
9721 +       UARTLS_oe_m     = 0x00000002,
9722 +       UARTLS_pe_b     = 2,
9723 +       UARTLS_pe_m     = 0x00000004,
9724 +       UARTLS_fe_b     = 3,
9725 +       UARTLS_fe_m     = 0x00000008,
9726 +       UARTLS_bi_b     = 4,
9727 +       UARTLS_bi_m     = 0x00000010,
9728 +       UARTLS_thr_b    = 5,
9729 +       UARTLS_thr_m    = 0x00000020,
9730 +       UARTLS_te_b     = 6,
9731 +       UARTLS_te_m     = 0x00000040,
9732 +       UARTLS_rfe_b    = 7,
9733 +       UARTLS_rfe_m    = 0x00000080,
9734 +
9735 +       UARTMS_dcts_b   = 0,
9736 +       UARTMS_dcts_m   = 0x00000001,
9737 +       UARTMS_ddsr_b   = 1,
9738 +       UARTMS_ddsr_m   = 0x00000002,
9739 +       UARTMS_teri_b   = 2,
9740 +       UARTMS_teri_m   = 0x00000004,
9741 +       UARTMS_ddcd_b   = 3,
9742 +       UARTMS_ddcd_m   = 0x00000008,
9743 +       UARTMS_cts_b    = 4,
9744 +       UARTMS_cts_m    = 0x00000010,
9745 +       UARTMS_dsr_b    = 5,
9746 +       UARTMS_dsr_m    = 0x00000020,
9747 +       UARTMS_ri_b     = 6,
9748 +       UARTMS_ri_m     = 0x00000040,
9749 +       UARTMS_dcd_b    = 7,
9750 +       UARTMS_dcd_m    = 0x00000080,
9751 +} ;
9752 +
9753 +#endif // __IDT_UART_H__
9754 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_dma.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_dma.h
9755 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_dma.h      1970-01-01 01:00:00.000000000 +0100
9756 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_dma.h      2006-01-10 00:32:33.000000000 +0100
9757 @@ -0,0 +1,231 @@
9758 +/**************************************************************************
9759 + *
9760 + *  BRIEF MODULE DESCRIPTION
9761 + *   Register definitions for  IDT RC32438 DMA.
9762 + *
9763 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
9764 + *         
9765 + *  This program is free software; you can redistribute  it and/or modify it
9766 + *  under  the terms of  the GNU General  Public License as published by the
9767 + *  Free Software Foundation;  either version 2 of the  License, or (at your
9768 + *  option) any later version.
9769 + *
9770 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
9771 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
9772 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
9773 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
9774 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
9775 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
9776 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
9777 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
9778 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
9779 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9780 + *
9781 + *  You should have received a copy of the  GNU General Public License along
9782 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
9783 + *  675 Mass Ave, Cambridge, MA 02139, USA.
9784 + *
9785 + *
9786 + **************************************************************************
9787 + * May 2004 P. Sadik.
9788 + *
9789 + * Initial Release
9790 + *
9791 + * 
9792 + *
9793 + **************************************************************************
9794 + */
9795 +#ifndef __IDT_RC32438_DMA_H__
9796 +#define __IDT_RC32438_DMA_H__
9797 +enum
9798 +{
9799 +       DMA0_PhysicalAddress    = 0x18040000,
9800 +       DMA_PhysicalAddress     = DMA0_PhysicalAddress,         // Default
9801 +
9802 +       DMA0_VirtualAddress     = 0xb8040000,
9803 +       DMA_VirtualAddress      = DMA0_VirtualAddress,          // Default
9804 +} ;
9805 +
9806 +/*
9807 + * DMA descriptor (in physical memory).
9808 + */
9809 +
9810 +typedef struct DMAD_s
9811 +{
9812 +       u32                     control ;       // Control. use DMAD_*
9813 +       u32                     ca ;            // Current Address.
9814 +       u32                     devcs ;         // Device control and status.
9815 +       u32                     link ;          // Next descriptor in chain.
9816 +} volatile *DMAD_t ;
9817 +
9818 +enum
9819 +{
9820 +       DMAD_size               = sizeof (struct DMAD_s),
9821 +       DMAD_count_b            = 0,            // in DMAD_t -> control
9822 +       DMAD_count_m            = 0x0003ffff,   // in DMAD_t -> control
9823 +       DMAD_ds_b               = 20,           // in DMAD_t -> control
9824 +       DMAD_ds_m               = 0x00300000,   // in DMAD_t -> control
9825 +               DMAD_ds_extToMem0_v     = 0,
9826 +               DMAD_ds_memToExt0_v     = 1,
9827 +               DMAD_ds_extToMem1_v     = 0,
9828 +               DMAD_ds_memToExt1_v     = 1,
9829 +               DMAD_ds_ethRcv0_v       = 0,
9830 +               DMAD_ds_ethXmt0_v       = 0,
9831 +               DMAD_ds_ethRcv1_v       = 0,
9832 +               DMAD_ds_ethXmt2_v       = 0,
9833 +               DMAD_ds_memToFifo_v     = 0,
9834 +               DMAD_ds_fifoToMem_v     = 0,
9835 +               DMAD_ds_rng_de_v           = 1,//randomNumberGenerator on LC/DE
9836 +               DMAD_ds_pciToMem_v      = 0,
9837 +               DMAD_ds_memToPci_v      = 0,
9838 +               DMAD_ds_securityInput_v = 0,
9839 +               DMAD_ds_securityOutput_v = 0,
9840 +               DMAD_ds_rng_se_v        = 0,//randomNumberGenerator on SE
9841 +       
9842 +       DMAD_devcmd_b           = 22,           // in DMAD_t -> control
9843 +       DMAD_devcmd_m           = 0x01c00000,   // in DMAD_t -> control
9844 +               DMAD_devcmd_byte_v      = 0,    //memory-to-memory
9845 +               DMAD_devcmd_halfword_v  = 1,    //memory-to-memory
9846 +               DMAD_devcmd_word_v      = 2,    //memory-to-memory
9847 +               DMAD_devcmd_2words_v    = 3,    //memory-to-memory
9848 +               DMAD_devcmd_4words_v    = 4,    //memory-to-memory
9849 +               DMAD_devcmd_6words_v    = 5,    //memory-to-memory
9850 +               DMAD_devcmd_8words_v    = 6,    //memory-to-memory
9851 +               DMAD_devcmd_16words_v   = 7,    //memory-to-memory
9852 +       DMAD_cof_b              = 25,           // chain on finished
9853 +       DMAD_cof_m              = 0x02000000,   // 
9854 +       DMAD_cod_b              = 26,           // chain on done
9855 +       DMAD_cod_m              = 0x04000000,   // 
9856 +       DMAD_iof_b              = 27,           // interrupt on finished
9857 +       DMAD_iof_m              = 0x08000000,   // 
9858 +       DMAD_iod_b              = 28,           // interrupt on done
9859 +       DMAD_iod_m              = 0x10000000,   // 
9860 +       DMAD_t_b                = 29,           // terminated
9861 +       DMAD_t_m                = 0x20000000,   // 
9862 +       DMAD_d_b                = 30,           // done
9863 +       DMAD_d_m                = 0x40000000,   // 
9864 +       DMAD_f_b                = 31,           // finished
9865 +       DMAD_f_m                = 0x80000000,   // 
9866 +} ;
9867 +
9868 +/*
9869 + * DMA register (within Internal Register Map).
9870 + */
9871 +
9872 +struct DMA_Chan_s
9873 +{
9874 +       u32             dmac ;          // Control.
9875 +       u32             dmas ;          // Status.      
9876 +       u32             dmasm ;         // Mask.
9877 +       u32             dmadptr ;       // Descriptor pointer.
9878 +       u32             dmandptr ;      // Next descriptor pointer.
9879 +};
9880 +
9881 +typedef struct DMA_Chan_s volatile *DMA_Chan_t ;
9882 +
9883 +//DMA_Channels   use DMACH_count instead
9884 +
9885 +enum
9886 +{
9887 +       DMAC_run_b      = 0,            // 
9888 +       DMAC_run_m      = 0x00000001,   // 
9889 +       DMAC_dm_b       = 1,            // done mask
9890 +       DMAC_dm_m       = 0x00000002,   // 
9891 +       DMAC_mode_b     = 2,            // 
9892 +       DMAC_mode_m     = 0x0000000c,   // 
9893 +               DMAC_mode_auto_v        = 0,
9894 +               DMAC_mode_burst_v       = 1,
9895 +               DMAC_mode_transfer_v    = 2, //usually used
9896 +               DMAC_mode_reserved_v    = 3,
9897 +       DMAC_a_b        = 4,            // 
9898 +       DMAC_a_m        = 0x00000010,   // 
9899 +
9900 +       DMAS_f_b        = 0,            // finished (sticky) 
9901 +       DMAS_f_m        = 0x00000001,   //                   
9902 +       DMAS_d_b        = 1,            // done (sticky)     
9903 +       DMAS_d_m        = 0x00000002,   //                   
9904 +       DMAS_c_b        = 2,            // chain (sticky)    
9905 +       DMAS_c_m        = 0x00000004,   //                   
9906 +       DMAS_e_b        = 3,            // error (sticky)    
9907 +       DMAS_e_m        = 0x00000008,   //                   
9908 +       DMAS_h_b        = 4,            // halt (sticky)     
9909 +       DMAS_h_m        = 0x00000010,   //                   
9910 +
9911 +       DMASM_f_b       = 0,            // finished (1=mask)
9912 +       DMASM_f_m       = 0x00000001,   // 
9913 +       DMASM_d_b       = 1,            // done (1=mask)
9914 +       DMASM_d_m       = 0x00000002,   // 
9915 +       DMASM_c_b       = 2,            // chain (1=mask)
9916 +       DMASM_c_m       = 0x00000004,   // 
9917 +       DMASM_e_b       = 3,            // error (1=mask)
9918 +       DMASM_e_m       = 0x00000008,   // 
9919 +       DMASM_h_b       = 4,            // halt (1=mask)
9920 +       DMASM_h_m       = 0x00000010,   // 
9921 +} ;
9922 +
9923 +/*
9924 + * DMA channel definitions
9925 + */
9926 +
9927 +enum
9928 +{
9929 +       DMACH_extToMem0 = 0,
9930 +       DMACH_memToExt0 = 0,
9931 +       DMACH_extToMem1 = 1,
9932 +       DMACH_memToExt1 = 1,
9933 +       DMACH_ethRcv0 = 2,
9934 +       DMACH_ethXmt0 = 3,
9935 +       DMACH_ethRcv1 = 4,
9936 +       DMACH_ethXmt2 = 5,
9937 +       DMACH_memToFifo = 6,
9938 +       DMACH_fifoToMem = 7,
9939 +       DMACH_rng_de = 7,//randomNumberGenerator on LC/DE
9940 +       DMACH_pciToMem = 8,
9941 +       DMACH_memToPci = 9,
9942 +       DMACH_securityInput = 10,
9943 +       DMACH_securityOutput = 11,
9944 +       DMACH_rng_se = 12, //randomNumberGenerator on SE
9945 +       
9946 +       DMACH_count //must be last
9947 +};
9948 +
9949 +
9950 +typedef struct DMAC_s
9951 +{
9952 +       struct DMA_Chan_s ch [DMACH_count] ; //use ch[DMACH_]
9953 +} volatile *DMA_t ;
9954 +
9955 +
9956 +/*
9957 + * External DMA parameters
9958 +*/
9959 +
9960 +enum
9961 +{
9962 +       DMADEVCMD_ts_b  = 0,            // ts field in devcmd
9963 +       DMADEVCMD_ts_m  = 0x00000007,   // ts field in devcmd
9964 +               DMADEVCMD_ts_byte_v     = 0,
9965 +               DMADEVCMD_ts_halfword_v = 1,
9966 +               DMADEVCMD_ts_word_v     = 2,
9967 +               DMADEVCMD_ts_2word_v    = 3,
9968 +               DMADEVCMD_ts_4word_v    = 4,
9969 +               DMADEVCMD_ts_6word_v    = 5,
9970 +               DMADEVCMD_ts_8word_v    = 6,
9971 +               DMADEVCMD_ts_16word_v   = 7
9972 +};
9973 +
9974 +
9975 +#if 1  // aws - Compatibility.
9976 +#      define  EXTDMA_ts_b             DMADEVCMD_ts_b
9977 +#      define  EXTDMA_ts_m             DMADEVCMD_ts_m
9978 +#      define  EXTDMA_ts_byte_v        DMADEVCMD_ts_byte_v
9979 +#      define  EXTDMA_ts_halfword_v    DMADEVCMD_ts_halfword_v
9980 +#      define  EXTDMA_ts_word_v        DMADEVCMD_ts_word_v
9981 +#      define  EXTDMA_ts_2word_v       DMADEVCMD_ts_2word_v
9982 +#      define  EXTDMA_ts_4word_v       DMADEVCMD_ts_4word_v
9983 +#      define  EXTDMA_ts_6word_v       DMADEVCMD_ts_6word_v
9984 +#      define  EXTDMA_ts_8word_v       DMADEVCMD_ts_8word_v
9985 +#      define  EXTDMA_ts_16word_v      DMADEVCMD_ts_16word_v
9986 +#endif // aws - Compatibility.
9987 +
9988 +#endif //__IDT_RC32438_DMA_H__
9989 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_dma_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_dma_v.h
9990 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_dma_v.h    1970-01-01 01:00:00.000000000 +0100
9991 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_dma_v.h    2006-01-10 00:32:33.000000000 +0100
9992 @@ -0,0 +1,82 @@
9993 +/**************************************************************************
9994 + *
9995 + *  BRIEF MODULE DESCRIPTION
9996 + *   DMA operations for IDT RC32438.
9997 + *
9998 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
9999 + *         
10000 + *  This program is free software; you can redistribute  it and/or modify it
10001 + *  under  the terms of  the GNU General  Public License as published by the
10002 + *  Free Software Foundation;  either version 2 of the  License, or (at your
10003 + *  option) any later version.
10004 + *
10005 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
10006 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
10007 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
10008 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
10009 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
10010 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
10011 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
10012 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
10013 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10014 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10015 + *
10016 + *  You should have received a copy of the  GNU General Public License along
10017 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
10018 + *  675 Mass Ave, Cambridge, MA 02139, USA.
10019 + *
10020 + *
10021 + **************************************************************************
10022 + * May 2004 P. Sadik.
10023 + *
10024 + * Initial Release
10025 + *
10026 + * 
10027 + *
10028 + **************************************************************************
10029 + */
10030 +
10031 +#ifndef __IDT_RC32438_DMA_V_H__
10032 +#define __IDT_RC32438_DMA_V_H__
10033 +#include  <asm/idt-boards/rc32438/rc32438_dma.h> 
10034 +
10035 +#define DMA_CHAN_OFFSET  0x14
10036 +#define IS_DMA_USED(X) (((X) & (DMAD_f_m | DMAD_d_m | DMAD_t_m)) != 0)
10037 +#define DMA_COUNT(count)   \
10038 +  ((count) & DMAD_count_m)
10039 +
10040 +#define DMA_HALT_TIMEOUT 500
10041 +
10042 +
10043 +static inline int rc32438_halt_dma(DMA_Chan_t ch)
10044 +{
10045 +       int timeout=1;
10046 +       if (rc32438_readl(&ch->dmac) & DMAC_run_m) {
10047 +               rc32438_writel(0, &ch->dmac); 
10048 +               
10049 +               for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
10050 +                       if (rc32438_readl(&ch->dmas) & DMAS_h_m) {
10051 +                               rc32438_writel(0, &ch->dmas);  
10052 +                               break;
10053 +                       }
10054 +               }
10055 +
10056 +       }
10057 +       
10058 +       return timeout ? 0 : 1;
10059 +}
10060 +
10061 +
10062 +
10063 +
10064 +static inline void rc32438_start_dma(DMA_Chan_t ch, u32 dma_addr)
10065 +{
10066 +       rc32438_writel(0, &ch->dmandptr); 
10067 +       rc32438_writel(dma_addr, &ch->dmadptr);
10068 +}
10069 +
10070 +static inline void rc32438_chain_dma(DMA_Chan_t ch, u32 dma_addr)
10071 +{
10072 +       rc32438_writel(dma_addr, &ch->dmandptr);
10073 +}
10074 +#endif //__IDT_RC32438_DMA_V_H__
10075 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_eth.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_eth.h
10076 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_eth.h      1970-01-01 01:00:00.000000000 +0100
10077 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_eth.h      2006-01-10 00:32:33.000000000 +0100
10078 @@ -0,0 +1,328 @@
10079 +/**************************************************************************
10080 + *
10081 + *  BRIEF MODULE DESCRIPTION
10082 + *   Definitions for IDT EB438 ethernet
10083 + *
10084 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
10085 + *         
10086 + *  This program is free software; you can redistribute  it and/or modify it
10087 + *  under  the terms of  the GNU General  Public License as published by the
10088 + *  Free Software Foundation;  either version 2 of the  License, or (at your
10089 + *  option) any later version.
10090 + *
10091 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
10092 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
10093 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
10094 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
10095 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
10096 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
10097 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
10098 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
10099 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10100 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10101 + *
10102 + *  You should have received a copy of the  GNU General Public License along
10103 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
10104 + *  675 Mass Ave, Cambridge, MA 02139, USA.
10105 + *
10106 + *
10107 + **************************************************************************
10108 + * May 2004 P. Sadik.
10109 + *
10110 + * Initial Release
10111 + *
10112 + * 
10113 + *
10114 + **************************************************************************
10115 + */
10116 +
10117 +#ifndef __IDT_RC32438_ETH_H__
10118 +#define __IDT_RC32438_ETH_H__
10119 +enum
10120 +{
10121 +       ETH0_PhysicalAddress    = 0x18058000,
10122 +       ETH_PhysicalAddress     = ETH0_PhysicalAddress,         // Default
10123 +
10124 +       ETH0_VirtualAddress     = 0xb8058000,
10125 +       ETH_VirtualAddress      = ETH0_VirtualAddress,          // Default
10126 +       ETH1_PhysicalAddress    = 0x18060000,
10127 +       ETH1_VirtualAddress     = 0xb8060000,                   // Default
10128 +} ;
10129 +
10130 +typedef struct
10131 +{
10132 +       u32 ethintfc            ;
10133 +       u32 ethfifott           ;
10134 +       u32 etharc              ;
10135 +       u32 ethhash0            ;
10136 +       u32 ethhash1            ;
10137 +       u32 ethu0 [4]           ;       // Reserved.    
10138 +       u32 ethpfs              ;
10139 +       u32 ethmcp              ;
10140 +       u32 eth_u1 [10]         ;       // Reserved.
10141 +       u32 ethspare            ;
10142 +       u32 eth_u2 [42]         ;       // Reserved. 
10143 +       u32 ethsal0             ;
10144 +       u32 ethsah0             ;
10145 +       u32 ethsal1             ;
10146 +       u32 ethsah1             ;
10147 +       u32 ethsal2             ;
10148 +       u32 ethsah2             ;
10149 +       u32 ethsal3             ;
10150 +       u32 ethsah3             ;
10151 +       u32 ethrbc              ;
10152 +       u32 ethrpc              ;
10153 +       u32 ethrupc             ;
10154 +       u32 ethrfc              ;
10155 +       u32 ethtbc              ;
10156 +       u32 ethgpf              ;
10157 +       u32 eth_u9 [50]         ;       // Reserved.    
10158 +       u32 ethmac1             ;
10159 +       u32 ethmac2             ;
10160 +       u32 ethipgt             ;
10161 +       u32 ethipgr             ;
10162 +       u32 ethclrt             ;
10163 +       u32 ethmaxf             ;
10164 +       u32 eth_u10             ;       // Reserved.    
10165 +       u32 ethmtest            ;
10166 +       u32 miimcfg             ;
10167 +       u32 miimcmd             ;
10168 +       u32 miimaddr            ;
10169 +       u32 miimwtd             ;
10170 +       u32 miimrdd             ;
10171 +       u32 miimind             ;
10172 +       u32 eth_u11             ;       // Reserved.
10173 +       u32 eth_u12             ;       // Reserved.
10174 +       u32 ethcfsa0            ;
10175 +       u32 ethcfsa1            ;
10176 +       u32 ethcfsa2            ;
10177 +} volatile *ETH_t;
10178 +
10179 +enum
10180 +{
10181 +       ETHINTFC_en_b           = 0,
10182 +       ETHINTFC_en_m           = 0x00000001,
10183 +       ETHINTFC_its_b          = 1,
10184 +       ETHINTFC_its_m          = 0x00000002,
10185 +       ETHINTFC_rip_b          = 2,
10186 +       ETHINTFC_rip_m          = 0x00000004,
10187 +       ETHINTFC_jam_b          = 3,
10188 +       ETHINTFC_jam_m          = 0x00000008,
10189 +       ETHINTFC_ovr_b          = 4,
10190 +       ETHINTFC_ovr_m          = 0x00000010,
10191 +       ETHINTFC_und_b          = 5,
10192 +       ETHINTFC_und_m          = 0x00000020,
10193 +
10194 +       ETHFIFOTT_tth_b         = 0,
10195 +       ETHFIFOTT_tth_m         = 0x0000007f,
10196 +
10197 +       ETHARC_pro_b            = 0,
10198 +       ETHARC_pro_m            = 0x00000001,
10199 +       ETHARC_am_b             = 1,
10200 +       ETHARC_am_m             = 0x00000002,
10201 +       ETHARC_afm_b            = 2,
10202 +       ETHARC_afm_m            = 0x00000004,
10203 +       ETHARC_ab_b             = 3,
10204 +       ETHARC_ab_m             = 0x00000008,
10205 +
10206 +       ETHSAL_byte5_b          = 0,
10207 +       ETHSAL_byte5_m          = 0x000000ff,
10208 +       ETHSAL_byte4_b          = 8,
10209 +       ETHSAL_byte4_m          = 0x0000ff00,
10210 +       ETHSAL_byte3_b          = 16,
10211 +       ETHSAL_byte3_m          = 0x00ff0000,
10212 +       ETHSAL_byte2_b          = 24,
10213 +       ETHSAL_byte2_m          = 0xff000000,
10214 +
10215 +       ETHSAH_byte1_b          = 0,
10216 +       ETHSAH_byte1_m          = 0x000000ff,
10217 +       ETHSAH_byte0_b          = 8,
10218 +       ETHSAH_byte0_m          = 0x0000ff00,
10219 +       
10220 +       ETHGPF_ptv_b            = 0,
10221 +       ETHGPF_ptv_m            = 0x0000ffff,
10222 +
10223 +       ETHPFS_pfd_b            = 0,
10224 +       ETHPFS_pfd_m            = 0x00000001,
10225 +
10226 +       ETHCFSA0_cfsa4_b        = 0,
10227 +       ETHCFSA0_cfsa4_m        = 0x000000ff,
10228 +       ETHCFSA0_cfsa5_b        = 8,
10229 +       ETHCFSA0_cfsa5_m        = 0x0000ff00,
10230 +
10231 +       ETHCFSA1_cfsa2_b        = 0,
10232 +       ETHCFSA1_cfsa2_m        = 0x000000ff,
10233 +       ETHCFSA1_cfsa3_b        = 8,
10234 +       ETHCFSA1_cfsa3_m        = 0x0000ff00,
10235 +
10236 +       ETHCFSA2_cfsa0_b        = 0,
10237 +       ETHCFSA2_cfsa0_m        = 0x000000ff,
10238 +       ETHCFSA2_cfsa1_b        = 8,
10239 +       ETHCFSA2_cfsa1_m        = 0x0000ff00,
10240 +
10241 +       ETHMAC1_re_b            = 0,
10242 +       ETHMAC1_re_m            = 0x00000001,
10243 +       ETHMAC1_paf_b           = 1,
10244 +       ETHMAC1_paf_m           = 0x00000002,
10245 +       ETHMAC1_rfc_b           = 2,
10246 +       ETHMAC1_rfc_m           = 0x00000004,
10247 +       ETHMAC1_tfc_b           = 3,
10248 +       ETHMAC1_tfc_m           = 0x00000008,
10249 +       ETHMAC1_lb_b            = 4,
10250 +       ETHMAC1_lb_m            = 0x00000010,
10251 +       ETHMAC1_mr_b            = 31,
10252 +       ETHMAC1_mr_m            = 0x80000000,
10253 +
10254 +       ETHMAC2_fd_b            = 0,
10255 +       ETHMAC2_fd_m            = 0x00000001,
10256 +       ETHMAC2_flc_b           = 1,
10257 +       ETHMAC2_flc_m           = 0x00000002,
10258 +       ETHMAC2_hfe_b           = 2,
10259 +       ETHMAC2_hfe_m           = 0x00000004,
10260 +       ETHMAC2_dc_b            = 3,
10261 +       ETHMAC2_dc_m            = 0x00000008,
10262 +       ETHMAC2_cen_b           = 4,
10263 +       ETHMAC2_cen_m           = 0x00000010,
10264 +       ETHMAC2_pe_b            = 5,
10265 +       ETHMAC2_pe_m            = 0x00000020,
10266 +       ETHMAC2_vpe_b           = 6,
10267 +       ETHMAC2_vpe_m           = 0x00000040,
10268 +       ETHMAC2_ape_b           = 7,
10269 +       ETHMAC2_ape_m           = 0x00000080,
10270 +       ETHMAC2_ppe_b           = 8,
10271 +       ETHMAC2_ppe_m           = 0x00000100,
10272 +       ETHMAC2_lpe_b           = 9,
10273 +       ETHMAC2_lpe_m           = 0x00000200,
10274 +       ETHMAC2_nb_b            = 12,
10275 +       ETHMAC2_nb_m            = 0x00001000,
10276 +       ETHMAC2_bp_b            = 13,
10277 +       ETHMAC2_bp_m            = 0x00002000,
10278 +       ETHMAC2_ed_b            = 14,
10279 +       ETHMAC2_ed_m            = 0x00004000,
10280 +
10281 +       ETHIPGT_ipgt_b          = 0,
10282 +       ETHIPGT_ipgt_m          = 0x0000007f,
10283 +
10284 +       ETHIPGR_ipgr2_b         = 0,
10285 +       ETHIPGR_ipgr2_m         = 0x0000007f,
10286 +       ETHIPGR_ipgr1_b         = 8,
10287 +       ETHIPGR_ipgr1_m         = 0x00007f00,
10288 +
10289 +       ETHCLRT_maxret_b        = 0,
10290 +       ETHCLRT_maxret_m        = 0x0000000f,
10291 +       ETHCLRT_colwin_b        = 8,
10292 +       ETHCLRT_colwin_m        = 0x00003f00,
10293 +
10294 +       ETHMAXF_maxf_b          = 0,
10295 +       ETHMAXF_maxf_m          = 0x0000ffff,
10296 +
10297 +       ETHMTEST_tb_b           = 2,
10298 +       ETHMTEST_tb_m           = 0x00000004,
10299 +
10300 +       ETHMCP_div_b            = 0,
10301 +       ETHMCP_div_m            = 0x000000ff,
10302 +       
10303 +       MIIMCFG_rsv_b           = 0,
10304 +       MIIMCFG_rsv_m           = 0x0000000c,
10305 +
10306 +       MIIMCMD_rd_b            = 0,
10307 +       MIIMCMD_rd_m            = 0x00000001,
10308 +       MIIMCMD_scn_b           = 1,
10309 +       MIIMCMD_scn_m           = 0x00000002,
10310 +
10311 +       MIIMADDR_regaddr_b      = 0,
10312 +       MIIMADDR_regaddr_m      = 0x0000001f,
10313 +       MIIMADDR_phyaddr_b      = 8,
10314 +       MIIMADDR_phyaddr_m      = 0x00001f00,
10315 +
10316 +       MIIMWTD_wdata_b         = 0,
10317 +       MIIMWTD_wdata_m         = 0x0000ffff,
10318 +
10319 +       MIIMRDD_rdata_b         = 0,
10320 +       MIIMRDD_rdata_m         = 0x0000ffff,
10321 +
10322 +       MIIMIND_bsy_b           = 0,
10323 +       MIIMIND_bsy_m           = 0x00000001,
10324 +       MIIMIND_scn_b           = 1,
10325 +       MIIMIND_scn_m           = 0x00000002,
10326 +       MIIMIND_nv_b            = 2,
10327 +       MIIMIND_nv_m            = 0x00000004,
10328 +
10329 +} ;
10330 +
10331 +/*
10332 + * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
10333 + */
10334 +enum
10335 +{
10336 +       ETHRX_fd_b              = 0,
10337 +       ETHRX_fd_m              = 0x00000001,
10338 +       ETHRX_ld_b              = 1,
10339 +       ETHRX_ld_m              = 0x00000002,
10340 +       ETHRX_rok_b             = 2,
10341 +       ETHRX_rok_m             = 0x00000004,
10342 +       ETHRX_fm_b              = 3,
10343 +       ETHRX_fm_m              = 0x00000008,
10344 +       ETHRX_mp_b              = 4,
10345 +       ETHRX_mp_m              = 0x00000010,
10346 +       ETHRX_bp_b              = 5,
10347 +       ETHRX_bp_m              = 0x00000020,
10348 +       ETHRX_vlt_b             = 6,
10349 +       ETHRX_vlt_m             = 0x00000040,
10350 +       ETHRX_cf_b              = 7,
10351 +       ETHRX_cf_m              = 0x00000080,
10352 +       ETHRX_ovr_b             = 8,
10353 +       ETHRX_ovr_m             = 0x00000100,
10354 +       ETHRX_crc_b             = 9,
10355 +       ETHRX_crc_m             = 0x00000200,
10356 +       ETHRX_cv_b              = 10,
10357 +       ETHRX_cv_m              = 0x00000400,
10358 +       ETHRX_db_b              = 11,
10359 +       ETHRX_db_m              = 0x00000800,
10360 +       ETHRX_le_b              = 12,
10361 +       ETHRX_le_m              = 0x00001000,
10362 +       ETHRX_lor_b             = 13,
10363 +       ETHRX_lor_m             = 0x00002000,
10364 +       ETHRX_ces_b             = 14,
10365 +       ETHRX_ces_m             = 0x00004000,
10366 +       ETHRX_length_b          = 16,
10367 +       ETHRX_length_m          = 0xffff0000,
10368 +
10369 +       ETHTX_fd_b              = 0,
10370 +       ETHTX_fd_m              = 0x00000001,
10371 +       ETHTX_ld_b              = 1,
10372 +       ETHTX_ld_m              = 0x00000002,
10373 +       ETHTX_oen_b             = 2,
10374 +       ETHTX_oen_m             = 0x00000004,
10375 +       ETHTX_pen_b             = 3,
10376 +       ETHTX_pen_m             = 0x00000008,
10377 +       ETHTX_cen_b             = 4,
10378 +       ETHTX_cen_m             = 0x00000010,
10379 +       ETHTX_hen_b             = 5,
10380 +       ETHTX_hen_m             = 0x00000020,
10381 +       ETHTX_tok_b             = 6,
10382 +       ETHTX_tok_m             = 0x00000040,
10383 +       ETHTX_mp_b              = 7,
10384 +       ETHTX_mp_m              = 0x00000080,
10385 +       ETHTX_bp_b              = 8,
10386 +       ETHTX_bp_m              = 0x00000100,
10387 +       ETHTX_und_b             = 9,
10388 +       ETHTX_und_m             = 0x00000200,
10389 +       ETHTX_of_b              = 10,
10390 +       ETHTX_of_m              = 0x00000400,
10391 +       ETHTX_ed_b              = 11,
10392 +       ETHTX_ed_m              = 0x00000800,
10393 +       ETHTX_ec_b              = 12,
10394 +       ETHTX_ec_m              = 0x00001000,
10395 +       ETHTX_lc_b              = 13,
10396 +       ETHTX_lc_m              = 0x00002000,
10397 +       ETHTX_td_b              = 14,
10398 +       ETHTX_td_m              = 0x00004000,
10399 +       ETHTX_crc_b             = 15,
10400 +       ETHTX_crc_m             = 0x00008000,
10401 +       ETHTX_le_b              = 16,
10402 +       ETHTX_le_m              = 0x00010000,
10403 +       ETHTX_cc_b              = 17,
10404 +       ETHTX_cc_m              = 0x001E0000,
10405 +} ;
10406 +#endif //__IDT_RC32438_ETH_H__
10407 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_eth_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_eth_v.h
10408 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_eth_v.h    1970-01-01 01:00:00.000000000 +0100
10409 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_eth_v.h    2006-01-10 00:32:33.000000000 +0100
10410 @@ -0,0 +1,72 @@
10411 +/**************************************************************************
10412 + *
10413 + *  BRIEF MODULE DESCRIPTION
10414 + *   macros for IDT EB438 ethernet
10415 + *
10416 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
10417 + *         
10418 + *  This program is free software; you can redistribute  it and/or modify it
10419 + *  under  the terms of  the GNU General  Public License as published by the
10420 + *  Free Software Foundation;  either version 2 of the  License, or (at your
10421 + *  option) any later version.
10422 + *
10423 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
10424 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
10425 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
10426 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
10427 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
10428 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
10429 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
10430 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
10431 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10432 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10433 + *
10434 + *  You should have received a copy of the  GNU General Public License along
10435 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
10436 + *  675 Mass Ave, Cambridge, MA 02139, USA.
10437 + *
10438 + *
10439 + **************************************************************************
10440 + * May 2004 P. Sadik.
10441 + *
10442 + * Initial Release
10443 + *
10444 + * 
10445 + *
10446 + **************************************************************************
10447 + */
10448 +
10449 +#ifndef __IDT_RC32438_ETH_V_H__
10450 +#define __IDT_RC32438_ETH_V_H__
10451 +#include  <asm/idt-boards/rc32438/rc32438_eth.h> 
10452 +
10453 +#define IS_TX_TOK(X)         (((X) & (1<<ETHTX_tok_b)) >> ETHTX_tok_b )   /* Transmit Okay    */
10454 +#define IS_TX_MP(X)          (((X) & (1<<ETHTX_mp_b))  >> ETHTX_mp_b )    /* Multicast        */
10455 +#define IS_TX_BP(X)          (((X) & (1<<ETHTX_bp_b))  >> ETHTX_bp_b )    /* Broadcast        */
10456 +#define IS_TX_UND_ERR(X)     (((X) & (1<<ETHTX_und_b)) >> ETHTX_und_b )   /* Transmit FIFO Underflow */
10457 +#define IS_TX_OF_ERR(X)      (((X) & (1<<ETHTX_of_b))  >> ETHTX_of_b )    /* Oversized frame  */
10458 +#define IS_TX_ED_ERR(X)      (((X) & (1<<ETHTX_ed_b))  >> ETHTX_ed_b )    /* Excessive deferral  */
10459 +#define IS_TX_EC_ERR(X)      (((X) & (1<<ETHTX_ec_b))  >> ETHTX_ec_b)     /* Excessive collisions  */
10460 +#define IS_TX_LC_ERR(X)      (((X) & (1<<ETHTX_lc_b))  >> ETHTX_lc_b )    /* Late Collision   */
10461 +#define IS_TX_TD_ERR(X)      (((X) & (1<<ETHTX_td_b))  >> ETHTX_td_b )    /* Transmit deferred*/
10462 +#define IS_TX_CRC_ERR(X)     (((X) & (1<<ETHTX_crc_b)) >> ETHTX_crc_b )   /* CRC Error        */
10463 +#define IS_TX_LE_ERR(X)      (((X) & (1<<ETHTX_le_b))  >>  ETHTX_le_b )    /* Length Error     */
10464 +
10465 +#define TX_COLLISION_COUNT(X) (((X) & ETHTX_cc_m)>>ETHTX_cc_b)  /* Collision Count  */
10466 +
10467 +#define IS_RCV_ROK(X)        (((X) & (1<<ETHRX_rok_b)) >> ETHRX_rok_b)    /* Receive Okay     */
10468 +#define IS_RCV_FM(X)         (((X) & (1<<ETHRX_fm_b))  >> ETHRX_fm_b)     /* Is Filter Match  */
10469 +#define IS_RCV_MP(X)         (((X) & (1<<ETHRX_mp_b))  >> ETHRX_mp_b)     /* Is it MP         */
10470 +#define IS_RCV_BP(X)         (((X) & (1<<ETHRX_bp_b))  >> ETHRX_bp_b)     /* Is it BP         */
10471 +#define IS_RCV_VLT(X)        (((X) & (1<<ETHRX_vlt_b)) >> ETHRX_vlt_b)    /* VLAN Tag Detect  */
10472 +#define IS_RCV_CF(X)         (((X) & (1<<ETHRX_cf_b))  >> ETHRX_cf_b)     /* Control Frame    */
10473 +#define IS_RCV_OVR_ERR(X)    (((X) & (1<<ETHRX_ovr_b)) >> ETHRX_ovr_b)    /* Receive Overflow */
10474 +#define IS_RCV_CRC_ERR(X)    (((X) & (1<<ETHRX_crc_b)) >> ETHRX_crc_b)    /* CRC Error        */
10475 +#define IS_RCV_CV_ERR(X)     (((X) & (1<<ETHRX_cv_b))  >> ETHRX_cv_b)     /* Code Violation   */
10476 +#define IS_RCV_DB_ERR(X)     (((X) & (1<<ETHRX_db_b))  >> ETHRX_db_b)     /* Dribble Bits     */
10477 +#define IS_RCV_LE_ERR(X)     (((X) & (1<<ETHRX_le_b))  >> ETHRX_le_b)     /* Length error     */
10478 +#define IS_RCV_LOR_ERR(X)    (((X) & (1<<ETHRX_lor_b)) >> ETHRX_lor_b)    /* Length Out of Range */
10479 +#define IS_RCV_CES_ERR(X)    (((X) & (1<<ETHRX_ces_b)) >> ETHRX_ces_b)  /* Preamble error   */
10480 +#define RCVPKT_LENGTH(X)     (((X) & ETHRX_length_m) >> ETHRX_length_b)   /* Length of the received packet */
10481 +
10482 +#endif //__IDT_RC32438_ETH_V_H__
10483 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_gpio.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_gpio.h
10484 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_gpio.h     1970-01-01 01:00:00.000000000 +0100
10485 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_gpio.h     2006-01-10 00:32:33.000000000 +0100
10486 @@ -0,0 +1,257 @@
10487 +/**************************************************************************
10488 + *
10489 + *  BRIEF MODULE DESCRIPTION
10490 + *   Definitions for IDT RC32438 GPIO.
10491 + *
10492 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
10493 + *         
10494 + *  This program is free software; you can redistribute  it and/or modify it
10495 + *  under  the terms of  the GNU General  Public License as published by the
10496 + *  Free Software Foundation;  either version 2 of the  License, or (at your
10497 + *  option) any later version.
10498 + *
10499 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
10500 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
10501 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
10502 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
10503 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
10504 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
10505 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
10506 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
10507 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10508 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10509 + *
10510 + *  You should have received a copy of the  GNU General Public License along
10511 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
10512 + *  675 Mass Ave, Cambridge, MA 02139, USA.
10513 + *
10514 + *
10515 + **************************************************************************
10516 + * May 2004 P. Sadik.
10517 + *
10518 + * Initial Release
10519 + *
10520 + * 
10521 + *
10522 + **************************************************************************
10523 + */
10524 +#ifndef __IDT_RC32438_GPIO_H__
10525 +#define __IDT_RC32438_GPIO_H__ 
10526 +enum
10527 +{
10528 +       GPIO0_PhysicalAddress   = 0x18048000,
10529 +       GPIO_PhysicalAddress    = GPIO0_PhysicalAddress,        // Default
10530 +
10531 +       GPIO0_VirtualAddress    = 0xb8048000,
10532 +       GPIO_VirtualAddress     = GPIO0_VirtualAddress,         // Default
10533 +} ;
10534 +
10535 +typedef struct
10536 +{
10537 +       u32   gpiofunc;   /* GPIO Function Register
10538 +                          * gpiofunc[x]==0 bit = gpio
10539 +                          * func[x]==1  bit = altfunc
10540 +                          */
10541 +       u32   gpiocfg;    /* GPIO Configuration Register
10542 +                          * gpiocfg[x]==0 bit = input
10543 +                          * gpiocfg[x]==1 bit = output
10544 +                          */
10545 +       u32   gpiod;      /* GPIO Data Register
10546 +                          * gpiod[x] read/write gpio pinX status
10547 +                          */
10548 +       u32   gpioilevel; /* GPIO Interrupt Status Register
10549 +                          * interrupt level (see gpioistat)
10550 +                          */
10551 +       u32   gpioistat;  /* Gpio Interrupt Status Register
10552 +                          * istat[x] = (gpiod[x] == level[x])
10553 +                          * cleared in ISR (STICKY bits)
10554 +                          */
10555 +       u32   gpionmien;  /* GPIO Non-maskable Interrupt Enable Register */
10556 +} volatile * GPIO_t ;
10557 +
10558 +typedef enum
10559 +{
10560 +       GPIO_gpio_v             = 0,            // gpiofunc use pin as GPIO.
10561 +       GPIO_alt_v              = 1,            // gpiofunc use pin as alt.
10562 +       GPIO_input_v            = 0,            // gpiocfg use pin as input.
10563 +       GPIO_output_v           = 1,            // gpiocfg use pin as output.
10564 +       GPIO_pin0_b             = 0,
10565 +       GPIO_pin0_m             = 0x00000001,
10566 +       GPIO_pin1_b             = 1,
10567 +       GPIO_pin1_m             = 0x00000002,
10568 +       GPIO_pin2_b             = 2,
10569 +       GPIO_pin2_m             = 0x00000004,
10570 +       GPIO_pin3_b             = 3,
10571 +       GPIO_pin3_m             = 0x00000008,
10572 +       GPIO_pin4_b             = 4,
10573 +       GPIO_pin4_m             = 0x00000010,
10574 +       GPIO_pin5_b             = 5,
10575 +       GPIO_pin5_m             = 0x00000020,
10576 +       GPIO_pin6_b             = 6,
10577 +       GPIO_pin6_m             = 0x00000040,
10578 +       GPIO_pin7_b             = 7,
10579 +       GPIO_pin7_m             = 0x00000080,
10580 +       GPIO_pin8_b             = 8,
10581 +       GPIO_pin8_m             = 0x00000100,
10582 +       GPIO_pin9_b             = 9,
10583 +       GPIO_pin9_m             = 0x00000200,
10584 +       GPIO_pin10_b            = 10,
10585 +       GPIO_pin10_m            = 0x00000400,
10586 +       GPIO_pin11_b            = 11,
10587 +       GPIO_pin11_m            = 0x00000800,
10588 +       GPIO_pin12_b            = 12,
10589 +       GPIO_pin12_m            = 0x00001000,
10590 +       GPIO_pin13_b            = 13,
10591 +       GPIO_pin13_m            = 0x00002000,
10592 +       GPIO_pin14_b            = 14,
10593 +       GPIO_pin14_m            = 0x00004000,
10594 +       GPIO_pin15_b            = 15,
10595 +       GPIO_pin15_m            = 0x00008000,
10596 +       GPIO_pin16_b            = 16,
10597 +       GPIO_pin16_m            = 0x00010000,
10598 +       GPIO_pin17_b            = 17,
10599 +       GPIO_pin17_m            = 0x00020000,
10600 +       GPIO_pin18_b            = 18,
10601 +       GPIO_pin18_m            = 0x00040000,
10602 +       GPIO_pin19_b            = 19,
10603 +       GPIO_pin19_m            = 0x00080000,
10604 +       GPIO_pin20_b            = 20,
10605 +       GPIO_pin20_m            = 0x00100000,
10606 +       GPIO_pin21_b            = 21,
10607 +       GPIO_pin21_m            = 0x00200000,
10608 +       GPIO_pin22_b            = 22,
10609 +       GPIO_pin22_m            = 0x00400000,
10610 +       GPIO_pin23_b            = 23,
10611 +       GPIO_pin23_m            = 0x00800000,
10612 +       GPIO_pin24_b            = 24,
10613 +       GPIO_pin24_m            = 0x01000000,
10614 +       GPIO_pin25_b            = 25,
10615 +       GPIO_pin25_m            = 0x02000000,
10616 +       GPIO_pin26_b            = 26,
10617 +       GPIO_pin26_m            = 0x04000000,
10618 +       GPIO_pin27_b            = 27,
10619 +       GPIO_pin27_m            = 0x08000000,
10620 +       GPIO_pin28_b            = 28,
10621 +       GPIO_pin28_m            = 0x10000000,
10622 +       GPIO_pin29_b            = 29,
10623 +       GPIO_pin29_m            = 0x20000000,
10624 +       GPIO_pin30_b            = 30,
10625 +       GPIO_pin30_m            = 0x40000000,
10626 +       GPIO_pin31_b            = 31,
10627 +       GPIO_pin31_m            = 0x80000000,
10628 +
10629 +// Alternate function pins.  Corrsponding gpiofunc bit set to GPIO_alt_v.
10630 +
10631 +       GPIO_u0sout_b           = GPIO_pin0_b,          // UART 0 serial out.
10632 +       GPIO_u0sout_m           = GPIO_pin0_m,
10633 +               GPIO_u0sout_cfg_v       = GPIO_output_v,
10634 +       GPIO_u0sinp_b   = GPIO_pin1_b,                  // UART 0 serial in.
10635 +       GPIO_u0sinp_m   = GPIO_pin1_m,
10636 +               GPIO_u0sinp_cfg_v       = GPIO_input_v,
10637 +       GPIO_u0rin_b    = GPIO_pin2_b,                  // UART 0 ring indic.
10638 +       GPIO_u0rin_m    = GPIO_pin2_m,
10639 +               GPIO_u0rin_cfg_v        = GPIO_input_v,
10640 +       GPIO_u0dcdn_b   = GPIO_pin3_b,                  // UART 0 data carr.det.
10641 +       GPIO_u0dcdn_m   = GPIO_pin3_m,
10642 +               GPIO_u0dcdn_cfg_v       = GPIO_input_v,
10643 +       GPIO_u0dtrn_b   = GPIO_pin4_b,                  // UART 0 data term rdy.
10644 +       GPIO_u0dtrn_m   = GPIO_pin4_m,
10645 +               GPIO_u0dtrn_cfg_v       = GPIO_output_v,
10646 +       GPIO_u0dsrn_b   = GPIO_pin5_b,                  // UART 0 data set rdy.
10647 +       GPIO_u0dsrn_m   = GPIO_pin5_m,
10648 +               GPIO_u0dsrn_cfg_v       = GPIO_input_v,
10649 +       GPIO_u0rtsn_b   = GPIO_pin6_b,                  // UART 0 req. to send.
10650 +       GPIO_u0rtsn_m   = GPIO_pin6_m,
10651 +               GPIO_u0rtsn_cfg_v       = GPIO_output_v,
10652 +       GPIO_u0ctsn_b   = GPIO_pin7_b,                  // UART 0 clear to send.
10653 +       GPIO_u0ctsn_m   = GPIO_pin7_m,
10654 +               GPIO_u0ctsn_cfg_v       = GPIO_input_v,
10655 +
10656 +       GPIO_u1sout_b           = GPIO_pin8_b,          // UART 1 serial out.
10657 +       GPIO_u1sout_m           = GPIO_pin8_m,
10658 +               GPIO_u1sout_cfg_v       = GPIO_output_v,
10659 +       GPIO_u1sinp_b           = GPIO_pin9_b,          // UART 1 serial in.
10660 +       GPIO_u1sinp_m           = GPIO_pin9_m,
10661 +               GPIO_u1sinp_cfg_v       = GPIO_input_v,
10662 +       GPIO_u1dtrn_b           = GPIO_pin10_b,         // UART 1 data term rdy.
10663 +       GPIO_u1dtrn_m           = GPIO_pin10_m,
10664 +               GPIO_u1dtrn_cfg_v       = GPIO_output_v,
10665 +       GPIO_u1dsrn_b           = GPIO_pin11_b,         // UART 1 data set rdy.
10666 +       GPIO_u1dsrn_m           = GPIO_pin11_m,
10667 +               GPIO_u1dsrn_cfg_v       = GPIO_input_v,
10668 +       GPIO_u1rtsn_b           = GPIO_pin12_b,         // UART 1 req. to send.
10669 +       GPIO_u1rtsn_m           = GPIO_pin12_m,
10670 +               GPIO_u1rtsn_cfg_v       = GPIO_output_v,
10671 +       GPIO_u1ctsn_b           = GPIO_pin13_b,         // UART 1 clear to send.
10672 +       GPIO_u1ctsn_m           = GPIO_pin13_m,
10673 +               GPIO_u1ctsn_cfg_v       = GPIO_input_v,
10674 +
10675 +       GPIO_dmareqn0_b         = GPIO_pin14_b,         // Ext. DMA 0 request
10676 +       GPIO_dmareqn0_m         = GPIO_pin14_m,
10677 +               GPIO_dmareqn0_cfg_v     = GPIO_input_v,
10678 +
10679 +       GPIO_dmareqn1_b         = GPIO_pin15_b,         // Ext. DMA 1 request
10680 +       GPIO_dmareqn1_m         = GPIO_pin15_m,
10681 +               GPIO_dmareqn1_cfg_v     = GPIO_input_v,
10682 +
10683 +       GPIO_dmadonen0_b        = GPIO_pin16_b,         // Ext. DMA 0 done
10684 +       GPIO_dmadonen0_m        = GPIO_pin16_m,
10685 +               GPIO_dmadonen0_cfg_v    = GPIO_input_v,
10686 +
10687 +       GPIO_dmadonen1_b        = GPIO_pin17_b,         // Ext. DMA 1 done
10688 +       GPIO_dmadonen1_m        = GPIO_pin17_m,
10689 +               GPIO_dmadonen1_cfg_v    = GPIO_input_v,
10690 +
10691 +       GPIO_dmafinn0_b         = GPIO_pin18_b,         // Ext. DMA 0 finished
10692 +       GPIO_dmafinn0_m         = GPIO_pin18_m,
10693 +               GPIO_dmafinn0_cfg_v     = GPIO_output_v,
10694 +
10695 +       GPIO_dmafinn1_b         = GPIO_pin19_b,         // Ext. DMA 1 finished
10696 +       GPIO_dmafinn1_m         = GPIO_pin19_m,
10697 +               GPIO_dmafinn1_cfg_v     = GPIO_output_v,
10698 +
10699 +       GPIO_maddr22_b          = GPIO_pin20_b,         // M&P bus bit 22.
10700 +       GPIO_maddr22_m          = GPIO_pin20_m,
10701 +               GPIO_maddr22_cfg_v      = GPIO_output_v,
10702 +
10703 +       GPIO_maddr23_b          = GPIO_pin21_b,         // M&P bus bit 23.
10704 +       GPIO_maddr23_m          = GPIO_pin21_m,
10705 +               GPIO_maddr23_cfg_v      = GPIO_output_v,
10706 +
10707 +       GPIO_maddr24_b          = GPIO_pin22_b,         // M&P bus bit 24.
10708 +       GPIO_maddr24_m          = GPIO_pin22_m,
10709 +               GPIO_maddr24_cfg_v      = GPIO_output_v,
10710 +
10711 +       GPIO_maddr25_b          = GPIO_pin23_b,         // M&P bus bit 25.
10712 +       GPIO_maddr25_m          = GPIO_pin23_m,
10713 +               GPIO_maddr25_cfg_v      = GPIO_output_v,
10714 +
10715 +       GPIO_afspare6_b         = GPIO_pin24_b,         // reserved.
10716 +       GPIO_afspare6_m         = GPIO_pin24_m,
10717 +               GPIO_afspare6_cfg_v     = GPIO_input_v,
10718 +       GPIO_afspare5_b         = GPIO_pin25_b,         // reserved.
10719 +       GPIO_afspare5_m         = GPIO_pin25_m,
10720 +               GPIO_afspare5_cfg_v     = GPIO_input_v,
10721 +       GPIO_afspare4_b         = GPIO_pin26_b,         // reserved.
10722 +       GPIO_afspare4_m         = GPIO_pin26_m,
10723 +               GPIO_afspare4_cfg_v     = GPIO_input_v,
10724 +       GPIO_afspare3_b         = GPIO_pin27_b,         // reserved.
10725 +       GPIO_afspare3_m         = GPIO_pin27_m,
10726 +               GPIO_afspare3_cfg_v     = GPIO_input_v,
10727 +       GPIO_afspare2_b         = GPIO_pin28_b,         // reserved.
10728 +       GPIO_afspare2_m         = GPIO_pin28_m,
10729 +               GPIO_afspare2_cfg_v     = GPIO_input_v,
10730 +       GPIO_afspare1_b         = GPIO_pin29_b,         // reserved.
10731 +       GPIO_afspare1_m         = GPIO_pin29_m,
10732 +               GPIO_afspare1_cfg_v     = GPIO_input_v,
10733 +
10734 +       GPIO_pcimuintn_b        = GPIO_pin30_b,         // PCI messaging int.
10735 +       GPIO_pcimuintn_m        = GPIO_pin30_m,
10736 +               GPIO_pcimuintn_cfg_v    = GPIO_output_v,
10737 +
10738 +       GPIO_rngclk_b           = GPIO_pin31_b,         // RNG external clock
10739 +       GPIO_rngclk_m           = GPIO_pin31_m,
10740 +               GPIO_rncclk_cfg_v       = GPIO_input_v,
10741 +} GPIO_DEFS_t;
10742 +
10743 +#endif //__IDT_RC32438_GPIO_H__
10744 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438.h
10745 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438.h  1970-01-01 01:00:00.000000000 +0100
10746 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438.h  2006-01-10 00:32:33.000000000 +0100
10747 @@ -0,0 +1,152 @@
10748 +/**************************************************************************
10749 + *
10750 + *  BRIEF MODULE DESCRIPTION
10751 + *   Definitions for IDT RC32438 CPU.
10752 + *
10753 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
10754 + *         
10755 + *  This program is free software; you can redistribute  it and/or modify it
10756 + *  under  the terms of  the GNU General  Public License as published by the
10757 + *  Free Software Foundation;  either version 2 of the  License, or (at your
10758 + *  option) any later version.
10759 + *
10760 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
10761 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
10762 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
10763 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
10764 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
10765 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
10766 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
10767 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
10768 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10769 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10770 + *
10771 + *  You should have received a copy of the  GNU General Public License along
10772 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
10773 + *  675 Mass Ave, Cambridge, MA 02139, USA.
10774 + *
10775 + *
10776 + **************************************************************************
10777 + * May 2004 P. Sadik.
10778 + *
10779 + * Initial Release
10780 + *
10781 + * 
10782 + *
10783 + **************************************************************************
10784 + */
10785 +
10786 +#ifndef __IDT_RC32438_H__
10787 +#define  __IDT_RC32438_H__
10788 +#include <linux/config.h>
10789 +#include <linux/delay.h>
10790 +#include <asm/io.h>
10791 +#include <asm/idt-boards/rc32438/rc32438_timer.h>
10792 +
10793 +#define RC32438_REG_BASE   0x18000000
10794 +
10795 +#define interrupt ((volatile INT_t ) INT0_VirtualAddress)
10796 +#define idttimer     ((volatile TIM_t)  TIM0_VirtualAddress)
10797 +#define idt_gpio         ((volatile GPIO_t) GPIO0_VirtualAddress)
10798 +
10799 +#define IDT_CLOCK_MULT 2
10800 +#define MIPS_CPU_TIMER_IRQ 7
10801 +/* Interrupt Controller */
10802 +#define IC_GROUP0_PEND     (RC32438_REG_BASE + 0x38000)
10803 +#define IC_GROUP0_MASK     (RC32438_REG_BASE + 0x38008)
10804 +#define IC_GROUP_OFFSET    0x0C
10805 +#define RTC_BASE           0xAC0801FF0
10806 +
10807 +#define NUM_INTR_GROUPS    5
10808 +/* 16550 UARTs */
10809 +
10810 +#define GROUP0_IRQ_BASE 8              /* GRP2 IRQ numbers start here */
10811 +#define GROUP1_IRQ_BASE (GROUP0_IRQ_BASE + 32) /* GRP3 IRQ numbers start here */
10812 +#define GROUP2_IRQ_BASE (GROUP1_IRQ_BASE + 32) /* GRP4 IRQ numbers start here */
10813 +#define GROUP3_IRQ_BASE (GROUP2_IRQ_BASE + 32) /* GRP5 IRQ numbers start here */
10814 +#define GROUP4_IRQ_BASE (GROUP3_IRQ_BASE + 32)
10815 +
10816 +#ifdef __MIPSEB__
10817 +#define RC32438_UART0_BASE (RC32438_REG_BASE + 0x50003)
10818 +#define RC32438_UART1_BASE (RC32438_REG_BASE + 0x50023)
10819 +#else
10820 +#define RC32438_UART0_BASE (RC32438_REG_BASE + 0x50000)
10821 +#define RC32438_UART1_BASE (RC32438_REG_BASE + 0x50020)
10822 +#endif
10823 +
10824 +#define RC32438_UART0_IRQ  GROUP3_IRQ_BASE + 0
10825 +#define RC32438_UART1_IRQ  GROUP3_IRQ_BASE + 3
10826 +
10827 +#define RC32438_NR_IRQS  (GROUP4_IRQ_BASE + 32)
10828 +
10829 +
10830 +
10831 +/* cpu pipeline flush */
10832 +static inline void rc32438_sync(void)
10833 +{
10834 +        __asm__ volatile ("sync");
10835 +}
10836 +
10837 +static inline void rc32438_sync_udelay(int us)
10838 +{
10839 +        __asm__ volatile ("sync");
10840 +        udelay(us);
10841 +}
10842 +
10843 +static inline void rc32438_sync_delay(int ms)
10844 +{
10845 +        __asm__ volatile ("sync");
10846 +        mdelay(ms);
10847 +}
10848 +
10849 +/*
10850 + * Macros to access internal RC32438 registers. No byte
10851 + * swapping should be done when accessing the internal
10852 + * registers.
10853 + */
10854 +
10855 +#define rc32438_readb __raw_readb
10856 +#define rc32438_readw __raw_readw
10857 +#define rc32438_readl __raw_readl
10858 +
10859 +#define rc32438_writeb __raw_writeb
10860 +#define rc32438_writew __raw_writew
10861 +#define rc32438_writel __raw_writel
10862 +
10863 +/*
10864 + * C access to CLZ and CLO instructions
10865 + * (count leading zeroes/ones).
10866 + */
10867 +static inline int rc32438_clz(unsigned long val)
10868 +{
10869 +       int ret;
10870 +        __asm__ volatile (
10871 +               ".set\tnoreorder\n\t"
10872 +               ".set\tnoat\n\t"
10873 +               ".set\tmips32\n\t"
10874 +               "clz\t%0,%1\n\t"
10875 +                ".set\tmips0\n\t"
10876 +                ".set\tat\n\t"
10877 +                ".set\treorder"
10878 +                : "=r" (ret)
10879 +               : "r" (val));
10880 +
10881 +       return ret;
10882 +}
10883 +static inline int rc32438_clo(unsigned long val)
10884 +{
10885 +       int ret;
10886 +        __asm__ volatile (
10887 +               ".set\tnoreorder\n\t"
10888 +               ".set\tnoat\n\t"
10889 +               ".set\tmips32\n\t"
10890 +               "clo\t%0,%1\n\t"
10891 +                ".set\tmips0\n\t"
10892 +                ".set\tat\n\t"
10893 +                ".set\treorder"
10894 +                : "=r" (ret)
10895 +               : "r" (val));
10896 +
10897 +       return ret;
10898 +}
10899 +#endif //__IDT_RC32438_H__
10900 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_pci.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_pci.h
10901 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_pci.h      1970-01-01 01:00:00.000000000 +0100
10902 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_pci.h      2006-01-10 00:32:33.000000000 +0100
10903 @@ -0,0 +1,510 @@
10904 +/**************************************************************************
10905 + *
10906 + *  BRIEF MODULE DESCRIPTION
10907 + *   Definitions for IDT RC32438 PCI.
10908 + *
10909 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
10910 + *         
10911 + *  This program is free software; you can redistribute  it and/or modify it
10912 + *  under  the terms of  the GNU General  Public License as published by the
10913 + *  Free Software Foundation;  either version 2 of the  License, or (at your
10914 + *  option) any later version.
10915 + *
10916 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
10917 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
10918 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
10919 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
10920 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
10921 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
10922 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
10923 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
10924 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
10925 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10926 + *
10927 + *  You should have received a copy of the  GNU General Public License along
10928 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
10929 + *  675 Mass Ave, Cambridge, MA 02139, USA.
10930 + *
10931 + *
10932 + **************************************************************************
10933 + * May 2004 P. Sadik
10934 + *
10935 + * Initial Release
10936 + *
10937 + * 
10938 + *
10939 + **************************************************************************
10940 + */
10941 +
10942 +enum
10943 +{
10944 +       PCI0_PhysicalAddress    = 0x18080000,
10945 +       PCI_PhysicalAddress     = PCI0_PhysicalAddress,
10946 +
10947 +       PCI0_VirtualAddress     = 0xb8080000,
10948 +       PCI_VirtualAddress      = PCI0_VirtualAddress,
10949 +} ;
10950 +
10951 +enum
10952 +{
10953 +       PCI_LbaCount    = 4,            // Local base addresses.
10954 +} ;
10955 +
10956 +typedef struct
10957 +{
10958 +       u32     a ;             // Address.
10959 +       u32     c ;             // Control.
10960 +       u32     m ;             // mapping.
10961 +} PCI_Map_s ;
10962 +
10963 +typedef struct
10964 +{
10965 +       u32             pcic ;
10966 +       u32             pcis ;
10967 +       u32             pcism ;
10968 +       u32             pcicfga ;
10969 +       u32             pcicfgd ;
10970 +       PCI_Map_s       pcilba [PCI_LbaCount] ;
10971 +       u32             pcidac ;
10972 +       u32             pcidas ;
10973 +       u32             pcidasm ;
10974 +       u32             pcidad ;
10975 +       u32             pcidma8c ;
10976 +       u32             pcidma9c ;
10977 +       u32             pcitc ;
10978 +} volatile *PCI_t ;
10979 +
10980 +// PCI messaging unit.
10981 +enum
10982 +{
10983 +       PCIM_Count      = 2,
10984 +} ;
10985 +typedef struct
10986 +{
10987 +       u32             pciim [PCIM_Count] ;
10988 +       u32             pciom [PCIM_Count] ;
10989 +       u32             pciid ;
10990 +       u32             pciiic ;
10991 +       u32             pciiim ;
10992 +       u32             pciiod ;
10993 +       u32             pciioic ;
10994 +       u32             pciioim ;
10995 +} volatile *PCIM_t ;
10996 +
10997 +/*******************************************************************************
10998 + *
10999 + * PCI Control Register
11000 + *
11001 + ******************************************************************************/
11002 +enum
11003 +{
11004 +       PCIC_en_b       = 0,
11005 +       PCIC_en_m       = 0x00000001,
11006 +       PCIC_tnr_b      = 1,
11007 +       PCIC_tnr_m      = 0x00000002,
11008 +       PCIC_sce_b      = 2,
11009 +       PCIC_sce_m      = 0x00000004,
11010 +       PCIC_ien_b      = 3,
11011 +       PCIC_ien_m      = 0x00000008,
11012 +       PCIC_aaa_b      = 4,
11013 +       PCIC_aaa_m      = 0x00000010,
11014 +       PCIC_eap_b      = 5,
11015 +       PCIC_eap_m      = 0x00000020,
11016 +       PCIC_pcim_b     = 6,
11017 +       PCIC_pcim_m     = 0x000001c0,
11018 +               PCIC_pcim_disabled_v    = 0,
11019 +               PCIC_pcim_tnr_v         = 1,    // Satellite - target not ready
11020 +               PCIC_pcim_suspend_v     = 2,    // Satellite - suspended CPU.
11021 +               PCIC_pcim_extern_v      = 3,    // Host - external arbiter.
11022 +               PCIC_pcim_fixed_v       = 4,    // Host - fixed priority arb.
11023 +               PCIC_pcim_roundrobin_v  = 5,    // Host - round robin priority.
11024 +               PCIC_pcim_reserved6_v   = 6,
11025 +               PCIC_pcim_reserved7_v   = 7,
11026 +       PCIC_igm_b      = 9,
11027 +       PCIC_igm_m      = 0x00000200,
11028 +} ;
11029 +
11030 +/*******************************************************************************
11031 + *
11032 + * PCI Status Register
11033 + *
11034 + ******************************************************************************/
11035 +enum {
11036 +       PCIS_eed_b      = 0,
11037 +       PCIS_eed_m      = 0x00000001,
11038 +       PCIS_wr_b       = 1,
11039 +       PCIS_wr_m       = 0x00000002,
11040 +       PCIS_nmi_b      = 2,
11041 +       PCIS_nmi_m      = 0x00000004,
11042 +       PCIS_ii_b       = 3,
11043 +       PCIS_ii_m       = 0x00000008,
11044 +       PCIS_cwe_b      = 4,
11045 +       PCIS_cwe_m      = 0x00000010,
11046 +       PCIS_cre_b      = 5,
11047 +       PCIS_cre_m      = 0x00000020,
11048 +       PCIS_mdpe_b     = 6,
11049 +       PCIS_mdpe_m     = 0x00000040,
11050 +       PCIS_sta_b      = 7,
11051 +       PCIS_sta_m      = 0x00000080,
11052 +       PCIS_rta_b      = 8,
11053 +       PCIS_rta_m      = 0x00000100,
11054 +       PCIS_rma_b      = 9,
11055 +       PCIS_rma_m      = 0x00000200,
11056 +       PCIS_sse_b      = 10,
11057 +       PCIS_sse_m      = 0x00000400,
11058 +       PCIS_ose_b      = 11,
11059 +       PCIS_ose_m      = 0x00000800,
11060 +       PCIS_pe_b       = 12,
11061 +       PCIS_pe_m       = 0x00001000,
11062 +       PCIS_tae_b      = 13,
11063 +       PCIS_tae_m      = 0x00002000,
11064 +       PCIS_rle_b      = 14,
11065 +       PCIS_rle_m      = 0x00004000,
11066 +       PCIS_bme_b      = 15,
11067 +       PCIS_bme_m      = 0x00008000,
11068 +       PCIS_prd_b      = 16,
11069 +       PCIS_prd_m      = 0x00010000,
11070 +       PCIS_rip_b      = 17,
11071 +       PCIS_rip_m      = 0x00020000,
11072 +} ;
11073 +
11074 +/*******************************************************************************
11075 + *
11076 + * PCI Status Mask Register
11077 + *
11078 + ******************************************************************************/
11079 +enum {
11080 +       PCISM_eed_b             = 0,
11081 +       PCISM_eed_m             = 0x00000001,
11082 +       PCISM_wr_b              = 1,
11083 +       PCISM_wr_m              = 0x00000002,
11084 +       PCISM_nmi_b             = 2,
11085 +       PCISM_nmi_m             = 0x00000004,
11086 +       PCISM_ii_b              = 3,
11087 +       PCISM_ii_m              = 0x00000008,
11088 +       PCISM_cwe_b             = 4,
11089 +       PCISM_cwe_m             = 0x00000010,
11090 +       PCISM_cre_b             = 5,
11091 +       PCISM_cre_m             = 0x00000020,
11092 +       PCISM_mdpe_b            = 6,
11093 +       PCISM_mdpe_m            = 0x00000040,
11094 +       PCISM_sta_b             = 7,
11095 +       PCISM_sta_m             = 0x00000080,
11096 +       PCISM_rta_b             = 8,
11097 +       PCISM_rta_m             = 0x00000100,
11098 +       PCISM_rma_b             = 9,
11099 +       PCISM_rma_m             = 0x00000200,
11100 +       PCISM_sse_b             = 10,
11101 +       PCISM_sse_m             = 0x00000400,
11102 +       PCISM_ose_b             = 11,
11103 +       PCISM_ose_m             = 0x00000800,
11104 +       PCISM_pe_b              = 12,
11105 +       PCISM_pe_m              = 0x00001000,
11106 +       PCISM_tae_b             = 13,
11107 +       PCISM_tae_m             = 0x00002000,
11108 +       PCISM_rle_b             = 14,
11109 +       PCISM_rle_m             = 0x00004000,
11110 +       PCISM_bme_b             = 15,
11111 +       PCISM_bme_m             = 0x00008000,
11112 +       PCISM_prd_b             = 16,
11113 +       PCISM_prd_m             = 0x00010000,
11114 +       PCISM_rip_b             = 17,
11115 +       PCISM_rip_m             = 0x00020000,
11116 +} ;
11117 +
11118 +/*******************************************************************************
11119 + *
11120 + * PCI Configuration Address Register
11121 + *
11122 + ******************************************************************************/
11123 +enum {
11124 +       PCICFGA_reg_b           = 2,
11125 +       PCICFGA_reg_m           = 0x000000fc,
11126 +               PCICFGA_reg_id_v        = 0x00>>2, //use PCFGID_
11127 +               PCICFGA_reg_04_v        = 0x04>>2, //use PCFG04_
11128 +               PCICFGA_reg_08_v        = 0x08>>2, //use PCFG08_
11129 +               PCICFGA_reg_0C_v        = 0x0C>>2, //use PCFG0C_
11130 +               PCICFGA_reg_pba0_v      = 0x10>>2, //use PCIPBA_
11131 +               PCICFGA_reg_pba1_v      = 0x14>>2, //use PCIPBA_
11132 +               PCICFGA_reg_pba2_v      = 0x18>>2, //use PCIPBA_
11133 +               PCICFGA_reg_pba3_v      = 0x1c>>2, //use PCIPBA_
11134 +               PCICFGA_reg_subsystem_v = 0x2c>>2, //use PCFGSS_
11135 +               PCICFGA_reg_3C_v        = 0x3C>>2, //use PCFG3C_
11136 +               PCICFGA_reg_pba0c_v     = 0x44>>2, //use PCIPBAC_
11137 +               PCICFGA_reg_pba0m_v     = 0x48>>2,
11138 +               PCICFGA_reg_pba1c_v     = 0x4c>>2, //use PCIPBAC_
11139 +               PCICFGA_reg_pba1m_v     = 0x50>>2,
11140 +               PCICFGA_reg_pba2c_v     = 0x54>>2, //use PCIPBAC_
11141 +               PCICFGA_reg_pba2m_v     = 0x58>>2,
11142 +               PCICFGA_reg_pba3c_v     = 0x5c>>2, //use PCIPBAC_
11143 +               PCICFGA_reg_pba3m_v     = 0x60>>2,
11144 +               PCICFGA_reg_pmgt_v      = 0x64>>2,
11145 +       PCICFGA_func_b          = 8,
11146 +       PCICFGA_func_m          = 0x00000700,
11147 +       PCICFGA_dev_b           = 11,
11148 +       PCICFGA_dev_m           = 0x0000f800,
11149 +               PCICFGA_dev_internal_v  = 0,
11150 +       PCICFGA_bus_b           = 16,
11151 +       PCICFGA_bus_m           = 0x00ff0000,
11152 +               PCICFGA_bus_type0_v     = 0,    //local bus
11153 +       PCICFGA_en_b            = 31,           // read only
11154 +       PCICFGA_en_m            = 0x80000000,
11155 +} ;
11156 +
11157 +enum {
11158 +       PCFGID_vendor_b         = 0,
11159 +       PCFGID_vendor_m         = 0x0000ffff,
11160 +               PCFGID_vendor_IDT_v             = 0x111d,
11161 +       PCFGID_device_b         = 16,
11162 +       PCFGID_device_m         = 0xffff0000,
11163 +               PCFGID_device_Acaciade_v        = 0x0207,
11164 +
11165 +       PCFG04_command_ioena_b          = 1,
11166 +       PCFG04_command_ioena_m          = 0x00000001,
11167 +       PCFG04_command_memena_b         = 2,
11168 +       PCFG04_command_memena_m         = 0x00000002,
11169 +       PCFG04_command_bmena_b          = 3,
11170 +       PCFG04_command_bmena_m          = 0x00000004,
11171 +       PCFG04_command_mwinv_b          = 5,
11172 +       PCFG04_command_mwinv_m          = 0x00000010,
11173 +       PCFG04_command_parena_b         = 7,
11174 +       PCFG04_command_parena_m         = 0x00000040,
11175 +       PCFG04_command_serrena_b        = 9,
11176 +       PCFG04_command_serrena_m        = 0x00000100,
11177 +       PCFG04_command_fastbbena_b      = 10,
11178 +       PCFG04_command_fastbbena_m      = 0x00000200,
11179 +       PCFG04_status_b                 = 16,
11180 +       PCFG04_status_m                 = 0xffff0000,
11181 +       PCFG04_status_66MHz_b           = 21,   // 66 MHz enable
11182 +       PCFG04_status_66MHz_m           = 0x00200000,
11183 +       PCFG04_status_fbb_b             = 23,
11184 +       PCFG04_status_fbb_m             = 0x00800000,
11185 +       PCFG04_status_mdpe_b            = 24,
11186 +       PCFG04_status_mdpe_m            = 0x01000000,
11187 +       PCFG04_status_dst_b             = 25,
11188 +       PCFG04_status_dst_m             = 0x06000000,
11189 +       PCFG04_status_sta_b             = 27,
11190 +       PCFG04_status_sta_m             = 0x08000000,
11191 +       PCFG04_status_rta_b             = 28,
11192 +       PCFG04_status_rta_m             = 0x10000000,
11193 +       PCFG04_status_rma_b             = 29,
11194 +       PCFG04_status_rma_m             = 0x20000000,
11195 +       PCFG04_status_sse_b             = 30,
11196 +       PCFG04_status_sse_m             = 0x40000000,
11197 +       PCFG04_status_pe_b              = 31,
11198 +       PCFG04_status_pe_m              = 0x40000000,
11199 +
11200 +       PCFG08_revId_b                  = 0,
11201 +       PCFG08_revId_m                  = 0x000000ff,
11202 +       PCFG08_classCode_b              = 0,
11203 +       PCFG08_classCode_m              = 0xffffff00,
11204 +               PCFG08_classCode_bridge_v       = 06,
11205 +               PCFG08_classCode_proc_v         = 0x0b3000, // processor-MIPS
11206 +       PCFG0C_cacheline_b              = 0,
11207 +       PCFG0C_cacheline_m              = 0x000000ff,
11208 +       PCFG0C_masterLatency_b          = 8,
11209 +       PCFG0C_masterLatency_m          = 0x0000ff00,
11210 +       PCFG0C_headerType_b             = 16,
11211 +       PCFG0C_headerType_m             = 0x00ff0000,
11212 +       PCFG0C_bist_b                   = 24,
11213 +       PCFG0C_bist_m                   = 0xff000000,
11214 +
11215 +       PCIPBA_msi_b                    = 0,
11216 +       PCIPBA_msi_m                    = 0x00000001,
11217 +       PCIPBA_p_b                      = 3,
11218 +       PCIPBA_p_m                      = 0x00000004,
11219 +       PCIPBA_baddr_b                  = 8,
11220 +       PCIPBA_baddr_m                  = 0xffffff00,
11221 +
11222 +       PCFGSS_vendorId_b               = 0,
11223 +       PCFGSS_vendorId_m               = 0x0000ffff,
11224 +       PCFGSS_id_b                     = 16,
11225 +       PCFGSS_id_m                     = 0xffff0000,
11226 +
11227 +       PCFG3C_interruptLine_b          = 0,
11228 +       PCFG3C_interruptLine_m          = 0x000000ff,
11229 +       PCFG3C_interruptPin_b           = 8,
11230 +       PCFG3C_interruptPin_m           = 0x0000ff00,
11231 +       PCFG3C_minGrant_b               = 16,
11232 +       PCFG3C_minGrant_m               = 0x00ff0000,
11233 +       PCFG3C_maxLat_b                 = 24,
11234 +       PCFG3C_maxLat_m                 = 0xff000000,
11235 +
11236 +       PCIPBAC_msi_b                   = 0,
11237 +       PCIPBAC_msi_m                   = 0x00000001,
11238 +       PCIPBAC_p_b                     = 1,
11239 +       PCIPBAC_p_m                     = 0x00000002,
11240 +       PCIPBAC_size_b                  = 2,
11241 +       PCIPBAC_size_m                  = 0x0000007c,
11242 +       PCIPBAC_sb_b                    = 7,
11243 +       PCIPBAC_sb_m                    = 0x00000080,
11244 +       PCIPBAC_pp_b                    = 8,
11245 +       PCIPBAC_pp_m                    = 0x00000100,
11246 +       PCIPBAC_mr_b                    = 9,
11247 +       PCIPBAC_mr_m                    = 0x00000600,
11248 +               PCIPBAC_mr_read_v       =0,     //no prefetching
11249 +               PCIPBAC_mr_readLine_v   =1,
11250 +               PCIPBAC_mr_readMult_v   =2,
11251 +       PCIPBAC_mrl_b                   = 11,
11252 +       PCIPBAC_mrl_m                   = 0x00000800,
11253 +       PCIPBAC_mrm_b                   = 12,
11254 +       PCIPBAC_mrm_m                   = 0x00001000,
11255 +       PCIPBAC_trp_b                   = 13,
11256 +       PCIPBAC_trp_m                   = 0x00002000,
11257 +
11258 +       PCFG40_trdyTimeout_b            = 0,
11259 +       PCFG40_trdyTimeout_m            = 0x000000ff,
11260 +       PCFG40_retryLim_b               = 8,
11261 +       PCFG40_retryLim_m               = 0x0000ff00,
11262 +};
11263 +
11264 +/*******************************************************************************
11265 + *
11266 + * PCI Local Base Address [0|1|2|3] Register
11267 + *
11268 + ******************************************************************************/
11269 +enum {
11270 +       PCILBA_baddr_b          = 0,            // In PCI_t -> pcilba [] .a
11271 +       PCILBA_baddr_m          = 0xffffff00,
11272 +} ;
11273 +/*******************************************************************************
11274 + *
11275 + * PCI Local Base Address Control Register
11276 + *
11277 + ******************************************************************************/
11278 +enum {
11279 +       PCILBAC_msi_b           = 0,            // In pPci->pcilba[i].c
11280 +       PCILBAC_msi_m           = 0x00000001,
11281 +               PCILBAC_msi_mem_v       = 0,
11282 +               PCILBAC_msi_io_v        = 1,
11283 +       PCILBAC_size_b          = 2,    // In pPci->pcilba[i].c
11284 +       PCILBAC_size_m          = 0x0000007c,
11285 +       PCILBAC_sb_b            = 7,    // In pPci->pcilba[i].c
11286 +       PCILBAC_sb_m            = 0x00000080,
11287 +       PCILBAC_rt_b            = 8,    // In pPci->pcilba[i].c
11288 +       PCILBAC_rt_m            = 0x00000100,
11289 +               PCILBAC_rt_noprefetch_v = 0, // mem read
11290 +               PCILBAC_rt_prefetch_v   = 1, // mem readline
11291 +} ;
11292 +
11293 +/*******************************************************************************
11294 + *
11295 + * PCI Local Base Address [0|1|2|3] Mapping Register
11296 + *
11297 + ******************************************************************************/
11298 +enum {
11299 +       PCILBAM_maddr_b         = 8,
11300 +       PCILBAM_maddr_m         = 0xffffff00,
11301 +} ;
11302 +
11303 +/*******************************************************************************
11304 + *
11305 + * PCI Decoupled Access Control Register
11306 + *
11307 + ******************************************************************************/
11308 +enum {
11309 +       PCIDAC_den_b            = 0,
11310 +       PCIDAC_den_m            = 0x00000001,
11311 +} ;
11312 +
11313 +/*******************************************************************************
11314 + *
11315 + * PCI Decoupled Access Status Register
11316 + *
11317 + ******************************************************************************/
11318 +enum {
11319 +       PCIDAS_d_b      = 0,
11320 +       PCIDAS_d_m      = 0x00000001,
11321 +       PCIDAS_b_b      = 1,
11322 +       PCIDAS_b_m      = 0x00000002,
11323 +       PCIDAS_e_b      = 2,
11324 +       PCIDAS_e_m      = 0x00000004,
11325 +       PCIDAS_ofe_b    = 3,
11326 +       PCIDAS_ofe_m    = 0x00000008,
11327 +       PCIDAS_off_b    = 4,
11328 +       PCIDAS_off_m    = 0x00000010,
11329 +       PCIDAS_ife_b    = 5,
11330 +       PCIDAS_ife_m    = 0x00000020,
11331 +       PCIDAS_iff_b    = 6,
11332 +       PCIDAS_iff_m    = 0x00000040,
11333 +} ;
11334 +
11335 +/*******************************************************************************
11336 + *
11337 + * PCI DMA Channel 8 Configuration Register
11338 + *
11339 + ******************************************************************************/
11340 +enum
11341 +{
11342 +       PCIDMA8C_mbs_b  = 0,            // Maximum Burst Size.
11343 +       PCIDMA8C_mbs_m  = 0x00000fff,   // { pcidma8c }
11344 +       PCIDMA8C_our_b  = 12,           // Optimize Unaligned Burst Reads.
11345 +       PCIDMA8C_our_m  = 0x00001000,   // { pcidma8c }
11346 +} ;
11347 +
11348 +/*******************************************************************************
11349 + *
11350 + * PCI DMA Channel 9 Configuration Register
11351 + *
11352 + ******************************************************************************/
11353 +enum
11354 +{
11355 +       PCIDMA9C_mbs_b  = 0,            // Maximum Burst Size.
11356 +       PCIDMA9C_mbs_m  = 0x00000fff, // { pcidma9c }
11357 +} ;
11358 +
11359 +/*******************************************************************************
11360 + *
11361 + * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors
11362 + *
11363 + ******************************************************************************/
11364 +enum {
11365 +       PCIDMAD_pt_b            = 22,           // in DEVCMD field (descriptor)
11366 +       PCIDMAD_pt_m            = 0x00c00000,   // preferred transaction field
11367 +               // These are for reads (DMA channel 8)
11368 +               PCIDMAD_devcmd_mr_v     = 0,    //memory read
11369 +               PCIDMAD_devcmd_mrl_v    = 1,    //memory read line
11370 +               PCIDMAD_devcmd_mrm_v    = 2,    //memory read multiple
11371 +               PCIDMAD_devcmd_ior_v    = 3,    //I/O read
11372 +               // These are for writes (DMA channel 9)
11373 +               PCIDMAD_devcmd_mw_v     = 0,    //memory write
11374 +               PCIDMAD_devcmd_mwi_v    = 1,    //memory write invalidate
11375 +               PCIDMAD_devcmd_iow_v    = 3,    //I/O write
11376 +
11377 +       // Swap byte field applies to both DMA channel 8 and 9
11378 +       PCIDMAD_sb_b            = 24,           // in DEVCMD field (descriptor)
11379 +       PCIDMAD_sb_m            = 0x01000000,   // swap byte field
11380 +} ;
11381 +
11382 +
11383 +/*******************************************************************************
11384 + *
11385 + * PCI Target Control Register
11386 + *
11387 + ******************************************************************************/
11388 +enum
11389 +{
11390 +       PCITC_rtimer_b          = 0,            // In PCITC_t -> pcitc
11391 +       PCITC_rtimer_m          = 0x000000ff,
11392 +       PCITC_dtimer_b          = 8,            // In PCITC_t -> pcitc
11393 +       PCITC_dtimer_m          = 0x0000ff00,
11394 +       PCITC_rdr_b             = 18,           // In PCITC_t -> pcitc
11395 +       PCITC_rdr_m             = 0x00040000,
11396 +       PCITC_ddt_b             = 19,           // In PCITC_t -> pcitc
11397 +       PCITC_ddt_m             = 0x00080000,
11398 +} ;
11399 +/*******************************************************************************
11400 + *
11401 + * PCI messaging unit [applies to both inbound and outbound registers ]
11402 + *
11403 + ******************************************************************************/
11404 +enum
11405 +{
11406 +       PCIM_m0_b       = 0,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
11407 +       PCIM_m0_m       = 0x00000001,   // inbound or outbound message 0
11408 +       PCIM_m1_b       = 1,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
11409 +       PCIM_m1_m       = 0x00000002,   // inbound or outbound message 1
11410 +       PCIM_db_b       = 2,            // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
11411 +       PCIM_db_m       = 0x00000004,   // inbound or outbound doorbell
11412 +};
11413 +
11414 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_pci_v.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_pci_v.h
11415 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_pci_v.h    1970-01-01 01:00:00.000000000 +0100
11416 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_pci_v.h    2006-01-10 00:32:33.000000000 +0100
11417 @@ -0,0 +1,190 @@
11418 +/**************************************************************************
11419 + *
11420 + *  BRIEF MODULE DESCRIPTION
11421 + *   Definitions for IDT RC32438 PCI setup.
11422 + *
11423 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
11424 + *         
11425 + *  This program is free software; you can redistribute  it and/or modify it
11426 + *  under  the terms of  the GNU General  Public License as published by the
11427 + *  Free Software Foundation;  either version 2 of the  License, or (at your
11428 + *  option) any later version.
11429 + *
11430 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
11431 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
11432 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
11433 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
11434 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
11435 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
11436 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
11437 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
11438 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11439 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11440 + *
11441 + *  You should have received a copy of the  GNU General Public License along
11442 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
11443 + *  675 Mass Ave, Cambridge, MA 02139, USA.
11444 + *
11445 + *
11446 + **************************************************************************
11447 + * May 2004 P. Sadik
11448 + *
11449 + * Initial Release
11450 + *
11451 + * 
11452 + *
11453 + **************************************************************************
11454 + */
11455 +
11456 +#define PCI_MSG_VirtualAddress      0xB8088010
11457 +#define rc32438_pci ((volatile PCI_t) PCI0_VirtualAddress)
11458 +#define rc32438_pci_msg ((volatile PCIM_t) PCI_MSG_VirtualAddress)
11459 +
11460 +#define PCIM_SHFT              0x6
11461 +#define PCIM_BIT_LEN           0x7
11462 +#define PCIM_H_EA              0x3
11463 +#define PCIM_H_IA_FIX          0x4
11464 +#define PCIM_H_IA_RR           0x5
11465 +
11466 +#define PCI_ADDR_START         0x50000000
11467 +
11468 +#define CPUTOPCI_MEM_WIN       0x02000000
11469 +#define CPUTOPCI_IO_WIN                0x00100000
11470 +#define PCILBA_SIZE_SHFT       2
11471 +#define PCILBA_SIZE_MASK       0x1F
11472 +#define SIZE_256MB             0x1C
11473 +#define SIZE_128MB             0x1B
11474 +#define SIZE_64MB               0x1A
11475 +#define SIZE_32MB              0x19
11476 +#define SIZE_16MB               0x18
11477 +#define SIZE_4MB               0x16
11478 +#define SIZE_2MB               0x15
11479 +#define SIZE_1MB               0x14
11480 +#define ACACIA_CONFIG0_ADDR    0x80000000
11481 +#define ACACIA_CONFIG1_ADDR    0x80000004
11482 +#define ACACIA_CONFIG2_ADDR    0x80000008
11483 +#define ACACIA_CONFIG3_ADDR    0x8000000C
11484 +#define ACACIA_CONFIG4_ADDR    0x80000010
11485 +#define ACACIA_CONFIG5_ADDR    0x80000014
11486 +#define ACACIA_CONFIG6_ADDR    0x80000018
11487 +#define ACACIA_CONFIG7_ADDR    0x8000001C
11488 +#define ACACIA_CONFIG8_ADDR    0x80000020
11489 +#define ACACIA_CONFIG9_ADDR    0x80000024
11490 +#define ACACIA_CONFIG10_ADDR   0x80000028
11491 +#define ACACIA_CONFIG11_ADDR   0x8000002C
11492 +#define ACACIA_CONFIG12_ADDR   0x80000030
11493 +#define ACACIA_CONFIG13_ADDR   0x80000034
11494 +#define ACACIA_CONFIG14_ADDR   0x80000038
11495 +#define ACACIA_CONFIG15_ADDR   0x8000003C
11496 +#define ACACIA_CONFIG16_ADDR   0x80000040
11497 +#define ACACIA_CONFIG17_ADDR   0x80000044
11498 +#define ACACIA_CONFIG18_ADDR   0x80000048
11499 +#define ACACIA_CONFIG19_ADDR   0x8000004C
11500 +#define ACACIA_CONFIG20_ADDR   0x80000050
11501 +#define ACACIA_CONFIG21_ADDR   0x80000054
11502 +#define ACACIA_CONFIG22_ADDR   0x80000058
11503 +#define ACACIA_CONFIG23_ADDR   0x8000005C
11504 +#define ACACIA_CONFIG24_ADDR   0x80000060
11505 +#define ACACIA_CONFIG25_ADDR   0x80000064
11506 +#define ACACIA_CMD             (PCFG04_command_ioena_m | \
11507 +                                PCFG04_command_memena_m | \
11508 +                                PCFG04_command_bmena_m | \
11509 +                                PCFG04_command_mwinv_m | \
11510 +                                PCFG04_command_parena_m | \
11511 +                                PCFG04_command_serrena_m )
11512 +
11513 +#define ACACIA_STAT            (PCFG04_status_mdpe_m | \
11514 +                                PCFG04_status_sta_m  | \
11515 +                                PCFG04_status_rta_m  | \
11516 +                                PCFG04_status_rma_m  | \
11517 +                                PCFG04_status_sse_m  | \
11518 +                                PCFG04_status_pe_m)
11519 +
11520 +#define ACACIA_CNFG1           ((ACACIA_STAT<<16)|ACACIA_CMD)
11521 +
11522 +#define ACACIA_REVID           0
11523 +#define ACACIA_CLASS_CODE      0
11524 +#define ACACIA_CNFG2           ((ACACIA_CLASS_CODE<<8) | \
11525 +                                 ACACIA_REVID)
11526 +
11527 +#define ACACIA_CACHE_LINE_SIZE 4
11528 +#define ACACIA_MASTER_LAT      0x3c
11529 +#define ACACIA_HEADER_TYPE     0
11530 +#define ACACIA_BIST            0
11531 +
11532 +#define ACACIA_CNFG3 ((ACACIA_BIST << 24) | \
11533 +                     (ACACIA_HEADER_TYPE<<16) | \
11534 +                     (ACACIA_MASTER_LAT<<8) | \
11535 +                     ACACIA_CACHE_LINE_SIZE )
11536 +
11537 +#define ACACIA_BAR0    0x00000008 /* 128 MB Memory */
11538 +#define ACACIA_BAR1    0x18800001 /* 1 MB IO */
11539 +#define ACACIA_BAR2    0x18000001 /* 2 MB IO window for Acacia
11540 +                                       internal Registers */
11541 +#define ACACIA_BAR3    0x48000008 /* Spare 128 MB Memory */
11542 +
11543 +#define ACACIA_CNFG4   ACACIA_BAR0
11544 +#define ACACIA_CNFG5    ACACIA_BAR1
11545 +#define ACACIA_CNFG6   ACACIA_BAR2
11546 +#define ACACIA_CNFG7   ACACIA_BAR3
11547 +
11548 +#define ACACIA_SUBSYS_VENDOR_ID 0
11549 +#define ACACIA_SUBSYSTEM_ID    0
11550 +#define ACACIA_CNFG8           0
11551 +#define ACACIA_CNFG9           0
11552 +#define ACACIA_CNFG10          0
11553 +#define ACACIA_CNFG11  ((ACACIA_SUBSYS_VENDOR_ID<<16) | \
11554 +                         ACACIA_SUBSYSTEM_ID)
11555 +#define ACACIA_INT_LINE                1
11556 +#define ACACIA_INT_PIN         1
11557 +#define ACACIA_MIN_GNT         8
11558 +#define ACACIA_MAX_LAT         0x38
11559 +#define ACACIA_CNFG12          0
11560 +#define ACACIA_CNFG13          0
11561 +#define ACACIA_CNFG14          0
11562 +#define ACACIA_CNFG15  ((ACACIA_MAX_LAT<<24) | \
11563 +                        (ACACIA_MIN_GNT<<16) | \
11564 +                        (ACACIA_INT_PIN<<8)  | \
11565 +                         ACACIA_INT_LINE)
11566 +#define        ACACIA_RETRY_LIMIT      0x80
11567 +#define ACACIA_TRDY_LIMIT      0x80
11568 +#define ACACIA_CNFG16 ((ACACIA_RETRY_LIMIT<<8) | \
11569 +                       ACACIA_TRDY_LIMIT)
11570 +#define PCI_PBAxC_R            0x0
11571 +#define PCI_PBAxC_RL           0x1
11572 +#define PCI_PBAxC_RM           0x2
11573 +#define SIZE_SHFT              2
11574 +
11575 +#define ACACIA_PBA0C   ( PCIPBAC_mrl_m | PCIPBAC_sb_m | \
11576 +                         ((PCI_PBAxC_RM &0x3) << PCIPBAC_mr_b) | \
11577 +                         PCIPBAC_pp_m | \
11578 +                         (SIZE_128MB<<SIZE_SHFT) | \
11579 +                          PCIPBAC_p_m)
11580 +
11581 +#define ACACIA_CNFG17  ACACIA_PBA0C
11582 +#define ACACIA_PBA0M   0x0
11583 +#define ACACIA_CNFG18  ACACIA_PBA0M
11584 +
11585 +#define ACACIA_PBA1C   ((SIZE_1MB<<SIZE_SHFT) | PCIPBAC_sb_m | \
11586 +                         PCIPBAC_msi_m)
11587 +
11588 +#define ACACIA_CNFG19  ACACIA_PBA1C
11589 +#define ACACIA_PBA1M   0x0
11590 +#define ACACIA_CNFG20  ACACIA_PBA1M
11591 +
11592 +#define ACACIA_PBA2C   ((SIZE_2MB<<SIZE_SHFT) | PCIPBAC_sb_m | \
11593 +                         PCIPBAC_msi_m)
11594 +
11595 +#define ACACIA_CNFG21  ACACIA_PBA2C
11596 +#define ACACIA_PBA2M   0x18000000
11597 +#define ACACIA_CNFG22  ACACIA_PBA2M
11598 +#define ACACIA_PBA3C   0
11599 +#define ACACIA_CNFG23  ACACIA_PBA3C
11600 +#define ACACIA_PBA3M   0
11601 +#define ACACIA_CNFG24  ACACIA_PBA3M
11602 +
11603 +
11604 +
11605 +#define        PCITC_DTIMER_VAL        8
11606 +#define PCITC_RTIMER_VAL       0x10
11607 +
11608 diff -Nur linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_timer.h linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_timer.h
11609 --- linux-2.6.15/include/asm-mips/idt-boards/rc32438/rc32438_timer.h    1970-01-01 01:00:00.000000000 +0100
11610 +++ linux-2.6.15-openwrt/include/asm-mips/idt-boards/rc32438/rc32438_timer.h    2006-01-10 00:32:33.000000000 +0100
11611 @@ -0,0 +1,91 @@
11612 +/**************************************************************************
11613 + *
11614 + *  BRIEF MODULE DESCRIPTION
11615 + *    Timer register definition IDT RC32438 CPU.
11616 + *
11617 + *  Copyright 2004 IDT Inc. (rischelp@idt.com)
11618 + *         
11619 + *  This program is free software; you can redistribute  it and/or modify it
11620 + *  under  the terms of  the GNU General  Public License as published by the
11621 + *  Free Software Foundation;  either version 2 of the  License, or (at your
11622 + *  option) any later version.
11623 + *
11624 + *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
11625 + *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
11626 + *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
11627 + *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
11628 + *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
11629 + *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
11630 + *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
11631 + *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
11632 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11633 + *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11634 + *
11635 + *  You should have received a copy of the  GNU General Public License along
11636 + *  with this program; if not, write  to the Free Software Foundation, Inc.,
11637 + *  675 Mass Ave, Cambridge, MA 02139, USA.
11638 + *
11639 + *
11640 + **************************************************************************
11641 + * May 2004 P. Sadik.
11642 + *
11643 + * Initial Release
11644 + *
11645 + * 
11646 + *
11647 + **************************************************************************
11648 + */
11649
11650 +#ifndef __IDT_RC32438_TIM_H__
11651 +#define __IDT_RC32438_TIM_H__
11652 +
11653 +enum
11654 +{
11655 +       TIM0_PhysicalAddress    = 0x18028000,
11656 +       TIM_PhysicalAddress     = TIM0_PhysicalAddress,         // Default
11657 +
11658 +       TIM0_VirtualAddress     = 0xb8028000,
11659 +       TIM_VirtualAddress      = TIM0_VirtualAddress,          // Default
11660 +} ;
11661 +
11662 +enum
11663 +{
11664 +       TIM_Count = 3,
11665 +} ;
11666 +
11667 +struct TIM_CNTR_s
11668 +{
11669 +       u32 count ;
11670 +       u32 compare ;
11671 +       u32 ctc ;       //use CTC_
11672 +} ;
11673 +
11674 +typedef struct TIM_s
11675 +{
11676 +       struct TIM_CNTR_s       tim [TIM_Count] ;
11677 +       u32                     rcount ;        //use RCOUNT_
11678 +       u32                     rcompare ;      //use RCOMPARE_
11679 +       u32                     rtc ;           //use RTC_
11680 +} volatile * TIM_t ;
11681 +
11682 +enum
11683 +{
11684 +       CTC_en_b        = 0,            
11685 +       CTC_en_m        = 0x00000001,
11686 +       CTC_to_b        = 1,             
11687 +       CTC_to_m        = 0x00000002,
11688 +
11689 +       RCOUNT_count_b          = 0,         
11690 +       RCOUNT_count_m          = 0x0000ffff,
11691 +       RCOMPARE_compare_b      = 0,       
11692 +       RCOMPARE_compare_m      = 0x0000ffff,
11693 +       RTC_ce_b                = 0,            
11694 +       RTC_ce_m                = 0x00000001,
11695 +       RTC_to_b                = 1,            
11696 +       RTC_to_m                = 0x00000002,
11697 +       RTC_rqe_b               = 2,            
11698 +       RTC_rqe_m               = 0x00000004,
11699 +                                
11700 +} ;
11701 +#endif //__IDT_RC32438_TIM_H__
11702 +
11703 diff -Nur linux-2.6.15/include/asm-mips/mach-generic/irq.h linux-2.6.15-openwrt/include/asm-mips/mach-generic/irq.h
11704 --- linux-2.6.15/include/asm-mips/mach-generic/irq.h    2006-01-03 04:21:10.000000000 +0100
11705 +++ linux-2.6.15-openwrt/include/asm-mips/mach-generic/irq.h    2006-01-10 00:32:33.000000000 +0100
11706 @@ -8,6 +8,6 @@
11707  #ifndef __ASM_MACH_GENERIC_IRQ_H
11708  #define __ASM_MACH_GENERIC_IRQ_H
11709  
11710 -#define NR_IRQS        128
11711 +#define NR_IRQS        256
11712  
11713  #endif /* __ASM_MACH_GENERIC_IRQ_H */
11714 diff -Nur linux-2.6.15/include/linux/init.h linux-2.6.15-openwrt/include/linux/init.h
11715 --- linux-2.6.15/include/linux/init.h   2006-01-03 04:21:10.000000000 +0100
11716 +++ linux-2.6.15-openwrt/include/linux/init.h   2006-01-10 00:32:33.000000000 +0100
11717 @@ -86,6 +86,8 @@
11718         static initcall_t __initcall_##fn __attribute_used__ \
11719         __attribute__((__section__(".initcall" level ".init"))) = fn
11720  
11721 +#define early_initcall(fn)              __define_initcall(".early1",fn)
11722 +
11723  #define core_initcall(fn)              __define_initcall("1",fn)
11724  #define postcore_initcall(fn)          __define_initcall("2",fn)
11725  #define arch_initcall(fn)              __define_initcall("3",fn)
11726 diff -Nur linux-2.6.15/include/linux/kernel.h linux-2.6.15-openwrt/include/linux/kernel.h
11727 --- linux-2.6.15/include/linux/kernel.h 2006-01-03 04:21:10.000000000 +0100
11728 +++ linux-2.6.15-openwrt/include/linux/kernel.h 2006-01-10 00:32:33.000000000 +0100
11729 @@ -307,6 +307,7 @@
11730  };
11731  
11732  /* Force a compilation error if condition is true */
11733 +extern void BUILD_BUG(void);
11734  #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
11735  
11736  #ifdef CONFIG_SYSCTL
11737 diff -Nur linux-2.6.15/Makefile linux-2.6.15-openwrt/Makefile
11738 --- linux-2.6.15/Makefile       2006-01-03 04:21:10.000000000 +0100
11739 +++ linux-2.6.15-openwrt/Makefile       2006-01-10 00:32:33.000000000 +0100
11740 @@ -166,10 +166,7 @@
11741  # then ARCH is assigned, getting whatever value it gets normally, and 
11742  # SUBARCH is subsequently ignored.
11743  
11744 -SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
11745 -                                 -e s/arm.*/arm/ -e s/sa110/arm/ \
11746 -                                 -e s/s390x/s390/ -e s/parisc64/parisc/ \
11747 -                                 -e s/ppc64/powerpc/ )
11748 +SUBARCH := mips
11749  
11750  # Cross compiling and selecting different set of gcc/bin-utils
11751  # ---------------------------------------------------------------------------
11752 diff -Nur linux-2.6.15/drivers/net/natsemi.c linux-2.6.15-openwrt/drivers/net/natsemi.c
11753 --- linux-2.6.15/drivers/net/natsemi.c  2006-01-02 19:21:10.000000000 -0800
11754 +++ linux-2.6.15-openwrt/drivers/net/natsemi.c  2006-01-10 07:29:49.581994000 -0800
11755 @@ -771,6 +771,49 @@
11756  static int netdev_get_eeprom(struct net_device *dev, u8 *buf);
11757  static struct ethtool_ops ethtool_ops;
11758  
11759 +#ifdef CONFIG_MACH_ARUBA
11760 +
11761 +#include <linux/ctype.h>
11762 +
11763 +#ifndef ERR
11764 +#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
11765 +#endif
11766 +
11767 +static int parse_mac_addr(struct net_device *dev, char* macstr)
11768 +{
11769 +        int i, j;
11770 +        unsigned char result, value;
11771 +
11772 +        for (i=0; i<6; i++) {
11773 +                result = 0;
11774 +                if (i != 5 && *(macstr+2) != ':') {
11775 +                        ERR("invalid mac address format: %d %c\n",
11776 +                            i, *(macstr+2));
11777 +                        return -EINVAL;
11778 +                }
11779 +                for (j=0; j<2; j++) {
11780 +                        if (isxdigit(*macstr) && (value = isdigit(*macstr) ? *macstr-'0' :
11781 +                                                  toupper(*macstr)-'A'+10) < 16) {
11782 +                                result = result*16 + value;
11783 +                                macstr++;
11784 +                        }
11785 +                        else {
11786 +                                ERR("invalid mac address "
11787 +                                    "character: %c\n", *macstr);
11788 +                                return -EINVAL;
11789 +                        }
11790 +                }
11791 +
11792 +                macstr++;
11793 +                dev->dev_addr[i] = result;
11794 +        }
11795 +
11796 +       dev->dev_addr[5]++;
11797 +        return 0;
11798 +}
11799 +
11800 +#endif
11801 +
11802  static inline void __iomem *ns_ioaddr(struct net_device *dev)
11803  {
11804         return (void __iomem *) dev->base_addr;
11805 @@ -859,6 +902,7 @@
11806                 goto err_ioremap;
11807         }
11808  
11809 +#ifndef CONFIG_MACH_ARUBA
11810         /* Work around the dropped serial bit. */
11811         prev_eedata = eeprom_read(ioaddr, 6);
11812         for (i = 0; i < 3; i++) {
11813 @@ -867,6 +911,19 @@
11814                 dev->dev_addr[i*2+1] = eedata >> 7;
11815                 prev_eedata = eedata;
11816         }
11817 +#else
11818 +       {
11819 +               char mac[32];
11820 +               unsigned char def_mac[6] = {00, 0x0b, 0x86, 0xba, 0xdb, 0xad};
11821 +               extern char *getenv(char *e);
11822 +               memset(mac, 0, 32);
11823 +               memcpy(mac, getenv("ethaddr"), 17);
11824 +               if (parse_mac_addr(dev, mac)){
11825 +                       printk("%s: MAC address not found\n", __func__);
11826 +                       memcpy(dev->dev_addr, def_mac, 6);
11827 +               }
11828 +       }
11829 +#endif
11830  
11831         dev->base_addr = (unsigned long __force) ioaddr;
11832         dev->irq = irq;
11833 diff -Nur linux-2.6.15/drivers/net/Makefile linux-2.6.15-openwrt/drivers/net/Makefile
11834 --- linux-2.6.15/drivers/net/Makefile   2006-01-13 09:19:55.000000000 -0800
11835 +++ linux-2.6.15-openwrt/drivers/net/Makefile   2006-01-09 20:44:10.378339000 -0800
11836 @@ -35,6 +35,7 @@
11837  
11838  obj-$(CONFIG_OAKNET) += oaknet.o 8390.o
11839  
11840 +obj-$(CONFIG_IDT_RC32434_ETH) += rc32434_eth.o
11841  obj-$(CONFIG_DGRS) += dgrs.o
11842  obj-$(CONFIG_VORTEX) += 3c59x.o
11843  obj-$(CONFIG_TYPHOON) += typhoon.o
11844 @@ -190,7 +189,6 @@
11845  obj-$(CONFIG_SMC91X) += smc91x.o
11846  obj-$(CONFIG_DM9000) += dm9000.o
11847  obj-$(CONFIG_FEC_8XX) += fec_8xx/
11848 -obj-$(CONFIG_IDT_RC32434_ETH) += rc32434_eth.o
11849  
11850  obj-$(CONFIG_ARM) += arm/
11851  obj-$(CONFIG_DEV_APPLETALK) += appletalk/