1 diff -urN linux-2.4.30/Makefile linux-2.4.30.current/Makefile
2 --- linux-2.4.30/Makefile 2005-06-11 20:24:07.000000000 +0200
3 +++ linux-2.4.30.current/Makefile 2005-06-12 20:14:28.000000000 +0200
6 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
8 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
9 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
10 -fno-strict-aliasing -fno-common
11 ifndef CONFIG_FRAME_POINTER
12 CFLAGS += -fomit-frame-pointer
13 diff -urN linux-2.4.30/arch/mips/Makefile linux-2.4.30.current/arch/mips/Makefile
14 --- linux-2.4.30/arch/mips/Makefile 2005-06-11 20:24:07.000000000 +0200
15 +++ linux-2.4.30.current/arch/mips/Makefile 2005-06-12 20:14:28.000000000 +0200
20 +# Texas Instruments AR7
24 +LIBS += arch/mips/ar7/ar7.o arch/mips/ar7/avalanche/avalanche.o
25 +SUBDIRS += arch/mips/ar7 arch/mips/ar7/avalanche
26 +LOADADDR += 0x94020000
32 ifdef CONFIG_DECSTATION
33 diff -urN linux-2.4.30/arch/mips/ar7/Makefile linux-2.4.30.current/arch/mips/ar7/Makefile
34 --- linux-2.4.30/arch/mips/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
35 +++ linux-2.4.30.current/arch/mips/ar7/Makefile 2005-06-12 20:14:28.000000000 +0200
38 + $(CPP) $(AFLAGS) $< -o $*.s
41 + $(CC) $(AFLAGS) -c $< -o $*.o
45 +obj-y := tnetd73xx_misc.o
46 +obj-y += setup.o irq.o mipsIRQ.o reset.o init.o memory.o printf.o cmdline.o time.o
48 +include $(TOPDIR)/Rules.make
49 diff -urN linux-2.4.30/arch/mips/ar7/avalanche/Makefile linux-2.4.30.current/arch/mips/ar7/avalanche/Makefile
50 --- linux-2.4.30/arch/mips/ar7/avalanche/Makefile 1970-01-01 01:00:00.000000000 +0100
51 +++ linux-2.4.30.current/arch/mips/ar7/avalanche/Makefile 2005-06-12 20:14:28.000000000 +0200
54 + $(CPP) $(AFLAGS) $< -o $*.s
57 + $(CC) $(AFLAGS) -c $< -o $*.o
59 +EXTRA_CFLAGS := -DLITTLE_ENDIAN -D_LINK_KSEG0_
61 +O_TARGET := avalanche.o
63 +obj-y += avalanche_paging.o avalanche_jump.o
65 +include $(TOPDIR)/Rules.make
66 diff -urN linux-2.4.30/arch/mips/ar7/avalanche/avalanche_jump.S linux-2.4.30.current/arch/mips/ar7/avalanche/avalanche_jump.S
67 --- linux-2.4.30/arch/mips/ar7/avalanche/avalanche_jump.S 1970-01-01 01:00:00.000000000 +0100
68 +++ linux-2.4.30.current/arch/mips/ar7/avalanche/avalanche_jump.S 2005-06-12 20:14:28.000000000 +0200
70 +#include <linux/config.h>
71 +#include <linux/threads.h>
74 +#include <asm/cacheops.h>
75 +#include <asm/current.h>
76 +#include <asm/offset.h>
77 +#include <asm/processor.h>
78 +#include <asm/regdef.h>
79 +#include <asm/cachectl.h>
80 +#include <asm/mipsregs.h>
81 +#include <asm/stackframe.h>
88 +/* TLB Miss Vector */
98 + /* Unused TLB Miss Vector */
100 +LEAF(jump_tlb_miss_unused)
106 +END(jump_tlb_miss_unused)
108 + /* Cache Error Vector */
110 +LEAF(jump_cache_error)
116 +END(jump_cache_error)
118 + /* General Exception */
120 +LEAF(jump_general_exception)
126 +END(jump_general_exception)
128 + /* Dedicated Interrupt */
130 +LEAF(jump_dedicated_interrupt)
136 +END(jump_dedicated_interrupt)
139 diff -urN linux-2.4.30/arch/mips/ar7/avalanche/avalanche_paging.c linux-2.4.30.current/arch/mips/ar7/avalanche/avalanche_paging.c
140 --- linux-2.4.30/arch/mips/ar7/avalanche/avalanche_paging.c 1970-01-01 01:00:00.000000000 +0100
141 +++ linux-2.4.30.current/arch/mips/ar7/avalanche/avalanche_paging.c 2005-06-12 20:14:28.000000000 +0200
145 + * This file is subject to the terms and conditions of the GNU General Public
146 + * License. See the file "COPYING" in the main directory of this archive
147 + * for more details.
149 + * Copyright (C) 2002 by Jeff Harrell (jharrell@ti.com)
150 + * Copyright (C) 2002 Texas Instruments, Inc.
155 + * This file takes care of the "memory hole" issue that exists with the standard
156 + * linux kernel and the TI Avalanche ASIC. The Avalanche ASIC requires an offset
157 + * of 0x14000000 due to the ASIC's memory map constraints. This file corrects the
158 + * paging tables so that the only reflect valid memory (i.e. > 0x14000000)
162 +#include <linux/config.h>
163 +#include <linux/signal.h>
164 +#include <linux/sched.h>
165 +#include <linux/kernel.h>
166 +#include <linux/errno.h>
167 +#include <linux/string.h>
168 +#include <linux/types.h>
169 +#include <linux/ptrace.h>
170 +#include <linux/mman.h>
171 +#include <linux/mm.h>
172 +#include <linux/swap.h>
173 +#include <linux/smp.h>
174 +#include <linux/init.h>
175 +#ifdef CONFIG_BLK_DEV_INITRD
176 +#include <linux/blk.h>
177 +#endif /* CONFIG_BLK_DEV_INITRD */
178 +#include <linux/highmem.h>
179 +#include <linux/bootmem.h>
181 +#include <asm/processor.h>
182 +#include <asm/system.h>
183 +#include <asm/uaccess.h>
184 +#include <asm/pgtable.h>
185 +#include <asm/pgalloc.h>
186 +#include <asm/mmu_context.h>
188 +#include <asm/tlb.h>
189 +#include <asm/cpu.h>
191 +#define __MEMORY_START CONFIG_AR7_MEMORY
193 +#ifdef CONFIG_DISCONTIGMEM
194 +pg_data_t discontig_page_data[NR_NODES];
195 +bootmem_data_t discontig_node_bdata[NR_NODES];
198 +static unsigned long totalram_pages;
199 +/* static unsigned long totalhigh_pages; */
201 +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
202 +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
204 +#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
205 +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
206 +#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
208 +unsigned long bootmap_size;
210 +extern char *prom_getenv(char *envname);
213 + * We have upto 8 empty zeroed pages so we can map one of the right colour
214 + * when needed. This is necessary only on R4000 / R4400 SC and MC versions
215 + * where we have to avoid VCED / VECI exceptions for good performance at
216 + * any price. Since page is never written to after the initialization we
217 + * don't have to care about aliases on other CPUs.
220 +static inline unsigned long setup_zero_pages(void)
222 + unsigned long order, size;
224 + if(current_cpu_data.options & MIPS_CPU_VCE)
229 + empty_zero_page = __get_free_pages(GFP_KERNEL, order);
231 + if (!empty_zero_page)
232 + panic("Oh boy, that early out of memory?");
234 + page = virt_to_page(empty_zero_page);
236 + while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
237 + set_bit(PG_reserved, &page->flags);
238 + set_page_count(page, 0);
242 + size = PAGE_SIZE << order;
243 + zero_page_mask = (size - 1) & PAGE_MASK;
244 + memset((void *)empty_zero_page, 0, size);
246 + return 1UL << order;
250 + * paging_init() sets up the page tables
252 + * This routines also unmaps the page at virtual kernel address 0, so
253 + * that we can trap those pesky NULL-reference errors in the kernel.
255 +void __init paging_init(void)
257 + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
258 + unsigned long low, start_pfn;
260 + /* Initialize the entire pgd. */
261 + pgd_init((unsigned long)swapper_pg_dir);
262 + pgd_init((unsigned long)swapper_pg_dir + PAGE_SIZE / 2);
265 + start_pfn = START_PFN;
266 + // max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
269 + /* Avalanche DMA-able memory 0x14000000+memsize */
271 + zones_size[ZONE_DMA] = low - start_pfn;
273 + free_area_init_node(0, NODE_DATA(0), 0, zones_size, __MEMORY_START, 0);
275 +#ifdef CONFIG_DISCONTIGMEM
276 + zones_size[ZONE_DMA] = __MEMORY_SIZE_2ND >> PAGE_SHIFT;
277 + zones_size[ZONE_NORMAL] = 0;
278 + free_area_init_node(1, NODE_DATA(1), 0, zones_size, __MEMORY_START_2ND, 0);
279 +#endif /* CONFIG_DISCONTIGMEM */
283 +extern char _ftext, _etext, _fdata, _edata, _end;
284 +extern char __init_begin, __init_end;
286 +void __init mem_init(void)
288 + int codesize, reservedpages, datasize, initsize;
291 + max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN;
292 + high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE);
294 + /* free up the memory associated with Adam2 -
295 + * that is the, after the first page that is
296 + * reserved all the way up to the start of the kernel
298 + free_bootmem_node(NODE_DATA(0), (__MEMORY_START+PAGE_SIZE),
299 + (__pa(&_ftext))-(__MEMORY_START+PAGE_SIZE) );
301 + /* this will put all low memory onto the freelists */
302 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
304 + /* Setup zeroed pages */
305 + totalram_pages -= setup_zero_pages();
308 +#ifdef CONFIG_DISCONTIGMEM
309 + totalram_pages += free_all_bootmem_node(NODE_DATA(1));
312 + for (tmp = 0; tmp < num_physpages; tmp++)
314 + * Only count reserved RAM pages
316 + if (PageReserved(mem_map+tmp))
319 + codesize = (unsigned long) &_etext - (unsigned long) &_ftext;
320 + datasize = (unsigned long) &_edata - (unsigned long) &_fdata;
321 + initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
323 + printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
324 + (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
325 + max_mapnr << (PAGE_SHIFT-10),
327 + reservedpages << (PAGE_SHIFT-10),
333 +/* fixes paging routines for avalanche (utilized in /arch/mips/kernel/setup.c) */
335 +void avalanche_bootmem_init(void)
337 + unsigned long start_pfn, max_pfn;
338 + unsigned long max_low_pfn;
339 + unsigned int memsize,memory_end,memory_start;
342 + memsize_str = prom_getenv("memsize");
343 + if (!memsize_str) {
344 + memsize = 0x02000000;
346 + memsize = simple_strtol(memsize_str, NULL, 0);
350 + memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START;
351 + memory_end = memory_start + memsize;
354 + * Find the highest memory page fram number we have available
357 + max_pfn = PFN_DOWN(__pa(memory_end));
360 + * Determine the low and high memory ranges
363 + max_low_pfn = max_pfn;
366 + * Partially used pages are not usable - thus we are
367 + * rounding upwards:
370 + start_pfn = PFN_UP(__pa(&_end));
373 + * Find a proper area for the bootmem bitmap. After this
374 + * bootstrap step all allocations (until the page allocator is
375 + * intact) must be done via bootmem_alloc().
378 + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
379 + __MEMORY_START>>PAGE_SHIFT, max_low_pfn);
383 + * Register fully available low RAM pages with the bootmem allocator.
387 + unsigned long curr_pfn, last_pfn, pages;
390 + * We are rounding up the start address of usable memory:
392 + curr_pfn = PFN_UP(__MEMORY_START);
395 + * ... and at the end of the usable range downwards:
397 + last_pfn = PFN_DOWN(__pa(memory_end));
399 + if (last_pfn > max_low_pfn)
400 + last_pfn = max_low_pfn;
402 + pages = last_pfn - curr_pfn;
405 + free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
410 + * Reserve the kernel text and
411 + * Reserve the bootmem bitmap. We do this in two steps (first step
412 + * was init_bootmem()), because this catches the (definitely buggy)
413 + * case of us accidentally initializing the bootmem allocator with
414 + * an invalid RAM area.
416 + reserve_bootmem_node(NODE_DATA(0), __MEMORY_START+PAGE_SIZE,
417 + (PFN_PHYS(start_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START);
420 + * reserve physical page 0 - it's a special BIOS page on many boxes,
421 + * enabling clean reboots, SMP operation, laptop functions.
423 + reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);
426 +extern char __init_begin, __init_end;
428 +void free_initmem(void)
430 + unsigned long addr;
431 + // prom_free_prom_memory ();
433 + addr = (unsigned long) &__init_begin;
434 + while (addr < (unsigned long) &__init_end) {
435 + ClearPageReserved(virt_to_page(addr));
436 + set_page_count(virt_to_page(addr), 1);
441 + printk("Freeing unused kernel memory: %dk freed\n",
442 + (&__init_end - &__init_begin) >> 10);
445 +void si_meminfo(struct sysinfo *val)
447 + val->totalram = totalram_pages;
448 + val->sharedram = 0;
449 + val->freeram = nr_free_pages();
450 + val->bufferram = atomic_read(&buffermem_pages);
451 + val->totalhigh = 0;
452 + val->freehigh = nr_free_highpages();
453 + val->mem_unit = PAGE_SIZE;
457 diff -urN linux-2.4.30/arch/mips/ar7/cmdline.c linux-2.4.30.current/arch/mips/ar7/cmdline.c
458 --- linux-2.4.30/arch/mips/ar7/cmdline.c 1970-01-01 01:00:00.000000000 +0100
459 +++ linux-2.4.30.current/arch/mips/ar7/cmdline.c 2005-06-12 20:14:28.000000000 +0200
462 + * Carsten Langgaard, carstenl@mips.com
463 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
465 + * This program is free software; you can distribute it and/or modify it
466 + * under the terms of the GNU General Public License (Version 2) as
467 + * published by the Free Software Foundation.
469 + * This program is distributed in the hope it will be useful, but WITHOUT
470 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
471 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
472 + * for more details.
474 + * You should have received a copy of the GNU General Public License along
475 + * with this program; if not, write to the Free Software Foundation, Inc.,
476 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
478 + * Kernel command line creation using the prom monitor (YAMON) argc/argv.
480 +#include <linux/init.h>
481 +#include <linux/string.h>
483 +#include <asm/bootinfo.h>
485 +extern int prom_argc;
486 +extern int *_prom_argv;
489 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
490 + * This macro take care of sign extension.
492 +#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
494 +char arcs_cmdline[CL_SIZE];
496 +char * __init prom_getcmdline(void)
498 + return &(arcs_cmdline[0]);
502 +void __init prom_init_cmdline(void)
507 + actr = 1; /* Always ignore argv[0] */
509 + cp = &(arcs_cmdline[0]);
510 +#ifdef CONFIG_CMDLINE_BOOL
511 + strcpy(cp, CONFIG_CMDLINE);
512 + cp += strlen(CONFIG_CMDLINE);
515 + while(actr < prom_argc) {
516 + strcpy(cp, prom_argv(actr));
517 + cp += strlen(prom_argv(actr));
521 + if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
525 diff -urN linux-2.4.30/arch/mips/ar7/init.c linux-2.4.30.current/arch/mips/ar7/init.c
526 --- linux-2.4.30/arch/mips/ar7/init.c 1970-01-01 01:00:00.000000000 +0100
527 +++ linux-2.4.30.current/arch/mips/ar7/init.c 2005-06-12 20:14:28.000000000 +0200
530 + * Carsten Langgaard, carstenl@mips.com
531 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
533 + * This program is free software; you can distribute it and/or modify it
534 + * under the terms of the GNU General Public License (Version 2) as
535 + * published by the Free Software Foundation.
537 + * This program is distributed in the hope it will be useful, but WITHOUT
538 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
539 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
540 + * for more details.
542 + * You should have received a copy of the GNU General Public License along
543 + * with this program; if not, write to the Free Software Foundation, Inc.,
544 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
546 + * PROM library initialisation code.
548 +#include <linux/config.h>
549 +#include <linux/init.h>
550 +#include <linux/string.h>
551 +#include <linux/kernel.h>
554 +#include <asm/mips-boards/prom.h>
555 +#include <asm/mips-boards/generic.h>
557 +/* Environment variable */
564 +int *_prom_argv, *_prom_envp;
567 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
568 + * This macro take care of sign extension, if running in 64-bit mode.
570 +#define prom_envp(index) ((char *)(((int *)(int)_prom_envp)[(index)]))
574 +char *prom_getenv(char *envname)
577 + * Return a pointer to the given environment variable.
578 + * In 64-bit mode: we're using 64-bit pointers, but all pointers
579 + * in the PROM structures are only 32-bit, so we need some
580 + * workarounds, if we are running in 64-bit mode.
584 + i = strlen(envname);
586 + while (prom_envp(index)) {
587 + if(strncmp(envname, prom_envp(index), i) == 0) {
588 + return(prom_envp(index+1));
596 +static inline unsigned char str2hexnum(unsigned char c)
598 + if (c >= '0' && c <= '9')
600 + if (c >= 'a' && c <= 'f')
601 + return c - 'a' + 10;
602 + return 0; /* foo */
605 +static inline void str2eaddr(unsigned char *ea, unsigned char *str)
609 + for (i = 0; i < 6; i++) {
612 + if((*str == '.') || (*str == ':'))
614 + num = str2hexnum(*str++) << 4;
615 + num |= (str2hexnum(*str++));
620 +int get_ethernet_addr(char *ethernet_addr)
624 + ethaddr_str = prom_getenv("ethaddr");
625 + if (!ethaddr_str) {
626 + printk("ethaddr not set in boot prom\n");
629 + str2eaddr(ethernet_addr, ethaddr_str);
631 + if (init_debug > 1) {
633 + printk("get_ethernet_addr: ");
634 + for (i=0; i<5; i++)
635 + printk("%02x:", (unsigned char)*(ethernet_addr+i));
636 + printk("%02x\n", *(ethernet_addr+i));
642 +int __init prom_init(int argc, char **argv, char **envp)
645 + _prom_argv = (int *)argv;
646 + _prom_envp = (int *)envp;
648 + set_io_port_base(0);
650 + prom_printf("\nLINUX started...\n");
651 + prom_init_cmdline();
656 diff -urN linux-2.4.30/arch/mips/ar7/irq.c linux-2.4.30.current/arch/mips/ar7/irq.c
657 --- linux-2.4.30/arch/mips/ar7/irq.c 1970-01-01 01:00:00.000000000 +0100
658 +++ linux-2.4.30.current/arch/mips/ar7/irq.c 2005-06-12 20:14:28.000000000 +0200
661 + * Nitin Dhingra, iamnd@ti.com
662 + * Copyright (C) 2002 Texas Instruments, Inc. All rights reserved.
664 + * ########################################################################
666 + * This program is free software; you can distribute it and/or modify it
667 + * under the terms of the GNU General Public License (Version 2) as
668 + * published by the Free Software Foundation.
670 + * This program is distributed in the hope it will be useful, but WITHOUT
671 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
672 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
673 + * for more details.
675 + * You should have received a copy of the GNU General Public License along
676 + * with this program; if not, write to the Free Software Foundation, Inc.,
677 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
679 + * ########################################################################
681 + * Routines for generic manipulation of the interrupts found on the Texas
682 + * Instruments avalanche board
686 +#include <linux/config.h>
687 +#include <linux/init.h>
688 +#include <linux/sched.h>
689 +#include <linux/slab.h>
690 +#include <linux/interrupt.h>
691 +#include <linux/kernel_stat.h>
692 +#include <linux/proc_fs.h>
693 +#include <asm/irq.h>
694 +#include <asm/mips-boards/prom.h>
695 +#include <asm/ar7/ar7.h>
696 +#include <asm/ar7/avalanche_intc.h>
697 +#include <asm/gdb-stub.h>
700 +#define shutdown_avalanche_irq disable_avalanche_irq
701 +#define mask_and_ack_avalanche_irq disable_avalanche_irq
703 +static unsigned int startup_avalanche_irq(unsigned int irq);
704 +static void end_avalanche_irq(unsigned int irq);
705 +void enable_avalanche_irq(unsigned int irq_nr);
706 +void disable_avalanche_irq(unsigned int irq_nr);
708 +static struct hw_interrupt_type avalanche_irq_type = {
710 + startup_avalanche_irq,
711 + shutdown_avalanche_irq,
712 + enable_avalanche_irq,
713 + disable_avalanche_irq,
714 + mask_and_ack_avalanche_irq,
719 +irq_desc_t irq_desc_ti[AVALANCHE_INT_END+1] __cacheline_aligned =
720 +{ [0 ... AVALANCHE_INT_END] = { 0, &avalanche_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}};
723 +unsigned long spurious_count = 0;
725 +struct avalanche_ictrl_regs *avalanche_hw0_icregs; /* Interrupt control regs (primary) */
726 +struct avalanche_exctrl_regs *avalanche_hw0_ecregs; /* Exception control regs (secondary) */
727 +struct avalanche_ipace_regs *avalanche_hw0_ipaceregs;
728 +struct avalanche_channel_int_number *avalanche_hw0_chregs; /* Channel control registers */
730 +extern asmlinkage void mipsIRQ(void);
734 + * The avalanche/MIPS interrupt line numbers are used to represent the
735 + * interrupts within the irqaction arrays. The index notation is
738 + * 0-7 MIPS CPU Exceptions (HW/SW)
739 + * 8-47 Primary Interrupts (Avalanche)
740 + * 48-79 Secondary Interrupts (Avalanche)
745 +static struct irqaction *hw0_irq_action_primary[AVINTNUM(AVALANCHE_INT_END_PRIMARY)] =
747 + NULL, NULL, NULL, NULL,
748 + NULL, NULL, NULL, NULL,
749 + NULL, NULL, NULL, NULL,
750 + NULL, NULL, NULL, NULL,
751 + NULL, NULL, NULL, NULL,
752 + NULL, NULL, NULL, NULL,
753 + NULL, NULL, NULL, NULL,
754 + NULL, NULL, NULL, NULL,
755 + NULL, NULL, NULL, NULL,
756 + NULL, NULL, NULL, NULL
759 +static struct irqaction *hw0_irq_action_secondary[AVINTNUM(AVALANCHE_INT_END_SECONDARY)] =
761 + NULL, NULL, NULL, NULL,
762 + NULL, NULL, NULL, NULL,
763 + NULL, NULL, NULL, NULL,
764 + NULL, NULL, NULL, NULL,
765 + NULL, NULL, NULL, NULL,
766 + NULL, NULL, NULL, NULL,
767 + NULL, NULL, NULL, NULL,
768 + NULL, NULL, NULL, NULL
772 + This remaps interrupts to exist on other channels than the default
773 + channels. essentially we can use the line # as the index for this
778 +static unsigned long line_to_channel[AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
779 +unsigned long uni_secondary_interrupt = 0;
781 +static struct irqaction r4ktimer_action = {
782 + NULL, 0, 0, "R4000 timer/counter", NULL, NULL,
785 +static struct irqaction *irq_action[8] = {
786 + NULL, /* SW int 0 */
787 + NULL, /* SW int 1 */
788 + NULL, /* HW int 0 */
791 + NULL, /* HW int 3 */
792 + NULL, /* HW int 4 */
793 + &r4ktimer_action /* HW int 5 */
796 +static void end_avalanche_irq(unsigned int irq)
798 + if (!(irq_desc_ti[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
799 + enable_avalanche_irq(irq);
802 +void disable_avalanche_irq(unsigned int irq_nr)
804 + unsigned long flags;
805 + unsigned long chan_nr=0;
806 + unsigned long int_bit=0;
808 + if(irq_nr >= AVALANCHE_INT_END)
810 + printk("whee, invalid irq_nr %d\n", irq_nr);
811 + panic("IRQ, you lose...");
814 + save_and_cli(flags);
817 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
819 + /* disable mips exception */
821 + int_bit = read_c0_status() & ~(1 << (8+irq_nr));
822 + change_c0_status(ST0_IM,int_bit);
823 + restore_flags(flags);
827 + /* irq_nr represents the line number for the interrupt. We must
828 + * disable the channel number associated with that line number.
831 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
832 + chan_nr = AVINTNUM(irq_nr); /*CHECK THIS ALSO*/
834 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];/* WE NEED A LINE TO CHANNEL MAPPING FUNCTION HERE*/
836 + /* disable the interrupt channel bit */
838 + /* primary interrupt #'s 0-31 */
840 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
841 + avalanche_hw0_icregs->intecr1 = (1 << chan_nr);
843 + /* primary interrupt #'s 32-39 */
845 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
846 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
847 + avalanche_hw0_icregs->intecr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
849 + else /* secondary interrupt #'s 0-31 */
850 + avalanche_hw0_ecregs->exiecr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
852 + restore_flags(flags);
855 +void enable_avalanche_irq(unsigned int irq_nr)
857 + unsigned long flags;
858 + unsigned long chan_nr=0;
859 + unsigned long int_bit=0;
861 + if(irq_nr > AVALANCHE_INT_END) {
862 + printk("whee, invalid irq_nr %d\n", irq_nr);
863 + panic("IRQ, you lose...");
866 + save_and_cli(flags);
869 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
871 + /* Enable MIPS exceptions */
872 + int_bit = read_c0_status();
873 + change_c0_status(ST0_IM,int_bit | (1<<(8+irq_nr)));
874 + restore_flags(flags);
878 + /* irq_nr represents the line number for the interrupt. We must
879 + * disable the channel number associated with that line number.
882 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
883 + chan_nr = AVINTNUM(irq_nr);
885 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];
887 + /* enable the interrupt channel bit */
889 + /* primary interrupt #'s 0-31 */
890 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
891 + avalanche_hw0_icregs->intesr1 = (1 << chan_nr);
893 + /* primary interrupt #'s 32 throuth 39 */
894 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
895 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
896 + avalanche_hw0_icregs->intesr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
898 + else /* secondary interrupt #'s 0-31 */
899 + avalanche_hw0_ecregs->exiesr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
901 + restore_flags(flags);
904 +static unsigned int startup_avalanche_irq(unsigned int irq)
906 + enable_avalanche_irq(irq);
907 + return 0; /* never anything pending */
911 +int get_irq_list(char *buf)
915 + struct irqaction *action;
917 + for (i = 0; i < MIPS_EXCEPTION_OFFSET; i++, num++)
919 + action = irq_action[i];
922 + len += sprintf(buf+len, "%2d: %8d %c %s",
923 + num, kstat.irqs[0][num],
924 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
926 + for (action=action->next; action; action = action->next) {
927 + len += sprintf(buf+len, ",%s %s",
928 + (action->flags & SA_INTERRUPT) ? " +" : "",
931 + len += sprintf(buf+len, " [MIPS interrupt]\n");
935 + for (i = 0; i < AVINTNUM(AVALANCHE_INT_END); i++,num++)
937 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
938 + action = hw0_irq_action_primary[i];
940 + action = hw0_irq_action_secondary[i-AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
943 + len += sprintf(buf+len, "%2d: %8d %c %s",
944 + num, kstat.irqs[0][ LNXINTNUM(i) ],
945 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
948 + for (action=action->next; action; action = action->next)
950 + len += sprintf(buf+len, ",%s %s",
951 + (action->flags & SA_INTERRUPT) ? " +" : "",
955 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
956 + len += sprintf(buf+len, " [hw0 (Avalanche Primary)]\n");
958 + len += sprintf(buf+len, " [hw0 (Avalanche Secondary)]\n");
965 +int request_irq(unsigned int irq,
966 + void (*handler)(int, void *, struct pt_regs *),
967 + unsigned long irqflags,
968 + const char * devname,
971 + struct irqaction *action;
973 + if (irq > AVALANCHE_INT_END)
978 + action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
982 + action->handler = handler;
983 + action->flags = irqflags;
985 + action->name = devname;
986 + irq_desc_ti[irq].action = action;
987 + action->dev_id = dev_id;
991 + if(irq < MIPS_EXCEPTION_OFFSET)
993 + irq_action[irq] = action;
994 + enable_avalanche_irq(irq);
998 + if(irq < AVALANCHE_INT_END_PRIMARY)
999 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = action;
1001 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = action;
1003 + enable_avalanche_irq(irq);
1008 +void free_irq(unsigned int irq, void *dev_id)
1010 + struct irqaction *action;
1012 + if (irq > AVALANCHE_INT_END) {
1013 + printk("Trying to free IRQ%d\n",irq);
1017 + if(irq < MIPS_EXCEPTION_OFFSET)
1019 + action = irq_action[irq];
1020 + irq_action[irq] = NULL;
1021 + irq_desc_ti[irq].action = NULL;
1022 + disable_avalanche_irq(irq);
1027 + if(irq < AVALANCHE_INT_END_PRIMARY) {
1028 + action = hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]];
1029 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = NULL;
1030 + irq_desc_ti[irq].action = NULL;
1033 + action = hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY];
1034 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = NULL;
1035 + irq_desc_ti[irq].action = NULL;
1038 + disable_avalanche_irq(irq);
1043 +extern void breakpoint(void);
1044 +extern int remote_debug;
1047 +//void init_IRQ(void) __init;
1048 +void __init init_IRQ(void)
1052 + avalanche_hw0_icregs = (struct avalanche_ictrl_regs *)AVALANCHE_ICTRL_REGS_BASE;
1053 + avalanche_hw0_ecregs = (struct avalanche_exctrl_regs *)AVALANCHE_ECTRL_REGS_BASE;
1054 + avalanche_hw0_ipaceregs = (struct avalanche_ipace_regs *)AVALANCHE_IPACE_REGS_BASE;
1055 + avalanche_hw0_chregs = (struct avalanche_channel_int_number *)AVALANCHE_CHCTRL_REGS_BASE;
1057 + /* Disable interrupts and clear pending
1060 + avalanche_hw0_icregs->intecr1 = 0xffffffff; /* disable interrupts 0:31 */
1061 + avalanche_hw0_icregs->intcr1 = 0xffffffff; /* clear interrupts 0:31 */
1062 + avalanche_hw0_icregs->intecr2 = 0xff; /* disable interrupts 32:39 */
1063 + avalanche_hw0_icregs->intcr2 = 0xff; /* clear interrupts 32:39 */
1064 + avalanche_hw0_ecregs->exiecr = 0xffffffff; /* disable secondary interrupts 0:31 */
1065 + avalanche_hw0_ecregs->excr = 0xffffffff; /* clear secondary interrupts 0:31 */
1068 + // avalanche_hw0_ipaceregs->ipacep = (2*get_avalanche_vbus_freq()/1000000)*4;
1069 + /* hack for speeding up the pacing. */
1070 + printk("the pacing pre-scalar has been set as 600.\n");
1071 + avalanche_hw0_ipaceregs->ipacep = 600;
1072 + /* Channel to line mapping, Line to Channel mapping */
1074 + for(i = 0; i < 40; i++)
1075 + avalanche_int_set(i,i);
1077 + /* Now safe to set the exception vector. */
1078 + set_except_vector(0, mipsIRQ);
1080 + /* Setup the IRQ description array. These will be mapped
1081 + * as flat interrupts numbers. The mapping is as follows
1083 + * 0-7 MIPS CPU Exceptions (HW/SW)
1084 + * 8-46 Primary Interrupts (Avalanche)
1085 + * 47-78 Secondary Interrupts (Avalanche)
1088 + for (i = 0; i <= AVALANCHE_INT_END; i++)
1090 + irq_desc_ti[i].status = IRQ_DISABLED;
1091 + irq_desc_ti[i].action = 0;
1092 + irq_desc_ti[i].depth = 1;
1093 + irq_desc_ti[i].handler = &avalanche_irq_type;
1099 + set_debug_traps();
1106 +void avalanche_hw0_irqdispatch(struct pt_regs *regs)
1108 + struct irqaction *action;
1109 + int irq, cpu = smp_processor_id();
1110 + unsigned long int_line_number,status;
1111 + int i,secondary = 0;
1114 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
1115 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
1120 + if( chan_nr != uni_secondary_interrupt)
1121 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
1125 + if((chan_nr < 40) && (chan_nr > 31))
1127 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
1131 + /* If the Priority Interrupt Index Register returns 40 then no
1132 + * interrupts are pending
1138 + if(chan_nr == uni_secondary_interrupt)
1140 + status = avalanche_hw0_ecregs->exsr;
1141 + for(i=0; i < AVINTNUM(AVALANCHE_INT_END_SECONDARY); i++)
1143 + if (status & 1<<i)
1145 + /* clear secondary interrupt */
1146 + avalanche_hw0_ecregs->excr = 1 << i;
1153 + /* clear the universal secondary interrupt */
1154 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
1160 + /* Suraj Add code to clear secondary interrupt */
1163 + action = hw0_irq_action_secondary[irq];
1165 + action = hw0_irq_action_primary[irq];
1167 + /* if action == NULL, then we don't have a handler for the irq */
1169 + if ( action == NULL ) {
1170 + printk("No handler for hw0 irq: %i\n", irq);
1174 + irq_enter(cpu,irq);
1177 + kstat.irqs[0][(irq + AVINTNUM(AVALANCHE_INT_END_PRIMARY)) + 8]++;
1178 + action->handler((irq + AVALANCHE_INT_END_PRIMARY), action->dev_id, regs);
1182 + kstat.irqs[0][irq + 8]++;
1183 + action->handler(LNXINTNUM(irq), action->dev_id, regs);
1186 + irq_exit(cpu,irq);
1188 + if(softirq_pending(cpu))
1194 +void avalanche_int_set(int channel, int line)
1199 + avalanche_hw0_chregs->cintnr0 = line;
1202 + avalanche_hw0_chregs->cintnr1 = line;
1205 + avalanche_hw0_chregs->cintnr2 = line;
1208 + avalanche_hw0_chregs->cintnr3 = line;
1211 + avalanche_hw0_chregs->cintnr4 = line;
1214 + avalanche_hw0_chregs->cintnr5 = line;
1217 + avalanche_hw0_chregs->cintnr6 = line;
1220 + avalanche_hw0_chregs->cintnr7 = line;
1223 + avalanche_hw0_chregs->cintnr8 = line;
1226 + avalanche_hw0_chregs->cintnr9 = line;
1229 + avalanche_hw0_chregs->cintnr10 = line;
1232 + avalanche_hw0_chregs->cintnr11 = line;
1235 + avalanche_hw0_chregs->cintnr12 = line;
1238 + avalanche_hw0_chregs->cintnr13 = line;
1241 + avalanche_hw0_chregs->cintnr14 = line;
1244 + avalanche_hw0_chregs->cintnr15 = line;
1247 + avalanche_hw0_chregs->cintnr16 = line;
1250 + avalanche_hw0_chregs->cintnr17 = line;
1253 + avalanche_hw0_chregs->cintnr18 = line;
1256 + avalanche_hw0_chregs->cintnr19 = line;
1259 + avalanche_hw0_chregs->cintnr20 = line;
1262 + avalanche_hw0_chregs->cintnr21 = line;
1265 + avalanche_hw0_chregs->cintnr22 = line;
1268 + avalanche_hw0_chregs->cintnr23 = line;
1271 + avalanche_hw0_chregs->cintnr24 = line;
1274 + avalanche_hw0_chregs->cintnr25 = line;
1277 + avalanche_hw0_chregs->cintnr26 = line;
1280 + avalanche_hw0_chregs->cintnr27 = line;
1283 + avalanche_hw0_chregs->cintnr28 = line;
1286 + avalanche_hw0_chregs->cintnr29 = line;
1289 + avalanche_hw0_chregs->cintnr30 = line;
1292 + avalanche_hw0_chregs->cintnr31 = line;
1295 + avalanche_hw0_chregs->cintnr32 = line;
1298 + avalanche_hw0_chregs->cintnr33 = line;
1301 + avalanche_hw0_chregs->cintnr34 = line;
1304 + avalanche_hw0_chregs->cintnr35 = line;
1307 + avalanche_hw0_chregs->cintnr36 = line;
1310 + avalanche_hw0_chregs->cintnr37 = line;
1313 + avalanche_hw0_chregs->cintnr38 = line;
1316 + avalanche_hw0_chregs->cintnr39 = line;
1319 + printk("Error: Unknown Avalanche interrupt channel\n");
1322 + line_to_channel[line] = channel; /* Suraj check */
1324 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
1325 + uni_secondary_interrupt = line;
1329 diff -urN linux-2.4.30/arch/mips/ar7/memory.c linux-2.4.30.current/arch/mips/ar7/memory.c
1330 --- linux-2.4.30/arch/mips/ar7/memory.c 1970-01-01 01:00:00.000000000 +0100
1331 +++ linux-2.4.30.current/arch/mips/ar7/memory.c 2005-06-12 20:14:28.000000000 +0200
1334 + * Carsten Langgaard, carstenl@mips.com
1335 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1337 + * ########################################################################
1339 + * This program is free software; you can distribute it and/or modify it
1340 + * under the terms of the GNU General Public License (Version 2) as
1341 + * published by the Free Software Foundation.
1343 + * This program is distributed in the hope it will be useful, but WITHOUT
1344 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1345 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1346 + * for more details.
1348 + * You should have received a copy of the GNU General Public License along
1349 + * with this program; if not, write to the Free Software Foundation, Inc.,
1350 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1352 + * ########################################################################
1354 + * PROM library functions for acquiring/using memory descriptors given to
1355 + * us from the YAMON.
1358 +#include <linux/config.h>
1359 +#include <linux/init.h>
1360 +#include <linux/mm.h>
1361 +#include <linux/bootmem.h>
1363 +#include <asm/bootinfo.h>
1364 +#include <asm/page.h>
1365 +#include <asm/mips-boards/prom.h>
1366 +#include <asm/ar7/ar7.h>
1368 +enum yamon_memtypes {
1373 +struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
1375 +/* References to section boundaries */
1378 +#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
1381 +struct prom_pmemblock * __init prom_getmdesc(void)
1383 + char *memsize_str;
1384 + unsigned int memsize;
1386 + memsize_str = prom_getenv("memsize");
1387 + if (!memsize_str) {
1388 + memsize = 0x02000000;
1390 + memsize = simple_strtol(memsize_str, NULL, 0);
1393 + memset(mdesc, 0, sizeof(mdesc));
1395 + mdesc[0].type = yamon_dontuse;
1396 + mdesc[0].base = 0x00000000;
1397 + mdesc[0].size = AVALANCHE_SDRAM_BASE;
1399 + mdesc[1].type = yamon_prom;
1400 + mdesc[1].base = AVALANCHE_SDRAM_BASE;
1401 + mdesc[1].size = 0x00020000;
1403 + mdesc[2].type = yamon_free;
1404 + mdesc[2].base = AVALANCHE_SDRAM_BASE + 0x00020000;
1405 + mdesc[2].size = (memsize + AVALANCHE_SDRAM_BASE) - mdesc[2].base;
1410 +static int __init prom_memtype_classify (unsigned int type)
1414 + return BOOT_MEM_RAM;
1416 + return BOOT_MEM_ROM_DATA;
1418 + return BOOT_MEM_RESERVED;
1422 +void __init prom_meminit(void)
1424 + struct prom_pmemblock *p;
1426 + p = prom_getmdesc();
1430 + unsigned long base, size;
1432 + type = prom_memtype_classify (p->type);
1436 + add_memory_region(base, size, type);
1441 +void __init prom_free_prom_memory (void)
1444 + unsigned long freed = 0;
1445 + unsigned long addr;
1447 + for (i = 0; i < boot_mem_map.nr_map; i++) {
1448 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
1451 + addr = boot_mem_map.map[i].addr;
1452 + while (addr < boot_mem_map.map[i].addr
1453 + + boot_mem_map.map[i].size) {
1454 + ClearPageReserved(virt_to_page(__va(addr)));
1455 + set_page_count(virt_to_page(__va(addr)), 1);
1456 + free_page((unsigned long)__va(addr));
1457 + addr += PAGE_SIZE;
1458 + freed += PAGE_SIZE;
1461 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
1463 diff -urN linux-2.4.30/arch/mips/ar7/mipsIRQ.S linux-2.4.30.current/arch/mips/ar7/mipsIRQ.S
1464 --- linux-2.4.30/arch/mips/ar7/mipsIRQ.S 1970-01-01 01:00:00.000000000 +0100
1465 +++ linux-2.4.30.current/arch/mips/ar7/mipsIRQ.S 2005-06-12 20:14:28.000000000 +0200
1468 + * Carsten Langgaard, carstenl@mips.com
1469 + * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
1471 + * ########################################################################
1473 + * This program is free software; you can distribute it and/or modify it
1474 + * under the terms of the GNU General Public License (Version 2) as
1475 + * published by the Free Software Foundation.
1477 + * This program is distributed in the hope it will be useful, but WITHOUT
1478 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1479 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1480 + * for more details.
1482 + * You should have received a copy of the GNU General Public License along
1483 + * with this program; if not, write to the Free Software Foundation, Inc.,
1484 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1486 + * ########################################################################
1488 + * Interrupt exception dispatch code.
1491 +#include <linux/config.h>
1493 +#include <asm/asm.h>
1494 +#include <asm/mipsregs.h>
1495 +#include <asm/regdef.h>
1496 +#include <asm/stackframe.h>
1498 +/* A lot of complication here is taken away because:
1500 + * 1) We handle one interrupt and return, sitting in a loop and moving across
1501 + * all the pending IRQ bits in the cause register is _NOT_ the answer, the
1502 + * common case is one pending IRQ so optimize in that direction.
1504 + * 2) We need not check against bits in the status register IRQ mask, that
1505 + * would make this routine slow as hell.
1507 + * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
1508 + * between like BSD spl() brain-damage.
1510 + * Furthermore, the IRQs on the MIPS board look basically (barring software
1511 + * IRQs which we don't use at all and all external interrupt sources are
1512 + * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
1516 + * 0 Software (ignored)
1517 + * 1 Software (ignored)
1518 + * 2 Combined hardware interrupt (hw0)
1519 + * 3 Hardware (ignored)
1520 + * 4 Hardware (ignored)
1521 + * 5 Hardware (ignored)
1522 + * 6 Hardware (ignored)
1523 + * 7 R4k timer (what we use)
1525 + * Note: On the SEAD board thing are a little bit different.
1526 + * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
1529 + * We handle the IRQ according to _our_ priority which is:
1531 + * Highest ---- R4k Timer
1532 + * Lowest ---- Combined hardware interrupt
1534 + * then we just return, if multiple IRQs are pending then we will just take
1535 + * another exception, big deal.
1542 +NESTED(mipsIRQ, PT_SIZE, sp)
1547 + mfc0 s0, CP0_CAUSE # get irq bits
1549 + /* First we check for r4k counter/timer IRQ. */
1550 + andi a0, s0, CAUSEF_IP7
1552 + andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
1554 + /* Wheee, a timer interrupt. */
1556 + jal ar7_timer_interrupt
1563 + beq a0, zero, 1f # delay slot, check hw3 interrupt
1566 + /* Wheee, combined hardware level zero interrupt. */
1567 + jal avalanche_hw0_irqdispatch
1568 + move a0, sp # delay slot
1575 + * Here by mistake? This is possible, what can happen is that by the
1576 + * time we take the exception the IRQ pin goes low, so just leave if
1577 + * this is the case.
1580 + PRINT("Got interrupt: c0_cause = %08x\n")
1582 + PRINT("c0_epc = %08x\n")
1587 diff -urN linux-2.4.30/arch/mips/ar7/printf.c linux-2.4.30.current/arch/mips/ar7/printf.c
1588 --- linux-2.4.30/arch/mips/ar7/printf.c 1970-01-01 01:00:00.000000000 +0100
1589 +++ linux-2.4.30.current/arch/mips/ar7/printf.c 2005-06-12 20:14:28.000000000 +0200
1592 + * Carsten Langgaard, carstenl@mips.com
1593 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1595 + * This program is free software; you can distribute it and/or modify it
1596 + * under the terms of the GNU General Public License (Version 2) as
1597 + * published by the Free Software Foundation.
1599 + * This program is distributed in the hope it will be useful, but WITHOUT
1600 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1601 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1602 + * for more details.
1604 + * You should have received a copy of the GNU General Public License along
1605 + * with this program; if not, write to the Free Software Foundation, Inc.,
1606 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1608 + * Putting things on the screen/serial line using Adam2 facilities.
1611 +#include <linux/config.h>
1612 +#include <linux/init.h>
1613 +#include <linux/kernel.h>
1614 +#include <linux/serial_reg.h>
1615 +#include <linux/spinlock.h>
1616 +#include <asm/io.h>
1617 +#include <asm/serial.h>
1618 +#include <asm/addrspace.h>
1619 +#include <asm/ar7/ar7.h>
1621 +static char ppbuf[1024];
1623 +void (*prom_print_str)(unsigned int out, char *s, int len);
1625 +void prom_printf(char *fmt, ...) __init;
1626 +void prom_printf(char *fmt, ...)
1630 + prom_print_str = (void *)*(unsigned int *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR;
1632 + va_start(args, fmt);
1633 + vsprintf(ppbuf, fmt, args);
1634 + len = strlen(ppbuf);
1636 + prom_print_str(1, ppbuf, len);
1642 diff -urN linux-2.4.30/arch/mips/ar7/reset.c linux-2.4.30.current/arch/mips/ar7/reset.c
1643 --- linux-2.4.30/arch/mips/ar7/reset.c 1970-01-01 01:00:00.000000000 +0100
1644 +++ linux-2.4.30.current/arch/mips/ar7/reset.c 2005-06-12 20:14:28.000000000 +0200
1647 + * Carsten Langgaard, carstenl@mips.com
1648 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1650 + * ########################################################################
1652 + * This program is free software; you can distribute it and/or modify it
1653 + * under the terms of the GNU General Public License (Version 2) as
1654 + * published by the Free Software Foundation.
1656 + * This program is distributed in the hope it will be useful, but WITHOUT
1657 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1658 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1659 + * for more details.
1661 + * You should have received a copy of the GNU General Public License along
1662 + * with this program; if not, write to the Free Software Foundation, Inc.,
1663 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1665 + * ########################################################################
1667 + * Reset the MIPS boards.
1670 +#include <linux/config.h>
1672 +#include <asm/reboot.h>
1673 +#include <asm/mips-boards/generic.h>
1675 +static void ar7_machine_restart(char *command);
1676 +static void ar7_machine_halt(void);
1677 +static void ar7_machine_power_off(void);
1679 +static void ar7_machine_restart(char *command)
1684 +static void ar7_machine_halt(void)
1689 +static void ar7_machine_power_off(void)
1694 +void ar7_reboot_setup(void)
1696 + _machine_restart = ar7_machine_restart;
1697 + _machine_halt = ar7_machine_halt;
1698 + _machine_power_off = ar7_machine_power_off;
1700 diff -urN linux-2.4.30/arch/mips/ar7/setup.c linux-2.4.30.current/arch/mips/ar7/setup.c
1701 --- linux-2.4.30/arch/mips/ar7/setup.c 1970-01-01 01:00:00.000000000 +0100
1702 +++ linux-2.4.30.current/arch/mips/ar7/setup.c 2005-06-12 20:14:28.000000000 +0200
1705 + * Carsten Langgaard, carstenl@mips.com
1706 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
1708 + * This program is free software; you can distribute it and/or modify it
1709 + * under the terms of the GNU General Public License (Version 2) as
1710 + * published by the Free Software Foundation.
1712 + * This program is distributed in the hope it will be useful, but WITHOUT
1713 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1714 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1715 + * for more details.
1717 + * You should have received a copy of the GNU General Public License along
1718 + * with this program; if not, write to the Free Software Foundation, Inc.,
1719 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1721 +#include <linux/config.h>
1722 +#include <linux/init.h>
1723 +#include <linux/sched.h>
1724 +#include <linux/mc146818rtc.h>
1725 +#include <linux/ioport.h>
1727 +#include <asm/cpu.h>
1728 +#include <asm/bootinfo.h>
1729 +#include <asm/irq.h>
1730 +#include <asm/mips-boards/generic.h>
1731 +#include <asm/mips-boards/prom.h>
1733 +#include <asm/dma.h>
1734 +#include <asm/time.h>
1735 +#include <asm/traps.h>
1738 +#define _LINK_KSEG0_
1739 +#define LITTLE_ENDIAN
1740 +#include <asm/ar7/tnetd73xx.h>
1741 +#include <asm/ar7/tnetd73xx_misc.h>
1743 +// Specific for ar7wrd
1744 +unsigned int tnetd73xx_vbus_freq;
1745 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
1746 +#define AFECLK_FREQ 35328000
1747 +#define REFCLK_FREQ 25000000
1748 +#define OSC3_FREQ 24000000
1749 +#define AVALANCHE_CPMAC_INTERNAL_PHY_MASK 0x80000000
1751 +#if defined(CONFIG_AR7_MARVELL)
1752 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x00010000
1754 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x2
1759 +extern void rs_kgdb_hook(int);
1760 +int remote_debug = 0;
1763 +extern struct rtc_ops no_rtc_ops;
1765 +extern void ar7_reboot_setup(void);
1767 +extern void ar7_time_init(void);
1768 +extern void ar7_timer_setup(struct irqaction *irq);
1770 +/* maybe some of this is not needed? */
1771 +static void ar7_platform_init(void)
1773 + //tnetd73xx_gpio_init();
1775 + tnetd73xx_reset_ctrl(RESET_MODULE_UART0, OUT_OF_RESET);
1776 + //tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
1777 + //REG32_WRITE(TNETD73XX_GPIOENR, 0xf3fc3ff0);
1779 + //tnetd73xx_reset_ctrl(RESET_MODULE_EPHY, IN_RESET);
1780 + //tnetd73xx_reset_ctrl(RESET_MODULE_EPHY, OUT_OF_RESET);
1782 + tnetd73xx_clkc_init(AFECLK_FREQ, REFCLK_FREQ, OSC3_FREQ);
1784 + tnetd73xx_vbus_freq = tnetd73xx_clkc_get_freq(CLKC_SYS) / 2;
1786 +#if defined(CONFIG_AR7WRD)
1787 + if(! (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE)) {
1788 + tnetd73xx_clkc_set_freq(CLKC_MIPS, CLK_MHZ(150));
1794 +const char *get_system_type(void)
1796 + return "Texas Instruments AR7";
1799 +void __init ar7_setup(void)
1802 + int rs_putDebugChar(char);
1803 + char rs_getDebugChar(void);
1804 + extern int (*generic_putDebugChar)(char);
1805 + extern char (*generic_getDebugChar)(void);
1809 +#ifdef CONFIG_SERIAL_CONSOLE
1810 + argptr = prom_getcmdline();
1811 + if ((argptr = strstr(argptr, "console=")) == NULL) {
1812 + argptr = prom_getcmdline();
1813 + strcat(argptr, " console=ttyS0,38400");
1818 + argptr = prom_getcmdline();
1819 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
1821 + argptr += strlen("kgdb=ttyS");
1822 + if (*argptr != '0' && *argptr != '1')
1823 + printk("KGDB: Uknown serial line /dev/ttyS%c, "
1824 + "falling back to /dev/ttyS1\n", *argptr);
1825 + line = *argptr == '0' ? 0 : 1;
1826 + printk("KGDB: Using serial line /dev/ttyS%d for session\n",
1829 + rs_kgdb_hook(line);
1830 + generic_putDebugChar = rs_putDebugChar;
1831 + generic_getDebugChar = rs_getDebugChar;
1833 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
1834 + "please connect your debugger\n", line ? 1 : 0);
1837 + /* Breakpoints are in init_IRQ() */
1841 + argptr = prom_getcmdline();
1842 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
1843 + cpu_data[0].options &= ~MIPS_CPU_FPU;
1845 + rtc_ops = &no_rtc_ops;
1847 + ar7_platform_init();
1849 + ar7_reboot_setup();
1851 + board_time_init = ar7_time_init;
1852 + board_timer_setup = ar7_timer_setup;
1854 diff -urN linux-2.4.30/arch/mips/ar7/time.c linux-2.4.30.current/arch/mips/ar7/time.c
1855 --- linux-2.4.30/arch/mips/ar7/time.c 1970-01-01 01:00:00.000000000 +0100
1856 +++ linux-2.4.30.current/arch/mips/ar7/time.c 2005-06-12 20:14:28.000000000 +0200
1859 + * Carsten Langgaard, carstenl@mips.com
1860 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1862 + * ########################################################################
1864 + * This program is free software; you can distribute it and/or modify it
1865 + * under the terms of the GNU General Public License (Version 2) as
1866 + * published by the Free Software Foundation.
1868 + * This program is distributed in the hope it will be useful, but WITHOUT
1869 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1870 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1871 + * for more details.
1873 + * You should have received a copy of the GNU General Public License along
1874 + * with this program; if not, write to the Free Software Foundation, Inc.,
1875 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1877 + * ########################################################################
1879 + * Setting up the clock on the MIPS boards.
1883 +#include <linux/types.h>
1884 +#include <linux/config.h>
1885 +#include <linux/init.h>
1886 +#include <linux/kernel_stat.h>
1887 +#include <linux/sched.h>
1888 +#include <linux/spinlock.h>
1890 +#include <asm/mipsregs.h>
1891 +#include <asm/ptrace.h>
1892 +#include <asm/hardirq.h>
1893 +#include <asm/div64.h>
1895 +#include <linux/interrupt.h>
1896 +#include <linux/mc146818rtc.h>
1897 +#include <linux/timex.h>
1899 +#include <asm/mips-boards/generic.h>
1900 +#include <asm/mips-boards/prom.h>
1901 +#include <asm/ar7/ar7.h>
1903 +extern asmlinkage void mipsIRQ(void);
1905 +static unsigned long r4k_offset; /* Amount to increment compare reg each time */
1906 +static unsigned long r4k_cur; /* What counter should be at next timer irq */
1908 +#define MIPS_CPU_TIMER_IRQ 7
1909 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
1911 +static inline void ack_r4ktimer(unsigned long newval)
1913 + write_c0_compare(newval);
1916 +void ar7_timer_interrupt(struct pt_regs *regs)
1918 + int cpu = smp_processor_id();
1920 + irq_enter(cpu, MIPS_CPU_TIMER_IRQ);
1922 + if (r4k_offset == 0)
1926 + kstat.irqs[cpu][MIPS_CPU_TIMER_IRQ]++;
1928 + r4k_cur += r4k_offset;
1929 + ack_r4ktimer(r4k_cur);
1931 + } while (((unsigned long)read_c0_count()
1932 + - r4k_cur) < 0x7fffffff);
1934 + irq_exit(cpu, MIPS_CPU_TIMER_IRQ);
1936 + if (softirq_pending(cpu))
1946 + * Figure out the r4k offset, the amount to increment the compare
1947 + * register for each time tick.
1949 +static unsigned long __init cal_r4koff(void)
1951 + return ((CONFIG_AR7_FREQUENCY*500000)/HZ);
1954 +void __init ar7_time_init(void)
1956 + unsigned long flags;
1957 + unsigned int est_freq;
1959 + set_except_vector(0, mipsIRQ);
1960 + write_c0_count(0);
1962 + printk("calculating r4koff... ");
1963 + r4k_offset = cal_r4koff();
1964 + printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
1966 + est_freq = 2*r4k_offset*HZ;
1967 + est_freq += 5000; /* round */
1968 + est_freq -= est_freq%10000;
1969 + printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
1970 + (est_freq%1000000)*100/1000000);
1973 +void __init ar7_timer_setup(struct irqaction *irq)
1975 + /* we are using the cpu counter for timer interrupts */
1976 + irq->handler = no_action; /* we use our own handler */
1977 + setup_irq(MIPS_CPU_TIMER_IRQ, irq);
1979 + r4k_cur = (read_c0_count() + r4k_offset);
1980 + write_c0_compare(r4k_cur);
1981 + set_c0_status(ALLINTS);
1983 diff -urN linux-2.4.30/arch/mips/ar7/tnetd73xx_misc.c linux-2.4.30.current/arch/mips/ar7/tnetd73xx_misc.c
1984 --- linux-2.4.30/arch/mips/ar7/tnetd73xx_misc.c 1970-01-01 01:00:00.000000000 +0100
1985 +++ linux-2.4.30.current/arch/mips/ar7/tnetd73xx_misc.c 2005-06-12 20:14:28.000000000 +0200
1987 +/******************************************************************************
1988 + * FILE PURPOSE: TNETD73xx Misc modules API Source
1989 + ******************************************************************************
1990 + * FILE NAME: tnetd73xx_misc.c
1992 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
1993 + * FSER Modules API
1994 + * As per TNETD73xx specifications
1996 + * REVISION HISTORY:
1997 + * 27 Nov 02 - Sharath Kumar PSP TII
1998 + * 14 Feb 03 - Anant Gole PSP TII
2000 + * (C) Copyright 2002, Texas Instruments, Inc
2001 + *******************************************************************************/
2003 +#define LITTLE_ENDIAN
2004 +#define _LINK_KSEG0_
2006 +#include <linux/types.h>
2007 +#include <asm/ar7/tnetd73xx.h>
2008 +#include <asm/ar7/tnetd73xx_misc.h>
2010 +/* TNETD73XX Revision */
2011 +u32 tnetd73xx_get_revision(void)
2013 + /* Read Chip revision register - This register is from GPIO module */
2014 + return ( (u32) REG32_DATA(TNETD73XX_CVR));
2017 +/*****************************************************************************
2018 + * Reset Control Module
2019 + *****************************************************************************/
2022 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module, TNETD73XX_RESET_CTRL_T reset_ctrl)
2026 + /* read current reset register */
2027 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2029 + if (reset_ctrl == OUT_OF_RESET)
2031 + /* bring module out of reset */
2032 + reset_status |= (1 << reset_module);
2036 + /* put module in reset */
2037 + reset_status &= (~(1 << reset_module));
2040 + /* write to the reset register */
2041 + REG32_WRITE(TNETD73XX_RST_CTRL_PRCR, reset_status);
2045 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status (TNETD73XX_RESET_MODULE_T reset_module)
2049 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2050 + return ( (reset_status & (1 << reset_module)) ? OUT_OF_RESET : IN_RESET );
2053 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode)
2055 + REG32_WRITE(TNETD73XX_RST_CTRL_SWRCR, mode);
2058 +#define TNETD73XX_RST_CTRL_RSR_MASK 0x3
2060 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status()
2062 + u32 sys_reset_status;
2064 + REG32_READ(TNETD73XX_RST_CTRL_RSR, sys_reset_status);
2066 + return ( (TNETD73XX_SYS_RESET_STATUS_T) (sys_reset_status & TNETD73XX_RST_CTRL_RSR_MASK) );
2070 +/*****************************************************************************
2071 + * Power Control Module
2072 + *****************************************************************************/
2073 +#define TNETD73XX_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
2074 +#define TNETD73XX_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
2077 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl)
2081 + /* read current power down control register */
2082 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2084 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
2086 + /* power down the module */
2087 + power_status |= (1 << power_module);
2091 + /* power on the module */
2092 + power_status &= (~(1 << power_module));
2095 + /* write to the reset register */
2096 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2099 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module)
2103 + /* read current power down control register */
2104 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2106 + return ( (power_status & (1 << power_module)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP );
2109 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode)
2113 + /* read current power down control register */
2114 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2116 + power_status &= TNETD73XX_GLOBAL_POWER_DOWN_MASK;
2117 + power_status |= ( power_mode << TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2119 + /* write to power down control register */
2120 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2123 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode()
2127 + /* read current power down control register */
2128 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2130 + power_status &= (~TNETD73XX_GLOBAL_POWER_DOWN_MASK);
2131 + power_status = ( power_status >> TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2133 + return ( (TNETD73XX_SYS_POWER_MODE_T) power_status );
2137 +/*****************************************************************************
2139 + *****************************************************************************/
2141 +#define TNETD73XX_WAKEUP_POLARITY_BIT 16
2143 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
2144 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
2145 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity)
2147 + u32 wakeup_status;
2149 + /* read the wakeup control register */
2150 + REG32_READ(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2152 + /* enable/disable */
2153 + if (wakeup_ctrl == WAKEUP_ENABLED)
2155 + /* enable wakeup */
2156 + wakeup_status |= wakeup_int;
2160 + /* disable wakeup */
2161 + wakeup_status &= (~wakeup_int);
2164 + /* set polarity */
2165 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
2167 + wakeup_status |= (wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2171 + wakeup_status &= ~(wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2174 + /* write the wakeup control register */
2175 + REG32_WRITE(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2179 +/*****************************************************************************
2181 + *****************************************************************************/
2183 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode)
2185 + REG32_WRITE(TNETD73XX_FSER_BASE, fser_mode);
2188 +/*****************************************************************************
2190 + *****************************************************************************/
2192 +#define MIN(x,y) ( ((x) < (y)) ? (x) : (y) )
2193 +#define MAX(x,y) ( ((x) > (y)) ? (x) : (y) )
2194 +#define ABS(x) ( ((signed)(x) > 0) ? (x) : (-(x)) )
2195 +#define CEIL(x,y) ( ((x) + (y) / 2) / (y) )
2197 +#define CLKC_CLKCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x20 + (0x20 * (x)))
2198 +#define CLKC_CLKPLLCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x30 + (0x20 * (x)))
2200 +#define CLKC_PRE_DIVIDER 0x0000001F
2201 +#define CLKC_POST_DIVIDER 0x001F0000
2203 +#define CLKC_PLL_STATUS 0x1
2204 +#define CLKC_PLL_FACTOR 0x0000F000
2206 +#define BOOTCR_PLL_BYPASS (1 << 5)
2207 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
2209 +#define MIPS_PLL_SELECT 0x00030000
2210 +#define SYSTEM_PLL_SELECT 0x0000C000
2211 +#define USB_PLL_SELECT 0x000C0000
2212 +#define ADSLSS_PLL_SELECT 0x00C00000
2214 +#define MIPS_AFECLKI_SELECT 0x00000000
2215 +#define MIPS_REFCLKI_SELECT 0x00010000
2216 +#define MIPS_XTAL3IN_SELECT 0x00020000
2218 +#define SYSTEM_AFECLKI_SELECT 0x00000000
2219 +#define SYSTEM_REFCLKI_SELECT 0x00004000
2220 +#define SYSTEM_XTAL3IN_SELECT 0x00008000
2221 +#define SYSTEM_MIPSPLL_SELECT 0x0000C000
2223 +#define USB_SYSPLL_SELECT 0x00000000
2224 +#define USB_REFCLKI_SELECT 0x00040000
2225 +#define USB_XTAL3IN_SELECT 0x00080000
2226 +#define USB_MIPSPLL_SELECT 0x000C0000
2228 +#define ADSLSS_AFECLKI_SELECT 0x00000000
2229 +#define ADSLSS_REFCLKI_SELECT 0x00400000
2230 +#define ADSLSS_XTAL3IN_SELECT 0x00800000
2231 +#define ADSLSS_MIPSPLL_SELECT 0x00C00000
2233 +#define SYS_MAX CLK_MHZ(150)
2234 +#define SYS_MIN CLK_MHZ(1)
2236 +#define MIPS_SYNC_MAX SYS_MAX
2237 +#define MIPS_ASYNC_MAX CLK_MHZ(160)
2238 +#define MIPS_MIN CLK_MHZ(1)
2240 +#define USB_MAX CLK_MHZ(100)
2241 +#define USB_MIN CLK_MHZ(1)
2243 +#define ADSL_MAX CLK_MHZ(180)
2244 +#define ADSL_MIN CLK_MHZ(1)
2246 +#define PLL_MUL_MAXFACTOR 15
2247 +#define MAX_DIV_VALUE 32
2248 +#define MIN_DIV_VALUE 1
2250 +#define MIN_PLL_INP_FREQ CLK_MHZ(8)
2251 +#define MAX_PLL_INP_FREQ CLK_MHZ(100)
2253 +#define DIVIDER_LOCK_TIME 10100
2254 +#define PLL_LOCK_TIME 10100 * 75
2258 + /****************************************************************************
2259 + * DATA PURPOSE: PRIVATE Variables
2260 + **************************************************************************/
2261 + static u32 *clk_src[4];
2262 + static u32 mips_pll_out;
2263 + static u32 sys_pll_out;
2264 + static u32 afeclk_inp;
2265 + static u32 refclk_inp;
2266 + static u32 xtal_inp;
2267 + static u32 present_min;
2268 + static u32 present_max;
2270 + /* Forward References */
2271 + static u32 find_gcd(u32 min, u32 max);
2272 + static u32 compute_prediv( u32 divider, u32 min, u32 max);
2273 + static void get_val(u32 base_freq, u32 output_freq,u32 *multiplier, u32 *divider);
2274 + static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id);
2275 + static void find_approx(u32 *,u32 *,u32);
2277 + /****************************************************************************
2278 + * FUNCTION: tnetd73xx_clkc_init
2279 + ****************************************************************************
2280 + * Description: The routine initializes the internal variables depending on
2281 + * on the sources selected for different clocks.
2282 + ***************************************************************************/
2283 +void tnetd73xx_clkc_init(u32 afeclk, u32 refclk, u32 xtal3in)
2288 + afeclk_inp = afeclk;
2289 + refclk_inp = refclk;
2290 + xtal_inp = xtal3in;
2292 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & MIPS_PLL_SELECT;
2295 + case MIPS_AFECLKI_SELECT:
2296 + clk_src[CLKC_MIPS] = &afeclk_inp;
2299 + case MIPS_REFCLKI_SELECT:
2300 + clk_src[CLKC_MIPS] = &refclk_inp;
2303 + case MIPS_XTAL3IN_SELECT:
2304 + clk_src[CLKC_MIPS] = &xtal_inp;
2308 + clk_src[CLKC_MIPS] = 0;
2312 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & SYSTEM_PLL_SELECT;
2315 + case SYSTEM_AFECLKI_SELECT:
2316 + clk_src[CLKC_SYS] = &afeclk_inp;
2319 + case SYSTEM_REFCLKI_SELECT:
2320 + clk_src[CLKC_SYS] = &refclk_inp;
2323 + case SYSTEM_XTAL3IN_SELECT:
2324 + clk_src[CLKC_SYS] = &xtal_inp;
2327 + case SYSTEM_MIPSPLL_SELECT:
2328 + clk_src[CLKC_SYS] = &mips_pll_out;
2332 + clk_src[CLKC_SYS] = 0;
2337 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & ADSLSS_PLL_SELECT;
2340 + case ADSLSS_AFECLKI_SELECT:
2341 + clk_src[CLKC_ADSLSS] = &afeclk_inp;
2344 + case ADSLSS_REFCLKI_SELECT:
2345 + clk_src[CLKC_ADSLSS] = &refclk_inp;
2348 + case ADSLSS_XTAL3IN_SELECT:
2349 + clk_src[CLKC_ADSLSS] = &xtal_inp;
2352 + case ADSLSS_MIPSPLL_SELECT:
2353 + clk_src[CLKC_ADSLSS] = &mips_pll_out;
2357 + clk_src[CLKC_ADSLSS] = 0;
2362 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & USB_PLL_SELECT;
2365 + case USB_SYSPLL_SELECT:
2366 + clk_src[CLKC_USB] = &sys_pll_out ;
2369 + case USB_REFCLKI_SELECT:
2370 + clk_src[CLKC_USB] = &refclk_inp;
2373 + case USB_XTAL3IN_SELECT:
2374 + clk_src[CLKC_USB] = &xtal_inp;
2377 + case USB_MIPSPLL_SELECT:
2378 + clk_src[CLKC_USB] = &mips_pll_out;
2382 + clk_src[CLKC_USB] = 0;
2389 +/****************************************************************************
2390 + * FUNCTION: tnetd73xx_clkc_set_freq
2391 + ****************************************************************************
2392 + * Description: The above routine is called to set the output_frequency of the
2393 + * selected clock(using clk_id) to the required value given
2394 + * by the variable output_freq.
2395 + ***************************************************************************/
2396 +TNETD73XX_ERR tnetd73xx_clkc_set_freq
2398 + TNETD73XX_CLKC_ID_T clk_id,
2411 + /* check if PLLs are bypassed*/
2412 + if(REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS)
2414 + return TNETD73XX_ERR_ERROR;
2417 + /*check if the requested output_frequency is in valid range*/
2421 + if( output_freq < SYS_MIN || output_freq > SYS_MAX)
2423 + return TNETD73XX_ERR_ERROR;
2425 + present_min = SYS_MIN;
2426 + present_max = SYS_MAX;
2430 + if((output_freq < MIPS_MIN) ||
2431 + (output_freq > ((REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX)))
2433 + return TNETD73XX_ERR_ERROR;
2435 + present_min = MIPS_MIN;
2436 + present_max = (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX;
2440 + if( output_freq < USB_MIN || output_freq > USB_MAX)
2442 + return TNETD73XX_ERR_ERROR;
2444 + present_min = USB_MIN;
2445 + present_max = USB_MAX;
2449 + if( output_freq < ADSL_MIN || output_freq > ADSL_MAX)
2451 + return TNETD73XX_ERR_ERROR;
2453 + present_min = ADSL_MIN;
2454 + present_max = ADSL_MAX;
2459 + base_freq = get_base_frequency(clk_id);
2462 + /* check for minimum base frequency value */
2463 + if( base_freq < MIN_PLL_INP_FREQ)
2465 + return TNETD73XX_ERR_ERROR;
2468 + get_val(output_freq, base_freq, &multiplier, ÷r);
2470 + /* check multiplier range */
2471 + if( (multiplier > PLL_MUL_MAXFACTOR) || (multiplier <= 0) )
2473 + return TNETD73XX_ERR_ERROR;
2476 + /* check divider value */
2477 + if( divider == 0 )
2479 + return TNETD73XX_ERR_ERROR;
2482 + /*compute minimum and maximum predivider values */
2483 + min_prediv = MAX(base_freq / MAX_PLL_INP_FREQ + 1, divider / MAX_DIV_VALUE + 1);
2484 + max_prediv = MIN(base_freq / MIN_PLL_INP_FREQ, MAX_DIV_VALUE);
2486 + /*adjust the value of divider so that it not less than minimum predivider value*/
2487 + if (divider < min_prediv)
2489 + temp = CEIL(min_prediv, divider);
2490 + if ((temp * multiplier) > PLL_MUL_MAXFACTOR)
2492 + return TNETD73XX_ERR_ERROR ;
2496 + multiplier = temp * multiplier;
2497 + divider = min_prediv;
2502 + /* compute predivider and postdivider values */
2503 + prediv = compute_prediv (divider, min_prediv, max_prediv);
2504 + postdiv = CEIL(divider,prediv);
2506 + /*return fail if postdivider value falls out of range */
2507 + if(postdiv > MAX_DIV_VALUE)
2509 + return TNETD73XX_ERR_ERROR;
2513 + /*write predivider and postdivider values*/
2514 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2515 + REG32_WRITE(CLKC_CLKCR(clk_id), ((postdiv -1) & 0x1F) << 16 | ((prediv -1) & 0x1F) );
2517 + /*wait for divider output to stabilise*/
2518 + for(temp =0; temp < DIVIDER_LOCK_TIME; temp++);
2520 + /*write to PLL clock register*/
2522 + if(clk_id == CLKC_SYS)
2524 + /* but before writing put DRAM to hold mode */
2525 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) |= 0x80000000;
2527 + /*Bring PLL into div mode */
2528 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), 0x4);
2530 + /*compute the word to be written to PLLCR
2531 + *corresponding to multiplier value
2533 + multiplier = (((multiplier - 1) & 0xf) << 12)| ((255 <<3) | 0x0e);
2535 + /* wait till PLL enters div mode */
2536 + while(REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2539 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), multiplier);
2541 + while(!REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2545 + /*wait for External pll to lock*/
2546 + for(temp =0; temp < PLL_LOCK_TIME; temp++);
2548 + if(clk_id == CLKC_SYS)
2550 + /* Bring DRAM out of hold */
2551 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) &= ~0x80000000;
2554 + return TNETD73XX_ERR_OK ;
2557 +/****************************************************************************
2558 + * FUNCTION: tnetd73xx_clkc_get_freq
2559 + ****************************************************************************
2560 + * Description: The above routine is called to get the output_frequency of the
2561 + * selected clock( clk_id)
2562 + ***************************************************************************/
2563 +u32 tnetd73xx_clkc_get_freq
2565 + TNETD73XX_CLKC_ID_T clk_id
2569 + u32 clk_ctrl_register;
2570 + u32 clk_pll_setting;
2571 + u32 clk_predivider;
2572 + u32 clk_postdivider;
2577 + base_freq = get_base_frequency(clk_id);
2579 + clk_ctrl_register = REG32_DATA(CLKC_CLKCR(clk_id));
2581 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2582 + clk_predivider = (CLKC_PRE_DIVIDER & clk_ctrl_register) + 1;
2583 + clk_postdivider = ((CLKC_POST_DIVIDER & clk_ctrl_register) >> 16) + 1;
2585 + divider = clk_predivider * clk_postdivider;
2588 + if( (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS))
2590 + return (CEIL(base_freq, divider)); /* PLLs bypassed.*/
2596 + /* return the current clock speed based upon the PLL setting */
2597 + clk_pll_setting = REG32_DATA(CLKC_CLKPLLCR(clk_id));
2599 + /* Get the PLL multiplication factor */
2600 + pll_factor = ((clk_pll_setting & CLKC_PLL_FACTOR) >> 12) + 1;
2602 + /* Check if we're in divide mode or multiply mode */
2603 + if((clk_pll_setting & 0x1) == 0)
2605 + /* We're in divide mode */
2606 + if(pll_factor < 0x10)
2607 + return (CEIL(base_freq >> 1, divider));
2609 + return (CEIL(base_freq >> 2, divider));
2612 + else /* We're in PLL mode */
2614 + /* See if PLLNDIV & PLLDIV are set */
2615 + if((clk_pll_setting & 0x0800) && (clk_pll_setting & 0x2))
2617 + if(clk_pll_setting & 0x1000)
2619 + /* clk = base_freq * k/2 */
2620 + return(CEIL((base_freq * pll_factor) >> 1, divider));
2624 + /* clk = base_freq * (k-1) / 4)*/
2625 + return(CEIL((base_freq * (pll_factor - 1)) >>2, divider));
2630 + if(pll_factor < 0x10)
2632 + /* clk = base_freq * k */
2633 + return(CEIL(base_freq * pll_factor, divider));
2638 + /* clk = base_freq */
2639 + return(CEIL(base_freq, divider));
2643 + return(0); /* Should never reach here */
2650 +/* local helper functions */
2652 +/****************************************************************************
2653 + * FUNCTION: get_base_frequency
2654 + ****************************************************************************
2655 + * Description: The above routine is called to get base frequency of the clocks.
2656 + ***************************************************************************/
2658 +static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id)
2660 + /* update the current MIPs PLL output value, if the required
2661 + * source is MIPS PLL
2663 + if ( clk_src[clk_id] == &mips_pll_out)
2665 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_MIPS);
2669 + /* update the current System PLL output value, if the required
2670 + * source is system PLL
2672 + if ( clk_src[clk_id] == &sys_pll_out)
2674 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_SYS);
2677 + return (*clk_src[clk_id]);
2683 +/****************************************************************************
2684 + * FUNCTION: find_gcd
2685 + ****************************************************************************
2686 + * Description: The above routine is called to find gcd of 2 numbers.
2687 + ***************************************************************************/
2688 +static u32 find_gcd
2694 + if (max % min == 0)
2700 + return find_gcd(max % min, min);
2704 +/****************************************************************************
2705 + * FUNCTION: compute_prediv
2706 + ****************************************************************************
2707 + * Description: The above routine is called to compute predivider value
2708 + ***************************************************************************/
2709 +static u32 compute_prediv(u32 divider, u32 min, u32 max)
2713 + /* return the divider itself it it falls within the range of predivider*/
2714 + if (min <= divider && divider <= max)
2719 + /* find a value for prediv such that it is a factor of divider */
2720 + for (prediv = max; prediv >= min ; prediv--)
2722 + if ( (divider % prediv) == 0 )
2728 + /* No such factor exists, return min as prediv */
2732 +/****************************************************************************
2733 + * FUNCTION: get_val
2734 + ****************************************************************************
2735 + * Description: This routine is called to get values of divider and multiplier.
2736 + ***************************************************************************/
2738 +static void get_val(u32 output_freq, u32 base_freq,u32 *multiplier, u32 *divider)
2746 + /* find gcd of base_freq, output_freq */
2747 + min_freq = (base_freq < output_freq) ? base_freq : output_freq;
2748 + max_freq = (base_freq > output_freq) ? base_freq : output_freq;
2749 + gcd = find_gcd(min_freq , max_freq);
2752 + return; /* ERROR */
2754 + /* compute values of multiplier and divider */
2755 + temp_mul = output_freq / gcd;
2756 + temp_div = base_freq / gcd;
2759 + /* set multiplier such that 1 <= multiplier <= PLL_MUL_MAXFACTOR */
2760 + if( temp_mul > PLL_MUL_MAXFACTOR )
2762 + if((temp_mul / temp_div) > PLL_MUL_MAXFACTOR)
2765 + find_approx(&temp_mul,&temp_div,base_freq);
2768 + *multiplier = temp_mul;
2769 + *divider = temp_div;
2772 +/****************************************************************************
2773 + * FUNCTION: find_approx
2774 + ****************************************************************************
2775 + * Description: This function gets the approx value of num/denom.
2776 + ***************************************************************************/
2778 +static void find_approx(u32 *num,u32 *denom,u32 base_freq)
2785 + int32_t prev_closest;
2795 + prev_closest = 0x7fffffff; /* maximum possible value */
2799 + /* start with max */
2800 + for(temp_num = 15; temp_num >=1; temp_num--)
2803 + temp_denom = CEIL(temp_num * denom1, num1);
2804 + output_freq = (temp_num * base_freq) / temp_denom;
2806 + if(temp_denom < 1)
2812 + normalize = CEIL(num1,temp_num);
2813 + closest = (ABS((num1 * (temp_denom) ) - (temp_num * denom1))) * normalize;
2814 + if(closest < prev_closest && output_freq > present_min && output_freq <present_max)
2816 + prev_closest = closest;
2818 + denom2 = temp_denom;
2825 + gcd = find_gcd(num2,denom2);
2826 + num2 = num2 / gcd;
2827 + denom2 = denom2 /gcd;
2834 +/*****************************************************************************
2836 + *****************************************************************************/
2838 +/****************************************************************************
2839 + * FUNCTION: tnetd73xx_gpio_init
2840 + ***************************************************************************/
2841 +void tnetd73xx_gpio_init()
2843 + /* Bring module out of reset */
2844 + tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
2845 + REG32_WRITE(TNETD73XX_GPIOENR, 0xFFFFFFFF);
2848 +/****************************************************************************
2849 + * FUNCTION: tnetd73xx_gpio_ctrl
2850 + ***************************************************************************/
2851 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
2852 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
2853 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction)
2856 + REG32_READ(TNETD73XX_GPIOENR, pin_status);
2857 + if (pin_mode == GPIO_PIN)
2859 + pin_status |= (1 << gpio_pin);
2860 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2862 + /* Set pin direction */
2863 + REG32_READ(TNETD73XX_GPIOPDIRR, pin_status);
2864 + if (pin_direction == GPIO_INPUT_PIN)
2866 + pin_status |= (1 << gpio_pin);
2868 + else /* GPIO_OUTPUT_PIN */
2870 + pin_status &= (~(1 << gpio_pin));
2872 + REG32_WRITE(TNETD73XX_GPIOPDIRR, pin_status);
2874 + else /* FUNCTIONAL PIN */
2876 + pin_status &= (~(1 << gpio_pin));
2877 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2882 +/****************************************************************************
2883 + * FUNCTION: tnetd73xx_gpio_out
2884 + ***************************************************************************/
2885 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value)
2889 + REG32_READ(TNETD73XX_GPIODOUTR, pin_value);
2892 + pin_value |= (1 << gpio_pin);
2896 + pin_value &= (~(1 << gpio_pin));
2898 + REG32_WRITE(TNETD73XX_GPIODOUTR, pin_value);
2901 +/****************************************************************************
2902 + * FUNCTION: tnetd73xx_gpio_in
2903 + ***************************************************************************/
2904 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin)
2907 + REG32_READ(TNETD73XX_GPIODINR, pin_value);
2908 + return ( (pin_value & (1 << gpio_pin)) ? 1 : 0 );
2911 diff -urN linux-2.4.30/arch/mips/config-shared.in linux-2.4.30.current/arch/mips/config-shared.in
2912 --- linux-2.4.30/arch/mips/config-shared.in 2005-06-11 20:24:09.000000000 +0200
2913 +++ linux-2.4.30.current/arch/mips/config-shared.in 2005-06-12 20:14:28.000000000 +0200
2915 mainmenu_option next_comment
2916 comment 'Machine selection'
2917 dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL
2918 +dep_bool 'Support for Texas Instruments AR7 (EXPERIMENTAL)' CONFIG_AR7 $CONFIG_MIPS32 $CONFIG_EXPERIMENTAL
2919 +if [ "$CONFIG_AR7" = "y" ]; then
2920 + choice 'Texas Instruments Reference Platform' \
2921 + "AR7DB CONFIG_AR7DB \
2922 + AR7RD CONFIG_AR7RD \
2923 + AR7WRD CONFIG_AR7WRD" AR7DB
2924 + int 'Texas Instruments AR7 CPU Frequency' CONFIG_AR7_FREQUENCY 150
2925 + hex 'Texas Instruments AR7 SDRAM Start' CONFIG_AR7_MEMORY 0x14000000
2927 dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32
2928 dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32
2929 dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32
2930 @@ -239,6 +248,11 @@
2931 define_bool CONFIG_NONCOHERENT_IO y
2932 define_bool CONFIG_PC_KEYB y
2934 +if [ "$CONFIG_AR7" = "y" ]; then
2935 + define_bool CONFIG_NONCOHERENT_IO y
2936 + define_bool CONFIG_SWAP_IO_SPACE y
2937 + define_bool CONFIG_AR7_PAGING y
2939 if [ "$CONFIG_CASIO_E55" = "y" ]; then
2940 define_bool CONFIG_IRQ_CPU y
2941 define_bool CONFIG_NONCOHERENT_IO y
2943 mainmenu_option next_comment
2944 comment 'General setup'
2945 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2946 + "$CONFIG_AR7" = "y" -o \
2947 "$CONFIG_CASIO_E55" = "y" -o \
2948 "$CONFIG_DDB5074" = "y" -o \
2949 "$CONFIG_DDB5476" = "y" -o \
2951 bool 'Networking support' CONFIG_NET
2953 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2954 + "$CONFIG_AR7" = "y" -o \
2955 "$CONFIG_CASIO_E55" = "y" -o \
2956 "$CONFIG_DECSTATION" = "y" -o \
2957 "$CONFIG_IBM_WORKPAD" = "y" -o \
2958 diff -urN linux-2.4.30/arch/mips/kernel/irq.c linux-2.4.30.current/arch/mips/kernel/irq.c
2959 --- linux-2.4.30/arch/mips/kernel/irq.c 2004-02-18 14:36:30.000000000 +0100
2960 +++ linux-2.4.30.current/arch/mips/kernel/irq.c 2005-06-12 20:21:34.000000000 +0200
2962 * Generic, controller-independent functions:
2966 int get_irq_list(char *buf)
2970 p += sprintf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
2976 int global_irq_holder = NO_PROC_ID;
2982 int request_irq(unsigned int irq,
2983 void (*handler)(int, void *, struct pt_regs *),
2984 unsigned long irqflags,
2992 * free_irq - free an interrupt
2998 void free_irq(unsigned int irq, void *dev_id)
3008 * IRQ autodetection code..
3009 diff -urN linux-2.4.30/arch/mips/kernel/setup.c linux-2.4.30.current/arch/mips/kernel/setup.c
3010 --- linux-2.4.30/arch/mips/kernel/setup.c 2005-06-11 20:24:07.000000000 +0200
3011 +++ linux-2.4.30.current/arch/mips/kernel/setup.c 2005-06-12 20:14:28.000000000 +0200
3013 unsigned long isa_slot_offset;
3014 EXPORT_SYMBOL(isa_slot_offset);
3016 +extern void avalanche_bootmem_init(void);
3017 extern void SetUpBootInfo(void);
3018 extern void load_mmu(void);
3019 extern asmlinkage void start_kernel(void);
3021 #endif /* CONFIG_BLK_DEV_INITRD */
3023 /* Find the highest page frame number we have available. */
3024 +#ifdef CONFIG_AR7_PAGING
3025 + avalanche_bootmem_init();
3028 first_usable_pfn = -1UL;
3029 for (i = 0; i < boot_mem_map.nr_map; i++) {
3032 /* Reserve the bootmap memory. */
3033 reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
3036 #ifdef CONFIG_BLK_DEV_INITRD
3037 /* Board specific code should have set up initrd_start and initrd_end */
3038 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
3040 void hp_setup(void);
3041 void au1x00_setup(void);
3042 void frame_info_init(void);
3043 + void ar7_setup(void);
3046 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
3047 @@ -691,6 +696,11 @@
3048 pmc_yosemite_setup();
3052 + case MACH_GROUP_UNKNOWN:
3057 panic("Unsupported architecture");
3059 diff -urN linux-2.4.30/arch/mips/kernel/traps.c linux-2.4.30.current/arch/mips/kernel/traps.c
3060 --- linux-2.4.30/arch/mips/kernel/traps.c 2005-06-11 20:24:07.000000000 +0200
3061 +++ linux-2.4.30.current/arch/mips/kernel/traps.c 2005-06-12 20:24:13.000000000 +0200
3063 #include <asm/uaccess.h>
3064 #include <asm/mmu_context.h>
3067 +#include <asm/ar7/ar7.h>
3070 extern asmlinkage void handle_mod(void);
3071 extern asmlinkage void handle_tlbl(void);
3072 extern asmlinkage void handle_tlbs(void);
3073 @@ -920,14 +924,37 @@
3074 void __init trap_init(void)
3076 extern char except_vec1_generic;
3077 + extern char except_vec2_generic;
3078 extern char except_vec3_generic, except_vec3_r4000;
3079 extern char except_vec_ejtag_debug;
3080 extern char except_vec4;
3084 + extern char jump_tlb_miss, jump_tlb_miss_unused;
3085 + extern char jump_cache_error,jump_general_exception;
3086 + extern char jump_dedicated_interrupt;
3087 + clear_c0_status(ST0_BEV);
3090 /* Copy the generic exception handler code to it's final destination. */
3091 memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
3094 + memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
3095 + memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
3096 + flush_icache_range(KSEG0, KSEG0 + 0x200);
3098 + /* jump table to exception routines */
3100 + memcpy((void *)(KSEG0 + 0x0), &jump_tlb_miss, 0x80);
3101 + memcpy((void *)(KSEG0 + 0x80), &jump_tlb_miss_unused, 0x80);
3102 + memcpy((void *)(KSEG0 + 0x100), &jump_cache_error, 0x80);
3103 + memcpy((void *)(KSEG0 + 0x180), &jump_general_exception, 0x80);
3104 + memcpy((void *)(KSEG0 + 0x200), &jump_dedicated_interrupt, 0x80);
3105 + flush_icache_range(KSEG0 + 0x80, KSEG0 + 0x200);
3109 * Setup default vectors
3111 diff -urN linux-2.4.30/arch/mips/lib/promlib.c linux-2.4.30.current/arch/mips/lib/promlib.c
3112 --- linux-2.4.30/arch/mips/lib/promlib.c 2003-08-25 13:44:40.000000000 +0200
3113 +++ linux-2.4.30.current/arch/mips/lib/promlib.c 2005-06-12 20:14:28.000000000 +0200
3117 #include <linux/kernel.h>
3124 diff -urN linux-2.4.30/arch/mips/mm/init.c linux-2.4.30.current/arch/mips/mm/init.c
3125 --- linux-2.4.30/arch/mips/mm/init.c 2004-02-18 14:36:30.000000000 +0100
3126 +++ linux-2.4.30.current/arch/mips/mm/init.c 2005-06-12 20:14:28.000000000 +0200
3129 mmu_gather_t mmu_gathers[NR_CPUS];
3130 unsigned long highstart_pfn, highend_pfn;
3131 +#ifndef CONFIG_AR7_PAGING
3132 static unsigned long totalram_pages;
3133 static unsigned long totalhigh_pages;
3136 void pgd_init(unsigned long page)
3142 +#ifndef CONFIG_AR7_PAGING
3143 void __init paging_init(void)
3145 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
3148 free_area_init(zones_size);
3152 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
3153 #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
3158 +#ifndef CONFIG_AR7_PAGING
3159 void __init mem_init(void)
3161 unsigned long codesize, reservedpages, datasize, initsize;
3164 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
3168 #ifdef CONFIG_BLK_DEV_INITRD
3169 void free_initrd_mem(unsigned long start, unsigned long end)
3174 +#ifndef CONFIG_AR7_PAGING
3175 extern char __init_begin, __init_end;
3176 extern void prom_free_prom_memory(void) __init;
3183 prom_free_prom_memory ();
3186 addr = (unsigned long) &__init_begin;
3187 while (addr < (unsigned long) &__init_end) {
3193 diff -urN linux-2.4.30/arch/mips/mm/tlb-r4k.c linux-2.4.30.current/arch/mips/mm/tlb-r4k.c
3194 --- linux-2.4.30/arch/mips/mm/tlb-r4k.c 2005-06-11 20:24:07.000000000 +0200
3195 +++ linux-2.4.30.current/arch/mips/mm/tlb-r4k.c 2005-06-12 20:14:28.000000000 +0200
3197 #include <asm/pgtable.h>
3198 #include <asm/system.h>
3201 +#include <asm/ar7/ar7.h>
3204 extern char except_vec0_nevada, except_vec0_r4000, except_vec0_r4600;
3206 /* CP0 hazard avoidance. */
3207 diff -urN linux-2.4.30/drivers/char/serial.c linux-2.4.30.current/drivers/char/serial.c
3208 --- linux-2.4.30/drivers/char/serial.c 2005-06-11 20:24:07.000000000 +0200
3209 +++ linux-2.4.30.current/drivers/char/serial.c 2005-06-12 20:14:28.000000000 +0200
3210 @@ -419,7 +419,40 @@
3214 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3215 +#if defined(CONFIG_AR7)
3217 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
3219 + return (inb(info->port + (offset * 4)) & 0xff);
3223 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
3225 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3226 + return (inb(info->port + (offset * 4)) & 0xff);
3228 + return (inb_p(info->port + (offset * 4)) & 0xff);
3232 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
3234 + outb(value, info->port + (offset * 4));
3238 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
3241 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3242 + outb(value, info->port + (offset * 4));
3244 + outb_p(value, info->port + (offset * 4));
3248 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3250 #include <asm/mips-boards/atlas.h>
3252 @@ -478,8 +511,10 @@
3253 * needed for certain old 386 machines, I've left these #define's
3257 #define serial_inp(info, offset) serial_in(info, offset)
3258 #define serial_outp(info, offset, value) serial_out(info, offset, value)
3263 @@ -1728,7 +1763,15 @@
3264 /* Special case since 134 is really 134.5 */
3265 quot = (2*baud_base / 269);
3268 + quot = get_avalanche_vbus_freq() / baud;
3274 quot = baud_base / baud;
3277 /* If the quotient is zero refuse the change */
3278 if (!quot && old_termios) {
3279 @@ -5552,8 +5595,10 @@
3280 state->irq = irq_cannonicalize(state->irq);
3282 state->io_type = SERIAL_IO_HUB6;
3284 if (state->port && check_region(state->port,8))
3288 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
3290 @@ -6009,7 +6054,15 @@
3291 info->io_type = state->io_type;
3292 info->iomem_base = state->iomem_base;
3293 info->iomem_reg_shift = state->iomem_reg_shift;
3295 + quot = get_avalanche_vbus_freq() / baud;
3301 quot = state->baud_base / baud;
3303 cval = cflag & (CSIZE | CSTOPB);
3304 #if defined(__powerpc__) || defined(__alpha__)
3306 Binary files linux-2.4.30/include/asm-mips/.addrspace.h.swp and linux-2.4.30.current/include/asm-mips/.addrspace.h.swp differ
3307 diff -urN linux-2.4.30/include/asm-mips/ar7/ar7.h linux-2.4.30.current/include/asm-mips/ar7/ar7.h
3308 --- linux-2.4.30/include/asm-mips/ar7/ar7.h 1970-01-01 01:00:00.000000000 +0100
3309 +++ linux-2.4.30.current/include/asm-mips/ar7/ar7.h 2005-06-12 20:59:09.000000000 +0200
3311 +#ifndef _MIPS_AR7_H
3312 +#define _MIPS_AR7_H
3314 +#include <linux/config.h>
3315 +#include <asm/addrspace.h>
3318 +#ifndef LITTLE_ENDIAN
3319 +#define LITTLE_ENDIAN
3322 +#ifndef _LINK_KSEG0_
3323 +#define _LINK_KSEG0_
3326 +#include <asm/ar7/tnetd73xx.h>
3328 +#define AVALANCHE_UART0_INT 7
3329 +#define AVALANCHE_UART1_INT 8
3331 +#define MIPS_EXCEPTION_OFFSET 8
3332 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3335 + * AR7 board SDRAM base address. This is used to setup the
3339 +#define AVALANCHE_SDRAM_BASE CONFIG_AR7_MEMORY//0x14000000UL
3340 +#define AVALANCHE_INTC_BASE TNETD73XX_INTC_BASE
3344 + * AR7 board vectors
3347 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
3348 +#define AVALANCHE_VECS_KSEG0 (CPHYSADDR(AVALANCHE_SDRAM_BASE) | 0x80000000)
3350 +#define KSEG0 AVALANCHE_VECS_KSEG0
3353 + * Yamon Prom print address.
3355 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
3356 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
3357 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
3360 + * AR7 Reset and PSU standby register.
3362 +#define AVALANCHE_SOFTRES_REG (KSEG1ADDR(0x08611600)) /* Resets machine */
3363 +#define AVALANCHE_PSUSTBY_REG (KSEG1ADDR(0x08611600)) /* Turns off power supply unit */
3364 +#define AVALANCHE_GORESET 0x1
3365 +#define AVALANCHE_GOSTBY 0x1
3366 +#define AVALANCHE_SWRCR (*(unsigned int *)TNETD73XX_RST_CTRL_SWRCR)
3369 + * Avalanche UART register base.
3372 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
3373 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 1 */
3374 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
3377 + * AVALANCHE DMA controller base
3380 +#define AVALANCHE_DMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* DMA 0 (channels 0-3) */
3385 + * GPIO register map
3388 +/* to be obtained from avalanche_map.h */
3389 +#define AVALANCHE_GPIO_WRITE_REG (KSEG1ADDR(0xa8610904))
3390 +#define AVALANCHE_GPIO_DIRECTION_REG (KSEG1ADDR(0xa8610908))
3391 +#define AVALANCHE_GPIO_MODE_REG (KSEG1ADDR(0xa861090C))
3392 +#define AVALANCHE_GPIO_PIN_COUNT 32
3393 +#define AVALANCHE_GPIO_OFF_MAP {0xF34FFFC0,0}
3396 +// Let us define board specific information here.
3398 +#if defined(CONFIG_AR7DB)
3400 +#define AFECLK_FREQ 35328000
3401 +#define REFCLK_FREQ 25000000
3402 +#define OSC3_FREQ 24000000
3403 +#define AVALANCHE_CPMAC_INTERNAL_PHY_MASK 0x80000000
3404 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x55555555
3409 +#if defined(CONFIG_AR7RD)
3411 +#define AFECLK_FREQ 35328000
3412 +#define REFCLK_FREQ 25000000
3413 +#define OSC3_FREQ 24000000
3414 +#define AVALANCHE_CPMAC_INTERNAL_PHY_MASK 0x80000000
3416 +#if defined(CONFIG_AR7_MARVELL)
3417 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x00010000
3419 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x2
3425 +#if defined(CONFIG_AR7WRD)
3427 +#define AFECLK_FREQ 35328000
3428 +#define REFCLK_FREQ 25000000
3429 +#define OSC3_FREQ 24000000
3430 +#define AVALANCHE_CPMAC_INTERNAL_PHY_MASK 0x80000000
3432 +#if defined(CONFIG_AR7_MARVELL)
3433 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x00010000
3435 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x2
3440 +extern unsigned int tnetd73xx_vbus_freq;
3441 +#define AVALANCHE_VBUS_FREQ tnetd73xx_vbus_freq
3443 +static inline unsigned int get_avalanche_vbus_freq(void)
3445 + return (tnetd73xx_vbus_freq);
3448 +#endif /*_MIPS_AR7_H */
3449 diff -urN linux-2.4.30/include/asm-mips/ar7/avalanche.h linux-2.4.30.current/include/asm-mips/ar7/avalanche.h
3450 --- linux-2.4.30/include/asm-mips/ar7/avalanche.h 1970-01-01 01:00:00.000000000 +0100
3451 +++ linux-2.4.30.current/include/asm-mips/ar7/avalanche.h 2005-06-12 20:14:28.000000000 +0200
3457 + * Jeff Harrell, jharrell@ti.com
3458 + * Copyright (C) 2000,2001,2002 Texas Instruments Inc.
3461 + * ########################################################################
3463 + * This program is free software; you can distribute it and/or modify it
3464 + * under the terms of the GNU General Public License (Version 2) as
3465 + * published by the Free Software Foundation.
3467 + * This program is distributed in the hope it will be useful, but WITHOUT
3468 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3469 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3470 + * for more details.
3472 + * You should have received a copy of the GNU General Public License along
3473 + * with this program; if not, write to the Free Software Foundation, Inc.,
3474 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
3476 + * ########################################################################
3478 + * Defines of the AVALANCHE board specific address-MAP, registers, etc.
3481 +#ifndef _MIPS_AVALANCHE_H
3482 +#define _MIPS_AVALANCHE_H
3484 +#include <asm/addrspace.h>
3487 + * AVALANCHE board SDRAM base address. This is used to setup the
3491 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
3494 + * AVALANCHE board vectors
3497 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
3498 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
3500 + * Avalanche RTC-device indirect register access.
3503 +#define EVM3_RTC_ADR_REG (KSEG1ADDR(0x1f000800))
3504 +#define EVM3_RTC_DAT_REG (KSEG1ADDR(0x1f000808))
3507 + * Evm3 interrupt controller register base (primary)
3510 +#define AVALANCHE_ICTRL_REGS_BASE (KSEG1ADDR(0x08612400))
3513 + * Avalanche exception controller register base (secondary)
3515 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE+0x80)
3519 + * Avalanche Interrupt Channel Control register base
3521 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
3525 + * Avalanche UART register base.
3528 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
3529 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 1 */
3530 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
3532 + * AVALANCHE DMA controller base
3535 +#define AVALANCHE_DMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* DMA 0 (channels 0-3) */
3539 + * AVALANCHE display register base.
3542 +#define EVM3_ASCII_DISPLAY_POS_BASE (KSEG1ADDR(0x1D000038))
3543 +#define EVM3_ASCII_DISPLAY_WORD_BASE (KSEG1ADDR(0x1D00003F)) /* How is this used??? JAH */
3546 +#define EVM3_ASCIIPOS0 0x1D000038
3547 +#define EVM3_ASCIIPOS1 0x1D000039
3548 +#define EVM3_ASCIIPOS2 0x1D00003A
3549 +#define EVM3_ASCIIPOS3 0x1D00003B
3550 +#define EVM3_ASCIIPOS4 0x1D00003C
3551 +#define EVM3_ASCIIPOS5 0x1D00003D
3552 +#define EVM3_ASCIIPOS6 0x1D00003E
3553 +#define EVM3_ASCIIPOS7 0x1D00003F
3556 + * Yamon Prom print address.
3558 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
3559 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
3560 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
3563 + * Evm3 Reset and PSU standby register.
3565 +#define AVALANCHE_SOFTRES_REG (KSEG1ADDR(0x08611600)) /* Resets machine */
3566 +#define AVALANCHE_PSUSTBY_REG (KSEG1ADDR(0x08611600)) /* Turns off power supply unit */
3567 +#define AVALANCHE_GORESET 0x1
3568 +#define AVALANCHE_GOSTBY 0x1
3570 +/************************************************************************
3571 + * PERIPHERAL BUS LEDs (P-LED):
3572 +*************************************************************************/
3574 +/************************************************************************
3575 + * P-LED Register Addresses
3576 +*************************************************************************/
3578 +#define EVM3_PLED (KSEG1ADDR(0x01C500000)) /* 0x1D200000 P-LED */
3581 +/************************************************************************
3582 + * Register field encodings
3583 +*************************************************************************/
3585 +/******** reg: PLED ********/
3586 +/* bits 7:0: VAL */
3587 +#define EVM3_PLED_VAL_MSK 0xff
3590 +#define EVM3_PLED_BIT0_SHF 0
3591 +#define EVM3_PLED_BIT0_MSK (1 << EVM3_PLED_BIT0_SHF)
3592 +#define EVM3_PLED_BIT0_ON EVM3_PLED_BIT0_MSK
3595 +#define EVM3_PLED_BIT1_SHF 1
3596 +#define EVM3_PLED_BIT1_MSK (1 << EVM3_PLED_BIT1_SHF)
3597 +#define EVM3_PLED_BIT1_ON EVM3_PLED_BIT1_MSK
3600 +#define EVM3_PLED_BIT2_SHF 2
3601 +#define EVM3_PLED_BIT2_MSK (1 << EVM3_PLED_BIT2_SHF)
3602 +#define EVM3_PLED_BIT2_ON EVM3_PLED_BIT2_MSK
3605 +#define EVM3_PLED_BIT3_SHF 3
3606 +#define EVM3_PLED_BIT3_MSK (1 << EVM3_PLED_BIT3_SHF)
3607 +#define EVM3_PLED_BIT3_ON EVM3_PLED_BIT3_MSK
3610 +#define EVM3_PLED_BIT4_SHF 4
3611 +#define EVM3_PLED_BIT4_MSK (1 << EVM3_PLED_BIT4_SHF)
3612 +#define EVM3_PLED_BIT4_ON EVM3_PLED_BIT4_MSK
3615 +#define EVM3_PLED_BIT5_SHF 5
3616 +#define EVM3_PLED_BIT5_MSK (1 << EVM3_PLED_BIT5_SHF)
3617 +#define EVM3_PLED_BIT5_ON EVM3_PLED_BIT5_MSK
3620 +#define EVM3_PLED_BIT6_SHF 6
3621 +#define EVM3_PLED_BIT6_MSK (1 << EVM3_PLED_BIT6_SHF)
3622 +#define EVM3_PLED_BIT6_ON EVM3_PLED_BIT6_MSK
3625 +#define EVM3_PLED_BIT7_SHF 7
3626 +#define EVM3_PLED_BIT7_MSK (1 << EVM3_PLED_BIT7_SHF)
3627 +#define EVM3_PLED_BIT7_ON EVM3_PLED_BIT7_MSK
3629 +#endif /* !(_MIPS_AVALANCHE_H) */
3636 diff -urN linux-2.4.30/include/asm-mips/ar7/avalanche_int.h linux-2.4.30.current/include/asm-mips/ar7/avalanche_int.h
3637 --- linux-2.4.30/include/asm-mips/ar7/avalanche_int.h 1970-01-01 01:00:00.000000000 +0100
3638 +++ linux-2.4.30.current/include/asm-mips/ar7/avalanche_int.h 2005-06-12 20:14:28.000000000 +0200
3644 + * Jeff Harrell, jharrell@ti.com
3645 + * Copyright (C) 2000,2001 Texas Instruments , Inc.
3647 + * ########################################################################
3649 + * This program is free software; you can distribute it and/or modify it
3650 + * under the terms of the GNU General Public License (Version 2) as
3651 + * published by the Free Software Foundation.
3653 + * This program is distributed in the hope it will be useful, but WITHOUT
3654 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3655 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3656 + * for more details.
3658 + * You should have received a copy of the GNU General Public License along
3659 + * with this program; if not, write to the Free Software Foundation, Inc.,
3660 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
3662 + * ########################################################################
3664 + * Defines for the AVALANCHE interrupt controller.
3667 +#ifndef _MIPS_AVALANCHEINT_H
3668 +#define _MIPS_AVALANCHEINT_H
3670 +#include <linux/config.h>
3672 +/* Avalanche Interrupt number */
3673 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
3674 +/* Linux Interrupt number */
3675 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3676 +/* Number of IRQ supported on hw interrupt 0. */
3678 +//#define SEADINT_UART0 3 /* TTYS0 interrupt on SEAD */
3679 +//#define SEADINT_UART1 4 /* TTYS1 interrupt on SEAD */
3682 +#define MIPS_EXCEPTION_OFFSET 8
3683 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
3684 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
3686 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
3687 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
3690 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
3691 + + MIPS_EXCEPTION_OFFSET - 1)
3693 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
3695 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 */ /* 0x00 */
3696 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 */ /* 0x04 */
3697 + volatile unsigned long unused1; /* 0x08 */
3698 + volatile unsigned long unused2; /* 0x0C */
3699 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 */ /* 0x10 */
3700 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 */ /* 0x14 */
3701 + volatile unsigned long unused3; /* 0x18 */
3702 + volatile unsigned long unused4; /* 0x1C */
3703 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 */ /* 0x20 */
3704 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 */ /* 0x24 */
3705 + volatile unsigned long unused5; /* 0x28 */
3706 + volatile unsigned long unused6; /* 0x2C */
3707 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 */ /* 0x30 */
3708 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 */ /* 0x34 */
3709 + volatile unsigned long unused7; /* 0x38 */
3710 + volatile unsigned long unused8; /* 0x3c */
3711 + volatile unsigned long pintir; /* Priority Interrupt Index Register */ /* 0x40 */
3712 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg.*/ /* 0x44 */
3713 + volatile unsigned long unused9; /* 0x48 */
3714 + volatile unsigned long unused10; /* 0x4C */
3715 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 1*/ /* 0x50 */
3716 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 2*/ /* 0x54 */
3719 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
3721 + volatile unsigned long exsr; /* Exceptions Status/Set register */ /* 0x80 */
3722 + volatile unsigned long reserved; /* 0x84 */
3723 + volatile unsigned long excr; /* Exceptions Clear Register */ /* 0x88 */
3724 + volatile unsigned long reserved1; /* 0x8c */
3725 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) */ /* 0x90 */
3726 + volatile unsigned long reserved2; /* 0x94 */
3727 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable (clear)*/ /* 0x98 */
3730 +struct avalanche_channel_int_number
3732 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register */ /* 0x200 */
3733 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register */ /* 0x204 */
3734 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register */ /* 0x208 */
3735 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register */ /* 0x20C */
3736 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register */ /* 0x210 */
3737 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register */ /* 0x214 */
3738 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register */ /* 0x218 */
3739 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register */ /* 0x21C */
3740 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register */ /* 0x220 */
3741 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register */ /* 0x224 */
3742 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register */ /* 0x228 */
3743 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register */ /* 0x22C */
3744 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register */ /* 0x230 */
3745 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register */ /* 0x234 */
3746 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register */ /* 0x238 */
3747 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register */ /* 0x23C */
3748 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register */ /* 0x240 */
3749 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register */ /* 0x244 */
3750 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register */ /* 0x248 */
3751 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register */ /* 0x24C */
3752 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register */ /* 0x250 */
3753 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register */ /* 0x254 */
3754 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register */ /* 0x358 */
3755 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register */ /* 0x35C */
3756 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register */ /* 0x260 */
3757 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register */ /* 0x264 */
3758 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register */ /* 0x268 */
3759 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register */ /* 0x26C */
3760 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register */ /* 0x270 */
3761 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register */ /* 0x274 */
3762 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register */ /* 0x278 */
3763 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register */ /* 0x27C */
3764 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register */ /* 0x280 */
3765 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register */ /* 0x284 */
3766 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register */ /* 0x288 */
3767 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register */ /* 0x28C */
3768 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register */ /* 0x290 */
3769 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register */ /* 0x294 */
3770 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register */ /* 0x298 */
3771 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register */ /* 0x29C */
3774 +struct avalanche_interrupt_line_to_channel
3776 + unsigned long int_line0; /* Start of primary interrupts */
3777 + unsigned long int_line1;
3778 + unsigned long int_line2;
3779 + unsigned long int_line3;
3780 + unsigned long int_line4;
3781 + unsigned long int_line5;
3782 + unsigned long int_line6;
3783 + unsigned long int_line7;
3784 + unsigned long int_line8;
3785 + unsigned long int_line9;
3786 + unsigned long int_line10;
3787 + unsigned long int_line11;
3788 + unsigned long int_line12;
3789 + unsigned long int_line13;
3790 + unsigned long int_line14;
3791 + unsigned long int_line15;
3792 + unsigned long int_line16;
3793 + unsigned long int_line17;
3794 + unsigned long int_line18;
3795 + unsigned long int_line19;
3796 + unsigned long int_line20;
3797 + unsigned long int_line21;
3798 + unsigned long int_line22;
3799 + unsigned long int_line23;
3800 + unsigned long int_line24;
3801 + unsigned long int_line25;
3802 + unsigned long int_line26;
3803 + unsigned long int_line27;
3804 + unsigned long int_line28;
3805 + unsigned long int_line29;
3806 + unsigned long int_line30;
3807 + unsigned long int_line31;
3808 + unsigned long int_line32;
3809 + unsigned long int_line33;
3810 + unsigned long int_line34;
3811 + unsigned long int_line35;
3812 + unsigned long int_line36;
3813 + unsigned long int_line37;
3814 + unsigned long int_line38;
3815 + unsigned long int_line39;
3818 +/* Interrupt Line #'s (Avalanche peripherals) */
3820 +/*------------------------------*/
3821 +/* Avalanche primary interrupts */
3822 +/*------------------------------*/
3823 +#define UNIFIED_SECONDARY_INTERRUPT 0
3824 +#define AVALANCHE_EXT_INT_0 1
3825 +#define AVALANCHE_EXT_INT_1 2
3826 +#define AVALANCHE_EXT_INT_2 3
3827 +#define AVALANCHE_EXT_INT_3 4
3828 +#define AVALANCHE_TIMER_0_INT 5
3829 +#define AVALANCHE_TIMER_1_INT 6
3830 +#define AVALANCHE_UART0_INT 7
3831 +#define AVALANCHE_UART1_INT 8
3832 +#define AVALANCHE_PDMA_INT0 9
3833 +#define AVALANCHE_PDMA_INT1 10
3834 +#define AVALANCHE_HDLC_TXA 11
3835 +#define AVALANCHE_HDLC_TXB 12
3836 +#define AVALANCHE_HDLC_RXA 13
3837 +#define AVALANCHE_HDLC_RXB 14
3838 +#define AVALANCHE_ATM_SAR_TXA 15
3839 +#define AVALANCHE_ATM_SAR_TXB 16
3840 +#define AVALANCHE_ATM_SAR_RXA 17
3841 +#define AVALANCHE_ATM_SAR_RXB 18
3842 +#define AVALANCHE_MAC_TXA 19
3843 +#define AVALANCHE_MAC_RXA 20
3844 +#define AVALANCHE_DSP_SUB0 21
3845 +#define AVALANCHE_DSP_SUB1 22
3846 +#define AVALANCHE_DES_INT 23
3847 +#define AVALANCHE_USB_INT 24
3848 +#define AVALANCHE_PCI_INTA 25
3849 +#define AVALANCHE_PCI_INTB 26
3850 +#define AVALANCHE_PCI_INTC 27
3851 +/* Line #28 Reserved */
3852 +#define AVALANCHE_I2CM_INT 29
3853 +#define AVALANCHE_PDMA_INT2 30
3854 +#define AVALANCHE_PDMA_INT3 31
3855 +#define AVALANCHE_CODEC 32
3856 +#define AVALANCHE_MAC_TXB 33
3857 +#define AVALANCHE_MAC_RXB 34
3858 +/* Line #35 Reserved */
3859 +/* Line #36 Reserved */
3860 +/* Line #37 Reserved */
3861 +/* Line #38 Reserved */
3862 +/* Line #39 Reserved */
3864 +#define DEBUG_MISSED_INTS 1
3866 +#ifdef DEBUG_MISSED_INTS
3867 +struct debug_missed_int
3869 + unsigned int atm_sar_txa;
3870 + unsigned int atm_sar_txb;
3871 + unsigned int atm_sar_rxa;
3872 + unsigned int atm_sar_rxb;
3873 + unsigned int mac_txa;
3874 + unsigned int mac_rxa;
3875 + unsigned int mac_txb;
3876 + unsigned int mac_rxb;
3878 +#endif /* DEBUG_MISSED_INTS */
3880 +/*-----------------------------------*/
3881 +/* Avalanche Secondary Interrupts */
3882 +/*-----------------------------------*/
3883 +#define PRIMARY_INTS 40
3885 +#define AVALANCHE_HDLC_STATUS (0 + PRIMARY_INTS)
3886 +#define AVALANCHE_SAR_STATUS (1 + PRIMARY_INTS)
3887 +/* Line #02 Reserved */
3888 +#define AVALANCHE_ETH_MACA_LNK_CHG (3 + PRIMARY_INTS)
3889 +#define AVALANCHE_ETH_MACA_MGT (4 + PRIMARY_INTS)
3890 +#define AVALANCHE_PCI_STATUS_INT (5 + PRIMARY_INTS)
3891 +/* Line #06 Reserved */
3892 +#define AVALANCHE_EXTERN_MEM_INT (7 + PRIMARY_INTS)
3893 +#define AVALANCHE_DSP_A_DOG (8 + PRIMARY_INTS)
3894 +#define AVALANCHE_DSP_B_DOG (9 + PRIMARY_INTS)
3895 +/* Line #10-#20 Reserved */
3896 +#define AVALANCHE_ETH_MACB_LNK_CHG (21 + PRIMARY_INTS)
3897 +#define AVALANCHE_ETH_MACB_MGT (22 + PRIMARY_INTS)
3898 +#define AVALANCHE_AAL2_STATUS (23 + PRIMARY_INTS)
3899 +/* Line #24-#31 Reserved */
3901 +#define AVALANCHEINT_UART0 LNXINTNUM(AVALANCHE_UART0_INT)
3902 +#define AVALANCHEINT_UART1 LNXINTNUM(AVALANCHE_UART1_INT)
3903 +#define SEADINT_UART0 3 /* TTYS0 interrupt on SEAD */
3904 +#define SEADINT_UART1 4 /* TTYS1 interrupt on SEAD */
3906 +#ifdef JIMK_INT_CTRLR
3907 +/*-----------------------------------*/
3908 +/* Jim Kennedy's Interrupt Controller*/
3909 +/*-----------------------------------*/
3911 +/* to clear the interrupt write the bit back to the status reg */
3913 +#define JIMK_INT_STATUS (*(volatile unsigned int *)(0xA8612400))
3914 +#define JIMK_INT_MASK (*(volatile unsigned int *)(0xA8612404))
3915 +#define JIMK_SAR_STATUS (1<<0)
3916 +#define JIMK_SAR_TX_A (1<<1)
3917 +#define JIMK_SAR_TX_B (1<<2)
3918 +#define JIMK_SAR_RX_A (1<<3)
3919 +#define JIMK_SAR_RX_B (1<<4)
3920 +#define JIMK_AAL2_STATUS (1<<5)
3921 +#define JIMK_UART0_INT (1<<11)
3923 +#ifdef SEAD_USB_DEVELOPMENT
3924 +#define JIMK_USB_INT (1<<0)
3925 +#endif /* SEAD_USB_DEVELOPMENT */
3927 +#endif /* JIMK_INT_CTRLR */
3929 +extern void avalanche_int_set(int channel, int line);
3930 +extern void avalancheint_init(void);
3933 +#endif /* !(_MIPS_AVALANCHEINT_H) */
3938 diff -urN linux-2.4.30/include/asm-mips/ar7/avalanche_intc.h linux-2.4.30.current/include/asm-mips/ar7/avalanche_intc.h
3939 --- linux-2.4.30/include/asm-mips/ar7/avalanche_intc.h 1970-01-01 01:00:00.000000000 +0100
3940 +++ linux-2.4.30.current/include/asm-mips/ar7/avalanche_intc.h 2005-06-12 20:14:28.000000000 +0200
3943 + * Nitin Dhingra, iamnd@ti.com
3944 + * Copyright (C) 2000 Texas Instruments Inc.
3947 + * ########################################################################
3949 + * This program is free software; you can distribute it and/or modify it
3950 + * under the terms of the GNU General Public License (Version 2) as
3951 + * published by the Free Software Foundation.
3953 + * This program is distributed in the hope it will be useful, but WITHOUT
3954 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3955 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3956 + * for more details.
3958 + * You should have received a copy of the GNU General Public License along
3959 + * with this program; if not, write to the Free Software Foundation, Inc.,
3960 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
3962 + * ########################################################################
3964 + * Defines of the Sead board specific address-MAP, registers, etc.
3967 +#ifndef _AVALANCHE_INTC_H
3968 +#define _AVALANCHE_INTC_H
3970 +#define MIPS_EXCEPTION_OFFSET 8
3972 +/******************************************************************************
3973 + Avalanche Interrupt number
3974 +******************************************************************************/
3975 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
3977 +/*******************************************************************************
3978 +*Linux Interrupt number
3979 +*******************************************************************************/
3980 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3984 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
3985 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
3987 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
3988 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
3991 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
3992 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
3993 + + MIPS_EXCEPTION_OFFSET - 1) /* Suraj, check */
3997 + * Avalanche interrupt controller register base (primary)
3999 +#define AVALANCHE_ICTRL_REGS_BASE AVALANCHE_INTC_BASE
4001 +/******************************************************************************
4002 + * Avalanche exception controller register base (secondary)
4003 + ******************************************************************************/
4004 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
4007 +/******************************************************************************
4008 + * Avalanche Interrupt pacing register base (secondary)
4009 + ******************************************************************************/
4010 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
4014 +/******************************************************************************
4015 + * Avalanche Interrupt Channel Control register base
4016 + *****************************************************************************/
4017 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
4020 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
4022 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 0x00 */
4023 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 0x04 */
4024 + volatile unsigned long unused1; /*0x08 */
4025 + volatile unsigned long unused2; /*0x0C */
4026 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 0x10 */
4027 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 0x14 */
4028 + volatile unsigned long unused3; /*0x18 */
4029 + volatile unsigned long unused4; /*0x1C */
4030 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 0x20 */
4031 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 0x24 */
4032 + volatile unsigned long unused5; /*0x28 */
4033 + volatile unsigned long unused6; /*0x2C */
4034 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 0x30 */
4035 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 0x34 */
4036 + volatile unsigned long unused7; /* 0x38 */
4037 + volatile unsigned long unused8; /* 0x3c */
4038 + volatile unsigned long pintir; /* Priority Interrupt Index Register 0x40 */
4039 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg 0x44 */
4040 + volatile unsigned long unused9; /* 0x48 */
4041 + volatile unsigned long unused10; /* 0x4C */
4042 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 10x50 */
4043 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 20x54 */
4044 + volatile unsigned long unused11; /* 0x58 */
4045 + volatile unsigned long unused12; /*0x5C */
4046 + volatile unsigned long inttypr1; /* Interrupt Type Mask register 10x60 */
4047 + volatile unsigned long inttypr2; /* Interrupt Type Mask register 20x64 */
4050 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
4052 + volatile unsigned long exsr; /* Exceptions Status/Set register 0x80 */
4053 + volatile unsigned long reserved; /*0x84 */
4054 + volatile unsigned long excr; /* Exceptions Clear Register 0x88 */
4055 + volatile unsigned long reserved1; /*0x8c */
4056 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) 0x90 */
4057 + volatile unsigned long reserved2; /*0x94 */
4058 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable(clear)0x98 */
4060 +struct avalanche_ipace_regs
4063 + volatile unsigned long ipacep; /* Interrupt pacing register 0xa0 */
4064 + volatile unsigned long ipacemap; /*Interrupt Pacing Map Register 0xa4 */
4065 + volatile unsigned long ipacemax; /*Interrupt Pacing Max Register 0xa8 */
4067 +struct avalanche_channel_int_number
4069 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register0x200 */
4070 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register0x204 */
4071 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register0x208 */
4072 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register0x20C */
4073 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register0x210 */
4074 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register0x214 */
4075 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register0x218 */
4076 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register0x21C */
4077 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register0x220 */
4078 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register0x224 */
4079 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register0x228 */
4080 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register0x22C */
4081 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register0x230 */
4082 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register0x234 */
4083 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register0x238 */
4084 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register0x23C */
4085 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register0x240 */
4086 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register0x244 */
4087 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register0x248 */
4088 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register0x24C */
4089 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register0x250 */
4090 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register0x254 */
4091 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register0x358 */
4092 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register0x35C */
4093 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register0x260 */
4094 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register0x264 */
4095 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register0x268 */
4096 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register0x26C */
4097 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register0x270 */
4098 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register0x274 */
4099 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register0x278 */
4100 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register0x27C */
4101 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register0x280 */
4102 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register0x284 */
4103 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register0x288 */
4104 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register0x28C */
4105 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register0x290 */
4106 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register0x294 */
4107 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register0x298 */
4108 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register0x29C */
4111 +struct avalanche_interrupt_line_to_channel
4113 + unsigned long int_line0; /* Start of primary interrupts */
4114 + unsigned long int_line1;
4115 + unsigned long int_line2;
4116 + unsigned long int_line3;
4117 + unsigned long int_line4;
4118 + unsigned long int_line5;
4119 + unsigned long int_line6;
4120 + unsigned long int_line7;
4121 + unsigned long int_line8;
4122 + unsigned long int_line9;
4123 + unsigned long int_line10;
4124 + unsigned long int_line11;
4125 + unsigned long int_line12;
4126 + unsigned long int_line13;
4127 + unsigned long int_line14;
4128 + unsigned long int_line15;
4129 + unsigned long int_line16;
4130 + unsigned long int_line17;
4131 + unsigned long int_line18;
4132 + unsigned long int_line19;
4133 + unsigned long int_line20;
4134 + unsigned long int_line21;
4135 + unsigned long int_line22;
4136 + unsigned long int_line23;
4137 + unsigned long int_line24;
4138 + unsigned long int_line25;
4139 + unsigned long int_line26;
4140 + unsigned long int_line27;
4141 + unsigned long int_line28;
4142 + unsigned long int_line29;
4143 + unsigned long int_line30;
4144 + unsigned long int_line31;
4145 + unsigned long int_line32;
4146 + unsigned long int_line33;
4147 + unsigned long int_line34;
4148 + unsigned long int_line35;
4149 + unsigned long int_line36;
4150 + unsigned long int_line37;
4151 + unsigned long int_line38;
4152 + unsigned long int_line39;
4156 +/* Interrupt Line #'s (Sangam peripherals) */
4158 +/*------------------------------*/
4159 +/* Sangam primary interrupts */
4160 +/*------------------------------*/
4162 +#define UNIFIED_SECONDARY_INTERRUPT 0
4163 +#define AVALANCHE_EXT_INT_0 1
4164 +#define AVALANCHE_EXT_INT_1 2
4165 +/* Line #3 Reserved */
4166 +/* Line #4 Reserved */
4167 +#define AVALANCHE_TIMER_0_INT 5
4168 +#define AVALANCHE_TIMER_1_INT 6
4169 +#define AVALANCHE_UART0_INT 7
4170 +#define AVALANCHE_UART1_INT 8
4171 +#define AVALANCHE_PDMA_INT0 9
4172 +#define AVALANCHE_PDMA_INT1 10
4173 +/* Line #11 Reserved */
4174 +/* Line #12 Reserved */
4175 +/* Line #13 Reserved */
4176 +/* Line #14 Reserved */
4177 +#define AVALANCHE_ATM_SAR_INT 15
4178 +/* Line #16 Reserved */
4179 +/* Line #17 Reserved */
4180 +/* Line #18 Reserved */
4181 +#define AVALANCHE_MAC0_INT 19
4182 +/* Line #20 Reserved */
4183 +#define AVALANCHE_VLYNQ0_INT 21
4184 +#define AVALANCHE_CODEC_WAKE_INT 22
4185 +/* Line #23 Reserved */
4186 +#define AVALANCHE_USB_INT 24
4187 +#define AVALANCHE_VLYNQ1_INT 25
4188 +/* Line #26 Reserved */
4189 +/* Line #27 Reserved */
4190 +#define AVALANCHE_MAC1_INT 28
4191 +#define AVALANCHE_I2CM_INT 29
4192 +#define AVALANCHE_PDMA_INT2 30
4193 +#define AVALANCHE_PDMA_INT3 31
4194 +/* Line #32 Reserved */
4195 +/* Line #33 Reserved */
4196 +/* Line #34 Reserved */
4197 +/* Line #35 Reserved */
4198 +/* Line #36 Reserved */
4199 +#define AVALANCHE_VDMA_VT_RX_INT 37
4200 +#define AVALANCHE_VDMA_VT_TX_INT 38
4201 +#define AVALANCHE_ADSLSS_INT 39
4203 +/*-----------------------------------*/
4204 +/* Sangam Secondary Interrupts */
4205 +/*-----------------------------------*/
4206 +#define PRIMARY_INTS 40
4208 +#define EMIF_INT (7 + PRIMARY_INTS)
4211 +extern void avalanche_int_set(int channel, int line);
4214 +#endif /* _AVALANCHE_INTC_H */
4215 diff -urN linux-2.4.30/include/asm-mips/ar7/avalanche_prom.h linux-2.4.30.current/include/asm-mips/ar7/avalanche_prom.h
4216 --- linux-2.4.30/include/asm-mips/ar7/avalanche_prom.h 1970-01-01 01:00:00.000000000 +0100
4217 +++ linux-2.4.30.current/include/asm-mips/ar7/avalanche_prom.h 2005-06-12 20:14:28.000000000 +0200
4223 + * Carsten Langgaard, carstenl@mips.com
4224 + * Copyright (C) 1999 MIPS Technologies, Inc.
4226 + * ########################################################################
4228 + * This program is free software; you can distribute it and/or modify it
4229 + * under the terms of the GNU General Public License (Version 2) as
4230 + * published by the Free Software Foundation.
4232 + * This program is distributed in the hope it will be useful, but WITHOUT
4233 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4234 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4235 + * for more details.
4237 + * You should have received a copy of the GNU General Public License along
4238 + * with this program; if not, write to the Free Software Foundation, Inc.,
4239 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4241 + * ########################################################################
4243 + * Sead bootprom interface for the Linux kernel.
4247 +#ifndef _MIPS_PROM_H
4248 +#define _MIPS_PROM_H
4250 +extern char *prom_getcmdline(void);
4251 +extern char *prom_getenv(char *name);
4252 +extern void setup_prom_printf(void);
4253 +extern void prom_printf(char *fmt, ...);
4254 +extern void prom_init_cmdline(void);
4255 +extern void prom_meminit(void);
4256 +extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
4257 +extern void prom_free_prom_memory (void);
4258 +extern void sead_display_message(const char *str);
4259 +extern void sead_display_word(unsigned int num);
4260 +extern int get_ethernet_addr(char *ethernet_addr);
4262 +/* Memory descriptor management. */
4263 +#define PROM_MAX_PMEMBLOCKS 32
4264 +struct prom_pmemblock {
4265 + unsigned long base; /* Within KSEG0. */
4266 + unsigned int size; /* In bytes. */
4267 + unsigned int type; /* free or prom memory */
4271 +#endif /* !(_MIPS_PROM_H) */
4273 diff -urN linux-2.4.30/include/asm-mips/ar7/avalanche_regs.h linux-2.4.30.current/include/asm-mips/ar7/avalanche_regs.h
4274 --- linux-2.4.30/include/asm-mips/ar7/avalanche_regs.h 1970-01-01 01:00:00.000000000 +0100
4275 +++ linux-2.4.30.current/include/asm-mips/ar7/avalanche_regs.h 2005-06-12 20:14:28.000000000 +0200
4279 + * Avalanche Register Descriptions
4281 + * Jeff Harrell, jharrell@ti.com
4282 + * 2000 (c) Texas Instruments Inc.
4285 +#ifndef __AVALANCHE_REGS_H
4286 +#define __AVALANCHE_REGS_H
4288 +#include <asm/addrspace.h>
4289 +#include <linux/config.h>
4291 +/*----------------------------------------*/
4292 +/* Base offsets within the Avalanche ASIC */
4293 +/*----------------------------------------*/
4295 +#define BBIF_SPACE0 (KSEG1ADDR(0x01000000))
4296 +#define BBIF_SPACE1 (KSEG1ADDR(0x01800000))
4297 +#define BBIF_CONTROL (KSEG1ADDR(0x02000000))
4298 +#define ATM_SAR_BASE (KSEG1ADDR(0x03000000))
4299 +#define USB_MCU_BASE (KSEG1ADDR(0x03400000))
4300 +#define DES_BASE (KSEG1ADDR(0x08600000))
4301 +#define ETH_MACA_BASE (KSEG1ADDR(0x08610000))
4302 +#define ETH_MACB_BASE (KSEG1ADDR(0x08612800))
4303 +#define MEM_CTRLR_BASE (KSEG1ADDR(0x08610800))
4304 +#define GPIO_BASE (KSEG1ADDR(0x08610900))
4305 +#define CLK_CTRL_BASE (KSEG1ADDR(0x08610A00))
4306 +#define WATCH_DOG_BASE (KSEG1ADDR(0x08610B00))
4307 +#define TMR1_BASE (KSEG1ADDR(0x08610C00))
4308 +#define TRM2_BASE (KSEG1ADDR(0x08610D00))
4309 +#define UARTA_BASE (KSEG1ADDR(0x08610E00))
4310 +#define UARTB_BASE (KSEG1ADDR(0x08610F00))
4311 +#define I2C_BASE (KSEG1ADDR(0x08611000))
4312 +#define DEV_ID_BASE (KSEG1ADDR(0x08611100))
4313 +#define USB_BASE (KSEG1ADDR(0x08611200))
4314 +#define PCI_CONFIG_BASE (KSEG1ADDR(0x08611300))
4315 +#define DMA_BASE (KSEG1ADDR(0x08611400))
4316 +#define RESET_CTRL_BASE (KSEG1ADDR(0x08611600))
4317 +#define DSL_IF_BASE (KSEG1ADDR(0x08611B00))
4318 +#define INT_CTL_BASE (KSEG1ADDR(0x08612400))
4319 +#define PHY_BASE (KSEG1ADDR(0x1E000000))
4321 +/*---------------------------------*/
4322 +/* Device ID, chip version number */
4323 +/*---------------------------------*/
4325 +#define AVALANCHE_CHVN (*(volatile unsigned int *)(DEV_ID_BASE+0x14))
4326 +#define AVALANCHE_DEVID1 (*(volatile unsigned int *)(DEV_ID_BASE+0x18))
4327 +#define AVALANCHE_DEVID2 (*(volatile unsigned int *)(DEV_ID_BASE+0x1C))
4329 +/*----------------------------------*/
4330 +/* Reset Control VW changed to ptrs */
4331 +/*----------------------------------*/
4333 +#define AVALANCHE_PRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x0)) /* Peripheral reset control */
4334 +#define AVALANCHE_SWRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x4)) /* Software reset control */
4335 +#define AVALANCHE_RSR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x8)) /* Reset status register */
4337 +/* reset control bits */
4339 +#define AV_RST_UART0 (1<<0) /* Brings UART0 out of reset */
4340 +#define AV_RST_UART1 (1<<1) /* Brings UART1 out of reset */
4341 +#define AV_RST_IICM (1<<2) /* Brings the I2CM out of reset */
4342 +#define AV_RST_TIMER0 (1<<3) /* Brings Timer 0 out of reset */
4343 +#define AV_RST_TIMER1 (1<<4) /* Brings Timer 1 out of reset */
4344 +#define AV_RST_DES (1<<5) /* Brings the DES module out of reset */
4345 +#define AV_RST_GPIO (1<<6) /* Brings the GPIO module out of reset (see note below) */
4347 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4348 + If you reset the GPIO interface all of the directions (i/o) of the UART B
4349 + interface pins are inputs and must be reconfigured so as not to lose the
4350 + serial console interface
4351 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4353 +#define AV_RST_BBIF (1<<7) /* Brings the Broadband interface out of reset */
4354 +#define AV_RST_USB (1<<8) /* Brings the USB module out of reset */
4355 +#define AV_RST_SAR (1<<9) /* Brings the SAR out of reset */
4356 +#define AV_RST_HDLC (1<<10) /* Brings the HDLC module out of reset */
4357 +#define AV_RST_PCI (1<<16) /* Brings the PCI module out of reset */
4358 +#define AV_RST_ETH_MAC0 (1<<17) /* Brings the Ethernet MAC0 out of reset */
4359 +#define AV_RST_PICO_DMA (1<<18) /* Brings the PICO DMA module out of reset */
4360 +#define AV_RST_BIST (1<<19) /* Brings the BIST module out of reset */
4361 +#define AV_RST_DSP (1<<20) /* Brings the DSP sub system out of reset */
4362 +#define AV_RST_ETH_MAC1 (1<<21) /* Brings the Ethernet MAC1 out of reset */
4364 +/*----------------------*/
4365 +/* Physical interfaces */
4366 +/*----------------------*/
4369 +#define PHY_LOOPBACK 1
4373 +#define PHY0BASE (PHY_BASE)
4374 +#define PHY0RST (*(volatile unsigned char *) (PHY0BASE)) /* reset */
4375 +#define PHY0CTRL (*(volatile unsigned char *) (PHY0BASE+0x5)) /* control */
4376 +#define PHY0RACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x50)) /* RACP control/status */
4377 +#define PHY0TACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x60)) /* TACP idle/unassigned cell hdr */
4378 +#define PHY0RACPINT (*(volatile unsigned char *) (PHY0BASE+0x51)) /* RACP interrupt enable/Status */
4383 +#define PHY1BASE (PHY_BASE + 0x100000)
4384 +#define PHY1RST (*(volatile unsigned char *) (PHY1BASE)) /* reset */
4385 +#define PHY1CTRL (*(volatile unsigned char *) (PHY1BASE+0x5)) /* control */
4386 +#define PHY1RACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x50))
4387 +#define PHY1TACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x60))
4388 +#define PHY1RACPINT (*(volatile unsigned char *) (PHY1BASE+0x51))
4392 +#define PHY2BASE (PHY_BASE + 0x200000)
4393 +#define PHY2RST (*(volatile unsigned char *) (PHY2BASE)) /* reset */
4394 +#define PHY2CTRL (*(volatile unsigned char *) (PHY2BASE+0x5)) /* control */
4395 +#define PHY2RACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x50))
4396 +#define PHY2TACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x60))
4397 +#define PHY2RACPINT (*(volatile unsigned char *) (PHY2BASE+0x51))
4399 +/*-------------------*/
4400 +/* Avalanche ATM SAR */
4401 +/*-------------------*/
4403 +#define AVSAR_SYSCONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000000)) /* SAR system config register */
4404 +#define AVSAR_SYSSTATUS (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000004)) /* SAR system status register */
4405 +#define AVSAR_INT_ENABLE (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000008)) /* SAR interrupt enable register */
4406 +#define AVSAR_CONN_VPI_VCI (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000000c)) /* VPI/VCI connection config */
4407 +#define AVSAR_CONN_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000010)) /* Connection config register */
4408 +#define AVSAR_OAM_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018)) /* OAM configuration register */
4410 +/* Transmit completion ring registers */
4412 +#define AVSAR_TCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000100))
4413 +#define AVSAR_TCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000104))
4414 +#define AVSAR_TCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000108))
4415 +#define AVSAR_TCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000010c))
4416 +#define AVSAR_TCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000110))
4417 +#define AVSAR_TCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000114))
4418 +#define AVSAR_TCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000118))
4419 +#define AVSAR_TCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000011c))
4420 +#define AVSAR_TCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000120))
4421 +#define AVSAR_TCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000124))
4422 +#define AVSAR_TCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000128))
4423 +#define AVSAR_TCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000012c))
4424 +#define AVSAR_TCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000130))
4425 +#define AVSAR_TCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000134))
4427 +/* Transmit Queue Packet registers */
4428 +#define AVSAR_TXQUEUE_PKT0 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000140))
4429 +#define AVSAR_TXQUEUE_PKT1 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000144))
4430 +#define AVSAR_TXQUEUE_PKT2 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000148))
4431 +#define AVSAR_TX_FLUSH (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000014C))
4432 +/* Receive completion ring registers */
4434 +#define AVSAR_RCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000200))
4435 +#define AVSAR_RCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000204))
4436 +#define AVSAR_RCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000208))
4437 +#define AVSAR_RCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000020c))
4438 +#define AVSAR_RCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000210))
4439 +#define AVSAR_RCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000214))
4440 +#define AVSAR_RCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000218))
4441 +#define AVSAR_RCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000021c))
4442 +#define AVSAR_RCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000220))
4443 +#define AVSAR_RCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000224))
4444 +#define AVSAR_RCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000228))
4445 +#define AVSAR_RCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000022c))
4446 +#define AVSAR_RCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000230))
4447 +#define AVSAR_RCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000234))
4449 +#define AVSAR_RXFBL_ADD0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000240)) /* Rx Free buffer list add 0 */
4450 +#define AVSAR_RXFBL_ADD1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000244)) /* Rx Free buffer list add 1 */
4451 +#define AVSAR_RXFBL_ADD2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000248)) /* Rx Free buffer list add 2 */
4452 +#define AVSAR_RXFBLSIZE_0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000028c)) /* Rx Free buffer list size 0 */
4453 +#define AVSAR_RXFBLSIZE_1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000029c)) /* Rx Free buffer list size 1 */
4454 +#define AVSAR_RXFBLSIZE_2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002ac)) /* Rx Free buffer list size 2 */
4455 +#define AVSAR_RXFBLSIZE_3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002bc)) /* Rx Free buffer list size 3 */
4458 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
4460 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010480))
4461 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010484))
4462 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010488))
4463 +#define AVSAR_OAM_CPID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E0))
4464 +#define AVSAR_OAM_LLID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F0))
4465 +#define AVSAR_OAM_CPID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E4))
4466 +#define AVSAR_OAM_LLID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F4))
4467 +#define AVSAR_OAM_CPID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E8))
4468 +#define AVSAR_OAM_LLID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F8))
4469 +#define AVSAR_OAM_CPID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104EC))
4470 +#define AVSAR_OAM_LLID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104FC))
4471 +#define AVSAR_OAM_CORR_TAG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010500))
4472 +#define AVSAR_OAM_FAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010520))
4473 +#define AVSAR_OAM_NEAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010540))
4474 +#define AVSAR_OAM_CONFIG_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018))
4475 +#define AVSAR_FAIRNESS_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104B8))
4476 +#define AVSAR_UBR_PCR_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010490))
4481 +#define OAM_CPID_ADD 0xa30104e0
4483 +#define OAM_LLID_ADD 0xa30104f0
4485 +#define OAM_LLID_VAL 0xffffffff
4487 +#define OAM_CORR_TAG 0xa3010500
4489 +#define OAM_FAR_COUNT_ADD 0xa3010520
4491 +#define OAM_NEAR_COUNT_ADD 0xa3010540
4493 +#define OAM_CONFIG_REG_ADD 0xa3000018
4497 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
4499 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012000))
4500 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012004))
4501 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012008))
4502 +#define AVSAR_OAM_CPID (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012300))
4504 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
4507 +#define AVSAR_STATE_RAM (ATM_SAR_BASE + 0x010000) /* SAR state RAM */
4508 +#define AVSAR_PDSP_BASE (ATM_SAR_BASE + 0x020000) /* SAR PDSP base address */
4509 +#define AVSAR_TXDMA_BASE (ATM_SAR_BASE + 0x030000) /* Transmit DMA state base */
4510 +#define AVSAR_TDMASTATE6 0x18 /* Transmit DMA state word 6 */
4511 +#define AVSAR_RXDMA_BASE (ATM_SAR_BASE + 0x040000) /* Receive DMA state base */
4512 +#define AVSAR_RDMASTATE0 0x0 /* Receive DMA state word 0 */
4514 +/*------------------------------------------*/
4515 +/* DSL Interface */
4516 +/*------------------------------------------*/
4518 +#define AVDSL_TX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000000))
4519 +#define AVDSL_RX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000004))
4520 +#define AVDSL_POLL (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000008))
4524 +#define AVDSL_TX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000000C))
4525 +#define AVDSL_TX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000010))
4526 +#define AVDSL_TX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000014))
4527 +#define AVDSL_TX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000018))
4528 +#define AVDSL_RX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000001C))
4529 +#define AVDSL_RX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000020))
4530 +#define AVDSL_RX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000024))
4531 +#define AVDSL_RX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000028))
4535 +#define AVDSL_TX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000002C))
4536 +#define AVDSL_TX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000030))
4537 +#define AVDSL_TX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000034))
4538 +#define AVDSL_TX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000038))
4539 +#define AVDSL_RX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000003C))
4540 +#define AVDSL_RX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000040))
4541 +#define AVDSL_RX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000044))
4542 +#define AVDSL_RX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000048))
4544 +/*------------------------------------------*/
4545 +/* Broadband I/F */
4546 +/*------------------------------------------*/
4548 +#define AVBBIF_BBIF_CNTRL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000000))
4549 +#define AVBBIF_ADDR_TRANS_0 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000004))
4550 +#define AVBBIF_ADDR_TRANS_1 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000008))
4551 +#define AVBBIF_ADDR_XB_MX_BL (*(volatile unsigned int *)(BBIF_CONTROL + 0x0000000C))
4552 +#define AVBBIF_INFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000010))
4553 +#define AVBBIF_OUTFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000014))
4555 +#define AVBBIF_DISABLED 0x0
4556 +#define AVBBIF_LBT4040_INT 0x1
4557 +#define AVBBIF_XBUS 0x2
4558 +#define AVBBIF_LBT4040_EXT 0x4
4560 +#define AVBBIF_ADDR_MASK0 0xff000000 /* handles upper bits of BBIF 0 address */
4561 +#define AVBBIF_ADDR_MASK1 0xff800000 /* handles upper bits of BBIF 1 address */
4562 +#define AVBBIF_TRANS_MASK 0xff000000
4563 +/*------------------------------------------*/
4565 +/*------------------------------------------*/
4567 +#define GPIO_DATA_INPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000000))
4568 +#define GPIO_DATA_OUTPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000004))
4569 +#define GPIO_DATA_DIR (*(volatile unsigned int *)(GPIO_BASE + 0x00000008)) /* 0=output 1=input */
4570 +#define GPIO_DATA_ENABLE (*(volatile unsigned int *)(GPIO_BASE + 0x0000000C)) /* 0=GPIO Mux 1=GPIO */
4572 +#define GPIO_0 (1<<21)
4573 +#define GPIO_1 (1<<22)
4574 +#define GPIO_2 (1<<23)
4575 +#define GPIO_3 (1<<24)
4576 +#define EINT_1 (1<<18)
4579 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4580 + If you reset the GPIO interface all of the directions (i/o) of the UART B
4581 + interface pins are inputs and must be reconfigured so as not to lose the
4582 + serial console interface
4583 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4586 +/*------------------------------------------*/
4588 +/*------------------------------------------*/
4589 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
4591 +#define PCLK_0_HALF_VBUS (0<<16)
4592 +#define PCLK_EQ_INPUT (1<<16)
4593 +#define BBIF_CLK_HALF_VBUS (0<<17)
4594 +#define BBIF_CLK_EQ_VBUS (1<<17)
4595 +#define BBIF_CLK_EQ_BBCLK (3<<17)
4596 +#define DSP_MODCLK_DSPCLKI (0<<20)
4597 +#define DSP_MODCLK_REFCLKI (1<<20)
4598 +#define USB_CLK_EQ_USBCLKI (0<<21)
4599 +#define USB_CLK_EQ_REFCLKI (1<<21)
4601 +/*------------------------------------------*/
4602 +/* PCI Control Registers */
4603 +/*------------------------------------------*/
4604 +#define PCIC_CONTROL (*(volatile unsigned int *)(PCI_CONFIG_BASE))
4605 +#define PCIC_CONTROL_CFG_DONE (1<<0)
4606 +#define PCIC_CONTROL_DIS_SLAVE_TO (1<<1)
4607 +#define PCIC_CONTROL_FORCE_DELAY_READ (1<<2)
4608 +#define PCIC_CONTROL_FORCE_DELAY_READ_LINE (1<<3)
4609 +#define PCIC_CONTROL_FORCE_DELAY_READ_MULT (1<<4)
4610 +#define PCIC_CONTROL_MEM_SPACE_EN (1<<5)
4611 +#define PCIC_CONTROL_MEM_MASK (1<<6)
4612 +#define PCIC_CONTROL_IO_SPACE_EN (1<<7)
4613 +#define PCIC_CONTROL_IO_MASK (1<<8)
4614 +/* PCIC_CONTROL_RESERVED (1<<9) */
4615 +#define PCIC_CONTROL_BASE0_EN (1<<10)
4616 +#define PCIC_CONTROL_BASE1_EN (1<<11)
4617 +#define PCIC_CONTROL_BASE2_EN (1<<12)
4618 +#define PCIC_CONTROL_HOLD_MASTER_WRITE (1<<13)
4619 +#define PCIC_CONTROL_ARBITER_EN (1<<14)
4620 +#define PCIC_INT_SOURCE (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000004))
4621 +#define PCIC_INT_SOURCE_PWR_MGMT (1<<0)
4622 +#define PCIC_INT_SOURCE_PCI_TARGET (1<<1)
4623 +#define PCIC_INT_SOURCE_PCI_MASTER (1<<2)
4624 +#define PCIC_INT_SOURCE_POWER_WAKEUP (1<<3)
4625 +#define PCIC_INT_SOURCE_PMEIN (1<<4)
4626 +/* PCIC_INT_SOURCE_RESERVED (1<<5) */
4627 +/* PCIC_INT_SOURCE_RESERVED (1<<6) */
4628 +#define PCIC_INT_SOURCE_PIC_INTA (1<<7)
4629 +#define PCIC_INT_SOURCE_PIC_INTB (1<<8)
4630 +#define PCIC_INT_SOURCE_PIC_INTC (1<<9)
4631 +#define PCIC_INT_SOURCE_PIC_INTD (1<<10)
4632 +#define PCIC_INT_SOURCE_SOFT_INT0 (1<<11)
4633 +#define PCIC_INT_SOURCE_SOFT_INT1 (1<<12)
4634 +#define PCIC_INT_SOURCE_SOFT_INT2 (1<<13)
4635 +#define PCIC_INT_SOURCE_SOFT_INT3 (1<<14)
4636 +#define PCIC_INT_CLEAR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000008))
4637 +#define PCIC_INT_CLEAR_PM (1<<0)
4638 +#define PCIC_INT_CLEAR_PCI_TARGET (1<<1)
4639 +#define PCIC_INT_CLEAR_PCI_MASTER (1<<2)
4640 +/* PCIC_INT_CLEAR_RESERVED (1<<3) */
4641 +#define PCIC_INT_CLEAR_PMEIN (1<<4)
4642 +/* PCIC_INT_CLEAR_RESERVED (1<<5) */
4643 +/* PCIC_INT_CLEAR_RESERVED (1<<6) */
4644 +#define PCIC_INT_CLEAR_PCI_INTA (1<<7)
4645 +#define PCIC_INT_CLEAR_PCI_INTB (1<<8)
4646 +#define PCIC_INT_CLEAR_PCI_INTC (1<<9)
4647 +#define PCIC_INT_CLEAR_PCI_INTD (1<<10)
4648 +#define PCIC_INT_CLEAR_SOFT_INT0 (1<<11)
4649 +#define PCIC_INT_CLEAR_SOFT_INT1 (1<<12)
4650 +#define PCIC_INT_CLEAR_SOFT_INT2 (1<<13)
4651 +#define PCIC_INT_CLEAR_SOFT_INT3 (1<<14)
4652 +#define PCIC_INT_EN_AVAL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000000c))
4653 +#define PCIC_INT_EN_AVAL_PM (1<<0)
4654 +#define PCIC_INT_EN_AVAL_PCI_TARGET (1<<1)
4655 +#define PCIC_INT_EN_AVAL_PCI_MASTER (1<<2)
4656 +/* PCIC_INT_EN_AVAL_RESERVED (1<<3) */
4657 +#define PCIC_INT_EN_AVAL_PMEIN (1<<4)
4658 +/* PCIC_INT_EN_AVAL_RESERVED (1<<5) */
4659 +/* PCIC_INT_EN_AVAL_RESERVED (1<<6) */
4660 +#define PCIC_INT_EN_AVAL_PCI_INTA (1<<7)
4661 +#define PCIC_INT_EN_AVAL_PCI_INTB (1<<8)
4662 +#define PCIC_INT_EN_AVAL_PCI_INTC (1<<9)
4663 +#define PCIC_INT_EN_AVAL_PCI_INTD (1<<10)
4664 +#define PCIC_INT_EN_AVAL_SOFT_INT0 (1<<11)
4665 +#define PCIC_INT_EN_AVAL_SOFT_INT1 (1<<12)
4666 +#define PCIC_INT_EN_AVAL_SOFT_INT2 (1<<13)
4667 +#define PCIC_INT_EN_AVAL_SOFT_INT3 (1<<14)
4668 +#define PCIC_INT_EN_PCI (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000010))
4669 +#define PCIC_INT_EN_PCI_PM (1<<0)
4670 +#define PCIC_INT_EN_PCI_PCI_TARGET (1<<1)
4671 +#define PCIC_INT_EN_PCI_PCI_MASTER (1<<2)
4672 +/* PCIC_INT_EN_PCI_RESERVED (1<<3) */
4673 +#define PCIC_INT_EN_PCI_PMEIN (1<<4)
4674 +/* PCIC_INT_EN_PCI_RESERVED (1<<5) */
4675 +/* PCIC_INT_EN_PCI_RESERVED (1<<6) */
4676 +#define PCIC_INT_EN_PCI_PCI_INTA (1<<7)
4677 +#define PCIC_INT_EN_PCI_PCI_INTB (1<<8)
4678 +#define PCIC_INT_EN_PCI_PCI_INTC (1<<9)
4679 +#define PCIC_INT_EN_PCI_PCI_INTD (1<<10)
4680 +#define PCIC_INT_EN_PCI_SOFT_INT0 (1<<11)
4681 +#define PCIC_INT_EN_PCI_SOFT_INT1 (1<<12)
4682 +#define PCIC_INT_EN_PCI_SOFT_INT2 (1<<13)
4683 +#define PCIC_INT_EN_PCI_SOFT_INT3 (1<<14)
4684 +#define PCIC_INT_SWSET (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000014))
4685 +#define PCIC_INT_SWSET_SOFT_INT0 (1<<0)
4686 +#define PCIC_INT_SWSET_SOFT_INT1 (1<<1)
4687 +#define PCIC_INT_SWSET_SOFT_INT2 (1<<2)
4688 +#define PCIC_INT_SWSET_SOFT_INT3 (1<<3)
4689 +#define PCIC_PM_CTL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000018))
4690 +#define PCIC_PM_CTL_PWR_STATE_MASK (0x02)
4691 +/* PCIC_PM_CTL_RESERVED (1<<2) */
4692 +/* PCIC_PM_CTL_RESERVED (1<<3) */
4693 +/* PCIC_PM_CTL_RESERVED (1<<4) */
4694 +/* PCIC_PM_CTL_RESERVED (1<<5) */
4695 +/* PCIC_PM_CTL_RESERVED (1<<6) */
4696 +/* PCIC_PM_CTL_RESERVED (1<<7) */
4697 +/* PCIC_PM_CTL_RESERVED (1<<8) */
4698 +/* PCIC_PM_CTL_RESERVED (1<<9) */
4699 +#define PCIC_PM_CTL_PWR_SUPPORT (1<<10)
4700 +#define PCIC_PM_CTL_PMEIN (1<<11)
4701 +#define PCIC_PM_CTL_CAP_MASK (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x0000001a))
4702 +#define PCIC_PM_CONSUME (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000001c))
4703 +#define PCIC_PM_CONSUME_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001c))
4704 +#define PCIC_PM_CONSUME_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001d))
4705 +#define PCIC_PM_CONSUME_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001e))
4706 +#define PCIC_PM_CONSUME_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001f))
4707 +#define PCIC_PM_DISSAPATED (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000020))
4708 +#define PCIC_PM_DISSAPATED_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000020))
4709 +#define PCIC_PM_DISSAPATED_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000021))
4710 +#define PCIC_PM_DISSAPATED_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000022))
4711 +#define PCIC_PM_DISSAPATED_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000023))
4712 +#define PCIC_PM_DATA_SCALE (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x00000024))
4713 +#define PCIC_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000028))
4714 +#define PCIC_SUB_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000002c))
4715 +#define PCIC_CLASS_REV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000030))
4716 +#define PCIC_MAX_MIN (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000034))
4717 +#define PCIC_MAST_MEM_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000003c))
4718 +#define PCIC_MAST_MEM_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000040))
4719 +#define PCIC_MAST_MEM_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000044))
4720 +#define PCIC_SLAVE_MASK0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000004c))
4721 +#define PCIC_SLAVE_MASK1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000050))
4722 +#define PCIC_SLAVE_MASK2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000054))
4723 +#define PCIC_SLAVE_BASE_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000058))
4724 +#define PCIC_SLAVE_BASE_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000005c))
4725 +#define PCIC_SLAVE_BASE_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000060))
4726 +#define PCIC_CONF_COMMAND (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000090))
4727 +#define PCIC_CONF_ADDR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000094))
4728 +#define PCIC_CONF_DATA (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000098))
4730 +/*------------------------------------------*/
4731 +/* IIC_INTERFACE */
4732 +/*------------------------------------------*/
4733 +#define I2C_DATA_HI (*(volatile unsigned int *)(I2C_BASE + 0x0))
4734 +#define I2C_DATA_LOW (*(volatile unsigned int *)(I2C_BASE + 0x4))
4735 +#define I2C_CONFIG (*(volatile unsigned int *)(I2C_BASE + 0x8))
4736 +#define I2C_DATA_READ (*(volatile unsigned int *)(I2C_BASE + 0xC))
4737 +#define I2C_CLOCK_DIV (*(volatile unsigned int *)(I2C_BASE + 0x10))
4739 +#define I2CWRITE 0x200
4740 +#define I2CREAD 0x300
4741 +#define I2C_END_BURST 0x400
4744 +#define I2C_READ_ERROR 0x8000
4745 +#define I2C_READ_COMPLETE 0x4000
4746 +#define I2C_READ_BUSY 0x2000
4749 +#define I2C_IO_EXPANDER 0x2
4750 +#define I2C_RTC 0xd
4752 +/* device Addresses on I2C bus (EVM3) */
4753 +#define SEVEN_SEGMENT_DISP 0x23 /* Device type = 0x2, Addr = 3 */
4754 +#define EVM3_RTC 0xd0 /* Device type = 0xd, Addr = 0 */
4755 +#define EVM3_RTC_I2C_ADDR 0x0
4757 +/*------------------------------------------*/
4758 +/* Ethernet MAC register offset definitions */
4759 +/*------------------------------------------*/
4760 +#define VMAC_DMACONFIG(X) (*(volatile unsigned int *)(X + 0x00000000))
4761 +#define VMAC_INTSTS(X) (*(volatile unsigned int *)(X + 0x00000004))
4762 +#define VMAC_INTMASK(X) (*(volatile unsigned int *)(X + 0x00000008))
4764 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4765 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
4767 +#define VMAC_TCRPTR(X) (*(volatile unsigned int *)(X + 0x00000100))
4768 +#define VMAC_TCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000104))
4769 +#define VMAC_TCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000108))
4770 +#define VMAC_TCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000010C))
4771 +#define VMAC_TCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000110))
4772 +#define VMAC_TCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000114))
4773 +#define VMAC_TCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000118))
4774 +#define VMAC_TXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000011c))
4777 +#define VMAC_TDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000120))
4778 +#define VMAC_TDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000124))
4779 +#define VMAC_TDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000128))
4780 +#define VMAC_TDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000012C))
4781 +#define VMAC_TDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000130))
4782 +#define VMAC_TDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000134))
4783 +#define VMAC_TDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000138))
4784 +#define VMAC_TDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000013C))
4785 +#define VMAC_TXPADDCNT(X) (*(volatile unsigned int *)(X + 0x00000140))
4786 +#define VMAC_TXPADDSTART(X) (*(volatile unsigned int *)(X + 0x00000144))
4787 +#define VMAC_TXPADDEND(X) (*(volatile unsigned int *)(X + 0x00000148))
4788 +#define VMAC_TXQFLUSH(X) (*(volatile unsigned int *)(X + 0x0000014C))
4790 +#define VMAC_RCRPTR(X) (*(volatile unsigned int *)(X + 0x00000200))
4791 +#define VMAC_RCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000204))
4792 +#define VMAC_RCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000208))
4793 +#define VMAC_RCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000020C))
4794 +#define VMAC_RCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000210))
4795 +#define VMAC_RCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000214))
4796 +#define VMAC_RCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000218))
4797 +#define VMAC_RXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000021c))
4799 +#define VMAC_RDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000220))
4800 +#define VMAC_RDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000224))
4801 +#define VMAC_RDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000228))
4802 +#define VMAC_RDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000022C))
4803 +#define VMAC_RDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000230))
4804 +#define VMAC_RDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000234))
4805 +#define VMAC_RDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000238))
4806 +#define VMAC_RDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000023C))
4807 +#define VMAC_FBLADDCNT(X) (*(volatile unsigned int *)(X + 0x00000240))
4808 +#define VMAC_FBLADDSTART(X) (*(volatile unsigned int *)(X + 0x00000244))
4809 +#define VMAC_FBLADDEND(X) (*(volatile unsigned int *)(X + 0x00000248))
4810 +#define VMAC_RXONOFF(X) (*(volatile unsigned int *)(X + 0x0000024C))
4812 +#define VMAC_FBL0NEXTD(X) (*(volatile unsigned int *)(X + 0x00000280))
4813 +#define VMAC_FBL0LASTD(X) (*(volatile unsigned int *)(X + 0x00000284))
4814 +#define VMAC_FBL0COUNTD(X) (*(volatile unsigned int *)(X + 0x00000288))
4815 +#define VMAC_FBL0BUFSIZE(X) (*(volatile unsigned int *)(X + 0x0000028C))
4817 +#define VMAC_MACCONTROL(X) (*(volatile unsigned int *)(X + 0x00000300))
4818 +#define VMAC_MACSTATUS(X) (*(volatile unsigned int *)(X + 0x00000304))
4819 +#define VMAC_MACADDRHI(X) (*(volatile unsigned int *)(X + 0x00000308))
4820 +#define VMAC_MACADDRLO(X) (*(volatile unsigned int *)(X + 0x0000030C))
4821 +#define VMAC_MACHASH1(X) (*(volatile unsigned int *)(X + 0x00000310))
4822 +#define VMAC_MACHASH2(X) (*(volatile unsigned int *)(X + 0x00000314))
4824 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4825 +#define VMAC_BOFTEST(X) (*(volatile unsigned int *)(X + 0x00000344))
4826 +#define VMAC_PACTEST(X) (*(volatile unsigned int *)(X + 0x00000348))
4827 +#define VMAC_PAUSEOP(X) (*(volatile unsigned int *)(X + 0x0000034C))
4829 +#define VMAC_MDIOCONTROL(X) (*(volatile unsigned int *)(X + 0x00000380))
4830 +#define VMAC_MDIOUSERACCESS(X) (*(volatile unsigned int *)(X +0x00000384))
4831 +#define VMAC_MDIOACK(X) (*(volatile unsigned int *)(X + 0x00000388))
4832 +#define VMAC_MDIOLINK(X) (*(volatile unsigned int *)(X + 0x0000038C))
4833 +#define VMAC_MDIOMACPHY(X) (*(volatile unsigned int *)(X + 0x00000390))
4835 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
4844 diff -urN linux-2.4.30/include/asm-mips/ar7/tnetd73xx.h linux-2.4.30.current/include/asm-mips/ar7/tnetd73xx.h
4845 --- linux-2.4.30/include/asm-mips/ar7/tnetd73xx.h 1970-01-01 01:00:00.000000000 +0100
4846 +++ linux-2.4.30.current/include/asm-mips/ar7/tnetd73xx.h 2005-06-12 20:14:28.000000000 +0200
4848 +/******************************************************************************
4849 + * FILE PURPOSE: TNETD73xx Common Header File
4850 + ******************************************************************************
4851 + * FILE NAME: tnetd73xx.h
4853 + * DESCRIPTION: shared typedef's, constants and API for TNETD73xx
4855 + * REVISION HISTORY:
4856 + * 27 Nov 02 - PSP TII
4858 + * (C) Copyright 2002, Texas Instruments, Inc
4859 + *******************************************************************************/
4864 + * These are const, typedef, and api definitions for tnetd73xx.
4867 + * 1. This file may be included into both C and Assembly files.
4868 + * - for .s files, please do #define _ASMLANGUAGE in your ASM file to
4869 + * avoid C data types (typedefs) below;
4870 + * - for .c files, you don't have to do anything special.
4872 + * 2. This file has a number of sections for each SOC subsystem. When adding
4873 + * a new constant, find the subsystem you are working on and follow the
4874 + * name pattern. If you are adding another typedef for your interface, please,
4875 + * place it with other typedefs and function prototypes.
4877 + * 3. Please, DO NOT add any macros or types that are local to a subsystem to avoid
4878 + * cluttering. Include such items directly into the module's .c file or have a
4879 + * local .h file to pass data between smaller modules. This file defines only
4883 +#ifndef __TNETD73XX_H__
4884 +#define __TNETD73XX_H__
4886 +#ifndef _ASMLANGUAGE /* This part not for assembly language */
4888 +#include <linux/types.h>
4890 +extern unsigned int tnetd73xx_mips_freq;
4891 +extern unsigned int tnetd73xx_vbus_freq;
4893 +#include "tnetd73xx_err.h"
4895 +#endif /* _ASMLANGUAGE */
4898 +/*******************************************************************************************
4899 +* Emerald core specific
4900 +******************************************************************************************** */
4903 +#elif defined(LITTLE_ENDIAN)
4905 +#error Need to define endianism
4909 +#define KSEG_MSK 0xE0000000 /* Most significant 3 bits denote kseg choice */
4912 +#ifndef KSEG_INV_MASK
4913 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
4917 +#define KSEG0_BASE 0x80000000
4921 +#define KSEG1_BASE 0xA0000000
4925 +#define KSEG0(addr) (((u32)(addr) & ~KSEG_MSK) | KSEG0_BASE)
4929 +#define KSEG1(addr) (((u32)(addr) & ~KSEG_MSK) | KSEG1_BASE)
4933 +#define KUSEG(addr) ((u32)(addr) & ~KSEG_MSK)
4937 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
4941 +#define PHYS_TO_K0(addr) (PHYS_ADDR(addr)|KSEG0_BASE)
4945 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
4949 +#define REG8_ADDR(addr) (volatile u8 *)(PHYS_TO_K1(addr))
4950 +#define REG8_DATA(addr) (*(volatile u8 *)(PHYS_TO_K1(addr)))
4951 +#define REG8_WRITE(addr, data) REG8_DATA(addr) = data;
4952 +#define REG8_READ(addr, data) data = (u8) REG8_DATA(addr);
4956 +#define REG16_ADDR(addr) (volatile u16 *)(PHYS_TO_K1(addr))
4957 +#define REG16_DATA(addr) (*(volatile u16 *)(PHYS_TO_K1(addr)))
4958 +#define REG16_WRITE(addr, data) REG16_DATA(addr) = data;
4959 +#define REG16_READ(addr, data) data = (u16) REG16_DATA(addr);
4963 +#define REG32_ADDR(addr) (volatile u32 *)(PHYS_TO_K1(addr))
4964 +#define REG32_DATA(addr) (*(volatile u32 *)(PHYS_TO_K1(addr)))
4965 +#define REG32_WRITE(addr, data) REG32_DATA(addr) = data;
4966 +#define REG32_READ(addr, data) data = (u32) REG32_DATA(addr);
4969 +#ifdef _LINK_KSEG0_ /* Application is linked into KSEG0 space */
4970 +#define VIRT_ADDR(addr) PHYS_TO_K0(PHYS_ADDR(addr))
4973 +#ifdef _LINK_KSEG1_ /* Application is linked into KSEG1 space */
4974 +#define VIRT_ADDR(addr) PHYS_TO_K1(PHYS_ADDR(addr))
4977 +#if !defined(_LINK_KSEG0_) && !defined(_LINK_KSEG1_)
4978 +#error You must define _LINK_KSEG0_ or _LINK_KSEG1_ to compile the code.
4981 +/* TNETD73XX chip definations */
4983 +#define FREQ_1MHZ 1000000
4984 +#define TNETD73XX_MIPS_FREQ tnetd73xx_mips_freq /* CPU clock frequency */
4985 +#define TNETD73XX_VBUS_FREQ tnetd73xx_vbus_freq /* originally (TNETD73XX_MIPS_FREQ/2) */
4988 +#define TNETD73XX_MIPS_FREQ_DEFAULT 25000000 /* 25 Mhz for sead2 board crystal */
4990 +#define TNETD73XX_MIPS_FREQ_DEFAULT 125000000 /* 125 Mhz */
4992 +#define TNETD73XX_VBUS_FREQ_DEFAULT (TNETD73XX_MIPS_FREQ_DEFAULT / 2) /* Sync mode */
4996 +/* Module base addresses */
4997 +#define TNETD73XX_ADSLSS_BASE PHYS_TO_K1(0x01000000) /* ADSLSS Module */
4998 +#define TNETD73XX_BBIF_CTRL_BASE PHYS_TO_K1(0x02000000) /* BBIF Control */
4999 +#define TNETD73XX_ATMSAR_BASE PHYS_TO_K1(0x03000000) /* ATM SAR */
5000 +#define TNETD73XX_USB_BASE PHYS_TO_K1(0x03400000) /* USB Module */
5001 +#define TNETD73XX_VLYNQ0_BASE PHYS_TO_K1(0x04000000) /* VLYNQ0 Module */
5002 +#define TNETD73xx_EMAC0_BASE PHYS_TO_K1(0x08610000) /* EMAC0 Module*/
5003 +#define TNETD73XX_EMIF_BASE PHYS_TO_K1(0x08610800) /* EMIF Module */
5004 +#define TNETD73XX_GPIO_BASE PHYS_TO_K1(0x08610900) /* GPIO control */
5005 +#define TNETD73XX_CLOCK_CTRL_BASE PHYS_TO_K1(0x08610A00) /* Clock Control */
5006 +#define TNETD73XX_WDTIMER_BASE PHYS_TO_K1(0x08610B00) /* WDTIMER Module */
5007 +#define TNETD73XX_TIMER0_BASE PHYS_TO_K1(0x08610C00) /* TIMER0 Module */
5008 +#define TNETD73XX_TIMER1_BASE PHYS_TO_K1(0x08610D00) /* TIMER1 Module */
5009 +#define TNETD73XX_UARTA_BASE PHYS_TO_K1(0x08610E00) /* UART A */
5010 +#define TNETD73XX_UARTB_BASE PHYS_TO_K1(0x08610F00) /* UART B */
5011 +#define TNETD73XX_I2C_BASE PHYS_TO_K1(0x08611000) /* I2C Module */
5012 +#define TNETD73XX_USB_DMA_BASE PHYS_TO_K1(0x08611200) /* USB Module */
5013 +#define TNETD73XX_MCDMA_BASE PHYS_TO_K1(0x08611400) /* MC-DMA */
5014 +#define TNETD73xx_VDMAVT_BASE PHYS_TO_K1(0x08611500) /* VDMAVT Control */
5015 +#define TNETD73XX_RST_CTRL_BASE PHYS_TO_K1(0x08611600) /* Reset Control */
5016 +#define TNETD73xx_BIST_CTRL_BASE PHYS_TO_K1(0x08611700) /* BIST Control */
5017 +#define TNETD73xx_VLYNQ0_CTRL_BASE PHYS_TO_K1(0x08611800) /* VLYNQ0 Control */
5018 +#define TNETD73XX_DCL_BASE PHYS_TO_K1(0x08611A00) /* Device Configuration Latch */
5019 +#define TNETD73xx_VLYNQ1_CTRL_BASE PHYS_TO_K1(0x08611C00) /* VLYNQ1 Control */
5020 +#define TNETD73xx_MDIO_BASE PHYS_TO_K1(0x08611E00) /* MDIO Control */
5021 +#define TNETD73XX_FSER_BASE PHYS_TO_K1(0x08612000) /* FSER Control */
5022 +#define TNETD73XX_INTC_BASE PHYS_TO_K1(0x08612400) /* Interrupt Controller */
5023 +#define TNETD73xx_EMAC1_BASE PHYS_TO_K1(0x08612800) /* EMAC1 Module*/
5024 +#define TNETD73XX_VLYNQ1_BASE PHYS_TO_K1(0x0C000000) /* VLYNQ1 Module */
5026 +/* BBIF Registers */
5027 +#define TNETD73XX_BBIF_ADSLADR (TNETD73XX_BBIF_CTRL_BASE + 0x0)
5029 +/* Device Configuration Latch Registers */
5030 +#define TNETD73XX_DCL_BOOTCR (TNETD73XX_DCL_BASE + 0x0)
5031 +#define TNETD73XX_DCL_DPLLSELR (TNETD73XX_DCL_BASE + 0x10)
5032 +#define TNETD73XX_DCL_SPEEDCTLR (TNETD73XX_DCL_BASE + 0x14)
5033 +#define TNETD73XX_DCL_SPEEDPWDR (TNETD73XX_DCL_BASE + 0x18)
5034 +#define TNETD73XX_DCL_SPEEDCAPR (TNETD73XX_DCL_BASE + 0x1C)
5037 +#define TNETD73XX_GPIODINR (TNETD73XX_GPIO_BASE + 0x0)
5038 +#define TNETD73XX_GPIODOUTR (TNETD73XX_GPIO_BASE + 0x4)
5039 +#define TNETD73XX_GPIOPDIRR (TNETD73XX_GPIO_BASE + 0x8)
5040 +#define TNETD73XX_GPIOENR (TNETD73XX_GPIO_BASE + 0xC)
5041 +#define TNETD73XX_CVR (TNETD73XX_GPIO_BASE + 0x14)
5042 +#define TNETD73XX_DIDR1 (TNETD73XX_GPIO_BASE + 0x18)
5043 +#define TNETD73XX_DIDR2 (TNETD73XX_GPIO_BASE + 0x1C)
5045 +/* Reset Control */
5046 +#define TNETD73XX_RST_CTRL_PRCR (TNETD73XX_RST_CTRL_BASE + 0x0)
5047 +#define TNETD73XX_RST_CTRL_SWRCR (TNETD73XX_RST_CTRL_BASE + 0x4)
5048 +#define TNETD73XX_RST_CTRL_RSR (TNETD73XX_RST_CTRL_BASE + 0x8)
5050 +/* Power Control */
5051 +#define TNETD73XX_POWER_CTRL_PDCR (TNETD73XX_CLOCK_CTRL_BASE + 0x0)
5052 +#define TNETD73XX_POWER_CTRL_PCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x4)
5053 +#define TNETD73XX_POWER_CTRL_PDUCR (TNETD73XX_CLOCK_CTRL_BASE + 0x8)
5054 +#define TNETD73XX_POWER_CTRL_WKCR (TNETD73XX_CLOCK_CTRL_BASE + 0xC)
5056 +/* Clock Control */
5057 +#define TNETD73XX_CLK_CTRL_SCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x20)
5058 +#define TNETD73XX_CLK_CTRL_SCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x30)
5059 +#define TNETD73XX_CLK_CTRL_MCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x40)
5060 +#define TNETD73XX_CLK_CTRL_MCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x50)
5061 +#define TNETD73XX_CLK_CTRL_UCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x60)
5062 +#define TNETD73XX_CLK_CTRL_UCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x70)
5063 +#define TNETD73XX_CLK_CTRL_ACLKCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x80)
5064 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x90)
5065 +#define TNETD73XX_CLK_CTRL_ACLKCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xA0)
5066 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xB0)
5069 +#define TNETD73XX_EMIF_SDRAM_CFG ( TNETD73XX_EMIF_BASE + 0x08 )
5073 +#define TNETD73XX_UART_FREQ 3686400
5075 +#define TNETD73XX_UART_FREQ TNETD73XX_VBUS_FREQ
5078 +/* Interrupt Controller */
5080 +/* Primary interrupts */
5081 +#define TNETD73XX_INTC_UNIFIED_SECONDARY 0 /* Unified secondary interrupt */
5082 +#define TNETD73XX_INTC_EXTERNAL0 1 /* External Interrupt Line 0 */
5083 +#define TNETD73XX_INTC_EXTERNAL1 2 /* External Interrupt Line 1 */
5084 +#define TNETD73XX_INTC_RESERVED3 3 /* Reserved */
5085 +#define TNETD73XX_INTC_RESERVED4 4 /* Reserved */
5086 +#define TNETD73XX_INTC_TIMER0 5 /* TIMER 0 int */
5087 +#define TNETD73XX_INTC_TIMER1 6 /* TIMER 1 int */
5088 +#define TNETD73XX_INTC_UART0 7 /* UART 0 int */
5089 +#define TNETD73XX_INTC_UART1 8 /* UART 1 int */
5090 +#define TNETD73XX_INTC_MCDMA0 9 /* MCDMA 0 int */
5091 +#define TNETD73XX_INTC_MCDMA1 10 /* MCDMA 1 int */
5092 +#define TNETD73XX_INTC_RESERVED11 11 /* Reserved */
5093 +#define TNETD73XX_INTC_RESERVED12 12 /* Reserved */
5094 +#define TNETD73XX_INTC_RESERVED13 13 /* Reserved */
5095 +#define TNETD73XX_INTC_RESERVED14 14 /* Reserved */
5096 +#define TNETD73XX_INTC_ATMSAR 15 /* ATM SAR int */
5097 +#define TNETD73XX_INTC_RESERVED16 16 /* Reserved */
5098 +#define TNETD73XX_INTC_RESERVED17 17 /* Reserved */
5099 +#define TNETD73XX_INTC_RESERVED18 18 /* Reserved */
5100 +#define TNETD73XX_INTC_EMAC0 19 /* EMAC 0 int */
5101 +#define TNETD73XX_INTC_RESERVED20 20 /* Reserved */
5102 +#define TNETD73XX_INTC_VLYNQ0 21 /* VLYNQ 0 int */
5103 +#define TNETD73XX_INTC_CODEC 22 /* CODEC int */
5104 +#define TNETD73XX_INTC_RESERVED23 23 /* Reserved */
5105 +#define TNETD73XX_INTC_USBSLAVE 24 /* USB Slave int */
5106 +#define TNETD73XX_INTC_VLYNQ1 25 /* VLYNQ 1 int */
5107 +#define TNETD73XX_INTC_RESERVED26 26 /* Reserved */
5108 +#define TNETD73XX_INTC_RESERVED27 27 /* Reserved */
5109 +#define TNETD73XX_INTC_ETH_PHY 28 /* Ethernet PHY */
5110 +#define TNETD73XX_INTC_I2C 29 /* I2C int */
5111 +#define TNETD73XX_INTC_MCDMA2 30 /* MCDMA 2 int */
5112 +#define TNETD73XX_INTC_MCDMA3 31 /* MCDMA 3 int */
5113 +#define TNETD73XX_INTC_RESERVED32 32 /* Reserved */
5114 +#define TNETD73XX_INTC_EMAC1 33 /* EMAC 1 int */
5115 +#define TNETD73XX_INTC_RESERVED34 34 /* Reserved */
5116 +#define TNETD73XX_INTC_RESERVED35 35 /* Reserved */
5117 +#define TNETD73XX_INTC_RESERVED36 36 /* Reserved */
5118 +#define TNETD73XX_INTC_VDMAVTRX 37 /* VDMAVTRX */
5119 +#define TNETD73XX_INTC_VDMAVTTX 38 /* VDMAVTTX */
5120 +#define TNETD73XX_INTC_ADSLSS 39 /* ADSLSS */
5122 +/* Secondary interrupts */
5123 +#define TNETD73XX_INTC_SEC0 40 /* Secondary */
5124 +#define TNETD73XX_INTC_SEC1 41 /* Secondary */
5125 +#define TNETD73XX_INTC_SEC2 42 /* Secondary */
5126 +#define TNETD73XX_INTC_SEC3 43 /* Secondary */
5127 +#define TNETD73XX_INTC_SEC4 44 /* Secondary */
5128 +#define TNETD73XX_INTC_SEC5 45 /* Secondary */
5129 +#define TNETD73XX_INTC_SEC6 46 /* Secondary */
5130 +#define TNETD73XX_INTC_EMIF 47 /* EMIF */
5131 +#define TNETD73XX_INTC_SEC8 48 /* Secondary */
5132 +#define TNETD73XX_INTC_SEC9 49 /* Secondary */
5133 +#define TNETD73XX_INTC_SEC10 50 /* Secondary */
5134 +#define TNETD73XX_INTC_SEC11 51 /* Secondary */
5135 +#define TNETD73XX_INTC_SEC12 52 /* Secondary */
5136 +#define TNETD73XX_INTC_SEC13 53 /* Secondary */
5137 +#define TNETD73XX_INTC_SEC14 54 /* Secondary */
5138 +#define TNETD73XX_INTC_SEC15 55 /* Secondary */
5139 +#define TNETD73XX_INTC_SEC16 56 /* Secondary */
5140 +#define TNETD73XX_INTC_SEC17 57 /* Secondary */
5141 +#define TNETD73XX_INTC_SEC18 58 /* Secondary */
5142 +#define TNETD73XX_INTC_SEC19 59 /* Secondary */
5143 +#define TNETD73XX_INTC_SEC20 60 /* Secondary */
5144 +#define TNETD73XX_INTC_SEC21 61 /* Secondary */
5145 +#define TNETD73XX_INTC_SEC22 62 /* Secondary */
5146 +#define TNETD73XX_INTC_SEC23 63 /* Secondary */
5147 +#define TNETD73XX_INTC_SEC24 64 /* Secondary */
5148 +#define TNETD73XX_INTC_SEC25 65 /* Secondary */
5149 +#define TNETD73XX_INTC_SEC26 66 /* Secondary */
5150 +#define TNETD73XX_INTC_SEC27 67 /* Secondary */
5151 +#define TNETD73XX_INTC_SEC28 68 /* Secondary */
5152 +#define TNETD73XX_INTC_SEC29 69 /* Secondary */
5153 +#define TNETD73XX_INTC_SEC30 70 /* Secondary */
5154 +#define TNETD73XX_INTC_SEC31 71 /* Secondary */
5156 +/* These ugly macros are to access the -1 registers, like config1 */
5157 +#define MFC0_SEL1_OPCODE(dst, src)\
5158 + .word (0x40000000 | ((dst)<<16) | ((src)<<11) | 1);\
5163 +#define MTC0_SEL1_OPCODE(dst, src)\
5164 + .word (0x40800000 | ((dst)<<16) | ((src)<<11) | 1);\
5170 +/* Below are Jade core specific */
5171 +#define CFG0_4K_IL_MASK 0x00380000
5172 +#define CFG0_4K_IL_SHIFT 19
5173 +#define CFG0_4K_IA_MASK 0x00070000
5174 +#define CFG0_4K_IA_SHIFT 16
5175 +#define CFG0_4K_IS_MASK 0x01c00000
5176 +#define CFG0_4K_IS_SHIFT 22
5178 +#define CFG0_4K_DL_MASK 0x00001c00
5179 +#define CFG0_4K_DL_SHIFT 10
5180 +#define CFG0_4K_DA_MASK 0x00000380
5181 +#define CFG0_4K_DA_SHIFT 7
5182 +#define CFG0_4K_DS_MASK 0x0000E000
5183 +#define CFG0_4K_DS_SHIFT 13
5187 +#endif /* __TNETD73XX_H_ */
5188 diff -urN linux-2.4.30/include/asm-mips/ar7/tnetd73xx_err.h linux-2.4.30.current/include/asm-mips/ar7/tnetd73xx_err.h
5189 --- linux-2.4.30/include/asm-mips/ar7/tnetd73xx_err.h 1970-01-01 01:00:00.000000000 +0100
5190 +++ linux-2.4.30.current/include/asm-mips/ar7/tnetd73xx_err.h 2005-06-12 20:14:28.000000000 +0200
5192 +/******************************************************************************
5193 + * FILE PURPOSE: TNETD73xx Error Definations Header File
5194 + ******************************************************************************
5195 + * FILE NAME: tnetd73xx_err.h
5197 + * DESCRIPTION: Error definations for TNETD73XX
5199 + * REVISION HISTORY:
5200 + * 27 Nov 02 - PSP TII
5202 + * (C) Copyright 2002, Texas Instruments, Inc
5203 + *******************************************************************************/
5206 +#ifndef __TNETD73XX_ERR_H__
5207 +#define __TNETD73XX_ERR_H__
5209 +typedef enum TNETD73XX_ERR_t
5211 + TNETD73XX_ERR_OK = 0, /* OK or SUCCESS */
5212 + TNETD73XX_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
5214 + /* Pointers and args */
5215 + TNETD73XX_ERR_INVARG = -2, /* Invaild argument to the call */
5216 + TNETD73XX_ERR_NULLPTR = -3, /* NULL pointer */
5217 + TNETD73XX_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
5219 + /* Memory issues */
5220 + TNETD73XX_ERR_ALLOC_FAIL = -10, /* allocation failed */
5221 + TNETD73XX_ERR_FREE_FAIL = -11, /* free failed */
5222 + TNETD73XX_ERR_MEM_CORRUPT = -12, /* corrupted memory */
5223 + TNETD73XX_ERR_BUF_LINK = -13, /* buffer linking failed */
5225 + /* Device issues */
5226 + TNETD73XX_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
5227 + TNETD73XX_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
5229 + TNETD73XX_ERR_INVID = -30 /* Invalid ID */
5233 +#endif /* __TNETD73XX_ERR_H__ */
5234 diff -urN linux-2.4.30/include/asm-mips/ar7/tnetd73xx_misc.h linux-2.4.30.current/include/asm-mips/ar7/tnetd73xx_misc.h
5235 --- linux-2.4.30/include/asm-mips/ar7/tnetd73xx_misc.h 1970-01-01 01:00:00.000000000 +0100
5236 +++ linux-2.4.30.current/include/asm-mips/ar7/tnetd73xx_misc.h 2005-06-12 20:14:28.000000000 +0200
5238 +/******************************************************************************
5239 + * FILE PURPOSE: TNETD73xx Misc modules API Header
5240 + ******************************************************************************
5241 + * FILE NAME: tnetd73xx_misc.h
5243 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
5244 + * FSER Modules API
5245 + * As per TNETD73xx specifications
5247 + * REVISION HISTORY:
5248 + * 27 Nov 02 - Sharath Kumar PSP TII
5249 + * 14 Feb 03 - Anant Gole PSP TII
5251 + * (C) Copyright 2002, Texas Instruments, Inc
5252 + *******************************************************************************/
5254 +#ifndef __TNETD73XX_MISC_H__
5255 +#define __TNETD73XX_MISC_H__
5257 +#include <linux/types.h>
5259 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
5261 +/*****************************************************************************
5262 + * Reset Control Module
5263 + *****************************************************************************/
5265 +typedef enum TNETD73XX_RESET_MODULE_tag
5267 + RESET_MODULE_UART0 = 0,
5268 + RESET_MODULE_UART1 = 1,
5269 + RESET_MODULE_I2C = 2,
5270 + RESET_MODULE_TIMER0 = 3,
5271 + RESET_MODULE_TIMER1 = 4,
5272 + RESET_MODULE_GPIO = 6,
5273 + RESET_MODULE_ADSLSS = 7,
5274 + RESET_MODULE_USBS = 8,
5275 + RESET_MODULE_SAR = 9,
5276 + RESET_MODULE_VDMA_VT = 11,
5277 + RESET_MODULE_FSER = 12,
5278 + RESET_MODULE_VLYNQ1 = 16,
5279 + RESET_MODULE_EMAC0 = 17,
5280 + RESET_MODULE_DMA = 18,
5281 + RESET_MODULE_BIST = 19,
5282 + RESET_MODULE_VLYNQ0 = 20,
5283 + RESET_MODULE_EMAC1 = 21,
5284 + RESET_MODULE_MDIO = 22,
5285 + RESET_MODULE_ADSLSS_DSP = 23,
5286 + RESET_MODULE_EPHY = 26
5287 +} TNETD73XX_RESET_MODULE_T;
5289 +typedef enum TNETD73XX_RESET_CTRL_tag
5293 +} TNETD73XX_RESET_CTRL_T;
5295 +typedef enum TNETD73XX_SYS_RST_MODE_tag
5297 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
5298 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
5299 +} TNETD73XX_SYS_RST_MODE_T;
5301 +typedef enum TNETD73XX_SYS_RESET_STATUS_tag
5303 + HARDWARE_RESET = 0,
5304 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
5306 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
5307 +} TNETD73XX_SYS_RESET_STATUS_T;
5309 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module,
5310 + TNETD73XX_RESET_CTRL_T reset_ctrl);
5311 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status(TNETD73XX_RESET_MODULE_T reset_module);
5312 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode);
5313 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status(void);
5315 +/*****************************************************************************
5316 + * Power Control Module
5317 + *****************************************************************************/
5319 +typedef enum TNETD73XX_POWER_MODULE_tag
5321 + POWER_MODULE_USBSP = 0,
5322 + POWER_MODULE_WDTP = 1,
5323 + POWER_MODULE_UT0P = 2,
5324 + POWER_MODULE_UT1P = 3,
5325 + POWER_MODULE_IICP = 4,
5326 + POWER_MODULE_VDMAP = 5,
5327 + POWER_MODULE_GPIOP = 6,
5328 + POWER_MODULE_VLYNQ1P = 7,
5329 + POWER_MODULE_SARP = 8,
5330 + POWER_MODULE_ADSLP = 9,
5331 + POWER_MODULE_EMIFP = 10,
5332 + POWER_MODULE_ADSPP = 12,
5333 + POWER_MODULE_RAMP = 13,
5334 + POWER_MODULE_ROMP = 14,
5335 + POWER_MODULE_DMAP = 15,
5336 + POWER_MODULE_BISTP = 16,
5337 + POWER_MODULE_TIMER0P = 18,
5338 + POWER_MODULE_TIMER1P = 19,
5339 + POWER_MODULE_EMAC0P = 20,
5340 + POWER_MODULE_EMAC1P = 22,
5341 + POWER_MODULE_EPHYP = 24,
5342 + POWER_MODULE_VLYNQ0P = 27,
5343 +} TNETD73XX_POWER_MODULE_T;
5345 +typedef enum TNETD73XX_POWER_CTRL_tag
5347 + POWER_CTRL_POWER_UP = 0,
5348 + POWER_CTRL_POWER_DOWN
5349 +} TNETD73XX_POWER_CTRL_T;
5351 +typedef enum TNETD73XX_SYS_POWER_MODE_tag
5353 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
5354 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
5355 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
5356 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
5357 +} TNETD73XX_SYS_POWER_MODE_T;
5359 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl);
5360 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module);
5361 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode);
5362 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode(void);
5364 +/*****************************************************************************
5366 + *****************************************************************************/
5368 +typedef enum TNETD73XX_WAKEUP_INTERRUPT_tag
5374 +} TNETD73XX_WAKEUP_INTERRUPT_T;
5376 +typedef enum TNETD73XX_WAKEUP_CTRL_tag
5378 + WAKEUP_DISABLED = 0,
5380 +} TNETD73XX_WAKEUP_CTRL_T;
5382 +typedef enum TNETD73XX_WAKEUP_POLARITY_tag
5384 + WAKEUP_ACTIVE_HIGH = 0,
5386 +} TNETD73XX_WAKEUP_POLARITY_T;
5388 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
5389 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
5390 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity);
5392 +/*****************************************************************************
5394 + *****************************************************************************/
5396 +typedef enum TNETD73XX_FSER_MODE_tag
5400 +} TNETD73XX_FSER_MODE_T;
5402 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode);
5404 +/*****************************************************************************
5406 + *****************************************************************************/
5408 +#define CLK_MHZ(x) ( (x) * 1000000 )
5410 +typedef enum TNETD73XX_CLKC_ID_tag
5416 +} TNETD73XX_CLKC_ID_T;
5418 +void tnetd73xx_clkc_init(u32 afeclk, u32 refclk, u32 xtal3in);
5419 +TNETD73XX_ERR tnetd73xx_clkc_set_freq(TNETD73XX_CLKC_ID_T clk_id, u32 output_freq);
5420 +u32 tnetd73xx_clkc_get_freq(TNETD73XX_CLKC_ID_T clk_id);
5422 +/*****************************************************************************
5424 + *****************************************************************************/
5426 +typedef enum TNETD73XX_GPIO_PIN_tag
5428 + GPIO_UART0_RD = 0,
5429 + GPIO_UART0_TD = 1,
5430 + GPIO_UART0_RTS = 2,
5431 + GPIO_UART0_CTS = 3,
5432 + GPIO_FSER_CLK = 4,
5434 + GPIO_EXT_AFE_SCLK = 6,
5435 + GPIO_EXT_AFE_TX_FS = 7,
5436 + GPIO_EXT_AFE_TXD = 8,
5437 + GPIO_EXT_AFE_RS_FS = 9,
5438 + GPIO_EXT_AFE_RXD1 = 10,
5439 + GPIO_EXT_AFE_RXD0 = 11,
5440 + GPIO_EXT_AFE_CDIN = 12,
5441 + GPIO_EXT_AFE_CDOUT = 13,
5442 + GPIO_EPHY_SPEED100 = 14,
5443 + GPIO_EPHY_LINKON = 15,
5444 + GPIO_EPHY_ACTIVITY = 16,
5445 + GPIO_EPHY_FDUPLEX = 17,
5448 + GPIO_MBSP0_TCLK = 20,
5449 + GPIO_MBSP0_RCLK = 21,
5450 + GPIO_MBSP0_RD = 22,
5451 + GPIO_MBSP0_TD = 23,
5452 + GPIO_MBSP0_RFS = 24,
5453 + GPIO_MBSP0_TFS = 25,
5454 + GPIO_MII_DIO = 26,
5455 + GPIO_MII_DCLK = 27,
5456 +} TNETD73XX_GPIO_PIN_T;
5458 +typedef enum TNETD73XX_GPIO_PIN_MODE_tag
5460 + FUNCTIONAL_PIN = 0,
5462 +} TNETD73XX_GPIO_PIN_MODE_T;
5464 +typedef enum TNETD73XX_GPIO_PIN_DIRECTION_tag
5466 + GPIO_OUTPUT_PIN = 0,
5467 + GPIO_INPUT_PIN = 1
5468 +} TNETD73XX_GPIO_PIN_DIRECTION_T;
5470 +void tnetd73xx_gpio_init(void);
5471 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
5472 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
5473 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction);
5474 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value);
5475 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin);
5477 +/* TNETD73XX Revision */
5478 +u32 tnetd73xx_get_revision(void);
5480 +#endif /* __TNETD73XX_MISC_H__ */
5481 diff -urN linux-2.4.30/include/asm-mips/io.h linux-2.4.30.current/include/asm-mips/io.h
5482 --- linux-2.4.30/include/asm-mips/io.h 2003-08-25 13:44:43.000000000 +0200
5483 +++ linux-2.4.30.current/include/asm-mips/io.h 2005-06-12 20:14:28.000000000 +0200
5485 #ifdef CONFIG_64BIT_PHYS_ADDR
5486 #define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
5488 +#ifdef CONFIG_AR7_PAGING
5489 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + CONFIG_AR7_MEMORY)
5491 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
5495 #define IO_SPACE_LIMIT 0xffff
5497 diff -urN linux-2.4.30/include/asm-mips/irq.h linux-2.4.30.current/include/asm-mips/irq.h
5498 --- linux-2.4.30/include/asm-mips/irq.h 2003-08-25 13:44:43.000000000 +0200
5499 +++ linux-2.4.30.current/include/asm-mips/irq.h 2005-06-12 20:14:28.000000000 +0200
5501 #include <linux/config.h>
5502 #include <linux/linkage.h>
5505 +#include <asm/ar7/avalanche_intc.h>
5506 +#define NR_IRQS AVALANCHE_INT_END + 1
5508 #define NR_IRQS 128 /* Largest number of ints of all machines. */
5512 static inline int irq_cannonicalize(int irq)
5513 diff -urN linux-2.4.30/include/asm-mips/page.h linux-2.4.30.current/include/asm-mips/page.h
5514 --- linux-2.4.30/include/asm-mips/page.h 2004-02-18 14:36:32.000000000 +0100
5515 +++ linux-2.4.30.current/include/asm-mips/page.h 2005-06-12 20:14:28.000000000 +0200
5516 @@ -129,7 +129,11 @@
5518 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
5519 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
5520 +#ifdef CONFIG_AR7_PAGING
5521 +#define virt_to_page(kaddr) phys_to_page(__pa(kaddr))
5523 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
5525 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
5527 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
5528 diff -urN linux-2.4.30/include/asm-mips/pgtable-32.h linux-2.4.30.current/include/asm-mips/pgtable-32.h
5529 --- linux-2.4.30/include/asm-mips/pgtable-32.h 2004-02-18 14:36:32.000000000 +0100
5530 +++ linux-2.4.30.current/include/asm-mips/pgtable-32.h 2005-06-12 20:14:28.000000000 +0200
5531 @@ -108,7 +108,18 @@
5532 * and a page entry and page directory to the page they refer to.
5535 -#ifdef CONFIG_CPU_VR41XX
5536 +#if defined(CONFIG_AR7_PAGING)
5537 +#define mk_pte(page, pgprot) \
5541 + pte_val(__pte) = ((phys_t)(page - mem_map) << (PAGE_SHIFT) | \
5542 + CONFIG_AR7_MEMORY) | \
5543 + pgprot_val(pgprot); \
5547 +#elif defined(CONFIG_CPU_VR41XX)
5548 #define mk_pte(page, pgprot) \
5556 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
5558 #ifdef CONFIG_CPU_VR41XX
5559 @@ -175,7 +187,10 @@
5560 set_pte(ptep, __pte(0));
5563 -#ifdef CONFIG_CPU_VR41XX
5564 +#if defined(CONFIG_AR7_PAGING)
5565 +#define phys_to_page(phys) (mem_map + (((phys)-CONFIG_AR7_MEMORY) >> PAGE_SHIFT))
5566 +#define pte_page(x) phys_to_page(pte_val(x))
5567 +#elif defined(CONFIG_CPU_VR41XX)
5568 #define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> (PAGE_SHIFT+2)))))
5569 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << (PAGE_SHIFT+2)) | pgprot_val(pgprot))
5571 diff -urN linux-2.4.30/include/asm-mips/serial.h linux-2.4.30.current/include/asm-mips/serial.h
5572 --- linux-2.4.30/include/asm-mips/serial.h 2005-01-19 15:10:12.000000000 +0100
5573 +++ linux-2.4.30.current/include/asm-mips/serial.h 2005-06-12 20:14:28.000000000 +0200
5576 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
5579 +#include <asm/ar7/ar7.h>
5580 +#define AR7_SERIAL_PORT_DEFNS \
5581 + { 0, AVALANCHE_BASE_BAUD, AVALANCHE_UART0_REGS_BASE, LNXINTNUM(AVALANCHE_UART0_INT), STD_COM_FLAGS }, \
5582 + { 0, AVALANCHE_BASE_BAUD, AVALANCHE_UART1_REGS_BASE, LNXINTNUM(AVALANCHE_UART1_INT), STD_COM_FLAGS },
5584 +#define AR7_SERIAL_PORT_DEFNS
5587 #ifdef CONFIG_MIPS_JAZZ
5588 #define _JAZZ_SERIAL_INIT(int, base) \
5589 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
5593 #define SERIAL_PORT_DFNS \
5594 + AR7_SERIAL_PORT_DEFNS \
5595 ATLAS_SERIAL_PORT_DEFNS \
5596 AU1000_SERIAL_PORT_DEFNS \
5597 COBALT_SERIAL_PORT_DEFNS \