1 diff -urN linux.old/arch/mips/Kconfig linux.dev/arch/mips/Kconfig
2 --- linux.old/arch/mips/Kconfig 2006-11-29 22:57:37.000000000 +0100
3 +++ linux.dev/arch/mips/Kconfig 2006-12-14 04:09:50.000000000 +0100
5 select SYS_SUPPORTS_BIG_ENDIAN
9 + bool "Support for RB5xx boards"
12 + select SYS_HAS_CPU_MIPS32_R1
13 + select SYS_SUPPORTS_LITTLE_ENDIAN
14 + select SYS_SUPPORTS_32BIT_KERNEL
15 + select SWAP_IO_SPACE
16 + select DMA_NONCOHERENT
18 + Support the Mikrotik(tm) Routerboard 500 series,
21 config TOSHIBA_RBTX4927
22 bool "Toshiba TBTX49[23]7 board"
23 select DMA_NONCOHERENT
26 config MIPS_L1_CACHE_SHIFT
28 - default "4" if MACH_DECSTATION
29 + default "4" if MACH_DECSTATION || MIKROTIK_RB500
30 default "7" if SGI_IP27
33 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
34 --- linux.old/arch/mips/Makefile 2006-12-14 03:13:55.000000000 +0100
35 +++ linux.dev/arch/mips/Makefile 2006-12-14 04:09:50.000000000 +0100
37 load-$(CONFIG_TOSHIBA_JMR3927) += 0xffffffff80050000
40 +# Routerboard 532 board
42 +core-$(CONFIG_MIKROTIK_RB500) += arch/mips/rb500/
43 +cflags-$(CONFIG_MIKROTIK_RB500) += -Iinclude/asm-mips/rc32434
44 +load-$(CONFIG_MIKROTIK_RB500) += 0xffffffff80101000
47 # Toshiba RBTX4927 board or
48 # Toshiba RBTX4937 board
50 diff -urN linux.old/arch/mips/pci/fixup-rb500.c linux.dev/arch/mips/pci/fixup-rb500.c
51 --- linux.old/arch/mips/pci/fixup-rb500.c 1970-01-01 01:00:00.000000000 +0100
52 +++ linux.dev/arch/mips/pci/fixup-rb500.c 2006-12-14 04:09:50.000000000 +0100
55 + * Copyright 2001 MontaVista Software Inc.
56 + * Author: MontaVista Software, Inc.
57 + * stevel@mvista.com or source@mvista.com
59 + * This program is free software; you can redistribute it and/or modify it
60 + * under the terms of the GNU General Public License as published by the
61 + * Free Software Foundation; either version 2 of the License, or (at your
62 + * option) any later version.
64 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
65 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
66 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
67 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
68 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
69 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
70 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
71 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
72 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
73 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
75 + * You should have received a copy of the GNU General Public License along
76 + * with this program; if not, write to the Free Software Foundation, Inc.,
77 + * 675 Mass Ave, Cambridge, MA 02139, USA.
80 +#include <linux/autoconf.h>
81 +#include <linux/types.h>
82 +#include <linux/pci.h>
83 +#include <linux/kernel.h>
84 +#include <linux/init.h>
86 +#include <asm/rc32434/rc32434.h>
88 +static int __devinitdata irq_map[2][12] = {
89 + { 0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1 },
90 + { 0, 0, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3 }
93 +int __devinit pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
97 + if (dev->bus->number < 2 && PCI_SLOT(dev->devfn) < 12) {
98 + irq = irq_map[dev->bus->number][PCI_SLOT(dev->devfn)];
100 + return irq + GROUP4_IRQ_BASE + 4;
103 diff -urN linux.old/arch/mips/pci/Makefile linux.dev/arch/mips/pci/Makefile
104 --- linux.old/arch/mips/pci/Makefile 2006-11-29 22:57:37.000000000 +0100
105 +++ linux.dev/arch/mips/pci/Makefile 2006-12-14 04:09:50.000000000 +0100
107 obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
108 obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o
109 obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o
110 +obj-$(CONFIG_MIKROTIK_RB500) += pci-rc32434.o ops-rc32434.o fixup-rb500.o
111 diff -urN linux.old/arch/mips/pci/ops-rc32434.c linux.dev/arch/mips/pci/ops-rc32434.c
112 --- linux.old/arch/mips/pci/ops-rc32434.c 1970-01-01 01:00:00.000000000 +0100
113 +++ linux.dev/arch/mips/pci/ops-rc32434.c 2006-12-14 04:09:50.000000000 +0100
115 +/**************************************************************************
117 + * BRIEF MODULE DESCRIPTION
118 + * pci_ops for IDT EB434 board
120 + * Copyright 2004 IDT Inc. (rischelp@idt.com)
121 + * Copyright 2006 Felix Fietkau <nbd@openwrt.org>
123 + * This program is free software; you can redistribute it and/or modify it
124 + * under the terms of the GNU General Public License as published by the
125 + * Free Software Foundation; either version 2 of the License, or (at your
126 + * option) any later version.
128 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
129 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
130 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
131 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
132 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
133 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
134 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
135 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
136 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
137 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
139 + * You should have received a copy of the GNU General Public License along
140 + * with this program; if not, write to the Free Software Foundation, Inc.,
141 + * 675 Mass Ave, Cambridge, MA 02139, USA.
144 + **************************************************************************
145 + * May 2004 rkt, neb
151 + **************************************************************************
154 +#include <linux/autoconf.h>
155 +#include <linux/init.h>
156 +#include <linux/pci.h>
157 +#include <linux/types.h>
158 +#include <linux/delay.h>
160 +#include <asm/cpu.h>
163 +#include <asm/rc32434/rc32434.h>
164 +#include <asm/rc32434/pci.h>
166 +#define PCI_ACCESS_READ 0
167 +#define PCI_ACCESS_WRITE 1
170 +#define PCI_CFG_SET(bus,slot,func,off) \
171 + (rc32434_pci->pcicfga = (0x80000000 | \
172 + ((bus) << 16) | ((slot)<<11) | \
173 + ((func)<<8) | (off)))
175 +static inline int config_access(unsigned char access_type, struct pci_bus *bus,
176 + unsigned int devfn, unsigned char where,
179 + unsigned int slot = PCI_SLOT(devfn);
180 + u8 func = PCI_FUNC(devfn);
182 + /* Setup address */
183 + PCI_CFG_SET(bus->number, slot, func, where);
186 + if (access_type == PCI_ACCESS_WRITE)
187 + rc32434_pci->pcicfgd = *data;
189 + *data = rc32434_pci->pcicfgd;
198 + * We can't address 8 and 16 bit words directly. Instead we have to
199 + * read/write a 32bit word and mask/modify the data we actually want.
201 +static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
202 + int where, u8 * val)
207 + ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
208 + *val = (data >> ((where & 3) << 3)) & 0xff;
212 +static int read_config_word(struct pci_bus *bus, unsigned int devfn,
213 + int where, u16 * val)
218 + ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data);
219 + *val = (data >> ((where & 3) << 3)) & 0xffff;
223 +static int read_config_dword(struct pci_bus *bus, unsigned int devfn,
224 + int where, u32 * val)
229 + if (bus->number == 0 && PCI_SLOT(devfn) > 21)
233 + ret = config_access(PCI_ACCESS_READ, bus, devfn, where, val);
235 + /* PCI scan: check for invalid values, device may not have
236 + * finished initializing */
238 + if (where == PCI_VENDOR_ID) {
239 + if (ret == 0xffffffff || ret == 0x00000000 ||
240 + ret == 0x0000ffff || ret == 0xffff0000) {
255 +write_config_byte(struct pci_bus *bus, unsigned int devfn, int where,
260 + if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
263 + data = (data & ~(0xff << ((where & 3) << 3))) |
264 + (val << ((where & 3) << 3));
266 + if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
269 + return PCIBIOS_SUCCESSFUL;
274 +write_config_word(struct pci_bus *bus, unsigned int devfn, int where,
279 + if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data))
282 + data = (data & ~(0xffff << ((where & 3) << 3))) |
283 + (val << ((where & 3) << 3));
285 + if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data))
289 + return PCIBIOS_SUCCESSFUL;
294 +write_config_dword(struct pci_bus *bus, unsigned int devfn, int where,
297 + if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val))
300 + return PCIBIOS_SUCCESSFUL;
303 +static int pci_config_read(struct pci_bus *bus, unsigned int devfn,
304 + int where, int size, u32 * val)
308 + return read_config_byte(bus, devfn, where, (u8 *) val);
310 + return read_config_word(bus, devfn, where, (u16 *) val);
312 + return read_config_dword(bus, devfn, where, val);
316 +static int pci_config_write(struct pci_bus *bus, unsigned int devfn,
317 + int where, int size, u32 val)
321 + return write_config_byte(bus, devfn, where, (u8) val);
323 + return write_config_word(bus, devfn, where, (u16) val);
325 + return write_config_dword(bus, devfn, where, val);
329 +struct pci_ops rc32434_pci_ops = {
330 + .read = pci_config_read,
331 + .write = pci_config_write,
333 diff -urN linux.old/arch/mips/pci/pci-rc32434.c linux.dev/arch/mips/pci/pci-rc32434.c
334 --- linux.old/arch/mips/pci/pci-rc32434.c 1970-01-01 01:00:00.000000000 +0100
335 +++ linux.dev/arch/mips/pci/pci-rc32434.c 2006-12-14 04:09:50.000000000 +0100
337 +/**************************************************************************
339 + * BRIEF MODULE DESCRIPTION
340 + * PCI initialization for IDT EB434 board
342 + * Copyright 2004 IDT Inc. (rischelp@idt.com)
344 + * This program is free software; you can redistribute it and/or modify it
345 + * under the terms of the GNU General Public License as published by the
346 + * Free Software Foundation; either version 2 of the License, or (at your
347 + * option) any later version.
349 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
350 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
351 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
352 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
353 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
354 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
355 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
356 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
357 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
358 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
360 + * You should have received a copy of the GNU General Public License along
361 + * with this program; if not, write to the Free Software Foundation, Inc.,
362 + * 675 Mass Ave, Cambridge, MA 02139, USA.
365 + **************************************************************************
366 + * May 2004 rkt, neb
372 + **************************************************************************
375 +#include <linux/autoconf.h>
376 +#include <linux/types.h>
377 +#include <linux/pci.h>
378 +#include <linux/kernel.h>
379 +#include <linux/init.h>
381 +#include <asm/rc32434/rc32434.h>
382 +#include <asm/rc32434/pci.h>
384 +#define PCI_ACCESS_READ 0
385 +#define PCI_ACCESS_WRITE 1
387 +/* define an unsigned array for the PCI registers */
388 +unsigned int korinaCnfgRegs[25] = {
389 + KORINA_CNFG1, KORINA_CNFG2, KORINA_CNFG3, KORINA_CNFG4,
390 + KORINA_CNFG5, KORINA_CNFG6, KORINA_CNFG7, KORINA_CNFG8,
391 + KORINA_CNFG9, KORINA_CNFG10, KORINA_CNFG11, KORINA_CNFG12,
392 + KORINA_CNFG13, KORINA_CNFG14, KORINA_CNFG15, KORINA_CNFG16,
393 + KORINA_CNFG17, KORINA_CNFG18, KORINA_CNFG19, KORINA_CNFG20,
394 + KORINA_CNFG21, KORINA_CNFG22, KORINA_CNFG23, KORINA_CNFG24
396 +static struct resource rc32434_res_pci_mem1;
397 +static struct resource rc32434_res_pci_mem2;
399 +static struct resource rc32434_res_pci_mem1 = {
400 + .name = "PCI MEM1",
401 + .start = 0x50000000,
403 + .flags = IORESOURCE_MEM,
404 + .parent = &rc32434_res_pci_mem1,
406 + .child = &rc32434_res_pci_mem2
409 +static struct resource rc32434_res_pci_mem2 = {
410 + .name = "PCI Mem2",
411 + .start = 0x60000000,
413 + .flags = IORESOURCE_MEM,
414 + .parent = &rc32434_res_pci_mem1,
419 +static struct resource rc32434_res_pci_io1 = {
420 + .name = "PCI I/O1",
421 + .start = 0x18800000,
423 + .flags = IORESOURCE_IO,
426 +extern struct pci_ops rc32434_pci_ops;
428 +#define PCI_MEM1_START PCI_ADDR_START
429 +#define PCI_MEM1_END PCI_ADDR_START + CPUTOPCI_MEM_WIN - 1
430 +#define PCI_MEM2_START PCI_ADDR_START + CPUTOPCI_MEM_WIN
431 +#define PCI_MEM2_END PCI_ADDR_START + ( 2* CPUTOPCI_MEM_WIN) - 1
432 +#define PCI_IO1_START PCI_ADDR_START + (2 * CPUTOPCI_MEM_WIN)
433 +#define PCI_IO1_END PCI_ADDR_START + (2* CPUTOPCI_MEM_WIN) + CPUTOPCI_IO_WIN -1
434 +#define PCI_IO2_START PCI_ADDR_START + (2 * CPUTOPCI_MEM_WIN) + CPUTOPCI_IO_WIN
435 +#define PCI_IO2_END PCI_ADDR_START + (2* CPUTOPCI_MEM_WIN) + (2 * CPUTOPCI_IO_WIN) -1
438 +struct pci_controller rc32434_controller2;
440 +struct pci_controller rc32434_controller = {
441 + .pci_ops = &rc32434_pci_ops,
442 + .mem_resource = &rc32434_res_pci_mem1,
443 + .io_resource = &rc32434_res_pci_io1,
450 +#define PCI_ENDIAN_FLAG PCILBAC_sb_m
452 +#define PCI_ENDIAN_FLAG 0
455 +static int __init rc32434_pcibridge_init(void)
457 + unsigned int pcicValue, pcicData = 0;
458 + unsigned int dummyRead, pciCntlVal;
460 + unsigned int pciConfigAddr;
462 + pcicValue = rc32434_pci->pcic;
463 + pcicValue = (pcicValue >> PCIM_SHFT) & PCIM_BIT_LEN;
464 + if (!((pcicValue == PCIM_H_EA) ||
465 + (pcicValue == PCIM_H_IA_FIX) ||
466 + (pcicValue == PCIM_H_IA_RR))) {
467 + printk("PCI init error!!!\n");
468 + /* Not in Host Mode, return ERROR */
471 + /* Enables the Idle Grant mode, Arbiter Parking */
472 + pcicData |=(PCIC_igm_m|PCIC_eap_m|PCIC_en_m);
473 + rc32434_pci->pcic = pcicData; /* Enable the PCI bus Interface */
474 + /* Zero out the PCI status & PCI Status Mask */
477 + pcicData = rc32434_pci->pcis;
478 + if (!(pcicData & PCIS_rip_m))
482 + rc32434_pci->pcis = 0;
483 + rc32434_pci->pcism = 0xFFFFFFFF;
484 + /* Zero out the PCI decoupled registers */
485 + rc32434_pci->pcidac=0; /* disable PCI decoupled accesses at initialization */
486 + rc32434_pci->pcidas=0; /* clear the status */
487 + rc32434_pci->pcidasm=0x0000007F; /* Mask all the interrupts */
488 + /* Mask PCI Messaging Interrupts */
489 + rc32434_pci_msg->pciiic = 0;
490 + rc32434_pci_msg->pciiim = 0xFFFFFFFF;
491 + rc32434_pci_msg->pciioic = 0;
492 + rc32434_pci_msg->pciioim = 0;
495 + /* Setup PCILB0 as Memory Window */
496 + rc32434_pci->pcilba[0].a = (unsigned int) (PCI_ADDR_START);
498 + /* setup the PCI map address as same as the local address */
500 + rc32434_pci->pcilba[0].m = (unsigned int) (PCI_ADDR_START);
503 + /* Setup PCILBA1 as MEM */
504 + rc32434_pci->pcilba[0].c = ( ((SIZE_256MB & 0x1f) << PCILBAC_size_b) | PCI_ENDIAN_FLAG);
505 + dummyRead = rc32434_pci->pcilba[0].c; /* flush the CPU write Buffers */
506 + rc32434_pci->pcilba[1].a = 0x60000000;
507 + rc32434_pci->pcilba[1].m = 0x60000000;
509 + /* setup PCILBA2 as IO Window*/
510 + rc32434_pci->pcilba[1].c = (((SIZE_256MB & 0x1f) << PCILBAC_size_b )| PCI_ENDIAN_FLAG);
511 + dummyRead = rc32434_pci->pcilba[1].c; /* flush the CPU write Buffers */
512 + rc32434_pci->pcilba[2].a = 0x18C00000;
513 + rc32434_pci->pcilba[2].m = 0x18FFFFFF;
515 + /* setup PCILBA2 as IO Window*/
516 + rc32434_pci->pcilba[2].c = (((SIZE_4MB & 0x1f) << PCILBAC_size_b) | PCI_ENDIAN_FLAG );
517 + dummyRead = rc32434_pci->pcilba[2].c; /* flush the CPU write Buffers */
519 + /* Setup PCILBA3 as IO Window */
520 + rc32434_pci->pcilba[3].a = 0x18800000;
521 + rc32434_pci->pcilba[3].m = 0x18800000;
522 + rc32434_pci->pcilba[3].c = ( (((SIZE_1MB & 0x1ff) << PCILBAC_size_b) | PCILBAC_msi_m) | PCI_ENDIAN_FLAG);
523 + dummyRead = rc32434_pci->pcilba[3].c; /* flush the CPU write Buffers */
525 + pciConfigAddr=(unsigned int)(0x80000004);
526 + for(loopCount=0;loopCount<24;loopCount++){
527 + rc32434_pci->pcicfga=pciConfigAddr;
528 + dummyRead=rc32434_pci->pcicfga;
529 + rc32434_pci->pcicfgd = korinaCnfgRegs[loopCount];
530 + dummyRead=rc32434_pci->pcicfgd;
531 + pciConfigAddr += 4;
533 + rc32434_pci->pcitc = (unsigned int)((PCITC_RTIMER_VAL&0xff) << PCITC_rtimer_b)
534 + | ((PCITC_DTIMER_VAL&0xff) << PCITC_dtimer_b);
536 + pciCntlVal=rc32434_pci->pcic;
537 + pciCntlVal &=~(PCIC_tnr_m);
538 + rc32434_pci->pcic = pciCntlVal;
539 + pciCntlVal=rc32434_pci->pcic;
543 +/* Do platform specific device initialization at pci_enable_device() time */
544 +int pcibios_plat_dev_init(struct pci_dev *dev)
546 + if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) {
547 + /* disable prefetched memory range */
548 + pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0);
549 + pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0x10);
551 + pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4);
556 +static int __init rc32434_pci_init(void)
558 + printk("PCI: Initializing PCI\n");
560 + ioport_resource.start = rc32434_res_pci_io1.start;
561 + ioport_resource.end = rc32434_res_pci_io1.end;
563 + rc32434_pcibridge_init();
565 + register_pci_controller(&rc32434_controller);
569 +arch_initcall(rc32434_pci_init);
571 diff -urN linux.old/arch/mips/rb500/devices.c linux.dev/arch/mips/rb500/devices.c
572 --- linux.old/arch/mips/rb500/devices.c 1970-01-01 01:00:00.000000000 +0100
573 +++ linux.dev/arch/mips/rb500/devices.c 2006-12-14 04:09:50.000000000 +0100
576 + * RouterBoard 500 Platform devices
578 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
580 + * This program is free software; you can redistribute it and/or modify
581 + * it under the terms of the GNU General Public License as published by
582 + * the Free Software Foundation; either version 2 of the License, or
583 + * (at your option) any later version.
585 + * This program is distributed in the hope that it will be useful,
586 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
587 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
588 + * GNU General Public License for more details.
592 +#include <linux/kernel.h>
593 +#include <linux/init.h>
594 +#include <linux/module.h>
595 +#include <linux/ctype.h>
596 +#include <linux/string.h>
597 +#include <linux/platform_device.h>
598 +#include <asm/unaligned.h>
601 +#include <asm/rc32434/rc32434.h>
602 +#include <asm/rc32434/dma.h>
603 +#include <asm/rc32434/dma_v.h>
604 +#include <asm/rc32434/eth.h>
605 +#include <asm/rc32434/rb.h>
607 +#define ETH0_DMA_RX_IRQ GROUP1_IRQ_BASE + 0
608 +#define ETH0_DMA_TX_IRQ GROUP1_IRQ_BASE + 1
609 +#define ETH0_RX_OVR_IRQ GROUP3_IRQ_BASE + 9
610 +#define ETH0_TX_UND_IRQ GROUP3_IRQ_BASE + 10
612 +#define ETH0_RX_DMA_ADDR (DMA0_PhysicalAddress + 0*DMA_CHAN_OFFSET)
613 +#define ETH0_TX_DMA_ADDR (DMA0_PhysicalAddress + 1*DMA_CHAN_OFFSET)
615 +static struct resource korina_dev0_res[] = {
617 + .name = "korina_regs",
618 + .start = ETH0_PhysicalAddress,
619 + .end = ETH0_PhysicalAddress + sizeof(ETH_t),
620 + .flags = IORESOURCE_MEM,
623 + .name = "korina_rx",
624 + .start = ETH0_DMA_RX_IRQ,
625 + .end = ETH0_DMA_RX_IRQ,
626 + .flags = IORESOURCE_IRQ
629 + .name = "korina_tx",
630 + .start = ETH0_DMA_TX_IRQ,
631 + .end = ETH0_DMA_TX_IRQ,
632 + .flags = IORESOURCE_IRQ
635 + .name = "korina_ovr",
636 + .start = ETH0_RX_OVR_IRQ,
637 + .end = ETH0_RX_OVR_IRQ,
638 + .flags = IORESOURCE_IRQ
641 + .name = "korina_und",
642 + .start = ETH0_TX_UND_IRQ,
643 + .end = ETH0_TX_UND_IRQ,
644 + .flags = IORESOURCE_IRQ
647 + .name = "korina_dma_rx",
648 + .start = ETH0_RX_DMA_ADDR,
649 + .end = ETH0_RX_DMA_ADDR + DMA_CHAN_OFFSET - 1,
650 + .flags = IORESOURCE_MEM,
653 + .name = "korina_dma_tx",
654 + .start = ETH0_TX_DMA_ADDR,
655 + .end = ETH0_TX_DMA_ADDR + DMA_CHAN_OFFSET - 1,
656 + .flags = IORESOURCE_MEM,
660 +static struct korina_device korina_dev0_data = {
662 + .mac = { 0xde, 0xca, 0xff, 0xc0, 0xff, 0xee }
665 +static struct platform_device korina_dev0 = {
668 + .dev.platform_data = &korina_dev0_data,
669 + .resource = korina_dev0_res,
670 + .num_resources = ARRAY_SIZE(korina_dev0_res),
674 +#define CF_GPIO_NUM 13
676 +static struct resource cf_slot0_res[] = {
678 + .name = "cf_membase",
679 + .flags = IORESOURCE_MEM
683 + .start = (8 + 4 * 32 + CF_GPIO_NUM), /* 149 */
684 + .end = (8 + 4 * 32 + CF_GPIO_NUM),
685 + .flags = IORESOURCE_IRQ
689 +static struct cf_device cf_slot0_data = {
693 +static struct platform_device cf_slot0 = {
695 + .name = "rb500-cf",
696 + .dev.platform_data = &cf_slot0_data,
697 + .resource = cf_slot0_res,
698 + .num_resources = ARRAY_SIZE(cf_slot0_res),
701 +/* Resources and device for NAND. There is no data needed and no irqs, so just define the memory used. */
702 +static struct resource nand_slot0_res[] = {
704 + .name = "nand_membase",
705 + .flags = IORESOURCE_MEM
709 +static struct platform_device nand_slot0 = {
711 + .name = "rb500-nand",
712 + .resource = nand_slot0_res,
713 + .num_resources = ARRAY_SIZE(nand_slot0_res),
717 +static struct platform_device *rb500_devs[] = {
723 +static void __init parse_mac_addr(char* macstr)
726 + unsigned char result, value;
728 + for (i=0; i<6; i++) {
730 + if (i != 5 && *(macstr+2) != ':') {
733 + for (j=0; j<2; j++) {
734 + if (isxdigit(*macstr) && (value = isdigit(*macstr) ? *macstr-'0' :
735 + toupper(*macstr)-'A'+10) < 16) {
736 + result = result*16 + value;
743 + korina_dev0_data.mac[i] = result;
748 +/* DEVICE CONTROLLER 1 */
749 +#define CFG_DC_DEV1 (void*)0xb8010010
750 +#define CFG_DC_DEV2 (void*)0xb8010020
751 +#define CFG_DC_DEVBASE 0x0
752 +#define CFG_DC_DEVMASK 0x4
753 +#define CFG_DC_DEVC 0x8
754 +#define CFG_DC_DEVTC 0xC
757 +static int __init plat_setup_devices(void)
759 + /* Look for the CF card reader */
760 + if (!readl(CFG_DC_DEV1 + CFG_DC_DEVMASK))
761 + rb500_devs[1] = NULL;
763 + cf_slot0_res[0].start = readl(CFG_DC_DEV1 + CFG_DC_DEVBASE);
764 + cf_slot0_res[0].end = cf_slot0_res[0].start + 0x1000;
767 + /* There is always a NAND device */
768 + nand_slot0_res[0].start = readl( CFG_DC_DEV2 + CFG_DC_DEVBASE);
769 + nand_slot0_res[0].end = nand_slot0_res[0].start + 0x1000;
771 + return platform_add_devices(rb500_devs, ARRAY_SIZE(rb500_devs));
774 +static int __init setup_kmac(char *s)
776 + printk("korina mac = %s\n",s);
781 +__setup("kmac=", setup_kmac);
782 +arch_initcall(plat_setup_devices);
785 diff -urN linux.old/arch/mips/rb500/irq.c linux.dev/arch/mips/rb500/irq.c
786 --- linux.old/arch/mips/rb500/irq.c 1970-01-01 01:00:00.000000000 +0100
787 +++ linux.dev/arch/mips/rb500/irq.c 2006-12-14 04:14:16.000000000 +0100
790 + * BRIEF MODULE DESCRIPTION
791 + * RC32434 interrupt routines.
793 + * Copyright 2002 MontaVista Software Inc.
794 + * Author: MontaVista Software, Inc.
795 + * stevel@mvista.com or source@mvista.com
797 + * This program is free software; you can redistribute it and/or modify it
798 + * under the terms of the GNU General Public License as published by the
799 + * Free Software Foundation; either version 2 of the License, or (at your
800 + * option) any later version.
802 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
803 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
804 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
805 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
806 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
807 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
808 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
809 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
810 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
811 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
813 + * You should have received a copy of the GNU General Public License along
814 + * with this program; if not, write to the Free Software Foundation, Inc.,
815 + * 675 Mass Ave, Cambridge, MA 02139, USA.
818 +#include <linux/errno.h>
819 +#include <linux/init.h>
820 +#include <linux/kernel_stat.h>
821 +#include <linux/module.h>
822 +#include <linux/signal.h>
823 +#include <linux/sched.h>
824 +#include <linux/types.h>
825 +#include <linux/interrupt.h>
826 +#include <linux/ioport.h>
827 +#include <linux/timex.h>
828 +#include <linux/slab.h>
829 +#include <linux/random.h>
830 +#include <linux/delay.h>
832 +#include <asm/bitops.h>
833 +#include <asm/bootinfo.h>
835 +#include <asm/irq.h>
836 +#include <asm/time.h>
837 +#include <asm/mipsregs.h>
838 +#include <asm/system.h>
839 +#include <asm/rc32434/rc32434.h>
840 +#include <asm/rc32434/gpio.h>
842 +extern void set_debug_traps(void);
843 +extern irq_cpustat_t irq_stat [NR_CPUS];
844 +unsigned int local_bh_count[NR_CPUS];
845 +unsigned int local_irq_count[NR_CPUS];
847 +static unsigned int startup_irq(unsigned int irq);
848 +static void rb500_end_irq(unsigned int irq_nr);
849 +static void mask_and_ack_irq(unsigned int irq_nr);
850 +static void rb500_enable_irq(unsigned int irq_nr);
851 +static void rb500_disable_irq(unsigned int irq_nr);
853 +extern void __init init_generic_irq(void);
856 + u32 mask; /* mask of valid bits in pending/mask registers */
857 + volatile u32 *base_addr;
860 +#define RC32434_NR_IRQS (GROUP4_IRQ_BASE + 32)
862 +#if (NR_IRQS < RC32434_NR_IRQS)
863 +#error Too little irqs defined. Did you override <asm/irq.h> ?
866 +static const intr_group_t intr_group[NUM_INTR_GROUPS] = {
867 + { 0x0000efff, (u32 *)KSEG1ADDR(IC_GROUP0_PEND + 0 * IC_GROUP_OFFSET) },
868 + { 0x00001fff, (u32 *)KSEG1ADDR(IC_GROUP0_PEND + 1 * IC_GROUP_OFFSET) },
869 + { 0x00000007, (u32 *)KSEG1ADDR(IC_GROUP0_PEND + 2 * IC_GROUP_OFFSET) },
870 + { 0x0003ffff, (u32 *)KSEG1ADDR(IC_GROUP0_PEND + 3 * IC_GROUP_OFFSET) },
871 + { 0xffffffff, (u32 *)KSEG1ADDR(IC_GROUP0_PEND + 4 * IC_GROUP_OFFSET) }
874 +#define READ_PEND(base) (*(base))
875 +#define READ_MASK(base) (*(base + 2))
876 +#define WRITE_MASK(base, val) (*(base + 2) = (val))
878 +static inline int irq_to_group(unsigned int irq_nr)
880 + return ((irq_nr - GROUP0_IRQ_BASE) >> 5);
883 +static inline int group_to_ip(unsigned int group)
888 +static inline void enable_local_irq(unsigned int ip)
890 + int ipnum = 0x100 << ip;
891 + clear_c0_cause(ipnum);
892 + set_c0_status(ipnum);
895 +static inline void disable_local_irq(unsigned int ip)
897 + int ipnum = 0x100 << ip;
898 + clear_c0_status(ipnum);
901 +static inline void ack_local_irq(unsigned int ip)
903 + int ipnum = 0x100 << ip;
904 + clear_c0_cause(ipnum);
907 +static void rb500_enable_irq(unsigned int irq_nr)
909 + int ip = irq_nr - GROUP0_IRQ_BASE;
910 + unsigned int group, intr_bit;
911 + volatile unsigned int *addr;
915 + enable_local_irq(irq_nr);
920 + intr_bit = 1 << ip;
922 + enable_local_irq(group_to_ip(group));
924 + addr = intr_group[group].base_addr;
925 + WRITE_MASK(addr, READ_MASK(addr) & ~intr_bit);
929 +static void rb500_disable_irq(unsigned int irq_nr)
931 + int ip = irq_nr - GROUP0_IRQ_BASE;
932 + unsigned int group, intr_bit, mask;
933 + volatile unsigned int *addr;
936 + disable_local_irq(irq_nr);
941 + intr_bit = 1 << ip;
942 + addr = intr_group[group].base_addr;
943 + mask = READ_MASK(addr);
945 + WRITE_MASK(addr,mask);
948 + * if there are no more interrupts enabled in this
949 + * group, disable corresponding IP
951 + if (mask == intr_group[group].mask)
952 + disable_local_irq(group_to_ip(group));
956 +static unsigned int startup_irq(unsigned int irq_nr)
958 + rb500_enable_irq(irq_nr);
962 +static void shutdown_irq(unsigned int irq_nr)
964 + rb500_disable_irq(irq_nr);
968 +static void mask_and_ack_irq(unsigned int irq_nr)
970 + rb500_disable_irq(irq_nr);
971 + ack_local_irq(group_to_ip(irq_to_group(irq_nr)));
974 +static void rb500_end_irq(unsigned int irq_nr)
977 + int ip = irq_nr - GROUP0_IRQ_BASE;
978 + unsigned int intr_bit, group;
979 + volatile unsigned int *addr;
981 + if ((irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
982 + printk("warning: end_irq %d did not enable (%x)\n",
983 + irq_nr, irq_desc[irq_nr].status);
988 + enable_local_irq(irq_nr);
992 + ip &= (1 << 5) - 1;
993 + intr_bit = 1 << ip;
995 + if (irq_nr >= GROUP4_IRQ_BASE && irq_nr <= (GROUP4_IRQ_BASE + 13)) {
996 + gpio->gpioistat = gpio->gpioistat & ~intr_bit;
999 + enable_local_irq(group_to_ip(group));
1001 + addr = intr_group[group].base_addr;
1002 + WRITE_MASK(addr, READ_MASK(addr) & ~intr_bit);
1006 +static struct hw_interrupt_type rc32434_irq_type = {
1007 + .typename = "RB500",
1008 + .startup = startup_irq,
1009 + .shutdown = shutdown_irq,
1010 + .enable = rb500_enable_irq,
1011 + .disable = rb500_disable_irq,
1012 + .ack = mask_and_ack_irq,
1013 + .end = rb500_end_irq,
1017 +void __init arch_init_irq(void)
1021 + printk("Initializing IRQ's: %d out of %d\n", RC32434_NR_IRQS, NR_IRQS);
1022 + memset(irq_desc, 0, sizeof(irq_desc));
1024 + for (i = 0; i < RC32434_NR_IRQS; i++) {
1025 + irq_desc[i].status = IRQ_DISABLED;
1026 + irq_desc[i].action = NULL;
1027 + irq_desc[i].depth = 1;
1028 + irq_desc[i].chip = &rc32434_irq_type;
1029 + spin_lock_init(&irq_desc[i].lock);
1033 +/* Main Interrupt dispatcher */
1034 +asmlinkage void plat_irq_dispatch(void)
1036 + unsigned int ip, pend, group;
1037 + volatile unsigned int *addr;
1038 + unsigned int cp0_cause = read_c0_cause() & read_c0_status();
1040 + if (cp0_cause & CAUSEF_IP7) {
1041 + ll_timer_interrupt(7);
1042 + } else if ((ip = (cp0_cause & 0x7c00))) {
1043 + group = 21 - rc32434_clz(ip);
1045 + addr = intr_group[group].base_addr;
1047 + pend = READ_PEND(addr);
1048 + pend &= ~READ_MASK(addr); // only unmasked interrupts
1049 + pend = 39 - rc32434_clz(pend);
1050 + do_IRQ((group << 5) + pend);
1053 diff -urN linux.old/arch/mips/rb500/Makefile linux.dev/arch/mips/rb500/Makefile
1054 --- linux.old/arch/mips/rb500/Makefile 1970-01-01 01:00:00.000000000 +0100
1055 +++ linux.dev/arch/mips/rb500/Makefile 2006-12-14 04:09:50.000000000 +0100
1058 +# Makefile for the RB500 board specific parts of the kernel
1061 +obj-y += irq.o time.o setup.o serial.o prom.o misc.o devices.o
1062 diff -urN linux.old/arch/mips/rb500/misc.c linux.dev/arch/mips/rb500/misc.c
1063 --- linux.old/arch/mips/rb500/misc.c 1970-01-01 01:00:00.000000000 +0100
1064 +++ linux.dev/arch/mips/rb500/misc.c 2006-12-14 04:09:50.000000000 +0100
1066 +#include <linux/module.h>
1067 +#include <linux/kernel.h> /* printk() */
1068 +#include <linux/types.h> /* size_t */
1069 +#include <linux/pci.h>
1070 +#include <linux/spinlock.h>
1071 +#include <asm/rc32434/rb.h>
1073 +#define GPIO_BADDR 0xb8050000
1076 +static volatile unsigned char *devCtl3Base = 0;
1077 +static unsigned char latchU5State = 0;
1078 +static spinlock_t clu5Lock = SPIN_LOCK_UNLOCKED;
1080 +void set434Reg(unsigned regOffs, unsigned bit, unsigned len, unsigned val) {
1081 + unsigned flags, data;
1083 + spin_lock_irqsave(&clu5Lock, flags);
1084 + data = *(volatile unsigned *) (IDT434_REG_BASE + regOffs);
1085 + for (i = 0; i != len; ++i) {
1086 + if (val & (1 << i)) data |= (1 << (i + bit));
1087 + else data &= ~(1 << (i + bit));
1089 + *(volatile unsigned *) (IDT434_REG_BASE + regOffs) = data;
1090 + spin_unlock_irqrestore(&clu5Lock, flags);
1093 +void changeLatchU5(unsigned char orMask, unsigned char nandMask) {
1095 + spin_lock_irqsave(&clu5Lock, flags);
1096 + latchU5State = (latchU5State | orMask) & ~nandMask;
1097 + if( !devCtl3Base) devCtl3Base = (volatile unsigned char *)
1098 + KSEG1ADDR(*(volatile unsigned *) KSEG1ADDR(0x18010030));
1099 + *devCtl3Base = latchU5State;
1100 + spin_unlock_irqrestore(&clu5Lock, flags);
1103 +u32 gpio_get(gpio_func func)
1105 + return readl((void *) GPIO_BADDR + func);
1108 +void gpio_set(gpio_func func, u32 mask, u32 value)
1110 + u32 val = readl((void *) GPIO_BADDR + func);
1113 + val |= value & mask;
1115 + writel(val, (void *) GPIO_BADDR + func);
1118 +EXPORT_SYMBOL(gpio_set);
1119 +EXPORT_SYMBOL(gpio_get);
1120 +EXPORT_SYMBOL(set434Reg);
1121 +EXPORT_SYMBOL(changeLatchU5);
1122 diff -urN linux.old/arch/mips/rb500/prom.c linux.dev/arch/mips/rb500/prom.c
1123 --- linux.old/arch/mips/rb500/prom.c 1970-01-01 01:00:00.000000000 +0100
1124 +++ linux.dev/arch/mips/rb500/prom.c 2006-12-14 05:15:05.000000000 +0100
1128 +**********************************************************************
1129 +* P . Sadik Oct 10, 2003
1131 +* Started change log
1132 +* idt_cpu_freq is make a kernel configuration parameter
1133 +* idt_cpu_freq is exported so that other modules can use it.
1135 +**********************************************************************
1136 +* P. Sadik Oct 20, 2003
1138 +* Removed NVRAM code from here, since they are already available under
1140 +* Added serial port initialisation.
1141 +**********************************************************************
1142 +**********************************************************************
1143 +* P. Sadik Oct 30, 2003
1145 +* Added reset_cons_port
1146 +**********************************************************************
1148 + P.Christeas, 2005-2006
1149 + Port to 2.6, add 2.6 cmdline parsing
1153 +#include <linux/autoconf.h>
1154 +#include <linux/init.h>
1155 +#include <linux/mm.h>
1156 +#include <linux/module.h>
1157 +#include <linux/string.h>
1158 +#include <linux/console.h>
1159 +#include <asm/bootinfo.h>
1160 +#include <linux/bootmem.h>
1161 +#include <linux/ioport.h>
1162 +#include <linux/blkdev.h>
1163 +#include <asm/rc32434/ddr.h>
1165 +#define PROM_ENTRY(x) (0xbfc00000+((x)*8))
1166 +extern void __init setup_serial_port(void);
1168 +unsigned int idt_cpu_freq = 132000000;
1169 +EXPORT_SYMBOL(idt_cpu_freq);
1170 +unsigned int board_type = 500;
1171 +EXPORT_SYMBOL(board_type);
1172 +unsigned int gpio_bootup_state = 0;
1173 +EXPORT_SYMBOL(gpio_bootup_state);
1176 +char mips_mac_address[18] = "08:00:06:05:40:01";
1177 +EXPORT_SYMBOL(mips_mac_address);
1179 +/* what to append to cmdline when button is [not] pressed */
1180 +#define GPIO_INIT_NOBUTTON ""
1181 +#define GPIO_INIT_BUTTON " 2"
1183 +#ifdef CONFIG_MIKROTIK_RB500
1184 +unsigned soft_reboot = 0;
1185 +EXPORT_SYMBOL(soft_reboot);
1188 +#define SR_NMI 0x00180000 /* NMI */
1189 +#define SERIAL_SPEED_ENTRY 0x00000001
1191 +#ifdef CONFIG_REMOTE_DEBUG
1192 +extern int remote_debug;
1195 +extern unsigned long mips_machgroup;
1196 +extern unsigned long mips_machtype;
1198 +#define FREQ_TAG "HZ="
1199 +#define GPIO_TAG "gpio="
1200 +#define KMAC_TAG "kmac="
1201 +#define MEM_TAG "mem="
1202 +#define BOARD_TAG "board="
1203 +#define IGNORE_CMDLINE_MEM 1
1206 +void parse_soft_settings(unsigned *ptr, unsigned size);
1207 +void parse_hard_settings(unsigned *ptr, unsigned size);
1209 +void __init prom_setup_cmdline(void);
1211 +void __init prom_init(void)
1213 + DDR_t ddr = (DDR_t) DDR_VirtualAddress; /* define the pointer to the DDR registers */
1214 + phys_t memsize = 0-ddr->ddrmask;
1216 + /* this should be the very first message, even before serial is properly initialized */
1217 + prom_setup_cmdline();
1218 + setup_serial_port();
1220 + mips_machgroup = MACH_GROUP_MIKROTIK;
1221 + soft_reboot = read_c0_status() & SR_NMI;
1222 + pm_power_off = NULL;
1225 + * give all RAM to boot allocator,
1226 + * except for the first 0x400 and the last 0x200 bytes
1228 + add_memory_region(ddr->ddrbase + 0x400, memsize - 0x600, BOOT_MEM_RAM);
1231 +void prom_free_prom_memory(void)
1236 +void __init prom_setup_cmdline(void){
1237 + char cmd_line[CL_SIZE];
1240 + char **prom_argv, **prom_envp;
1243 + prom_argc = fw_arg0;
1244 + prom_argv = (char **) fw_arg1;
1245 + prom_envp = (char **) fw_arg2;
1248 + /* Note: it is common that parameters start at argv[1] and not argv[0],
1249 + however, our elf loader starts at [0] */
1250 + for(i=0;i<prom_argc;i++){
1251 + if (strncmp(prom_argv[i], FREQ_TAG, sizeof(FREQ_TAG) - 1) == 0) {
1252 + idt_cpu_freq = simple_strtoul(prom_argv[i] + sizeof(FREQ_TAG) - 1, 0, 10);
1255 +#ifdef IGNORE_CMDLINE_MEM
1256 + /* parses out the "mem=xx" arg */
1257 + if (strncmp(prom_argv[i], MEM_TAG, sizeof(MEM_TAG) - 1) == 0) {
1261 + if (i>0) *(cp++) = ' ';
1262 + if (strncmp(prom_argv[i], BOARD_TAG, sizeof(BOARD_TAG) - 1) == 0) {
1263 + board_type = simple_strtoul(prom_argv[i] + sizeof(BOARD_TAG) - 1, 0, 10);
1265 + if (strncmp(prom_argv[i], GPIO_TAG, sizeof(GPIO_TAG) - 1) == 0) {
1266 + gpio_bootup_state = simple_strtoul(prom_argv[i] + sizeof(GPIO_TAG) - 1, 0, 10);
1268 + strcpy(cp,prom_argv[i]);
1269 + cp+=strlen(prom_argv[i]);
1272 + i=strlen(arcs_cmdline);
1275 + strcpy(cp,arcs_cmdline);
1276 + cp+=strlen(arcs_cmdline);
1278 + if (gpio_bootup_state&0x02)
1279 + strcpy(cp,GPIO_INIT_NOBUTTON);
1281 + strcpy(cp,GPIO_INIT_BUTTON);
1282 + cmd_line[CL_SIZE-1] = '\0';
1284 + strcpy(arcs_cmdline,cmd_line);
1287 diff -urN linux.old/arch/mips/rb500/serial.c linux.dev/arch/mips/rb500/serial.c
1288 --- linux.old/arch/mips/rb500/serial.c 1970-01-01 01:00:00.000000000 +0100
1289 +++ linux.dev/arch/mips/rb500/serial.c 2006-12-14 04:09:50.000000000 +0100
1291 +/**************************************************************************
1293 + * BRIEF MODULE DESCRIPTION
1294 + * Serial port initialisation.
1296 + * Copyright 2004 IDT Inc. (rischelp@idt.com)
1298 + * This program is free software; you can redistribute it and/or modify it
1299 + * under the terms of the GNU General Public License as published by the
1300 + * Free Software Foundation; either version 2 of the License, or (at your
1301 + * option) any later version.
1303 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1304 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1305 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1306 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1307 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1308 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1309 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1310 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1311 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1312 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1314 + * You should have received a copy of the GNU General Public License along
1315 + * with this program; if not, write to the Free Software Foundation, Inc.,
1316 + * 675 Mass Ave, Cambridge, MA 02139, USA.
1319 + **************************************************************************
1320 + * May 2004 rkt, neb
1326 + **************************************************************************
1330 +#include <linux/autoconf.h>
1331 +#include <linux/init.h>
1332 +#include <linux/sched.h>
1333 +#include <linux/pci.h>
1334 +#include <linux/interrupt.h>
1335 +#include <linux/tty.h>
1336 +#include <linux/serial.h>
1337 +#include <linux/serial_core.h>
1339 +#include <asm/time.h>
1340 +#include <asm/cpu.h>
1341 +#include <asm/bootinfo.h>
1342 +#include <asm/irq.h>
1343 +#include <asm/serial.h>
1344 +#include <asm/rc32434/rc32434.h>
1346 +extern unsigned int idt_cpu_freq;
1348 +static struct uart_port serial_req = {
1349 + .type = PORT_16550A,
1351 + .irq = RC32434_UART0_IRQ,
1352 + .flags = STD_COM_FLAGS,
1353 + .iotype = UPIO_MEM,
1354 + .membase = (char *) KSEG1ADDR(RC32434_UART0_BASE),
1359 +int __init setup_serial_port(void)
1361 + serial_req.uartclk = idt_cpu_freq;
1363 + if (early_serial_setup(&serial_req))
1368 diff -urN linux.old/arch/mips/rb500/setup.c linux.dev/arch/mips/rb500/setup.c
1369 --- linux.old/arch/mips/rb500/setup.c 1970-01-01 01:00:00.000000000 +0100
1370 +++ linux.dev/arch/mips/rb500/setup.c 2006-12-14 04:51:12.000000000 +0100
1373 + * setup.c - boot time setup code
1376 +#include <linux/init.h>
1377 +#include <linux/mm.h>
1378 +#include <linux/sched.h>
1379 +#include <linux/irq.h>
1380 +#include <linux/ioport.h>
1381 +#include <linux/pm.h>
1382 +#include <asm/bootinfo.h>
1383 +#include <asm/mipsregs.h>
1384 +#include <asm/pgtable.h>
1385 +#include <asm/reboot.h>
1386 +#include <asm/addrspace.h> /* for KSEG1ADDR() */
1387 +#include <asm/time.h>
1388 +#include <asm/io.h>
1389 +#include <asm/rc32434/rc32434.h>
1390 +#include <asm/rc32434/pci.h>
1393 +extern void *rc32434_time_init(void);
1394 +extern int __init rc32434_pcibridge_init(void);
1397 +#define epldMask ((volatile unsigned char *)0xB900000d)
1399 +static void rb_machine_restart(char *command)
1401 + /* just jump to the reset vector */
1402 + * (volatile unsigned *) KSEG1ADDR(0x18008000) = 0x80000001;
1403 + ((void (*)(void))KSEG1ADDR(0x1FC00000u))();
1406 +static void rb_machine_halt(void)
1411 +#ifdef CONFIG_CPU_HAS_WB
1412 +void (*__wbflush) (void);
1414 +static void rb_write_buffer_flush(void)
1416 + __asm__ __volatile__
1417 + ("sync\n\t" "nop\n\t" "loop: bc0f loop\n\t" "nop\n\t");
1421 +void __init plat_mem_setup(void)
1423 + unsigned int pciCntlVal;
1425 + board_time_init = rc32434_time_init;
1427 +#ifdef CONFIG_CPU_HAS_WB
1428 + __wbflush = rb_write_buffer_flush;
1430 + _machine_restart = rb_machine_restart;
1431 + _machine_halt = rb_machine_halt;
1432 + /*_machine_power_off = rb_machine_power_halt;*/
1433 + pm_power_off = rb_machine_halt;
1435 + set_io_port_base(KSEG1);
1437 + pciCntlVal=rc32434_pci->pcic;
1438 + pciCntlVal &= 0xFFFFFF7;
1439 + rc32434_pci->pcic = pciCntlVal;
1442 + /* Enable PCI interrupts in EPLD Mask register */
1444 + *(epldMask + 1) = 0x0;
1446 + write_c0_wired(0);
1449 +const char *get_system_type(void)
1451 + return "MIPS RB500";
1453 diff -urN linux.old/arch/mips/rb500/time.c linux.dev/arch/mips/rb500/time.c
1454 --- linux.old/arch/mips/rb500/time.c 1970-01-01 01:00:00.000000000 +0100
1455 +++ linux.dev/arch/mips/rb500/time.c 2006-12-14 04:48:33.000000000 +0100
1458 +****************************************************************************
1459 +* Carsten Langgaard, carstenl@mips.com
1460 +* Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1462 +***************************************************************************
1464 +* This program is free software; you can distribute it and/or modify it
1465 +* under the terms of the GNU General Public License (Version 2) as
1466 +* published by the Free Software Foundation.
1468 +* This program is distributed in the hope it will be useful, but WITHOUT
1469 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1470 +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1471 +* for more details.
1473 +* You should have received a copy of the GNU General Public License along
1474 +* with this program; if not, write to the Free Software Foundation, Inc.,
1475 +* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1477 +****************************************************************************
1479 +* Setting up the clock on the MIPS boards.
1481 +****************************************************************************
1482 +* P. Sadik Oct 10, 2003
1484 +* Started change log.
1485 +* mips_counter_frequency is now calculated at run time, based on idt_cpu_freq.
1487 +****************************************************************************
1490 +#include <linux/autoconf.h>
1491 +#include <linux/init.h>
1492 +#include <linux/kernel_stat.h>
1493 +#include <linux/sched.h>
1494 +#include <linux/spinlock.h>
1495 +#include <linux/mc146818rtc.h>
1496 +#include <linux/irq.h>
1497 +#include <linux/timex.h>
1499 +#include <asm/mipsregs.h>
1500 +#include <asm/ptrace.h>
1501 +#include <asm/debug.h>
1502 +#include <asm/rc32434/rc32434.h>
1504 +static unsigned long r4k_offset; /* Amount to incr compare reg each time */
1505 +static unsigned long r4k_cur; /* What counter should be at next timer irq */
1506 +extern unsigned int mips_hpt_frequency;
1507 +extern unsigned int idt_cpu_freq;
1510 + * Figure out the r4k offset, the amount to increment the compare
1511 + * register for each time tick. There is no RTC available.
1513 + * The RC32434 counts at half the CPU *core* speed.
1515 +static unsigned long __init cal_r4koff(void)
1517 + mips_hpt_frequency = idt_cpu_freq * IDT_CLOCK_MULT / 2;
1518 + return (mips_hpt_frequency / HZ);
1522 +void __init rc32434_time_init(void)
1524 + unsigned int est_freq, flags;
1526 + local_irq_save(flags);
1528 + printk("calculating r4koff... ");
1529 + r4k_offset = cal_r4koff();
1530 + printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
1532 + est_freq = 2*r4k_offset*HZ;
1533 + est_freq += 5000; /* round */
1534 + est_freq -= est_freq%10000;
1535 + printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
1536 + (est_freq%1000000)*100/1000000);
1537 + local_irq_restore(flags);
1540 +void __init plat_timer_setup(struct irqaction *irq)
1542 + /* we are using the cpu counter for timer interrupts */
1543 + setup_irq(MIPS_CPU_TIMER_IRQ, irq);
1545 + /* to generate the first timer interrupt */
1546 + r4k_cur = (read_c0_count() + r4k_offset);
1547 + write_c0_compare(r4k_cur);
1550 diff -urN linux.old/drivers/pci/Makefile linux.dev/drivers/pci/Makefile
1551 --- linux.old/drivers/pci/Makefile 2006-11-29 22:57:37.000000000 +0100
1552 +++ linux.dev/drivers/pci/Makefile 2006-12-14 04:09:50.000000000 +0100
1555 # Build the PCI MSI interrupt support
1556 obj-$(CONFIG_PCI_MSI) += msi.o
1557 +obj-$(CONFIG_MIKROTIK_RB500) += setup-irq.o
1559 # Build the Hypertransport interrupt support
1560 obj-$(CONFIG_HT_IRQ) += htirq.o
1561 diff -urN linux.old/include/asm-mips/bootinfo.h linux.dev/include/asm-mips/bootinfo.h
1562 --- linux.old/include/asm-mips/bootinfo.h 2006-11-29 22:57:37.000000000 +0100
1563 +++ linux.dev/include/asm-mips/bootinfo.h 2006-12-14 04:09:50.000000000 +0100
1565 #define MACH_GROUP_NEC_EMMA2RH 25 /* NEC EMMA2RH (was 23) */
1566 #define MACH_NEC_MARKEINS 0 /* NEC EMMA2RH Mark-eins */
1568 +#define MACH_GROUP_MIKROTIK 24 /* Mikrotik Boards */
1570 #define CL_SIZE COMMAND_LINE_SIZE
1572 const char *get_system_type(void);
1573 diff -urN linux.old/include/asm-mips/cpu.h linux.dev/include/asm-mips/cpu.h
1574 --- linux.old/include/asm-mips/cpu.h 2006-11-29 22:57:37.000000000 +0100
1575 +++ linux.dev/include/asm-mips/cpu.h 2006-12-14 04:09:50.000000000 +0100
1579 #define CPU_R14000 64
1580 -#define CPU_LAST 64
1581 +#define CPU_RC32300 65
1582 +#define CPU_LAST 65
1585 * ISA Level encodings
1586 diff -urN linux.old/include/asm-mips/rc32434/ddr.h linux.dev/include/asm-mips/rc32434/ddr.h
1587 --- linux.old/include/asm-mips/rc32434/ddr.h 1970-01-01 01:00:00.000000000 +0100
1588 +++ linux.dev/include/asm-mips/rc32434/ddr.h 2006-12-14 04:09:50.000000000 +0100
1590 +#ifndef __IDT_DDR_H__
1591 +#define __IDT_DDR_H__
1593 +/*******************************************************************************
1595 + * Copyright 2002 Integrated Device Technology, Inc.
1596 + * All rights reserved.
1598 + * DDR register definition.
1600 + * File : $Id: ddr.h,v 1.2 2002/06/06 18:34:03 astichte Exp $
1602 + * Author : ryan.holmQVist@idt.com
1606 + * Revision 1.2 2002/06/06 18:34:03 astichte
1607 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
1609 + * Revision 1.1 2002/05/29 17:33:21 sysarch
1610 + * jba File moved from vcode/include/idt/acacia
1613 + ******************************************************************************/
1617 + DDR0_PhysicalAddress = 0x18018000,
1618 + DDR_PhysicalAddress = DDR0_PhysicalAddress, // Default
1620 + DDR0_VirtualAddress = 0xb8018000,
1621 + DDR_VirtualAddress = DDR0_VirtualAddress, // Default
1624 +typedef struct DDR_s
1637 +} volatile *DDR_t ;
1641 + DDR0BASE_baseaddr_b = 16,
1642 + DDR0BASE_baseaddr_m = 0xffff0000,
1644 + DDR0MASK_mask_b = 16,
1645 + DDR0MASK_mask_m = 0xffff0000,
1647 + DDR1BASE_baseaddr_b = 16,
1648 + DDR1BASE_baseaddr_m = 0xffff0000,
1650 + DDR1MASK_mask_b = 16,
1651 + DDR1MASK_mask_m = 0xffff0000,
1654 + DDRC_ata_m = 0x000000E0,
1656 + DDRC_dbw_m = 0x00000100,
1658 + DDRC_wr_m = 0x00000600,
1660 + DDRC_ps_m = 0x00001800,
1661 + DDRC_dtype_b = 13,
1662 + DDRC_dtype_m = 0x0000e000,
1664 + DDRC_rfc_m = 0x000f0000,
1666 + DDRC_rp_m = 0x00300000,
1668 + DDRC_ap_m = 0x00400000,
1670 + DDRC_rcd_m = 0x01800000,
1672 + DDRC_cl_m = 0x06000000,
1674 + DDRC_dbm_m = 0x08000000,
1676 + DDRC_sds_m = 0x10000000,
1678 + DDRC_atp_m = 0x60000000,
1680 + DDRC_re_m = 0x80000000,
1683 + DDRRDC_ces_m = 0x00000001,
1685 + DDRRDC_ace_m = 0x00000002,
1687 + DDRABASE_baseaddr_b = 16,
1688 + DDRABASE_baseaddr_m = 0xffff0000,
1690 + DDRAMASK_mask_b = 16,
1691 + DDRAMASK_mask_m = 0xffff0000,
1693 + DDRAMAP_map_b = 16,
1694 + DDRAMAP_map_m = 0xffff0000,
1697 + DDRCUST_cs_m = 0x00000003,
1699 + DDRCUST_we_m = 0x00000004,
1700 + DDRCUST_ras_b = 3,
1701 + DDRCUST_ras_m = 0x00000008,
1702 + DDRCUST_cas_b = 4,
1703 + DDRCUST_cas_m = 0x00000010,
1704 + DDRCUST_cke_b = 5,
1705 + DDRCUST_cke_m = 0x00000020,
1707 + DDRCUST_ba_m = 0x000000c0,
1709 + RCOUNT_rcount_b = 0,
1710 + RCOUNT_rcount_m = 0x0000ffff,
1712 + RCOMPARE_rcompare_b = 0,
1713 + RCOMPARE_rcompare_m = 0x0000ffff,
1716 + RTC_ce_m = 0x00000001,
1718 + RTC_to_m = 0x00000002,
1720 + RTC_rqe_m = 0x00000004,
1723 + DDRDQSC_dm_m = 0x00000003,
1724 + DDRDQSC_dqsbs_b = 2,
1725 + DDRDQSC_dqsbs_m = 0x000000fc,
1727 + DDRDQSC_db_m = 0x00000100,
1728 + DDRDQSC_dbsp_b = 9,
1729 + DDRDQSC_dbsp_m = 0x01fffe00,
1730 + DDRDQSC_bdp_b = 25,
1731 + DDRDQSC_bdp_m = 0x7e000000,
1733 + DDRDLLC_eao_b = 0,
1734 + DDRDLLC_eao_m = 0x00000001,
1736 + DDRDLLC_eo_m = 0x0000003e,
1738 + DDRDLLC_fs_m = 0x000000c0,
1740 + DDRDLLC_as_m = 0x00000700,
1741 + DDRDLLC_sp_b = 11,
1742 + DDRDLLC_sp_m = 0x001ff800,
1744 + DDRDLLFC_men_b = 0,
1745 + DDRDLLFC_men_m = 0x00000001,
1746 + DDRDLLFC_aen_b = 1,
1747 + DDRDLLFC_aen_m = 0x00000002,
1748 + DDRDLLFC_ff_b = 2,
1749 + DDRDLLFC_ff_m = 0x00000004,
1751 + DDRDLLTA_addr_b = 2,
1752 + DDRDLLTA_addr_m = 0xfffffffc,
1754 + DDRDLLED_dbe_b = 0,
1755 + DDRDLLED_dbe_m = 0x00000001,
1756 + DDRDLLED_dte_b = 1,
1757 + DDRDLLED_dte_m = 0x00000002,
1762 +#endif // __IDT_DDR_H__
1763 diff -urN linux.old/include/asm-mips/rc32434/dma.h linux.dev/include/asm-mips/rc32434/dma.h
1764 --- linux.old/include/asm-mips/rc32434/dma.h 1970-01-01 01:00:00.000000000 +0100
1765 +++ linux.dev/include/asm-mips/rc32434/dma.h 2006-12-14 04:09:50.000000000 +0100
1767 +#ifndef __IDT_DMA_H__
1768 +#define __IDT_DMA_H__
1770 +/*******************************************************************************
1772 + * Copyright 2002 Integrated Device Technology, Inc.
1773 + * All rights reserved.
1775 + * DMA register definition.
1777 + * File : $Id: dma.h,v 1.3 2002/06/06 18:34:03 astichte Exp $
1779 + * Author : ryan.holmQVist@idt.com
1783 + * Revision 1.3 2002/06/06 18:34:03 astichte
1784 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
1786 + * Revision 1.2 2002/06/05 18:30:46 astichte
1787 + * Removed IDTField
1789 + * Revision 1.1 2002/05/29 17:33:21 sysarch
1790 + * jba File moved from vcode/include/idt/acacia
1793 + ******************************************************************************/
1797 + DMA0_PhysicalAddress = 0x18040000,
1798 + DMA_PhysicalAddress = DMA0_PhysicalAddress, // Default
1800 + DMA0_VirtualAddress = 0xb8040000,
1801 + DMA_VirtualAddress = DMA0_VirtualAddress, // Default
1805 + * DMA descriptor (in physical memory).
1808 +typedef struct DMAD_s
1810 + u32 control ; // Control. use DMAD_*
1811 + u32 ca ; // Current Address.
1812 + u32 devcs ; // Device control and status.
1813 + u32 link ; // Next descriptor in chain.
1814 +} volatile *DMAD_t ;
1818 + DMAD_size = sizeof (struct DMAD_s),
1819 + DMAD_count_b = 0, // in DMAD_t -> control
1820 + DMAD_count_m = 0x0003ffff, // in DMAD_t -> control
1821 + DMAD_ds_b = 20, // in DMAD_t -> control
1822 + DMAD_ds_m = 0x00300000, // in DMAD_t -> control
1823 + DMAD_ds_ethRcv_v = 0,
1824 + DMAD_ds_ethXmt_v = 0,
1825 + DMAD_ds_memToFifo_v = 0,
1826 + DMAD_ds_fifoToMem_v = 0,
1827 + DMAD_ds_pciToMem_v = 0,
1828 + DMAD_ds_memToPci_v = 0,
1830 + DMAD_devcmd_b = 22, // in DMAD_t -> control
1831 + DMAD_devcmd_m = 0x01c00000, // in DMAD_t -> control
1832 + DMAD_devcmd_byte_v = 0, //memory-to-memory
1833 + DMAD_devcmd_halfword_v = 1, //memory-to-memory
1834 + DMAD_devcmd_word_v = 2, //memory-to-memory
1835 + DMAD_devcmd_2words_v = 3, //memory-to-memory
1836 + DMAD_devcmd_4words_v = 4, //memory-to-memory
1837 + DMAD_devcmd_6words_v = 5, //memory-to-memory
1838 + DMAD_devcmd_8words_v = 6, //memory-to-memory
1839 + DMAD_devcmd_16words_v = 7, //memory-to-memory
1840 + DMAD_cof_b = 25, // chain on finished
1841 + DMAD_cof_m = 0x02000000, //
1842 + DMAD_cod_b = 26, // chain on done
1843 + DMAD_cod_m = 0x04000000, //
1844 + DMAD_iof_b = 27, // interrupt on finished
1845 + DMAD_iof_m = 0x08000000, //
1846 + DMAD_iod_b = 28, // interrupt on done
1847 + DMAD_iod_m = 0x10000000, //
1848 + DMAD_t_b = 29, // terminated
1849 + DMAD_t_m = 0x20000000, //
1850 + DMAD_d_b = 30, // done
1851 + DMAD_d_m = 0x40000000, //
1852 + DMAD_f_b = 31, // finished
1853 + DMAD_f_m = 0x80000000, //
1857 + * DMA register (within Internal Register Map).
1862 + u32 dmac ; // Control.
1863 + u32 dmas ; // Status.
1864 + u32 dmasm ; // Mask.
1865 + u32 dmadptr ; // Descriptor pointer.
1866 + u32 dmandptr ; // Next descriptor pointer.
1869 +typedef struct DMA_Chan_s volatile *DMA_Chan_t ;
1871 +//DMA_Channels use DMACH_count instead
1875 + DMAC_run_b = 0, //
1876 + DMAC_run_m = 0x00000001, //
1877 + DMAC_dm_b = 1, // done mask
1878 + DMAC_dm_m = 0x00000002, //
1879 + DMAC_mode_b = 2, //
1880 + DMAC_mode_m = 0x0000000c, //
1881 + DMAC_mode_auto_v = 0,
1882 + DMAC_mode_burst_v = 1,
1883 + DMAC_mode_transfer_v = 2, //usually used
1884 + DMAC_mode_reserved_v = 3,
1886 + DMAC_a_m = 0x00000010, //
1888 + DMAS_f_b = 0, // finished (sticky)
1889 + DMAS_f_m = 0x00000001, //
1890 + DMAS_d_b = 1, // done (sticky)
1891 + DMAS_d_m = 0x00000002, //
1892 + DMAS_c_b = 2, // chain (sticky)
1893 + DMAS_c_m = 0x00000004, //
1894 + DMAS_e_b = 3, // error (sticky)
1895 + DMAS_e_m = 0x00000008, //
1896 + DMAS_h_b = 4, // halt (sticky)
1897 + DMAS_h_m = 0x00000010, //
1899 + DMASM_f_b = 0, // finished (1=mask)
1900 + DMASM_f_m = 0x00000001, //
1901 + DMASM_d_b = 1, // done (1=mask)
1902 + DMASM_d_m = 0x00000002, //
1903 + DMASM_c_b = 2, // chain (1=mask)
1904 + DMASM_c_m = 0x00000004, //
1905 + DMASM_e_b = 3, // error (1=mask)
1906 + DMASM_e_m = 0x00000008, //
1907 + DMASM_h_b = 4, // halt (1=mask)
1908 + DMASM_h_m = 0x00000010, //
1912 + * DMA channel definitions
1919 + DMACH_memToFifo = 2,
1920 + DMACH_fifoToMem = 3,
1921 + DMACH_pciToMem = 4,
1922 + DMACH_memToPci = 5,
1924 + DMACH_count //must be last
1928 +typedef struct DMAC_s
1930 + struct DMA_Chan_s ch [DMACH_count] ; //use ch[DMACH_]
1931 +} volatile *DMA_t ;
1933 +#endif // __IDT_DMA_H__
1935 diff -urN linux.old/include/asm-mips/rc32434/dma_v.h linux.dev/include/asm-mips/rc32434/dma_v.h
1936 --- linux.old/include/asm-mips/rc32434/dma_v.h 1970-01-01 01:00:00.000000000 +0100
1937 +++ linux.dev/include/asm-mips/rc32434/dma_v.h 2006-12-14 04:09:50.000000000 +0100
1939 +#ifndef __IDT_DMA_V_H__
1940 +#define __IDT_DMA_V_H__
1942 +/*******************************************************************************
1944 + * Copyright 2002 Integrated Device Technology, Inc.
1945 + * All rights reserved.
1947 + * DMA register definition.
1949 + * File : $Id: dma.h,v 1.3 2002/06/06 18:34:03 astichte Exp $
1951 + * Author : ryan.holmQVist@idt.com
1955 + * Revision 1.3 2002/06/06 18:34:03 astichte
1956 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
1958 + * Revision 1.2 2002/06/05 18:30:46 astichte
1959 + * Removed IDTField
1961 + * Revision 1.1 2002/05/29 17:33:21 sysarch
1962 + * jba File moved from vcode/include/idt/acacia
1965 + ******************************************************************************/
1966 +#include <asm/rc32434/dma.h>
1967 +#include <asm/rc32434/rc32434.h>
1968 +#define DMA_CHAN_OFFSET 0x14
1969 +#define IS_DMA_USED(X) (((X) & (DMAD_f_m | DMAD_d_m | DMAD_t_m)) != 0)
1970 +#define DMA_COUNT(count) \
1971 + ((count) & DMAD_count_m)
1973 +#define DMA_HALT_TIMEOUT 500
1976 +static inline int rc32434_halt_dma(DMA_Chan_t ch)
1979 + if (local_readl(&ch->dmac) & DMAC_run_m) {
1980 + local_writel(0, &ch->dmac);
1981 + for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
1982 + if (local_readl(&ch->dmas) & DMAS_h_m) {
1983 + local_writel(0, &ch->dmas);
1989 + return timeout ? 0 : 1;
1992 +static inline void rc32434_start_dma(DMA_Chan_t ch, u32 dma_addr)
1994 + local_writel(0, &ch->dmandptr);
1995 + local_writel(dma_addr, &ch->dmadptr);
1998 +static inline void rc32434_chain_dma(DMA_Chan_t ch, u32 dma_addr)
2000 + local_writel(dma_addr, &ch->dmandptr);
2003 +#endif // __IDT_DMA_V_H__
2011 diff -urN linux.old/include/asm-mips/rc32434/eth.h linux.dev/include/asm-mips/rc32434/eth.h
2012 --- linux.old/include/asm-mips/rc32434/eth.h 1970-01-01 01:00:00.000000000 +0100
2013 +++ linux.dev/include/asm-mips/rc32434/eth.h 2006-12-14 04:09:50.000000000 +0100
2015 +#ifndef __IDT_ETH_H__
2016 +#define __IDT_ETH_H__
2018 +/*******************************************************************************
2020 + * Copyright 2002 Integrated Device Technology, Inc.
2021 + * All rights reserved.
2023 + * Ethernet register definition.
2025 + * File : $Id: eth.h,v 1.3 2002/06/06 18:34:04 astichte Exp $
2027 + * Author : Allen.Stichter@idt.com
2031 + * Revision 1.3 2002/06/06 18:34:04 astichte
2032 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
2034 + * Revision 1.2 2002/06/05 18:19:46 astichte
2037 + * Revision 1.1 2002/05/29 17:33:22 sysarch
2038 + * jba File moved from vcode/include/idt/acacia
2040 + ******************************************************************************/
2044 + ETH0_PhysicalAddress = 0x18060000,
2045 + ETH_PhysicalAddress = ETH0_PhysicalAddress, // Default
2047 + ETH0_VirtualAddress = 0xb8060000,
2048 + ETH_VirtualAddress = ETH0_VirtualAddress, // Default
2058 + u32 ethu0 [4] ; // Reserved.
2061 + u32 eth_u1 [10] ; // Reserved.
2063 + u32 eth_u2 [42] ; // Reserved.
2078 + u32 eth_u9 [50] ; // Reserved.
2085 + u32 eth_u10 ; // Reserved.
2093 + u32 eth_u11 ; // Reserved.
2094 + u32 eth_u12 ; // Reserved.
2102 + ETHINTFC_en_b = 0,
2103 + ETHINTFC_en_m = 0x00000001,
2104 + ETHINTFC_its_b = 1,
2105 + ETHINTFC_its_m = 0x00000002,
2106 + ETHINTFC_rip_b = 2,
2107 + ETHINTFC_rip_m = 0x00000004,
2108 + ETHINTFC_jam_b = 3,
2109 + ETHINTFC_jam_m = 0x00000008,
2110 + ETHINTFC_ovr_b = 4,
2111 + ETHINTFC_ovr_m = 0x00000010,
2112 + ETHINTFC_und_b = 5,
2113 + ETHINTFC_und_m = 0x00000020,
2114 + ETHINTFC_iom_b = 6,
2115 + ETHINTFC_iom_m = 0x000000c0,
2117 + ETHFIFOTT_tth_b = 0,
2118 + ETHFIFOTT_tth_m = 0x0000007f,
2121 + ETHARC_pro_m = 0x00000001,
2123 + ETHARC_am_m = 0x00000002,
2125 + ETHARC_afm_m = 0x00000004,
2127 + ETHARC_ab_m = 0x00000008,
2129 + ETHSAL_byte5_b = 0,
2130 + ETHSAL_byte5_m = 0x000000ff,
2131 + ETHSAL_byte4_b = 8,
2132 + ETHSAL_byte4_m = 0x0000ff00,
2133 + ETHSAL_byte3_b = 16,
2134 + ETHSAL_byte3_m = 0x00ff0000,
2135 + ETHSAL_byte2_b = 24,
2136 + ETHSAL_byte2_m = 0xff000000,
2138 + ETHSAH_byte1_b = 0,
2139 + ETHSAH_byte1_m = 0x000000ff,
2140 + ETHSAH_byte0_b = 8,
2141 + ETHSAH_byte0_m = 0x0000ff00,
2144 + ETHGPF_ptv_m = 0x0000ffff,
2147 + ETHPFS_pfd_m = 0x00000001,
2149 + ETHCFSA0_cfsa4_b = 0,
2150 + ETHCFSA0_cfsa4_m = 0x000000ff,
2151 + ETHCFSA0_cfsa5_b = 8,
2152 + ETHCFSA0_cfsa5_m = 0x0000ff00,
2154 + ETHCFSA1_cfsa2_b = 0,
2155 + ETHCFSA1_cfsa2_m = 0x000000ff,
2156 + ETHCFSA1_cfsa3_b = 8,
2157 + ETHCFSA1_cfsa3_m = 0x0000ff00,
2159 + ETHCFSA2_cfsa0_b = 0,
2160 + ETHCFSA2_cfsa0_m = 0x000000ff,
2161 + ETHCFSA2_cfsa1_b = 8,
2162 + ETHCFSA2_cfsa1_m = 0x0000ff00,
2165 + ETHMAC1_re_m = 0x00000001,
2166 + ETHMAC1_paf_b = 1,
2167 + ETHMAC1_paf_m = 0x00000002,
2168 + ETHMAC1_rfc_b = 2,
2169 + ETHMAC1_rfc_m = 0x00000004,
2170 + ETHMAC1_tfc_b = 3,
2171 + ETHMAC1_tfc_m = 0x00000008,
2173 + ETHMAC1_lb_m = 0x00000010,
2174 + ETHMAC1_mr_b = 31,
2175 + ETHMAC1_mr_m = 0x80000000,
2178 + ETHMAC2_fd_m = 0x00000001,
2179 + ETHMAC2_flc_b = 1,
2180 + ETHMAC2_flc_m = 0x00000002,
2181 + ETHMAC2_hfe_b = 2,
2182 + ETHMAC2_hfe_m = 0x00000004,
2184 + ETHMAC2_dc_m = 0x00000008,
2185 + ETHMAC2_cen_b = 4,
2186 + ETHMAC2_cen_m = 0x00000010,
2188 + ETHMAC2_pe_m = 0x00000020,
2189 + ETHMAC2_vpe_b = 6,
2190 + ETHMAC2_vpe_m = 0x00000040,
2191 + ETHMAC2_ape_b = 7,
2192 + ETHMAC2_ape_m = 0x00000080,
2193 + ETHMAC2_ppe_b = 8,
2194 + ETHMAC2_ppe_m = 0x00000100,
2195 + ETHMAC2_lpe_b = 9,
2196 + ETHMAC2_lpe_m = 0x00000200,
2197 + ETHMAC2_nb_b = 12,
2198 + ETHMAC2_nb_m = 0x00001000,
2199 + ETHMAC2_bp_b = 13,
2200 + ETHMAC2_bp_m = 0x00002000,
2201 + ETHMAC2_ed_b = 14,
2202 + ETHMAC2_ed_m = 0x00004000,
2204 + ETHIPGT_ipgt_b = 0,
2205 + ETHIPGT_ipgt_m = 0x0000007f,
2207 + ETHIPGR_ipgr2_b = 0,
2208 + ETHIPGR_ipgr2_m = 0x0000007f,
2209 + ETHIPGR_ipgr1_b = 8,
2210 + ETHIPGR_ipgr1_m = 0x00007f00,
2212 + ETHCLRT_maxret_b = 0,
2213 + ETHCLRT_maxret_m = 0x0000000f,
2214 + ETHCLRT_colwin_b = 8,
2215 + ETHCLRT_colwin_m = 0x00003f00,
2217 + ETHMAXF_maxf_b = 0,
2218 + ETHMAXF_maxf_m = 0x0000ffff,
2220 + ETHMTEST_tb_b = 2,
2221 + ETHMTEST_tb_m = 0x00000004,
2224 + ETHMCP_div_m = 0x000000ff,
2226 + MIIMCFG_rsv_b = 0,
2227 + MIIMCFG_rsv_m = 0x0000000c,
2230 + MIIMCMD_rd_m = 0x00000001,
2231 + MIIMCMD_scn_b = 1,
2232 + MIIMCMD_scn_m = 0x00000002,
2234 + MIIMADDR_regaddr_b = 0,
2235 + MIIMADDR_regaddr_m = 0x0000001f,
2236 + MIIMADDR_phyaddr_b = 8,
2237 + MIIMADDR_phyaddr_m = 0x00001f00,
2239 + MIIMWTD_wdata_b = 0,
2240 + MIIMWTD_wdata_m = 0x0000ffff,
2242 + MIIMRDD_rdata_b = 0,
2243 + MIIMRDD_rdata_m = 0x0000ffff,
2245 + MIIMIND_bsy_b = 0,
2246 + MIIMIND_bsy_m = 0x00000001,
2247 + MIIMIND_scn_b = 1,
2248 + MIIMIND_scn_m = 0x00000002,
2250 + MIIMIND_nv_m = 0x00000004,
2255 + * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
2260 + ETHRX_fd_m = 0x00000001,
2262 + ETHRX_ld_m = 0x00000002,
2264 + ETHRX_rok_m = 0x00000004,
2266 + ETHRX_fm_m = 0x00000008,
2268 + ETHRX_mp_m = 0x00000010,
2270 + ETHRX_bp_m = 0x00000020,
2272 + ETHRX_vlt_m = 0x00000040,
2274 + ETHRX_cf_m = 0x00000080,
2276 + ETHRX_ovr_m = 0x00000100,
2278 + ETHRX_crc_m = 0x00000200,
2280 + ETHRX_cv_m = 0x00000400,
2282 + ETHRX_db_m = 0x00000800,
2284 + ETHRX_le_m = 0x00001000,
2286 + ETHRX_lor_m = 0x00002000,
2288 + ETHRX_ces_m = 0x00004000,
2289 + ETHRX_length_b = 16,
2290 + ETHRX_length_m = 0xffff0000,
2293 + ETHTX_fd_m = 0x00000001,
2295 + ETHTX_ld_m = 0x00000002,
2297 + ETHTX_oen_m = 0x00000004,
2299 + ETHTX_pen_m = 0x00000008,
2301 + ETHTX_cen_m = 0x00000010,
2303 + ETHTX_hen_m = 0x00000020,
2305 + ETHTX_tok_m = 0x00000040,
2307 + ETHTX_mp_m = 0x00000080,
2309 + ETHTX_bp_m = 0x00000100,
2311 + ETHTX_und_m = 0x00000200,
2313 + ETHTX_of_m = 0x00000400,
2315 + ETHTX_ed_m = 0x00000800,
2317 + ETHTX_ec_m = 0x00001000,
2319 + ETHTX_lc_m = 0x00002000,
2321 + ETHTX_td_m = 0x00004000,
2323 + ETHTX_crc_m = 0x00008000,
2325 + ETHTX_le_m = 0x00010000,
2327 + ETHTX_cc_m = 0x001E0000,
2330 +#endif // __IDT_ETH_H__
2335 diff -urN linux.old/include/asm-mips/rc32434/eth_v.h linux.dev/include/asm-mips/rc32434/eth_v.h
2336 --- linux.old/include/asm-mips/rc32434/eth_v.h 1970-01-01 01:00:00.000000000 +0100
2337 +++ linux.dev/include/asm-mips/rc32434/eth_v.h 2006-12-14 04:09:50.000000000 +0100
2339 +#ifndef __IDT_ETH_V_H__
2340 +#define __IDT_ETH_V_H__
2342 +/*******************************************************************************
2344 + * Copyright 2002 Integrated Device Technology, Inc.
2345 + * All rights reserved.
2347 + * Ethernet register definition.
2349 + * File : $Id: eth.h,v 1.3 2002/06/06 18:34:04 astichte Exp $
2351 + * Author : Allen.Stichter@idt.com
2355 + * Revision 1.3 2002/06/06 18:34:04 astichte
2356 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
2358 + * Revision 1.2 2002/06/05 18:19:46 astichte
2361 + * Revision 1.1 2002/05/29 17:33:22 sysarch
2362 + * jba File moved from vcode/include/idt/acacia
2364 + ******************************************************************************/
2366 +#include <asm/rc32434/eth.h>
2368 +#define IS_TX_TOK(X) (((X) & (1<<ETHTX_tok_b)) >> ETHTX_tok_b ) /* Transmit Okay */
2369 +#define IS_TX_MP(X) (((X) & (1<<ETHTX_mp_b)) >> ETHTX_mp_b ) /* Multicast */
2370 +#define IS_TX_BP(X) (((X) & (1<<ETHTX_bp_b)) >> ETHTX_bp_b ) /* Broadcast */
2371 +#define IS_TX_UND_ERR(X) (((X) & (1<<ETHTX_und_b)) >> ETHTX_und_b ) /* Transmit FIFO Underflow */
2372 +#define IS_TX_OF_ERR(X) (((X) & (1<<ETHTX_of_b)) >> ETHTX_of_b ) /* Oversized frame */
2373 +#define IS_TX_ED_ERR(X) (((X) & (1<<ETHTX_ed_b)) >> ETHTX_ed_b ) /* Excessive deferral */
2374 +#define IS_TX_EC_ERR(X) (((X) & (1<<ETHTX_ec_b)) >> ETHTX_ec_b) /* Excessive collisions */
2375 +#define IS_TX_LC_ERR(X) (((X) & (1<<ETHTX_lc_b)) >> ETHTX_lc_b ) /* Late Collision */
2376 +#define IS_TX_TD_ERR(X) (((X) & (1<<ETHTX_td_b)) >> ETHTX_td_b ) /* Transmit deferred*/
2377 +#define IS_TX_CRC_ERR(X) (((X) & (1<<ETHTX_crc_b)) >> ETHTX_crc_b ) /* CRC Error */
2378 +#define IS_TX_LE_ERR(X) (((X) & (1<<ETHTX_le_b)) >> ETHTX_le_b ) /* Length Error */
2380 +#define TX_COLLISION_COUNT(X) (((X) & ETHTX_cc_m)>>ETHTX_cc_b) /* Collision Count */
2382 +#define IS_RCV_ROK(X) (((X) & (1<<ETHRX_rok_b)) >> ETHRX_rok_b) /* Receive Okay */
2383 +#define IS_RCV_FM(X) (((X) & (1<<ETHRX_fm_b)) >> ETHRX_fm_b) /* Is Filter Match */
2384 +#define IS_RCV_MP(X) (((X) & (1<<ETHRX_mp_b)) >> ETHRX_mp_b) /* Is it MP */
2385 +#define IS_RCV_BP(X) (((X) & (1<<ETHRX_bp_b)) >> ETHRX_bp_b) /* Is it BP */
2386 +#define IS_RCV_VLT(X) (((X) & (1<<ETHRX_vlt_b)) >> ETHRX_vlt_b) /* VLAN Tag Detect */
2387 +#define IS_RCV_CF(X) (((X) & (1<<ETHRX_cf_b)) >> ETHRX_cf_b) /* Control Frame */
2388 +#define IS_RCV_OVR_ERR(X) (((X) & (1<<ETHRX_ovr_b)) >> ETHRX_ovr_b) /* Receive Overflow */
2389 +#define IS_RCV_CRC_ERR(X) (((X) & (1<<ETHRX_crc_b)) >> ETHRX_crc_b) /* CRC Error */
2390 +#define IS_RCV_CV_ERR(X) (((X) & (1<<ETHRX_cv_b)) >> ETHRX_cv_b) /* Code Violation */
2391 +#define IS_RCV_DB_ERR(X) (((X) & (1<<ETHRX_db_b)) >> ETHRX_db_b) /* Dribble Bits */
2392 +#define IS_RCV_LE_ERR(X) (((X) & (1<<ETHRX_le_b)) >> ETHRX_le_b) /* Length error */
2393 +#define IS_RCV_LOR_ERR(X) (((X) & (1<<ETHRX_lor_b)) >> ETHRX_lor_b) /* Length Out of Range */
2394 +#define IS_RCV_CES_ERR(X) (((X) & (1<<ETHRX_ces_b)) >> ETHRX_ces_b) /* Preamble error */
2395 +#define RCVPKT_LENGTH(X) (((X) & ETHRX_length_m) >> ETHRX_length_b) /* Length of the received packet */
2396 +#endif // __IDT_ETH_V_H__
2402 diff -urN linux.old/include/asm-mips/rc32434/gpio.h linux.dev/include/asm-mips/rc32434/gpio.h
2403 --- linux.old/include/asm-mips/rc32434/gpio.h 1970-01-01 01:00:00.000000000 +0100
2404 +++ linux.dev/include/asm-mips/rc32434/gpio.h 2006-12-14 04:09:50.000000000 +0100
2406 +#ifndef __IDT_GPIO_H__
2407 +#define __IDT_GPIO_H__
2409 +/*******************************************************************************
2411 + * Copyright 2002 Integrated Device Technology, Inc.
2412 + * All rights reserved.
2414 + * GPIO register definition.
2416 + * File : $Id: gpio.h,v 1.2 2002/06/06 18:34:04 astichte Exp $
2418 + * Author : ryan.holmQVist@idt.com
2421 + * $Log: gpio.h,v $
2422 + * Revision 1.2 2002/06/06 18:34:04 astichte
2423 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
2425 + * Revision 1.1 2002/05/29 17:33:22 sysarch
2426 + * jba File moved from vcode/include/idt/acacia
2429 + ******************************************************************************/
2433 + GPIO0_PhysicalAddress = 0x18050000,
2434 + GPIO_PhysicalAddress = GPIO0_PhysicalAddress, // Default
2436 + GPIO0_VirtualAddress = 0xb8050000,
2437 + GPIO_VirtualAddress = GPIO0_VirtualAddress, // Default
2442 + u32 gpiofunc; /* GPIO Function Register
2443 + * gpiofunc[x]==0 bit = gpio
2444 + * func[x]==1 bit = altfunc
2446 + u32 gpiocfg; /* GPIO Configuration Register
2447 + * gpiocfg[x]==0 bit = input
2448 + * gpiocfg[x]==1 bit = output
2450 + u32 gpiod; /* GPIO Data Register
2451 + * gpiod[x] read/write gpio pinX status
2453 + u32 gpioilevel; /* GPIO Interrupt Status Register
2454 + * interrupt level (see gpioistat)
2456 + u32 gpioistat; /* Gpio Interrupt Status Register
2457 + * istat[x] = (gpiod[x] == level[x])
2458 + * cleared in ISR (STICKY bits)
2460 + u32 gpionmien; /* GPIO Non-maskable Interrupt Enable Register */
2461 +} volatile * GPIO_t ;
2465 + GPIO_gpio_v = 0, // gpiofunc use pin as GPIO.
2466 + GPIO_alt_v = 1, // gpiofunc use pin as alt.
2467 + GPIO_input_v = 0, // gpiocfg use pin as input.
2468 + GPIO_output_v = 1, // gpiocfg use pin as output.
2470 + GPIO_pin0_m = 0x00000001,
2472 + GPIO_pin1_m = 0x00000002,
2474 + GPIO_pin2_m = 0x00000004,
2476 + GPIO_pin3_m = 0x00000008,
2478 + GPIO_pin4_m = 0x00000010,
2480 + GPIO_pin5_m = 0x00000020,
2482 + GPIO_pin6_m = 0x00000040,
2484 + GPIO_pin7_m = 0x00000080,
2486 + GPIO_pin8_m = 0x00000100,
2488 + GPIO_pin9_m = 0x00000200,
2489 + GPIO_pin10_b = 10,
2490 + GPIO_pin10_m = 0x00000400,
2491 + GPIO_pin11_b = 11,
2492 + GPIO_pin11_m = 0x00000800,
2493 + GPIO_pin12_b = 12,
2494 + GPIO_pin12_m = 0x00001000,
2495 + GPIO_pin13_b = 13,
2496 + GPIO_pin13_m = 0x00002000,
2497 + GPIO_pin14_b = 14,
2498 + GPIO_pin14_m = 0x00004000,
2499 + GPIO_pin15_b = 15,
2500 + GPIO_pin15_m = 0x00008000,
2501 + GPIO_pin16_b = 16,
2502 + GPIO_pin16_m = 0x00010000,
2503 + GPIO_pin17_b = 17,
2504 + GPIO_pin17_m = 0x00020000,
2505 + GPIO_pin18_b = 18,
2506 + GPIO_pin18_m = 0x00040000,
2507 + GPIO_pin19_b = 19,
2508 + GPIO_pin19_m = 0x00080000,
2509 + GPIO_pin20_b = 20,
2510 + GPIO_pin20_m = 0x00100000,
2511 + GPIO_pin21_b = 21,
2512 + GPIO_pin21_m = 0x00200000,
2513 + GPIO_pin22_b = 22,
2514 + GPIO_pin22_m = 0x00400000,
2515 + GPIO_pin23_b = 23,
2516 + GPIO_pin23_m = 0x00800000,
2517 + GPIO_pin24_b = 24,
2518 + GPIO_pin24_m = 0x01000000,
2519 + GPIO_pin25_b = 25,
2520 + GPIO_pin25_m = 0x02000000,
2521 + GPIO_pin26_b = 26,
2522 + GPIO_pin26_m = 0x04000000,
2523 + GPIO_pin27_b = 27,
2524 + GPIO_pin27_m = 0x08000000,
2525 + GPIO_pin28_b = 28,
2526 + GPIO_pin28_m = 0x10000000,
2527 + GPIO_pin29_b = 29,
2528 + GPIO_pin29_m = 0x20000000,
2529 + GPIO_pin30_b = 30,
2530 + GPIO_pin30_m = 0x40000000,
2531 + GPIO_pin31_b = 31,
2532 + GPIO_pin31_m = 0x80000000,
2534 +// Alternate function pins. Corrsponding gpiofunc bit set to GPIO_alt_v.
2536 + GPIO_u0sout_b = GPIO_pin0_b, // UART 0 serial out.
2537 + GPIO_u0sout_m = GPIO_pin0_m,
2538 + GPIO_u0sout_cfg_v = GPIO_output_v,
2539 + GPIO_u0sinp_b = GPIO_pin1_b, // UART 0 serial in.
2540 + GPIO_u0sinp_m = GPIO_pin1_m,
2541 + GPIO_u0sinp_cfg_v = GPIO_input_v,
2542 + GPIO_u0rtsn_b = GPIO_pin2_b, // UART 0 req. to send.
2543 + GPIO_u0rtsn_m = GPIO_pin2_m,
2544 + GPIO_u0rtsn_cfg_v = GPIO_output_v,
2545 + GPIO_u0ctsn_b = GPIO_pin3_b, // UART 0 clear to send.
2546 + GPIO_u0ctsn_m = GPIO_pin3_m,
2547 + GPIO_u0ctsn_cfg_v = GPIO_input_v,
2548 + GPIO_maddr22_b = GPIO_pin4_b, // M&P bus bit 22.
2549 + GPIO_maddr22_m = GPIO_pin4_m,
2550 + GPIO_maddr22_cfg_v = GPIO_output_v,
2552 + GPIO_maddr23_b = GPIO_pin5_b, // M&P bus bit 23.
2553 + GPIO_maddr23_m = GPIO_pin5_m,
2554 + GPIO_maddr23_cfg_v = GPIO_output_v,
2556 + GPIO_maddr24_b = GPIO_pin6_b, // M&P bus bit 24.
2557 + GPIO_maddr24_m = GPIO_pin6_m,
2558 + GPIO_maddr24_cfg_v = GPIO_output_v,
2560 + GPIO_maddr25_b = GPIO_pin7_b, // M&P bus bit 25.
2561 + GPIO_maddr25_m = GPIO_pin7_m,
2562 + GPIO_maddr25_cfg_v = GPIO_output_v,
2564 + GPIO_cpu_b = GPIO_pin8_b, // M&P bus bit 25.
2565 + GPIO_cpu_m = GPIO_pin8_m,
2566 + GPIO_cpu_cfg_v = GPIO_output_v,
2567 + GPIO_afspare6_b = GPIO_pin9_b, // reserved.
2568 + GPIO_afspare6_m = GPIO_pin9_m,
2569 + GPIO_afspare6_cfg_v = GPIO_input_v,
2570 + GPIO_afspare4_b = GPIO_pin10_b, // reserved.
2571 + GPIO_afspare4_m = GPIO_pin10_m,
2572 + GPIO_afspare4_cfg_v = GPIO_input_v,
2573 + GPIO_afspare3_b = GPIO_pin11_b, // reserved.
2574 + GPIO_afspare3_m = GPIO_pin11_m,
2575 + GPIO_afspare3_cfg_v = GPIO_input_v,
2576 + GPIO_afspare2_b = GPIO_pin12_b, // reserved.
2577 + GPIO_afspare2_m = GPIO_pin12_m,
2578 + GPIO_afspare2_cfg_v = GPIO_input_v,
2579 + GPIO_pcimuintn_b = GPIO_pin13_b, // PCI messaging int.
2580 + GPIO_pcimuintn_m = GPIO_pin13_m,
2581 + GPIO_pcimuintn_cfg_v = GPIO_output_v,
2585 +#endif // __IDT_GPIO_H__
2587 diff -urN linux.old/include/asm-mips/rc32434/irq.h linux.dev/include/asm-mips/rc32434/irq.h
2588 --- linux.old/include/asm-mips/rc32434/irq.h 1970-01-01 01:00:00.000000000 +0100
2589 +++ linux.dev/include/asm-mips/rc32434/irq.h 2006-12-14 04:09:50.000000000 +0100
2591 +#ifndef __ASM_MACH_MIPS_IRQ_H
2592 +#define __ASM_MACH_MIPS_IRQ_H
2594 +#include <linux/autoconf.h>
2596 +#define NR_IRQS 256
2598 +#endif /* __ASM_MACH_MIPS_IRQ_H */
2599 diff -urN linux.old/include/asm-mips/rc32434/pci.h linux.dev/include/asm-mips/rc32434/pci.h
2600 --- linux.old/include/asm-mips/rc32434/pci.h 1970-01-01 01:00:00.000000000 +0100
2601 +++ linux.dev/include/asm-mips/rc32434/pci.h 2006-12-14 04:09:50.000000000 +0100
2603 +/**************************************************************************
2605 + * BRIEF MODULE DESCRIPTION
2606 + * PCI register definitio
2608 + * Copyright 2004 IDT Inc. (rischelp@idt.com)
2610 + * This program is free software; you can redistribute it and/or modify it
2611 + * under the terms of the GNU General Public License as published by the
2612 + * Free Software Foundation; either version 2 of the License, or (at your
2613 + * option) any later version.
2615 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
2616 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2617 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
2618 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2619 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2620 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2621 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2622 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2623 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2624 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626 + * You should have received a copy of the GNU General Public License along
2627 + * with this program; if not, write to the Free Software Foundation, Inc.,
2628 + * 675 Mass Ave, Cambridge, MA 02139, USA.
2631 + **************************************************************************
2632 + * May 2004 rkt, neb.
2638 + **************************************************************************
2641 +#ifndef __IDT_PCI_H__
2642 +#define __IDT_PCI_H__
2646 + PCI0_PhysicalAddress = 0x18080000,
2647 + PCI_PhysicalAddress = PCI0_PhysicalAddress,
2649 + PCI0_VirtualAddress = 0xB8080000,
2650 + PCI_VirtualAddress = PCI0_VirtualAddress,
2655 + PCI_LbaCount = 4, // Local base addresses.
2660 + u32 a ; // Address.
2661 + u32 c ; // Control.
2662 + u32 m ; // mapping.
2672 + PCI_Map_s pcilba [PCI_LbaCount] ;
2680 +} volatile *PCI_t ;
2682 +// PCI messaging unit.
2689 + u32 pciim [PCIM_Count] ;
2690 + u32 pciom [PCIM_Count] ;
2697 +} volatile *PCIM_t ;
2699 +/*******************************************************************************
2701 + * PCI Control Register
2703 + ******************************************************************************/
2707 + PCIC_en_m = 0x00000001,
2709 + PCIC_tnr_m = 0x00000002,
2711 + PCIC_sce_m = 0x00000004,
2713 + PCIC_ien_m = 0x00000008,
2715 + PCIC_aaa_m = 0x00000010,
2717 + PCIC_eap_m = 0x00000020,
2719 + PCIC_pcim_m = 0x000001c0,
2720 + PCIC_pcim_disabled_v = 0,
2721 + PCIC_pcim_tnr_v = 1, // Satellite - target not ready
2722 + PCIC_pcim_suspend_v = 2, // Satellite - suspended CPU.
2723 + PCIC_pcim_extern_v = 3, // Host - external arbiter.
2724 + PCIC_pcim_fixed_v = 4, // Host - fixed priority arb.
2725 + PCIC_pcim_roundrobin_v = 5, // Host - round robin priority.
2726 + PCIC_pcim_reserved6_v = 6,
2727 + PCIC_pcim_reserved7_v = 7,
2729 + PCIC_igm_m = 0x00000200,
2732 +/*******************************************************************************
2734 + * PCI Status Register
2736 + ******************************************************************************/
2739 + PCIS_eed_m = 0x00000001,
2741 + PCIS_wr_m = 0x00000002,
2743 + PCIS_nmi_m = 0x00000004,
2745 + PCIS_ii_m = 0x00000008,
2747 + PCIS_cwe_m = 0x00000010,
2749 + PCIS_cre_m = 0x00000020,
2751 + PCIS_mdpe_m = 0x00000040,
2753 + PCIS_sta_m = 0x00000080,
2755 + PCIS_rta_m = 0x00000100,
2757 + PCIS_rma_m = 0x00000200,
2759 + PCIS_sse_m = 0x00000400,
2761 + PCIS_ose_m = 0x00000800,
2763 + PCIS_pe_m = 0x00001000,
2765 + PCIS_tae_m = 0x00002000,
2767 + PCIS_rle_m = 0x00004000,
2769 + PCIS_bme_m = 0x00008000,
2771 + PCIS_prd_m = 0x00010000,
2773 + PCIS_rip_m = 0x00020000,
2776 +/*******************************************************************************
2778 + * PCI Status Mask Register
2780 + ******************************************************************************/
2783 + PCISM_eed_m = 0x00000001,
2785 + PCISM_wr_m = 0x00000002,
2787 + PCISM_nmi_m = 0x00000004,
2789 + PCISM_ii_m = 0x00000008,
2791 + PCISM_cwe_m = 0x00000010,
2793 + PCISM_cre_m = 0x00000020,
2795 + PCISM_mdpe_m = 0x00000040,
2797 + PCISM_sta_m = 0x00000080,
2799 + PCISM_rta_m = 0x00000100,
2801 + PCISM_rma_m = 0x00000200,
2803 + PCISM_sse_m = 0x00000400,
2805 + PCISM_ose_m = 0x00000800,
2807 + PCISM_pe_m = 0x00001000,
2809 + PCISM_tae_m = 0x00002000,
2811 + PCISM_rle_m = 0x00004000,
2813 + PCISM_bme_m = 0x00008000,
2815 + PCISM_prd_m = 0x00010000,
2817 + PCISM_rip_m = 0x00020000,
2820 +/*******************************************************************************
2822 + * PCI Configuration Address Register
2824 + ******************************************************************************/
2826 + PCICFGA_reg_b = 2,
2827 + PCICFGA_reg_m = 0x000000fc,
2828 + PCICFGA_reg_id_v = 0x00>>2, //use PCFGID_
2829 + PCICFGA_reg_04_v = 0x04>>2, //use PCFG04_
2830 + PCICFGA_reg_08_v = 0x08>>2, //use PCFG08_
2831 + PCICFGA_reg_0C_v = 0x0C>>2, //use PCFG0C_
2832 + PCICFGA_reg_pba0_v = 0x10>>2, //use PCIPBA_
2833 + PCICFGA_reg_pba1_v = 0x14>>2, //use PCIPBA_
2834 + PCICFGA_reg_pba2_v = 0x18>>2, //use PCIPBA_
2835 + PCICFGA_reg_pba3_v = 0x1c>>2, //use PCIPBA_
2836 + PCICFGA_reg_subsystem_v = 0x2c>>2, //use PCFGSS_
2837 + PCICFGA_reg_3C_v = 0x3C>>2, //use PCFG3C_
2838 + PCICFGA_reg_pba0c_v = 0x44>>2, //use PCIPBAC_
2839 + PCICFGA_reg_pba0m_v = 0x48>>2,
2840 + PCICFGA_reg_pba1c_v = 0x4c>>2, //use PCIPBAC_
2841 + PCICFGA_reg_pba1m_v = 0x50>>2,
2842 + PCICFGA_reg_pba2c_v = 0x54>>2, //use PCIPBAC_
2843 + PCICFGA_reg_pba2m_v = 0x58>>2,
2844 + PCICFGA_reg_pba3c_v = 0x5c>>2, //use PCIPBAC_
2845 + PCICFGA_reg_pba3m_v = 0x60>>2,
2846 + PCICFGA_reg_pmgt_v = 0x64>>2,
2847 + PCICFGA_func_b = 8,
2848 + PCICFGA_func_m = 0x00000700,
2849 + PCICFGA_dev_b = 11,
2850 + PCICFGA_dev_m = 0x0000f800,
2851 + PCICFGA_dev_internal_v = 0,
2852 + PCICFGA_bus_b = 16,
2853 + PCICFGA_bus_m = 0x00ff0000,
2854 + PCICFGA_bus_type0_v = 0, //local bus
2855 + PCICFGA_en_b = 31, // read only
2856 + PCICFGA_en_m = 0x80000000,
2860 + PCFGID_vendor_b = 0,
2861 + PCFGID_vendor_m = 0x0000ffff,
2862 + PCFGID_vendor_IDT_v = 0x111d,
2863 + PCFGID_device_b = 16,
2864 + PCFGID_device_m = 0xffff0000,
2865 + PCFGID_device_Korinade_v = 0x0214,
2867 + PCFG04_command_ioena_b = 1,
2868 + PCFG04_command_ioena_m = 0x00000001,
2869 + PCFG04_command_memena_b = 2,
2870 + PCFG04_command_memena_m = 0x00000002,
2871 + PCFG04_command_bmena_b = 3,
2872 + PCFG04_command_bmena_m = 0x00000004,
2873 + PCFG04_command_mwinv_b = 5,
2874 + PCFG04_command_mwinv_m = 0x00000010,
2875 + PCFG04_command_parena_b = 7,
2876 + PCFG04_command_parena_m = 0x00000040,
2877 + PCFG04_command_serrena_b = 9,
2878 + PCFG04_command_serrena_m = 0x00000100,
2879 + PCFG04_command_fastbbena_b = 10,
2880 + PCFG04_command_fastbbena_m = 0x00000200,
2881 + PCFG04_status_b = 16,
2882 + PCFG04_status_m = 0xffff0000,
2883 + PCFG04_status_66MHz_b = 21, // 66 MHz enable
2884 + PCFG04_status_66MHz_m = 0x00200000,
2885 + PCFG04_status_fbb_b = 23,
2886 + PCFG04_status_fbb_m = 0x00800000,
2887 + PCFG04_status_mdpe_b = 24,
2888 + PCFG04_status_mdpe_m = 0x01000000,
2889 + PCFG04_status_dst_b = 25,
2890 + PCFG04_status_dst_m = 0x06000000,
2891 + PCFG04_status_sta_b = 27,
2892 + PCFG04_status_sta_m = 0x08000000,
2893 + PCFG04_status_rta_b = 28,
2894 + PCFG04_status_rta_m = 0x10000000,
2895 + PCFG04_status_rma_b = 29,
2896 + PCFG04_status_rma_m = 0x20000000,
2897 + PCFG04_status_sse_b = 30,
2898 + PCFG04_status_sse_m = 0x40000000,
2899 + PCFG04_status_pe_b = 31,
2900 + PCFG04_status_pe_m = 0x40000000,
2902 + PCFG08_revId_b = 0,
2903 + PCFG08_revId_m = 0x000000ff,
2904 + PCFG08_classCode_b = 0,
2905 + PCFG08_classCode_m = 0xffffff00,
2906 + PCFG08_classCode_bridge_v = 06,
2907 + PCFG08_classCode_proc_v = 0x0b3000, // processor-MIPS
2908 + PCFG0C_cacheline_b = 0,
2909 + PCFG0C_cacheline_m = 0x000000ff,
2910 + PCFG0C_masterLatency_b = 8,
2911 + PCFG0C_masterLatency_m = 0x0000ff00,
2912 + PCFG0C_headerType_b = 16,
2913 + PCFG0C_headerType_m = 0x00ff0000,
2914 + PCFG0C_bist_b = 24,
2915 + PCFG0C_bist_m = 0xff000000,
2918 + PCIPBA_msi_m = 0x00000001,
2920 + PCIPBA_p_m = 0x00000004,
2921 + PCIPBA_baddr_b = 8,
2922 + PCIPBA_baddr_m = 0xffffff00,
2924 + PCFGSS_vendorId_b = 0,
2925 + PCFGSS_vendorId_m = 0x0000ffff,
2927 + PCFGSS_id_m = 0xffff0000,
2929 + PCFG3C_interruptLine_b = 0,
2930 + PCFG3C_interruptLine_m = 0x000000ff,
2931 + PCFG3C_interruptPin_b = 8,
2932 + PCFG3C_interruptPin_m = 0x0000ff00,
2933 + PCFG3C_minGrant_b = 16,
2934 + PCFG3C_minGrant_m = 0x00ff0000,
2935 + PCFG3C_maxLat_b = 24,
2936 + PCFG3C_maxLat_m = 0xff000000,
2938 + PCIPBAC_msi_b = 0,
2939 + PCIPBAC_msi_m = 0x00000001,
2941 + PCIPBAC_p_m = 0x00000002,
2942 + PCIPBAC_size_b = 2,
2943 + PCIPBAC_size_m = 0x0000007c,
2945 + PCIPBAC_sb_m = 0x00000080,
2947 + PCIPBAC_pp_m = 0x00000100,
2949 + PCIPBAC_mr_m = 0x00000600,
2950 + PCIPBAC_mr_read_v =0, //no prefetching
2951 + PCIPBAC_mr_readLine_v =1,
2952 + PCIPBAC_mr_readMult_v =2,
2953 + PCIPBAC_mrl_b = 11,
2954 + PCIPBAC_mrl_m = 0x00000800,
2955 + PCIPBAC_mrm_b = 12,
2956 + PCIPBAC_mrm_m = 0x00001000,
2957 + PCIPBAC_trp_b = 13,
2958 + PCIPBAC_trp_m = 0x00002000,
2960 + PCFG40_trdyTimeout_b = 0,
2961 + PCFG40_trdyTimeout_m = 0x000000ff,
2962 + PCFG40_retryLim_b = 8,
2963 + PCFG40_retryLim_m = 0x0000ff00,
2966 +/*******************************************************************************
2968 + * PCI Local Base Address [0|1|2|3] Register
2970 + ******************************************************************************/
2972 + PCILBA_baddr_b = 0, // In PCI_t -> pcilba [] .a
2973 + PCILBA_baddr_m = 0xffffff00,
2975 +/*******************************************************************************
2977 + * PCI Local Base Address Control Register
2979 + ******************************************************************************/
2981 + PCILBAC_msi_b = 0, // In pPci->pcilba[i].c
2982 + PCILBAC_msi_m = 0x00000001,
2983 + PCILBAC_msi_mem_v = 0,
2984 + PCILBAC_msi_io_v = 1,
2985 + PCILBAC_size_b = 2, // In pPci->pcilba[i].c
2986 + PCILBAC_size_m = 0x0000007c,
2987 + PCILBAC_sb_b = 7, // In pPci->pcilba[i].c
2988 + PCILBAC_sb_m = 0x00000080,
2989 + PCILBAC_rt_b = 8, // In pPci->pcilba[i].c
2990 + PCILBAC_rt_m = 0x00000100,
2991 + PCILBAC_rt_noprefetch_v = 0, // mem read
2992 + PCILBAC_rt_prefetch_v = 1, // mem readline
2995 +/*******************************************************************************
2997 + * PCI Local Base Address [0|1|2|3] Mapping Register
2999 + ******************************************************************************/
3001 + PCILBAM_maddr_b = 8,
3002 + PCILBAM_maddr_m = 0xffffff00,
3005 +/*******************************************************************************
3007 + * PCI Decoupled Access Control Register
3009 + ******************************************************************************/
3012 + PCIDAC_den_m = 0x00000001,
3015 +/*******************************************************************************
3017 + * PCI Decoupled Access Status Register
3019 + ******************************************************************************/
3022 + PCIDAS_d_m = 0x00000001,
3024 + PCIDAS_b_m = 0x00000002,
3026 + PCIDAS_e_m = 0x00000004,
3028 + PCIDAS_ofe_m = 0x00000008,
3030 + PCIDAS_off_m = 0x00000010,
3032 + PCIDAS_ife_m = 0x00000020,
3034 + PCIDAS_iff_m = 0x00000040,
3037 +/*******************************************************************************
3039 + * PCI DMA Channel 8 Configuration Register
3041 + ******************************************************************************/
3044 + PCIDMA8C_mbs_b = 0, // Maximum Burst Size.
3045 + PCIDMA8C_mbs_m = 0x00000fff, // { pcidma8c }
3046 + PCIDMA8C_our_b = 12, // Optimize Unaligned Burst Reads.
3047 + PCIDMA8C_our_m = 0x00001000, // { pcidma8c }
3050 +/*******************************************************************************
3052 + * PCI DMA Channel 9 Configuration Register
3054 + ******************************************************************************/
3057 + PCIDMA9C_mbs_b = 0, // Maximum Burst Size.
3058 + PCIDMA9C_mbs_m = 0x00000fff, // { pcidma9c }
3061 +/*******************************************************************************
3063 + * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors
3065 + ******************************************************************************/
3067 + PCIDMAD_pt_b = 22, // in DEVCMD field (descriptor)
3068 + PCIDMAD_pt_m = 0x00c00000, // preferred transaction field
3069 + // These are for reads (DMA channel 8)
3070 + PCIDMAD_devcmd_mr_v = 0, //memory read
3071 + PCIDMAD_devcmd_mrl_v = 1, //memory read line
3072 + PCIDMAD_devcmd_mrm_v = 2, //memory read multiple
3073 + PCIDMAD_devcmd_ior_v = 3, //I/O read
3074 + // These are for writes (DMA channel 9)
3075 + PCIDMAD_devcmd_mw_v = 0, //memory write
3076 + PCIDMAD_devcmd_mwi_v = 1, //memory write invalidate
3077 + PCIDMAD_devcmd_iow_v = 3, //I/O write
3079 + // Swap byte field applies to both DMA channel 8 and 9
3080 + PCIDMAD_sb_b = 24, // in DEVCMD field (descriptor)
3081 + PCIDMAD_sb_m = 0x01000000, // swap byte field
3085 +/*******************************************************************************
3087 + * PCI Target Control Register
3089 + ******************************************************************************/
3092 + PCITC_rtimer_b = 0, // In PCITC_t -> pcitc
3093 + PCITC_rtimer_m = 0x000000ff,
3094 + PCITC_dtimer_b = 8, // In PCITC_t -> pcitc
3095 + PCITC_dtimer_m = 0x0000ff00,
3096 + PCITC_rdr_b = 18, // In PCITC_t -> pcitc
3097 + PCITC_rdr_m = 0x00040000,
3098 + PCITC_ddt_b = 19, // In PCITC_t -> pcitc
3099 + PCITC_ddt_m = 0x00080000,
3101 +/*******************************************************************************
3103 + * PCI messaging unit [applies to both inbound and outbound registers ]
3105 + ******************************************************************************/
3108 + PCIM_m0_b = 0, // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
3109 + PCIM_m0_m = 0x00000001, // inbound or outbound message 0
3110 + PCIM_m1_b = 1, // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
3111 + PCIM_m1_m = 0x00000002, // inbound or outbound message 1
3112 + PCIM_db_b = 2, // In PCIM_t -> {pci{iic,iim,ioic,ioim}}
3113 + PCIM_db_m = 0x00000004, // inbound or outbound doorbell
3121 +#define PCI_MSG_VirtualAddress 0xB8088010
3122 +#define rc32434_pci ((volatile PCI_t) PCI0_VirtualAddress)
3123 +#define rc32434_pci_msg ((volatile PCIM_t) PCI_MSG_VirtualAddress)
3125 +#define PCIM_SHFT 0x6
3126 +#define PCIM_BIT_LEN 0x7
3127 +#define PCIM_H_EA 0x3
3128 +#define PCIM_H_IA_FIX 0x4
3129 +#define PCIM_H_IA_RR 0x5
3131 +#define PCI_ADDR_START 0x50000000
3133 +#define CPUTOPCI_MEM_WIN 0x02000000
3134 +#define CPUTOPCI_IO_WIN 0x00100000
3135 +#define PCILBA_SIZE_SHFT 2
3136 +#define PCILBA_SIZE_MASK 0x1F
3137 +#define SIZE_256MB 0x1C
3138 +#define SIZE_128MB 0x1B
3139 +#define SIZE_64MB 0x1A
3140 +#define SIZE_32MB 0x19
3141 +#define SIZE_16MB 0x18
3142 +#define SIZE_4MB 0x16
3143 +#define SIZE_2MB 0x15
3144 +#define SIZE_1MB 0x14
3145 +#define KORINA_CONFIG0_ADDR 0x80000000
3146 +#define KORINA_CONFIG1_ADDR 0x80000004
3147 +#define KORINA_CONFIG2_ADDR 0x80000008
3148 +#define KORINA_CONFIG3_ADDR 0x8000000C
3149 +#define KORINA_CONFIG4_ADDR 0x80000010
3150 +#define KORINA_CONFIG5_ADDR 0x80000014
3151 +#define KORINA_CONFIG6_ADDR 0x80000018
3152 +#define KORINA_CONFIG7_ADDR 0x8000001C
3153 +#define KORINA_CONFIG8_ADDR 0x80000020
3154 +#define KORINA_CONFIG9_ADDR 0x80000024
3155 +#define KORINA_CONFIG10_ADDR 0x80000028
3156 +#define KORINA_CONFIG11_ADDR 0x8000002C
3157 +#define KORINA_CONFIG12_ADDR 0x80000030
3158 +#define KORINA_CONFIG13_ADDR 0x80000034
3159 +#define KORINA_CONFIG14_ADDR 0x80000038
3160 +#define KORINA_CONFIG15_ADDR 0x8000003C
3161 +#define KORINA_CONFIG16_ADDR 0x80000040
3162 +#define KORINA_CONFIG17_ADDR 0x80000044
3163 +#define KORINA_CONFIG18_ADDR 0x80000048
3164 +#define KORINA_CONFIG19_ADDR 0x8000004C
3165 +#define KORINA_CONFIG20_ADDR 0x80000050
3166 +#define KORINA_CONFIG21_ADDR 0x80000054
3167 +#define KORINA_CONFIG22_ADDR 0x80000058
3168 +#define KORINA_CONFIG23_ADDR 0x8000005C
3169 +#define KORINA_CONFIG24_ADDR 0x80000060
3170 +#define KORINA_CONFIG25_ADDR 0x80000064
3171 +#define KORINA_CMD (PCFG04_command_ioena_m | \
3172 + PCFG04_command_memena_m | \
3173 + PCFG04_command_bmena_m | \
3174 + PCFG04_command_mwinv_m | \
3175 + PCFG04_command_parena_m | \
3176 + PCFG04_command_serrena_m )
3178 +#define KORINA_STAT (PCFG04_status_mdpe_m | \
3179 + PCFG04_status_sta_m | \
3180 + PCFG04_status_rta_m | \
3181 + PCFG04_status_rma_m | \
3182 + PCFG04_status_sse_m | \
3183 + PCFG04_status_pe_m)
3185 +#define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD)
3187 +#define KORINA_REVID 0
3188 +#define KORINA_CLASS_CODE 0
3189 +#define KORINA_CNFG2 ((KORINA_CLASS_CODE<<8) | \
3192 +#define KORINA_CACHE_LINE_SIZE 4
3193 +#define KORINA_MASTER_LAT 0x3c
3194 +#define KORINA_HEADER_TYPE 0
3195 +#define KORINA_BIST 0
3197 +#define KORINA_CNFG3 ((KORINA_BIST << 24) | \
3198 + (KORINA_HEADER_TYPE<<16) | \
3199 + (KORINA_MASTER_LAT<<8) | \
3200 + KORINA_CACHE_LINE_SIZE )
3202 +#define KORINA_BAR0 0x00000008 /* 128 MB Memory */
3203 +#define KORINA_BAR1 0x18800001 /* 1 MB IO */
3204 +#define KORINA_BAR2 0x18000001 /* 2 MB IO window for Korina
3205 + internal Registers */
3206 +#define KORINA_BAR3 0x48000008 /* Spare 128 MB Memory */
3208 +#define KORINA_CNFG4 KORINA_BAR0
3209 +#define KORINA_CNFG5 KORINA_BAR1
3210 +#define KORINA_CNFG6 KORINA_BAR2
3211 +#define KORINA_CNFG7 KORINA_BAR3
3213 +#define KORINA_SUBSYS_VENDOR_ID 0x011d
3214 +#define KORINA_SUBSYSTEM_ID 0x0214
3215 +#define KORINA_CNFG8 0
3216 +#define KORINA_CNFG9 0
3217 +#define KORINA_CNFG10 0
3218 +#define KORINA_CNFG11 ((KORINA_SUBSYS_VENDOR_ID<<16) | \
3219 + KORINA_SUBSYSTEM_ID)
3220 +#define KORINA_INT_LINE 1
3221 +#define KORINA_INT_PIN 1
3222 +#define KORINA_MIN_GNT 8
3223 +#define KORINA_MAX_LAT 0x38
3224 +#define KORINA_CNFG12 0
3225 +#define KORINA_CNFG13 0
3226 +#define KORINA_CNFG14 0
3227 +#define KORINA_CNFG15 ((KORINA_MAX_LAT<<24) | \
3228 + (KORINA_MIN_GNT<<16) | \
3229 + (KORINA_INT_PIN<<8) | \
3231 +#define KORINA_RETRY_LIMIT 0x80
3232 +#define KORINA_TRDY_LIMIT 0x80
3233 +#define KORINA_CNFG16 ((KORINA_RETRY_LIMIT<<8) | \
3234 + KORINA_TRDY_LIMIT)
3235 +#define PCI_PBAxC_R 0x0
3236 +#define PCI_PBAxC_RL 0x1
3237 +#define PCI_PBAxC_RM 0x2
3238 +#define SIZE_SHFT 2
3240 +#if defined(__MIPSEB__)
3241 +#define KORINA_PBA0C ( PCIPBAC_mrl_m | PCIPBAC_sb_m | \
3242 + ((PCI_PBAxC_RM &0x3) << PCIPBAC_mr_b) | \
3244 + (SIZE_128MB<<SIZE_SHFT) | \
3247 +#define KORINA_PBA0C ( PCIPBAC_mrl_m | \
3248 + ((PCI_PBAxC_RM &0x3) << PCIPBAC_mr_b) | \
3250 + (SIZE_128MB<<SIZE_SHFT) | \
3253 +#define KORINA_CNFG17 KORINA_PBA0C
3254 +#define KORINA_PBA0M 0x0
3255 +#define KORINA_CNFG18 KORINA_PBA0M
3257 +#if defined(__MIPSEB__)
3258 +#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | PCIPBAC_sb_m | \
3261 +#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | \
3264 +#define KORINA_CNFG19 KORINA_PBA1C
3265 +#define KORINA_PBA1M 0x0
3266 +#define KORINA_CNFG20 KORINA_PBA1M
3268 +#if defined(__MIPSEB__)
3269 +#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | PCIPBAC_sb_m | \
3272 +#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | \
3275 +#define KORINA_CNFG21 KORINA_PBA2C
3276 +#define KORINA_PBA2M 0x18000000
3277 +#define KORINA_CNFG22 KORINA_PBA2M
3278 +#define KORINA_PBA3C 0
3279 +#define KORINA_CNFG23 KORINA_PBA3C
3280 +#define KORINA_PBA3M 0
3281 +#define KORINA_CNFG24 KORINA_PBA3M
3285 +#define PCITC_DTIMER_VAL 8
3286 +#define PCITC_RTIMER_VAL 0x10
3291 +#endif // __IDT_PCI_H__
3295 diff -urN linux.old/include/asm-mips/rc32434/rb.h linux.dev/include/asm-mips/rc32434/rb.h
3296 --- linux.old/include/asm-mips/rc32434/rb.h 1970-01-01 01:00:00.000000000 +0100
3297 +++ linux.dev/include/asm-mips/rc32434/rb.h 2006-12-14 04:09:50.000000000 +0100
3300 + * Copyright (C) 2004 IDT Inc.
3301 + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
3303 + * This program is free software; you can redistribute it and/or modify
3304 + * it under the terms of the GNU General Public License as published by
3305 + * the Free Software Foundation; either version 2 of the License, or
3306 + * (at your option) any later version.
3308 + * This program is distributed in the hope that it will be useful,
3309 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3310 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3311 + * GNU General Public License for more details.
3314 +#ifndef __MIPS_RB_H__
3315 +#define __MIPS_RB_H__
3316 +#include <linux/genhd.h>
3318 +#define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(0x18000000))
3319 +#define DEV0BASE 0x010000
3320 +#define DEV0MASK 0x010004
3321 +#define DEV0C 0x010008
3322 +#define DEV0TC 0x01000C
3323 +#define DEV1BASE 0x010010
3324 +#define DEV1MASK 0x010014
3325 +#define DEV1C 0x010018
3326 +#define DEV1TC 0x01001C
3327 +#define DEV2BASE 0x010020
3328 +#define DEV2MASK 0x010024
3329 +#define DEV2C 0x010028
3330 +#define DEV2TC 0x01002C
3331 +#define DEV3BASE 0x010030
3332 +#define DEV3MASK 0x010034
3333 +#define DEV3C 0x010038
3334 +#define DEV3TC 0x01003C
3335 +#define BTCS 0x010040
3336 +#define BTCOMPARE 0x010044
3337 +#define GPIOFUNC 0x050000
3338 +#define GPIOCFG 0x050004
3339 +#define GPIOD 0x050008
3340 +#define GPIOILEVEL 0x05000C
3341 +#define GPIOISTAT 0x050010
3342 +#define GPIONMIEN 0x050014
3343 +#define IMASK6 0x038038
3345 +#define LO_WPX (1 << 0)
3346 +#define LO_ALE (1 << 1)
3347 +#define LO_CLE (1 << 2)
3348 +#define LO_CEX (1 << 3)
3349 +#define LO_FOFF (1 << 5)
3350 +#define LO_SPICS (1 << 6)
3351 +#define LO_ULED (1 << 7)
3362 +extern void changeLatchU5(unsigned char orMask, unsigned char nandMask);
3363 +extern unsigned get434Reg(unsigned regOffs);
3364 +extern void set434Reg(unsigned regOffs, unsigned bit, unsigned len, unsigned val);
3365 +extern void gpio_set(gpio_func func, u32 mask, u32 value);
3366 +extern u32 gpio_get(gpio_func func);
3368 +#define get434Reg(x) (*(volatile unsigned *) (IDT434_REG_BASE + (x)))
3370 +struct korina_device {
3372 + unsigned char mac[6];
3373 + struct net_device *dev;
3379 + struct gendisk *gd;
3383 diff -urN linux.old/include/asm-mips/rc32434/rc32434.h linux.dev/include/asm-mips/rc32434/rc32434.h
3384 --- linux.old/include/asm-mips/rc32434/rc32434.h 1970-01-01 01:00:00.000000000 +0100
3385 +++ linux.dev/include/asm-mips/rc32434/rc32434.h 2006-12-14 04:09:50.000000000 +0100
3388 + ***************************************************************************
3389 + * Definitions for IDT RC323434 CPU.
3391 + ****************************************************************************
3395 + ****************************************************************************
3396 + * P. Sadik Oct 08, 2003
3398 + * Started revision history
3399 + * Made IDT_BUS_FREQ a kernel configuration parameter
3400 + ****************************************************************************
3401 + * P. Sadik Oct 10, 2003
3403 + * Removed IDT_BUS_FREQ, since this parameter is no longer required. Instead
3404 + * idt_cpu_freq is used everywhere
3405 + ****************************************************************************
3406 + * P. Sadik Oct 20, 2003
3408 + * Removed RC32434_BASE_BAUD
3409 + ****************************************************************************
3411 +#ifndef _RC32434_H_
3412 +#define _RC32434_H_
3414 +#include <linux/autoconf.h>
3415 +#include <linux/delay.h>
3416 +#include <asm/io.h>
3418 +#define RC32434_REG_BASE 0x18000000
3420 +#define interrupt ((volatile INT_t ) INT0_VirtualAddress)
3421 +#define gpio ((volatile GPIO_t) GPIO0_VirtualAddress)
3424 +#define IDT_CLOCK_MULT 2
3425 +#define MIPS_CPU_TIMER_IRQ 7
3426 +/* Interrupt Controller */
3427 +#define IC_GROUP0_PEND (RC32434_REG_BASE + 0x38000)
3428 +#define IC_GROUP0_MASK (RC32434_REG_BASE + 0x38008)
3429 +#define IC_GROUP_OFFSET 0x0C
3431 +#define NUM_INTR_GROUPS 5
3434 +#define GROUP0_IRQ_BASE 8 /* GRP2 IRQ numbers start here */
3435 +#define GROUP1_IRQ_BASE (GROUP0_IRQ_BASE + 32) /* GRP3 IRQ numbers start here */
3436 +#define GROUP2_IRQ_BASE (GROUP1_IRQ_BASE + 32) /* GRP4 IRQ numbers start here */
3437 +#define GROUP3_IRQ_BASE (GROUP2_IRQ_BASE + 32) /* GRP5 IRQ numbers start here */
3438 +#define GROUP4_IRQ_BASE (GROUP3_IRQ_BASE + 32)
3442 +#define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58003)
3444 +#define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58000)
3447 +#define RC32434_UART0_IRQ GROUP3_IRQ_BASE + 0
3448 +// #define EB434_UART1_IRQ GROUP4_IRQ_BASE + 11
3450 +#define local_readl(addr) __raw_readl(addr)
3451 +#define local_writel(l,addr) __raw_writel(l,addr)
3453 +/* cpu pipeline flush */
3454 +static inline void rc32434_sync(void)
3456 + __asm__ volatile ("sync");
3459 +static inline void rc32434_sync_udelay(int us)
3461 + __asm__ volatile ("sync");
3465 +static inline void rc32434_sync_delay(int ms)
3467 + __asm__ volatile ("sync");
3472 + * C access to CLZ and CLO instructions
3473 + * (count leading zeroes/ones).
3475 +static inline int rc32434_clz(unsigned long val)
3478 + __asm__ volatile (
3479 + ".set\tnoreorder\n\t"
3481 + ".set\tmips32\n\t"
3491 +static inline int rc32434_clo(unsigned long val)
3494 + __asm__ volatile (
3495 + ".set\tnoreorder\n\t"
3497 + ".set\tmips32\n\t"
3508 +#endif /* _RC32434_H_ */