add incomplete ar7 hardware support (disabled by default)
[openwrt.git] / openwrt / target / linux / linux-2.4 / patches / ar7 / 000-ar7_support.patch
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
4 @@ -91,7 +91,7 @@
5
6 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
7
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
16 @@ -369,6 +369,16 @@
17 endif
18
19 #
20 +# Texas Instruments AR7
21 +#
22 +
23 +ifdef CONFIG_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
27 +endif
28 +
29 +#
30 # DECstation family
31 #
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
36 @@ -0,0 +1,12 @@
37 +.S.s:
38 + $(CPP) $(AFLAGS) $< -o $*.s
39 +
40 +.S.o:
41 + $(CC) $(AFLAGS) -c $< -o $*.o
42 +
43 +O_TARGET := ar7.o
44 +
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
47 +
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
52 @@ -0,0 +1,13 @@
53 +.S.s:
54 + $(CPP) $(AFLAGS) $< -o $*.s
55 +
56 +.S.o:
57 + $(CC) $(AFLAGS) -c $< -o $*.o
58 +
59 +EXTRA_CFLAGS := -DLITTLE_ENDIAN -D_LINK_KSEG0_
60 +
61 +O_TARGET := avalanche.o
62 +
63 +obj-y += avalanche_paging.o avalanche_jump.o
64 +
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
69 @@ -0,0 +1,69 @@
70 +#include <linux/config.h>
71 +#include <linux/threads.h>
72 +
73 +#include <asm/asm.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>
82 +
83 +.text
84 +
85 +.set noreorder
86 +.set noat
87 +
88 +/* TLB Miss Vector */
89 +
90 +LEAF(jump_tlb_miss)
91 + .set mips2
92 + lui k0,0x9400
93 + ori k0,0
94 + jr k0
95 + nop
96 +END(jump_tlb_miss)
97 +
98 + /* Unused TLB Miss Vector */
99 +
100 +LEAF(jump_tlb_miss_unused)
101 + .set mips2
102 + lui k0,0x9400
103 + ori k0,0x80
104 + jr k0
105 + nop
106 +END(jump_tlb_miss_unused)
107 +
108 + /* Cache Error Vector */
109 +
110 +LEAF(jump_cache_error)
111 + .set mips2
112 + lui k0,0x9400
113 + ori k0,0x100
114 + jr k0
115 + nop
116 +END(jump_cache_error)
117 +
118 + /* General Exception */
119 +
120 +LEAF(jump_general_exception)
121 + .set mips2
122 + lui k0,0x9400
123 + ori k0,0x180
124 + jr k0
125 + nop
126 +END(jump_general_exception)
127 +
128 + /* Dedicated Interrupt */
129 +
130 +LEAF(jump_dedicated_interrupt)
131 + .set mips2
132 + lui k0,0x9400
133 + ori k0,0x200
134 + jr k0
135 + nop
136 +END(jump_dedicated_interrupt)
137 +
138 + .set at
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
142 @@ -0,0 +1,314 @@
143 +/*
144 + * -*- linux-c -*-
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.
148 + *
149 + * Copyright (C) 2002 by Jeff Harrell (jharrell@ti.com)
150 + * Copyright (C) 2002 Texas Instruments, Inc.
151 + *
152 + */
153 +
154 +/*
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)
159 + *
160 + * -JAH
161 + */
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>
180 +
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>
187 +#include <asm/io.h>
188 +#include <asm/tlb.h>
189 +#include <asm/cpu.h>
190 +
191 +#define __MEMORY_START CONFIG_AR7_MEMORY
192 +
193 +#ifdef CONFIG_DISCONTIGMEM
194 +pg_data_t discontig_page_data[NR_NODES];
195 +bootmem_data_t discontig_node_bdata[NR_NODES];
196 +#endif
197 +
198 +static unsigned long totalram_pages;
199 +/* static unsigned long totalhigh_pages; */
200 +
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)
203 +
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)
207 +
208 +unsigned long bootmap_size;
209 +
210 +extern char *prom_getenv(char *envname);
211 +
212 +/*
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.
218 + */
219 +
220 +static inline unsigned long setup_zero_pages(void)
221 +{
222 + unsigned long order, size;
223 + struct page *page;
224 + if(current_cpu_data.options & MIPS_CPU_VCE)
225 + order = 3;
226 + else
227 + order = 0;
228 +
229 + empty_zero_page = __get_free_pages(GFP_KERNEL, order);
230 +
231 + if (!empty_zero_page)
232 + panic("Oh boy, that early out of memory?");
233 +
234 + page = virt_to_page(empty_zero_page);
235 +
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);
239 + page++;
240 + }
241 +
242 + size = PAGE_SIZE << order;
243 + zero_page_mask = (size - 1) & PAGE_MASK;
244 + memset((void *)empty_zero_page, 0, size);
245 +
246 + return 1UL << order;
247 +}
248 +
249 +/*
250 + * paging_init() sets up the page tables
251 + *
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.
254 + */
255 +void __init paging_init(void)
256 +{
257 + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
258 + unsigned long low, start_pfn;
259 +
260 + /* Initialize the entire pgd. */
261 + pgd_init((unsigned long)swapper_pg_dir);
262 + pgd_init((unsigned long)swapper_pg_dir + PAGE_SIZE / 2);
263 +
264 +
265 + start_pfn = START_PFN;
266 + // max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
267 + low = MAX_LOW_PFN;
268 +
269 + /* Avalanche DMA-able memory 0x14000000+memsize */
270 +
271 + zones_size[ZONE_DMA] = low - start_pfn;
272 +
273 + free_area_init_node(0, NODE_DATA(0), 0, zones_size, __MEMORY_START, 0);
274 +
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 */
280 +
281 +}
282 +
283 +extern char _ftext, _etext, _fdata, _edata, _end;
284 +extern char __init_begin, __init_end;
285 +
286 +void __init mem_init(void)
287 +{
288 + int codesize, reservedpages, datasize, initsize;
289 + int tmp;
290 +
291 + max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN;
292 + high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE);
293 +
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
297 + */
298 + free_bootmem_node(NODE_DATA(0), (__MEMORY_START+PAGE_SIZE),
299 + (__pa(&_ftext))-(__MEMORY_START+PAGE_SIZE) );
300 +
301 + /* this will put all low memory onto the freelists */
302 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
303 +
304 + /* Setup zeroed pages */
305 + totalram_pages -= setup_zero_pages();
306 +
307 +
308 +#ifdef CONFIG_DISCONTIGMEM
309 + totalram_pages += free_all_bootmem_node(NODE_DATA(1));
310 +#endif
311 + reservedpages = 0;
312 + for (tmp = 0; tmp < num_physpages; tmp++)
313 + /*
314 + * Only count reserved RAM pages
315 + */
316 + if (PageReserved(mem_map+tmp))
317 + reservedpages++;
318 +
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;
322 +
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),
326 + codesize >> 10,
327 + reservedpages << (PAGE_SHIFT-10),
328 + datasize >> 10,
329 + initsize >> 10);
330 +
331 +}
332 +
333 +/* fixes paging routines for avalanche (utilized in /arch/mips/kernel/setup.c) */
334 +
335 +void avalanche_bootmem_init(void)
336 +{
337 + unsigned long start_pfn, max_pfn;
338 + unsigned long max_low_pfn;
339 + unsigned int memsize,memory_end,memory_start;
340 + char *memsize_str;
341 +
342 + memsize_str = prom_getenv("memsize");
343 + if (!memsize_str) {
344 + memsize = 0x02000000;
345 + } else {
346 + memsize = simple_strtol(memsize_str, NULL, 0);
347 + }
348 +
349 +
350 + memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START;
351 + memory_end = memory_start + memsize;
352 +
353 + /*
354 + * Find the highest memory page fram number we have available
355 + */
356 +
357 + max_pfn = PFN_DOWN(__pa(memory_end));
358 +
359 + /*
360 + * Determine the low and high memory ranges
361 + */
362 +
363 + max_low_pfn = max_pfn;
364 +
365 + /*
366 + * Partially used pages are not usable - thus we are
367 + * rounding upwards:
368 + */
369 +
370 + start_pfn = PFN_UP(__pa(&_end));
371 +
372 + /*
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().
376 + */
377 +
378 + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
379 + __MEMORY_START>>PAGE_SHIFT, max_low_pfn);
380 +
381 +
382 + /*
383 + * Register fully available low RAM pages with the bootmem allocator.
384 + */
385 +
386 + {
387 + unsigned long curr_pfn, last_pfn, pages;
388 +
389 + /*
390 + * We are rounding up the start address of usable memory:
391 + */
392 + curr_pfn = PFN_UP(__MEMORY_START);
393 +
394 + /*
395 + * ... and at the end of the usable range downwards:
396 + */
397 + last_pfn = PFN_DOWN(__pa(memory_end));
398 +
399 + if (last_pfn > max_low_pfn)
400 + last_pfn = max_low_pfn;
401 +
402 + pages = last_pfn - curr_pfn;
403 +
404 +
405 + free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
406 + PFN_PHYS(pages));
407 + }
408 +
409 + /*
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.
415 + */
416 + reserve_bootmem_node(NODE_DATA(0), __MEMORY_START+PAGE_SIZE,
417 + (PFN_PHYS(start_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START);
418 +
419 + /*
420 + * reserve physical page 0 - it's a special BIOS page on many boxes,
421 + * enabling clean reboots, SMP operation, laptop functions.
422 + */
423 + reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);
424 +}
425 +
426 +extern char __init_begin, __init_end;
427 +
428 +void free_initmem(void)
429 +{
430 + unsigned long addr;
431 + // prom_free_prom_memory ();
432 +
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);
437 + free_page(addr);
438 + totalram_pages++;
439 + addr += PAGE_SIZE;
440 + }
441 + printk("Freeing unused kernel memory: %dk freed\n",
442 + (&__init_end - &__init_begin) >> 10);
443 +}
444 +
445 +void si_meminfo(struct sysinfo *val)
446 +{
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;
454 +
455 + return;
456 +}
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
460 @@ -0,0 +1,64 @@
461 +/*
462 + * Carsten Langgaard, carstenl@mips.com
463 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
464 + *
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.
468 + *
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.
473 + *
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.
477 + *
478 + * Kernel command line creation using the prom monitor (YAMON) argc/argv.
479 + */
480 +#include <linux/init.h>
481 +#include <linux/string.h>
482 +
483 +#include <asm/bootinfo.h>
484 +
485 +extern int prom_argc;
486 +extern int *_prom_argv;
487 +
488 +/*
489 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
490 + * This macro take care of sign extension.
491 + */
492 +#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
493 +
494 +char arcs_cmdline[CL_SIZE];
495 +
496 +char * __init prom_getcmdline(void)
497 +{
498 + return &(arcs_cmdline[0]);
499 +}
500 +
501 +
502 +void __init prom_init_cmdline(void)
503 +{
504 + char *cp;
505 + int actr;
506 +
507 + actr = 1; /* Always ignore argv[0] */
508 +
509 + cp = &(arcs_cmdline[0]);
510 +#ifdef CONFIG_CMDLINE_BOOL
511 + strcpy(cp, CONFIG_CMDLINE);
512 + cp += strlen(CONFIG_CMDLINE);
513 + *cp++ = ' ';
514 +#endif
515 + while(actr < prom_argc) {
516 + strcpy(cp, prom_argv(actr));
517 + cp += strlen(prom_argv(actr));
518 + *cp++ = ' ';
519 + actr++;
520 + }
521 + if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
522 + --cp;
523 + *cp = '\0';
524 +}
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
528 @@ -0,0 +1,127 @@
529 +/*
530 + * Carsten Langgaard, carstenl@mips.com
531 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
532 + *
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.
536 + *
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.
541 + *
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.
545 + *
546 + * PROM library initialisation code.
547 + */
548 +#include <linux/config.h>
549 +#include <linux/init.h>
550 +#include <linux/string.h>
551 +#include <linux/kernel.h>
552 +
553 +#include <asm/io.h>
554 +#include <asm/mips-boards/prom.h>
555 +#include <asm/mips-boards/generic.h>
556 +
557 +/* Environment variable */
558 +typedef struct {
559 + char *name;
560 + char *val;
561 +} t_env_var;
562 +
563 +int prom_argc;
564 +int *_prom_argv, *_prom_envp;
565 +
566 +/*
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.
569 + */
570 +#define prom_envp(index) ((char *)(((int *)(int)_prom_envp)[(index)]))
571 +
572 +int init_debug = 0;
573 +
574 +char *prom_getenv(char *envname)
575 +{
576 + /*
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.
581 + */
582 + int i, index=0;
583 +
584 + i = strlen(envname);
585 +
586 + while (prom_envp(index)) {
587 + if(strncmp(envname, prom_envp(index), i) == 0) {
588 + return(prom_envp(index+1));
589 + }
590 + index += 2;
591 + }
592 +
593 + return NULL;
594 +}
595 +
596 +static inline unsigned char str2hexnum(unsigned char c)
597 +{
598 + if (c >= '0' && c <= '9')
599 + return c - '0';
600 + if (c >= 'a' && c <= 'f')
601 + return c - 'a' + 10;
602 + return 0; /* foo */
603 +}
604 +
605 +static inline void str2eaddr(unsigned char *ea, unsigned char *str)
606 +{
607 + int i;
608 +
609 + for (i = 0; i < 6; i++) {
610 + unsigned char num;
611 +
612 + if((*str == '.') || (*str == ':'))
613 + str++;
614 + num = str2hexnum(*str++) << 4;
615 + num |= (str2hexnum(*str++));
616 + ea[i] = num;
617 + }
618 +}
619 +
620 +int get_ethernet_addr(char *ethernet_addr)
621 +{
622 + char *ethaddr_str;
623 +
624 + ethaddr_str = prom_getenv("ethaddr");
625 + if (!ethaddr_str) {
626 + printk("ethaddr not set in boot prom\n");
627 + return -1;
628 + }
629 + str2eaddr(ethernet_addr, ethaddr_str);
630 +
631 + if (init_debug > 1) {
632 + int i;
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));
637 + }
638 +
639 + return 0;
640 +}
641 +
642 +int __init prom_init(int argc, char **argv, char **envp)
643 +{
644 + prom_argc = argc;
645 + _prom_argv = (int *)argv;
646 + _prom_envp = (int *)envp;
647 +
648 + set_io_port_base(0);
649 +
650 + prom_printf("\nLINUX started...\n");
651 + prom_init_cmdline();
652 + prom_meminit();
653 +
654 + return 0;
655 +}
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
659 @@ -0,0 +1,669 @@
660 +/*
661 + * Nitin Dhingra, iamnd@ti.com
662 + * Copyright (C) 2002 Texas Instruments, Inc. All rights reserved.
663 + *
664 + * ########################################################################
665 + *
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.
669 + *
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.
674 + *
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.
678 + *
679 + * ########################################################################
680 + *
681 + * Routines for generic manipulation of the interrupts found on the Texas
682 + * Instruments avalanche board
683 + *
684 + */
685 +
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>
698 +
699 +
700 +#define shutdown_avalanche_irq disable_avalanche_irq
701 +#define mask_and_ack_avalanche_irq disable_avalanche_irq
702 +
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);
707 +
708 +static struct hw_interrupt_type avalanche_irq_type = {
709 + "TI AVALANCHE",
710 + startup_avalanche_irq,
711 + shutdown_avalanche_irq,
712 + enable_avalanche_irq,
713 + disable_avalanche_irq,
714 + mask_and_ack_avalanche_irq,
715 + end_avalanche_irq,
716 + NULL
717 +};
718 +
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}};
721 +
722 +
723 +unsigned long spurious_count = 0;
724 +
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 */
729 +
730 +extern asmlinkage void mipsIRQ(void);
731 +
732 +
733 +/*
734 + * The avalanche/MIPS interrupt line numbers are used to represent the
735 + * interrupts within the irqaction arrays. The index notation is
736 + * is as follows:
737 + *
738 + * 0-7 MIPS CPU Exceptions (HW/SW)
739 + * 8-47 Primary Interrupts (Avalanche)
740 + * 48-79 Secondary Interrupts (Avalanche)
741 + *
742 + */
743 +
744 +
745 +static struct irqaction *hw0_irq_action_primary[AVINTNUM(AVALANCHE_INT_END_PRIMARY)] =
746 +{
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
757 +};
758 +
759 +static struct irqaction *hw0_irq_action_secondary[AVINTNUM(AVALANCHE_INT_END_SECONDARY)] =
760 +{
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
769 +};
770 +
771 +/*
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
774 + array
775 + */
776 +
777 +
778 +static unsigned long line_to_channel[AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
779 +unsigned long uni_secondary_interrupt = 0;
780 +
781 +static struct irqaction r4ktimer_action = {
782 + NULL, 0, 0, "R4000 timer/counter", NULL, NULL,
783 +};
784 +
785 +static struct irqaction *irq_action[8] = {
786 + NULL, /* SW int 0 */
787 + NULL, /* SW int 1 */
788 + NULL, /* HW int 0 */
789 + NULL,
790 + NULL,
791 + NULL, /* HW int 3 */
792 + NULL, /* HW int 4 */
793 + &r4ktimer_action /* HW int 5 */
794 +};
795 +
796 +static void end_avalanche_irq(unsigned int irq)
797 +{
798 + if (!(irq_desc_ti[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
799 + enable_avalanche_irq(irq);
800 +}
801 +
802 +void disable_avalanche_irq(unsigned int irq_nr)
803 +{
804 + unsigned long flags;
805 + unsigned long chan_nr=0;
806 + unsigned long int_bit=0;
807 +
808 + if(irq_nr >= AVALANCHE_INT_END)
809 + {
810 + printk("whee, invalid irq_nr %d\n", irq_nr);
811 + panic("IRQ, you lose...");
812 + }
813 +
814 + save_and_cli(flags);
815 +
816 +
817 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
818 + {
819 + /* disable mips exception */
820 +
821 + int_bit = read_c0_status() & ~(1 << (8+irq_nr));
822 + change_c0_status(ST0_IM,int_bit);
823 + restore_flags(flags);
824 + return;
825 + }
826 +
827 + /* irq_nr represents the line number for the interrupt. We must
828 + * disable the channel number associated with that line number.
829 + */
830 +
831 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
832 + chan_nr = AVINTNUM(irq_nr); /*CHECK THIS ALSO*/
833 + else
834 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];/* WE NEED A LINE TO CHANNEL MAPPING FUNCTION HERE*/
835 +
836 + /* disable the interrupt channel bit */
837 +
838 + /* primary interrupt #'s 0-31 */
839 +
840 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
841 + avalanche_hw0_icregs->intecr1 = (1 << chan_nr);
842 +
843 + /* primary interrupt #'s 32-39 */
844 +
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)));
848 +
849 + else /* secondary interrupt #'s 0-31 */
850 + avalanche_hw0_ecregs->exiecr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
851 +
852 + restore_flags(flags);
853 +}
854 +
855 +void enable_avalanche_irq(unsigned int irq_nr)
856 +{
857 + unsigned long flags;
858 + unsigned long chan_nr=0;
859 + unsigned long int_bit=0;
860 +
861 + if(irq_nr > AVALANCHE_INT_END) {
862 + printk("whee, invalid irq_nr %d\n", irq_nr);
863 + panic("IRQ, you lose...");
864 + }
865 +
866 + save_and_cli(flags);
867 +
868 +
869 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
870 + {
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);
875 + return;
876 + }
877 +
878 + /* irq_nr represents the line number for the interrupt. We must
879 + * disable the channel number associated with that line number.
880 + */
881 +
882 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
883 + chan_nr = AVINTNUM(irq_nr);
884 + else
885 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];
886 +
887 + /* enable the interrupt channel bit */
888 +
889 + /* primary interrupt #'s 0-31 */
890 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
891 + avalanche_hw0_icregs->intesr1 = (1 << chan_nr);
892 +
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)));
897 +
898 + else /* secondary interrupt #'s 0-31 */
899 + avalanche_hw0_ecregs->exiesr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
900 +
901 + restore_flags(flags);
902 +}
903 +
904 +static unsigned int startup_avalanche_irq(unsigned int irq)
905 +{
906 + enable_avalanche_irq(irq);
907 + return 0; /* never anything pending */
908 +}
909 +
910 +
911 +int get_irq_list(char *buf)
912 +{
913 + int i, len = 0;
914 + int num = 0;
915 + struct irqaction *action;
916 +
917 + for (i = 0; i < MIPS_EXCEPTION_OFFSET; i++, num++)
918 + {
919 + action = irq_action[i];
920 + if (!action)
921 + continue;
922 + len += sprintf(buf+len, "%2d: %8d %c %s",
923 + num, kstat.irqs[0][num],
924 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
925 + action->name);
926 + for (action=action->next; action; action = action->next) {
927 + len += sprintf(buf+len, ",%s %s",
928 + (action->flags & SA_INTERRUPT) ? " +" : "",
929 + action->name);
930 + }
931 + len += sprintf(buf+len, " [MIPS interrupt]\n");
932 + }
933 +
934 +
935 + for (i = 0; i < AVINTNUM(AVALANCHE_INT_END); i++,num++)
936 + {
937 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
938 + action = hw0_irq_action_primary[i];
939 + else
940 + action = hw0_irq_action_secondary[i-AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
941 + if (!action)
942 + continue;
943 + len += sprintf(buf+len, "%2d: %8d %c %s",
944 + num, kstat.irqs[0][ LNXINTNUM(i) ],
945 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
946 + action->name);
947 +
948 + for (action=action->next; action; action = action->next)
949 + {
950 + len += sprintf(buf+len, ",%s %s",
951 + (action->flags & SA_INTERRUPT) ? " +" : "",
952 + action->name);
953 + }
954 +
955 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
956 + len += sprintf(buf+len, " [hw0 (Avalanche Primary)]\n");
957 + else
958 + len += sprintf(buf+len, " [hw0 (Avalanche Secondary)]\n");
959 +
960 + }
961 +
962 + return len;
963 +}
964 +
965 +int request_irq(unsigned int irq,
966 + void (*handler)(int, void *, struct pt_regs *),
967 + unsigned long irqflags,
968 + const char * devname,
969 + void *dev_id)
970 +{
971 + struct irqaction *action;
972 +
973 + if (irq > AVALANCHE_INT_END)
974 + return -EINVAL;
975 + if (!handler)
976 + return -EINVAL;
977 +
978 + action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
979 + if(!action)
980 + return -ENOMEM;
981 +
982 + action->handler = handler;
983 + action->flags = irqflags;
984 + action->mask = 0;
985 + action->name = devname;
986 + irq_desc_ti[irq].action = action;
987 + action->dev_id = dev_id;
988 +
989 + action->next = 0;
990 +
991 + if(irq < MIPS_EXCEPTION_OFFSET)
992 + {
993 + irq_action[irq] = action;
994 + enable_avalanche_irq(irq);
995 + return 0;
996 + }
997 +
998 + if(irq < AVALANCHE_INT_END_PRIMARY)
999 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = action;
1000 + else
1001 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = action;
1002 +
1003 + enable_avalanche_irq(irq);
1004 +
1005 + return 0;
1006 +}
1007 +
1008 +void free_irq(unsigned int irq, void *dev_id)
1009 +{
1010 + struct irqaction *action;
1011 +
1012 + if (irq > AVALANCHE_INT_END) {
1013 + printk("Trying to free IRQ%d\n",irq);
1014 + return;
1015 + }
1016 +
1017 + if(irq < MIPS_EXCEPTION_OFFSET)
1018 + {
1019 + action = irq_action[irq];
1020 + irq_action[irq] = NULL;
1021 + irq_desc_ti[irq].action = NULL;
1022 + disable_avalanche_irq(irq);
1023 + kfree(action);
1024 + return;
1025 + }
1026 +
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;
1031 + }
1032 + else {
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;
1036 + }
1037 +
1038 + disable_avalanche_irq(irq);
1039 + kfree(action);
1040 +}
1041 +
1042 +#ifdef CONFIG_KGDB
1043 +extern void breakpoint(void);
1044 +extern int remote_debug;
1045 +#endif
1046 +
1047 +//void init_IRQ(void) __init;
1048 +void __init init_IRQ(void)
1049 +{
1050 + int i;
1051 +
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;
1056 +
1057 + /* Disable interrupts and clear pending
1058 + */
1059 +
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 */
1066 +
1067 +
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 */
1073 +
1074 + for(i = 0; i < 40; i++)
1075 + avalanche_int_set(i,i);
1076 +
1077 + /* Now safe to set the exception vector. */
1078 + set_except_vector(0, mipsIRQ);
1079 +
1080 + /* Setup the IRQ description array. These will be mapped
1081 + * as flat interrupts numbers. The mapping is as follows
1082 + *
1083 + * 0-7 MIPS CPU Exceptions (HW/SW)
1084 + * 8-46 Primary Interrupts (Avalanche)
1085 + * 47-78 Secondary Interrupts (Avalanche)
1086 + */
1087 +
1088 + for (i = 0; i <= AVALANCHE_INT_END; i++)
1089 + {
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;
1094 + }
1095 +
1096 +#ifdef CONFIG_KGDB
1097 + if (remote_debug)
1098 + {
1099 + set_debug_traps();
1100 + breakpoint();
1101 + }
1102 +#endif
1103 +}
1104 +
1105 +
1106 +void avalanche_hw0_irqdispatch(struct pt_regs *regs)
1107 +{
1108 + struct irqaction *action;
1109 + int irq, cpu = smp_processor_id();
1110 + unsigned long int_line_number,status;
1111 + int i,secondary = 0;
1112 + int chan_nr=0;
1113 +
1114 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
1115 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
1116 +
1117 +
1118 + if(chan_nr < 32)
1119 + {
1120 + if( chan_nr != uni_secondary_interrupt)
1121 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
1122 +
1123 + }
1124 +
1125 + if((chan_nr < 40) && (chan_nr > 31))
1126 + {
1127 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
1128 + }
1129 +
1130 +
1131 + /* If the Priority Interrupt Index Register returns 40 then no
1132 + * interrupts are pending
1133 + */
1134 +
1135 + if(chan_nr == 40)
1136 + return;
1137 +
1138 + if(chan_nr == uni_secondary_interrupt)
1139 + {
1140 + status = avalanche_hw0_ecregs->exsr;
1141 + for(i=0; i < AVINTNUM(AVALANCHE_INT_END_SECONDARY); i++)
1142 + {
1143 + if (status & 1<<i)
1144 + {
1145 + /* clear secondary interrupt */
1146 + avalanche_hw0_ecregs->excr = 1 << i;
1147 + break;
1148 + }
1149 + }
1150 + irq = i;
1151 + secondary = 1;
1152 +
1153 + /* clear the universal secondary interrupt */
1154 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
1155 +
1156 + }
1157 + else
1158 + irq = chan_nr;
1159 +
1160 + /* Suraj Add code to clear secondary interrupt */
1161 +
1162 + if(secondary)
1163 + action = hw0_irq_action_secondary[irq];
1164 + else
1165 + action = hw0_irq_action_primary[irq];
1166 +
1167 + /* if action == NULL, then we don't have a handler for the irq */
1168 +
1169 + if ( action == NULL ) {
1170 + printk("No handler for hw0 irq: %i\n", irq);
1171 + return;
1172 + }
1173 +
1174 + irq_enter(cpu,irq);
1175 + if(secondary)
1176 + {
1177 + kstat.irqs[0][(irq + AVINTNUM(AVALANCHE_INT_END_PRIMARY)) + 8]++;
1178 + action->handler((irq + AVALANCHE_INT_END_PRIMARY), action->dev_id, regs);
1179 + }
1180 + else
1181 + {
1182 + kstat.irqs[0][irq + 8]++;
1183 + action->handler(LNXINTNUM(irq), action->dev_id, regs);
1184 + }
1185 +
1186 + irq_exit(cpu,irq);
1187 +
1188 + if(softirq_pending(cpu))
1189 + do_softirq();
1190 +
1191 + return;
1192 +}
1193 +
1194 +void avalanche_int_set(int channel, int line)
1195 +{
1196 + switch(channel)
1197 + {
1198 + case(0):
1199 + avalanche_hw0_chregs->cintnr0 = line;
1200 + break;
1201 + case(1):
1202 + avalanche_hw0_chregs->cintnr1 = line;
1203 + break;
1204 + case(2):
1205 + avalanche_hw0_chregs->cintnr2 = line;
1206 + break;
1207 + case(3):
1208 + avalanche_hw0_chregs->cintnr3 = line;
1209 + break;
1210 + case(4):
1211 + avalanche_hw0_chregs->cintnr4 = line;
1212 + break;
1213 + case(5):
1214 + avalanche_hw0_chregs->cintnr5 = line;
1215 + break;
1216 + case(6):
1217 + avalanche_hw0_chregs->cintnr6 = line;
1218 + break;
1219 + case(7):
1220 + avalanche_hw0_chregs->cintnr7 = line;
1221 + break;
1222 + case(8):
1223 + avalanche_hw0_chregs->cintnr8 = line;
1224 + break;
1225 + case(9):
1226 + avalanche_hw0_chregs->cintnr9 = line;
1227 + break;
1228 + case(10):
1229 + avalanche_hw0_chregs->cintnr10 = line;
1230 + break;
1231 + case(11):
1232 + avalanche_hw0_chregs->cintnr11 = line;
1233 + break;
1234 + case(12):
1235 + avalanche_hw0_chregs->cintnr12 = line;
1236 + break;
1237 + case(13):
1238 + avalanche_hw0_chregs->cintnr13 = line;
1239 + break;
1240 + case(14):
1241 + avalanche_hw0_chregs->cintnr14 = line;
1242 + break;
1243 + case(15):
1244 + avalanche_hw0_chregs->cintnr15 = line;
1245 + break;
1246 + case(16):
1247 + avalanche_hw0_chregs->cintnr16 = line;
1248 + break;
1249 + case(17):
1250 + avalanche_hw0_chregs->cintnr17 = line;
1251 + break;
1252 + case(18):
1253 + avalanche_hw0_chregs->cintnr18 = line;
1254 + break;
1255 + case(19):
1256 + avalanche_hw0_chregs->cintnr19 = line;
1257 + break;
1258 + case(20):
1259 + avalanche_hw0_chregs->cintnr20 = line;
1260 + break;
1261 + case(21):
1262 + avalanche_hw0_chregs->cintnr21 = line;
1263 + break;
1264 + case(22):
1265 + avalanche_hw0_chregs->cintnr22 = line;
1266 + break;
1267 + case(23):
1268 + avalanche_hw0_chregs->cintnr23 = line;
1269 + break;
1270 + case(24):
1271 + avalanche_hw0_chregs->cintnr24 = line;
1272 + break;
1273 + case(25):
1274 + avalanche_hw0_chregs->cintnr25 = line;
1275 + break;
1276 + case(26):
1277 + avalanche_hw0_chregs->cintnr26 = line;
1278 + break;
1279 + case(27):
1280 + avalanche_hw0_chregs->cintnr27 = line;
1281 + break;
1282 + case(28):
1283 + avalanche_hw0_chregs->cintnr28 = line;
1284 + break;
1285 + case(29):
1286 + avalanche_hw0_chregs->cintnr29 = line;
1287 + break;
1288 + case(30):
1289 + avalanche_hw0_chregs->cintnr30 = line;
1290 + break;
1291 + case(31):
1292 + avalanche_hw0_chregs->cintnr31 = line;
1293 + break;
1294 + case(32):
1295 + avalanche_hw0_chregs->cintnr32 = line;
1296 + break;
1297 + case(33):
1298 + avalanche_hw0_chregs->cintnr33 = line;
1299 + break;
1300 + case(34):
1301 + avalanche_hw0_chregs->cintnr34 = line;
1302 + break;
1303 + case(35):
1304 + avalanche_hw0_chregs->cintnr35 = line;
1305 + break;
1306 + case(36):
1307 + avalanche_hw0_chregs->cintnr36 = line;
1308 + break;
1309 + case(37):
1310 + avalanche_hw0_chregs->cintnr37 = line;
1311 + break;
1312 + case(38):
1313 + avalanche_hw0_chregs->cintnr38 = line;
1314 + break;
1315 + case(39):
1316 + avalanche_hw0_chregs->cintnr39 = line;
1317 + break;
1318 + default:
1319 + printk("Error: Unknown Avalanche interrupt channel\n");
1320 + }
1321 +
1322 + line_to_channel[line] = channel; /* Suraj check */
1323 +
1324 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
1325 + uni_secondary_interrupt = line;
1326 +
1327 +}
1328 +
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
1332 @@ -0,0 +1,130 @@
1333 +/*
1334 + * Carsten Langgaard, carstenl@mips.com
1335 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1336 + *
1337 + * ########################################################################
1338 + *
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.
1342 + *
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.
1347 + *
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.
1351 + *
1352 + * ########################################################################
1353 + *
1354 + * PROM library functions for acquiring/using memory descriptors given to
1355 + * us from the YAMON.
1356 + *
1357 + */
1358 +#include <linux/config.h>
1359 +#include <linux/init.h>
1360 +#include <linux/mm.h>
1361 +#include <linux/bootmem.h>
1362 +
1363 +#include <asm/bootinfo.h>
1364 +#include <asm/page.h>
1365 +#include <asm/mips-boards/prom.h>
1366 +#include <asm/ar7/ar7.h>
1367 +
1368 +enum yamon_memtypes {
1369 + yamon_dontuse,
1370 + yamon_prom,
1371 + yamon_free,
1372 +};
1373 +struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
1374 +
1375 +/* References to section boundaries */
1376 +extern char _end;
1377 +
1378 +#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
1379 +
1380 +
1381 +struct prom_pmemblock * __init prom_getmdesc(void)
1382 +{
1383 + char *memsize_str;
1384 + unsigned int memsize;
1385 +
1386 + memsize_str = prom_getenv("memsize");
1387 + if (!memsize_str) {
1388 + memsize = 0x02000000;
1389 + } else {
1390 + memsize = simple_strtol(memsize_str, NULL, 0);
1391 + }
1392 +
1393 + memset(mdesc, 0, sizeof(mdesc));
1394 +
1395 + mdesc[0].type = yamon_dontuse;
1396 + mdesc[0].base = 0x00000000;
1397 + mdesc[0].size = AVALANCHE_SDRAM_BASE;
1398 +
1399 + mdesc[1].type = yamon_prom;
1400 + mdesc[1].base = AVALANCHE_SDRAM_BASE;
1401 + mdesc[1].size = 0x00020000;
1402 +
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;
1406 +
1407 + return &mdesc[0];
1408 +}
1409 +
1410 +static int __init prom_memtype_classify (unsigned int type)
1411 +{
1412 + switch (type) {
1413 + case yamon_free:
1414 + return BOOT_MEM_RAM;
1415 + case yamon_prom:
1416 + return BOOT_MEM_ROM_DATA;
1417 + default:
1418 + return BOOT_MEM_RESERVED;
1419 + }
1420 +}
1421 +
1422 +void __init prom_meminit(void)
1423 +{
1424 + struct prom_pmemblock *p;
1425 +
1426 + p = prom_getmdesc();
1427 +
1428 + while (p->size) {
1429 + long type;
1430 + unsigned long base, size;
1431 +
1432 + type = prom_memtype_classify (p->type);
1433 + base = p->base;
1434 + size = p->size;
1435 +
1436 + add_memory_region(base, size, type);
1437 + p++;
1438 + }
1439 +}
1440 +
1441 +void __init prom_free_prom_memory (void)
1442 +{
1443 + int i;
1444 + unsigned long freed = 0;
1445 + unsigned long addr;
1446 +
1447 + for (i = 0; i < boot_mem_map.nr_map; i++) {
1448 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
1449 + continue;
1450 +
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;
1459 + }
1460 + }
1461 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
1462 +}
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
1466 @@ -0,0 +1,120 @@
1467 +/*
1468 + * Carsten Langgaard, carstenl@mips.com
1469 + * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
1470 + *
1471 + * ########################################################################
1472 + *
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.
1476 + *
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.
1481 + *
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.
1485 + *
1486 + * ########################################################################
1487 + *
1488 + * Interrupt exception dispatch code.
1489 + *
1490 + */
1491 +#include <linux/config.h>
1492 +
1493 +#include <asm/asm.h>
1494 +#include <asm/mipsregs.h>
1495 +#include <asm/regdef.h>
1496 +#include <asm/stackframe.h>
1497 +
1498 +/* A lot of complication here is taken away because:
1499 + *
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.
1503 + *
1504 + * 2) We need not check against bits in the status register IRQ mask, that
1505 + * would make this routine slow as hell.
1506 + *
1507 + * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
1508 + * between like BSD spl() brain-damage.
1509 + *
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:
1513 + *
1514 + * MIPS IRQ Source
1515 + * -------- ------
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)
1524 + *
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
1527 + * wired to UART1.
1528 + *
1529 + * We handle the IRQ according to _our_ priority which is:
1530 + *
1531 + * Highest ---- R4k Timer
1532 + * Lowest ---- Combined hardware interrupt
1533 + *
1534 + * then we just return, if multiple IRQs are pending then we will just take
1535 + * another exception, big deal.
1536 + */
1537 +
1538 +.text
1539 +.set noreorder
1540 +.set noat
1541 + .align 5
1542 +NESTED(mipsIRQ, PT_SIZE, sp)
1543 + SAVE_ALL
1544 + CLI
1545 + .set at
1546 +
1547 + mfc0 s0, CP0_CAUSE # get irq bits
1548 +
1549 + /* First we check for r4k counter/timer IRQ. */
1550 + andi a0, s0, CAUSEF_IP7
1551 + beq a0, zero, 1f
1552 + andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
1553 +
1554 + /* Wheee, a timer interrupt. */
1555 + move a0, sp
1556 + jal ar7_timer_interrupt
1557 + nop
1558 +
1559 + j ret_from_irq
1560 + nop
1561 +
1562 + 1:
1563 + beq a0, zero, 1f # delay slot, check hw3 interrupt
1564 + nop
1565 +
1566 + /* Wheee, combined hardware level zero interrupt. */
1567 + jal avalanche_hw0_irqdispatch
1568 + move a0, sp # delay slot
1569 +
1570 + j ret_from_irq
1571 + nop # delay slot
1572 +
1573 + 1:
1574 + /*
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.
1578 + */
1579 + move a1,s0
1580 + PRINT("Got interrupt: c0_cause = %08x\n")
1581 + mfc0 a1, CP0_EPC
1582 + PRINT("c0_epc = %08x\n")
1583 +
1584 + j ret_from_irq
1585 + nop
1586 +END(mipsIRQ)
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
1590 @@ -0,0 +1,51 @@
1591 +/*
1592 + * Carsten Langgaard, carstenl@mips.com
1593 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1594 + *
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.
1598 + *
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.
1603 + *
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.
1607 + *
1608 + * Putting things on the screen/serial line using Adam2 facilities.
1609 + */
1610 +
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>
1620 +
1621 +static char ppbuf[1024];
1622 +
1623 +void (*prom_print_str)(unsigned int out, char *s, int len);
1624 +
1625 +void prom_printf(char *fmt, ...) __init;
1626 +void prom_printf(char *fmt, ...)
1627 +{
1628 + va_list args;
1629 + int len;
1630 + prom_print_str = (void *)*(unsigned int *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR;
1631 +
1632 + va_start(args, fmt);
1633 + vsprintf(ppbuf, fmt, args);
1634 + len = strlen(ppbuf);
1635 +
1636 + prom_print_str(1, ppbuf, len);
1637 +
1638 + va_end(args);
1639 + return;
1640 +
1641 +}
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
1645 @@ -0,0 +1,54 @@
1646 +/*
1647 + * Carsten Langgaard, carstenl@mips.com
1648 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1649 + *
1650 + * ########################################################################
1651 + *
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.
1655 + *
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.
1660 + *
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.
1664 + *
1665 + * ########################################################################
1666 + *
1667 + * Reset the MIPS boards.
1668 + *
1669 + */
1670 +#include <linux/config.h>
1671 +
1672 +#include <asm/reboot.h>
1673 +#include <asm/mips-boards/generic.h>
1674 +
1675 +static void ar7_machine_restart(char *command);
1676 +static void ar7_machine_halt(void);
1677 +static void ar7_machine_power_off(void);
1678 +
1679 +static void ar7_machine_restart(char *command)
1680 +{
1681 +
1682 +}
1683 +
1684 +static void ar7_machine_halt(void)
1685 +{
1686 +
1687 +}
1688 +
1689 +static void ar7_machine_power_off(void)
1690 +{
1691 +
1692 +}
1693 +
1694 +void ar7_reboot_setup(void)
1695 +{
1696 + _machine_restart = ar7_machine_restart;
1697 + _machine_halt = ar7_machine_halt;
1698 + _machine_power_off = ar7_machine_power_off;
1699 +}
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
1703 @@ -0,0 +1,150 @@
1704 +/*
1705 + * Carsten Langgaard, carstenl@mips.com
1706 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
1707 + *
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.
1711 + *
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.
1716 + *
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.
1720 + */
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>
1726 +
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>
1732 +
1733 +#include <asm/dma.h>
1734 +#include <asm/time.h>
1735 +#include <asm/traps.h>
1736 +
1737 +
1738 +#define _LINK_KSEG0_
1739 +#define LITTLE_ENDIAN
1740 +#include <asm/ar7/tnetd73xx.h>
1741 +#include <asm/ar7/tnetd73xx_misc.h>
1742 +
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
1750 +
1751 +#if defined(CONFIG_AR7_MARVELL)
1752 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x00010000
1753 +#else
1754 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x2
1755 +#endif
1756 +
1757 +
1758 +#ifdef CONFIG_KGDB
1759 +extern void rs_kgdb_hook(int);
1760 +int remote_debug = 0;
1761 +#endif
1762 +
1763 +extern struct rtc_ops no_rtc_ops;
1764 +
1765 +extern void ar7_reboot_setup(void);
1766 +
1767 +extern void ar7_time_init(void);
1768 +extern void ar7_timer_setup(struct irqaction *irq);
1769 +
1770 +/* maybe some of this is not needed? */
1771 +static void ar7_platform_init(void)
1772 +{
1773 + //tnetd73xx_gpio_init();
1774 +
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);
1778 +
1779 + //tnetd73xx_reset_ctrl(RESET_MODULE_EPHY, IN_RESET);
1780 + //tnetd73xx_reset_ctrl(RESET_MODULE_EPHY, OUT_OF_RESET);
1781 +
1782 + tnetd73xx_clkc_init(AFECLK_FREQ, REFCLK_FREQ, OSC3_FREQ);
1783 +
1784 + tnetd73xx_vbus_freq = tnetd73xx_clkc_get_freq(CLKC_SYS) / 2;
1785 +
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));
1789 + }
1790 +#endif
1791 +
1792 +}
1793 +
1794 +const char *get_system_type(void)
1795 +{
1796 + return "Texas Instruments AR7";
1797 +}
1798 +
1799 +void __init ar7_setup(void)
1800 +{
1801 +#ifdef CONFIG_KGDB
1802 + int rs_putDebugChar(char);
1803 + char rs_getDebugChar(void);
1804 + extern int (*generic_putDebugChar)(char);
1805 + extern char (*generic_getDebugChar)(void);
1806 +#endif
1807 + char *argptr;
1808 +
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");
1814 + }
1815 +#endif
1816 +
1817 +#ifdef CONFIG_KGDB
1818 + argptr = prom_getcmdline();
1819 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
1820 + int line;
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",
1827 + line ? 1 : 0);
1828 +
1829 + rs_kgdb_hook(line);
1830 + generic_putDebugChar = rs_putDebugChar;
1831 + generic_getDebugChar = rs_getDebugChar;
1832 +
1833 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
1834 + "please connect your debugger\n", line ? 1 : 0);
1835 +
1836 + remote_debug = 1;
1837 + /* Breakpoints are in init_IRQ() */
1838 + }
1839 +#endif
1840 +
1841 + argptr = prom_getcmdline();
1842 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
1843 + cpu_data[0].options &= ~MIPS_CPU_FPU;
1844 +
1845 + rtc_ops = &no_rtc_ops;
1846 +
1847 + ar7_platform_init();
1848 +
1849 + ar7_reboot_setup();
1850 +
1851 + board_time_init = ar7_time_init;
1852 + board_timer_setup = ar7_timer_setup;
1853 +}
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
1857 @@ -0,0 +1,125 @@
1858 +/*
1859 + * Carsten Langgaard, carstenl@mips.com
1860 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1861 + *
1862 + * ########################################################################
1863 + *
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.
1867 + *
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.
1872 + *
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.
1876 + *
1877 + * ########################################################################
1878 + *
1879 + * Setting up the clock on the MIPS boards.
1880 + *
1881 + */
1882 +
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>
1889 +
1890 +#include <asm/mipsregs.h>
1891 +#include <asm/ptrace.h>
1892 +#include <asm/hardirq.h>
1893 +#include <asm/div64.h>
1894 +
1895 +#include <linux/interrupt.h>
1896 +#include <linux/mc146818rtc.h>
1897 +#include <linux/timex.h>
1898 +
1899 +#include <asm/mips-boards/generic.h>
1900 +#include <asm/mips-boards/prom.h>
1901 +#include <asm/ar7/ar7.h>
1902 +
1903 +extern asmlinkage void mipsIRQ(void);
1904 +
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 */
1907 +
1908 +#define MIPS_CPU_TIMER_IRQ 7
1909 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
1910 +
1911 +static inline void ack_r4ktimer(unsigned long newval)
1912 +{
1913 + write_c0_compare(newval);
1914 +}
1915 +
1916 +void ar7_timer_interrupt(struct pt_regs *regs)
1917 +{
1918 + int cpu = smp_processor_id();
1919 +
1920 + irq_enter(cpu, MIPS_CPU_TIMER_IRQ);
1921 +
1922 + if (r4k_offset == 0)
1923 + goto null;
1924 +
1925 + do {
1926 + kstat.irqs[cpu][MIPS_CPU_TIMER_IRQ]++;
1927 + do_timer(regs);
1928 + r4k_cur += r4k_offset;
1929 + ack_r4ktimer(r4k_cur);
1930 +
1931 + } while (((unsigned long)read_c0_count()
1932 + - r4k_cur) < 0x7fffffff);
1933 +
1934 + irq_exit(cpu, MIPS_CPU_TIMER_IRQ);
1935 +
1936 + if (softirq_pending(cpu))
1937 + do_softirq();
1938 +
1939 + return;
1940 +
1941 +null:
1942 + ack_r4ktimer(0);
1943 +}
1944 +
1945 +/*
1946 + * Figure out the r4k offset, the amount to increment the compare
1947 + * register for each time tick.
1948 + */
1949 +static unsigned long __init cal_r4koff(void)
1950 +{
1951 + return ((CONFIG_AR7_FREQUENCY*500000)/HZ);
1952 +}
1953 +
1954 +void __init ar7_time_init(void)
1955 +{
1956 + unsigned long flags;
1957 + unsigned int est_freq;
1958 +
1959 + set_except_vector(0, mipsIRQ);
1960 + write_c0_count(0);
1961 +
1962 + printk("calculating r4koff... ");
1963 + r4k_offset = cal_r4koff();
1964 + printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
1965 +
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);
1971 +}
1972 +
1973 +void __init ar7_timer_setup(struct irqaction *irq)
1974 +{
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);
1978 +
1979 + r4k_cur = (read_c0_count() + r4k_offset);
1980 + write_c0_compare(r4k_cur);
1981 + set_c0_status(ALLINTS);
1982 +}
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
1986 @@ -0,0 +1,924 @@
1987 +/******************************************************************************
1988 + * FILE PURPOSE: TNETD73xx Misc modules API Source
1989 + ******************************************************************************
1990 + * FILE NAME: tnetd73xx_misc.c
1991 + *
1992 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
1993 + * FSER Modules API
1994 + * As per TNETD73xx specifications
1995 + *
1996 + * REVISION HISTORY:
1997 + * 27 Nov 02 - Sharath Kumar PSP TII
1998 + * 14 Feb 03 - Anant Gole PSP TII
1999 + *
2000 + * (C) Copyright 2002, Texas Instruments, Inc
2001 + *******************************************************************************/
2002 +
2003 +#define LITTLE_ENDIAN
2004 +#define _LINK_KSEG0_
2005 +
2006 +#include <linux/types.h>
2007 +#include <asm/ar7/tnetd73xx.h>
2008 +#include <asm/ar7/tnetd73xx_misc.h>
2009 +
2010 +/* TNETD73XX Revision */
2011 +u32 tnetd73xx_get_revision(void)
2012 +{
2013 + /* Read Chip revision register - This register is from GPIO module */
2014 + return ( (u32) REG32_DATA(TNETD73XX_CVR));
2015 +}
2016 +
2017 +/*****************************************************************************
2018 + * Reset Control Module
2019 + *****************************************************************************/
2020 +
2021 +
2022 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module, TNETD73XX_RESET_CTRL_T reset_ctrl)
2023 +{
2024 + u32 reset_status;
2025 +
2026 + /* read current reset register */
2027 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2028 +
2029 + if (reset_ctrl == OUT_OF_RESET)
2030 + {
2031 + /* bring module out of reset */
2032 + reset_status |= (1 << reset_module);
2033 + }
2034 + else
2035 + {
2036 + /* put module in reset */
2037 + reset_status &= (~(1 << reset_module));
2038 + }
2039 +
2040 + /* write to the reset register */
2041 + REG32_WRITE(TNETD73XX_RST_CTRL_PRCR, reset_status);
2042 +}
2043 +
2044 +
2045 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status (TNETD73XX_RESET_MODULE_T reset_module)
2046 +{
2047 + u32 reset_status;
2048 +
2049 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2050 + return ( (reset_status & (1 << reset_module)) ? OUT_OF_RESET : IN_RESET );
2051 +}
2052 +
2053 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode)
2054 +{
2055 + REG32_WRITE(TNETD73XX_RST_CTRL_SWRCR, mode);
2056 +}
2057 +
2058 +#define TNETD73XX_RST_CTRL_RSR_MASK 0x3
2059 +
2060 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status()
2061 +{
2062 + u32 sys_reset_status;
2063 +
2064 + REG32_READ(TNETD73XX_RST_CTRL_RSR, sys_reset_status);
2065 +
2066 + return ( (TNETD73XX_SYS_RESET_STATUS_T) (sys_reset_status & TNETD73XX_RST_CTRL_RSR_MASK) );
2067 +}
2068 +
2069 +
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 */
2075 +
2076 +
2077 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl)
2078 +{
2079 + u32 power_status;
2080 +
2081 + /* read current power down control register */
2082 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2083 +
2084 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
2085 + {
2086 + /* power down the module */
2087 + power_status |= (1 << power_module);
2088 + }
2089 + else
2090 + {
2091 + /* power on the module */
2092 + power_status &= (~(1 << power_module));
2093 + }
2094 +
2095 + /* write to the reset register */
2096 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2097 +}
2098 +
2099 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module)
2100 +{
2101 + u32 power_status;
2102 +
2103 + /* read current power down control register */
2104 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2105 +
2106 + return ( (power_status & (1 << power_module)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP );
2107 +}
2108 +
2109 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode)
2110 +{
2111 + u32 power_status;
2112 +
2113 + /* read current power down control register */
2114 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2115 +
2116 + power_status &= TNETD73XX_GLOBAL_POWER_DOWN_MASK;
2117 + power_status |= ( power_mode << TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2118 +
2119 + /* write to power down control register */
2120 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2121 +}
2122 +
2123 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode()
2124 +{
2125 + u32 power_status;
2126 +
2127 + /* read current power down control register */
2128 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2129 +
2130 + power_status &= (~TNETD73XX_GLOBAL_POWER_DOWN_MASK);
2131 + power_status = ( power_status >> TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2132 +
2133 + return ( (TNETD73XX_SYS_POWER_MODE_T) power_status );
2134 +}
2135 +
2136 +
2137 +/*****************************************************************************
2138 + * Wakeup Control
2139 + *****************************************************************************/
2140 +
2141 +#define TNETD73XX_WAKEUP_POLARITY_BIT 16
2142 +
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)
2146 +{
2147 + u32 wakeup_status;
2148 +
2149 + /* read the wakeup control register */
2150 + REG32_READ(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2151 +
2152 + /* enable/disable */
2153 + if (wakeup_ctrl == WAKEUP_ENABLED)
2154 + {
2155 + /* enable wakeup */
2156 + wakeup_status |= wakeup_int;
2157 + }
2158 + else
2159 + {
2160 + /* disable wakeup */
2161 + wakeup_status &= (~wakeup_int);
2162 + }
2163 +
2164 + /* set polarity */
2165 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
2166 + {
2167 + wakeup_status |= (wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2168 + }
2169 + else
2170 + {
2171 + wakeup_status &= ~(wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2172 + }
2173 +
2174 + /* write the wakeup control register */
2175 + REG32_WRITE(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2176 +}
2177 +
2178 +
2179 +/*****************************************************************************
2180 + * FSER Control
2181 + *****************************************************************************/
2182 +
2183 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode)
2184 +{
2185 + REG32_WRITE(TNETD73XX_FSER_BASE, fser_mode);
2186 +}
2187 +
2188 +/*****************************************************************************
2189 + * Clock Control
2190 + *****************************************************************************/
2191 +
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) )
2196 +
2197 +#define CLKC_CLKCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x20 + (0x20 * (x)))
2198 +#define CLKC_CLKPLLCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x30 + (0x20 * (x)))
2199 +
2200 +#define CLKC_PRE_DIVIDER 0x0000001F
2201 +#define CLKC_POST_DIVIDER 0x001F0000
2202 +
2203 +#define CLKC_PLL_STATUS 0x1
2204 +#define CLKC_PLL_FACTOR 0x0000F000
2205 +
2206 +#define BOOTCR_PLL_BYPASS (1 << 5)
2207 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
2208 +
2209 +#define MIPS_PLL_SELECT 0x00030000
2210 +#define SYSTEM_PLL_SELECT 0x0000C000
2211 +#define USB_PLL_SELECT 0x000C0000
2212 +#define ADSLSS_PLL_SELECT 0x00C00000
2213 +
2214 +#define MIPS_AFECLKI_SELECT 0x00000000
2215 +#define MIPS_REFCLKI_SELECT 0x00010000
2216 +#define MIPS_XTAL3IN_SELECT 0x00020000
2217 +
2218 +#define SYSTEM_AFECLKI_SELECT 0x00000000
2219 +#define SYSTEM_REFCLKI_SELECT 0x00004000
2220 +#define SYSTEM_XTAL3IN_SELECT 0x00008000
2221 +#define SYSTEM_MIPSPLL_SELECT 0x0000C000
2222 +
2223 +#define USB_SYSPLL_SELECT 0x00000000
2224 +#define USB_REFCLKI_SELECT 0x00040000
2225 +#define USB_XTAL3IN_SELECT 0x00080000
2226 +#define USB_MIPSPLL_SELECT 0x000C0000
2227 +
2228 +#define ADSLSS_AFECLKI_SELECT 0x00000000
2229 +#define ADSLSS_REFCLKI_SELECT 0x00400000
2230 +#define ADSLSS_XTAL3IN_SELECT 0x00800000
2231 +#define ADSLSS_MIPSPLL_SELECT 0x00C00000
2232 +
2233 +#define SYS_MAX CLK_MHZ(150)
2234 +#define SYS_MIN CLK_MHZ(1)
2235 +
2236 +#define MIPS_SYNC_MAX SYS_MAX
2237 +#define MIPS_ASYNC_MAX CLK_MHZ(160)
2238 +#define MIPS_MIN CLK_MHZ(1)
2239 +
2240 +#define USB_MAX CLK_MHZ(100)
2241 +#define USB_MIN CLK_MHZ(1)
2242 +
2243 +#define ADSL_MAX CLK_MHZ(180)
2244 +#define ADSL_MIN CLK_MHZ(1)
2245 +
2246 +#define PLL_MUL_MAXFACTOR 15
2247 +#define MAX_DIV_VALUE 32
2248 +#define MIN_DIV_VALUE 1
2249 +
2250 +#define MIN_PLL_INP_FREQ CLK_MHZ(8)
2251 +#define MAX_PLL_INP_FREQ CLK_MHZ(100)
2252 +
2253 +#define DIVIDER_LOCK_TIME 10100
2254 +#define PLL_LOCK_TIME 10100 * 75
2255 +
2256 +
2257 +
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;
2269 +
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);
2276 +
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)
2284 +{
2285 +
2286 + u32 choice;
2287 +
2288 + afeclk_inp = afeclk;
2289 + refclk_inp = refclk;
2290 + xtal_inp = xtal3in;
2291 +
2292 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & MIPS_PLL_SELECT;
2293 + switch(choice)
2294 + {
2295 + case MIPS_AFECLKI_SELECT:
2296 + clk_src[CLKC_MIPS] = &afeclk_inp;
2297 + break;
2298 +
2299 + case MIPS_REFCLKI_SELECT:
2300 + clk_src[CLKC_MIPS] = &refclk_inp;
2301 + break;
2302 +
2303 + case MIPS_XTAL3IN_SELECT:
2304 + clk_src[CLKC_MIPS] = &xtal_inp;
2305 + break;
2306 +
2307 + default :
2308 + clk_src[CLKC_MIPS] = 0;
2309 +
2310 + }
2311 +
2312 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & SYSTEM_PLL_SELECT;
2313 + switch(choice)
2314 + {
2315 + case SYSTEM_AFECLKI_SELECT:
2316 + clk_src[CLKC_SYS] = &afeclk_inp;
2317 + break;
2318 +
2319 + case SYSTEM_REFCLKI_SELECT:
2320 + clk_src[CLKC_SYS] = &refclk_inp;
2321 + break;
2322 +
2323 + case SYSTEM_XTAL3IN_SELECT:
2324 + clk_src[CLKC_SYS] = &xtal_inp;
2325 + break;
2326 +
2327 + case SYSTEM_MIPSPLL_SELECT:
2328 + clk_src[CLKC_SYS] = &mips_pll_out;
2329 + break;
2330 +
2331 + default :
2332 + clk_src[CLKC_SYS] = 0;
2333 +
2334 + }
2335 +
2336 +
2337 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & ADSLSS_PLL_SELECT;
2338 + switch(choice)
2339 + {
2340 + case ADSLSS_AFECLKI_SELECT:
2341 + clk_src[CLKC_ADSLSS] = &afeclk_inp;
2342 + break;
2343 +
2344 + case ADSLSS_REFCLKI_SELECT:
2345 + clk_src[CLKC_ADSLSS] = &refclk_inp;
2346 + break;
2347 +
2348 + case ADSLSS_XTAL3IN_SELECT:
2349 + clk_src[CLKC_ADSLSS] = &xtal_inp;
2350 + break;
2351 +
2352 + case ADSLSS_MIPSPLL_SELECT:
2353 + clk_src[CLKC_ADSLSS] = &mips_pll_out;
2354 + break;
2355 +
2356 + default :
2357 + clk_src[CLKC_ADSLSS] = 0;
2358 +
2359 + }
2360 +
2361 +
2362 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & USB_PLL_SELECT;
2363 + switch(choice)
2364 + {
2365 + case USB_SYSPLL_SELECT:
2366 + clk_src[CLKC_USB] = &sys_pll_out ;
2367 + break;
2368 +
2369 + case USB_REFCLKI_SELECT:
2370 + clk_src[CLKC_USB] = &refclk_inp;
2371 + break;
2372 +
2373 + case USB_XTAL3IN_SELECT:
2374 + clk_src[CLKC_USB] = &xtal_inp;
2375 + break;
2376 +
2377 + case USB_MIPSPLL_SELECT:
2378 + clk_src[CLKC_USB] = &mips_pll_out;
2379 + break;
2380 +
2381 + default :
2382 + clk_src[CLKC_USB] = 0;
2383 +
2384 + }
2385 +}
2386 +
2387 +
2388 +
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
2397 +(
2398 + TNETD73XX_CLKC_ID_T clk_id,
2399 + u32 output_freq
2400 + )
2401 +{
2402 + u32 base_freq;
2403 + u32 multiplier;
2404 + u32 divider;
2405 + u32 min_prediv;
2406 + u32 max_prediv;
2407 + u32 prediv;
2408 + u32 postdiv;
2409 + u32 temp;
2410 +
2411 + /* check if PLLs are bypassed*/
2412 + if(REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS)
2413 + {
2414 + return TNETD73XX_ERR_ERROR;
2415 + }
2416 +
2417 + /*check if the requested output_frequency is in valid range*/
2418 + switch( clk_id )
2419 + {
2420 + case CLKC_SYS:
2421 + if( output_freq < SYS_MIN || output_freq > SYS_MAX)
2422 + {
2423 + return TNETD73XX_ERR_ERROR;
2424 + }
2425 + present_min = SYS_MIN;
2426 + present_max = SYS_MAX;
2427 + break;
2428 +
2429 + case CLKC_MIPS:
2430 + if((output_freq < MIPS_MIN) ||
2431 + (output_freq > ((REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX)))
2432 + {
2433 + return TNETD73XX_ERR_ERROR;
2434 + }
2435 + present_min = MIPS_MIN;
2436 + present_max = (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX;
2437 + break;
2438 +
2439 + case CLKC_USB:
2440 + if( output_freq < USB_MIN || output_freq > USB_MAX)
2441 + {
2442 + return TNETD73XX_ERR_ERROR;
2443 + }
2444 + present_min = USB_MIN;
2445 + present_max = USB_MAX;
2446 + break;
2447 +
2448 + case CLKC_ADSLSS:
2449 + if( output_freq < ADSL_MIN || output_freq > ADSL_MAX)
2450 + {
2451 + return TNETD73XX_ERR_ERROR;
2452 + }
2453 + present_min = ADSL_MIN;
2454 + present_max = ADSL_MAX;
2455 + break;
2456 + }
2457 +
2458 +
2459 + base_freq = get_base_frequency(clk_id);
2460 +
2461 +
2462 + /* check for minimum base frequency value */
2463 + if( base_freq < MIN_PLL_INP_FREQ)
2464 + {
2465 + return TNETD73XX_ERR_ERROR;
2466 + }
2467 +
2468 + get_val(output_freq, base_freq, &multiplier, &divider);
2469 +
2470 + /* check multiplier range */
2471 + if( (multiplier > PLL_MUL_MAXFACTOR) || (multiplier <= 0) )
2472 + {
2473 + return TNETD73XX_ERR_ERROR;
2474 + }
2475 +
2476 + /* check divider value */
2477 + if( divider == 0 )
2478 + {
2479 + return TNETD73XX_ERR_ERROR;
2480 + }
2481 +
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);
2485 +
2486 + /*adjust the value of divider so that it not less than minimum predivider value*/
2487 + if (divider < min_prediv)
2488 + {
2489 + temp = CEIL(min_prediv, divider);
2490 + if ((temp * multiplier) > PLL_MUL_MAXFACTOR)
2491 + {
2492 + return TNETD73XX_ERR_ERROR ;
2493 + }
2494 + else
2495 + {
2496 + multiplier = temp * multiplier;
2497 + divider = min_prediv;
2498 + }
2499 +
2500 + }
2501 +
2502 + /* compute predivider and postdivider values */
2503 + prediv = compute_prediv (divider, min_prediv, max_prediv);
2504 + postdiv = CEIL(divider,prediv);
2505 +
2506 + /*return fail if postdivider value falls out of range */
2507 + if(postdiv > MAX_DIV_VALUE)
2508 + {
2509 + return TNETD73XX_ERR_ERROR;
2510 + }
2511 +
2512 +
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) );
2516 +
2517 + /*wait for divider output to stabilise*/
2518 + for(temp =0; temp < DIVIDER_LOCK_TIME; temp++);
2519 +
2520 + /*write to PLL clock register*/
2521 +
2522 + if(clk_id == CLKC_SYS)
2523 + {
2524 + /* but before writing put DRAM to hold mode */
2525 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) |= 0x80000000;
2526 + }
2527 + /*Bring PLL into div mode */
2528 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), 0x4);
2529 +
2530 + /*compute the word to be written to PLLCR
2531 + *corresponding to multiplier value
2532 + */
2533 + multiplier = (((multiplier - 1) & 0xf) << 12)| ((255 <<3) | 0x0e);
2534 +
2535 + /* wait till PLL enters div mode */
2536 + while(REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2537 + /*nothing*/;
2538 +
2539 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), multiplier);
2540 +
2541 + while(!REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2542 + /*nothing*/;
2543 +
2544 +
2545 + /*wait for External pll to lock*/
2546 + for(temp =0; temp < PLL_LOCK_TIME; temp++);
2547 +
2548 + if(clk_id == CLKC_SYS)
2549 + {
2550 + /* Bring DRAM out of hold */
2551 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) &= ~0x80000000;
2552 + }
2553 +
2554 + return TNETD73XX_ERR_OK ;
2555 +}
2556 +
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
2564 +(
2565 + TNETD73XX_CLKC_ID_T clk_id
2566 + )
2567 +{
2568 +
2569 + u32 clk_ctrl_register;
2570 + u32 clk_pll_setting;
2571 + u32 clk_predivider;
2572 + u32 clk_postdivider;
2573 + u16 pll_factor;
2574 + u32 base_freq;
2575 + u32 divider;
2576 +
2577 + base_freq = get_base_frequency(clk_id);
2578 +
2579 + clk_ctrl_register = REG32_DATA(CLKC_CLKCR(clk_id));
2580 +
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;
2584 +
2585 + divider = clk_predivider * clk_postdivider;
2586 +
2587 +
2588 + if( (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS))
2589 + {
2590 + return (CEIL(base_freq, divider)); /* PLLs bypassed.*/
2591 + }
2592 +
2593 +
2594 + else
2595 + {
2596 + /* return the current clock speed based upon the PLL setting */
2597 + clk_pll_setting = REG32_DATA(CLKC_CLKPLLCR(clk_id));
2598 +
2599 + /* Get the PLL multiplication factor */
2600 + pll_factor = ((clk_pll_setting & CLKC_PLL_FACTOR) >> 12) + 1;
2601 +
2602 + /* Check if we're in divide mode or multiply mode */
2603 + if((clk_pll_setting & 0x1) == 0)
2604 + {
2605 + /* We're in divide mode */
2606 + if(pll_factor < 0x10)
2607 + return (CEIL(base_freq >> 1, divider));
2608 + else
2609 + return (CEIL(base_freq >> 2, divider));
2610 + }
2611 +
2612 + else /* We're in PLL mode */
2613 + {
2614 + /* See if PLLNDIV & PLLDIV are set */
2615 + if((clk_pll_setting & 0x0800) && (clk_pll_setting & 0x2))
2616 + {
2617 + if(clk_pll_setting & 0x1000)
2618 + {
2619 + /* clk = base_freq * k/2 */
2620 + return(CEIL((base_freq * pll_factor) >> 1, divider));
2621 + }
2622 + else
2623 + {
2624 + /* clk = base_freq * (k-1) / 4)*/
2625 + return(CEIL((base_freq * (pll_factor - 1)) >>2, divider));
2626 + }
2627 + }
2628 + else
2629 + {
2630 + if(pll_factor < 0x10)
2631 + {
2632 + /* clk = base_freq * k */
2633 + return(CEIL(base_freq * pll_factor, divider));
2634 + }
2635 +
2636 + else
2637 + {
2638 + /* clk = base_freq */
2639 + return(CEIL(base_freq, divider));
2640 + }
2641 + }
2642 + }
2643 + return(0); /* Should never reach here */
2644 +
2645 + }
2646 +
2647 +}
2648 +
2649 +
2650 +/* local helper functions */
2651 +
2652 +/****************************************************************************
2653 + * FUNCTION: get_base_frequency
2654 + ****************************************************************************
2655 + * Description: The above routine is called to get base frequency of the clocks.
2656 + ***************************************************************************/
2657 +
2658 +static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id)
2659 +{
2660 + /* update the current MIPs PLL output value, if the required
2661 + * source is MIPS PLL
2662 + */
2663 + if ( clk_src[clk_id] == &mips_pll_out)
2664 + {
2665 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_MIPS);
2666 + }
2667 +
2668 +
2669 + /* update the current System PLL output value, if the required
2670 + * source is system PLL
2671 + */
2672 + if ( clk_src[clk_id] == &sys_pll_out)
2673 + {
2674 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_SYS);
2675 + }
2676 +
2677 + return (*clk_src[clk_id]);
2678 +
2679 +}
2680 +
2681 +
2682 +
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
2689 +(
2690 + u32 min,
2691 + u32 max
2692 + )
2693 +{
2694 + if (max % min == 0)
2695 + {
2696 + return min;
2697 + }
2698 + else
2699 + {
2700 + return find_gcd(max % min, min);
2701 + }
2702 +}
2703 +
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)
2710 +{
2711 + u16 prediv;
2712 +
2713 + /* return the divider itself it it falls within the range of predivider*/
2714 + if (min <= divider && divider <= max)
2715 + {
2716 + return divider;
2717 + }
2718 +
2719 + /* find a value for prediv such that it is a factor of divider */
2720 + for (prediv = max; prediv >= min ; prediv--)
2721 + {
2722 + if ( (divider % prediv) == 0 )
2723 + {
2724 + return prediv;
2725 + }
2726 + }
2727 +
2728 + /* No such factor exists, return min as prediv */
2729 + return min;
2730 +}
2731 +
2732 +/****************************************************************************
2733 + * FUNCTION: get_val
2734 + ****************************************************************************
2735 + * Description: This routine is called to get values of divider and multiplier.
2736 + ***************************************************************************/
2737 +
2738 +static void get_val(u32 output_freq, u32 base_freq,u32 *multiplier, u32 *divider)
2739 +{
2740 + u32 temp_mul;
2741 + u32 temp_div;
2742 + u32 gcd;
2743 + u32 min_freq;
2744 + u32 max_freq;
2745 +
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);
2750 +
2751 + if(gcd == 0)
2752 + return; /* ERROR */
2753 +
2754 + /* compute values of multiplier and divider */
2755 + temp_mul = output_freq / gcd;
2756 + temp_div = base_freq / gcd;
2757 +
2758 +
2759 + /* set multiplier such that 1 <= multiplier <= PLL_MUL_MAXFACTOR */
2760 + if( temp_mul > PLL_MUL_MAXFACTOR )
2761 + {
2762 + if((temp_mul / temp_div) > PLL_MUL_MAXFACTOR)
2763 + return;
2764 +
2765 + find_approx(&temp_mul,&temp_div,base_freq);
2766 + }
2767 +
2768 + *multiplier = temp_mul;
2769 + *divider = temp_div;
2770 +}
2771 +
2772 +/****************************************************************************
2773 + * FUNCTION: find_approx
2774 + ****************************************************************************
2775 + * Description: This function gets the approx value of num/denom.
2776 + ***************************************************************************/
2777 +
2778 +static void find_approx(u32 *num,u32 *denom,u32 base_freq)
2779 +{
2780 + u32 num1;
2781 + u32 denom1;
2782 + u32 num2;
2783 + u32 denom2;
2784 + int32_t closest;
2785 + int32_t prev_closest;
2786 + u32 temp_num;
2787 + u32 temp_denom;
2788 + u32 normalize;
2789 + u32 gcd;
2790 + u32 output_freq;
2791 +
2792 + num1 = *num;
2793 + denom1 = *denom;
2794 +
2795 + prev_closest = 0x7fffffff; /* maximum possible value */
2796 + num2 = num1;
2797 + denom2 = denom1;
2798 +
2799 + /* start with max */
2800 + for(temp_num = 15; temp_num >=1; temp_num--)
2801 + {
2802 +
2803 + temp_denom = CEIL(temp_num * denom1, num1);
2804 + output_freq = (temp_num * base_freq) / temp_denom;
2805 +
2806 + if(temp_denom < 1)
2807 + {
2808 + break;
2809 + }
2810 + else
2811 + {
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)
2815 + {
2816 + prev_closest = closest;
2817 + num2 = temp_num;
2818 + denom2 = temp_denom;
2819 + }
2820 +
2821 + }
2822 +
2823 + }
2824 +
2825 + gcd = find_gcd(num2,denom2);
2826 + num2 = num2 / gcd;
2827 + denom2 = denom2 /gcd;
2828 +
2829 + *num = num2;
2830 + *denom = denom2;
2831 +}
2832 +
2833 +
2834 +/*****************************************************************************
2835 + * GPIO Control
2836 + *****************************************************************************/
2837 +
2838 +/****************************************************************************
2839 + * FUNCTION: tnetd73xx_gpio_init
2840 + ***************************************************************************/
2841 +void tnetd73xx_gpio_init()
2842 +{
2843 + /* Bring module out of reset */
2844 + tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
2845 + REG32_WRITE(TNETD73XX_GPIOENR, 0xFFFFFFFF);
2846 +}
2847 +
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)
2854 +{
2855 + u32 pin_status;
2856 + REG32_READ(TNETD73XX_GPIOENR, pin_status);
2857 + if (pin_mode == GPIO_PIN)
2858 + {
2859 + pin_status |= (1 << gpio_pin);
2860 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2861 +
2862 + /* Set pin direction */
2863 + REG32_READ(TNETD73XX_GPIOPDIRR, pin_status);
2864 + if (pin_direction == GPIO_INPUT_PIN)
2865 + {
2866 + pin_status |= (1 << gpio_pin);
2867 + }
2868 + else /* GPIO_OUTPUT_PIN */
2869 + {
2870 + pin_status &= (~(1 << gpio_pin));
2871 + }
2872 + REG32_WRITE(TNETD73XX_GPIOPDIRR, pin_status);
2873 + }
2874 + else /* FUNCTIONAL PIN */
2875 + {
2876 + pin_status &= (~(1 << gpio_pin));
2877 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2878 + }
2879 +
2880 +}
2881 +
2882 +/****************************************************************************
2883 + * FUNCTION: tnetd73xx_gpio_out
2884 + ***************************************************************************/
2885 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value)
2886 +{
2887 + u32 pin_value;
2888 +
2889 + REG32_READ(TNETD73XX_GPIODOUTR, pin_value);
2890 + if (value == 1)
2891 + {
2892 + pin_value |= (1 << gpio_pin);
2893 + }
2894 + else
2895 + {
2896 + pin_value &= (~(1 << gpio_pin));
2897 + }
2898 + REG32_WRITE(TNETD73XX_GPIODOUTR, pin_value);
2899 +}
2900 +
2901 +/****************************************************************************
2902 + * FUNCTION: tnetd73xx_gpio_in
2903 + ***************************************************************************/
2904 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin)
2905 +{
2906 + u32 pin_value;
2907 + REG32_READ(TNETD73XX_GPIODINR, pin_value);
2908 + return ( (pin_value & (1 << gpio_pin)) ? 1 : 0 );
2909 +}
2910 +
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
2914 @@ -20,6 +20,15 @@
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
2926 +fi
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
2933 fi
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
2938 +fi
2939 if [ "$CONFIG_CASIO_E55" = "y" ]; then
2940 define_bool CONFIG_IRQ_CPU y
2941 define_bool CONFIG_NONCOHERENT_IO y
2942 @@ -736,6 +750,7 @@
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 \
2950 @@ -797,6 +812,7 @@
2951 bool 'Networking support' CONFIG_NET
2952
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
2961 @@ -76,6 +76,7 @@
2962 * Generic, controller-independent functions:
2963 */
2964
2965 +#ifndef CONFIG_AR7
2966 int get_irq_list(char *buf)
2967 {
2968 int i, j;
2969 @@ -110,6 +111,7 @@
2970 p += sprintf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
2971 return p - buf;
2972 }
2973 +#endif
2974
2975 #ifdef CONFIG_SMP
2976 int global_irq_holder = NO_PROC_ID;
2977 @@ -525,6 +527,7 @@
2978 *
2979 */
2980
2981 +#ifndef CONFIG_AR7
2982 int request_irq(unsigned int irq,
2983 void (*handler)(int, void *, struct pt_regs *),
2984 unsigned long irqflags,
2985 @@ -569,6 +572,7 @@
2986 kfree(action);
2987 return retval;
2988 }
2989 +#endif
2990
2991 /**
2992 * free_irq - free an interrupt
2993 @@ -588,6 +592,7 @@
2994 * the machine.
2995 */
2996
2997 +#ifndef CONFIG_AR7
2998 void free_irq(unsigned int irq, void *dev_id)
2999 {
3000 irq_desc_t *desc;
3001 @@ -629,6 +634,7 @@
3002 return;
3003 }
3004 }
3005 +#endif
3006
3007 /*
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
3012 @@ -109,6 +109,7 @@
3013 unsigned long isa_slot_offset;
3014 EXPORT_SYMBOL(isa_slot_offset);
3015
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);
3020 @@ -267,6 +268,9 @@
3021 #endif /* CONFIG_BLK_DEV_INITRD */
3022
3023 /* Find the highest page frame number we have available. */
3024 +#ifdef CONFIG_AR7_PAGING
3025 + avalanche_bootmem_init();
3026 +#else
3027 max_pfn = 0;
3028 first_usable_pfn = -1UL;
3029 for (i = 0; i < boot_mem_map.nr_map; i++) {
3030 @@ -376,7 +380,7 @@
3031
3032 /* Reserve the bootmap memory. */
3033 reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
3034 -
3035 +#endif
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);
3039 @@ -494,6 +498,7 @@
3040 void hp_setup(void);
3041 void au1x00_setup(void);
3042 void frame_info_init(void);
3043 + void ar7_setup(void);
3044
3045 frame_info_init();
3046 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
3047 @@ -691,6 +696,11 @@
3048 pmc_yosemite_setup();
3049 break;
3050 #endif
3051 +#ifdef CONFIG_AR7
3052 + case MACH_GROUP_UNKNOWN:
3053 + ar7_setup();
3054 + break;
3055 +#endif
3056 default:
3057 panic("Unsupported architecture");
3058 }
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
3062 @@ -40,6 +40,10 @@
3063 #include <asm/uaccess.h>
3064 #include <asm/mmu_context.h>
3065
3066 +#ifdef CONFIG_AR7
3067 +#include <asm/ar7/ar7.h>
3068 +#endif
3069 +
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)
3075 {
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;
3081 unsigned long i;
3082
3083 +#ifdef CONFIG_AR7
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);
3088 +#endif
3089 +
3090 /* Copy the generic exception handler code to it's final destination. */
3091 memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
3092
3093 +#ifdef CONFIG_AR7
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);
3097 +
3098 + /* jump table to exception routines */
3099 +
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);
3106 +#endif
3107 +
3108 /*
3109 * Setup default vectors
3110 */
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
3114 @@ -1,3 +1,4 @@
3115 +#ifndef CONFIG_AR7
3116 #include <stdarg.h>
3117 #include <linux/kernel.h>
3118
3119 @@ -22,3 +23,4 @@
3120 }
3121 va_end(args);
3122 }
3123 +#endif
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
3127 @@ -40,8 +40,10 @@
3128
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;
3134 +#endif
3135
3136 void pgd_init(unsigned long page)
3137 {
3138 @@ -235,6 +237,7 @@
3139 #endif
3140 }
3141
3142 +#ifndef CONFIG_AR7_PAGING
3143 void __init paging_init(void)
3144 {
3145 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
3146 @@ -272,6 +275,7 @@
3147
3148 free_area_init(zones_size);
3149 }
3150 +#endif
3151
3152 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
3153 #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
3154 @@ -298,6 +302,7 @@
3155 return 0;
3156 }
3157
3158 +#ifndef CONFIG_AR7_PAGING
3159 void __init mem_init(void)
3160 {
3161 unsigned long codesize, reservedpages, datasize, initsize;
3162 @@ -359,6 +364,7 @@
3163 initsize >> 10,
3164 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
3165 }
3166 +#endif
3167
3168 #ifdef CONFIG_BLK_DEV_INITRD
3169 void free_initrd_mem(unsigned long start, unsigned long end)
3170 @@ -376,6 +382,7 @@
3171 }
3172 #endif
3173
3174 +#ifndef CONFIG_AR7_PAGING
3175 extern char __init_begin, __init_end;
3176 extern void prom_free_prom_memory(void) __init;
3177
3178 @@ -383,7 +390,9 @@
3179 {
3180 unsigned long addr;
3181
3182 +#ifndef CONFIG_AR7
3183 prom_free_prom_memory ();
3184 +#endif
3185
3186 addr = (unsigned long) &__init_begin;
3187 while (addr < (unsigned long) &__init_end) {
3188 @@ -409,3 +418,4 @@
3189
3190 return;
3191 }
3192 +#endif
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
3196 @@ -20,6 +20,10 @@
3197 #include <asm/pgtable.h>
3198 #include <asm/system.h>
3199
3200 +#ifdef CONFIG_AR7
3201 +#include <asm/ar7/ar7.h>
3202 +#endif
3203 +
3204 extern char except_vec0_nevada, except_vec0_r4000, except_vec0_r4600;
3205
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 @@
3211 return 0;
3212 }
3213
3214 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3215 +#if defined(CONFIG_AR7)
3216 +
3217 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
3218 +{
3219 + return (inb(info->port + (offset * 4)) & 0xff);
3220 +}
3221 +
3222 +
3223 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
3224 +{
3225 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3226 + return (inb(info->port + (offset * 4)) & 0xff);
3227 +#else
3228 + return (inb_p(info->port + (offset * 4)) & 0xff);
3229 +#endif
3230 +}
3231 +
3232 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
3233 +{
3234 + outb(value, info->port + (offset * 4));
3235 +}
3236 +
3237 +
3238 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
3239 + int value)
3240 +{
3241 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3242 + outb(value, info->port + (offset * 4));
3243 +#else
3244 + outb_p(value, info->port + (offset * 4));
3245 +#endif
3246 +}
3247 +
3248 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3249
3250 #include <asm/mips-boards/atlas.h>
3251
3252 @@ -478,8 +511,10 @@
3253 * needed for certain old 386 machines, I've left these #define's
3254 * in....
3255 */
3256 +#ifdef CONFIG_AR7
3257 #define serial_inp(info, offset) serial_in(info, offset)
3258 #define serial_outp(info, offset, value) serial_out(info, offset, value)
3259 +#endif
3260
3261
3262 /*
3263 @@ -1728,7 +1763,15 @@
3264 /* Special case since 134 is really 134.5 */
3265 quot = (2*baud_base / 269);
3266 else if (baud)
3267 +#ifdef CONFIG_AR7
3268 + quot = get_avalanche_vbus_freq() / baud;
3269 +
3270 + if ((quot%16)>7)
3271 + quot += 8;
3272 + quot /=16;
3273 +#else
3274 quot = baud_base / baud;
3275 +#endif
3276 }
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);
3281 if (state->hub6)
3282 state->io_type = SERIAL_IO_HUB6;
3283 +#ifdef CONFIG_AR7
3284 if (state->port && check_region(state->port,8))
3285 continue;
3286 +#endif
3287 #ifdef CONFIG_MCA
3288 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
3289 continue;
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;
3294 +#ifdef CONFIG_AR7
3295 + quot = get_avalanche_vbus_freq() / baud;
3296 +
3297 + if ((quot%16)>7)
3298 + quot += 8;
3299 + quot /=16;
3300 +#else
3301 quot = state->baud_base / baud;
3302 +#endif
3303 cval = cflag & (CSIZE | CSTOPB);
3304 #if defined(__powerpc__) || defined(__alpha__)
3305 cval >>= 8;
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
3310 @@ -0,0 +1,138 @@
3311 +#ifndef _MIPS_AR7_H
3312 +#define _MIPS_AR7_H
3313 +
3314 +#include <linux/config.h>
3315 +#include <asm/addrspace.h>
3316 +
3317 +
3318 +#ifndef LITTLE_ENDIAN
3319 +#define LITTLE_ENDIAN
3320 +#endif
3321 +
3322 +#ifndef _LINK_KSEG0_
3323 +#define _LINK_KSEG0_
3324 +#endif
3325 +
3326 +#include <asm/ar7/tnetd73xx.h>
3327 +
3328 +#define AVALANCHE_UART0_INT 7
3329 +#define AVALANCHE_UART1_INT 8
3330 +
3331 +#define MIPS_EXCEPTION_OFFSET 8
3332 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3333 +
3334 +/*
3335 + * AR7 board SDRAM base address. This is used to setup the
3336 + * bootmem tables
3337 + */
3338 +
3339 +#define AVALANCHE_SDRAM_BASE CONFIG_AR7_MEMORY//0x14000000UL
3340 +#define AVALANCHE_INTC_BASE TNETD73XX_INTC_BASE
3341 +
3342 +
3343 +/*
3344 + * AR7 board vectors
3345 + */
3346 +
3347 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
3348 +#define AVALANCHE_VECS_KSEG0 (CPHYSADDR(AVALANCHE_SDRAM_BASE) | 0x80000000)
3349 +#undef KSEG0
3350 +#define KSEG0 AVALANCHE_VECS_KSEG0
3351 +
3352 +/*
3353 + * Yamon Prom print address.
3354 + */
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)
3358 +
3359 +/*
3360 + * AR7 Reset and PSU standby register.
3361 + */
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)
3367 +
3368 +/*
3369 + * Avalanche UART register base.
3370 + */
3371 +
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 )
3375 +
3376 +/*
3377 + * AVALANCHE DMA controller base
3378 + */
3379 +
3380 +#define AVALANCHE_DMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* DMA 0 (channels 0-3) */
3381 +
3382 +
3383 +
3384 +/*
3385 + * GPIO register map
3386 + */
3387 +
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}
3394 +
3395 +
3396 +// Let us define board specific information here.
3397 +
3398 +#if defined(CONFIG_AR7DB)
3399 +
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
3405 +
3406 +#endif
3407 +
3408 +
3409 +#if defined(CONFIG_AR7RD)
3410 +
3411 +#define AFECLK_FREQ 35328000
3412 +#define REFCLK_FREQ 25000000
3413 +#define OSC3_FREQ 24000000
3414 +#define AVALANCHE_CPMAC_INTERNAL_PHY_MASK 0x80000000
3415 +
3416 +#if defined(CONFIG_AR7_MARVELL)
3417 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x00010000
3418 +#else
3419 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x2
3420 +#endif
3421 +
3422 +#endif
3423 +
3424 +
3425 +#if defined(CONFIG_AR7WRD)
3426 +
3427 +#define AFECLK_FREQ 35328000
3428 +#define REFCLK_FREQ 25000000
3429 +#define OSC3_FREQ 24000000
3430 +#define AVALANCHE_CPMAC_INTERNAL_PHY_MASK 0x80000000
3431 +
3432 +#if defined(CONFIG_AR7_MARVELL)
3433 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x00010000
3434 +#else
3435 +#define AVALANCHE_CPMAC_EXTERNAL_PHY_MASK 0x2
3436 +#endif
3437 +
3438 +#endif
3439 +
3440 +extern unsigned int tnetd73xx_vbus_freq;
3441 +#define AVALANCHE_VBUS_FREQ tnetd73xx_vbus_freq
3442 +
3443 +static inline unsigned int get_avalanche_vbus_freq(void)
3444 +{
3445 + return (tnetd73xx_vbus_freq);
3446 +}
3447 +
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
3452 @@ -0,0 +1,183 @@
3453 +/* $Id$
3454 + *
3455 + * avalanche.h
3456 + *
3457 + * Jeff Harrell, jharrell@ti.com
3458 + * Copyright (C) 2000,2001,2002 Texas Instruments Inc.
3459 + *
3460 + *
3461 + * ########################################################################
3462 + *
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.
3466 + *
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.
3471 + *
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.
3475 + *
3476 + * ########################################################################
3477 + *
3478 + * Defines of the AVALANCHE board specific address-MAP, registers, etc.
3479 + *
3480 + */
3481 +#ifndef _MIPS_AVALANCHE_H
3482 +#define _MIPS_AVALANCHE_H
3483 +
3484 +#include <asm/addrspace.h>
3485 +
3486 +/*
3487 + * AVALANCHE board SDRAM base address. This is used to setup the
3488 + * bootmem tables
3489 + */
3490 +
3491 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
3492 +
3493 +/*
3494 + * AVALANCHE board vectors
3495 + */
3496 +
3497 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
3498 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
3499 +/*
3500 + * Avalanche RTC-device indirect register access.
3501 + */
3502 +
3503 +#define EVM3_RTC_ADR_REG (KSEG1ADDR(0x1f000800))
3504 +#define EVM3_RTC_DAT_REG (KSEG1ADDR(0x1f000808))
3505 +
3506 +/*
3507 + * Evm3 interrupt controller register base (primary)
3508 + */
3509 +
3510 +#define AVALANCHE_ICTRL_REGS_BASE (KSEG1ADDR(0x08612400))
3511 +
3512 +/*
3513 + * Avalanche exception controller register base (secondary)
3514 + */
3515 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE+0x80)
3516 +
3517 +
3518 +/*
3519 + * Avalanche Interrupt Channel Control register base
3520 + */
3521 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
3522 +
3523 +
3524 +/*
3525 + * Avalanche UART register base.
3526 + */
3527 +
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 )
3531 +/*
3532 + * AVALANCHE DMA controller base
3533 + */
3534 +
3535 +#define AVALANCHE_DMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* DMA 0 (channels 0-3) */
3536 +
3537 +
3538 +/*
3539 + * AVALANCHE display register base.
3540 + */
3541 +
3542 +#define EVM3_ASCII_DISPLAY_POS_BASE (KSEG1ADDR(0x1D000038))
3543 +#define EVM3_ASCII_DISPLAY_WORD_BASE (KSEG1ADDR(0x1D00003F)) /* How is this used??? JAH */
3544 +
3545 +
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
3554 +
3555 +/*
3556 + * Yamon Prom print address.
3557 + */
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)
3561 +
3562 +/*
3563 + * Evm3 Reset and PSU standby register.
3564 + */
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
3569 +
3570 +/************************************************************************
3571 + * PERIPHERAL BUS LEDs (P-LED):
3572 +*************************************************************************/
3573 +
3574 +/************************************************************************
3575 + * P-LED Register Addresses
3576 +*************************************************************************/
3577 +
3578 +#define EVM3_PLED (KSEG1ADDR(0x01C500000)) /* 0x1D200000 P-LED */
3579 +
3580 +
3581 +/************************************************************************
3582 + * Register field encodings
3583 +*************************************************************************/
3584 +
3585 +/******** reg: PLED ********/
3586 +/* bits 7:0: VAL */
3587 +#define EVM3_PLED_VAL_MSK 0xff
3588 +
3589 +/* bit 0: */
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
3593 +
3594 +/* bit 1: */
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
3598 +
3599 +/* bit 2: */
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
3603 +
3604 +/* bit 3: */
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
3608 +
3609 +/* bit 4: */
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
3613 +
3614 +/* bit 5: */
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
3618 +
3619 +/* bit 6: */
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
3623 +
3624 +/* bit 7: */
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
3628 +
3629 +#endif /* !(_MIPS_AVALANCHE_H) */
3630 +
3631 +
3632 +
3633 +
3634 +
3635 +
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
3639 @@ -0,0 +1,298 @@
3640 +/* $Id$
3641 + *
3642 + * avalancheint.h
3643 + *
3644 + * Jeff Harrell, jharrell@ti.com
3645 + * Copyright (C) 2000,2001 Texas Instruments , Inc.
3646 + *
3647 + * ########################################################################
3648 + *
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.
3652 + *
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.
3657 + *
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.
3661 + *
3662 + * ########################################################################
3663 + *
3664 + * Defines for the AVALANCHE interrupt controller.
3665 + *
3666 + */
3667 +#ifndef _MIPS_AVALANCHEINT_H
3668 +#define _MIPS_AVALANCHEINT_H
3669 +
3670 +#include <linux/config.h>
3671 +
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. */
3677 +
3678 +//#define SEADINT_UART0 3 /* TTYS0 interrupt on SEAD */
3679 +//#define SEADINT_UART1 4 /* TTYS1 interrupt on SEAD */
3680 +
3681 +
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)
3685 +
3686 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
3687 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
3688 +
3689 +
3690 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
3691 + + MIPS_EXCEPTION_OFFSET - 1)
3692 +
3693 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
3694 +{
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 */
3717 +};
3718 +
3719 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
3720 +{
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 */
3728 +};
3729 +
3730 +struct avalanche_channel_int_number
3731 +{
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 */
3772 +};
3773 +
3774 +struct avalanche_interrupt_line_to_channel
3775 +{
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;
3816 +};
3817 +
3818 +/* Interrupt Line #'s (Avalanche peripherals) */
3819 +
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 */
3863 +
3864 +#define DEBUG_MISSED_INTS 1
3865 +
3866 +#ifdef DEBUG_MISSED_INTS
3867 +struct debug_missed_int
3868 +{
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;
3877 +};
3878 +#endif /* DEBUG_MISSED_INTS */
3879 +
3880 +/*-----------------------------------*/
3881 +/* Avalanche Secondary Interrupts */
3882 +/*-----------------------------------*/
3883 +#define PRIMARY_INTS 40
3884 +
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 */
3900 +
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 */
3905 +
3906 +#ifdef JIMK_INT_CTRLR
3907 +/*-----------------------------------*/
3908 +/* Jim Kennedy's Interrupt Controller*/
3909 +/*-----------------------------------*/
3910 +
3911 +/* to clear the interrupt write the bit back to the status reg */
3912 +
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)
3922 +
3923 +#ifdef SEAD_USB_DEVELOPMENT
3924 +#define JIMK_USB_INT (1<<0)
3925 +#endif /* SEAD_USB_DEVELOPMENT */
3926 +
3927 +#endif /* JIMK_INT_CTRLR */
3928 +
3929 +extern void avalanche_int_set(int channel, int line);
3930 +extern void avalancheint_init(void);
3931 +
3932 +
3933 +#endif /* !(_MIPS_AVALANCHEINT_H) */
3934 +
3935 +
3936 +
3937 +
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
3941 @@ -0,0 +1,273 @@
3942 + /*
3943 + * Nitin Dhingra, iamnd@ti.com
3944 + * Copyright (C) 2000 Texas Instruments Inc.
3945 + *
3946 + *
3947 + * ########################################################################
3948 + *
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.
3952 + *
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.
3957 + *
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.
3961 + *
3962 + * ########################################################################
3963 + *
3964 + * Defines of the Sead board specific address-MAP, registers, etc.
3965 + *
3966 + */
3967 +#ifndef _AVALANCHE_INTC_H
3968 +#define _AVALANCHE_INTC_H
3969 +
3970 +#define MIPS_EXCEPTION_OFFSET 8
3971 +
3972 +/******************************************************************************
3973 + Avalanche Interrupt number
3974 +******************************************************************************/
3975 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
3976 +
3977 +/*******************************************************************************
3978 +*Linux Interrupt number
3979 +*******************************************************************************/
3980 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3981 +
3982 +
3983 +
3984 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
3985 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
3986 +
3987 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
3988 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
3989 +
3990 +
3991 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
3992 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
3993 + + MIPS_EXCEPTION_OFFSET - 1) /* Suraj, check */
3994 +
3995 +
3996 +/*
3997 + * Avalanche interrupt controller register base (primary)
3998 + */
3999 +#define AVALANCHE_ICTRL_REGS_BASE AVALANCHE_INTC_BASE
4000 +
4001 +/******************************************************************************
4002 + * Avalanche exception controller register base (secondary)
4003 + ******************************************************************************/
4004 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
4005 +
4006 +
4007 +/******************************************************************************
4008 + * Avalanche Interrupt pacing register base (secondary)
4009 + ******************************************************************************/
4010 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
4011 +
4012 +
4013 +
4014 +/******************************************************************************
4015 + * Avalanche Interrupt Channel Control register base
4016 + *****************************************************************************/
4017 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
4018 +
4019 +
4020 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
4021 +{
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 */
4048 +};
4049 +
4050 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
4051 +{
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 */
4059 +};
4060 +struct avalanche_ipace_regs
4061 +{
4062 +
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 */
4066 +};
4067 +struct avalanche_channel_int_number
4068 +{
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 */
4109 +};
4110 +
4111 +struct avalanche_interrupt_line_to_channel
4112 +{
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;
4153 +};
4154 +
4155 +
4156 +/* Interrupt Line #'s (Sangam peripherals) */
4157 +
4158 +/*------------------------------*/
4159 +/* Sangam primary interrupts */
4160 +/*------------------------------*/
4161 +
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
4202 +
4203 +/*-----------------------------------*/
4204 +/* Sangam Secondary Interrupts */
4205 +/*-----------------------------------*/
4206 +#define PRIMARY_INTS 40
4207 +
4208 +#define EMIF_INT (7 + PRIMARY_INTS)
4209 +
4210 +
4211 +extern void avalanche_int_set(int channel, int line);
4212 +
4213 +
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
4218 @@ -0,0 +1,54 @@
4219 +/* $Id$
4220 + *
4221 + * prom.h
4222 + *
4223 + * Carsten Langgaard, carstenl@mips.com
4224 + * Copyright (C) 1999 MIPS Technologies, Inc.
4225 + *
4226 + * ########################################################################
4227 + *
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.
4231 + *
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.
4236 + *
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.
4240 + *
4241 + * ########################################################################
4242 + *
4243 + * Sead bootprom interface for the Linux kernel.
4244 + *
4245 + */
4246 +
4247 +#ifndef _MIPS_PROM_H
4248 +#define _MIPS_PROM_H
4249 +
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);
4261 +
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 */
4268 +};
4269 +
4270 +
4271 +#endif /* !(_MIPS_PROM_H) */
4272 +
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
4276 @@ -0,0 +1,567 @@
4277 +/*
4278 + * $Id$
4279 + * Avalanche Register Descriptions
4280 + *
4281 + * Jeff Harrell, jharrell@ti.com
4282 + * 2000 (c) Texas Instruments Inc.
4283 + */
4284 +
4285 +#ifndef __AVALANCHE_REGS_H
4286 +#define __AVALANCHE_REGS_H
4287 +
4288 +#include <asm/addrspace.h>
4289 +#include <linux/config.h>
4290 +
4291 +/*----------------------------------------*/
4292 +/* Base offsets within the Avalanche ASIC */
4293 +/*----------------------------------------*/
4294 +
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))
4320 +
4321 +/*---------------------------------*/
4322 +/* Device ID, chip version number */
4323 +/*---------------------------------*/
4324 +
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))
4328 +
4329 +/*----------------------------------*/
4330 +/* Reset Control VW changed to ptrs */
4331 +/*----------------------------------*/
4332 +
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 */
4336 +
4337 +/* reset control bits */
4338 +
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) */
4346 +/*
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
4352 +*/
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 */
4363 +
4364 +/*----------------------*/
4365 +/* Physical interfaces */
4366 +/*----------------------*/
4367 +
4368 +/* Phy loopback */
4369 +#define PHY_LOOPBACK 1
4370 +
4371 +
4372 +/* Phy 0 */
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 */
4379 +
4380 +
4381 +/* Phy 1 */
4382 +
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))
4389 +
4390 +/* Phy 2 */
4391 +
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))
4398 +
4399 +/*-------------------*/
4400 +/* Avalanche ATM SAR */
4401 +/*-------------------*/
4402 +
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 */
4409 +
4410 +/* Transmit completion ring registers */
4411 +
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))
4426 +
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 */
4433 +
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))
4448 +
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 */
4456 +
4457 +
4458 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
4459 +
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))
4477 +
4478 +
4479 +/*
4480 +
4481 +#define OAM_CPID_ADD 0xa30104e0
4482 +
4483 +#define OAM_LLID_ADD 0xa30104f0
4484 +
4485 +#define OAM_LLID_VAL 0xffffffff
4486 +
4487 +#define OAM_CORR_TAG 0xa3010500
4488 +
4489 +#define OAM_FAR_COUNT_ADD 0xa3010520
4490 +
4491 +#define OAM_NEAR_COUNT_ADD 0xa3010540
4492 +
4493 +#define OAM_CONFIG_REG_ADD 0xa3000018
4494 +*/
4495 +
4496 +
4497 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
4498 +
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))
4503 +
4504 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
4505 +
4506 +
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 */
4513 +
4514 +/*------------------------------------------*/
4515 +/* DSL Interface */
4516 +/*------------------------------------------*/
4517 +
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))
4521 +
4522 +/* Fast */
4523 +
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))
4532 +
4533 +/* Interleaved */
4534 +
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))
4543 +
4544 +/*------------------------------------------*/
4545 +/* Broadband I/F */
4546 +/*------------------------------------------*/
4547 +
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))
4554 +
4555 +#define AVBBIF_DISABLED 0x0
4556 +#define AVBBIF_LBT4040_INT 0x1
4557 +#define AVBBIF_XBUS 0x2
4558 +#define AVBBIF_LBT4040_EXT 0x4
4559 +
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 +/*------------------------------------------*/
4564 +/* GPIO I/F */
4565 +/*------------------------------------------*/
4566 +
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 */
4571 +
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)
4577 +
4578 +/*
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
4584 +*/
4585 +
4586 +/*------------------------------------------*/
4587 +/* CLK_CTRL */
4588 +/*------------------------------------------*/
4589 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
4590 +
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)
4600 +
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))
4729 +
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))
4738 +
4739 +#define I2CWRITE 0x200
4740 +#define I2CREAD 0x300
4741 +#define I2C_END_BURST 0x400
4742 +
4743 +/* read bits */
4744 +#define I2C_READ_ERROR 0x8000
4745 +#define I2C_READ_COMPLETE 0x4000
4746 +#define I2C_READ_BUSY 0x2000
4747 +
4748 +/* device types */
4749 +#define I2C_IO_EXPANDER 0x2
4750 +#define I2C_RTC 0xd
4751 +
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
4756 +
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))
4763 +
4764 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4765 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
4766 +
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))
4775 +
4776 +
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))
4789 +
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))
4798 +
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))
4811 +
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))
4816 +
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))
4823 +
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))
4828 +
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))
4834 +
4835 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
4836 +
4837 +#endif
4838 +
4839 +
4840 +
4841 +
4842 +
4843 +
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
4847 @@ -0,0 +1,340 @@
4848 +/******************************************************************************
4849 + * FILE PURPOSE: TNETD73xx Common Header File
4850 + ******************************************************************************
4851 + * FILE NAME: tnetd73xx.h
4852 + *
4853 + * DESCRIPTION: shared typedef's, constants and API for TNETD73xx
4854 + *
4855 + * REVISION HISTORY:
4856 + * 27 Nov 02 - PSP TII
4857 + *
4858 + * (C) Copyright 2002, Texas Instruments, Inc
4859 + *******************************************************************************/
4860 +
4861 +/*
4862 + *
4863 + *
4864 + * These are const, typedef, and api definitions for tnetd73xx.
4865 + *
4866 + * NOTES:
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.
4871 + *
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.
4876 + *
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
4880 + * shared items.
4881 + */
4882 +
4883 +#ifndef __TNETD73XX_H__
4884 +#define __TNETD73XX_H__
4885 +
4886 +#ifndef _ASMLANGUAGE /* This part not for assembly language */
4887 +
4888 +#include <linux/types.h>
4889 +
4890 +extern unsigned int tnetd73xx_mips_freq;
4891 +extern unsigned int tnetd73xx_vbus_freq;
4892 +
4893 +#include "tnetd73xx_err.h"
4894 +
4895 +#endif /* _ASMLANGUAGE */
4896 +
4897 +
4898 +/*******************************************************************************************
4899 +* Emerald core specific
4900 +******************************************************************************************** */
4901 +
4902 +#ifdef BIG_ENDIAN
4903 +#elif defined(LITTLE_ENDIAN)
4904 +#else
4905 +#error Need to define endianism
4906 +#endif
4907 +
4908 +#ifndef KSEG_MSK
4909 +#define KSEG_MSK 0xE0000000 /* Most significant 3 bits denote kseg choice */
4910 +#endif
4911 +
4912 +#ifndef KSEG_INV_MASK
4913 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
4914 +#endif
4915 +
4916 +#ifndef KSEG0_BASE
4917 +#define KSEG0_BASE 0x80000000
4918 +#endif
4919 +
4920 +#ifndef KSEG1_BASE
4921 +#define KSEG1_BASE 0xA0000000
4922 +#endif
4923 +
4924 +#ifndef KSEG0
4925 +#define KSEG0(addr) (((u32)(addr) & ~KSEG_MSK) | KSEG0_BASE)
4926 +#endif
4927 +
4928 +#ifndef KSEG1
4929 +#define KSEG1(addr) (((u32)(addr) & ~KSEG_MSK) | KSEG1_BASE)
4930 +#endif
4931 +
4932 +#ifndef KUSEG
4933 +#define KUSEG(addr) ((u32)(addr) & ~KSEG_MSK)
4934 +#endif
4935 +
4936 +#ifndef PHYS_ADDR
4937 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
4938 +#endif
4939 +
4940 +#ifndef PHYS_TO_K0
4941 +#define PHYS_TO_K0(addr) (PHYS_ADDR(addr)|KSEG0_BASE)
4942 +#endif
4943 +
4944 +#ifndef PHYS_TO_K1
4945 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
4946 +#endif
4947 +
4948 +#ifndef REG8_ADDR
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);
4953 +#endif
4954 +
4955 +#ifndef REG16_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);
4960 +#endif
4961 +
4962 +#ifndef REG32_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);
4967 +#endif
4968 +
4969 +#ifdef _LINK_KSEG0_ /* Application is linked into KSEG0 space */
4970 +#define VIRT_ADDR(addr) PHYS_TO_K0(PHYS_ADDR(addr))
4971 +#endif
4972 +
4973 +#ifdef _LINK_KSEG1_ /* Application is linked into KSEG1 space */
4974 +#define VIRT_ADDR(addr) PHYS_TO_K1(PHYS_ADDR(addr))
4975 +#endif
4976 +
4977 +#if !defined(_LINK_KSEG0_) && !defined(_LINK_KSEG1_)
4978 +#error You must define _LINK_KSEG0_ or _LINK_KSEG1_ to compile the code.
4979 +#endif
4980 +
4981 +/* TNETD73XX chip definations */
4982 +
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) */
4986 +
4987 +#ifdef AR7SEAD2
4988 +#define TNETD73XX_MIPS_FREQ_DEFAULT 25000000 /* 25 Mhz for sead2 board crystal */
4989 +#else
4990 +#define TNETD73XX_MIPS_FREQ_DEFAULT 125000000 /* 125 Mhz */
4991 +#endif
4992 +#define TNETD73XX_VBUS_FREQ_DEFAULT (TNETD73XX_MIPS_FREQ_DEFAULT / 2) /* Sync mode */
4993 +
4994 +
4995 +
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 */
5025 +
5026 +/* BBIF Registers */
5027 +#define TNETD73XX_BBIF_ADSLADR (TNETD73XX_BBIF_CTRL_BASE + 0x0)
5028 +
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)
5035 +
5036 +/* GPIO Control */
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)
5044 +
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)
5049 +
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)
5055 +
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)
5067 +
5068 +/* EMIF control */
5069 +#define TNETD73XX_EMIF_SDRAM_CFG ( TNETD73XX_EMIF_BASE + 0x08 )
5070 +
5071 +/* UART */
5072 +#ifdef AR7SEAD2
5073 +#define TNETD73XX_UART_FREQ 3686400
5074 +#else
5075 +#define TNETD73XX_UART_FREQ TNETD73XX_VBUS_FREQ
5076 +#endif
5077 +
5078 +/* Interrupt Controller */
5079 +
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 */
5121 +
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 */
5155 +
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);\
5159 + nop; \
5160 + nop; \
5161 + nop
5162 +
5163 +#define MTC0_SEL1_OPCODE(dst, src)\
5164 + .word (0x40800000 | ((dst)<<16) | ((src)<<11) | 1);\
5165 + nop; \
5166 + nop; \
5167 + nop
5168 +
5169 +
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
5177 +
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
5184 +
5185 +
5186 +
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
5191 @@ -0,0 +1,42 @@
5192 +/******************************************************************************
5193 + * FILE PURPOSE: TNETD73xx Error Definations Header File
5194 + ******************************************************************************
5195 + * FILE NAME: tnetd73xx_err.h
5196 + *
5197 + * DESCRIPTION: Error definations for TNETD73XX
5198 + *
5199 + * REVISION HISTORY:
5200 + * 27 Nov 02 - PSP TII
5201 + *
5202 + * (C) Copyright 2002, Texas Instruments, Inc
5203 + *******************************************************************************/
5204 +
5205 +
5206 +#ifndef __TNETD73XX_ERR_H__
5207 +#define __TNETD73XX_ERR_H__
5208 +
5209 +typedef enum TNETD73XX_ERR_t
5210 +{
5211 + TNETD73XX_ERR_OK = 0, /* OK or SUCCESS */
5212 + TNETD73XX_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
5213 +
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 */
5218 +
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 */
5224 +
5225 + /* Device issues */
5226 + TNETD73XX_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
5227 + TNETD73XX_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
5228 +
5229 + TNETD73XX_ERR_INVID = -30 /* Invalid ID */
5230 +
5231 +} TNETD73XX_ERR;
5232 +
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
5237 @@ -0,0 +1,243 @@
5238 +/******************************************************************************
5239 + * FILE PURPOSE: TNETD73xx Misc modules API Header
5240 + ******************************************************************************
5241 + * FILE NAME: tnetd73xx_misc.h
5242 + *
5243 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
5244 + * FSER Modules API
5245 + * As per TNETD73xx specifications
5246 + *
5247 + * REVISION HISTORY:
5248 + * 27 Nov 02 - Sharath Kumar PSP TII
5249 + * 14 Feb 03 - Anant Gole PSP TII
5250 + *
5251 + * (C) Copyright 2002, Texas Instruments, Inc
5252 + *******************************************************************************/
5253 +
5254 +#ifndef __TNETD73XX_MISC_H__
5255 +#define __TNETD73XX_MISC_H__
5256 +
5257 +#include <linux/types.h>
5258 +
5259 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
5260 +
5261 +/*****************************************************************************
5262 + * Reset Control Module
5263 + *****************************************************************************/
5264 +
5265 +typedef enum TNETD73XX_RESET_MODULE_tag
5266 +{
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;
5288 +
5289 +typedef enum TNETD73XX_RESET_CTRL_tag
5290 +{
5291 + IN_RESET = 0,
5292 + OUT_OF_RESET
5293 +} TNETD73XX_RESET_CTRL_T;
5294 +
5295 +typedef enum TNETD73XX_SYS_RST_MODE_tag
5296 +{
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;
5300 +
5301 +typedef enum TNETD73XX_SYS_RESET_STATUS_tag
5302 +{
5303 + HARDWARE_RESET = 0,
5304 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
5305 + WATCHDOG_RESET,
5306 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
5307 +} TNETD73XX_SYS_RESET_STATUS_T;
5308 +
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);
5314 +
5315 +/*****************************************************************************
5316 + * Power Control Module
5317 + *****************************************************************************/
5318 +
5319 +typedef enum TNETD73XX_POWER_MODULE_tag
5320 +{
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;
5344 +
5345 +typedef enum TNETD73XX_POWER_CTRL_tag
5346 +{
5347 + POWER_CTRL_POWER_UP = 0,
5348 + POWER_CTRL_POWER_DOWN
5349 +} TNETD73XX_POWER_CTRL_T;
5350 +
5351 +typedef enum TNETD73XX_SYS_POWER_MODE_tag
5352 +{
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;
5358 +
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);
5363 +
5364 +/*****************************************************************************
5365 + * Wakeup Control
5366 + *****************************************************************************/
5367 +
5368 +typedef enum TNETD73XX_WAKEUP_INTERRUPT_tag
5369 +{
5370 + WAKEUP_INT0 = 1,
5371 + WAKEUP_INT1 = 2,
5372 + WAKEUP_INT2 = 4,
5373 + WAKEUP_INT3 = 8
5374 +} TNETD73XX_WAKEUP_INTERRUPT_T;
5375 +
5376 +typedef enum TNETD73XX_WAKEUP_CTRL_tag
5377 +{
5378 + WAKEUP_DISABLED = 0,
5379 + WAKEUP_ENABLED
5380 +} TNETD73XX_WAKEUP_CTRL_T;
5381 +
5382 +typedef enum TNETD73XX_WAKEUP_POLARITY_tag
5383 +{
5384 + WAKEUP_ACTIVE_HIGH = 0,
5385 + WAKEUP_ACTIVE_LOW
5386 +} TNETD73XX_WAKEUP_POLARITY_T;
5387 +
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);
5391 +
5392 +/*****************************************************************************
5393 + * FSER Control
5394 + *****************************************************************************/
5395 +
5396 +typedef enum TNETD73XX_FSER_MODE_tag
5397 +{
5398 + FSER_I2C = 0,
5399 + FSER_UART = 1
5400 +} TNETD73XX_FSER_MODE_T;
5401 +
5402 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode);
5403 +
5404 +/*****************************************************************************
5405 + * Clock Control
5406 + *****************************************************************************/
5407 +
5408 +#define CLK_MHZ(x) ( (x) * 1000000 )
5409 +
5410 +typedef enum TNETD73XX_CLKC_ID_tag
5411 +{
5412 + CLKC_SYS = 0,
5413 + CLKC_MIPS,
5414 + CLKC_USB,
5415 + CLKC_ADSLSS
5416 +} TNETD73XX_CLKC_ID_T;
5417 +
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);
5421 +
5422 +/*****************************************************************************
5423 + * GPIO Control
5424 + *****************************************************************************/
5425 +
5426 +typedef enum TNETD73XX_GPIO_PIN_tag
5427 +{
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,
5433 + GPIO_FSER_D = 5,
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,
5446 + GPIO_EINT0 = 18,
5447 + GPIO_EINT1 = 19,
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;
5457 +
5458 +typedef enum TNETD73XX_GPIO_PIN_MODE_tag
5459 +{
5460 + FUNCTIONAL_PIN = 0,
5461 + GPIO_PIN = 1
5462 +} TNETD73XX_GPIO_PIN_MODE_T;
5463 +
5464 +typedef enum TNETD73XX_GPIO_PIN_DIRECTION_tag
5465 +{
5466 + GPIO_OUTPUT_PIN = 0,
5467 + GPIO_INPUT_PIN = 1
5468 +} TNETD73XX_GPIO_PIN_DIRECTION_T;
5469 +
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);
5476 +
5477 +/* TNETD73XX Revision */
5478 +u32 tnetd73xx_get_revision(void);
5479 +
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
5484 @@ -63,8 +63,12 @@
5485 #ifdef CONFIG_64BIT_PHYS_ADDR
5486 #define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
5487 #else
5488 +#ifdef CONFIG_AR7_PAGING
5489 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + CONFIG_AR7_MEMORY)
5490 +#else
5491 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
5492 #endif
5493 +#endif
5494
5495 #define IO_SPACE_LIMIT 0xffff
5496
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
5500 @@ -14,7 +14,12 @@
5501 #include <linux/config.h>
5502 #include <linux/linkage.h>
5503
5504 +#ifdef CONFIG_AR7
5505 +#include <asm/ar7/avalanche_intc.h>
5506 +#define NR_IRQS AVALANCHE_INT_END + 1
5507 +#else
5508 #define NR_IRQS 128 /* Largest number of ints of all machines. */
5509 +#endif
5510
5511 #ifdef CONFIG_I8259
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 @@
5517
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))
5522 +#else
5523 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
5524 +#endif
5525 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
5526
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.
5533 */
5534
5535 -#ifdef CONFIG_CPU_VR41XX
5536 +#if defined(CONFIG_AR7_PAGING)
5537 +#define mk_pte(page, pgprot) \
5538 +({ \
5539 + pte_t __pte; \
5540 + \
5541 + pte_val(__pte) = ((phys_t)(page - mem_map) << (PAGE_SHIFT) | \
5542 + CONFIG_AR7_MEMORY) | \
5543 + pgprot_val(pgprot); \
5544 + \
5545 + __pte; \
5546 +})
5547 +#elif defined(CONFIG_CPU_VR41XX)
5548 #define mk_pte(page, pgprot) \
5549 ({ \
5550 pte_t __pte; \
5551 @@ -130,6 +141,7 @@
5552 })
5553 #endif
5554
5555 +
5556 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
5557 {
5558 #ifdef CONFIG_CPU_VR41XX
5559 @@ -175,7 +187,10 @@
5560 set_pte(ptep, __pte(0));
5561 }
5562
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))
5570 #else
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
5574 @@ -65,6 +65,15 @@
5575
5576 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
5577
5578 +#ifdef CONFIG_AR7
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 },
5583 +#else
5584 +#define AR7_SERIAL_PORT_DEFNS
5585 +#endif
5586 +
5587 #ifdef CONFIG_MIPS_JAZZ
5588 #define _JAZZ_SERIAL_INIT(int, base) \
5589 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
5590 @@ -468,6 +477,7 @@
5591 #endif
5592
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 \
This page took 0.287968 seconds and 5 git commands to generate.