1 diff -urN kernel-base/arch/mips/ar7/ar7/jump.S kernel-current/arch/mips/ar7/ar7/jump.S
2 --- kernel-base/arch/mips/ar7/ar7/jump.S 1970-01-01 01:00:00.000000000 +0100
3 +++ kernel-current/arch/mips/ar7/ar7/jump.S 2005-07-10 06:40:39.582267000 +0200
7 + * Copyright (C) $Date$ $Author$
9 + * This program is free software; you can redistribute it and/or modify
10 + * it under the terms of the GNU General Public License as published by
11 + * the Free Software Foundation; either version 2 of the License, or
12 + * (at your option) any later version.
14 + * This program is distributed in the hope that it will be useful,
15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 + * GNU General Public License for more details.
19 + * You should have received a copy of the GNU General Public License
20 + * along with this program; if not, write to the Free Software
21 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 +#include <linux/config.h>
26 +#include <linux/threads.h>
29 +#include <asm/cacheops.h>
30 +#include <asm/current.h>
31 +#include <asm/offset.h>
32 +#include <asm/processor.h>
33 +#include <asm/regdef.h>
34 +#include <asm/cachectl.h>
35 +#include <asm/mipsregs.h>
36 +#include <asm/stackframe.h>
43 +/* TLB Miss Vector */
53 + /* Unused TLB Miss Vector */
55 +LEAF(jump_tlb_miss_unused)
61 +END(jump_tlb_miss_unused)
63 + /* Cache Error Vector */
65 +LEAF(jump_cache_error)
71 +END(jump_cache_error)
73 + /* General Exception */
75 +LEAF(jump_general_exception)
81 +END(jump_general_exception)
83 + /* Dedicated Interrupt */
85 +LEAF(jump_dedicated_interrupt)
91 +END(jump_dedicated_interrupt)
94 diff -urN kernel-base/arch/mips/ar7/ar7/Makefile kernel-current/arch/mips/ar7/ar7/Makefile
95 --- kernel-base/arch/mips/ar7/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
96 +++ kernel-current/arch/mips/ar7/ar7/Makefile 2005-07-10 17:46:24.037377984 +0200
99 +# Copyright (C) $Date$ $Author$
101 +# This program is free software; you can redistribute it and/or modify
102 +# it under the terms of the GNU General Public License as published by
103 +# the Free Software Foundation; either version 2 of the License, or
104 +# (at your option) any later version.
106 +# This program is distributed in the hope that it will be useful,
107 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
108 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109 +# GNU General Public License for more details.
111 +# You should have received a copy of the GNU General Public License
112 +# along with this program; if not, write to the Free Software
113 +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
116 + $(CPP) $(AFLAGS) $< -o $*.s
119 + $(CC) $(AFLAGS) -c $< -o $*.o
121 +EXTRA_CFLAGS := -DLITTLE_ENDIAN -D_LINK_KSEG0_
125 +export-objs := misc.o
126 +obj-y += paging.o jump.o misc.o
128 +include $(TOPDIR)/Rules.make
129 diff -urN kernel-base/arch/mips/ar7/ar7/misc.c kernel-current/arch/mips/ar7/ar7/misc.c
130 --- kernel-base/arch/mips/ar7/ar7/misc.c 1970-01-01 01:00:00.000000000 +0100
131 +++ kernel-current/arch/mips/ar7/ar7/misc.c 2005-07-10 19:02:11.699779472 +0200
133 +#include <asm/ar7/sangam.h>
134 +#include <asm/ar7/avalanche_misc.h>
135 +#include <linux/module.h>
136 +#include <linux/spinlock.h>
140 +static unsigned int avalanche_vbus_freq;
142 +REMOTE_VLYNQ_DEV_RESET_CTRL_FN p_remote_vlynq_dev_reset_ctrl = NULL;
144 +/*****************************************************************************
145 + * Reset Control Module.
146 + *****************************************************************************/
147 +void avalanche_reset_ctrl(unsigned int module_reset_bit,
148 + AVALANCHE_RESET_CTRL_T reset_ctrl)
150 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
152 + if(module_reset_bit >= 32 && module_reset_bit < 64)
155 + if(module_reset_bit >= 64)
157 + if(p_remote_vlynq_dev_reset_ctrl)
158 + return(p_remote_vlynq_dev_reset_ctrl(module_reset_bit - 64, reset_ctrl));
163 + if(reset_ctrl == OUT_OF_RESET)
164 + *reset_reg |= 1 << module_reset_bit;
166 + *reset_reg &= ~(1 << module_reset_bit);
169 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(unsigned int module_reset_bit)
171 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
173 + return (((*reset_reg) & (1 << module_reset_bit)) ? OUT_OF_RESET : IN_RESET );
176 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode)
178 + volatile unsigned int *sw_reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_SWRCR;
179 + *sw_reset_reg = mode;
182 +#define AVALANCHE_RST_CTRL_RSR_MASK 0x3
184 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status()
186 + volatile unsigned int *sys_reset_status = (unsigned int*) AVALANCHE_RST_CTRL_RSR;
188 + return ( (AVALANCHE_SYS_RESET_STATUS_T) (*sys_reset_status & AVALANCHE_RST_CTRL_RSR_MASK) );
192 +/*****************************************************************************
193 + * Power Control Module
194 + *****************************************************************************/
195 +#define AVALANCHE_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
196 +#define AVALANCHE_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
199 +void avalanche_power_ctrl(unsigned int module_power_bit, AVALANCHE_POWER_CTRL_T power_ctrl)
201 + volatile unsigned int *power_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
203 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
204 + /* power down the module */
205 + *power_reg |= (1 << module_power_bit);
207 + /* power on the module */
208 + *power_reg &= (~(1 << module_power_bit));
211 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int module_power_bit)
213 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
215 + return (((*power_status_reg) & (1 << module_power_bit)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP);
218 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode)
220 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
222 + *power_status_reg &= AVALANCHE_GLOBAL_POWER_DOWN_MASK;
223 + *power_status_reg |= ( power_mode << AVALANCHE_GLOBAL_POWER_DOWN_BIT);
226 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void)
228 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
230 + return((AVALANCHE_SYS_POWER_MODE_T) (((*power_status_reg) & (~AVALANCHE_GLOBAL_POWER_DOWN_MASK))
231 + >> AVALANCHE_GLOBAL_POWER_DOWN_BIT));
234 +/*****************************************************************************
236 + *****************************************************************************/
238 +/****************************************************************************
239 + * FUNCTION: avalanche_gpio_init
240 + ***************************************************************************/
241 +void avalanche_gpio_init(void)
243 + spinlock_t closeLock;
244 + unsigned int closeFlag;
245 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
246 + spin_lock_irqsave(&closeLock, closeFlag);
247 + *reset_reg |= (1 << AVALANCHE_GPIO_RESET_BIT);
248 + spin_unlock_irqrestore(&closeLock, closeFlag);
251 +/****************************************************************************
252 + * FUNCTION: avalanche_gpio_ctrl
253 + ***************************************************************************/
254 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
255 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
256 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction)
258 + spinlock_t closeLock;
259 + unsigned int closeFlag;
260 + volatile unsigned int *gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_ENBL;
265 + spin_lock_irqsave(&closeLock, closeFlag);
267 + if(pin_mode == GPIO_PIN)
269 + *gpio_ctrl |= (1 << gpio_pin);
271 + gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_DIR;
273 + if(pin_direction == GPIO_INPUT_PIN)
274 + *gpio_ctrl |= (1 << gpio_pin);
276 + *gpio_ctrl &= ~(1 << gpio_pin);
278 + else /* FUNCTIONAL PIN */
280 + *gpio_ctrl &= ~(1 << gpio_pin);
283 + spin_unlock_irqrestore(&closeLock, closeFlag);
288 +/****************************************************************************
289 + * FUNCTION: avalanche_gpio_out
290 + ***************************************************************************/
291 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value)
293 + spinlock_t closeLock;
294 + unsigned int closeFlag;
295 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
300 + spin_lock_irqsave(&closeLock, closeFlag);
302 + *gpio_out |= 1 << gpio_pin;
304 + *gpio_out &= ~(1 << gpio_pin);
305 + spin_unlock_irqrestore(&closeLock, closeFlag);
310 +/****************************************************************************
311 + * FUNCTION: avalanche_gpio_in
312 + ***************************************************************************/
313 +int avalanche_gpio_in_bit(unsigned int gpio_pin)
315 + spinlock_t closeLock;
316 + unsigned int closeFlag;
317 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
323 + spin_lock_irqsave(&closeLock, closeFlag);
324 + ret_val = ((*gpio_in) & (1 << gpio_pin));
325 + spin_unlock_irqrestore(&closeLock, closeFlag);
330 +/****************************************************************************
331 + * FUNCTION: avalanche_gpio_out_val
332 + ***************************************************************************/
333 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int out_mask,
334 + unsigned int reg_index)
336 + spinlock_t closeLock;
337 + unsigned int closeFlag;
338 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
343 + spin_lock_irqsave(&closeLock, closeFlag);
344 + *gpio_out &= ~out_mask;
345 + *gpio_out |= out_val;
346 + spin_unlock_irqrestore(&closeLock, closeFlag);
351 +/****************************************************************************
352 + * FUNCTION: avalanche_gpio_in_value
353 + ***************************************************************************/
354 +int avalanche_gpio_in_value(unsigned int* in_val, unsigned int reg_index)
356 + spinlock_t closeLock;
357 + unsigned int closeFlag;
358 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
363 + spin_lock_irqsave(&closeLock, closeFlag);
364 + *in_val = *gpio_in;
365 + spin_unlock_irqrestore(&closeLock, closeFlag);
370 +/***********************************************************************
372 + * Wakeup Control Module for TNETV1050 Communication Processor
374 + ***********************************************************************/
376 +#define AVALANCHE_WAKEUP_POLARITY_BIT 16
378 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
379 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
380 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity)
382 + volatile unsigned int *wakeup_status_reg = (unsigned int*) AVALANCHE_WAKEUP_CTRL_WKCR;
384 + /* enable/disable */
385 + if (wakeup_ctrl == WAKEUP_ENABLED)
386 + /* enable wakeup */
387 + *wakeup_status_reg |= wakeup_int;
389 + /* disable wakeup */
390 + *wakeup_status_reg &= (~wakeup_int);
393 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
394 + *wakeup_status_reg |= (wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
396 + *wakeup_status_reg &= ~(wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
399 +void avalanche_set_vbus_freq(unsigned int new_vbus_freq)
401 + avalanche_vbus_freq = new_vbus_freq;
404 +unsigned int avalanche_get_vbus_freq()
406 + return(avalanche_vbus_freq);
409 +unsigned int avalanche_get_chip_version_info()
411 + return(*(volatile unsigned int*)AVALANCHE_CVR);
414 +SET_MDIX_ON_CHIP_FN_T p_set_mdix_on_chip_fn = NULL;
416 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation)
418 + if(p_set_mdix_on_chip_fn)
419 + return (p_set_mdix_on_chip_fn(base_addr, operation));
424 +unsigned int avalanche_is_mdix_on_chip(void)
426 + return(p_set_mdix_on_chip_fn ? 1:0);
429 +EXPORT_SYMBOL(avalanche_reset_ctrl);
430 +EXPORT_SYMBOL(avalanche_get_reset_status);
431 +EXPORT_SYMBOL(avalanche_sys_reset);
432 +EXPORT_SYMBOL(avalanche_get_sys_last_reset_status);
433 +EXPORT_SYMBOL(avalanche_power_ctrl);
434 +EXPORT_SYMBOL(avalanche_get_power_status);
435 +EXPORT_SYMBOL(avalanche_set_global_power_mode);
436 +EXPORT_SYMBOL(avalanche_get_global_power_mode);
437 +EXPORT_SYMBOL(avalanche_set_mdix_on_chip);
438 +EXPORT_SYMBOL(avalanche_is_mdix_on_chip);
440 +EXPORT_SYMBOL(avalanche_gpio_init);
441 +EXPORT_SYMBOL(avalanche_gpio_ctrl);
442 +EXPORT_SYMBOL(avalanche_gpio_out_bit);
443 +EXPORT_SYMBOL(avalanche_gpio_in_bit);
444 +EXPORT_SYMBOL(avalanche_gpio_out_value);
445 +EXPORT_SYMBOL(avalanche_gpio_in_value);
447 +EXPORT_SYMBOL(avalanche_set_vbus_freq);
448 +EXPORT_SYMBOL(avalanche_get_vbus_freq);
450 +EXPORT_SYMBOL(avalanche_get_chip_version_info);
452 diff -urN kernel-base/arch/mips/ar7/ar7/paging.c kernel-current/arch/mips/ar7/ar7/paging.c
453 --- kernel-base/arch/mips/ar7/ar7/paging.c 1970-01-01 01:00:00.000000000 +0100
454 +++ kernel-current/arch/mips/ar7/ar7/paging.c 2005-07-10 07:08:33.725758000 +0200
458 + * This file is subject to the terms and conditions of the GNU General Public
459 + * License. See the file "COPYING" in the main directory of this archive
460 + * for more details.
462 + * Copyright (C) 2002 by Jeff Harrell (jharrell@ti.com)
463 + * Copyright (C) 2002 Texas Instruments, Inc.
468 + * This file takes care of the "memory hole" issue that exists with the standard
469 + * linux kernel and the TI Avalanche ASIC. The Avalanche ASIC requires an offset
470 + * of 0x14000000 due to the ASIC's memory map constraints. This file corrects the
471 + * paging tables so that the only reflect valid memory (i.e. > 0x14000000)
475 +#include <linux/config.h>
476 +#include <linux/signal.h>
477 +#include <linux/sched.h>
478 +#include <linux/kernel.h>
479 +#include <linux/errno.h>
480 +#include <linux/string.h>
481 +#include <linux/types.h>
482 +#include <linux/ptrace.h>
483 +#include <linux/mman.h>
484 +#include <linux/mm.h>
485 +#include <linux/swap.h>
486 +#include <linux/smp.h>
487 +#include <linux/init.h>
488 +#ifdef CONFIG_BLK_DEV_INITRD
489 +#include <linux/blk.h>
490 +#endif /* CONFIG_BLK_DEV_INITRD */
491 +#include <linux/highmem.h>
492 +#include <linux/bootmem.h>
494 +#include <asm/processor.h>
495 +#include <asm/system.h>
496 +#include <asm/uaccess.h>
497 +#include <asm/pgtable.h>
498 +#include <asm/pgalloc.h>
499 +#include <asm/mmu_context.h>
501 +#include <asm/tlb.h>
502 +#include <asm/cpu.h>
504 +#define __MEMORY_START CONFIG_AR7_MEMORY
506 +#ifdef CONFIG_DISCONTIGMEM
507 +pg_data_t discontig_page_data[NR_NODES];
508 +bootmem_data_t discontig_node_bdata[NR_NODES];
511 +static unsigned long totalram_pages;
512 +/* static unsigned long totalhigh_pages; */
514 +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
515 +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
517 +#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
518 +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
519 +#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
521 +unsigned long bootmap_size;
523 +extern char *prom_getenv(char *envname);
526 + * We have upto 8 empty zeroed pages so we can map one of the right colour
527 + * when needed. This is necessary only on R4000 / R4400 SC and MC versions
528 + * where we have to avoid VCED / VECI exceptions for good performance at
529 + * any price. Since page is never written to after the initialization we
530 + * don't have to care about aliases on other CPUs.
533 +static inline unsigned long setup_zero_pages(void)
535 + unsigned long order, size;
537 + if(current_cpu_data.options & MIPS_CPU_VCE)
542 + empty_zero_page = __get_free_pages(GFP_KERNEL, order);
544 + if (!empty_zero_page)
545 + panic("Oh boy, that early out of memory?");
547 + page = virt_to_page(empty_zero_page);
549 + while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
550 + set_bit(PG_reserved, &page->flags);
551 + set_page_count(page, 0);
555 + size = PAGE_SIZE << order;
556 + zero_page_mask = (size - 1) & PAGE_MASK;
557 + memset((void *)empty_zero_page, 0, size);
559 + return 1UL << order;
563 + * paging_init() sets up the page tables
565 + * This routines also unmaps the page at virtual kernel address 0, so
566 + * that we can trap those pesky NULL-reference errors in the kernel.
568 +void __init paging_init(void)
570 + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
571 + unsigned long low, start_pfn;
573 + /* Initialize the entire pgd. */
574 + pgd_init((unsigned long)swapper_pg_dir);
575 + pgd_init((unsigned long)swapper_pg_dir + PAGE_SIZE / 2);
578 + start_pfn = START_PFN;
579 + // max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
582 + /* Avalanche DMA-able memory 0x14000000+memsize */
584 + zones_size[ZONE_DMA] = low - start_pfn;
586 + free_area_init_node(0, NODE_DATA(0), 0, zones_size, __MEMORY_START, 0);
588 +#ifdef CONFIG_DISCONTIGMEM
589 + zones_size[ZONE_DMA] = __MEMORY_SIZE_2ND >> PAGE_SHIFT;
590 + zones_size[ZONE_NORMAL] = 0;
591 + free_area_init_node(1, NODE_DATA(1), 0, zones_size, __MEMORY_START_2ND, 0);
592 +#endif /* CONFIG_DISCONTIGMEM */
596 +extern char _ftext, _etext, _fdata, _edata, _end;
597 +extern char __init_begin, __init_end;
599 +void __init mem_init(void)
601 + int codesize, reservedpages, datasize, initsize;
604 + max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN;
605 + high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE);
607 + /* free up the memory associated with Adam2 -
608 + * that is the, after the first page that is
609 + * reserved all the way up to the start of the kernel
611 + free_bootmem_node(NODE_DATA(0), (__MEMORY_START+PAGE_SIZE),
612 + (__pa(&_ftext))-(__MEMORY_START+PAGE_SIZE) );
614 + /* this will put all low memory onto the freelists */
615 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
617 + /* Setup zeroed pages */
618 + totalram_pages -= setup_zero_pages();
621 +#ifdef CONFIG_DISCONTIGMEM
622 + totalram_pages += free_all_bootmem_node(NODE_DATA(1));
625 + for (tmp = 0; tmp < num_physpages; tmp++)
627 + * Only count reserved RAM pages
629 + if (PageReserved(mem_map+tmp))
632 + codesize = (unsigned long) &_etext - (unsigned long) &_ftext;
633 + datasize = (unsigned long) &_edata - (unsigned long) &_fdata;
634 + initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
636 + printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
637 + (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
638 + max_mapnr << (PAGE_SHIFT-10),
640 + reservedpages << (PAGE_SHIFT-10),
646 +/* fixes paging routines for avalanche (utilized in /arch/mips/kernel/setup.c) */
648 +void avalanche_bootmem_init(void)
650 + unsigned long start_pfn, max_pfn;
651 + unsigned long max_low_pfn;
652 + unsigned int memsize,memory_end,memory_start;
655 + memsize_str = prom_getenv("memsize");
656 + if (!memsize_str) {
657 + memsize = 0x02000000;
659 + memsize = simple_strtol(memsize_str, NULL, 0);
663 + memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START;
664 + memory_end = memory_start + memsize;
667 + * Find the highest memory page fram number we have available
670 + max_pfn = PFN_DOWN(__pa(memory_end));
673 + * Determine the low and high memory ranges
676 + max_low_pfn = max_pfn;
679 + * Partially used pages are not usable - thus we are
680 + * rounding upwards:
683 + start_pfn = PFN_UP(__pa(&_end));
686 + * Find a proper area for the bootmem bitmap. After this
687 + * bootstrap step all allocations (until the page allocator is
688 + * intact) must be done via bootmem_alloc().
691 + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
692 + __MEMORY_START>>PAGE_SHIFT, max_low_pfn);
696 + * Register fully available low RAM pages with the bootmem allocator.
700 + unsigned long curr_pfn, last_pfn, pages;
703 + * We are rounding up the start address of usable memory:
705 + curr_pfn = PFN_UP(__MEMORY_START);
708 + * ... and at the end of the usable range downwards:
710 + last_pfn = PFN_DOWN(__pa(memory_end));
712 + if (last_pfn > max_low_pfn)
713 + last_pfn = max_low_pfn;
715 + pages = last_pfn - curr_pfn;
718 + free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
723 + * Reserve the kernel text and
724 + * Reserve the bootmem bitmap. We do this in two steps (first step
725 + * was init_bootmem()), because this catches the (definitely buggy)
726 + * case of us accidentally initializing the bootmem allocator with
727 + * an invalid RAM area.
729 + reserve_bootmem_node(NODE_DATA(0), __MEMORY_START+PAGE_SIZE,
730 + (PFN_PHYS(start_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START);
733 + * reserve physical page 0 - it's a special BIOS page on many boxes,
734 + * enabling clean reboots, SMP operation, laptop functions.
736 + reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);
739 +extern char __init_begin, __init_end;
741 +void free_initmem(void)
743 + unsigned long addr;
744 + // prom_free_prom_memory ();
746 + addr = (unsigned long) &__init_begin;
747 + while (addr < (unsigned long) &__init_end) {
748 + ClearPageReserved(virt_to_page(addr));
749 + set_page_count(virt_to_page(addr), 1);
754 + printk("Freeing unused kernel memory: %dk freed\n",
755 + (&__init_end - &__init_begin) >> 10);
758 +void si_meminfo(struct sysinfo *val)
760 + val->totalram = totalram_pages;
761 + val->sharedram = 0;
762 + val->freeram = nr_free_pages();
763 + val->bufferram = atomic_read(&buffermem_pages);
764 + val->totalhigh = 0;
765 + val->freehigh = nr_free_highpages();
766 + val->mem_unit = PAGE_SIZE;
770 diff -urN kernel-base/arch/mips/ar7/cmdline.c kernel-current/arch/mips/ar7/cmdline.c
771 --- kernel-base/arch/mips/ar7/cmdline.c 1970-01-01 01:00:00.000000000 +0100
772 +++ kernel-current/arch/mips/ar7/cmdline.c 2005-07-10 06:40:39.584266000 +0200
775 + * Carsten Langgaard, carstenl@mips.com
776 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
778 + * This program is free software; you can distribute it and/or modify it
779 + * under the terms of the GNU General Public License (Version 2) as
780 + * published by the Free Software Foundation.
782 + * This program is distributed in the hope it will be useful, but WITHOUT
783 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
784 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
785 + * for more details.
787 + * You should have received a copy of the GNU General Public License along
788 + * with this program; if not, write to the Free Software Foundation, Inc.,
789 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
791 + * Kernel command line creation using the prom monitor (YAMON) argc/argv.
793 +#include <linux/init.h>
794 +#include <linux/string.h>
796 +#include <asm/bootinfo.h>
798 +extern int prom_argc;
799 +extern int *_prom_argv;
802 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
803 + * This macro take care of sign extension.
805 +#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
807 +char arcs_cmdline[CL_SIZE];
809 +char * __init prom_getcmdline(void)
811 + return &(arcs_cmdline[0]);
815 +void __init prom_init_cmdline(void)
820 + actr = 1; /* Always ignore argv[0] */
822 + cp = &(arcs_cmdline[0]);
823 +#ifdef CONFIG_CMDLINE_BOOL
824 + strcpy(cp, CONFIG_CMDLINE);
825 + cp += strlen(CONFIG_CMDLINE);
828 + while(actr < prom_argc) {
829 + strcpy(cp, prom_argv(actr));
830 + cp += strlen(prom_argv(actr));
834 + if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
838 diff -urN kernel-base/arch/mips/ar7/init.c kernel-current/arch/mips/ar7/init.c
839 --- kernel-base/arch/mips/ar7/init.c 1970-01-01 01:00:00.000000000 +0100
840 +++ kernel-current/arch/mips/ar7/init.c 2005-07-10 17:53:38.565319696 +0200
843 + * Carsten Langgaard, carstenl@mips.com
844 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
846 + * This program is free software; you can distribute it and/or modify it
847 + * under the terms of the GNU General Public License (Version 2) as
848 + * published by the Free Software Foundation.
850 + * This program is distributed in the hope it will be useful, but WITHOUT
851 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
852 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
853 + * for more details.
855 + * You should have received a copy of the GNU General Public License along
856 + * with this program; if not, write to the Free Software Foundation, Inc.,
857 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
859 + * PROM library initialisation code.
861 +#include <linux/config.h>
862 +#include <linux/init.h>
863 +#include <linux/string.h>
864 +#include <linux/kernel.h>
865 +#include <linux/module.h>
868 +#include <asm/mips-boards/prom.h>
869 +#include <asm/mips-boards/generic.h>
871 +/* Environment variable */
878 +int *_prom_argv, *_prom_envp;
880 +/* max # of Adam2 environment variables */
881 +#define MAX_ENV_ENTRY 80
883 +static t_env_var local_envp[MAX_ENV_ENTRY];
886 +char *prom_getenv(char *envname)
889 + * Return a pointer to the given environment variable.
890 + * In 64-bit mode: we're using 64-bit pointers, but all pointers
891 + * in the PROM structures are only 32-bit, so we need some
892 + * workarounds, if we are running in 64-bit mode.
895 + t_env_var *env = (t_env_var *) local_envp;
897 + i = strlen(envname);
898 + while (env->name) {
899 + if(strncmp(envname, env->name, i) == 0) {
908 +static inline unsigned char str2hexnum(unsigned char c)
910 + if (c >= '0' && c <= '9')
912 + if (c >= 'a' && c <= 'f')
913 + return c - 'a' + 10;
914 + return 0; /* foo */
917 +static inline void str2eaddr(unsigned char *ea, unsigned char *str)
921 + for (i = 0; i < 6; i++) {
924 + if((*str == '.') || (*str == ':'))
926 + num = str2hexnum(*str++) << 4;
927 + num |= (str2hexnum(*str++));
932 +int get_ethernet_addr(char *ethernet_addr)
936 + ethaddr_str = prom_getenv("ethaddr");
937 + if (!ethaddr_str) {
938 + printk("ethaddr not set in boot prom\n");
941 + str2eaddr(ethernet_addr, ethaddr_str);
943 + if (init_debug > 1) {
945 + printk("get_ethernet_addr: ");
946 + for (i=0; i<5; i++)
947 + printk("%02x:", (unsigned char)*(ethernet_addr+i));
948 + printk("%02x\n", *(ethernet_addr+i));
954 +int __init prom_init(int argc, char **argv, char **envp)
957 + t_env_var *env = (t_env_var *) envp;
960 + _prom_argv = (int *)argv;
961 + _prom_envp = (int *)envp;
963 + /* Copy what we need locally so we are not dependent on
964 + * bootloader RAM. In Adam2, the environment parameters
965 + * are in flash but the table that references them is in
968 + for(i=0; i < MAX_ENV_ENTRY; i++, env++) {
970 + local_envp[i].name = env->name;
971 + local_envp[i].val = env->val;
973 + local_envp[i].name = NULL;
974 + local_envp[i].val = NULL;
978 + set_io_port_base(0);
980 + prom_printf("\nLINUX started...\n");
981 + prom_init_cmdline();
986 diff -urN kernel-base/arch/mips/ar7/irq.c kernel-current/arch/mips/ar7/irq.c
987 --- kernel-base/arch/mips/ar7/irq.c 1970-01-01 01:00:00.000000000 +0100
988 +++ kernel-current/arch/mips/ar7/irq.c 2005-07-10 17:53:17.841470200 +0200
991 + * Nitin Dhingra, iamnd@ti.com
992 + * Copyright (C) 2002 Texas Instruments, Inc. All rights reserved.
994 + * ########################################################################
996 + * This program is free software; you can distribute it and/or modify it
997 + * under the terms of the GNU General Public License (Version 2) as
998 + * published by the Free Software Foundation.
1000 + * This program is distributed in the hope it will be useful, but WITHOUT
1001 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1002 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1003 + * for more details.
1005 + * You should have received a copy of the GNU General Public License along
1006 + * with this program; if not, write to the Free Software Foundation, Inc.,
1007 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1009 + * ########################################################################
1011 + * Routines for generic manipulation of the interrupts found on the Texas
1012 + * Instruments avalanche board
1016 +#include <linux/config.h>
1017 +#include <linux/init.h>
1018 +#include <linux/sched.h>
1019 +#include <linux/slab.h>
1020 +#include <linux/interrupt.h>
1021 +#include <linux/kernel_stat.h>
1022 +#include <linux/proc_fs.h>
1023 +#include <asm/irq.h>
1024 +#include <asm/mips-boards/prom.h>
1025 +#include <asm/ar7/ar7.h>
1026 +#include <asm/ar7/avalanche_intc.h>
1027 +#include <asm/gdb-stub.h>
1030 +#define shutdown_avalanche_irq disable_avalanche_irq
1031 +#define mask_and_ack_avalanche_irq disable_avalanche_irq
1033 +static unsigned int startup_avalanche_irq(unsigned int irq);
1034 +static void end_avalanche_irq(unsigned int irq);
1035 +void enable_avalanche_irq(unsigned int irq_nr);
1036 +void disable_avalanche_irq(unsigned int irq_nr);
1038 +static struct hw_interrupt_type avalanche_irq_type = {
1040 + startup_avalanche_irq,
1041 + shutdown_avalanche_irq,
1042 + enable_avalanche_irq,
1043 + disable_avalanche_irq,
1044 + mask_and_ack_avalanche_irq,
1045 + end_avalanche_irq,
1049 +irq_desc_t irq_desc_ti[AVALANCHE_INT_END+1] __cacheline_aligned =
1050 +{ [0 ... AVALANCHE_INT_END] = { 0, &avalanche_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}};
1053 +unsigned long spurious_count = 0;
1055 +struct avalanche_ictrl_regs *avalanche_hw0_icregs; /* Interrupt control regs (primary) */
1056 +struct avalanche_exctrl_regs *avalanche_hw0_ecregs; /* Exception control regs (secondary) */
1057 +struct avalanche_ipace_regs *avalanche_hw0_ipaceregs;
1058 +struct avalanche_channel_int_number *avalanche_hw0_chregs; /* Channel control registers */
1060 +extern asmlinkage void mipsIRQ(void);
1064 + * The avalanche/MIPS interrupt line numbers are used to represent the
1065 + * interrupts within the irqaction arrays. The index notation is
1068 + * 0-7 MIPS CPU Exceptions (HW/SW)
1069 + * 8-47 Primary Interrupts (Avalanche)
1070 + * 48-79 Secondary Interrupts (Avalanche)
1075 +static struct irqaction *hw0_irq_action_primary[AVINTNUM(AVALANCHE_INT_END_PRIMARY)] =
1077 + NULL, NULL, NULL, NULL,
1078 + NULL, NULL, NULL, NULL,
1079 + NULL, NULL, NULL, NULL,
1080 + NULL, NULL, NULL, NULL,
1081 + NULL, NULL, NULL, NULL,
1082 + NULL, NULL, NULL, NULL,
1083 + NULL, NULL, NULL, NULL,
1084 + NULL, NULL, NULL, NULL,
1085 + NULL, NULL, NULL, NULL,
1086 + NULL, NULL, NULL, NULL
1089 +static struct irqaction *hw0_irq_action_secondary[AVINTNUM(AVALANCHE_INT_END_SECONDARY)] =
1091 + NULL, NULL, NULL, NULL,
1092 + NULL, NULL, NULL, NULL,
1093 + NULL, NULL, NULL, NULL,
1094 + NULL, NULL, NULL, NULL,
1095 + NULL, NULL, NULL, NULL,
1096 + NULL, NULL, NULL, NULL,
1097 + NULL, NULL, NULL, NULL,
1098 + NULL, NULL, NULL, NULL
1102 + This remaps interrupts to exist on other channels than the default
1103 + channels. essentially we can use the line # as the index for this
1108 +static unsigned long line_to_channel[AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
1109 +unsigned long uni_secondary_interrupt = 0;
1111 +static struct irqaction r4ktimer_action = {
1112 + NULL, 0, 0, "R4000 timer/counter", NULL, NULL,
1115 +static struct irqaction *irq_action[8] = {
1116 + NULL, /* SW int 0 */
1117 + NULL, /* SW int 1 */
1118 + NULL, /* HW int 0 */
1121 + NULL, /* HW int 3 */
1122 + NULL, /* HW int 4 */
1123 + &r4ktimer_action /* HW int 5 */
1126 +static void end_avalanche_irq(unsigned int irq)
1128 + if (!(irq_desc_ti[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
1129 + enable_avalanche_irq(irq);
1132 +void disable_avalanche_irq(unsigned int irq_nr)
1134 + unsigned long flags;
1135 + unsigned long chan_nr=0;
1136 + unsigned long int_bit=0;
1138 + if(irq_nr >= AVALANCHE_INT_END)
1140 + printk("whee, invalid irq_nr %d\n", irq_nr);
1141 + panic("IRQ, you lose...");
1144 + save_and_cli(flags);
1147 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
1149 + /* disable mips exception */
1151 + int_bit = read_c0_status() & ~(1 << (8+irq_nr));
1152 + change_c0_status(ST0_IM,int_bit);
1153 + restore_flags(flags);
1157 + /* irq_nr represents the line number for the interrupt. We must
1158 + * disable the channel number associated with that line number.
1161 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
1162 + chan_nr = AVINTNUM(irq_nr); /*CHECK THIS ALSO*/
1164 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];/* WE NEED A LINE TO CHANNEL MAPPING FUNCTION HERE*/
1166 + /* disable the interrupt channel bit */
1168 + /* primary interrupt #'s 0-31 */
1170 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
1171 + avalanche_hw0_icregs->intecr1 = (1 << chan_nr);
1173 + /* primary interrupt #'s 32-39 */
1175 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
1176 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
1177 + avalanche_hw0_icregs->intecr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
1179 + else /* secondary interrupt #'s 0-31 */
1180 + avalanche_hw0_ecregs->exiecr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
1182 + restore_flags(flags);
1185 +void enable_avalanche_irq(unsigned int irq_nr)
1187 + unsigned long flags;
1188 + unsigned long chan_nr=0;
1189 + unsigned long int_bit=0;
1191 + if(irq_nr > AVALANCHE_INT_END) {
1192 + printk("whee, invalid irq_nr %d\n", irq_nr);
1193 + panic("IRQ, you lose...");
1196 + save_and_cli(flags);
1199 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
1201 + /* Enable MIPS exceptions */
1202 + int_bit = read_c0_status();
1203 + change_c0_status(ST0_IM,int_bit | (1<<(8+irq_nr)));
1204 + restore_flags(flags);
1208 + /* irq_nr represents the line number for the interrupt. We must
1209 + * disable the channel number associated with that line number.
1212 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
1213 + chan_nr = AVINTNUM(irq_nr);
1215 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];
1217 + /* enable the interrupt channel bit */
1219 + /* primary interrupt #'s 0-31 */
1220 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
1221 + avalanche_hw0_icregs->intesr1 = (1 << chan_nr);
1223 + /* primary interrupt #'s 32 throuth 39 */
1224 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
1225 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
1226 + avalanche_hw0_icregs->intesr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
1228 + else /* secondary interrupt #'s 0-31 */
1229 + avalanche_hw0_ecregs->exiesr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
1231 + restore_flags(flags);
1234 +static unsigned int startup_avalanche_irq(unsigned int irq)
1236 + enable_avalanche_irq(irq);
1237 + return 0; /* never anything pending */
1241 +int get_irq_list(char *buf)
1245 + struct irqaction *action;
1247 + for (i = 0; i < MIPS_EXCEPTION_OFFSET; i++, num++)
1249 + action = irq_action[i];
1252 + len += sprintf(buf+len, "%2d: %8d %c %s",
1253 + num, kstat.irqs[0][num],
1254 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
1256 + for (action=action->next; action; action = action->next) {
1257 + len += sprintf(buf+len, ",%s %s",
1258 + (action->flags & SA_INTERRUPT) ? " +" : "",
1261 + len += sprintf(buf+len, " [MIPS interrupt]\n");
1265 + for (i = 0; i < AVINTNUM(AVALANCHE_INT_END); i++,num++)
1267 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
1268 + action = hw0_irq_action_primary[i];
1270 + action = hw0_irq_action_secondary[i-AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
1273 + len += sprintf(buf+len, "%2d: %8d %c %s",
1274 + num, kstat.irqs[0][ LNXINTNUM(i) ],
1275 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
1278 + for (action=action->next; action; action = action->next)
1280 + len += sprintf(buf+len, ",%s %s",
1281 + (action->flags & SA_INTERRUPT) ? " +" : "",
1285 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
1286 + len += sprintf(buf+len, " [hw0 (Avalanche Primary)]\n");
1288 + len += sprintf(buf+len, " [hw0 (Avalanche Secondary)]\n");
1295 +int request_irq(unsigned int irq,
1296 + void (*handler)(int, void *, struct pt_regs *),
1297 + unsigned long irqflags,
1298 + const char * devname,
1301 + struct irqaction *action;
1303 + if (irq > AVALANCHE_INT_END)
1308 + action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
1312 + action->handler = handler;
1313 + action->flags = irqflags;
1315 + action->name = devname;
1316 + irq_desc_ti[irq].action = action;
1317 + action->dev_id = dev_id;
1321 + if(irq < MIPS_EXCEPTION_OFFSET)
1323 + irq_action[irq] = action;
1324 + enable_avalanche_irq(irq);
1328 + if(irq < AVALANCHE_INT_END_PRIMARY)
1329 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = action;
1331 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = action;
1333 + enable_avalanche_irq(irq);
1338 +void free_irq(unsigned int irq, void *dev_id)
1340 + struct irqaction *action;
1342 + if (irq > AVALANCHE_INT_END) {
1343 + printk("Trying to free IRQ%d\n",irq);
1347 + if(irq < MIPS_EXCEPTION_OFFSET)
1349 + action = irq_action[irq];
1350 + irq_action[irq] = NULL;
1351 + irq_desc_ti[irq].action = NULL;
1352 + disable_avalanche_irq(irq);
1357 + if(irq < AVALANCHE_INT_END_PRIMARY) {
1358 + action = hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]];
1359 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = NULL;
1360 + irq_desc_ti[irq].action = NULL;
1363 + action = hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY];
1364 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = NULL;
1365 + irq_desc_ti[irq].action = NULL;
1368 + disable_avalanche_irq(irq);
1373 +extern void breakpoint(void);
1374 +extern int remote_debug;
1377 +//void init_IRQ(void) __init;
1378 +void __init init_IRQ(void)
1382 + avalanche_hw0_icregs = (struct avalanche_ictrl_regs *)AVALANCHE_ICTRL_REGS_BASE;
1383 + avalanche_hw0_ecregs = (struct avalanche_exctrl_regs *)AVALANCHE_ECTRL_REGS_BASE;
1384 + avalanche_hw0_ipaceregs = (struct avalanche_ipace_regs *)AVALANCHE_IPACE_REGS_BASE;
1385 + avalanche_hw0_chregs = (struct avalanche_channel_int_number *)AVALANCHE_CHCTRL_REGS_BASE;
1387 + /* Disable interrupts and clear pending
1390 + avalanche_hw0_icregs->intecr1 = 0xffffffff; /* disable interrupts 0:31 */
1391 + avalanche_hw0_icregs->intcr1 = 0xffffffff; /* clear interrupts 0:31 */
1392 + avalanche_hw0_icregs->intecr2 = 0xff; /* disable interrupts 32:39 */
1393 + avalanche_hw0_icregs->intcr2 = 0xff; /* clear interrupts 32:39 */
1394 + avalanche_hw0_ecregs->exiecr = 0xffffffff; /* disable secondary interrupts 0:31 */
1395 + avalanche_hw0_ecregs->excr = 0xffffffff; /* clear secondary interrupts 0:31 */
1398 + /* Channel to line mapping, Line to Channel mapping */
1400 + for(i = 0; i < 40; i++)
1401 + avalanche_int_set(i,i);
1403 + /* Now safe to set the exception vector. */
1404 + set_except_vector(0, mipsIRQ);
1406 + /* Setup the IRQ description array. These will be mapped
1407 + * as flat interrupts numbers. The mapping is as follows
1409 + * 0-7 MIPS CPU Exceptions (HW/SW)
1410 + * 8-46 Primary Interrupts (Avalanche)
1411 + * 47-78 Secondary Interrupts (Avalanche)
1414 + for (i = 0; i <= AVALANCHE_INT_END; i++)
1416 + irq_desc_ti[i].status = IRQ_DISABLED;
1417 + irq_desc_ti[i].action = 0;
1418 + irq_desc_ti[i].depth = 1;
1419 + irq_desc_ti[i].handler = &avalanche_irq_type;
1425 + set_debug_traps();
1432 +void avalanche_hw0_irqdispatch(struct pt_regs *regs)
1434 + struct irqaction *action;
1435 + int irq, cpu = smp_processor_id();
1436 + unsigned long int_line_number,status;
1437 + int i,secondary = 0;
1440 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
1441 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
1446 + if( chan_nr != uni_secondary_interrupt)
1447 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
1451 + if((chan_nr < 40) && (chan_nr > 31))
1453 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
1457 + /* If the Priority Interrupt Index Register returns 40 then no
1458 + * interrupts are pending
1464 + if(chan_nr == uni_secondary_interrupt)
1466 + status = avalanche_hw0_ecregs->exsr;
1467 + for(i=0; i < AVINTNUM(AVALANCHE_INT_END_SECONDARY); i++)
1469 + if (status & 1<<i)
1471 + /* clear secondary interrupt */
1472 + avalanche_hw0_ecregs->excr = 1 << i;
1479 + /* clear the universal secondary interrupt */
1480 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
1486 + /* Suraj Add code to clear secondary interrupt */
1489 + action = hw0_irq_action_secondary[irq];
1491 + action = hw0_irq_action_primary[irq];
1493 + /* if action == NULL, then we don't have a handler for the irq */
1495 + if ( action == NULL ) {
1496 + printk("No handler for hw0 irq: %i\n", irq);
1500 + irq_enter(cpu,irq);
1503 + kstat.irqs[0][(irq + AVINTNUM(AVALANCHE_INT_END_PRIMARY)) + 8]++;
1504 + action->handler((irq + AVALANCHE_INT_END_PRIMARY), action->dev_id, regs);
1508 + kstat.irqs[0][irq + 8]++;
1509 + action->handler(LNXINTNUM(irq), action->dev_id, regs);
1512 + irq_exit(cpu,irq);
1514 + if(softirq_pending(cpu))
1520 +void avalanche_int_set(int channel, int line)
1525 + avalanche_hw0_chregs->cintnr0 = line;
1528 + avalanche_hw0_chregs->cintnr1 = line;
1531 + avalanche_hw0_chregs->cintnr2 = line;
1534 + avalanche_hw0_chregs->cintnr3 = line;
1537 + avalanche_hw0_chregs->cintnr4 = line;
1540 + avalanche_hw0_chregs->cintnr5 = line;
1543 + avalanche_hw0_chregs->cintnr6 = line;
1546 + avalanche_hw0_chregs->cintnr7 = line;
1549 + avalanche_hw0_chregs->cintnr8 = line;
1552 + avalanche_hw0_chregs->cintnr9 = line;
1555 + avalanche_hw0_chregs->cintnr10 = line;
1558 + avalanche_hw0_chregs->cintnr11 = line;
1561 + avalanche_hw0_chregs->cintnr12 = line;
1564 + avalanche_hw0_chregs->cintnr13 = line;
1567 + avalanche_hw0_chregs->cintnr14 = line;
1570 + avalanche_hw0_chregs->cintnr15 = line;
1573 + avalanche_hw0_chregs->cintnr16 = line;
1576 + avalanche_hw0_chregs->cintnr17 = line;
1579 + avalanche_hw0_chregs->cintnr18 = line;
1582 + avalanche_hw0_chregs->cintnr19 = line;
1585 + avalanche_hw0_chregs->cintnr20 = line;
1588 + avalanche_hw0_chregs->cintnr21 = line;
1591 + avalanche_hw0_chregs->cintnr22 = line;
1594 + avalanche_hw0_chregs->cintnr23 = line;
1597 + avalanche_hw0_chregs->cintnr24 = line;
1600 + avalanche_hw0_chregs->cintnr25 = line;
1603 + avalanche_hw0_chregs->cintnr26 = line;
1606 + avalanche_hw0_chregs->cintnr27 = line;
1609 + avalanche_hw0_chregs->cintnr28 = line;
1612 + avalanche_hw0_chregs->cintnr29 = line;
1615 + avalanche_hw0_chregs->cintnr30 = line;
1618 + avalanche_hw0_chregs->cintnr31 = line;
1621 + avalanche_hw0_chregs->cintnr32 = line;
1624 + avalanche_hw0_chregs->cintnr33 = line;
1627 + avalanche_hw0_chregs->cintnr34 = line;
1630 + avalanche_hw0_chregs->cintnr35 = line;
1633 + avalanche_hw0_chregs->cintnr36 = line;
1636 + avalanche_hw0_chregs->cintnr37 = line;
1639 + avalanche_hw0_chregs->cintnr38 = line;
1642 + avalanche_hw0_chregs->cintnr39 = line;
1645 + printk("Error: Unknown Avalanche interrupt channel\n");
1648 + line_to_channel[line] = channel; /* Suraj check */
1650 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
1651 + uni_secondary_interrupt = line;
1656 +#define AVALANCHE_MAX_PACING_BLK 3
1657 +#define AVALANCHE_PACING_LOW_VAL 2
1658 +#define AVALANCHE_PACING_HIGH_VAL 63
1660 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num,
1661 + unsigned int pace_value)
1663 + unsigned int blk_offset;
1664 + unsigned long flags;
1666 + if(irq_nr < MIPS_EXCEPTION_OFFSET &&
1667 + irq_nr >= AVALANCHE_INT_END_PRIMARY)
1670 + if(blk_num > AVALANCHE_MAX_PACING_BLK)
1673 + if(pace_value > AVALANCHE_PACING_HIGH_VAL &&
1674 + pace_value < AVALANCHE_PACING_LOW_VAL)
1677 + blk_offset = blk_num*8;
1679 + save_and_cli(flags);
1681 + /* disable the interrupt pacing, if enabled previously */
1682 + avalanche_hw0_ipaceregs->ipacemax &= ~(0xff << blk_offset);
1684 + /* clear the pacing map */
1685 + avalanche_hw0_ipaceregs->ipacemap &= ~(0xff << blk_offset);
1687 + /* setup the new values */
1688 + avalanche_hw0_ipaceregs->ipacemap |= ((AVINTNUM(irq_nr)) << blk_offset);
1689 + avalanche_hw0_ipaceregs->ipacemax |= ((0x80 | pace_value) << blk_offset);
1691 + restore_flags(flags);
1695 diff -urN kernel-base/arch/mips/ar7/Makefile kernel-current/arch/mips/ar7/Makefile
1696 --- kernel-base/arch/mips/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
1697 +++ kernel-current/arch/mips/ar7/Makefile 2005-07-10 17:53:46.635092904 +0200
1700 +# Copyright (C) $Date$ $Author$
1702 +# This program is free software; you can redistribute it and/or modify
1703 +# it under the terms of the GNU General Public License as published by
1704 +# the Free Software Foundation; either version 2 of the License, or
1705 +# (at your option) any later version.
1707 +# This program is distributed in the hope that it will be useful,
1708 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1709 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1710 +# GNU General Public License for more details.
1712 +# You should have received a copy of the GNU General Public License
1713 +# along with this program; if not, write to the Free Software
1714 +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717 + $(CPP) $(AFLAGS) $< -o $*.s
1720 + $(CC) $(AFLAGS) -c $< -o $*.o
1724 +obj-y := setup.o irq.o mipsIRQ.o reset.o init.o memory.o printf.o cmdline.o time.o
1726 +include $(TOPDIR)/Rules.make
1727 diff -urN kernel-base/arch/mips/ar7/memory.c kernel-current/arch/mips/ar7/memory.c
1728 --- kernel-base/arch/mips/ar7/memory.c 1970-01-01 01:00:00.000000000 +0100
1729 +++ kernel-current/arch/mips/ar7/memory.c 2005-07-10 06:40:39.586266000 +0200
1732 + * Carsten Langgaard, carstenl@mips.com
1733 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1735 + * ########################################################################
1737 + * This program is free software; you can distribute it and/or modify it
1738 + * under the terms of the GNU General Public License (Version 2) as
1739 + * published by the Free Software Foundation.
1741 + * This program is distributed in the hope it will be useful, but WITHOUT
1742 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1743 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1744 + * for more details.
1746 + * You should have received a copy of the GNU General Public License along
1747 + * with this program; if not, write to the Free Software Foundation, Inc.,
1748 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1750 + * ########################################################################
1752 + * PROM library functions for acquiring/using memory descriptors given to
1753 + * us from the YAMON.
1756 +#include <linux/config.h>
1757 +#include <linux/init.h>
1758 +#include <linux/mm.h>
1759 +#include <linux/bootmem.h>
1761 +#include <asm/bootinfo.h>
1762 +#include <asm/page.h>
1763 +#include <asm/mips-boards/prom.h>
1764 +#include <asm/ar7/ar7.h>
1766 +enum yamon_memtypes {
1771 +struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
1773 +/* References to section boundaries */
1776 +#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
1779 +struct prom_pmemblock * __init prom_getmdesc(void)
1781 + char *memsize_str;
1782 + unsigned int memsize;
1784 + memsize_str = prom_getenv("memsize");
1785 + if (!memsize_str) {
1786 + memsize = 0x02000000;
1788 + memsize = simple_strtol(memsize_str, NULL, 0);
1791 + memset(mdesc, 0, sizeof(mdesc));
1793 + mdesc[0].type = yamon_dontuse;
1794 + mdesc[0].base = 0x00000000;
1795 + mdesc[0].size = CONFIG_AR7_MEMORY;
1797 + mdesc[1].type = yamon_prom;
1798 + mdesc[1].base = CONFIG_AR7_MEMORY;
1799 + mdesc[1].size = 0x00020000;
1801 + mdesc[2].type = yamon_free;
1802 + mdesc[2].base = CONFIG_AR7_MEMORY + 0x00020000;
1803 + mdesc[2].size = (memsize + CONFIG_AR7_MEMORY) - mdesc[2].base;
1808 +static int __init prom_memtype_classify (unsigned int type)
1812 + return BOOT_MEM_RAM;
1814 + return BOOT_MEM_ROM_DATA;
1816 + return BOOT_MEM_RESERVED;
1820 +void __init prom_meminit(void)
1822 + struct prom_pmemblock *p;
1824 + p = prom_getmdesc();
1828 + unsigned long base, size;
1830 + type = prom_memtype_classify (p->type);
1834 + add_memory_region(base, size, type);
1839 +void __init prom_free_prom_memory (void)
1842 + unsigned long freed = 0;
1843 + unsigned long addr;
1845 + for (i = 0; i < boot_mem_map.nr_map; i++) {
1846 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
1849 + addr = boot_mem_map.map[i].addr;
1850 + while (addr < boot_mem_map.map[i].addr
1851 + + boot_mem_map.map[i].size) {
1852 + ClearPageReserved(virt_to_page(__va(addr)));
1853 + set_page_count(virt_to_page(__va(addr)), 1);
1854 + free_page((unsigned long)__va(addr));
1855 + addr += PAGE_SIZE;
1856 + freed += PAGE_SIZE;
1859 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
1861 diff -urN kernel-base/arch/mips/ar7/mipsIRQ.S kernel-current/arch/mips/ar7/mipsIRQ.S
1862 --- kernel-base/arch/mips/ar7/mipsIRQ.S 1970-01-01 01:00:00.000000000 +0100
1863 +++ kernel-current/arch/mips/ar7/mipsIRQ.S 2005-07-10 06:40:39.587266000 +0200
1866 + * Carsten Langgaard, carstenl@mips.com
1867 + * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
1869 + * ########################################################################
1871 + * This program is free software; you can distribute it and/or modify it
1872 + * under the terms of the GNU General Public License (Version 2) as
1873 + * published by the Free Software Foundation.
1875 + * This program is distributed in the hope it will be useful, but WITHOUT
1876 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1877 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1878 + * for more details.
1880 + * You should have received a copy of the GNU General Public License along
1881 + * with this program; if not, write to the Free Software Foundation, Inc.,
1882 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1884 + * ########################################################################
1886 + * Interrupt exception dispatch code.
1889 +#include <linux/config.h>
1891 +#include <asm/asm.h>
1892 +#include <asm/mipsregs.h>
1893 +#include <asm/regdef.h>
1894 +#include <asm/stackframe.h>
1896 +/* A lot of complication here is taken away because:
1898 + * 1) We handle one interrupt and return, sitting in a loop and moving across
1899 + * all the pending IRQ bits in the cause register is _NOT_ the answer, the
1900 + * common case is one pending IRQ so optimize in that direction.
1902 + * 2) We need not check against bits in the status register IRQ mask, that
1903 + * would make this routine slow as hell.
1905 + * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
1906 + * between like BSD spl() brain-damage.
1908 + * Furthermore, the IRQs on the MIPS board look basically (barring software
1909 + * IRQs which we don't use at all and all external interrupt sources are
1910 + * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
1914 + * 0 Software (ignored)
1915 + * 1 Software (ignored)
1916 + * 2 Combined hardware interrupt (hw0)
1917 + * 3 Hardware (ignored)
1918 + * 4 Hardware (ignored)
1919 + * 5 Hardware (ignored)
1920 + * 6 Hardware (ignored)
1921 + * 7 R4k timer (what we use)
1923 + * Note: On the SEAD board thing are a little bit different.
1924 + * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
1927 + * We handle the IRQ according to _our_ priority which is:
1929 + * Highest ---- R4k Timer
1930 + * Lowest ---- Combined hardware interrupt
1932 + * then we just return, if multiple IRQs are pending then we will just take
1933 + * another exception, big deal.
1940 +NESTED(mipsIRQ, PT_SIZE, sp)
1945 + mfc0 s0, CP0_CAUSE # get irq bits
1947 + /* First we check for r4k counter/timer IRQ. */
1948 + andi a0, s0, CAUSEF_IP7
1950 + andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
1952 + /* Wheee, a timer interrupt. */
1954 + jal ar7_timer_interrupt
1961 + beq a0, zero, 1f # delay slot, check hw3 interrupt
1964 + /* Wheee, combined hardware level zero interrupt. */
1965 + jal avalanche_hw0_irqdispatch
1966 + move a0, sp # delay slot
1973 + * Here by mistake? This is possible, what can happen is that by the
1974 + * time we take the exception the IRQ pin goes low, so just leave if
1975 + * this is the case.
1978 + PRINT("Got interrupt: c0_cause = %08x\n")
1980 + PRINT("c0_epc = %08x\n")
1985 diff -urN kernel-base/arch/mips/ar7/printf.c kernel-current/arch/mips/ar7/printf.c
1986 --- kernel-base/arch/mips/ar7/printf.c 1970-01-01 01:00:00.000000000 +0100
1987 +++ kernel-current/arch/mips/ar7/printf.c 2005-07-10 06:40:39.587266000 +0200
1990 + * Carsten Langgaard, carstenl@mips.com
1991 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1993 + * This program is free software; you can distribute it and/or modify it
1994 + * under the terms of the GNU General Public License (Version 2) as
1995 + * published by the Free Software Foundation.
1997 + * This program is distributed in the hope it will be useful, but WITHOUT
1998 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1999 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2000 + * for more details.
2002 + * You should have received a copy of the GNU General Public License along
2003 + * with this program; if not, write to the Free Software Foundation, Inc.,
2004 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2006 + * Putting things on the screen/serial line using Adam2 facilities.
2009 +#include <linux/config.h>
2010 +#include <linux/init.h>
2011 +#include <linux/kernel.h>
2012 +#include <linux/serial_reg.h>
2013 +#include <linux/spinlock.h>
2014 +#include <asm/io.h>
2015 +#include <asm/serial.h>
2016 +#include <asm/addrspace.h>
2017 +#include <asm/ar7/ar7.h>
2019 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
2020 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
2022 +static char ppbuf[1024];
2024 +void (*prom_print_str)(unsigned int out, char *s, int len);
2026 +void prom_printf(char *fmt, ...) __init;
2027 +void prom_printf(char *fmt, ...)
2031 + prom_print_str = (void *)*(unsigned int *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR;
2033 + va_start(args, fmt);
2034 + vsprintf(ppbuf, fmt, args);
2035 + len = strlen(ppbuf);
2037 + prom_print_str(1, ppbuf, len);
2043 diff -urN kernel-base/arch/mips/ar7/reset.c kernel-current/arch/mips/ar7/reset.c
2044 --- kernel-base/arch/mips/ar7/reset.c 1970-01-01 01:00:00.000000000 +0100
2045 +++ kernel-current/arch/mips/ar7/reset.c 2005-07-10 06:40:39.587266000 +0200
2048 + * Carsten Langgaard, carstenl@mips.com
2049 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
2051 + * ########################################################################
2053 + * This program is free software; you can distribute it and/or modify it
2054 + * under the terms of the GNU General Public License (Version 2) as
2055 + * published by the Free Software Foundation.
2057 + * This program is distributed in the hope it will be useful, but WITHOUT
2058 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2059 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2060 + * for more details.
2062 + * You should have received a copy of the GNU General Public License along
2063 + * with this program; if not, write to the Free Software Foundation, Inc.,
2064 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2066 + * ########################################################################
2068 + * Reset the MIPS boards.
2071 +#include <linux/config.h>
2073 +#include <asm/reboot.h>
2074 +#include <asm/mips-boards/generic.h>
2076 +static void ar7_machine_restart(char *command);
2077 +static void ar7_machine_halt(void);
2078 +static void ar7_machine_power_off(void);
2080 +static void ar7_machine_restart(char *command)
2085 +static void ar7_machine_halt(void)
2090 +static void ar7_machine_power_off(void)
2095 +void ar7_reboot_setup(void)
2097 + _machine_restart = ar7_machine_restart;
2098 + _machine_halt = ar7_machine_halt;
2099 + _machine_power_off = ar7_machine_power_off;
2101 diff -urN kernel-base/arch/mips/ar7/setup.c kernel-current/arch/mips/ar7/setup.c
2102 --- kernel-base/arch/mips/ar7/setup.c 1970-01-01 01:00:00.000000000 +0100
2103 +++ kernel-current/arch/mips/ar7/setup.c 2005-07-10 06:40:39.588266000 +0200
2106 + * Carsten Langgaard, carstenl@mips.com
2107 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
2109 + * This program is free software; you can distribute it and/or modify it
2110 + * under the terms of the GNU General Public License (Version 2) as
2111 + * published by the Free Software Foundation.
2113 + * This program is distributed in the hope it will be useful, but WITHOUT
2114 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2115 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2116 + * for more details.
2118 + * You should have received a copy of the GNU General Public License along
2119 + * with this program; if not, write to the Free Software Foundation, Inc.,
2120 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2122 +#include <linux/config.h>
2123 +#include <linux/init.h>
2124 +#include <linux/sched.h>
2125 +#include <linux/mc146818rtc.h>
2126 +#include <linux/ioport.h>
2128 +#include <asm/cpu.h>
2129 +#include <asm/bootinfo.h>
2130 +#include <asm/irq.h>
2131 +#include <asm/mips-boards/generic.h>
2132 +#include <asm/mips-boards/prom.h>
2134 +#include <asm/dma.h>
2135 +#include <asm/time.h>
2136 +#include <asm/traps.h>
2139 +extern void rs_kgdb_hook(int);
2140 +int remote_debug = 0;
2143 +extern struct rtc_ops no_rtc_ops;
2145 +extern void ar7_reboot_setup(void);
2147 +extern void ar7_time_init(void);
2148 +extern void ar7_timer_setup(struct irqaction *irq);
2150 +const char *get_system_type(void)
2152 + return "Texas Instruments AR7";
2155 +void __init ar7_setup(void)
2158 + int rs_putDebugChar(char);
2159 + char rs_getDebugChar(void);
2160 + extern int (*generic_putDebugChar)(char);
2161 + extern char (*generic_getDebugChar)(void);
2164 +#ifdef CONFIG_SERIAL_CONSOLE
2165 + argptr = prom_getcmdline();
2166 + if ((argptr = strstr(argptr, "console=")) == NULL) {
2171 + s = prom_getenv("modetty0");
2172 + strcpy(console, "38400");
2175 + while (s[i] >= '0' && s[i] <= '9')
2179 + strncpy(console, s, i);
2184 + argptr = prom_getcmdline();
2185 + strcat(argptr, " console=ttyS0,");
2186 + strcat(argptr, console);
2191 + argptr = prom_getcmdline();
2192 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
2194 + argptr += strlen("kgdb=ttyS");
2195 + if (*argptr != '0' && *argptr != '1')
2196 + printk("KGDB: Uknown serial line /dev/ttyS%c, "
2197 + "falling back to /dev/ttyS1\n", *argptr);
2198 + line = *argptr == '0' ? 0 : 1;
2199 + printk("KGDB: Using serial line /dev/ttyS%d for session\n",
2202 + rs_kgdb_hook(line);
2203 + generic_putDebugChar = rs_putDebugChar;
2204 + generic_getDebugChar = rs_getDebugChar;
2206 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
2207 + "please connect your debugger\n", line ? 1 : 0);
2210 + /* Breakpoints are in init_IRQ() */
2214 + argptr = prom_getcmdline();
2215 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
2216 + cpu_data[0].options &= ~MIPS_CPU_FPU;
2218 + rtc_ops = &no_rtc_ops;
2220 + ar7_reboot_setup();
2222 + board_time_init = ar7_time_init;
2223 + board_timer_setup = ar7_timer_setup;
2225 diff -urN kernel-base/arch/mips/ar7/time.c kernel-current/arch/mips/ar7/time.c
2226 --- kernel-base/arch/mips/ar7/time.c 1970-01-01 01:00:00.000000000 +0100
2227 +++ kernel-current/arch/mips/ar7/time.c 2005-07-10 06:40:39.588266000 +0200
2230 + * Carsten Langgaard, carstenl@mips.com
2231 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
2233 + * ########################################################################
2235 + * This program is free software; you can distribute it and/or modify it
2236 + * under the terms of the GNU General Public License (Version 2) as
2237 + * published by the Free Software Foundation.
2239 + * This program is distributed in the hope it will be useful, but WITHOUT
2240 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2241 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2242 + * for more details.
2244 + * You should have received a copy of the GNU General Public License along
2245 + * with this program; if not, write to the Free Software Foundation, Inc.,
2246 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2248 + * ########################################################################
2250 + * Setting up the clock on the MIPS boards.
2254 +#include <linux/types.h>
2255 +#include <linux/config.h>
2256 +#include <linux/init.h>
2257 +#include <linux/kernel_stat.h>
2258 +#include <linux/sched.h>
2259 +#include <linux/spinlock.h>
2261 +#include <asm/mipsregs.h>
2262 +#include <asm/ptrace.h>
2263 +#include <asm/hardirq.h>
2264 +#include <asm/div64.h>
2266 +#include <linux/interrupt.h>
2267 +#include <linux/mc146818rtc.h>
2268 +#include <linux/timex.h>
2270 +#include <asm/mips-boards/generic.h>
2271 +#include <asm/mips-boards/prom.h>
2272 +#include <asm/ar7/ar7.h>
2274 +extern asmlinkage void mipsIRQ(void);
2276 +static unsigned long r4k_offset; /* Amount to increment compare reg each time */
2277 +static unsigned long r4k_cur; /* What counter should be at next timer irq */
2279 +#define MIPS_CPU_TIMER_IRQ 7
2280 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
2282 +static inline void ack_r4ktimer(unsigned long newval)
2284 + write_c0_compare(newval);
2287 +void ar7_timer_interrupt(struct pt_regs *regs)
2289 + int cpu = smp_processor_id();
2291 + irq_enter(cpu, MIPS_CPU_TIMER_IRQ);
2293 + if (r4k_offset == 0)
2297 + kstat.irqs[cpu][MIPS_CPU_TIMER_IRQ]++;
2299 + r4k_cur += r4k_offset;
2300 + ack_r4ktimer(r4k_cur);
2302 + } while (((unsigned long)read_c0_count()
2303 + - r4k_cur) < 0x7fffffff);
2305 + irq_exit(cpu, MIPS_CPU_TIMER_IRQ);
2307 + if (softirq_pending(cpu))
2317 + * Figure out the r4k offset, the amount to increment the compare
2318 + * register for each time tick.
2320 +static unsigned long __init cal_r4koff(void)
2322 + return ((CONFIG_AR7_CPU_FREQUENCY*500000)/HZ);
2325 +void __init ar7_time_init(void)
2327 + unsigned long flags;
2328 + unsigned int est_freq;
2330 + set_except_vector(0, mipsIRQ);
2331 + write_c0_count(0);
2333 + printk("calculating r4koff... ");
2334 + r4k_offset = cal_r4koff();
2335 + printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
2337 + est_freq = 2*r4k_offset*HZ;
2338 + est_freq += 5000; /* round */
2339 + est_freq -= est_freq%10000;
2340 + printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
2341 + (est_freq%1000000)*100/1000000);
2344 +void __init ar7_timer_setup(struct irqaction *irq)
2346 + /* we are using the cpu counter for timer interrupts */
2347 + irq->handler = no_action; /* we use our own handler */
2348 + setup_irq(MIPS_CPU_TIMER_IRQ, irq);
2350 + r4k_cur = (read_c0_count() + r4k_offset);
2351 + write_c0_compare(r4k_cur);
2352 + set_c0_status(ALLINTS);
2354 diff -urN kernel-base/arch/mips/config-shared.in kernel-current/arch/mips/config-shared.in
2355 --- kernel-base/arch/mips/config-shared.in 2005-07-10 03:00:44.784181376 +0200
2356 +++ kernel-current/arch/mips/config-shared.in 2005-07-10 06:40:39.589266000 +0200
2358 mainmenu_option next_comment
2359 comment 'Machine selection'
2360 dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL
2361 +dep_bool 'Support for Texas Instruments AR7 (EXPERIMENTAL)' CONFIG_AR7 $CONFIG_MIPS32 $CONFIG_EXPERIMENTAL
2362 +if [ "$CONFIG_AR7" = "y" ]; then
2363 + choice 'Texas Instruments Reference Platform' \
2364 + "AR7DB CONFIG_AR7DB \
2365 + AR7RD CONFIG_AR7RD \
2366 + AR7WRD CONFIG_AR7WRD" AR7DB
2367 + int 'Texas Instruments AR7 CPU Frequency' CONFIG_AR7_CPU_FREQUENCY 150
2368 + int 'Texas Instruments AR7 System Frequency' CONFIG_AR7_SYS_FREQUENCY 125
2369 + hex 'Texas Instruments AR7 SDRAM Start' CONFIG_AR7_MEMORY 0x14000000
2371 dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32
2372 dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32
2373 dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32
2374 @@ -239,6 +249,11 @@
2375 define_bool CONFIG_NONCOHERENT_IO y
2376 define_bool CONFIG_PC_KEYB y
2378 +if [ "$CONFIG_AR7" = "y" ]; then
2379 + define_bool CONFIG_NONCOHERENT_IO y
2380 + define_bool CONFIG_SWAP_IO_SPACE y
2381 + define_bool CONFIG_AR7_PAGING y
2383 if [ "$CONFIG_CASIO_E55" = "y" ]; then
2384 define_bool CONFIG_IRQ_CPU y
2385 define_bool CONFIG_NONCOHERENT_IO y
2387 mainmenu_option next_comment
2388 comment 'General setup'
2389 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2390 + "$CONFIG_AR7" = "y" -o \
2391 "$CONFIG_CASIO_E55" = "y" -o \
2392 "$CONFIG_DDB5074" = "y" -o \
2393 "$CONFIG_DDB5476" = "y" -o \
2395 bool 'Networking support' CONFIG_NET
2397 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2398 + "$CONFIG_AR7" = "y" -o \
2399 "$CONFIG_CASIO_E55" = "y" -o \
2400 "$CONFIG_DECSTATION" = "y" -o \
2401 "$CONFIG_IBM_WORKPAD" = "y" -o \
2402 diff -urN kernel-base/arch/mips/kernel/irq.c kernel-current/arch/mips/kernel/irq.c
2403 --- kernel-base/arch/mips/kernel/irq.c 2005-07-10 03:00:44.784181376 +0200
2404 +++ kernel-current/arch/mips/kernel/irq.c 2005-07-10 06:40:39.589266000 +0200
2406 * Generic, controller-independent functions:
2410 int get_irq_list(char *buf)
2414 p += sprintf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
2420 int global_irq_holder = NO_PROC_ID;
2426 int request_irq(unsigned int irq,
2427 void (*handler)(int, void *, struct pt_regs *),
2428 unsigned long irqflags,
2436 * free_irq - free an interrupt
2442 void free_irq(unsigned int irq, void *dev_id)
2452 * IRQ autodetection code..
2453 diff -urN kernel-base/arch/mips/kernel/mips_ksyms.c kernel-current/arch/mips/kernel/mips_ksyms.c
2454 --- kernel-base/arch/mips/kernel/mips_ksyms.c 2004-02-18 14:36:30.000000000 +0100
2455 +++ kernel-current/arch/mips/kernel/mips_ksyms.c 2005-07-10 17:55:55.738466208 +0200
2457 extern long __strnlen_user_nocheck_asm(const char *s);
2458 extern long __strnlen_user_asm(const char *s);
2461 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num, unsigned int pace_value);
2462 +char *prom_getenv(char *envname);
2466 EXPORT_SYMBOL(mips_machtype);
2468 EXPORT_SYMBOL(EISA_bus);
2472 EXPORT_SYMBOL(get_wchan);
2475 +EXPORT_SYMBOL_NOVERS(avalanche_request_pacing);
2476 +EXPORT_SYMBOL_NOVERS(prom_getenv);
2479 diff -urN kernel-base/arch/mips/kernel/setup.c kernel-current/arch/mips/kernel/setup.c
2480 --- kernel-base/arch/mips/kernel/setup.c 2005-07-10 03:00:44.785181224 +0200
2481 +++ kernel-current/arch/mips/kernel/setup.c 2005-07-10 06:40:39.590265000 +0200
2483 unsigned long isa_slot_offset;
2484 EXPORT_SYMBOL(isa_slot_offset);
2486 +extern void avalanche_bootmem_init(void);
2487 extern void SetUpBootInfo(void);
2488 extern void load_mmu(void);
2489 extern asmlinkage void start_kernel(void);
2491 #endif /* CONFIG_BLK_DEV_INITRD */
2493 /* Find the highest page frame number we have available. */
2494 +#ifdef CONFIG_AR7_PAGING
2495 + avalanche_bootmem_init();
2498 first_usable_pfn = -1UL;
2499 for (i = 0; i < boot_mem_map.nr_map; i++) {
2501 /* Reserve the bootmap memory. */
2502 reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
2505 #ifdef CONFIG_BLK_DEV_INITRD
2506 /* Board specific code should have set up initrd_start and initrd_end */
2507 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
2509 void hp_setup(void);
2510 void au1x00_setup(void);
2511 void frame_info_init(void);
2512 + void ar7_setup(void);
2515 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
2516 @@ -691,6 +697,11 @@
2517 pmc_yosemite_setup();
2521 + case MACH_GROUP_UNKNOWN:
2526 panic("Unsupported architecture");
2528 diff -urN kernel-base/arch/mips/kernel/traps.c kernel-current/arch/mips/kernel/traps.c
2529 --- kernel-base/arch/mips/kernel/traps.c 2005-07-10 03:00:44.786181072 +0200
2530 +++ kernel-current/arch/mips/kernel/traps.c 2005-07-10 06:40:39.591265000 +0200
2532 #include <asm/uaccess.h>
2533 #include <asm/mmu_context.h>
2536 +#include <asm/ar7/ar7.h>
2539 extern asmlinkage void handle_mod(void);
2540 extern asmlinkage void handle_tlbl(void);
2541 extern asmlinkage void handle_tlbs(void);
2542 @@ -869,9 +873,15 @@
2544 exception_handlers[n] = handler;
2545 if (n == 0 && cpu_has_divec) {
2547 + *(volatile u32 *)(AVALANCHE_VECS_KSEG0+0x200) = 0x08000000 |
2548 + (0x03ffffff & (handler >> 2));
2549 + flush_icache_range(AVALANCHE_VECS_KSEG0+0x200, AVALANCHE_VECS_KSEG0 + 0x204);
2551 *(volatile u32 *)(KSEG0+0x200) = 0x08000000 |
2552 (0x03ffffff & (handler >> 2));
2553 flush_icache_range(KSEG0+0x200, KSEG0 + 0x204);
2556 return (void *)old_handler;
2558 @@ -920,14 +930,46 @@
2559 void __init trap_init(void)
2561 extern char except_vec1_generic;
2562 + extern char except_vec2_generic;
2563 extern char except_vec3_generic, except_vec3_r4000;
2564 extern char except_vec_ejtag_debug;
2565 extern char except_vec4;
2569 + extern char jump_tlb_miss, jump_tlb_miss_unused;
2570 + extern char jump_cache_error,jump_general_exception;
2571 + extern char jump_dedicated_interrupt;
2572 + clear_c0_status(ST0_BEV);
2575 /* Copy the generic exception handler code to it's final destination. */
2576 memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
2577 + memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
2578 + memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
2580 + memcpy((void *)(KSEG0 + 0x0), &jump_tlb_miss, 0x80);
2581 + memcpy((void *)(KSEG0 + 0x80), &jump_tlb_miss_unused, 0x80);
2582 + memcpy((void *)(KSEG0 + 0x100), &jump_cache_error, 0x80);
2583 + memcpy((void *)(KSEG0 + 0x180), &jump_general_exception, 0x80);
2584 + memcpy((void *)(KSEG0 + 0x200), &jump_dedicated_interrupt, 0x80);
2587 + memcpy((void *)(AVALANCHE_VECS_KSEG0 + 0x80), &except_vec1_generic, 0x80);
2588 + memcpy((void *)(AVALANCHE_VECS_KSEG0 + 0x100), &except_vec2_generic, 0x80);
2589 + memcpy((void *)(AVALANCHE_VECS_KSEG0 + 0x180), &except_vec3_generic, 0x80);
2590 + flush_icache_range(AVALANCHE_VECS_KSEG0, AVALANCHE_VECS_KSEG0 + 0x200);
2592 + memcpy((void *)(KSEG0 + 0x0), &jump_tlb_miss, 0x80);
2593 + memcpy((void *)(KSEG0 + 0x80), &jump_tlb_miss_unused, 0x80);
2594 + memcpy((void *)(KSEG0 + 0x100), &jump_cache_error, 0x80);
2595 + memcpy((void *)(KSEG0 + 0x180), &jump_general_exception, 0x80);
2596 + memcpy((void *)(KSEG0 + 0x200), &jump_dedicated_interrupt, 0x80);
2598 + memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
2600 + flush_icache_range(KSEG0 + 0x80, KSEG0 + 0x200);
2603 * Setup default vectors
2605 @@ -951,8 +993,12 @@
2606 * Some MIPS CPUs have a dedicated interrupt vector which reduces the
2607 * interrupt processing overhead. Use it where available.
2610 + memcpy((void *)(AVALANCHE_VECS_KSEG0 + 0x200), &except_vec4, 8);
2613 memcpy((void *)(KSEG0 + 0x200), &except_vec4, 8);
2617 * Some CPUs can enable/disable for cache parity detection, but does
2618 @@ -991,12 +1037,17 @@
2620 set_except_vector(24, handle_mcheck);
2622 +memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
2624 + memcpy((void *)(AVALANCHE_VECS_KSEG0 + 0x180), &except_vec3_generic, 0x80);
2627 memcpy((void *)(KSEG0 + 0x180), &except_vec3_r4000, 0x80);
2628 else if (cpu_has_4kex)
2629 memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
2631 memcpy((void *)(KSEG0 + 0x080), &except_vec3_generic, 0x80);
2634 if (current_cpu_data.cputype == CPU_R6000 ||
2635 current_cpu_data.cputype == CPU_R6000A) {
2636 @@ -1023,7 +1074,11 @@
2637 if (board_nmi_handler_setup)
2638 board_nmi_handler_setup();
2641 + flush_icache_range(AVALANCHE_VECS_KSEG0, AVALANCHE_VECS_KSEG0 + 0x200);
2643 flush_icache_range(KSEG0, KSEG0 + 0x400);
2646 per_cpu_trap_init();
2648 diff -urN kernel-base/arch/mips/lib/promlib.c kernel-current/arch/mips/lib/promlib.c
2649 --- kernel-base/arch/mips/lib/promlib.c 2005-07-10 03:00:44.786181072 +0200
2650 +++ kernel-current/arch/mips/lib/promlib.c 2005-07-10 06:40:39.591265000 +0200
2654 #include <linux/kernel.h>
2661 diff -urN kernel-base/arch/mips/Makefile kernel-current/arch/mips/Makefile
2662 --- kernel-base/arch/mips/Makefile 2005-07-10 03:00:44.786181072 +0200
2663 +++ kernel-current/arch/mips/Makefile 2005-07-10 06:40:39.591265000 +0200
2664 @@ -369,6 +369,16 @@
2668 +# Texas Instruments AR7
2672 +LIBS += arch/mips/ar7/ar7.o arch/mips/ar7/ar7/ar7.o
2673 +SUBDIRS += arch/mips/ar7 arch/mips/ar7/ar7
2674 +LOADADDR += 0x94020000
2680 ifdef CONFIG_DECSTATION
2681 diff -urN kernel-base/arch/mips/mm/init.c kernel-current/arch/mips/mm/init.c
2682 --- kernel-base/arch/mips/mm/init.c 2005-07-10 03:00:44.787180920 +0200
2683 +++ kernel-current/arch/mips/mm/init.c 2005-07-10 07:09:29.914216000 +0200
2686 mmu_gather_t mmu_gathers[NR_CPUS];
2687 unsigned long highstart_pfn, highend_pfn;
2688 +#ifndef CONFIG_AR7_PAGING
2689 static unsigned long totalram_pages;
2690 static unsigned long totalhigh_pages;
2693 void pgd_init(unsigned long page)
2699 +#ifndef CONFIG_AR7_PAGING
2700 void __init paging_init(void)
2702 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
2705 free_area_init(zones_size);
2709 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
2710 #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
2715 +#ifndef CONFIG_AR7_PAGING
2716 void __init mem_init(void)
2718 unsigned long codesize, reservedpages, datasize, initsize;
2721 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
2725 #ifdef CONFIG_BLK_DEV_INITRD
2726 void free_initrd_mem(unsigned long start, unsigned long end)
2731 +#ifndef CONFIG_AR7_PAGING
2732 extern char __init_begin, __init_end;
2733 extern void prom_free_prom_memory(void) __init;
2740 prom_free_prom_memory ();
2743 addr = (unsigned long) &__init_begin;
2744 while (addr < (unsigned long) &__init_end) {
2750 diff -urN kernel-base/arch/mips/mm/tlb-r4k.c kernel-current/arch/mips/mm/tlb-r4k.c
2751 --- kernel-base/arch/mips/mm/tlb-r4k.c 2005-07-10 03:00:44.787180920 +0200
2752 +++ kernel-current/arch/mips/mm/tlb-r4k.c 2005-07-10 06:40:39.592265000 +0200
2754 #include <asm/pgtable.h>
2755 #include <asm/system.h>
2758 +#include <asm/ar7/ar7.h>
2761 extern char except_vec0_nevada, except_vec0_r4000, except_vec0_r4600;
2763 /* CP0 hazard avoidance. */
2764 @@ -375,7 +379,12 @@
2765 else if (current_cpu_data.cputype == CPU_R4600)
2766 memcpy((void *)KSEG0, &except_vec0_r4600, 0x80);
2769 + memcpy((void *)AVALANCHE_VECS_KSEG0, &except_vec0_r4000, 0x80);
2770 + flush_icache_range(AVALANCHE_VECS_KSEG0, AVALANCHE_VECS_KSEG0 + 0x80);
2772 memcpy((void *)KSEG0, &except_vec0_r4000, 0x80);
2773 flush_icache_range(KSEG0, KSEG0 + 0x80);
2777 diff -urN kernel-base/drivers/char/serial.c kernel-current/drivers/char/serial.c
2778 --- kernel-base/drivers/char/serial.c 2005-07-10 03:00:44.789180616 +0200
2779 +++ kernel-current/drivers/char/serial.c 2005-07-10 06:42:02.902600000 +0200
2780 @@ -419,7 +419,40 @@
2784 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
2785 +#if defined(CONFIG_AR7)
2787 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
2789 + return (inb(info->port + (offset * 4)) & 0xff);
2793 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
2795 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
2796 + return (inb(info->port + (offset * 4)) & 0xff);
2798 + return (inb_p(info->port + (offset * 4)) & 0xff);
2802 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
2804 + outb(value, info->port + (offset * 4));
2808 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
2811 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
2812 + outb(value, info->port + (offset * 4));
2814 + outb_p(value, info->port + (offset * 4));
2818 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
2820 #include <asm/mips-boards/atlas.h>
2822 @@ -478,8 +511,10 @@
2823 * needed for certain old 386 machines, I've left these #define's
2827 #define serial_inp(info, offset) serial_in(info, offset)
2828 #define serial_outp(info, offset, value) serial_out(info, offset, value)
2833 @@ -1728,7 +1763,16 @@
2834 /* Special case since 134 is really 134.5 */
2835 quot = (2*baud_base / 269);
2838 + quot = (CONFIG_AR7_SYS_FREQUENCY*500000) / baud;
2839 + //quot = get_avalanche_vbus_freq() / baud;
2845 quot = baud_base / baud;
2848 /* If the quotient is zero refuse the change */
2849 if (!quot && old_termios) {
2850 @@ -5552,8 +5596,10 @@
2851 state->irq = irq_cannonicalize(state->irq);
2853 state->io_type = SERIAL_IO_HUB6;
2855 if (state->port && check_region(state->port,8))
2859 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
2861 @@ -6009,7 +6055,16 @@
2862 info->io_type = state->io_type;
2863 info->iomem_base = state->iomem_base;
2864 info->iomem_reg_shift = state->iomem_reg_shift;
2866 + //quot = get_avalanche_vbus_freq() / baud;
2867 + quot = (CONFIG_AR7_SYS_FREQUENCY*500000) / baud;
2873 quot = state->baud_base / baud;
2875 cval = cflag & (CSIZE | CSTOPB);
2876 #if defined(__powerpc__) || defined(__alpha__)
2878 diff -urN kernel-base/include/asm-mips/ar7/ar7.h kernel-current/include/asm-mips/ar7/ar7.h
2879 --- kernel-base/include/asm-mips/ar7/ar7.h 1970-01-01 01:00:00.000000000 +0100
2880 +++ kernel-current/include/asm-mips/ar7/ar7.h 2005-07-10 06:40:39.622261000 +0200
2884 + * Copyright (C) $Date$ $Author$
2886 + * This program is free software; you can redistribute it and/or modify
2887 + * it under the terms of the GNU General Public License as published by
2888 + * the Free Software Foundation; either version 2 of the License, or
2889 + * (at your option) any later version.
2891 + * This program is distributed in the hope that it will be useful,
2892 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2893 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2894 + * GNU General Public License for more details.
2896 + * You should have received a copy of the GNU General Public License
2897 + * along with this program; if not, write to the Free Software
2898 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2905 +#include <asm/addrspace.h>
2906 +#include <linux/config.h>
2908 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(CONFIG_AR7_MEMORY))
2910 +#define AR7_UART0_REGS_BASE (KSEG1ADDR(0x08610E00))
2911 +#define AR7_UART1_REGS_BASE (KSEG1ADDR(0x08610E00))
2912 +#define AR7_BASE_BAUD ( 3686400 / 16 )
2915 diff -urN kernel-base/include/asm-mips/ar7/avalanche_intc.h kernel-current/include/asm-mips/ar7/avalanche_intc.h
2916 --- kernel-base/include/asm-mips/ar7/avalanche_intc.h 1970-01-01 01:00:00.000000000 +0100
2917 +++ kernel-current/include/asm-mips/ar7/avalanche_intc.h 2005-07-10 06:40:39.622261000 +0200
2920 + * Nitin Dhingra, iamnd@ti.com
2921 + * Copyright (C) 2000 Texas Instruments Inc.
2924 + * ########################################################################
2926 + * This program is free software; you can distribute it and/or modify it
2927 + * under the terms of the GNU General Public License (Version 2) as
2928 + * published by the Free Software Foundation.
2930 + * This program is distributed in the hope it will be useful, but WITHOUT
2931 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2932 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2933 + * for more details.
2935 + * You should have received a copy of the GNU General Public License along
2936 + * with this program; if not, write to the Free Software Foundation, Inc.,
2937 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2939 + * ########################################################################
2941 + * Defines of the Sead board specific address-MAP, registers, etc.
2944 +#ifndef _AVALANCHE_INTC_H
2945 +#define _AVALANCHE_INTC_H
2947 +#define MIPS_EXCEPTION_OFFSET 8
2949 +/******************************************************************************
2950 + Avalanche Interrupt number
2951 +******************************************************************************/
2952 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
2954 +/*******************************************************************************
2955 +*Linux Interrupt number
2956 +*******************************************************************************/
2957 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
2961 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
2962 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
2964 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
2965 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
2968 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
2969 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
2970 + + MIPS_EXCEPTION_OFFSET - 1) /* Suraj, check */
2974 + * Avalanche interrupt controller register base (primary)
2976 +#define KSEG1_BASE 0xA0000000
2977 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
2978 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
2979 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
2981 +#define AVALANCHE_ICTRL_REGS_BASE KSEG1ADDR(0x08612400)// AVALANCHE_INTC_BASE
2983 +/******************************************************************************
2984 + * Avalanche exception controller register base (secondary)
2985 + ******************************************************************************/
2986 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
2989 +/******************************************************************************
2990 + * Avalanche Interrupt pacing register base (secondary)
2991 + ******************************************************************************/
2992 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
2996 +/******************************************************************************
2997 + * Avalanche Interrupt Channel Control register base
2998 + *****************************************************************************/
2999 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
3002 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
3004 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 0x00 */
3005 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 0x04 */
3006 + volatile unsigned long unused1; /*0x08 */
3007 + volatile unsigned long unused2; /*0x0C */
3008 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 0x10 */
3009 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 0x14 */
3010 + volatile unsigned long unused3; /*0x18 */
3011 + volatile unsigned long unused4; /*0x1C */
3012 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 0x20 */
3013 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 0x24 */
3014 + volatile unsigned long unused5; /*0x28 */
3015 + volatile unsigned long unused6; /*0x2C */
3016 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 0x30 */
3017 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 0x34 */
3018 + volatile unsigned long unused7; /* 0x38 */
3019 + volatile unsigned long unused8; /* 0x3c */
3020 + volatile unsigned long pintir; /* Priority Interrupt Index Register 0x40 */
3021 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg 0x44 */
3022 + volatile unsigned long unused9; /* 0x48 */
3023 + volatile unsigned long unused10; /* 0x4C */
3024 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 10x50 */
3025 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 20x54 */
3026 + volatile unsigned long unused11; /* 0x58 */
3027 + volatile unsigned long unused12; /*0x5C */
3028 + volatile unsigned long inttypr1; /* Interrupt Type Mask register 10x60 */
3029 + volatile unsigned long inttypr2; /* Interrupt Type Mask register 20x64 */
3032 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
3034 + volatile unsigned long exsr; /* Exceptions Status/Set register 0x80 */
3035 + volatile unsigned long reserved; /*0x84 */
3036 + volatile unsigned long excr; /* Exceptions Clear Register 0x88 */
3037 + volatile unsigned long reserved1; /*0x8c */
3038 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) 0x90 */
3039 + volatile unsigned long reserved2; /*0x94 */
3040 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable(clear)0x98 */
3042 +struct avalanche_ipace_regs
3045 + volatile unsigned long ipacep; /* Interrupt pacing register 0xa0 */
3046 + volatile unsigned long ipacemap; /*Interrupt Pacing Map Register 0xa4 */
3047 + volatile unsigned long ipacemax; /*Interrupt Pacing Max Register 0xa8 */
3049 +struct avalanche_channel_int_number
3051 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register0x200 */
3052 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register0x204 */
3053 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register0x208 */
3054 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register0x20C */
3055 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register0x210 */
3056 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register0x214 */
3057 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register0x218 */
3058 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register0x21C */
3059 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register0x220 */
3060 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register0x224 */
3061 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register0x228 */
3062 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register0x22C */
3063 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register0x230 */
3064 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register0x234 */
3065 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register0x238 */
3066 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register0x23C */
3067 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register0x240 */
3068 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register0x244 */
3069 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register0x248 */
3070 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register0x24C */
3071 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register0x250 */
3072 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register0x254 */
3073 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register0x358 */
3074 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register0x35C */
3075 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register0x260 */
3076 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register0x264 */
3077 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register0x268 */
3078 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register0x26C */
3079 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register0x270 */
3080 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register0x274 */
3081 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register0x278 */
3082 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register0x27C */
3083 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register0x280 */
3084 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register0x284 */
3085 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register0x288 */
3086 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register0x28C */
3087 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register0x290 */
3088 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register0x294 */
3089 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register0x298 */
3090 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register0x29C */
3093 +struct avalanche_interrupt_line_to_channel
3095 + unsigned long int_line0; /* Start of primary interrupts */
3096 + unsigned long int_line1;
3097 + unsigned long int_line2;
3098 + unsigned long int_line3;
3099 + unsigned long int_line4;
3100 + unsigned long int_line5;
3101 + unsigned long int_line6;
3102 + unsigned long int_line7;
3103 + unsigned long int_line8;
3104 + unsigned long int_line9;
3105 + unsigned long int_line10;
3106 + unsigned long int_line11;
3107 + unsigned long int_line12;
3108 + unsigned long int_line13;
3109 + unsigned long int_line14;
3110 + unsigned long int_line15;
3111 + unsigned long int_line16;
3112 + unsigned long int_line17;
3113 + unsigned long int_line18;
3114 + unsigned long int_line19;
3115 + unsigned long int_line20;
3116 + unsigned long int_line21;
3117 + unsigned long int_line22;
3118 + unsigned long int_line23;
3119 + unsigned long int_line24;
3120 + unsigned long int_line25;
3121 + unsigned long int_line26;
3122 + unsigned long int_line27;
3123 + unsigned long int_line28;
3124 + unsigned long int_line29;
3125 + unsigned long int_line30;
3126 + unsigned long int_line31;
3127 + unsigned long int_line32;
3128 + unsigned long int_line33;
3129 + unsigned long int_line34;
3130 + unsigned long int_line35;
3131 + unsigned long int_line36;
3132 + unsigned long int_line37;
3133 + unsigned long int_line38;
3134 + unsigned long int_line39;
3138 +/* Interrupt Line #'s (Sangam peripherals) */
3140 +/*------------------------------*/
3141 +/* Sangam primary interrupts */
3142 +/*------------------------------*/
3144 +#define UNIFIED_SECONDARY_INTERRUPT 0
3145 +#define AVALANCHE_EXT_INT_0 1
3146 +#define AVALANCHE_EXT_INT_1 2
3147 +/* Line #3 Reserved */
3148 +/* Line #4 Reserved */
3149 +#define AVALANCHE_TIMER_0_INT 5
3150 +#define AVALANCHE_TIMER_1_INT 6
3151 +#define AVALANCHE_UART0_INT 7
3152 +#define AVALANCHE_UART1_INT 8
3153 +#define AVALANCHE_PDMA_INT0 9
3154 +#define AVALANCHE_PDMA_INT1 10
3155 +/* Line #11 Reserved */
3156 +/* Line #12 Reserved */
3157 +/* Line #13 Reserved */
3158 +/* Line #14 Reserved */
3159 +#define AVALANCHE_ATM_SAR_INT 15
3160 +/* Line #16 Reserved */
3161 +/* Line #17 Reserved */
3162 +/* Line #18 Reserved */
3163 +#define AVALANCHE_MAC0_INT 19
3164 +/* Line #20 Reserved */
3165 +#define AVALANCHE_VLYNQ0_INT 21
3166 +#define AVALANCHE_CODEC_WAKE_INT 22
3167 +/* Line #23 Reserved */
3168 +#define AVALANCHE_USB_INT 24
3169 +#define AVALANCHE_VLYNQ1_INT 25
3170 +/* Line #26 Reserved */
3171 +/* Line #27 Reserved */
3172 +#define AVALANCHE_MAC1_INT 28
3173 +#define AVALANCHE_I2CM_INT 29
3174 +#define AVALANCHE_PDMA_INT2 30
3175 +#define AVALANCHE_PDMA_INT3 31
3176 +/* Line #32 Reserved */
3177 +/* Line #33 Reserved */
3178 +/* Line #34 Reserved */
3179 +/* Line #35 Reserved */
3180 +/* Line #36 Reserved */
3181 +#define AVALANCHE_VDMA_VT_RX_INT 37
3182 +#define AVALANCHE_VDMA_VT_TX_INT 38
3183 +#define AVALANCHE_ADSLSS_INT 39
3185 +/*-----------------------------------*/
3186 +/* Sangam Secondary Interrupts */
3187 +/*-----------------------------------*/
3188 +#define PRIMARY_INTS 40
3190 +#define EMIF_INT (7 + PRIMARY_INTS)
3193 +extern void avalanche_int_set(int channel, int line);
3196 +#endif /* _AVALANCHE_INTC_H */
3197 diff -urN kernel-base/include/asm-mips/ar7/avalanche_misc.h kernel-current/include/asm-mips/ar7/avalanche_misc.h
3198 --- kernel-base/include/asm-mips/ar7/avalanche_misc.h 1970-01-01 01:00:00.000000000 +0100
3199 +++ kernel-current/include/asm-mips/ar7/avalanche_misc.h 2005-07-10 18:45:35.089287296 +0200
3201 +#ifndef _AVALANCHE_MISC_H_
3202 +#define _AVALANCHE_MISC_H_
3204 +typedef enum AVALANCHE_ERR_t
3206 + AVALANCHE_ERR_OK = 0, /* OK or SUCCESS */
3207 + AVALANCHE_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
3209 + /* Pointers and args */
3210 + AVALANCHE_ERR_INVARG = -2, /* Invaild argument to the call */
3211 + AVALANCHE_ERR_NULLPTR = -3, /* NULL pointer */
3212 + AVALANCHE_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
3214 + /* Memory issues */
3215 + AVALANCHE_ERR_ALLOC_FAIL = -10, /* allocation failed */
3216 + AVALANCHE_ERR_FREE_FAIL = -11, /* free failed */
3217 + AVALANCHE_ERR_MEM_CORRUPT = -12, /* corrupted memory */
3218 + AVALANCHE_ERR_BUF_LINK = -13, /* buffer linking failed */
3220 + /* Device issues */
3221 + AVALANCHE_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
3222 + AVALANCHE_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
3224 + AVALANCHE_ERR_INVID = -30 /* Invalid ID */
3228 +/*****************************************************************************
3229 + * Reset Control Module
3230 + *****************************************************************************/
3232 +typedef enum AVALANCHE_RESET_MODULE_tag
3234 + RESET_MODULE_UART0 = 0,
3235 + RESET_MODULE_UART1 = 1,
3236 + RESET_MODULE_I2C = 2,
3237 + RESET_MODULE_TIMER0 = 3,
3238 + RESET_MODULE_TIMER1 = 4,
3239 + RESET_MODULE_GPIO = 6,
3240 + RESET_MODULE_ADSLSS = 7,
3241 + RESET_MODULE_USBS = 8,
3242 + RESET_MODULE_SAR = 9,
3243 + RESET_MODULE_VDMA_VT = 11,
3244 + RESET_MODULE_FSER = 12,
3245 + RESET_MODULE_VLYNQ1 = 16,
3246 + RESET_MODULE_EMAC0 = 17,
3247 + RESET_MODULE_DMA = 18,
3248 + RESET_MODULE_BIST = 19,
3249 + RESET_MODULE_VLYNQ0 = 20,
3250 + RESET_MODULE_EMAC1 = 21,
3251 + RESET_MODULE_MDIO = 22,
3252 + RESET_MODULE_ADSLSS_DSP = 23,
3253 + RESET_MODULE_EPHY = 26
3254 +} AVALANCHE_RESET_MODULE_T;
3256 +typedef enum AVALANCHE_RESET_CTRL_tag
3260 +} AVALANCHE_RESET_CTRL_T;
3262 +typedef enum AVALANCHE_SYS_RST_MODE_tag
3264 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
3265 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
3266 +} AVALANCHE_SYS_RST_MODE_T;
3268 +typedef enum AVALANCHE_SYS_RESET_STATUS_tag
3270 + HARDWARE_RESET = 0,
3271 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
3273 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
3274 +} AVALANCHE_SYS_RESET_STATUS_T;
3276 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(AVALANCHE_RESET_MODULE_T reset_module);
3277 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode);
3278 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status(void);
3280 +typedef int (*REMOTE_VLYNQ_DEV_RESET_CTRL_FN)(unsigned int reset_module, AVALANCHE_RESET_CTRL_T reset_ctrl);
3282 +/*****************************************************************************
3283 + * Power Control Module
3284 + *****************************************************************************/
3286 +typedef enum AVALANCHE_POWER_CTRL_tag
3288 + POWER_CTRL_POWER_UP = 0,
3289 + POWER_CTRL_POWER_DOWN
3290 +} AVALANCHE_POWER_CTRL_T;
3292 +typedef enum AVALANCHE_SYS_POWER_MODE_tag
3294 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
3295 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
3296 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
3297 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
3298 +} AVALANCHE_SYS_POWER_MODE_T;
3300 +void avalanche_power_ctrl(unsigned int power_module, AVALANCHE_POWER_CTRL_T power_ctrl);
3301 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int power_module);
3302 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode);
3303 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void);
3305 +/*****************************************************************************
3307 + *****************************************************************************/
3309 +typedef enum AVALANCHE_WAKEUP_INTERRUPT_tag
3315 +} AVALANCHE_WAKEUP_INTERRUPT_T;
3317 +typedef enum TNETV1050_WAKEUP_CTRL_tag
3319 + WAKEUP_DISABLED = 0,
3321 +} AVALANCHE_WAKEUP_CTRL_T;
3323 +typedef enum TNETV1050_WAKEUP_POLARITY_tag
3325 + WAKEUP_ACTIVE_HIGH = 0,
3327 +} AVALANCHE_WAKEUP_POLARITY_T;
3329 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
3330 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
3331 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity);
3333 +/*****************************************************************************
3335 + *****************************************************************************/
3337 +typedef enum AVALANCHE_GPIO_PIN_MODE_tag
3339 + FUNCTIONAL_PIN = 0,
3341 +} AVALANCHE_GPIO_PIN_MODE_T;
3343 +typedef enum AVALANCHE_GPIO_PIN_DIRECTION_tag
3345 + GPIO_OUTPUT_PIN = 0,
3346 + GPIO_INPUT_PIN = 1
3347 +} AVALANCHE_GPIO_PIN_DIRECTION_T;
3349 +typedef enum { GPIO_FALSE, GPIO_TRUE } AVALANCHE_GPIO_BOOL_T;
3351 +void avalanche_gpio_init(void);
3352 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
3353 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
3354 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
3355 +int avalanche_gpio_ctrl_with_link_count(unsigned int gpio_pin,
3356 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
3357 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
3358 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value);
3359 +int avalanche_gpio_in_bit(unsigned int gpio_pin);
3360 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
3361 +int avalanche_gpio_out_value_with_link_count(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
3362 +int avalanche_gpio_in_value(unsigned int *in_val, unsigned int reg_index);
3364 +unsigned int avalanche_get_chip_version_info(void);
3366 +unsigned int avalanche_get_vbus_freq(void);
3367 +void avalanche_set_vbus_freq(unsigned int);
3370 +typedef int (*SET_MDIX_ON_CHIP_FN_T)(unsigned int base_addr, unsigned int operation);
3371 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation);
3372 +unsigned int avalanche_is_mdix_on_chip(void);
3375 diff -urN kernel-base/include/asm-mips/ar7/avalanche_regs.h kernel-current/include/asm-mips/ar7/avalanche_regs.h
3376 --- kernel-base/include/asm-mips/ar7/avalanche_regs.h 1970-01-01 01:00:00.000000000 +0100
3377 +++ kernel-current/include/asm-mips/ar7/avalanche_regs.h 2005-07-10 18:48:26.333254256 +0200
3381 + * Avalanche Register Descriptions
3383 + * Jeff Harrell, jharrell@ti.com
3384 + * 2000 (c) Texas Instruments Inc.
3387 +#ifndef __AVALANCHE_REGS_H
3388 +#define __AVALANCHE_REGS_H
3390 +#include <asm/addrspace.h>
3391 +#include <linux/config.h>
3393 +/*----------------------------------------*/
3394 +/* Base offsets within the Avalanche ASIC */
3395 +/*----------------------------------------*/
3397 +#define BBIF_SPACE0 (KSEG1ADDR(0x01000000))
3398 +#define BBIF_SPACE1 (KSEG1ADDR(0x01800000))
3399 +#define BBIF_CONTROL (KSEG1ADDR(0x02000000))
3400 +#define ATM_SAR_BASE (KSEG1ADDR(0x03000000))
3401 +#define USB_MCU_BASE (KSEG1ADDR(0x03400000))
3402 +#define DES_BASE (KSEG1ADDR(0x08600000))
3403 +#define ETH_MACA_BASE (KSEG1ADDR(0x08610000))
3404 +#define ETH_MACB_BASE (KSEG1ADDR(0x08612800))
3405 +#define MEM_CTRLR_BASE (KSEG1ADDR(0x08610800))
3406 +#define GPIO_BASE (KSEG1ADDR(0x08610900))
3407 +#define CLK_CTRL_BASE (KSEG1ADDR(0x08610A00))
3408 +#define WATCH_DOG_BASE (KSEG1ADDR(0x08610B00))
3409 +#define TMR1_BASE (KSEG1ADDR(0x08610C00))
3410 +#define TRM2_BASE (KSEG1ADDR(0x08610D00))
3411 +#define UARTA_BASE (KSEG1ADDR(0x08610E00))
3412 +#define UARTB_BASE (KSEG1ADDR(0x08610F00))
3413 +#define I2C_BASE (KSEG1ADDR(0x08611000))
3414 +#define DEV_ID_BASE (KSEG1ADDR(0x08611100))
3415 +#define USB_BASE (KSEG1ADDR(0x08611200))
3416 +#define PCI_CONFIG_BASE (KSEG1ADDR(0x08611300))
3417 +#define DMA_BASE (KSEG1ADDR(0x08611400))
3418 +#define RESET_CTRL_BASE (KSEG1ADDR(0x08611600))
3419 +#define DSL_IF_BASE (KSEG1ADDR(0x08611B00))
3420 +#define INT_CTL_BASE (KSEG1ADDR(0x08612400))
3421 +#define PHY_BASE (KSEG1ADDR(0x1E000000))
3423 +/*---------------------------------*/
3424 +/* Device ID, chip version number */
3425 +/*---------------------------------*/
3427 +#define AVALANCHE_CHVN (*(volatile unsigned int *)(DEV_ID_BASE+0x14))
3428 +#define AVALANCHE_DEVID1 (*(volatile unsigned int *)(DEV_ID_BASE+0x18))
3429 +#define AVALANCHE_DEVID2 (*(volatile unsigned int *)(DEV_ID_BASE+0x1C))
3431 +/*----------------------------------*/
3432 +/* Reset Control VW changed to ptrs */
3433 +/*----------------------------------*/
3435 +#define AVALANCHE_PRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x0)) /* Peripheral reset control */
3436 +#define AVALANCHE_SWRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x4)) /* Software reset control */
3437 +#define AVALANCHE_RSR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x8)) /* Reset status register */
3439 +/* reset control bits */
3441 +#define AV_RST_UART0 (1<<0) /* Brings UART0 out of reset */
3442 +#define AV_RST_UART1 (1<<1) /* Brings UART1 out of reset */
3443 +#define AV_RST_IICM (1<<2) /* Brings the I2CM out of reset */
3444 +#define AV_RST_TIMER0 (1<<3) /* Brings Timer 0 out of reset */
3445 +#define AV_RST_TIMER1 (1<<4) /* Brings Timer 1 out of reset */
3446 +#define AV_RST_DES (1<<5) /* Brings the DES module out of reset */
3447 +#define AV_RST_GPIO (1<<6) /* Brings the GPIO module out of reset (see note below) */
3449 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
3450 + If you reset the GPIO interface all of the directions (i/o) of the UART B
3451 + interface pins are inputs and must be reconfigured so as not to lose the
3452 + serial console interface
3453 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
3455 +#define AV_RST_BBIF (1<<7) /* Brings the Broadband interface out of reset */
3456 +#define AV_RST_USB (1<<8) /* Brings the USB module out of reset */
3457 +#define AV_RST_SAR (1<<9) /* Brings the SAR out of reset */
3458 +#define AV_RST_HDLC (1<<10) /* Brings the HDLC module out of reset */
3459 +#define AV_RST_PCI (1<<16) /* Brings the PCI module out of reset */
3460 +#define AV_RST_ETH_MAC0 (1<<17) /* Brings the Ethernet MAC0 out of reset */
3461 +#define AV_RST_PICO_DMA (1<<18) /* Brings the PICO DMA module out of reset */
3462 +#define AV_RST_BIST (1<<19) /* Brings the BIST module out of reset */
3463 +#define AV_RST_DSP (1<<20) /* Brings the DSP sub system out of reset */
3464 +#define AV_RST_ETH_MAC1 (1<<21) /* Brings the Ethernet MAC1 out of reset */
3466 +/*----------------------*/
3467 +/* Physical interfaces */
3468 +/*----------------------*/
3471 +#define PHY_LOOPBACK 1
3475 +#define PHY0BASE (PHY_BASE)
3476 +#define PHY0RST (*(volatile unsigned char *) (PHY0BASE)) /* reset */
3477 +#define PHY0CTRL (*(volatile unsigned char *) (PHY0BASE+0x5)) /* control */
3478 +#define PHY0RACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x50)) /* RACP control/status */
3479 +#define PHY0TACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x60)) /* TACP idle/unassigned cell hdr */
3480 +#define PHY0RACPINT (*(volatile unsigned char *) (PHY0BASE+0x51)) /* RACP interrupt enable/Status */
3485 +#define PHY1BASE (PHY_BASE + 0x100000)
3486 +#define PHY1RST (*(volatile unsigned char *) (PHY1BASE)) /* reset */
3487 +#define PHY1CTRL (*(volatile unsigned char *) (PHY1BASE+0x5)) /* control */
3488 +#define PHY1RACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x50))
3489 +#define PHY1TACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x60))
3490 +#define PHY1RACPINT (*(volatile unsigned char *) (PHY1BASE+0x51))
3494 +#define PHY2BASE (PHY_BASE + 0x200000)
3495 +#define PHY2RST (*(volatile unsigned char *) (PHY2BASE)) /* reset */
3496 +#define PHY2CTRL (*(volatile unsigned char *) (PHY2BASE+0x5)) /* control */
3497 +#define PHY2RACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x50))
3498 +#define PHY2TACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x60))
3499 +#define PHY2RACPINT (*(volatile unsigned char *) (PHY2BASE+0x51))
3501 +/*-------------------*/
3502 +/* Avalanche ATM SAR */
3503 +/*-------------------*/
3505 +#define AVSAR_SYSCONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000000)) /* SAR system config register */
3506 +#define AVSAR_SYSSTATUS (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000004)) /* SAR system status register */
3507 +#define AVSAR_INT_ENABLE (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000008)) /* SAR interrupt enable register */
3508 +#define AVSAR_CONN_VPI_VCI (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000000c)) /* VPI/VCI connection config */
3509 +#define AVSAR_CONN_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000010)) /* Connection config register */
3510 +#define AVSAR_OAM_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018)) /* OAM configuration register */
3512 +/* Transmit completion ring registers */
3514 +#define AVSAR_TCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000100))
3515 +#define AVSAR_TCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000104))
3516 +#define AVSAR_TCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000108))
3517 +#define AVSAR_TCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000010c))
3518 +#define AVSAR_TCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000110))
3519 +#define AVSAR_TCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000114))
3520 +#define AVSAR_TCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000118))
3521 +#define AVSAR_TCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000011c))
3522 +#define AVSAR_TCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000120))
3523 +#define AVSAR_TCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000124))
3524 +#define AVSAR_TCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000128))
3525 +#define AVSAR_TCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000012c))
3526 +#define AVSAR_TCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000130))
3527 +#define AVSAR_TCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000134))
3529 +/* Transmit Queue Packet registers */
3530 +#define AVSAR_TXQUEUE_PKT0 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000140))
3531 +#define AVSAR_TXQUEUE_PKT1 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000144))
3532 +#define AVSAR_TXQUEUE_PKT2 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000148))
3533 +#define AVSAR_TX_FLUSH (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000014C))
3534 +/* Receive completion ring registers */
3536 +#define AVSAR_RCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000200))
3537 +#define AVSAR_RCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000204))
3538 +#define AVSAR_RCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000208))
3539 +#define AVSAR_RCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000020c))
3540 +#define AVSAR_RCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000210))
3541 +#define AVSAR_RCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000214))
3542 +#define AVSAR_RCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000218))
3543 +#define AVSAR_RCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000021c))
3544 +#define AVSAR_RCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000220))
3545 +#define AVSAR_RCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000224))
3546 +#define AVSAR_RCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000228))
3547 +#define AVSAR_RCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000022c))
3548 +#define AVSAR_RCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000230))
3549 +#define AVSAR_RCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000234))
3551 +#define AVSAR_RXFBL_ADD0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000240)) /* Rx Free buffer list add 0 */
3552 +#define AVSAR_RXFBL_ADD1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000244)) /* Rx Free buffer list add 1 */
3553 +#define AVSAR_RXFBL_ADD2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000248)) /* Rx Free buffer list add 2 */
3554 +#define AVSAR_RXFBLSIZE_0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000028c)) /* Rx Free buffer list size 0 */
3555 +#define AVSAR_RXFBLSIZE_1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000029c)) /* Rx Free buffer list size 1 */
3556 +#define AVSAR_RXFBLSIZE_2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002ac)) /* Rx Free buffer list size 2 */
3557 +#define AVSAR_RXFBLSIZE_3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002bc)) /* Rx Free buffer list size 3 */
3560 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
3562 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010480))
3563 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010484))
3564 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010488))
3565 +#define AVSAR_OAM_CPID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E0))
3566 +#define AVSAR_OAM_LLID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F0))
3567 +#define AVSAR_OAM_CPID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E4))
3568 +#define AVSAR_OAM_LLID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F4))
3569 +#define AVSAR_OAM_CPID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E8))
3570 +#define AVSAR_OAM_LLID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F8))
3571 +#define AVSAR_OAM_CPID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104EC))
3572 +#define AVSAR_OAM_LLID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104FC))
3573 +#define AVSAR_OAM_CORR_TAG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010500))
3574 +#define AVSAR_OAM_FAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010520))
3575 +#define AVSAR_OAM_NEAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010540))
3576 +#define AVSAR_OAM_CONFIG_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018))
3577 +#define AVSAR_FAIRNESS_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104B8))
3578 +#define AVSAR_UBR_PCR_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010490))
3583 +#define OAM_CPID_ADD 0xa30104e0
3585 +#define OAM_LLID_ADD 0xa30104f0
3587 +#define OAM_LLID_VAL 0xffffffff
3589 +#define OAM_CORR_TAG 0xa3010500
3591 +#define OAM_FAR_COUNT_ADD 0xa3010520
3593 +#define OAM_NEAR_COUNT_ADD 0xa3010540
3595 +#define OAM_CONFIG_REG_ADD 0xa3000018
3599 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
3601 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012000))
3602 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012004))
3603 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012008))
3604 +#define AVSAR_OAM_CPID (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012300))
3606 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
3609 +#define AVSAR_STATE_RAM (ATM_SAR_BASE + 0x010000) /* SAR state RAM */
3610 +#define AVSAR_PDSP_BASE (ATM_SAR_BASE + 0x020000) /* SAR PDSP base address */
3611 +#define AVSAR_TXDMA_BASE (ATM_SAR_BASE + 0x030000) /* Transmit DMA state base */
3612 +#define AVSAR_TDMASTATE6 0x18 /* Transmit DMA state word 6 */
3613 +#define AVSAR_RXDMA_BASE (ATM_SAR_BASE + 0x040000) /* Receive DMA state base */
3614 +#define AVSAR_RDMASTATE0 0x0 /* Receive DMA state word 0 */
3616 +/*------------------------------------------*/
3617 +/* DSL Interface */
3618 +/*------------------------------------------*/
3620 +#define AVDSL_TX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000000))
3621 +#define AVDSL_RX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000004))
3622 +#define AVDSL_POLL (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000008))
3626 +#define AVDSL_TX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000000C))
3627 +#define AVDSL_TX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000010))
3628 +#define AVDSL_TX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000014))
3629 +#define AVDSL_TX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000018))
3630 +#define AVDSL_RX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000001C))
3631 +#define AVDSL_RX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000020))
3632 +#define AVDSL_RX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000024))
3633 +#define AVDSL_RX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000028))
3637 +#define AVDSL_TX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000002C))
3638 +#define AVDSL_TX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000030))
3639 +#define AVDSL_TX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000034))
3640 +#define AVDSL_TX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000038))
3641 +#define AVDSL_RX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000003C))
3642 +#define AVDSL_RX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000040))
3643 +#define AVDSL_RX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000044))
3644 +#define AVDSL_RX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000048))
3646 +/*------------------------------------------*/
3647 +/* Broadband I/F */
3648 +/*------------------------------------------*/
3650 +#define AVBBIF_BBIF_CNTRL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000000))
3651 +#define AVBBIF_ADDR_TRANS_0 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000004))
3652 +#define AVBBIF_ADDR_TRANS_1 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000008))
3653 +#define AVBBIF_ADDR_XB_MX_BL (*(volatile unsigned int *)(BBIF_CONTROL + 0x0000000C))
3654 +#define AVBBIF_INFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000010))
3655 +#define AVBBIF_OUTFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000014))
3657 +#define AVBBIF_DISABLED 0x0
3658 +#define AVBBIF_LBT4040_INT 0x1
3659 +#define AVBBIF_XBUS 0x2
3660 +#define AVBBIF_LBT4040_EXT 0x4
3662 +#define AVBBIF_ADDR_MASK0 0xff000000 /* handles upper bits of BBIF 0 address */
3663 +#define AVBBIF_ADDR_MASK1 0xff800000 /* handles upper bits of BBIF 1 address */
3664 +#define AVBBIF_TRANS_MASK 0xff000000
3665 +/*------------------------------------------*/
3667 +/*------------------------------------------*/
3669 +#define GPIO_DATA_INPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000000))
3670 +#define GPIO_DATA_OUTPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000004))
3671 +#define GPIO_DATA_DIR (*(volatile unsigned int *)(GPIO_BASE + 0x00000008)) /* 0=output 1=input */
3672 +#define GPIO_DATA_ENABLE (*(volatile unsigned int *)(GPIO_BASE + 0x0000000C)) /* 0=GPIO Mux 1=GPIO */
3674 +#define GPIO_0 (1<<21)
3675 +#define GPIO_1 (1<<22)
3676 +#define GPIO_2 (1<<23)
3677 +#define GPIO_3 (1<<24)
3678 +#define EINT_1 (1<<18)
3681 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
3682 + If you reset the GPIO interface all of the directions (i/o) of the UART B
3683 + interface pins are inputs and must be reconfigured so as not to lose the
3684 + serial console interface
3685 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
3688 +/*------------------------------------------*/
3690 +/*------------------------------------------*/
3691 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
3693 +#define PCLK_0_HALF_VBUS (0<<16)
3694 +#define PCLK_EQ_INPUT (1<<16)
3695 +#define BBIF_CLK_HALF_VBUS (0<<17)
3696 +#define BBIF_CLK_EQ_VBUS (1<<17)
3697 +#define BBIF_CLK_EQ_BBCLK (3<<17)
3698 +#define DSP_MODCLK_DSPCLKI (0<<20)
3699 +#define DSP_MODCLK_REFCLKI (1<<20)
3700 +#define USB_CLK_EQ_USBCLKI (0<<21)
3701 +#define USB_CLK_EQ_REFCLKI (1<<21)
3703 +/*------------------------------------------*/
3704 +/* PCI Control Registers */
3705 +/*------------------------------------------*/
3706 +#define PCIC_CONTROL (*(volatile unsigned int *)(PCI_CONFIG_BASE))
3707 +#define PCIC_CONTROL_CFG_DONE (1<<0)
3708 +#define PCIC_CONTROL_DIS_SLAVE_TO (1<<1)
3709 +#define PCIC_CONTROL_FORCE_DELAY_READ (1<<2)
3710 +#define PCIC_CONTROL_FORCE_DELAY_READ_LINE (1<<3)
3711 +#define PCIC_CONTROL_FORCE_DELAY_READ_MULT (1<<4)
3712 +#define PCIC_CONTROL_MEM_SPACE_EN (1<<5)
3713 +#define PCIC_CONTROL_MEM_MASK (1<<6)
3714 +#define PCIC_CONTROL_IO_SPACE_EN (1<<7)
3715 +#define PCIC_CONTROL_IO_MASK (1<<8)
3716 +/* PCIC_CONTROL_RESERVED (1<<9) */
3717 +#define PCIC_CONTROL_BASE0_EN (1<<10)
3718 +#define PCIC_CONTROL_BASE1_EN (1<<11)
3719 +#define PCIC_CONTROL_BASE2_EN (1<<12)
3720 +#define PCIC_CONTROL_HOLD_MASTER_WRITE (1<<13)
3721 +#define PCIC_CONTROL_ARBITER_EN (1<<14)
3722 +#define PCIC_INT_SOURCE (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000004))
3723 +#define PCIC_INT_SOURCE_PWR_MGMT (1<<0)
3724 +#define PCIC_INT_SOURCE_PCI_TARGET (1<<1)
3725 +#define PCIC_INT_SOURCE_PCI_MASTER (1<<2)
3726 +#define PCIC_INT_SOURCE_POWER_WAKEUP (1<<3)
3727 +#define PCIC_INT_SOURCE_PMEIN (1<<4)
3728 +/* PCIC_INT_SOURCE_RESERVED (1<<5) */
3729 +/* PCIC_INT_SOURCE_RESERVED (1<<6) */
3730 +#define PCIC_INT_SOURCE_PIC_INTA (1<<7)
3731 +#define PCIC_INT_SOURCE_PIC_INTB (1<<8)
3732 +#define PCIC_INT_SOURCE_PIC_INTC (1<<9)
3733 +#define PCIC_INT_SOURCE_PIC_INTD (1<<10)
3734 +#define PCIC_INT_SOURCE_SOFT_INT0 (1<<11)
3735 +#define PCIC_INT_SOURCE_SOFT_INT1 (1<<12)
3736 +#define PCIC_INT_SOURCE_SOFT_INT2 (1<<13)
3737 +#define PCIC_INT_SOURCE_SOFT_INT3 (1<<14)
3738 +#define PCIC_INT_CLEAR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000008))
3739 +#define PCIC_INT_CLEAR_PM (1<<0)
3740 +#define PCIC_INT_CLEAR_PCI_TARGET (1<<1)
3741 +#define PCIC_INT_CLEAR_PCI_MASTER (1<<2)
3742 +/* PCIC_INT_CLEAR_RESERVED (1<<3) */
3743 +#define PCIC_INT_CLEAR_PMEIN (1<<4)
3744 +/* PCIC_INT_CLEAR_RESERVED (1<<5) */
3745 +/* PCIC_INT_CLEAR_RESERVED (1<<6) */
3746 +#define PCIC_INT_CLEAR_PCI_INTA (1<<7)
3747 +#define PCIC_INT_CLEAR_PCI_INTB (1<<8)
3748 +#define PCIC_INT_CLEAR_PCI_INTC (1<<9)
3749 +#define PCIC_INT_CLEAR_PCI_INTD (1<<10)
3750 +#define PCIC_INT_CLEAR_SOFT_INT0 (1<<11)
3751 +#define PCIC_INT_CLEAR_SOFT_INT1 (1<<12)
3752 +#define PCIC_INT_CLEAR_SOFT_INT2 (1<<13)
3753 +#define PCIC_INT_CLEAR_SOFT_INT3 (1<<14)
3754 +#define PCIC_INT_EN_AVAL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000000c))
3755 +#define PCIC_INT_EN_AVAL_PM (1<<0)
3756 +#define PCIC_INT_EN_AVAL_PCI_TARGET (1<<1)
3757 +#define PCIC_INT_EN_AVAL_PCI_MASTER (1<<2)
3758 +/* PCIC_INT_EN_AVAL_RESERVED (1<<3) */
3759 +#define PCIC_INT_EN_AVAL_PMEIN (1<<4)
3760 +/* PCIC_INT_EN_AVAL_RESERVED (1<<5) */
3761 +/* PCIC_INT_EN_AVAL_RESERVED (1<<6) */
3762 +#define PCIC_INT_EN_AVAL_PCI_INTA (1<<7)
3763 +#define PCIC_INT_EN_AVAL_PCI_INTB (1<<8)
3764 +#define PCIC_INT_EN_AVAL_PCI_INTC (1<<9)
3765 +#define PCIC_INT_EN_AVAL_PCI_INTD (1<<10)
3766 +#define PCIC_INT_EN_AVAL_SOFT_INT0 (1<<11)
3767 +#define PCIC_INT_EN_AVAL_SOFT_INT1 (1<<12)
3768 +#define PCIC_INT_EN_AVAL_SOFT_INT2 (1<<13)
3769 +#define PCIC_INT_EN_AVAL_SOFT_INT3 (1<<14)
3770 +#define PCIC_INT_EN_PCI (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000010))
3771 +#define PCIC_INT_EN_PCI_PM (1<<0)
3772 +#define PCIC_INT_EN_PCI_PCI_TARGET (1<<1)
3773 +#define PCIC_INT_EN_PCI_PCI_MASTER (1<<2)
3774 +/* PCIC_INT_EN_PCI_RESERVED (1<<3) */
3775 +#define PCIC_INT_EN_PCI_PMEIN (1<<4)
3776 +/* PCIC_INT_EN_PCI_RESERVED (1<<5) */
3777 +/* PCIC_INT_EN_PCI_RESERVED (1<<6) */
3778 +#define PCIC_INT_EN_PCI_PCI_INTA (1<<7)
3779 +#define PCIC_INT_EN_PCI_PCI_INTB (1<<8)
3780 +#define PCIC_INT_EN_PCI_PCI_INTC (1<<9)
3781 +#define PCIC_INT_EN_PCI_PCI_INTD (1<<10)
3782 +#define PCIC_INT_EN_PCI_SOFT_INT0 (1<<11)
3783 +#define PCIC_INT_EN_PCI_SOFT_INT1 (1<<12)
3784 +#define PCIC_INT_EN_PCI_SOFT_INT2 (1<<13)
3785 +#define PCIC_INT_EN_PCI_SOFT_INT3 (1<<14)
3786 +#define PCIC_INT_SWSET (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000014))
3787 +#define PCIC_INT_SWSET_SOFT_INT0 (1<<0)
3788 +#define PCIC_INT_SWSET_SOFT_INT1 (1<<1)
3789 +#define PCIC_INT_SWSET_SOFT_INT2 (1<<2)
3790 +#define PCIC_INT_SWSET_SOFT_INT3 (1<<3)
3791 +#define PCIC_PM_CTL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000018))
3792 +#define PCIC_PM_CTL_PWR_STATE_MASK (0x02)
3793 +/* PCIC_PM_CTL_RESERVED (1<<2) */
3794 +/* PCIC_PM_CTL_RESERVED (1<<3) */
3795 +/* PCIC_PM_CTL_RESERVED (1<<4) */
3796 +/* PCIC_PM_CTL_RESERVED (1<<5) */
3797 +/* PCIC_PM_CTL_RESERVED (1<<6) */
3798 +/* PCIC_PM_CTL_RESERVED (1<<7) */
3799 +/* PCIC_PM_CTL_RESERVED (1<<8) */
3800 +/* PCIC_PM_CTL_RESERVED (1<<9) */
3801 +#define PCIC_PM_CTL_PWR_SUPPORT (1<<10)
3802 +#define PCIC_PM_CTL_PMEIN (1<<11)
3803 +#define PCIC_PM_CTL_CAP_MASK (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x0000001a))
3804 +#define PCIC_PM_CONSUME (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000001c))
3805 +#define PCIC_PM_CONSUME_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001c))
3806 +#define PCIC_PM_CONSUME_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001d))
3807 +#define PCIC_PM_CONSUME_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001e))
3808 +#define PCIC_PM_CONSUME_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001f))
3809 +#define PCIC_PM_DISSAPATED (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000020))
3810 +#define PCIC_PM_DISSAPATED_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000020))
3811 +#define PCIC_PM_DISSAPATED_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000021))
3812 +#define PCIC_PM_DISSAPATED_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000022))
3813 +#define PCIC_PM_DISSAPATED_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000023))
3814 +#define PCIC_PM_DATA_SCALE (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x00000024))
3815 +#define PCIC_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000028))
3816 +#define PCIC_SUB_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000002c))
3817 +#define PCIC_CLASS_REV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000030))
3818 +#define PCIC_MAX_MIN (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000034))
3819 +#define PCIC_MAST_MEM_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000003c))
3820 +#define PCIC_MAST_MEM_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000040))
3821 +#define PCIC_MAST_MEM_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000044))
3822 +#define PCIC_SLAVE_MASK0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000004c))
3823 +#define PCIC_SLAVE_MASK1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000050))
3824 +#define PCIC_SLAVE_MASK2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000054))
3825 +#define PCIC_SLAVE_BASE_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000058))
3826 +#define PCIC_SLAVE_BASE_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000005c))
3827 +#define PCIC_SLAVE_BASE_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000060))
3828 +#define PCIC_CONF_COMMAND (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000090))
3829 +#define PCIC_CONF_ADDR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000094))
3830 +#define PCIC_CONF_DATA (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000098))
3832 +/*------------------------------------------*/
3833 +/* IIC_INTERFACE */
3834 +/*------------------------------------------*/
3835 +#define I2C_DATA_HI (*(volatile unsigned int *)(I2C_BASE + 0x0))
3836 +#define I2C_DATA_LOW (*(volatile unsigned int *)(I2C_BASE + 0x4))
3837 +#define I2C_CONFIG (*(volatile unsigned int *)(I2C_BASE + 0x8))
3838 +#define I2C_DATA_READ (*(volatile unsigned int *)(I2C_BASE + 0xC))
3839 +#define I2C_CLOCK_DIV (*(volatile unsigned int *)(I2C_BASE + 0x10))
3841 +#define I2CWRITE 0x200
3842 +#define I2CREAD 0x300
3843 +#define I2C_END_BURST 0x400
3846 +#define I2C_READ_ERROR 0x8000
3847 +#define I2C_READ_COMPLETE 0x4000
3848 +#define I2C_READ_BUSY 0x2000
3851 +#define I2C_IO_EXPANDER 0x2
3852 +#define I2C_RTC 0xd
3854 +/* device Addresses on I2C bus (EVM3) */
3855 +#define SEVEN_SEGMENT_DISP 0x23 /* Device type = 0x2, Addr = 3 */
3856 +#define EVM3_RTC 0xd0 /* Device type = 0xd, Addr = 0 */
3857 +#define EVM3_RTC_I2C_ADDR 0x0
3859 +/*------------------------------------------*/
3860 +/* Ethernet MAC register offset definitions */
3861 +/*------------------------------------------*/
3862 +#define VMAC_DMACONFIG(X) (*(volatile unsigned int *)(X + 0x00000000))
3863 +#define VMAC_INTSTS(X) (*(volatile unsigned int *)(X + 0x00000004))
3864 +#define VMAC_INTMASK(X) (*(volatile unsigned int *)(X + 0x00000008))
3866 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
3867 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
3869 +#define VMAC_TCRPTR(X) (*(volatile unsigned int *)(X + 0x00000100))
3870 +#define VMAC_TCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000104))
3871 +#define VMAC_TCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000108))
3872 +#define VMAC_TCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000010C))
3873 +#define VMAC_TCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000110))
3874 +#define VMAC_TCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000114))
3875 +#define VMAC_TCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000118))
3876 +#define VMAC_TXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000011c))
3879 +#define VMAC_TDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000120))
3880 +#define VMAC_TDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000124))
3881 +#define VMAC_TDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000128))
3882 +#define VMAC_TDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000012C))
3883 +#define VMAC_TDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000130))
3884 +#define VMAC_TDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000134))
3885 +#define VMAC_TDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000138))
3886 +#define VMAC_TDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000013C))
3887 +#define VMAC_TXPADDCNT(X) (*(volatile unsigned int *)(X + 0x00000140))
3888 +#define VMAC_TXPADDSTART(X) (*(volatile unsigned int *)(X + 0x00000144))
3889 +#define VMAC_TXPADDEND(X) (*(volatile unsigned int *)(X + 0x00000148))
3890 +#define VMAC_TXQFLUSH(X) (*(volatile unsigned int *)(X + 0x0000014C))
3892 +#define VMAC_RCRPTR(X) (*(volatile unsigned int *)(X + 0x00000200))
3893 +#define VMAC_RCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000204))
3894 +#define VMAC_RCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000208))
3895 +#define VMAC_RCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000020C))
3896 +#define VMAC_RCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000210))
3897 +#define VMAC_RCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000214))
3898 +#define VMAC_RCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000218))
3899 +#define VMAC_RXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000021c))
3901 +#define VMAC_RDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000220))
3902 +#define VMAC_RDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000224))
3903 +#define VMAC_RDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000228))
3904 +#define VMAC_RDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000022C))
3905 +#define VMAC_RDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000230))
3906 +#define VMAC_RDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000234))
3907 +#define VMAC_RDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000238))
3908 +#define VMAC_RDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000023C))
3909 +#define VMAC_FBLADDCNT(X) (*(volatile unsigned int *)(X + 0x00000240))
3910 +#define VMAC_FBLADDSTART(X) (*(volatile unsigned int *)(X + 0x00000244))
3911 +#define VMAC_FBLADDEND(X) (*(volatile unsigned int *)(X + 0x00000248))
3912 +#define VMAC_RXONOFF(X) (*(volatile unsigned int *)(X + 0x0000024C))
3914 +#define VMAC_FBL0NEXTD(X) (*(volatile unsigned int *)(X + 0x00000280))
3915 +#define VMAC_FBL0LASTD(X) (*(volatile unsigned int *)(X + 0x00000284))
3916 +#define VMAC_FBL0COUNTD(X) (*(volatile unsigned int *)(X + 0x00000288))
3917 +#define VMAC_FBL0BUFSIZE(X) (*(volatile unsigned int *)(X + 0x0000028C))
3919 +#define VMAC_MACCONTROL(X) (*(volatile unsigned int *)(X + 0x00000300))
3920 +#define VMAC_MACSTATUS(X) (*(volatile unsigned int *)(X + 0x00000304))
3921 +#define VMAC_MACADDRHI(X) (*(volatile unsigned int *)(X + 0x00000308))
3922 +#define VMAC_MACADDRLO(X) (*(volatile unsigned int *)(X + 0x0000030C))
3923 +#define VMAC_MACHASH1(X) (*(volatile unsigned int *)(X + 0x00000310))
3924 +#define VMAC_MACHASH2(X) (*(volatile unsigned int *)(X + 0x00000314))
3926 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
3927 +#define VMAC_BOFTEST(X) (*(volatile unsigned int *)(X + 0x00000344))
3928 +#define VMAC_PACTEST(X) (*(volatile unsigned int *)(X + 0x00000348))
3929 +#define VMAC_PAUSEOP(X) (*(volatile unsigned int *)(X + 0x0000034C))
3931 +#define VMAC_MDIOCONTROL(X) (*(volatile unsigned int *)(X + 0x00000380))
3932 +#define VMAC_MDIOUSERACCESS(X) (*(volatile unsigned int *)(X +0x00000384))
3933 +#define VMAC_MDIOACK(X) (*(volatile unsigned int *)(X + 0x00000388))
3934 +#define VMAC_MDIOLINK(X) (*(volatile unsigned int *)(X + 0x0000038C))
3935 +#define VMAC_MDIOMACPHY(X) (*(volatile unsigned int *)(X + 0x00000390))
3937 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
3939 +#endif __AVALANCHE_REGS_H
3946 diff -urN kernel-base/include/asm-mips/ar7/if_port.h kernel-current/include/asm-mips/ar7/if_port.h
3947 --- kernel-base/include/asm-mips/ar7/if_port.h 1970-01-01 01:00:00.000000000 +0100
3948 +++ kernel-current/include/asm-mips/ar7/if_port.h 2005-07-10 06:40:39.623260000 +0200
3950 +/*******************************************************************************
3951 + * FILE PURPOSE: Interface port id Header file
3952 + *******************************************************************************
3953 + * FILE NAME: if_port.h
3955 + * DESCRIPTION: Header file carrying information about port ids of interfaces
3958 + * (C) Copyright 2003, Texas Instruments, Inc
3959 + ******************************************************************************/
3960 +#ifndef _IF_PORT_H_
3961 +#define _IF_PORT_H_
3963 +#define AVALANCHE_CPMAC_LOW_PORT_ID 0
3964 +#define AVALANCHE_CPMAC_HIGH_PORT_ID 1
3965 +#define AVALANCHE_USB_PORT_ID 2
3966 +#define AVALANCHE_WLAN_PORT_ID 3
3969 +#define AVALANCHE_MARVELL_BASE_PORT_ID 4
3971 +/* The marvell ports occupy port ids from 4 to 8 */
3972 +/* so the next port id number should start at 9 */
3975 +#endif /* _IF_PORT_H_ */
3976 diff -urN kernel-base/include/asm-mips/ar7/sangam_boards.h kernel-current/include/asm-mips/ar7/sangam_boards.h
3977 --- kernel-base/include/asm-mips/ar7/sangam_boards.h 1970-01-01 01:00:00.000000000 +0100
3978 +++ kernel-current/include/asm-mips/ar7/sangam_boards.h 2005-07-10 06:40:39.623260000 +0200
3980 +#ifndef _SANGAM_BOARDS_H
3981 +#define _SANGAM_BOARDS_H
3983 +// Let us define board specific information here.
3986 +#if defined(CONFIG_AR7DB)
3988 +#define AFECLK_FREQ 35328000
3989 +#define REFCLK_FREQ 25000000
3990 +#define OSC3_FREQ 24000000
3991 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
3992 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
3993 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
3998 +#if defined(CONFIG_AR7RD)
3999 +#define AFECLK_FREQ 35328000
4000 +#define REFCLK_FREQ 25000000
4001 +#define OSC3_FREQ 24000000
4002 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4003 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
4004 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4008 +#if defined(CONFIG_AR7WI)
4009 +#define AFECLK_FREQ 35328000
4010 +#define REFCLK_FREQ 25000000
4011 +#define OSC3_FREQ 24000000
4012 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4013 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
4014 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4018 +#if defined(CONFIG_AR7V)
4019 +#define AFECLK_FREQ 35328000
4020 +#define REFCLK_FREQ 25000000
4021 +#define OSC3_FREQ 24000000
4022 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4023 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
4024 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4028 +#if defined(CONFIG_AR7WRD)
4029 +#define AFECLK_FREQ 35328000
4030 +#define REFCLK_FREQ 25000000
4031 +#define OSC3_FREQ 24000000
4032 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4033 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
4034 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4038 +#if defined(CONFIG_AR7VWI)
4039 +#define AFECLK_FREQ 35328000
4040 +#define REFCLK_FREQ 25000000
4041 +#define OSC3_FREQ 24000000
4042 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4043 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
4044 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4048 +#if defined CONFIG_SEAD2
4049 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0xAAAAAAAA
4050 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
4051 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0
4052 +#include <asm/mips-boards/sead.h>
4057 diff -urN kernel-base/include/asm-mips/ar7/sangam.h kernel-current/include/asm-mips/ar7/sangam.h
4058 --- kernel-base/include/asm-mips/ar7/sangam.h 1970-01-01 01:00:00.000000000 +0100
4059 +++ kernel-current/include/asm-mips/ar7/sangam.h 2005-07-10 06:40:39.624260000 +0200
4064 +#include <linux/config.h>
4065 +#include <asm/addrspace.h>
4067 +/*----------------------------------------------------
4068 + * Sangam's Module Base Addresses
4069 + *--------------------------------------------------*/
4070 +#define AVALANCHE_ADSL_SUB_SYS_MEM_BASE (KSEG1ADDR(0x01000000)) /* AVALANCHE ADSL Mem Base */
4071 +#define AVALANCHE_BROADBAND_INTERFACE__BASE (KSEG1ADDR(0x02000000)) /* AVALANCHE BBIF */
4072 +#define AVALANCHE_ATM_SAR_BASE (KSEG1ADDR(0x03000000)) /* AVALANCHE ATM SAR */
4073 +#define AVALANCHE_USB_SLAVE_BASE (KSEG1ADDR(0x03400000)) /* AVALANCHE USB SLAVE */
4074 +#define AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x04000000)) /* AVALANCHE VLYNQ 0 Mem map */
4075 +#define AVALANCHE_LOW_CPMAC_BASE (KSEG1ADDR(0x08610000)) /* AVALANCHE CPMAC 0 */
4076 +#define AVALANCHE_EMIF_CONTROL_BASE (KSEG1ADDR(0x08610800)) /* AVALANCHE EMIF */
4077 +#define AVALANCHE_GPIO_BASE (KSEG1ADDR(0x08610900)) /* AVALANCHE GPIO */
4078 +#define AVALANCHE_CLOCK_CONTROL_BASE (KSEG1ADDR(0x08610A00)) /* AVALANCHE Clock Control */
4079 +#define AVALANCHE_WATCHDOG_TIMER_BASE (KSEG1ADDR(0x08610B00)) /* AVALANCHE Watch Dog Timer */
4080 +#define AVALANCHE_TIMER0_BASE (KSEG1ADDR(0x08610C00)) /* AVALANCHE Timer 1 */
4081 +#define AVALANCHE_TIMER1_BASE (KSEG1ADDR(0x08610D00)) /* AVALANCHE Timer 2 */
4082 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
4083 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 0 */
4084 +#define AVALANCHE_I2C_BASE (KSEG1ADDR(0x08611000)) /* AVALANCHE I2C */
4085 +#define AVALANCHE_USB_SLAVE_CONTROL_BASE (KSEG1ADDR(0x08611200)) /* AVALANCHE USB DMA */
4086 +#define AVALANCHE_MCDMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* AVALANCHE MC DMA 0 (channels 0-3) */
4087 +#define AVALANCHE_RESET_CONTROL_BASE (KSEG1ADDR(0x08611600)) /* AVALANCHE Reset Control */
4088 +#define AVALANCHE_BIST_CONTROL_BASE (KSEG1ADDR(0x08611700)) /* AVALANCHE BIST Control */
4089 +#define AVALANCHE_LOW_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611800)) /* AVALANCHE VLYNQ0 Control */
4090 +#define AVALANCHE_DEVICE_CONFIG_LATCH_BASE (KSEG1ADDR(0x08611A00)) /* AVALANCHE Device Config Latch */
4091 +#define AVALANCHE_HIGH_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611C00)) /* AVALANCHE VLYNQ1 Control */
4092 +#define AVALANCHE_MDIO_BASE (KSEG1ADDR(0x08611E00)) /* AVALANCHE MDIO */
4093 +#define AVALANCHE_FSER_BASE (KSEG1ADDR(0x08612000)) /* AVALANCHE FSER base */
4094 +#define AVALANCHE_INTC_BASE (KSEG1ADDR(0x08612400)) /* AVALANCHE INTC */
4095 +#define AVALANCHE_HIGH_CPMAC_BASE (KSEG1ADDR(0x08612800)) /* AVALANCHE CPMAC 1 */
4096 +#define AVALANCHE_HIGH_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x0C000000)) /* AVALANCHE VLYNQ 1 Mem map */
4098 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
4101 +/*----------------------------------------------------
4102 + * Sangam Interrupt Map (Primary Interrupts)
4103 + *--------------------------------------------------*/
4105 +#define AVALANCHE_UNIFIED_SECONDARY_INT 0
4106 +#define AVALANCHE_EXT_INT_0 1
4107 +#define AVALANCHE_EXT_INT_1 2
4108 +/* Line# 3 to 4 are reserved */
4109 +#define AVALANCHE_TIMER_0_INT 5
4110 +#define AVALANCHE_TIMER_1_INT 6
4111 +#define AVALANCHE_UART0_INT 7
4112 +#define AVALANCHE_UART1_INT 8
4113 +#define AVALANCHE_DMA_INT0 9
4114 +#define AVALANCHE_DMA_INT1 10
4115 +/* Line# 11 to 14 are reserved */
4116 +#define AVALANCHE_ATM_SAR_INT 15
4117 +/* Line# 16 to 18 are reserved */
4118 +#define AVALANCHE_LOW_CPMAC_INT 19
4119 +/* Line# 20 is reserved */
4120 +#define AVALANCHE_LOW_VLYNQ_INT 21
4121 +#define AVALANCHE_CODEC_WAKEUP_INT 22
4122 +/* Line# 23 is reserved */
4123 +#define AVALANCHE_USB_SLAVE_INT 24
4124 +#define AVALANCHE_HIGH_VLYNQ_INT 25
4125 +/* Line# 26 to 27 are reserved */
4126 +#define AVALANCHE_UNIFIED_PHY_INT 28
4127 +#define AVALANCHE_I2C_INT 29
4128 +#define AVALANCHE_DMA_INT2 30
4129 +#define AVALANCHE_DMA_INT3 31
4130 +/* Line# 32 is reserved */
4131 +#define AVALANCHE_HIGH_CPMAC_INT 33
4132 +/* Line# 34 to 36 is reserved */
4133 +#define AVALANCHE_VDMA_VT_RX_INT 37
4134 +#define AVALANCHE_VDMA_VT_TX_INT 38
4135 +#define AVALANCHE_ADSL_SUB_SYSTEM_INT 39
4138 +#define AVALANCHE_EMIF_INT 47
4142 +/*-----------------------------------------------------------
4143 + * Sangam's Reset Bits
4144 + *---------------------------------------------------------*/
4146 +#define AVALANCHE_UART0_RESET_BIT 0
4147 +#define AVALANCHE_UART1_RESET_BIT 1
4148 +#define AVALANCHE_I2C_RESET_BIT 2
4149 +#define AVALANCHE_TIMER0_RESET_BIT 3
4150 +#define AVALANCHE_TIMER1_RESET_BIT 4
4151 +/* Reset bit 5 is reserved. */
4152 +#define AVALANCHE_GPIO_RESET_BIT 6
4153 +#define AVALANCHE_ADSL_SUB_SYS_RESET_BIT 7
4154 +#define AVALANCHE_USB_SLAVE_RESET_BIT 8
4155 +#define AVALANCHE_ATM_SAR_RESET_BIT 9
4156 +/* Reset bit 10 is reserved. */
4157 +#define AVALANCHE_VDMA_VT_RESET_BIT 11
4158 +#define AVALANCHE_FSER_RESET_BIT 12
4159 +/* Reset bit 13 to 15 are reserved */
4160 +#define AVALANCHE_HIGH_VLYNQ_RESET_BIT 16
4161 +#define AVALANCHE_LOW_CPMAC_RESET_BIT 17
4162 +#define AVALANCHE_MCDMA_RESET_BIT 18
4163 +#define AVALANCHE_BIST_RESET_BIT 19
4164 +#define AVALANCHE_LOW_VLYNQ_RESET_BIT 20
4165 +#define AVALANCHE_HIGH_CPMAC_RESET_BIT 21
4166 +#define AVALANCHE_MDIO_RESET_BIT 22
4167 +#define AVALANCHE_ADSL_SUB_SYS_DSP_RESET_BIT 23
4168 +/* Reset bit 24 to 25 are reserved */
4169 +#define AVALANCHE_LOW_EPHY_RESET_BIT 26
4170 +/* Reset bit 27 to 31 are reserved */
4173 +#define AVALANCHE_POWER_MODULE_USBSP 0
4174 +#define AVALANCHE_POWER_MODULE_WDTP 1
4175 +#define AVALANCHE_POWER_MODULE_UT0P 2
4176 +#define AVALANCHE_POWER_MODULE_UT1P 3
4177 +#define AVALANCHE_POWER_MODULE_IICP 4
4178 +#define AVALANCHE_POWER_MODULE_VDMAP 5
4179 +#define AVALANCHE_POWER_MODULE_GPIOP 6
4180 +#define AVALANCHE_POWER_MODULE_VLYNQ1P 7
4181 +#define AVALANCHE_POWER_MODULE_SARP 8
4182 +#define AVALANCHE_POWER_MODULE_ADSLP 9
4183 +#define AVALANCHE_POWER_MODULE_EMIFP 10
4184 +#define AVALANCHE_POWER_MODULE_ADSPP 12
4185 +#define AVALANCHE_POWER_MODULE_RAMP 13
4186 +#define AVALANCHE_POWER_MODULE_ROMP 14
4187 +#define AVALANCHE_POWER_MODULE_DMAP 15
4188 +#define AVALANCHE_POWER_MODULE_BISTP 16
4189 +#define AVALANCHE_POWER_MODULE_TIMER0P 18
4190 +#define AVALANCHE_POWER_MODULE_TIMER1P 19
4191 +#define AVALANCHE_POWER_MODULE_EMAC0P 20
4192 +#define AVALANCHE_POWER_MODULE_EMAC1P 22
4193 +#define AVALANCHE_POWER_MODULE_EPHYP 24
4194 +#define AVALANCHE_POWER_MODULE_VLYNQ0P 27
4201 + * Sangam board vectors
4204 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
4205 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
4207 +/*-----------------------------------------------------------------------------
4208 + * Sangam's system register.
4210 + *---------------------------------------------------------------------------*/
4211 +#define AVALANCHE_DCL_BOOTCR (KSEG1ADDR(0x08611A00))
4212 +#define AVALANCHE_EMIF_SDRAM_CFG (AVALANCHE_EMIF_CONTROL_BASE + 0x8)
4213 +#define AVALANCHE_RST_CTRL_PRCR (KSEG1ADDR(0x08611600))
4214 +#define AVALANCHE_RST_CTRL_SWRCR (KSEG1ADDR(0x08611604))
4215 +#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611600))
4217 +#define AVALANCHE_POWER_CTRL_PDCR (KSEG1ADDR(0x08610A00))
4218 +#define AVALANCHE_WAKEUP_CTRL_WKCR (KSEG1ADDR(0x08610A0C))
4220 +#define AVALANCHE_GPIO_DATA_IN (AVALANCHE_GPIO_BASE + 0x0)
4221 +#define AVALANCHE_GPIO_DATA_OUT (AVALANCHE_GPIO_BASE + 0x4)
4222 +#define AVALANCHE_GPIO_DIR (AVALANCHE_GPIO_BASE + 0x8)
4223 +#define AVALANCHE_GPIO_ENBL (AVALANCHE_GPIO_BASE + 0xC)
4224 +#define AVALANCHE_CVR (AVALANCHE_GPIO_BASE + 0x14)
4227 + * Yamon Prom print address.
4229 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
4230 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
4231 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
4233 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
4235 +#define AVALANCHE_GPIO_PIN_COUNT 32
4236 +#define AVALANCHE_GPIO_OFF_MAP {0xF34FFFC0}
4238 +#include "sangam_boards.h"
4240 +#endif /*_SANGAM_H_ */
4241 diff -urN kernel-base/include/asm-mips/io.h kernel-current/include/asm-mips/io.h
4242 --- kernel-base/include/asm-mips/io.h 2005-07-10 03:00:44.797179400 +0200
4243 +++ kernel-current/include/asm-mips/io.h 2005-07-10 06:40:39.624260000 +0200
4245 #ifdef CONFIG_64BIT_PHYS_ADDR
4246 #define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
4248 +#ifdef CONFIG_AR7_PAGING
4249 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + CONFIG_AR7_MEMORY)
4251 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
4255 #define IO_SPACE_LIMIT 0xffff
4257 diff -urN kernel-base/include/asm-mips/irq.h kernel-current/include/asm-mips/irq.h
4258 --- kernel-base/include/asm-mips/irq.h 2005-07-10 03:00:44.798179248 +0200
4259 +++ kernel-current/include/asm-mips/irq.h 2005-07-10 06:40:39.624260000 +0200
4261 #include <linux/config.h>
4262 #include <linux/linkage.h>
4265 +#include <asm/ar7/avalanche_intc.h>
4266 +#define NR_IRQS AVALANCHE_INT_END + 1
4268 #define NR_IRQS 128 /* Largest number of ints of all machines. */
4272 static inline int irq_cannonicalize(int irq)
4273 diff -urN kernel-base/include/asm-mips/page.h kernel-current/include/asm-mips/page.h
4274 --- kernel-base/include/asm-mips/page.h 2005-07-10 03:00:44.798179248 +0200
4275 +++ kernel-current/include/asm-mips/page.h 2005-07-10 06:40:39.625260000 +0200
4276 @@ -129,7 +129,11 @@
4278 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
4279 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
4280 +#ifdef CONFIG_AR7_PAGING
4281 +#define virt_to_page(kaddr) phys_to_page(__pa(kaddr))
4283 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
4285 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
4287 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
4288 diff -urN kernel-base/include/asm-mips/pgtable-32.h kernel-current/include/asm-mips/pgtable-32.h
4289 --- kernel-base/include/asm-mips/pgtable-32.h 2005-07-10 03:00:44.798179248 +0200
4290 +++ kernel-current/include/asm-mips/pgtable-32.h 2005-07-10 06:40:39.625260000 +0200
4291 @@ -108,7 +108,18 @@
4292 * and a page entry and page directory to the page they refer to.
4295 -#ifdef CONFIG_CPU_VR41XX
4296 +#if defined(CONFIG_AR7_PAGING)
4297 +#define mk_pte(page, pgprot) \
4301 + pte_val(__pte) = ((phys_t)(page - mem_map) << (PAGE_SHIFT) | \
4302 + CONFIG_AR7_MEMORY) | \
4303 + pgprot_val(pgprot); \
4307 +#elif defined(CONFIG_CPU_VR41XX)
4308 #define mk_pte(page, pgprot) \
4316 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
4318 #ifdef CONFIG_CPU_VR41XX
4319 @@ -175,7 +187,10 @@
4320 set_pte(ptep, __pte(0));
4323 -#ifdef CONFIG_CPU_VR41XX
4324 +#if defined(CONFIG_AR7_PAGING)
4325 +#define phys_to_page(phys) (mem_map + (((phys)-CONFIG_AR7_MEMORY) >> PAGE_SHIFT))
4326 +#define pte_page(x) phys_to_page(pte_val(x))
4327 +#elif defined(CONFIG_CPU_VR41XX)
4328 #define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> (PAGE_SHIFT+2)))))
4329 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << (PAGE_SHIFT+2)) | pgprot_val(pgprot))
4331 diff -urN kernel-base/include/asm-mips/serial.h kernel-current/include/asm-mips/serial.h
4332 --- kernel-base/include/asm-mips/serial.h 2005-07-10 03:00:44.799179096 +0200
4333 +++ kernel-current/include/asm-mips/serial.h 2005-07-10 06:40:39.625260000 +0200
4336 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
4339 +#include <asm/ar7/ar7.h>
4340 +#define AR7_SERIAL_PORT_DEFNS \
4341 + { 0, AR7_BASE_BAUD, AR7_UART0_REGS_BASE, LNXINTNUM(AVALANCHE_UART0_INT), STD_COM_FLAGS }, \
4342 + { 0, AR7_BASE_BAUD, AR7_UART1_REGS_BASE, LNXINTNUM(AVALANCHE_UART1_INT), STD_COM_FLAGS },
4344 +#define AR7_SERIAL_PORT_DEFNS
4347 #ifdef CONFIG_MIPS_JAZZ
4348 #define _JAZZ_SERIAL_INIT(int, base) \
4349 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
4353 #define SERIAL_PORT_DFNS \
4354 + AR7_SERIAL_PORT_DEFNS \
4355 ATLAS_SERIAL_PORT_DEFNS \
4356 AU1000_SERIAL_PORT_DEFNS \
4357 COBALT_SERIAL_PORT_DEFNS \
4358 diff -urN kernel-base/Makefile kernel-current/Makefile
4359 --- kernel-base/Makefile 2005-07-10 03:00:44.799179096 +0200
4360 +++ kernel-current/Makefile 2005-07-10 06:40:39.626260000 +0200
4363 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
4365 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
4366 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
4367 -fno-strict-aliasing -fno-common
4368 ifndef CONFIG_FRAME_POINTER
4369 CFLAGS += -fomit-frame-pointer