1 diff -urN linux.old/Makefile linux.dev/Makefile
2 --- linux.old/Makefile 2005-07-26 18:18:16.286577600 +0200
3 +++ linux.dev/Makefile 2005-07-26 18:11:03.247409000 +0200
6 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
8 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
9 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
10 -fno-strict-aliasing -fno-common
11 ifndef CONFIG_FRAME_POINTER
12 CFLAGS += -fomit-frame-pointer
13 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
14 --- linux.old/arch/mips/Makefile 2005-07-26 18:18:16.268580336 +0200
15 +++ linux.dev/arch/mips/Makefile 2005-07-26 18:11:03.268406000 +0200
20 +# Texas Instruments AR7
24 +LIBS += arch/mips/ar7/ar7.o arch/mips/ar7/ar7/ar7.o
25 +SUBDIRS += arch/mips/ar7 arch/mips/ar7/ar7
26 +LOADADDR += 0x94020000
32 ifdef CONFIG_DECSTATION
33 diff -urN linux.old/arch/mips/ar7/Makefile linux.dev/arch/mips/ar7/Makefile
34 --- linux.old/arch/mips/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
35 +++ linux.dev/arch/mips/ar7/Makefile 2005-07-26 18:11:02.626503000 +0200
38 + $(CPP) $(AFLAGS) $< -o $*.s
41 + $(CC) $(AFLAGS) -c $< -o $*.o
43 +EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7 -DLITTLE_ENDIAN -D_LINK_KSEG0_
46 +obj-y := tnetd73xx_misc.o
47 +obj-y += setup.o irq.o mipsIRQ.o reset.o init.o memory.o printf.o cmdline.o time.o
49 +include $(TOPDIR)/Rules.make
50 diff -urN linux.old/arch/mips/ar7/ar7/Makefile linux.dev/arch/mips/ar7/ar7/Makefile
51 --- linux.old/arch/mips/ar7/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
52 +++ linux.dev/arch/mips/ar7/ar7/Makefile 2005-07-26 18:11:02.621504000 +0200
55 +# Copyright (C) $Date$ $Author$
57 +# This program is free software; you can redistribute it and/or modify
58 +# it under the terms of the GNU General Public License as published by
59 +# the Free Software Foundation; either version 2 of the License, or
60 +# (at your option) any later version.
62 +# This program is distributed in the hope that it will be useful,
63 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
64 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65 +# GNU General Public License for more details.
67 +# You should have received a copy of the GNU General Public License
68 +# along with this program; if not, write to the Free Software
69 +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
72 + $(CPP) $(AFLAGS) $< -o $*.s
75 + $(CC) $(AFLAGS) -c $< -o $*.o
77 +EXTRA_CFLAGS := -DLITTLE_ENDIAN -D_LINK_KSEG0_
81 +export-objs := misc.o
82 +obj-y += paging.o jump.o misc.o
84 +include $(TOPDIR)/Rules.make
85 diff -urN linux.old/arch/mips/ar7/ar7/jump.S linux.dev/arch/mips/ar7/ar7/jump.S
86 --- linux.old/arch/mips/ar7/ar7/jump.S 1970-01-01 01:00:00.000000000 +0100
87 +++ linux.dev/arch/mips/ar7/ar7/jump.S 2005-07-26 18:11:02.621504000 +0200
91 + * Copyright (C) $Date$ $Author$
93 + * This program is free software; you can redistribute it and/or modify
94 + * it under the terms of the GNU General Public License as published by
95 + * the Free Software Foundation; either version 2 of the License, or
96 + * (at your option) any later version.
98 + * This program is distributed in the hope that it will be useful,
99 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
100 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
101 + * GNU General Public License for more details.
103 + * You should have received a copy of the GNU General Public License
104 + * along with this program; if not, write to the Free Software
105 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
109 +#include <linux/config.h>
110 +#include <linux/threads.h>
112 +#include <asm/asm.h>
113 +#include <asm/cacheops.h>
114 +#include <asm/current.h>
115 +#include <asm/offset.h>
116 +#include <asm/processor.h>
117 +#include <asm/regdef.h>
118 +#include <asm/cachectl.h>
119 +#include <asm/mipsregs.h>
120 +#include <asm/stackframe.h>
127 +/* TLB Miss Vector */
137 + /* Unused TLB Miss Vector */
139 +LEAF(jump_tlb_miss_unused)
145 +END(jump_tlb_miss_unused)
147 + /* Cache Error Vector */
149 +LEAF(jump_cache_error)
155 +END(jump_cache_error)
157 + /* General Exception */
159 +LEAF(jump_general_exception)
165 +END(jump_general_exception)
167 + /* Dedicated Interrupt */
169 +LEAF(jump_dedicated_interrupt)
175 +END(jump_dedicated_interrupt)
178 diff -urN linux.old/arch/mips/ar7/ar7/misc.c linux.dev/arch/mips/ar7/ar7/misc.c
179 --- linux.old/arch/mips/ar7/ar7/misc.c 1970-01-01 01:00:00.000000000 +0100
180 +++ linux.dev/arch/mips/ar7/ar7/misc.c 2005-07-26 18:11:02.622504000 +0200
182 +#include <asm/ar7/sangam.h>
183 +#include <asm/ar7/avalanche_misc.h>
184 +#include <linux/module.h>
185 +#include <linux/spinlock.h>
189 +static unsigned int avalanche_vbus_freq;
191 +REMOTE_VLYNQ_DEV_RESET_CTRL_FN p_remote_vlynq_dev_reset_ctrl = NULL;
193 +/*****************************************************************************
194 + * Reset Control Module.
195 + *****************************************************************************/
196 +void avalanche_reset_ctrl(unsigned int module_reset_bit,
197 + AVALANCHE_RESET_CTRL_T reset_ctrl)
199 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
201 + if(module_reset_bit >= 32 && module_reset_bit < 64)
204 + if(module_reset_bit >= 64)
206 + if(p_remote_vlynq_dev_reset_ctrl)
207 + return(p_remote_vlynq_dev_reset_ctrl(module_reset_bit - 64, reset_ctrl));
212 + if(reset_ctrl == OUT_OF_RESET)
213 + *reset_reg |= 1 << module_reset_bit;
215 + *reset_reg &= ~(1 << module_reset_bit);
218 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(unsigned int module_reset_bit)
220 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
222 + return (((*reset_reg) & (1 << module_reset_bit)) ? OUT_OF_RESET : IN_RESET );
225 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode)
227 + volatile unsigned int *sw_reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_SWRCR;
228 + *sw_reset_reg = mode;
231 +#define AVALANCHE_RST_CTRL_RSR_MASK 0x3
233 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status()
235 + volatile unsigned int *sys_reset_status = (unsigned int*) AVALANCHE_RST_CTRL_RSR;
237 + return ( (AVALANCHE_SYS_RESET_STATUS_T) (*sys_reset_status & AVALANCHE_RST_CTRL_RSR_MASK) );
241 +/*****************************************************************************
242 + * Power Control Module
243 + *****************************************************************************/
244 +#define AVALANCHE_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
245 +#define AVALANCHE_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
248 +void avalanche_power_ctrl(unsigned int module_power_bit, AVALANCHE_POWER_CTRL_T power_ctrl)
250 + volatile unsigned int *power_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
252 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
253 + /* power down the module */
254 + *power_reg |= (1 << module_power_bit);
256 + /* power on the module */
257 + *power_reg &= (~(1 << module_power_bit));
260 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int module_power_bit)
262 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
264 + return (((*power_status_reg) & (1 << module_power_bit)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP);
267 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode)
269 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
271 + *power_status_reg &= AVALANCHE_GLOBAL_POWER_DOWN_MASK;
272 + *power_status_reg |= ( power_mode << AVALANCHE_GLOBAL_POWER_DOWN_BIT);
275 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void)
277 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
279 + return((AVALANCHE_SYS_POWER_MODE_T) (((*power_status_reg) & (~AVALANCHE_GLOBAL_POWER_DOWN_MASK))
280 + >> AVALANCHE_GLOBAL_POWER_DOWN_BIT));
283 +/*****************************************************************************
285 + *****************************************************************************/
287 +/****************************************************************************
288 + * FUNCTION: avalanche_gpio_init
289 + ***************************************************************************/
290 +void avalanche_gpio_init(void)
292 + spinlock_t closeLock;
293 + unsigned int closeFlag;
294 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
295 + spin_lock_irqsave(&closeLock, closeFlag);
296 + *reset_reg |= (1 << AVALANCHE_GPIO_RESET_BIT);
297 + spin_unlock_irqrestore(&closeLock, closeFlag);
300 +/****************************************************************************
301 + * FUNCTION: avalanche_gpio_ctrl
302 + ***************************************************************************/
303 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
304 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
305 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction)
307 + spinlock_t closeLock;
308 + unsigned int closeFlag;
309 + volatile unsigned int *gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_ENBL;
314 + spin_lock_irqsave(&closeLock, closeFlag);
316 + if(pin_mode == GPIO_PIN)
318 + *gpio_ctrl |= (1 << gpio_pin);
320 + gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_DIR;
322 + if(pin_direction == GPIO_INPUT_PIN)
323 + *gpio_ctrl |= (1 << gpio_pin);
325 + *gpio_ctrl &= ~(1 << gpio_pin);
327 + else /* FUNCTIONAL PIN */
329 + *gpio_ctrl &= ~(1 << gpio_pin);
332 + spin_unlock_irqrestore(&closeLock, closeFlag);
337 +/****************************************************************************
338 + * FUNCTION: avalanche_gpio_out
339 + ***************************************************************************/
340 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value)
342 + spinlock_t closeLock;
343 + unsigned int closeFlag;
344 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
349 + spin_lock_irqsave(&closeLock, closeFlag);
351 + *gpio_out |= 1 << gpio_pin;
353 + *gpio_out &= ~(1 << gpio_pin);
354 + spin_unlock_irqrestore(&closeLock, closeFlag);
359 +/****************************************************************************
360 + * FUNCTION: avalanche_gpio_in
361 + ***************************************************************************/
362 +int avalanche_gpio_in_bit(unsigned int gpio_pin)
364 + spinlock_t closeLock;
365 + unsigned int closeFlag;
366 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
372 + spin_lock_irqsave(&closeLock, closeFlag);
373 + ret_val = ((*gpio_in) & (1 << gpio_pin));
374 + spin_unlock_irqrestore(&closeLock, closeFlag);
379 +/****************************************************************************
380 + * FUNCTION: avalanche_gpio_out_val
381 + ***************************************************************************/
382 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int out_mask,
383 + unsigned int reg_index)
385 + spinlock_t closeLock;
386 + unsigned int closeFlag;
387 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
392 + spin_lock_irqsave(&closeLock, closeFlag);
393 + *gpio_out &= ~out_mask;
394 + *gpio_out |= out_val;
395 + spin_unlock_irqrestore(&closeLock, closeFlag);
400 +/****************************************************************************
401 + * FUNCTION: avalanche_gpio_in_value
402 + ***************************************************************************/
403 +int avalanche_gpio_in_value(unsigned int* in_val, unsigned int reg_index)
405 + spinlock_t closeLock;
406 + unsigned int closeFlag;
407 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
412 + spin_lock_irqsave(&closeLock, closeFlag);
413 + *in_val = *gpio_in;
414 + spin_unlock_irqrestore(&closeLock, closeFlag);
419 +/***********************************************************************
421 + * Wakeup Control Module for TNETV1050 Communication Processor
423 + ***********************************************************************/
425 +#define AVALANCHE_WAKEUP_POLARITY_BIT 16
427 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
428 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
429 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity)
431 + volatile unsigned int *wakeup_status_reg = (unsigned int*) AVALANCHE_WAKEUP_CTRL_WKCR;
433 + /* enable/disable */
434 + if (wakeup_ctrl == WAKEUP_ENABLED)
435 + /* enable wakeup */
436 + *wakeup_status_reg |= wakeup_int;
438 + /* disable wakeup */
439 + *wakeup_status_reg &= (~wakeup_int);
442 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
443 + *wakeup_status_reg |= (wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
445 + *wakeup_status_reg &= ~(wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
448 +void avalanche_set_vbus_freq(unsigned int new_vbus_freq)
450 + avalanche_vbus_freq = new_vbus_freq;
453 +unsigned int avalanche_get_vbus_freq()
455 + return(avalanche_vbus_freq);
458 +unsigned int avalanche_get_chip_version_info()
460 + return(*(volatile unsigned int*)AVALANCHE_CVR);
463 +SET_MDIX_ON_CHIP_FN_T p_set_mdix_on_chip_fn = NULL;
465 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation)
467 + if(p_set_mdix_on_chip_fn)
468 + return (p_set_mdix_on_chip_fn(base_addr, operation));
473 +unsigned int avalanche_is_mdix_on_chip(void)
475 + return(p_set_mdix_on_chip_fn ? 1:0);
478 +EXPORT_SYMBOL(avalanche_reset_ctrl);
479 +EXPORT_SYMBOL(avalanche_get_reset_status);
480 +EXPORT_SYMBOL(avalanche_sys_reset);
481 +EXPORT_SYMBOL(avalanche_get_sys_last_reset_status);
482 +EXPORT_SYMBOL(avalanche_power_ctrl);
483 +EXPORT_SYMBOL(avalanche_get_power_status);
484 +EXPORT_SYMBOL(avalanche_set_global_power_mode);
485 +EXPORT_SYMBOL(avalanche_get_global_power_mode);
486 +EXPORT_SYMBOL(avalanche_set_mdix_on_chip);
487 +EXPORT_SYMBOL(avalanche_is_mdix_on_chip);
489 +EXPORT_SYMBOL(avalanche_gpio_init);
490 +EXPORT_SYMBOL(avalanche_gpio_ctrl);
491 +EXPORT_SYMBOL(avalanche_gpio_out_bit);
492 +EXPORT_SYMBOL(avalanche_gpio_in_bit);
493 +EXPORT_SYMBOL(avalanche_gpio_out_value);
494 +EXPORT_SYMBOL(avalanche_gpio_in_value);
496 +EXPORT_SYMBOL(avalanche_set_vbus_freq);
497 +EXPORT_SYMBOL(avalanche_get_vbus_freq);
499 +EXPORT_SYMBOL(avalanche_get_chip_version_info);
501 diff -urN linux.old/arch/mips/ar7/ar7/paging.c linux.dev/arch/mips/ar7/ar7/paging.c
502 --- linux.old/arch/mips/ar7/ar7/paging.c 1970-01-01 01:00:00.000000000 +0100
503 +++ linux.dev/arch/mips/ar7/ar7/paging.c 2005-07-26 18:38:00.086612640 +0200
507 + * This file is subject to the terms and conditions of the GNU General Public
508 + * License. See the file "COPYING" in the main directory of this archive
509 + * for more details.
511 + * Copyright (C) 2002 by Jeff Harrell (jharrell@ti.com)
512 + * Copyright (C) 2002 Texas Instruments, Inc.
517 + * This file takes care of the "memory hole" issue that exists with the standard
518 + * linux kernel and the TI Avalanche ASIC. The Avalanche ASIC requires an offset
519 + * of 0x14000000 due to the ASIC's memory map constraints. This file corrects the
520 + * paging tables so that the only reflect valid memory (i.e. > 0x14000000)
524 +#include <linux/config.h>
525 +#include <linux/signal.h>
526 +#include <linux/sched.h>
527 +#include <linux/kernel.h>
528 +#include <linux/errno.h>
529 +#include <linux/string.h>
530 +#include <linux/types.h>
531 +#include <linux/ptrace.h>
532 +#include <linux/mman.h>
533 +#include <linux/mm.h>
534 +#include <linux/swap.h>
535 +#include <linux/smp.h>
536 +#include <linux/init.h>
537 +#ifdef CONFIG_BLK_DEV_INITRD
538 +#include <linux/blk.h>
539 +#endif /* CONFIG_BLK_DEV_INITRD */
540 +#include <linux/highmem.h>
541 +#include <linux/bootmem.h>
543 +#include <asm/processor.h>
544 +#include <asm/system.h>
545 +#include <asm/uaccess.h>
546 +#include <asm/pgtable.h>
547 +#include <asm/pgalloc.h>
548 +#include <asm/mmu_context.h>
550 +#include <asm/tlb.h>
551 +#include <asm/cpu.h>
553 +static unsigned long totalram_pages;
554 +/* static unsigned long totalhigh_pages; */
556 +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
557 +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
559 +#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
560 +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
561 +#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
564 + * We have upto 8 empty zeroed pages so we can map one of the right colour
565 + * when needed. This is necessary only on R4000 / R4400 SC and MC versions
566 + * where we have to avoid VCED / VECI exceptions for good performance at
567 + * any price. Since page is never written to after the initialization we
568 + * don't have to care about aliases on other CPUs.
571 +static inline unsigned long setup_zero_pages(void)
573 + unsigned long order, size;
575 + if(current_cpu_data.options & MIPS_CPU_VCE)
580 + empty_zero_page = __get_free_pages(GFP_KERNEL, order);
582 + if (!empty_zero_page)
583 + panic("Oh boy, that early out of memory?");
585 + page = virt_to_page(empty_zero_page);
587 + while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
588 + set_bit(PG_reserved, &page->flags);
589 + set_page_count(page, 0);
593 + size = PAGE_SIZE << order;
594 + zero_page_mask = (size - 1) & PAGE_MASK;
595 + memset((void *)empty_zero_page, 0, size);
597 + return 1UL << order;
601 + * paging_init() sets up the page tables
603 + * This routines also unmaps the page at virtual kernel address 0, so
604 + * that we can trap those pesky NULL-reference errors in the kernel.
606 +void __init paging_init(void)
608 + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
609 + unsigned long low, start_pfn;
611 + /* Initialize the entire pgd. */
612 + pgd_init((unsigned long)swapper_pg_dir);
613 + pgd_init((unsigned long)swapper_pg_dir + PAGE_SIZE / 2);
616 + start_pfn = START_PFN;
617 + // max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
620 + /* Avalanche DMA-able memory 0x14000000+memsize */
622 + zones_size[ZONE_DMA] = low - start_pfn;
624 + free_area_init_node(0, NODE_DATA(0), 0, zones_size, CONFIG_AR7_MEMORY, 0);
627 +extern char _ftext, _etext, _fdata, _edata, _end;
628 +extern char __init_begin, __init_end;
630 +void __init mem_init(void)
632 + int codesize, reservedpages, datasize, initsize;
635 + max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN;
636 + high_memory = (void *)__va(MAX_LOW_PFN * PAGE_SIZE);
638 + /* free up the memory associated with Adam2 -
639 + * that is the, after the first page that is
640 + * reserved all the way up to the start of the kernel
642 + free_bootmem_node(NODE_DATA(0), (CONFIG_AR7_MEMORY+PAGE_SIZE),
643 + (__pa(&_ftext))-(CONFIG_AR7_MEMORY+PAGE_SIZE) );
645 + /* this will put all low memory onto the freelists */
646 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
648 + /* Setup zeroed pages */
649 + totalram_pages -= setup_zero_pages();
652 + for (tmp = 0; tmp < num_physpages; tmp++)
654 + * Only count reserved RAM pages
656 + if (PageReserved(mem_map+tmp))
659 + codesize = (unsigned long) &_etext - (unsigned long) &_ftext;
660 + datasize = (unsigned long) &_edata - (unsigned long) &_fdata;
661 + initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
663 + printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
664 + (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
665 + max_mapnr << (PAGE_SHIFT-10),
667 + reservedpages << (PAGE_SHIFT-10),
673 +/* fixes paging routines for avalanche (utilized in /arch/mips/kernel/setup.c) */
675 +void avalanche_bootmem_init(void)
677 + unsigned long start_pfn, max_pfn;
678 + unsigned long max_low_pfn;
679 + unsigned int memory_end,memory_start;
680 + unsigned long bootmap_size;
682 + memory_start = (unsigned long)PAGE_OFFSET+CONFIG_AR7_MEMORY;
683 + memory_end = memory_start + 0x02000000;
686 + * Find the highest memory page fram number we have available
689 + max_pfn = PFN_DOWN(__pa(memory_end));
692 + * Determine the low and high memory ranges
695 + max_low_pfn = max_pfn;
698 + * Partially used pages are not usable - thus we are
699 + * rounding upwards:
702 + start_pfn = PFN_UP(__pa(&_end));
705 + * Find a proper area for the bootmem bitmap. After this
706 + * bootstrap step all allocations (until the page allocator is
707 + * intact) must be done via bootmem_alloc().
710 + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
711 + CONFIG_AR7_MEMORY>>PAGE_SHIFT, max_low_pfn);
715 + * Register fully available low RAM pages with the bootmem allocator.
719 + unsigned long curr_pfn, last_pfn, pages;
722 + * We are rounding up the start address of usable memory:
724 + curr_pfn = PFN_UP(CONFIG_AR7_MEMORY);
727 + * ... and at the end of the usable range downwards:
729 + last_pfn = PFN_DOWN(__pa(memory_end));
731 + if (last_pfn > max_low_pfn)
732 + last_pfn = max_low_pfn;
734 + pages = last_pfn - curr_pfn;
737 + free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
742 + * Reserve the kernel text and
743 + * Reserve the bootmem bitmap. We do this in two steps (first step
744 + * was init_bootmem()), because this catches the (definitely buggy)
745 + * case of us accidentally initializing the bootmem allocator with
746 + * an invalid RAM area.
748 + reserve_bootmem_node(NODE_DATA(0), CONFIG_AR7_MEMORY+PAGE_SIZE,
749 + (PFN_PHYS(start_pfn)+bootmap_size+PAGE_SIZE-1)-CONFIG_AR7_MEMORY);
752 + * reserve physical page 0 - it's a special BIOS page on many boxes,
753 + * enabling clean reboots, SMP operation, laptop functions.
755 + reserve_bootmem_node(NODE_DATA(0), CONFIG_AR7_MEMORY, PAGE_SIZE);
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 linux.old/arch/mips/ar7/cmdline.c linux.dev/arch/mips/ar7/cmdline.c
771 --- linux.old/arch/mips/ar7/cmdline.c 1970-01-01 01:00:00.000000000 +0100
772 +++ linux.dev/arch/mips/ar7/cmdline.c 2005-07-26 18:11:02.623504000 +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 linux.old/arch/mips/ar7/init.c linux.dev/arch/mips/ar7/init.c
839 --- linux.old/arch/mips/ar7/init.c 1970-01-01 01:00:00.000000000 +0100
840 +++ linux.dev/arch/mips/ar7/init.c 2005-07-26 18:11:02.624504000 +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 linux.old/arch/mips/ar7/irq.c linux.dev/arch/mips/ar7/irq.c
987 --- linux.old/arch/mips/ar7/irq.c 1970-01-01 01:00:00.000000000 +0100
988 +++ linux.dev/arch/mips/ar7/irq.c 2005-07-26 18:38:00.087612488 +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 + // avalanche_hw0_ipaceregs->ipacep = (2*get_avalanche_vbus_freq()/1000000)*4;
1399 + /* hack for speeding up the pacing. */
1400 + printk("the pacing pre-scalar has been set as 600.\n");
1401 + avalanche_hw0_ipaceregs->ipacep = 600;
1402 + /* Channel to line mapping, Line to Channel mapping */
1404 + for(i = 0; i < 40; i++)
1405 + avalanche_int_set(i,i);
1407 + /* Now safe to set the exception vector. */
1408 + set_except_vector(0, mipsIRQ);
1410 + /* Setup the IRQ description array. These will be mapped
1411 + * as flat interrupts numbers. The mapping is as follows
1413 + * 0-7 MIPS CPU Exceptions (HW/SW)
1414 + * 8-46 Primary Interrupts (Avalanche)
1415 + * 47-78 Secondary Interrupts (Avalanche)
1418 + for (i = 0; i <= AVALANCHE_INT_END; i++)
1420 + irq_desc_ti[i].status = IRQ_DISABLED;
1421 + irq_desc_ti[i].action = 0;
1422 + irq_desc_ti[i].depth = 1;
1423 + irq_desc_ti[i].handler = &avalanche_irq_type;
1429 + set_debug_traps();
1436 +void avalanche_hw0_irqdispatch(struct pt_regs *regs)
1438 + struct irqaction *action;
1439 + int irq, cpu = smp_processor_id();
1440 + unsigned long int_line_number,status;
1441 + int i,secondary = 0;
1444 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
1445 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
1450 + if( chan_nr != uni_secondary_interrupt)
1451 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
1455 + if((chan_nr < 40) && (chan_nr > 31))
1457 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
1461 + /* If the Priority Interrupt Index Register returns 40 then no
1462 + * interrupts are pending
1468 + if(chan_nr == uni_secondary_interrupt)
1470 + status = avalanche_hw0_ecregs->exsr;
1471 + for(i=0; i < AVINTNUM(AVALANCHE_INT_END_SECONDARY); i++)
1473 + if (status & 1<<i)
1475 + /* clear secondary interrupt */
1476 + avalanche_hw0_ecregs->excr = 1 << i;
1483 + /* clear the universal secondary interrupt */
1484 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
1490 + /* Suraj Add code to clear secondary interrupt */
1493 + action = hw0_irq_action_secondary[irq];
1495 + action = hw0_irq_action_primary[irq];
1497 + /* if action == NULL, then we don't have a handler for the irq */
1499 + if ( action == NULL ) {
1500 + printk("No handler for hw0 irq: %i\n", irq);
1504 + irq_enter(cpu,irq);
1507 + kstat.irqs[0][(irq + AVINTNUM(AVALANCHE_INT_END_PRIMARY)) + 8]++;
1508 + action->handler((irq + AVALANCHE_INT_END_PRIMARY), action->dev_id, regs);
1512 + kstat.irqs[0][irq + 8]++;
1513 + action->handler(LNXINTNUM(irq), action->dev_id, regs);
1516 + irq_exit(cpu,irq);
1518 + if(softirq_pending(cpu))
1524 +void avalanche_int_set(int channel, int line)
1529 + avalanche_hw0_chregs->cintnr0 = line;
1532 + avalanche_hw0_chregs->cintnr1 = line;
1535 + avalanche_hw0_chregs->cintnr2 = line;
1538 + avalanche_hw0_chregs->cintnr3 = line;
1541 + avalanche_hw0_chregs->cintnr4 = line;
1544 + avalanche_hw0_chregs->cintnr5 = line;
1547 + avalanche_hw0_chregs->cintnr6 = line;
1550 + avalanche_hw0_chregs->cintnr7 = line;
1553 + avalanche_hw0_chregs->cintnr8 = line;
1556 + avalanche_hw0_chregs->cintnr9 = line;
1559 + avalanche_hw0_chregs->cintnr10 = line;
1562 + avalanche_hw0_chregs->cintnr11 = line;
1565 + avalanche_hw0_chregs->cintnr12 = line;
1568 + avalanche_hw0_chregs->cintnr13 = line;
1571 + avalanche_hw0_chregs->cintnr14 = line;
1574 + avalanche_hw0_chregs->cintnr15 = line;
1577 + avalanche_hw0_chregs->cintnr16 = line;
1580 + avalanche_hw0_chregs->cintnr17 = line;
1583 + avalanche_hw0_chregs->cintnr18 = line;
1586 + avalanche_hw0_chregs->cintnr19 = line;
1589 + avalanche_hw0_chregs->cintnr20 = line;
1592 + avalanche_hw0_chregs->cintnr21 = line;
1595 + avalanche_hw0_chregs->cintnr22 = line;
1598 + avalanche_hw0_chregs->cintnr23 = line;
1601 + avalanche_hw0_chregs->cintnr24 = line;
1604 + avalanche_hw0_chregs->cintnr25 = line;
1607 + avalanche_hw0_chregs->cintnr26 = line;
1610 + avalanche_hw0_chregs->cintnr27 = line;
1613 + avalanche_hw0_chregs->cintnr28 = line;
1616 + avalanche_hw0_chregs->cintnr29 = line;
1619 + avalanche_hw0_chregs->cintnr30 = line;
1622 + avalanche_hw0_chregs->cintnr31 = line;
1625 + avalanche_hw0_chregs->cintnr32 = line;
1628 + avalanche_hw0_chregs->cintnr33 = line;
1631 + avalanche_hw0_chregs->cintnr34 = line;
1634 + avalanche_hw0_chregs->cintnr35 = line;
1637 + avalanche_hw0_chregs->cintnr36 = line;
1640 + avalanche_hw0_chregs->cintnr37 = line;
1643 + avalanche_hw0_chregs->cintnr38 = line;
1646 + avalanche_hw0_chregs->cintnr39 = line;
1649 + printk("Error: Unknown Avalanche interrupt channel\n");
1652 + line_to_channel[line] = channel; /* Suraj check */
1654 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
1655 + uni_secondary_interrupt = line;
1660 +#define AVALANCHE_MAX_PACING_BLK 3
1661 +#define AVALANCHE_PACING_LOW_VAL 2
1662 +#define AVALANCHE_PACING_HIGH_VAL 63
1664 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num,
1665 + unsigned int pace_value)
1667 + unsigned int blk_offset;
1668 + unsigned long flags;
1670 + if(irq_nr < MIPS_EXCEPTION_OFFSET &&
1671 + irq_nr >= AVALANCHE_INT_END_PRIMARY)
1674 + if(blk_num > AVALANCHE_MAX_PACING_BLK)
1677 + if(pace_value > AVALANCHE_PACING_HIGH_VAL &&
1678 + pace_value < AVALANCHE_PACING_LOW_VAL)
1681 + blk_offset = blk_num*8;
1683 + save_and_cli(flags);
1685 + /* disable the interrupt pacing, if enabled previously */
1686 + avalanche_hw0_ipaceregs->ipacemax &= ~(0xff << blk_offset);
1688 + /* clear the pacing map */
1689 + avalanche_hw0_ipaceregs->ipacemap &= ~(0xff << blk_offset);
1691 + /* setup the new values */
1692 + avalanche_hw0_ipaceregs->ipacemap |= ((AVINTNUM(irq_nr)) << blk_offset);
1693 + avalanche_hw0_ipaceregs->ipacemax |= ((0x80 | pace_value) << blk_offset);
1695 + restore_flags(flags);
1699 diff -urN linux.old/arch/mips/ar7/memory.c linux.dev/arch/mips/ar7/memory.c
1700 --- linux.old/arch/mips/ar7/memory.c 1970-01-01 01:00:00.000000000 +0100
1701 +++ linux.dev/arch/mips/ar7/memory.c 2005-07-26 18:38:00.087612488 +0200
1704 + * Carsten Langgaard, carstenl@mips.com
1705 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1707 + * ########################################################################
1709 + * This program is free software; you can distribute it and/or modify it
1710 + * under the terms of the GNU General Public License (Version 2) as
1711 + * published by the Free Software Foundation.
1713 + * This program is distributed in the hope it will be useful, but WITHOUT
1714 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1715 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1716 + * for more details.
1718 + * You should have received a copy of the GNU General Public License along
1719 + * with this program; if not, write to the Free Software Foundation, Inc.,
1720 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1722 + * ########################################################################
1724 + * PROM library functions for acquiring/using memory descriptors given to
1725 + * us from the YAMON.
1728 +#include <linux/config.h>
1729 +#include <linux/init.h>
1730 +#include <linux/mm.h>
1731 +#include <linux/bootmem.h>
1733 +#include <asm/bootinfo.h>
1734 +#include <asm/page.h>
1735 +#include <asm/mips-boards/prom.h>
1737 +enum yamon_memtypes {
1742 +struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
1744 +/* References to section boundaries */
1747 +#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
1750 +struct prom_pmemblock * __init prom_getmdesc(void)
1752 + char *memsize_str;
1753 + unsigned int memsize;
1755 + memsize_str = prom_getenv("memsize");
1756 + if (!memsize_str) {
1757 + memsize = 0x02000000;
1759 + memsize = simple_strtol(memsize_str, NULL, 0);
1762 + memset(mdesc, 0, sizeof(mdesc));
1764 + mdesc[0].type = yamon_dontuse;
1765 + mdesc[0].base = 0x00000000;
1766 + mdesc[0].size = CONFIG_AR7_MEMORY;
1768 + mdesc[1].type = yamon_prom;
1769 + mdesc[1].base = CONFIG_AR7_MEMORY;
1770 + mdesc[1].size = 0x00020000;
1772 + mdesc[2].type = yamon_free;
1773 + mdesc[2].base = CONFIG_AR7_MEMORY + 0x00020000;
1774 + mdesc[2].size = (memsize + CONFIG_AR7_MEMORY) - mdesc[2].base;
1779 +static int __init prom_memtype_classify (unsigned int type)
1783 + return BOOT_MEM_RAM;
1785 + return BOOT_MEM_ROM_DATA;
1787 + return BOOT_MEM_RESERVED;
1791 +void __init prom_meminit(void)
1793 + struct prom_pmemblock *p;
1795 + p = prom_getmdesc();
1799 + unsigned long base, size;
1801 + type = prom_memtype_classify (p->type);
1805 + add_memory_region(base, size, type);
1810 +void __init prom_free_prom_memory (void)
1814 + unsigned long freed = 0;
1815 + unsigned long addr;
1817 + for (i = 0; i < boot_mem_map.nr_map; i++) {
1818 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
1821 + addr = boot_mem_map.map[i].addr;
1822 + while (addr < boot_mem_map.map[i].addr
1823 + + boot_mem_map.map[i].size) {
1824 + ClearPageReserved(virt_to_page(__va(addr)));
1825 + set_page_count(virt_to_page(__va(addr)), 1);
1826 + free_page((unsigned long)__va(addr));
1827 + addr += PAGE_SIZE;
1828 + freed += PAGE_SIZE;
1831 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
1834 diff -urN linux.old/arch/mips/ar7/mipsIRQ.S linux.dev/arch/mips/ar7/mipsIRQ.S
1835 --- linux.old/arch/mips/ar7/mipsIRQ.S 1970-01-01 01:00:00.000000000 +0100
1836 +++ linux.dev/arch/mips/ar7/mipsIRQ.S 2005-07-26 18:11:02.627503000 +0200
1839 + * Carsten Langgaard, carstenl@mips.com
1840 + * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
1842 + * ########################################################################
1844 + * This program is free software; you can distribute it and/or modify it
1845 + * under the terms of the GNU General Public License (Version 2) as
1846 + * published by the Free Software Foundation.
1848 + * This program is distributed in the hope it will be useful, but WITHOUT
1849 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1850 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1851 + * for more details.
1853 + * You should have received a copy of the GNU General Public License along
1854 + * with this program; if not, write to the Free Software Foundation, Inc.,
1855 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1857 + * ########################################################################
1859 + * Interrupt exception dispatch code.
1862 +#include <linux/config.h>
1864 +#include <asm/asm.h>
1865 +#include <asm/mipsregs.h>
1866 +#include <asm/regdef.h>
1867 +#include <asm/stackframe.h>
1869 +/* A lot of complication here is taken away because:
1871 + * 1) We handle one interrupt and return, sitting in a loop and moving across
1872 + * all the pending IRQ bits in the cause register is _NOT_ the answer, the
1873 + * common case is one pending IRQ so optimize in that direction.
1875 + * 2) We need not check against bits in the status register IRQ mask, that
1876 + * would make this routine slow as hell.
1878 + * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
1879 + * between like BSD spl() brain-damage.
1881 + * Furthermore, the IRQs on the MIPS board look basically (barring software
1882 + * IRQs which we don't use at all and all external interrupt sources are
1883 + * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
1887 + * 0 Software (ignored)
1888 + * 1 Software (ignored)
1889 + * 2 Combined hardware interrupt (hw0)
1890 + * 3 Hardware (ignored)
1891 + * 4 Hardware (ignored)
1892 + * 5 Hardware (ignored)
1893 + * 6 Hardware (ignored)
1894 + * 7 R4k timer (what we use)
1896 + * Note: On the SEAD board thing are a little bit different.
1897 + * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
1900 + * We handle the IRQ according to _our_ priority which is:
1902 + * Highest ---- R4k Timer
1903 + * Lowest ---- Combined hardware interrupt
1905 + * then we just return, if multiple IRQs are pending then we will just take
1906 + * another exception, big deal.
1913 +NESTED(mipsIRQ, PT_SIZE, sp)
1918 + mfc0 s0, CP0_CAUSE # get irq bits
1920 + /* First we check for r4k counter/timer IRQ. */
1921 + andi a0, s0, CAUSEF_IP7
1923 + andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
1925 + /* Wheee, a timer interrupt. */
1927 + jal ar7_timer_interrupt
1934 + beq a0, zero, 1f # delay slot, check hw3 interrupt
1937 + /* Wheee, combined hardware level zero interrupt. */
1938 + jal avalanche_hw0_irqdispatch
1939 + move a0, sp # delay slot
1946 + * Here by mistake? This is possible, what can happen is that by the
1947 + * time we take the exception the IRQ pin goes low, so just leave if
1948 + * this is the case.
1951 + PRINT("Got interrupt: c0_cause = %08x\n")
1953 + PRINT("c0_epc = %08x\n")
1958 diff -urN linux.old/arch/mips/ar7/printf.c linux.dev/arch/mips/ar7/printf.c
1959 --- linux.old/arch/mips/ar7/printf.c 1970-01-01 01:00:00.000000000 +0100
1960 +++ linux.dev/arch/mips/ar7/printf.c 2005-07-26 18:38:00.087612488 +0200
1963 + * Carsten Langgaard, carstenl@mips.com
1964 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1966 + * This program is free software; you can distribute it and/or modify it
1967 + * under the terms of the GNU General Public License (Version 2) as
1968 + * published by the Free Software Foundation.
1970 + * This program is distributed in the hope it will be useful, but WITHOUT
1971 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1972 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1973 + * for more details.
1975 + * You should have received a copy of the GNU General Public License along
1976 + * with this program; if not, write to the Free Software Foundation, Inc.,
1977 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1979 + * Putting things on the screen/serial line using Adam2 facilities.
1982 +#include <linux/config.h>
1983 +#include <linux/init.h>
1984 +#include <linux/kernel.h>
1985 +#include <linux/serial_reg.h>
1986 +#include <linux/spinlock.h>
1987 +#include <asm/io.h>
1988 +#include <asm/serial.h>
1989 +#include <asm/addrspace.h>
1991 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
1992 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4)
1994 +static char ppbuf[1024];
1996 +void (*prom_print_str)(unsigned int out, char *s, int len);
1998 +void prom_printf(char *fmt, ...) __init;
1999 +void prom_printf(char *fmt, ...)
2003 + prom_print_str = (void *)*(unsigned int *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR;
2005 + va_start(args, fmt);
2006 + vsprintf(ppbuf, fmt, args);
2007 + len = strlen(ppbuf);
2009 + prom_print_str(1, ppbuf, len);
2015 diff -urN linux.old/arch/mips/ar7/reset.c linux.dev/arch/mips/ar7/reset.c
2016 --- linux.old/arch/mips/ar7/reset.c 1970-01-01 01:00:00.000000000 +0100
2017 +++ linux.dev/arch/mips/ar7/reset.c 2005-07-26 18:38:00.088612336 +0200
2020 + * Carsten Langgaard, carstenl@mips.com
2021 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
2023 + * ########################################################################
2025 + * This program is free software; you can distribute it and/or modify it
2026 + * under the terms of the GNU General Public License (Version 2) as
2027 + * published by the Free Software Foundation.
2029 + * This program is distributed in the hope it will be useful, but WITHOUT
2030 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2031 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2032 + * for more details.
2034 + * You should have received a copy of the GNU General Public License along
2035 + * with this program; if not, write to the Free Software Foundation, Inc.,
2036 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2038 + * ########################################################################
2040 + * Reset the MIPS boards.
2043 +#include <linux/config.h>
2045 +#include <asm/reboot.h>
2046 +#include <asm/mips-boards/generic.h>
2048 +static void ar7_machine_restart(char *command);
2049 +static void ar7_machine_halt(void);
2050 +static void ar7_machine_power_off(void);
2052 +static void ar7_machine_restart(char *command)
2054 + volatile unsigned int *softres_reg = (void *)(KSEG1ADDR(0x08611600 + 0x4));
2059 +static void ar7_machine_halt(void)
2064 +static void ar7_machine_power_off(void)
2069 +void ar7_reboot_setup(void)
2071 + _machine_restart = ar7_machine_restart;
2072 + _machine_halt = ar7_machine_halt;
2073 + _machine_power_off = ar7_machine_power_off;
2075 diff -urN linux.old/arch/mips/ar7/setup.c linux.dev/arch/mips/ar7/setup.c
2076 --- linux.old/arch/mips/ar7/setup.c 1970-01-01 01:00:00.000000000 +0100
2077 +++ linux.dev/arch/mips/ar7/setup.c 2005-07-26 18:11:02.628503000 +0200
2080 + * Carsten Langgaard, carstenl@mips.com
2081 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
2083 + * This program is free software; you can distribute it and/or modify it
2084 + * under the terms of the GNU General Public License (Version 2) as
2085 + * published by the Free Software Foundation.
2087 + * This program is distributed in the hope it will be useful, but WITHOUT
2088 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2089 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2090 + * for more details.
2092 + * You should have received a copy of the GNU General Public License along
2093 + * with this program; if not, write to the Free Software Foundation, Inc.,
2094 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2096 +#include <linux/config.h>
2097 +#include <linux/init.h>
2098 +#include <linux/sched.h>
2099 +#include <linux/mc146818rtc.h>
2100 +#include <linux/ioport.h>
2102 +#include <asm/cpu.h>
2103 +#include <asm/bootinfo.h>
2104 +#include <asm/irq.h>
2105 +#include <asm/mips-boards/generic.h>
2106 +#include <asm/mips-boards/prom.h>
2108 +#include <asm/dma.h>
2109 +#include <asm/time.h>
2110 +#include <asm/traps.h>
2113 +extern void rs_kgdb_hook(int);
2114 +int remote_debug = 0;
2117 +extern struct rtc_ops no_rtc_ops;
2119 +extern void ar7_reboot_setup(void);
2121 +extern void ar7_time_init(void);
2122 +extern void ar7_timer_setup(struct irqaction *irq);
2124 +const char *get_system_type(void)
2126 + return "Texas Instruments AR7";
2129 +void __init ar7_setup(void)
2132 + int rs_putDebugChar(char);
2133 + char rs_getDebugChar(void);
2134 + extern int (*generic_putDebugChar)(char);
2135 + extern char (*generic_getDebugChar)(void);
2138 +#ifdef CONFIG_SERIAL_CONSOLE
2139 + argptr = prom_getcmdline();
2140 + if ((argptr = strstr(argptr, "console=")) == NULL) {
2145 + s = prom_getenv("modetty0");
2146 + strcpy(console, "38400");
2149 + while (s[i] >= '0' && s[i] <= '9')
2153 + strncpy(console, s, i);
2158 + argptr = prom_getcmdline();
2159 + strcat(argptr, " console=ttyS0,");
2160 + strcat(argptr, console);
2165 + argptr = prom_getcmdline();
2166 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
2168 + argptr += strlen("kgdb=ttyS");
2169 + if (*argptr != '0' && *argptr != '1')
2170 + printk("KGDB: Uknown serial line /dev/ttyS%c, "
2171 + "falling back to /dev/ttyS1\n", *argptr);
2172 + line = *argptr == '0' ? 0 : 1;
2173 + printk("KGDB: Using serial line /dev/ttyS%d for session\n",
2176 + rs_kgdb_hook(line);
2177 + generic_putDebugChar = rs_putDebugChar;
2178 + generic_getDebugChar = rs_getDebugChar;
2180 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
2181 + "please connect your debugger\n", line ? 1 : 0);
2184 + /* Breakpoints are in init_IRQ() */
2188 + argptr = prom_getcmdline();
2189 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
2190 + cpu_data[0].options &= ~MIPS_CPU_FPU;
2192 + rtc_ops = &no_rtc_ops;
2194 + ar7_reboot_setup();
2196 + board_time_init = ar7_time_init;
2197 + board_timer_setup = ar7_timer_setup;
2199 diff -urN linux.old/arch/mips/ar7/time.c linux.dev/arch/mips/ar7/time.c
2200 --- linux.old/arch/mips/ar7/time.c 1970-01-01 01:00:00.000000000 +0100
2201 +++ linux.dev/arch/mips/ar7/time.c 2005-07-26 18:38:00.088612336 +0200
2204 + * Carsten Langgaard, carstenl@mips.com
2205 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
2207 + * ########################################################################
2209 + * This program is free software; you can distribute it and/or modify it
2210 + * under the terms of the GNU General Public License (Version 2) as
2211 + * published by the Free Software Foundation.
2213 + * This program is distributed in the hope it will be useful, but WITHOUT
2214 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2215 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2216 + * for more details.
2218 + * You should have received a copy of the GNU General Public License along
2219 + * with this program; if not, write to the Free Software Foundation, Inc.,
2220 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2222 + * ########################################################################
2224 + * Setting up the clock on the MIPS boards.
2228 +#include <linux/types.h>
2229 +#include <linux/config.h>
2230 +#include <linux/init.h>
2231 +#include <linux/kernel_stat.h>
2232 +#include <linux/sched.h>
2233 +#include <linux/spinlock.h>
2235 +#include <asm/mipsregs.h>
2236 +#include <asm/ptrace.h>
2237 +#include <asm/hardirq.h>
2238 +#include <asm/div64.h>
2240 +#include <linux/interrupt.h>
2241 +#include <linux/mc146818rtc.h>
2242 +#include <linux/timex.h>
2244 +#include <asm/mips-boards/generic.h>
2245 +#include <asm/mips-boards/prom.h>
2247 +extern asmlinkage void mipsIRQ(void);
2249 +static unsigned long r4k_offset; /* Amount to increment compare reg each time */
2250 +static unsigned long r4k_cur; /* What counter should be at next timer irq */
2252 +#define MIPS_CPU_TIMER_IRQ 7
2253 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
2255 +static inline void ack_r4ktimer(unsigned long newval)
2257 + write_c0_compare(newval);
2260 +void ar7_timer_interrupt(struct pt_regs *regs)
2262 + int cpu = smp_processor_id();
2264 + irq_enter(cpu, MIPS_CPU_TIMER_IRQ);
2266 + if (r4k_offset == 0)
2270 + kstat.irqs[cpu][MIPS_CPU_TIMER_IRQ]++;
2272 + r4k_cur += r4k_offset;
2273 + ack_r4ktimer(r4k_cur);
2275 + } while (((unsigned long)read_c0_count()
2276 + - r4k_cur) < 0x7fffffff);
2278 + irq_exit(cpu, MIPS_CPU_TIMER_IRQ);
2280 + if (softirq_pending(cpu))
2290 + * Figure out the r4k offset, the amount to increment the compare
2291 + * register for each time tick.
2293 +static unsigned long __init cal_r4koff(void)
2295 + return ((CONFIG_AR7_CPU*500000)/HZ);
2298 +void __init ar7_time_init(void)
2300 + unsigned long flags;
2301 + unsigned int est_freq;
2303 + set_except_vector(0, mipsIRQ);
2304 + write_c0_count(0);
2306 + printk("calculating r4koff... ");
2307 + r4k_offset = cal_r4koff();
2308 + printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
2310 + est_freq = 2*r4k_offset*HZ;
2311 + est_freq += 5000; /* round */
2312 + est_freq -= est_freq%10000;
2313 + printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
2314 + (est_freq%1000000)*100/1000000);
2317 +void __init ar7_timer_setup(struct irqaction *irq)
2319 + /* we are using the cpu counter for timer interrupts */
2320 + irq->handler = no_action; /* we use our own handler */
2321 + setup_irq(MIPS_CPU_TIMER_IRQ, irq);
2323 + r4k_cur = (read_c0_count() + r4k_offset);
2324 + write_c0_compare(r4k_cur);
2325 + set_c0_status(ALLINTS);
2327 diff -urN linux.old/arch/mips/ar7/tnetd73xx_misc.c linux.dev/arch/mips/ar7/tnetd73xx_misc.c
2328 --- linux.old/arch/mips/ar7/tnetd73xx_misc.c 1970-01-01 01:00:00.000000000 +0100
2329 +++ linux.dev/arch/mips/ar7/tnetd73xx_misc.c 2005-07-26 18:11:02.630503000 +0200
2331 +/******************************************************************************
2332 + * FILE PURPOSE: TNETD73xx Misc modules API Source
2333 + ******************************************************************************
2334 + * FILE NAME: tnetd73xx_misc.c
2336 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
2337 + * FSER Modules API
2338 + * As per TNETD73xx specifications
2340 + * REVISION HISTORY:
2341 + * 27 Nov 02 - Sharath Kumar PSP TII
2342 + * 14 Feb 03 - Anant Gole PSP TII
2344 + * (C) Copyright 2002, Texas Instruments, Inc
2345 + *******************************************************************************/
2347 +#define LITTLE_ENDIAN
2348 +#define _LINK_KSEG0_
2350 +#include <linux/types.h>
2351 +#include <asm/ar7/tnetd73xx.h>
2352 +#include <asm/ar7/tnetd73xx_misc.h>
2354 +/* TNETD73XX Revision */
2355 +u32 tnetd73xx_get_revision(void)
2357 + /* Read Chip revision register - This register is from GPIO module */
2358 + return ( (u32) REG32_DATA(TNETD73XX_CVR));
2361 +/*****************************************************************************
2362 + * Reset Control Module
2363 + *****************************************************************************/
2366 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module, TNETD73XX_RESET_CTRL_T reset_ctrl)
2370 + /* read current reset register */
2371 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2373 + if (reset_ctrl == OUT_OF_RESET)
2375 + /* bring module out of reset */
2376 + reset_status |= (1 << reset_module);
2380 + /* put module in reset */
2381 + reset_status &= (~(1 << reset_module));
2384 + /* write to the reset register */
2385 + REG32_WRITE(TNETD73XX_RST_CTRL_PRCR, reset_status);
2389 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status (TNETD73XX_RESET_MODULE_T reset_module)
2393 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2394 + return ( (reset_status & (1 << reset_module)) ? OUT_OF_RESET : IN_RESET );
2397 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode)
2399 + REG32_WRITE(TNETD73XX_RST_CTRL_SWRCR, mode);
2402 +#define TNETD73XX_RST_CTRL_RSR_MASK 0x3
2404 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status()
2406 + u32 sys_reset_status;
2408 + REG32_READ(TNETD73XX_RST_CTRL_RSR, sys_reset_status);
2410 + return ( (TNETD73XX_SYS_RESET_STATUS_T) (sys_reset_status & TNETD73XX_RST_CTRL_RSR_MASK) );
2414 +/*****************************************************************************
2415 + * Power Control Module
2416 + *****************************************************************************/
2417 +#define TNETD73XX_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
2418 +#define TNETD73XX_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
2421 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl)
2425 + /* read current power down control register */
2426 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2428 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
2430 + /* power down the module */
2431 + power_status |= (1 << power_module);
2435 + /* power on the module */
2436 + power_status &= (~(1 << power_module));
2439 + /* write to the reset register */
2440 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2443 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module)
2447 + /* read current power down control register */
2448 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2450 + return ( (power_status & (1 << power_module)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP );
2453 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode)
2457 + /* read current power down control register */
2458 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2460 + power_status &= TNETD73XX_GLOBAL_POWER_DOWN_MASK;
2461 + power_status |= ( power_mode << TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2463 + /* write to power down control register */
2464 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2467 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode()
2471 + /* read current power down control register */
2472 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2474 + power_status &= (~TNETD73XX_GLOBAL_POWER_DOWN_MASK);
2475 + power_status = ( power_status >> TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2477 + return ( (TNETD73XX_SYS_POWER_MODE_T) power_status );
2481 +/*****************************************************************************
2483 + *****************************************************************************/
2485 +#define TNETD73XX_WAKEUP_POLARITY_BIT 16
2487 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
2488 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
2489 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity)
2491 + u32 wakeup_status;
2493 + /* read the wakeup control register */
2494 + REG32_READ(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2496 + /* enable/disable */
2497 + if (wakeup_ctrl == WAKEUP_ENABLED)
2499 + /* enable wakeup */
2500 + wakeup_status |= wakeup_int;
2504 + /* disable wakeup */
2505 + wakeup_status &= (~wakeup_int);
2508 + /* set polarity */
2509 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
2511 + wakeup_status |= (wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2515 + wakeup_status &= ~(wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2518 + /* write the wakeup control register */
2519 + REG32_WRITE(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2523 +/*****************************************************************************
2525 + *****************************************************************************/
2527 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode)
2529 + REG32_WRITE(TNETD73XX_FSER_BASE, fser_mode);
2532 +/*****************************************************************************
2534 + *****************************************************************************/
2536 +#define MIN(x,y) ( ((x) < (y)) ? (x) : (y) )
2537 +#define MAX(x,y) ( ((x) > (y)) ? (x) : (y) )
2538 +#define ABS(x) ( ((signed)(x) > 0) ? (x) : (-(x)) )
2539 +#define CEIL(x,y) ( ((x) + (y) / 2) / (y) )
2541 +#define CLKC_CLKCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x20 + (0x20 * (x)))
2542 +#define CLKC_CLKPLLCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x30 + (0x20 * (x)))
2544 +#define CLKC_PRE_DIVIDER 0x0000001F
2545 +#define CLKC_POST_DIVIDER 0x001F0000
2547 +#define CLKC_PLL_STATUS 0x1
2548 +#define CLKC_PLL_FACTOR 0x0000F000
2550 +#define BOOTCR_PLL_BYPASS (1 << 5)
2551 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
2553 +#define MIPS_PLL_SELECT 0x00030000
2554 +#define SYSTEM_PLL_SELECT 0x0000C000
2555 +#define USB_PLL_SELECT 0x000C0000
2556 +#define ADSLSS_PLL_SELECT 0x00C00000
2558 +#define MIPS_AFECLKI_SELECT 0x00000000
2559 +#define MIPS_REFCLKI_SELECT 0x00010000
2560 +#define MIPS_XTAL3IN_SELECT 0x00020000
2562 +#define SYSTEM_AFECLKI_SELECT 0x00000000
2563 +#define SYSTEM_REFCLKI_SELECT 0x00004000
2564 +#define SYSTEM_XTAL3IN_SELECT 0x00008000
2565 +#define SYSTEM_MIPSPLL_SELECT 0x0000C000
2567 +#define USB_SYSPLL_SELECT 0x00000000
2568 +#define USB_REFCLKI_SELECT 0x00040000
2569 +#define USB_XTAL3IN_SELECT 0x00080000
2570 +#define USB_MIPSPLL_SELECT 0x000C0000
2572 +#define ADSLSS_AFECLKI_SELECT 0x00000000
2573 +#define ADSLSS_REFCLKI_SELECT 0x00400000
2574 +#define ADSLSS_XTAL3IN_SELECT 0x00800000
2575 +#define ADSLSS_MIPSPLL_SELECT 0x00C00000
2577 +#define SYS_MAX CLK_MHZ(150)
2578 +#define SYS_MIN CLK_MHZ(1)
2580 +#define MIPS_SYNC_MAX SYS_MAX
2581 +#define MIPS_ASYNC_MAX CLK_MHZ(160)
2582 +#define MIPS_MIN CLK_MHZ(1)
2584 +#define USB_MAX CLK_MHZ(100)
2585 +#define USB_MIN CLK_MHZ(1)
2587 +#define ADSL_MAX CLK_MHZ(180)
2588 +#define ADSL_MIN CLK_MHZ(1)
2590 +#define PLL_MUL_MAXFACTOR 15
2591 +#define MAX_DIV_VALUE 32
2592 +#define MIN_DIV_VALUE 1
2594 +#define MIN_PLL_INP_FREQ CLK_MHZ(8)
2595 +#define MAX_PLL_INP_FREQ CLK_MHZ(100)
2597 +#define DIVIDER_LOCK_TIME 10100
2598 +#define PLL_LOCK_TIME 10100 * 75
2602 + /****************************************************************************
2603 + * DATA PURPOSE: PRIVATE Variables
2604 + **************************************************************************/
2605 + static u32 *clk_src[4];
2606 + static u32 mips_pll_out;
2607 + static u32 sys_pll_out;
2608 + static u32 afeclk_inp;
2609 + static u32 refclk_inp;
2610 + static u32 xtal_inp;
2611 + static u32 present_min;
2612 + static u32 present_max;
2614 + /* Forward References */
2615 + static u32 find_gcd(u32 min, u32 max);
2616 + static u32 compute_prediv( u32 divider, u32 min, u32 max);
2617 + static void get_val(u32 base_freq, u32 output_freq,u32 *multiplier, u32 *divider);
2618 + static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id);
2619 + static void find_approx(u32 *,u32 *,u32);
2621 + /****************************************************************************
2622 + * FUNCTION: tnetd73xx_clkc_init
2623 + ****************************************************************************
2624 + * Description: The routine initializes the internal variables depending on
2625 + * on the sources selected for different clocks.
2626 + ***************************************************************************/
2627 +void tnetd73xx_clkc_init(u32 afeclk, u32 refclk, u32 xtal3in)
2632 + afeclk_inp = afeclk;
2633 + refclk_inp = refclk;
2634 + xtal_inp = xtal3in;
2636 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & MIPS_PLL_SELECT;
2639 + case MIPS_AFECLKI_SELECT:
2640 + clk_src[CLKC_MIPS] = &afeclk_inp;
2643 + case MIPS_REFCLKI_SELECT:
2644 + clk_src[CLKC_MIPS] = &refclk_inp;
2647 + case MIPS_XTAL3IN_SELECT:
2648 + clk_src[CLKC_MIPS] = &xtal_inp;
2652 + clk_src[CLKC_MIPS] = 0;
2656 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & SYSTEM_PLL_SELECT;
2659 + case SYSTEM_AFECLKI_SELECT:
2660 + clk_src[CLKC_SYS] = &afeclk_inp;
2663 + case SYSTEM_REFCLKI_SELECT:
2664 + clk_src[CLKC_SYS] = &refclk_inp;
2667 + case SYSTEM_XTAL3IN_SELECT:
2668 + clk_src[CLKC_SYS] = &xtal_inp;
2671 + case SYSTEM_MIPSPLL_SELECT:
2672 + clk_src[CLKC_SYS] = &mips_pll_out;
2676 + clk_src[CLKC_SYS] = 0;
2681 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & ADSLSS_PLL_SELECT;
2684 + case ADSLSS_AFECLKI_SELECT:
2685 + clk_src[CLKC_ADSLSS] = &afeclk_inp;
2688 + case ADSLSS_REFCLKI_SELECT:
2689 + clk_src[CLKC_ADSLSS] = &refclk_inp;
2692 + case ADSLSS_XTAL3IN_SELECT:
2693 + clk_src[CLKC_ADSLSS] = &xtal_inp;
2696 + case ADSLSS_MIPSPLL_SELECT:
2697 + clk_src[CLKC_ADSLSS] = &mips_pll_out;
2701 + clk_src[CLKC_ADSLSS] = 0;
2706 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & USB_PLL_SELECT;
2709 + case USB_SYSPLL_SELECT:
2710 + clk_src[CLKC_USB] = &sys_pll_out ;
2713 + case USB_REFCLKI_SELECT:
2714 + clk_src[CLKC_USB] = &refclk_inp;
2717 + case USB_XTAL3IN_SELECT:
2718 + clk_src[CLKC_USB] = &xtal_inp;
2721 + case USB_MIPSPLL_SELECT:
2722 + clk_src[CLKC_USB] = &mips_pll_out;
2726 + clk_src[CLKC_USB] = 0;
2733 +/****************************************************************************
2734 + * FUNCTION: tnetd73xx_clkc_set_freq
2735 + ****************************************************************************
2736 + * Description: The above routine is called to set the output_frequency of the
2737 + * selected clock(using clk_id) to the required value given
2738 + * by the variable output_freq.
2739 + ***************************************************************************/
2740 +TNETD73XX_ERR tnetd73xx_clkc_set_freq
2742 + TNETD73XX_CLKC_ID_T clk_id,
2755 + /* check if PLLs are bypassed*/
2756 + if(REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS)
2758 + return TNETD73XX_ERR_ERROR;
2761 + /*check if the requested output_frequency is in valid range*/
2765 + if( output_freq < SYS_MIN || output_freq > SYS_MAX)
2767 + return TNETD73XX_ERR_ERROR;
2769 + present_min = SYS_MIN;
2770 + present_max = SYS_MAX;
2774 + if((output_freq < MIPS_MIN) ||
2775 + (output_freq > ((REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX)))
2777 + return TNETD73XX_ERR_ERROR;
2779 + present_min = MIPS_MIN;
2780 + present_max = (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX;
2784 + if( output_freq < USB_MIN || output_freq > USB_MAX)
2786 + return TNETD73XX_ERR_ERROR;
2788 + present_min = USB_MIN;
2789 + present_max = USB_MAX;
2793 + if( output_freq < ADSL_MIN || output_freq > ADSL_MAX)
2795 + return TNETD73XX_ERR_ERROR;
2797 + present_min = ADSL_MIN;
2798 + present_max = ADSL_MAX;
2803 + base_freq = get_base_frequency(clk_id);
2806 + /* check for minimum base frequency value */
2807 + if( base_freq < MIN_PLL_INP_FREQ)
2809 + return TNETD73XX_ERR_ERROR;
2812 + get_val(output_freq, base_freq, &multiplier, ÷r);
2814 + /* check multiplier range */
2815 + if( (multiplier > PLL_MUL_MAXFACTOR) || (multiplier <= 0) )
2817 + return TNETD73XX_ERR_ERROR;
2820 + /* check divider value */
2821 + if( divider == 0 )
2823 + return TNETD73XX_ERR_ERROR;
2826 + /*compute minimum and maximum predivider values */
2827 + min_prediv = MAX(base_freq / MAX_PLL_INP_FREQ + 1, divider / MAX_DIV_VALUE + 1);
2828 + max_prediv = MIN(base_freq / MIN_PLL_INP_FREQ, MAX_DIV_VALUE);
2830 + /*adjust the value of divider so that it not less than minimum predivider value*/
2831 + if (divider < min_prediv)
2833 + temp = CEIL(min_prediv, divider);
2834 + if ((temp * multiplier) > PLL_MUL_MAXFACTOR)
2836 + return TNETD73XX_ERR_ERROR ;
2840 + multiplier = temp * multiplier;
2841 + divider = min_prediv;
2846 + /* compute predivider and postdivider values */
2847 + prediv = compute_prediv (divider, min_prediv, max_prediv);
2848 + postdiv = CEIL(divider,prediv);
2850 + /*return fail if postdivider value falls out of range */
2851 + if(postdiv > MAX_DIV_VALUE)
2853 + return TNETD73XX_ERR_ERROR;
2857 + /*write predivider and postdivider values*/
2858 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2859 + REG32_WRITE(CLKC_CLKCR(clk_id), ((postdiv -1) & 0x1F) << 16 | ((prediv -1) & 0x1F) );
2861 + /*wait for divider output to stabilise*/
2862 + for(temp =0; temp < DIVIDER_LOCK_TIME; temp++);
2864 + /*write to PLL clock register*/
2866 + if(clk_id == CLKC_SYS)
2868 + /* but before writing put DRAM to hold mode */
2869 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) |= 0x80000000;
2871 + /*Bring PLL into div mode */
2872 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), 0x4);
2874 + /*compute the word to be written to PLLCR
2875 + *corresponding to multiplier value
2877 + multiplier = (((multiplier - 1) & 0xf) << 12)| ((255 <<3) | 0x0e);
2879 + /* wait till PLL enters div mode */
2880 + while(REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2883 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), multiplier);
2885 + while(!REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2889 + /*wait for External pll to lock*/
2890 + for(temp =0; temp < PLL_LOCK_TIME; temp++);
2892 + if(clk_id == CLKC_SYS)
2894 + /* Bring DRAM out of hold */
2895 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) &= ~0x80000000;
2898 + return TNETD73XX_ERR_OK ;
2901 +/****************************************************************************
2902 + * FUNCTION: tnetd73xx_clkc_get_freq
2903 + ****************************************************************************
2904 + * Description: The above routine is called to get the output_frequency of the
2905 + * selected clock( clk_id)
2906 + ***************************************************************************/
2907 +u32 tnetd73xx_clkc_get_freq
2909 + TNETD73XX_CLKC_ID_T clk_id
2913 + u32 clk_ctrl_register;
2914 + u32 clk_pll_setting;
2915 + u32 clk_predivider;
2916 + u32 clk_postdivider;
2921 + base_freq = get_base_frequency(clk_id);
2923 + clk_ctrl_register = REG32_DATA(CLKC_CLKCR(clk_id));
2925 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2926 + clk_predivider = (CLKC_PRE_DIVIDER & clk_ctrl_register) + 1;
2927 + clk_postdivider = ((CLKC_POST_DIVIDER & clk_ctrl_register) >> 16) + 1;
2929 + divider = clk_predivider * clk_postdivider;
2932 + if( (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS))
2934 + return (CEIL(base_freq, divider)); /* PLLs bypassed.*/
2940 + /* return the current clock speed based upon the PLL setting */
2941 + clk_pll_setting = REG32_DATA(CLKC_CLKPLLCR(clk_id));
2943 + /* Get the PLL multiplication factor */
2944 + pll_factor = ((clk_pll_setting & CLKC_PLL_FACTOR) >> 12) + 1;
2946 + /* Check if we're in divide mode or multiply mode */
2947 + if((clk_pll_setting & 0x1) == 0)
2949 + /* We're in divide mode */
2950 + if(pll_factor < 0x10)
2951 + return (CEIL(base_freq >> 1, divider));
2953 + return (CEIL(base_freq >> 2, divider));
2956 + else /* We're in PLL mode */
2958 + /* See if PLLNDIV & PLLDIV are set */
2959 + if((clk_pll_setting & 0x0800) && (clk_pll_setting & 0x2))
2961 + if(clk_pll_setting & 0x1000)
2963 + /* clk = base_freq * k/2 */
2964 + return(CEIL((base_freq * pll_factor) >> 1, divider));
2968 + /* clk = base_freq * (k-1) / 4)*/
2969 + return(CEIL((base_freq * (pll_factor - 1)) >>2, divider));
2974 + if(pll_factor < 0x10)
2976 + /* clk = base_freq * k */
2977 + return(CEIL(base_freq * pll_factor, divider));
2982 + /* clk = base_freq */
2983 + return(CEIL(base_freq, divider));
2987 + return(0); /* Should never reach here */
2994 +/* local helper functions */
2996 +/****************************************************************************
2997 + * FUNCTION: get_base_frequency
2998 + ****************************************************************************
2999 + * Description: The above routine is called to get base frequency of the clocks.
3000 + ***************************************************************************/
3002 +static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id)
3004 + /* update the current MIPs PLL output value, if the required
3005 + * source is MIPS PLL
3007 + if ( clk_src[clk_id] == &mips_pll_out)
3009 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_MIPS);
3013 + /* update the current System PLL output value, if the required
3014 + * source is system PLL
3016 + if ( clk_src[clk_id] == &sys_pll_out)
3018 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_SYS);
3021 + return (*clk_src[clk_id]);
3027 +/****************************************************************************
3028 + * FUNCTION: find_gcd
3029 + ****************************************************************************
3030 + * Description: The above routine is called to find gcd of 2 numbers.
3031 + ***************************************************************************/
3032 +static u32 find_gcd
3038 + if (max % min == 0)
3044 + return find_gcd(max % min, min);
3048 +/****************************************************************************
3049 + * FUNCTION: compute_prediv
3050 + ****************************************************************************
3051 + * Description: The above routine is called to compute predivider value
3052 + ***************************************************************************/
3053 +static u32 compute_prediv(u32 divider, u32 min, u32 max)
3057 + /* return the divider itself it it falls within the range of predivider*/
3058 + if (min <= divider && divider <= max)
3063 + /* find a value for prediv such that it is a factor of divider */
3064 + for (prediv = max; prediv >= min ; prediv--)
3066 + if ( (divider % prediv) == 0 )
3072 + /* No such factor exists, return min as prediv */
3076 +/****************************************************************************
3077 + * FUNCTION: get_val
3078 + ****************************************************************************
3079 + * Description: This routine is called to get values of divider and multiplier.
3080 + ***************************************************************************/
3082 +static void get_val(u32 output_freq, u32 base_freq,u32 *multiplier, u32 *divider)
3090 + /* find gcd of base_freq, output_freq */
3091 + min_freq = (base_freq < output_freq) ? base_freq : output_freq;
3092 + max_freq = (base_freq > output_freq) ? base_freq : output_freq;
3093 + gcd = find_gcd(min_freq , max_freq);
3096 + return; /* ERROR */
3098 + /* compute values of multiplier and divider */
3099 + temp_mul = output_freq / gcd;
3100 + temp_div = base_freq / gcd;
3103 + /* set multiplier such that 1 <= multiplier <= PLL_MUL_MAXFACTOR */
3104 + if( temp_mul > PLL_MUL_MAXFACTOR )
3106 + if((temp_mul / temp_div) > PLL_MUL_MAXFACTOR)
3109 + find_approx(&temp_mul,&temp_div,base_freq);
3112 + *multiplier = temp_mul;
3113 + *divider = temp_div;
3116 +/****************************************************************************
3117 + * FUNCTION: find_approx
3118 + ****************************************************************************
3119 + * Description: This function gets the approx value of num/denom.
3120 + ***************************************************************************/
3122 +static void find_approx(u32 *num,u32 *denom,u32 base_freq)
3129 + int32_t prev_closest;
3139 + prev_closest = 0x7fffffff; /* maximum possible value */
3143 + /* start with max */
3144 + for(temp_num = 15; temp_num >=1; temp_num--)
3147 + temp_denom = CEIL(temp_num * denom1, num1);
3148 + output_freq = (temp_num * base_freq) / temp_denom;
3150 + if(temp_denom < 1)
3156 + normalize = CEIL(num1,temp_num);
3157 + closest = (ABS((num1 * (temp_denom) ) - (temp_num * denom1))) * normalize;
3158 + if(closest < prev_closest && output_freq > present_min && output_freq <present_max)
3160 + prev_closest = closest;
3162 + denom2 = temp_denom;
3169 + gcd = find_gcd(num2,denom2);
3170 + num2 = num2 / gcd;
3171 + denom2 = denom2 /gcd;
3178 +/*****************************************************************************
3180 + *****************************************************************************/
3182 +/****************************************************************************
3183 + * FUNCTION: tnetd73xx_gpio_init
3184 + ***************************************************************************/
3185 +void tnetd73xx_gpio_init()
3187 + /* Bring module out of reset */
3188 + tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
3189 + REG32_WRITE(TNETD73XX_GPIOENR, 0xFFFFFFFF);
3192 +/****************************************************************************
3193 + * FUNCTION: tnetd73xx_gpio_ctrl
3194 + ***************************************************************************/
3195 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
3196 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
3197 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction)
3200 + REG32_READ(TNETD73XX_GPIOENR, pin_status);
3201 + if (pin_mode == GPIO_PIN)
3203 + pin_status |= (1 << gpio_pin);
3204 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
3206 + /* Set pin direction */
3207 + REG32_READ(TNETD73XX_GPIOPDIRR, pin_status);
3208 + if (pin_direction == GPIO_INPUT_PIN)
3210 + pin_status |= (1 << gpio_pin);
3212 + else /* GPIO_OUTPUT_PIN */
3214 + pin_status &= (~(1 << gpio_pin));
3216 + REG32_WRITE(TNETD73XX_GPIOPDIRR, pin_status);
3218 + else /* FUNCTIONAL PIN */
3220 + pin_status &= (~(1 << gpio_pin));
3221 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
3226 +/****************************************************************************
3227 + * FUNCTION: tnetd73xx_gpio_out
3228 + ***************************************************************************/
3229 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value)
3233 + REG32_READ(TNETD73XX_GPIODOUTR, pin_value);
3236 + pin_value |= (1 << gpio_pin);
3240 + pin_value &= (~(1 << gpio_pin));
3242 + REG32_WRITE(TNETD73XX_GPIODOUTR, pin_value);
3245 +/****************************************************************************
3246 + * FUNCTION: tnetd73xx_gpio_in
3247 + ***************************************************************************/
3248 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin)
3251 + REG32_READ(TNETD73XX_GPIODINR, pin_value);
3252 + return ( (pin_value & (1 << gpio_pin)) ? 1 : 0 );
3255 diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared.in
3256 --- linux.old/arch/mips/config-shared.in 2005-07-26 18:18:16.263581096 +0200
3257 +++ linux.dev/arch/mips/config-shared.in 2005-07-26 18:38:00.089612184 +0200
3259 mainmenu_option next_comment
3260 comment 'Machine selection'
3261 dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL
3262 +dep_bool 'Support for Texas Instruments AR7 (EXPERIMENTAL)' CONFIG_AR7 $CONFIG_MIPS32 $CONFIG_EXPERIMENTAL
3263 +if [ "$CONFIG_AR7" = "y" ]; then
3264 + choice 'Texas Instruments Reference Platform' \
3265 + "AR7DB CONFIG_AR7DB \
3266 + AR7RD CONFIG_AR7RD \
3267 + AR7WRD CONFIG_AR7WRD" AR7DB
3268 + int 'Texas Instruments AR7 CPU Frequency' CONFIG_AR7_CPU 150
3269 + int 'Texas Instruments AR7 System Frequency' CONFIG_AR7_SYS 125
3270 + hex 'Texas Instruments AR7 SDRAM Start' CONFIG_AR7_MEMORY 0x14000000
3272 dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32
3273 dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32
3274 dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32
3275 @@ -239,6 +249,11 @@
3276 define_bool CONFIG_NONCOHERENT_IO y
3277 define_bool CONFIG_PC_KEYB y
3279 +if [ "$CONFIG_AR7" = "y" ]; then
3280 + define_bool CONFIG_NONCOHERENT_IO y
3281 + define_bool CONFIG_SWAP_IO_SPACE y
3282 + define_bool CONFIG_AR7_PAGING y
3284 if [ "$CONFIG_CASIO_E55" = "y" ]; then
3285 define_bool CONFIG_IRQ_CPU y
3286 define_bool CONFIG_NONCOHERENT_IO y
3288 mainmenu_option next_comment
3289 comment 'General setup'
3290 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
3291 + "$CONFIG_AR7" = "y" -o \
3292 "$CONFIG_CASIO_E55" = "y" -o \
3293 "$CONFIG_DDB5074" = "y" -o \
3294 "$CONFIG_DDB5476" = "y" -o \
3296 bool 'Networking support' CONFIG_NET
3298 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
3299 + "$CONFIG_AR7" = "y" -o \
3300 "$CONFIG_CASIO_E55" = "y" -o \
3301 "$CONFIG_DECSTATION" = "y" -o \
3302 "$CONFIG_IBM_WORKPAD" = "y" -o \
3303 diff -urN linux.old/arch/mips/kernel/irq.c linux.dev/arch/mips/kernel/irq.c
3304 --- linux.old/arch/mips/kernel/irq.c 2005-07-26 18:18:16.264580944 +0200
3305 +++ linux.dev/arch/mips/kernel/irq.c 2005-07-26 18:11:02.632503000 +0200
3307 * Generic, controller-independent functions:
3311 int get_irq_list(char *buf)
3315 p += sprintf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
3321 int global_irq_holder = NO_PROC_ID;
3327 int request_irq(unsigned int irq,
3328 void (*handler)(int, void *, struct pt_regs *),
3329 unsigned long irqflags,
3337 * free_irq - free an interrupt
3343 void free_irq(unsigned int irq, void *dev_id)
3353 * IRQ autodetection code..
3354 diff -urN linux.old/arch/mips/kernel/mips_ksyms.c linux.dev/arch/mips/kernel/mips_ksyms.c
3355 --- linux.old/arch/mips/kernel/mips_ksyms.c 2005-07-26 18:18:16.265580792 +0200
3356 +++ linux.dev/arch/mips/kernel/mips_ksyms.c 2005-07-26 18:11:02.633502000 +0200
3358 extern long __strnlen_user_nocheck_asm(const char *s);
3359 extern long __strnlen_user_asm(const char *s);
3362 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num, unsigned int pace_value);
3363 +char *prom_getenv(char *envname);
3367 EXPORT_SYMBOL(mips_machtype);
3369 EXPORT_SYMBOL(EISA_bus);
3373 EXPORT_SYMBOL(get_wchan);
3376 +EXPORT_SYMBOL_NOVERS(avalanche_request_pacing);
3377 +EXPORT_SYMBOL_NOVERS(prom_getenv);
3380 diff -urN linux.old/arch/mips/kernel/setup.c linux.dev/arch/mips/kernel/setup.c
3381 --- linux.old/arch/mips/kernel/setup.c 2005-07-26 18:18:16.265580792 +0200
3382 +++ linux.dev/arch/mips/kernel/setup.c 2005-07-26 18:38:00.090612032 +0200
3384 unsigned long isa_slot_offset;
3385 EXPORT_SYMBOL(isa_slot_offset);
3387 +extern void avalanche_bootmem_init(void);
3388 extern void SetUpBootInfo(void);
3389 extern void load_mmu(void);
3390 extern asmlinkage void start_kernel(void);
3392 #endif /* CONFIG_BLK_DEV_INITRD */
3394 /* Find the highest page frame number we have available. */
3395 +#ifdef CONFIG_AR7_PAGING
3396 + avalanche_bootmem_init();
3399 first_usable_pfn = -1UL;
3400 for (i = 0; i < boot_mem_map.nr_map; i++) {
3402 /* Reserve the bootmap memory. */
3403 reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
3406 #ifdef CONFIG_BLK_DEV_INITRD
3407 /* Board specific code should have set up initrd_start and initrd_end */
3408 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
3410 void hp_setup(void);
3411 void au1x00_setup(void);
3412 void frame_info_init(void);
3413 + void ar7_setup(void);
3416 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
3417 @@ -691,6 +697,11 @@
3418 pmc_yosemite_setup();
3422 + case MACH_GROUP_UNKNOWN:
3427 panic("Unsupported architecture");
3429 diff -urN linux.old/arch/mips/kernel/traps.c linux.dev/arch/mips/kernel/traps.c
3430 --- linux.old/arch/mips/kernel/traps.c 2005-07-26 18:18:16.267580488 +0200
3431 +++ linux.dev/arch/mips/kernel/traps.c 2005-07-26 18:38:00.091611880 +0200
3432 @@ -869,9 +869,15 @@
3434 exception_handlers[n] = handler;
3435 if (n == 0 && cpu_has_divec) {
3437 + *(volatile u32 *)((KSEG0+CONFIG_AR7_MEMORY)+0x200) = 0x08000000 |
3438 + (0x03ffffff & (handler >> 2));
3439 + flush_icache_range((KSEG0+CONFIG_AR7_MEMORY)+0x200, (KSEG0+CONFIG_AR7_MEMORY) + 0x204);
3441 *(volatile u32 *)(KSEG0+0x200) = 0x08000000 |
3442 (0x03ffffff & (handler >> 2));
3443 flush_icache_range(KSEG0+0x200, KSEG0 + 0x204);
3446 return (void *)old_handler;
3448 @@ -920,14 +926,46 @@
3449 void __init trap_init(void)
3451 extern char except_vec1_generic;
3452 + extern char except_vec2_generic;
3453 extern char except_vec3_generic, except_vec3_r4000;
3454 extern char except_vec_ejtag_debug;
3455 extern char except_vec4;
3459 + extern char jump_tlb_miss, jump_tlb_miss_unused;
3460 + extern char jump_cache_error,jump_general_exception;
3461 + extern char jump_dedicated_interrupt;
3462 + clear_c0_status(ST0_BEV);
3465 /* Copy the generic exception handler code to it's final destination. */
3466 memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
3467 + memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
3468 + memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
3470 + memcpy((void *)(KSEG0 + 0x0), &jump_tlb_miss, 0x80);
3471 + memcpy((void *)(KSEG0 + 0x80), &jump_tlb_miss_unused, 0x80);
3472 + memcpy((void *)(KSEG0 + 0x100), &jump_cache_error, 0x80);
3473 + memcpy((void *)(KSEG0 + 0x180), &jump_general_exception, 0x80);
3474 + memcpy((void *)(KSEG0 + 0x200), &jump_dedicated_interrupt, 0x80);
3477 + memcpy((void *)((KSEG0+CONFIG_AR7_MEMORY) + 0x80), &except_vec1_generic, 0x80);
3478 + memcpy((void *)((KSEG0+CONFIG_AR7_MEMORY) + 0x100), &except_vec2_generic, 0x80);
3479 + memcpy((void *)((KSEG0+CONFIG_AR7_MEMORY) + 0x180), &except_vec3_generic, 0x80);
3480 + flush_icache_range((KSEG0+CONFIG_AR7_MEMORY), (KSEG0+CONFIG_AR7_MEMORY) + 0x200);
3482 + memcpy((void *)(KSEG0 + 0x0), &jump_tlb_miss, 0x80);
3483 + memcpy((void *)(KSEG0 + 0x80), &jump_tlb_miss_unused, 0x80);
3484 + memcpy((void *)(KSEG0 + 0x100), &jump_cache_error, 0x80);
3485 + memcpy((void *)(KSEG0 + 0x180), &jump_general_exception, 0x80);
3486 + memcpy((void *)(KSEG0 + 0x200), &jump_dedicated_interrupt, 0x80);
3488 + memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
3490 + flush_icache_range(KSEG0 + 0x80, KSEG0 + 0x200);
3493 * Setup default vectors
3495 @@ -951,8 +989,12 @@
3496 * Some MIPS CPUs have a dedicated interrupt vector which reduces the
3497 * interrupt processing overhead. Use it where available.
3500 + memcpy((void *)((KSEG0+CONFIG_AR7_MEMORY) + 0x200), &except_vec4, 8);
3503 memcpy((void *)(KSEG0 + 0x200), &except_vec4, 8);
3507 * Some CPUs can enable/disable for cache parity detection, but does
3508 @@ -991,12 +1033,17 @@
3510 set_except_vector(24, handle_mcheck);
3512 +memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
3514 + memcpy((void *)((KSEG0+CONFIG_AR7_MEMORY) + 0x180), &except_vec3_generic, 0x80);
3517 memcpy((void *)(KSEG0 + 0x180), &except_vec3_r4000, 0x80);
3518 else if (cpu_has_4kex)
3519 memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, 0x80);
3521 memcpy((void *)(KSEG0 + 0x080), &except_vec3_generic, 0x80);
3524 if (current_cpu_data.cputype == CPU_R6000 ||
3525 current_cpu_data.cputype == CPU_R6000A) {
3526 @@ -1023,7 +1070,11 @@
3527 if (board_nmi_handler_setup)
3528 board_nmi_handler_setup();
3531 + flush_icache_range((KSEG0+CONFIG_AR7_MEMORY), (KSEG0+CONFIG_AR7_MEMORY) + 0x200);
3533 flush_icache_range(KSEG0, KSEG0 + 0x400);
3536 per_cpu_trap_init();
3538 diff -urN linux.old/arch/mips/lib/promlib.c linux.dev/arch/mips/lib/promlib.c
3539 --- linux.old/arch/mips/lib/promlib.c 2005-07-26 18:18:16.267580488 +0200
3540 +++ linux.dev/arch/mips/lib/promlib.c 2005-07-26 18:11:02.635502000 +0200
3544 #include <linux/kernel.h>
3551 diff -urN linux.old/arch/mips/mm/init.c linux.dev/arch/mips/mm/init.c
3552 --- linux.old/arch/mips/mm/init.c 2005-07-26 18:18:16.268580336 +0200
3553 +++ linux.dev/arch/mips/mm/init.c 2005-07-26 18:38:00.091611880 +0200
3558 +#ifndef CONFIG_AR7_PAGING
3559 void __init paging_init(void)
3561 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
3564 free_area_init(zones_size);
3568 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
3569 #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
3574 +#ifndef CONFIG_AR7_PAGING
3575 void __init mem_init(void)
3577 unsigned long codesize, reservedpages, datasize, initsize;
3580 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
3584 #ifdef CONFIG_BLK_DEV_INITRD
3585 void free_initrd_mem(unsigned long start, unsigned long end)
3587 (&__init_end - &__init_begin) >> 10);
3590 +#ifndef CONFIG_AR7_PAGING
3591 void si_meminfo(struct sysinfo *val)
3593 val->totalram = totalram_pages;
3599 diff -urN linux.old/arch/mips/mm/tlb-r4k.c linux.dev/arch/mips/mm/tlb-r4k.c
3600 --- linux.old/arch/mips/mm/tlb-r4k.c 2005-07-26 18:18:16.269580184 +0200
3601 +++ linux.dev/arch/mips/mm/tlb-r4k.c 2005-07-26 18:38:00.092611728 +0200
3602 @@ -375,7 +375,12 @@
3603 else if (current_cpu_data.cputype == CPU_R4600)
3604 memcpy((void *)KSEG0, &except_vec0_r4600, 0x80);
3607 + memcpy((void *)(KSEG0+CONFIG_AR7_MEMORY), &except_vec0_r4000, 0x80);
3608 + flush_icache_range((KSEG0+CONFIG_AR7_MEMORY), (KSEG0+CONFIG_AR7_MEMORY) + 0x80);
3610 memcpy((void *)KSEG0, &except_vec0_r4000, 0x80);
3611 flush_icache_range(KSEG0, KSEG0 + 0x80);
3615 diff -urN linux.old/drivers/char/serial.c linux.dev/drivers/char/serial.c
3616 --- linux.old/drivers/char/serial.c 2005-07-26 18:18:16.274579424 +0200
3617 +++ linux.dev/drivers/char/serial.c 2005-07-26 18:38:00.096611120 +0200
3618 @@ -419,7 +419,40 @@
3622 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3623 +#if defined(CONFIG_AR7)
3625 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
3627 + return (inb(info->port + (offset * 4)) & 0xff);
3631 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
3633 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3634 + return (inb(info->port + (offset * 4)) & 0xff);
3636 + return (inb_p(info->port + (offset * 4)) & 0xff);
3640 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
3642 + outb(value, info->port + (offset * 4));
3646 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
3649 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3650 + outb(value, info->port + (offset * 4));
3652 + outb_p(value, info->port + (offset * 4));
3656 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3658 #include <asm/mips-boards/atlas.h>
3660 @@ -478,8 +511,10 @@
3661 * needed for certain old 386 machines, I've left these #define's
3665 #define serial_inp(info, offset) serial_in(info, offset)
3666 #define serial_outp(info, offset, value) serial_out(info, offset, value)
3671 @@ -1728,7 +1763,15 @@
3672 /* Special case since 134 is really 134.5 */
3673 quot = (2*baud_base / 269);
3676 + quot = (CONFIG_AR7_SYS*500000) / baud;
3682 quot = baud_base / baud;
3685 /* If the quotient is zero refuse the change */
3686 if (!quot && old_termios) {
3687 @@ -5552,8 +5595,10 @@
3688 state->irq = irq_cannonicalize(state->irq);
3690 state->io_type = SERIAL_IO_HUB6;
3692 if (state->port && check_region(state->port,8))
3696 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
3698 @@ -6009,7 +6054,15 @@
3699 info->io_type = state->io_type;
3700 info->iomem_base = state->iomem_base;
3701 info->iomem_reg_shift = state->iomem_reg_shift;
3703 + quot = (CONFIG_AR7_SYS*500000) / baud;
3709 quot = state->baud_base / baud;
3711 cval = cflag & (CSIZE | CSTOPB);
3712 #if defined(__powerpc__) || defined(__alpha__)
3714 diff -urN linux.old/include/asm-mips/ar7/ar7.h linux.dev/include/asm-mips/ar7/ar7.h
3715 --- linux.old/include/asm-mips/ar7/ar7.h 1970-01-01 01:00:00.000000000 +0100
3716 +++ linux.dev/include/asm-mips/ar7/ar7.h 2005-07-26 18:11:02.643501000 +0200
3720 + * Copyright (C) $Date$ $Author$
3722 + * This program is free software; you can redistribute it and/or modify
3723 + * it under the terms of the GNU General Public License as published by
3724 + * the Free Software Foundation; either version 2 of the License, or
3725 + * (at your option) any later version.
3727 + * This program is distributed in the hope that it will be useful,
3728 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3729 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3730 + * GNU General Public License for more details.
3732 + * You should have received a copy of the GNU General Public License
3733 + * along with this program; if not, write to the Free Software
3734 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3741 +#include <asm/addrspace.h>
3742 +#include <linux/config.h>
3744 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(CONFIG_AR7_MEMORY))
3746 +#define AR7_UART0_REGS_BASE (KSEG1ADDR(0x08610E00))
3747 +#define AR7_UART1_REGS_BASE (KSEG1ADDR(0x08610F00))
3748 +#define AR7_BASE_BAUD ( 3686400 / 16 )
3751 diff -urN linux.old/include/asm-mips/ar7/avalanche_intc.h linux.dev/include/asm-mips/ar7/avalanche_intc.h
3752 --- linux.old/include/asm-mips/ar7/avalanche_intc.h 1970-01-01 01:00:00.000000000 +0100
3753 +++ linux.dev/include/asm-mips/ar7/avalanche_intc.h 2005-07-26 18:38:00.097610968 +0200
3756 + * Nitin Dhingra, iamnd@ti.com
3757 + * Copyright (C) 2000 Texas Instruments Inc.
3760 + * ########################################################################
3762 + * This program is free software; you can distribute it and/or modify it
3763 + * under the terms of the GNU General Public License (Version 2) as
3764 + * published by the Free Software Foundation.
3766 + * This program is distributed in the hope it will be useful, but WITHOUT
3767 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3768 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3769 + * for more details.
3771 + * You should have received a copy of the GNU General Public License along
3772 + * with this program; if not, write to the Free Software Foundation, Inc.,
3773 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
3775 + * ########################################################################
3777 + * Defines of the Sead board specific address-MAP, registers, etc.
3780 +#ifndef _AVALANCHE_INTC_H
3781 +#define _AVALANCHE_INTC_H
3785 +#define KSEG1_BASE 0xA0000000
3786 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
3787 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
3788 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
3789 +#define AVALANCHE_INTC_BASE PHYS_TO_K1(0x08612400)
3793 +#define MIPS_EXCEPTION_OFFSET 8
3795 +/******************************************************************************
3796 + Avalanche Interrupt number
3797 +******************************************************************************/
3798 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
3800 +/*******************************************************************************
3801 +*Linux Interrupt number
3802 +*******************************************************************************/
3803 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3807 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
3808 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
3810 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
3811 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
3814 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
3815 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
3816 + + MIPS_EXCEPTION_OFFSET - 1) /* Suraj, check */
3820 + * Avalanche interrupt controller register base (primary)
3822 +#define AVALANCHE_ICTRL_REGS_BASE AVALANCHE_INTC_BASE
3824 +/******************************************************************************
3825 + * Avalanche exception controller register base (secondary)
3826 + ******************************************************************************/
3827 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
3830 +/******************************************************************************
3831 + * Avalanche Interrupt pacing register base (secondary)
3832 + ******************************************************************************/
3833 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
3837 +/******************************************************************************
3838 + * Avalanche Interrupt Channel Control register base
3839 + *****************************************************************************/
3840 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
3843 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
3845 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 0x00 */
3846 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 0x04 */
3847 + volatile unsigned long unused1; /*0x08 */
3848 + volatile unsigned long unused2; /*0x0C */
3849 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 0x10 */
3850 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 0x14 */
3851 + volatile unsigned long unused3; /*0x18 */
3852 + volatile unsigned long unused4; /*0x1C */
3853 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 0x20 */
3854 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 0x24 */
3855 + volatile unsigned long unused5; /*0x28 */
3856 + volatile unsigned long unused6; /*0x2C */
3857 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 0x30 */
3858 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 0x34 */
3859 + volatile unsigned long unused7; /* 0x38 */
3860 + volatile unsigned long unused8; /* 0x3c */
3861 + volatile unsigned long pintir; /* Priority Interrupt Index Register 0x40 */
3862 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg 0x44 */
3863 + volatile unsigned long unused9; /* 0x48 */
3864 + volatile unsigned long unused10; /* 0x4C */
3865 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 10x50 */
3866 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 20x54 */
3867 + volatile unsigned long unused11; /* 0x58 */
3868 + volatile unsigned long unused12; /*0x5C */
3869 + volatile unsigned long inttypr1; /* Interrupt Type Mask register 10x60 */
3870 + volatile unsigned long inttypr2; /* Interrupt Type Mask register 20x64 */
3873 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
3875 + volatile unsigned long exsr; /* Exceptions Status/Set register 0x80 */
3876 + volatile unsigned long reserved; /*0x84 */
3877 + volatile unsigned long excr; /* Exceptions Clear Register 0x88 */
3878 + volatile unsigned long reserved1; /*0x8c */
3879 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) 0x90 */
3880 + volatile unsigned long reserved2; /*0x94 */
3881 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable(clear)0x98 */
3883 +struct avalanche_ipace_regs
3886 + volatile unsigned long ipacep; /* Interrupt pacing register 0xa0 */
3887 + volatile unsigned long ipacemap; /*Interrupt Pacing Map Register 0xa4 */
3888 + volatile unsigned long ipacemax; /*Interrupt Pacing Max Register 0xa8 */
3890 +struct avalanche_channel_int_number
3892 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register0x200 */
3893 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register0x204 */
3894 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register0x208 */
3895 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register0x20C */
3896 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register0x210 */
3897 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register0x214 */
3898 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register0x218 */
3899 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register0x21C */
3900 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register0x220 */
3901 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register0x224 */
3902 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register0x228 */
3903 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register0x22C */
3904 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register0x230 */
3905 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register0x234 */
3906 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register0x238 */
3907 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register0x23C */
3908 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register0x240 */
3909 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register0x244 */
3910 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register0x248 */
3911 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register0x24C */
3912 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register0x250 */
3913 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register0x254 */
3914 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register0x358 */
3915 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register0x35C */
3916 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register0x260 */
3917 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register0x264 */
3918 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register0x268 */
3919 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register0x26C */
3920 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register0x270 */
3921 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register0x274 */
3922 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register0x278 */
3923 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register0x27C */
3924 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register0x280 */
3925 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register0x284 */
3926 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register0x288 */
3927 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register0x28C */
3928 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register0x290 */
3929 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register0x294 */
3930 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register0x298 */
3931 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register0x29C */
3934 +struct avalanche_interrupt_line_to_channel
3936 + unsigned long int_line0; /* Start of primary interrupts */
3937 + unsigned long int_line1;
3938 + unsigned long int_line2;
3939 + unsigned long int_line3;
3940 + unsigned long int_line4;
3941 + unsigned long int_line5;
3942 + unsigned long int_line6;
3943 + unsigned long int_line7;
3944 + unsigned long int_line8;
3945 + unsigned long int_line9;
3946 + unsigned long int_line10;
3947 + unsigned long int_line11;
3948 + unsigned long int_line12;
3949 + unsigned long int_line13;
3950 + unsigned long int_line14;
3951 + unsigned long int_line15;
3952 + unsigned long int_line16;
3953 + unsigned long int_line17;
3954 + unsigned long int_line18;
3955 + unsigned long int_line19;
3956 + unsigned long int_line20;
3957 + unsigned long int_line21;
3958 + unsigned long int_line22;
3959 + unsigned long int_line23;
3960 + unsigned long int_line24;
3961 + unsigned long int_line25;
3962 + unsigned long int_line26;
3963 + unsigned long int_line27;
3964 + unsigned long int_line28;
3965 + unsigned long int_line29;
3966 + unsigned long int_line30;
3967 + unsigned long int_line31;
3968 + unsigned long int_line32;
3969 + unsigned long int_line33;
3970 + unsigned long int_line34;
3971 + unsigned long int_line35;
3972 + unsigned long int_line36;
3973 + unsigned long int_line37;
3974 + unsigned long int_line38;
3975 + unsigned long int_line39;
3979 +/* Interrupt Line #'s (Sangam peripherals) */
3981 +/*------------------------------*/
3982 +/* Sangam primary interrupts */
3983 +/*------------------------------*/
3985 +#define UNIFIED_SECONDARY_INTERRUPT 0
3986 +#define AVALANCHE_EXT_INT_0 1
3987 +#define AVALANCHE_EXT_INT_1 2
3988 +/* Line #3 Reserved */
3989 +/* Line #4 Reserved */
3990 +#define AVALANCHE_TIMER_0_INT 5
3991 +#define AVALANCHE_TIMER_1_INT 6
3992 +#define AVALANCHE_UART0_INT 7
3993 +#define AVALANCHE_UART1_INT 8
3994 +#define AVALANCHE_PDMA_INT0 9
3995 +#define AVALANCHE_PDMA_INT1 10
3996 +/* Line #11 Reserved */
3997 +/* Line #12 Reserved */
3998 +/* Line #13 Reserved */
3999 +/* Line #14 Reserved */
4000 +#define AVALANCHE_ATM_SAR_INT 15
4001 +/* Line #16 Reserved */
4002 +/* Line #17 Reserved */
4003 +/* Line #18 Reserved */
4004 +#define AVALANCHE_MAC0_INT 19
4005 +/* Line #20 Reserved */
4006 +#define AVALANCHE_VLYNQ0_INT 21
4007 +#define AVALANCHE_CODEC_WAKE_INT 22
4008 +/* Line #23 Reserved */
4009 +#define AVALANCHE_USB_INT 24
4010 +#define AVALANCHE_VLYNQ1_INT 25
4011 +/* Line #26 Reserved */
4012 +/* Line #27 Reserved */
4013 +#define AVALANCHE_MAC1_INT 28
4014 +#define AVALANCHE_I2CM_INT 29
4015 +#define AVALANCHE_PDMA_INT2 30
4016 +#define AVALANCHE_PDMA_INT3 31
4017 +/* Line #32 Reserved */
4018 +/* Line #33 Reserved */
4019 +/* Line #34 Reserved */
4020 +/* Line #35 Reserved */
4021 +/* Line #36 Reserved */
4022 +#define AVALANCHE_VDMA_VT_RX_INT 37
4023 +#define AVALANCHE_VDMA_VT_TX_INT 38
4024 +#define AVALANCHE_ADSLSS_INT 39
4026 +/*-----------------------------------*/
4027 +/* Sangam Secondary Interrupts */
4028 +/*-----------------------------------*/
4029 +#define PRIMARY_INTS 40
4031 +#define EMIF_INT (7 + PRIMARY_INTS)
4034 +extern void avalanche_int_set(int channel, int line);
4037 +#endif /* _AVALANCHE_INTC_H */
4038 diff -urN linux.old/include/asm-mips/ar7/avalanche_misc.h linux.dev/include/asm-mips/ar7/avalanche_misc.h
4039 --- linux.old/include/asm-mips/ar7/avalanche_misc.h 1970-01-01 01:00:00.000000000 +0100
4040 +++ linux.dev/include/asm-mips/ar7/avalanche_misc.h 2005-07-26 18:11:02.645501000 +0200
4042 +#ifndef _AVALANCHE_MISC_H_
4043 +#define _AVALANCHE_MISC_H_
4045 +typedef enum AVALANCHE_ERR_t
4047 + AVALANCHE_ERR_OK = 0, /* OK or SUCCESS */
4048 + AVALANCHE_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
4050 + /* Pointers and args */
4051 + AVALANCHE_ERR_INVARG = -2, /* Invaild argument to the call */
4052 + AVALANCHE_ERR_NULLPTR = -3, /* NULL pointer */
4053 + AVALANCHE_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
4055 + /* Memory issues */
4056 + AVALANCHE_ERR_ALLOC_FAIL = -10, /* allocation failed */
4057 + AVALANCHE_ERR_FREE_FAIL = -11, /* free failed */
4058 + AVALANCHE_ERR_MEM_CORRUPT = -12, /* corrupted memory */
4059 + AVALANCHE_ERR_BUF_LINK = -13, /* buffer linking failed */
4061 + /* Device issues */
4062 + AVALANCHE_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
4063 + AVALANCHE_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
4065 + AVALANCHE_ERR_INVID = -30 /* Invalid ID */
4069 +/*****************************************************************************
4070 + * Reset Control Module
4071 + *****************************************************************************/
4073 +typedef enum AVALANCHE_RESET_MODULE_tag
4075 + RESET_MODULE_UART0 = 0,
4076 + RESET_MODULE_UART1 = 1,
4077 + RESET_MODULE_I2C = 2,
4078 + RESET_MODULE_TIMER0 = 3,
4079 + RESET_MODULE_TIMER1 = 4,
4080 + RESET_MODULE_GPIO = 6,
4081 + RESET_MODULE_ADSLSS = 7,
4082 + RESET_MODULE_USBS = 8,
4083 + RESET_MODULE_SAR = 9,
4084 + RESET_MODULE_VDMA_VT = 11,
4085 + RESET_MODULE_FSER = 12,
4086 + RESET_MODULE_VLYNQ1 = 16,
4087 + RESET_MODULE_EMAC0 = 17,
4088 + RESET_MODULE_DMA = 18,
4089 + RESET_MODULE_BIST = 19,
4090 + RESET_MODULE_VLYNQ0 = 20,
4091 + RESET_MODULE_EMAC1 = 21,
4092 + RESET_MODULE_MDIO = 22,
4093 + RESET_MODULE_ADSLSS_DSP = 23,
4094 + RESET_MODULE_EPHY = 26
4095 +} AVALANCHE_RESET_MODULE_T;
4097 +typedef enum AVALANCHE_RESET_CTRL_tag
4101 +} AVALANCHE_RESET_CTRL_T;
4103 +typedef enum AVALANCHE_SYS_RST_MODE_tag
4105 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
4106 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
4107 +} AVALANCHE_SYS_RST_MODE_T;
4109 +typedef enum AVALANCHE_SYS_RESET_STATUS_tag
4111 + HARDWARE_RESET = 0,
4112 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
4114 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
4115 +} AVALANCHE_SYS_RESET_STATUS_T;
4117 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(AVALANCHE_RESET_MODULE_T reset_module);
4118 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode);
4119 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status(void);
4121 +typedef int (*REMOTE_VLYNQ_DEV_RESET_CTRL_FN)(unsigned int reset_module, AVALANCHE_RESET_CTRL_T reset_ctrl);
4123 +/*****************************************************************************
4124 + * Power Control Module
4125 + *****************************************************************************/
4127 +typedef enum AVALANCHE_POWER_CTRL_tag
4129 + POWER_CTRL_POWER_UP = 0,
4130 + POWER_CTRL_POWER_DOWN
4131 +} AVALANCHE_POWER_CTRL_T;
4133 +typedef enum AVALANCHE_SYS_POWER_MODE_tag
4135 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
4136 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
4137 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
4138 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
4139 +} AVALANCHE_SYS_POWER_MODE_T;
4141 +void avalanche_power_ctrl(unsigned int power_module, AVALANCHE_POWER_CTRL_T power_ctrl);
4142 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int power_module);
4143 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode);
4144 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void);
4146 +/*****************************************************************************
4148 + *****************************************************************************/
4150 +typedef enum AVALANCHE_WAKEUP_INTERRUPT_tag
4156 +} AVALANCHE_WAKEUP_INTERRUPT_T;
4158 +typedef enum TNETV1050_WAKEUP_CTRL_tag
4160 + WAKEUP_DISABLED = 0,
4162 +} AVALANCHE_WAKEUP_CTRL_T;
4164 +typedef enum TNETV1050_WAKEUP_POLARITY_tag
4166 + WAKEUP_ACTIVE_HIGH = 0,
4168 +} AVALANCHE_WAKEUP_POLARITY_T;
4170 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
4171 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
4172 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity);
4174 +/*****************************************************************************
4176 + *****************************************************************************/
4178 +typedef enum AVALANCHE_GPIO_PIN_MODE_tag
4180 + FUNCTIONAL_PIN = 0,
4182 +} AVALANCHE_GPIO_PIN_MODE_T;
4184 +typedef enum AVALANCHE_GPIO_PIN_DIRECTION_tag
4186 + GPIO_OUTPUT_PIN = 0,
4187 + GPIO_INPUT_PIN = 1
4188 +} AVALANCHE_GPIO_PIN_DIRECTION_T;
4190 +typedef enum { GPIO_FALSE, GPIO_TRUE } AVALANCHE_GPIO_BOOL_T;
4192 +void avalanche_gpio_init(void);
4193 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
4194 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
4195 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
4196 +int avalanche_gpio_ctrl_with_link_count(unsigned int gpio_pin,
4197 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
4198 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
4199 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value);
4200 +int avalanche_gpio_in_bit(unsigned int gpio_pin);
4201 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
4202 +int avalanche_gpio_out_value_with_link_count(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
4203 +int avalanche_gpio_in_value(unsigned int *in_val, unsigned int reg_index);
4205 +unsigned int avalanche_get_chip_version_info(void);
4207 +unsigned int avalanche_get_vbus_freq(void);
4208 +void avalanche_set_vbus_freq(unsigned int);
4211 +typedef int (*SET_MDIX_ON_CHIP_FN_T)(unsigned int base_addr, unsigned int operation);
4212 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation);
4213 +unsigned int avalanche_is_mdix_on_chip(void);
4216 diff -urN linux.old/include/asm-mips/ar7/avalanche_regs.h linux.dev/include/asm-mips/ar7/avalanche_regs.h
4217 --- linux.old/include/asm-mips/ar7/avalanche_regs.h 1970-01-01 01:00:00.000000000 +0100
4218 +++ linux.dev/include/asm-mips/ar7/avalanche_regs.h 2005-07-26 18:11:02.646500000 +0200
4222 + * Avalanche Register Descriptions
4224 + * Jeff Harrell, jharrell@ti.com
4225 + * 2000 (c) Texas Instruments Inc.
4228 +#ifndef __AVALANCHE_REGS_H
4229 +#define __AVALANCHE_REGS_H
4231 +#include <asm/addrspace.h>
4232 +#include <linux/config.h>
4234 +/*----------------------------------------*/
4235 +/* Base offsets within the Avalanche ASIC */
4236 +/*----------------------------------------*/
4238 +#define BBIF_SPACE0 (KSEG1ADDR(0x01000000))
4239 +#define BBIF_SPACE1 (KSEG1ADDR(0x01800000))
4240 +#define BBIF_CONTROL (KSEG1ADDR(0x02000000))
4241 +#define ATM_SAR_BASE (KSEG1ADDR(0x03000000))
4242 +#define USB_MCU_BASE (KSEG1ADDR(0x03400000))
4243 +#define DES_BASE (KSEG1ADDR(0x08600000))
4244 +#define ETH_MACA_BASE (KSEG1ADDR(0x08610000))
4245 +#define ETH_MACB_BASE (KSEG1ADDR(0x08612800))
4246 +#define MEM_CTRLR_BASE (KSEG1ADDR(0x08610800))
4247 +#define GPIO_BASE (KSEG1ADDR(0x08610900))
4248 +#define CLK_CTRL_BASE (KSEG1ADDR(0x08610A00))
4249 +#define WATCH_DOG_BASE (KSEG1ADDR(0x08610B00))
4250 +#define TMR1_BASE (KSEG1ADDR(0x08610C00))
4251 +#define TRM2_BASE (KSEG1ADDR(0x08610D00))
4252 +#define UARTA_BASE (KSEG1ADDR(0x08610E00))
4253 +#define UARTB_BASE (KSEG1ADDR(0x08610F00))
4254 +#define I2C_BASE (KSEG1ADDR(0x08611000))
4255 +#define DEV_ID_BASE (KSEG1ADDR(0x08611100))
4256 +#define USB_BASE (KSEG1ADDR(0x08611200))
4257 +#define PCI_CONFIG_BASE (KSEG1ADDR(0x08611300))
4258 +#define DMA_BASE (KSEG1ADDR(0x08611400))
4259 +#define RESET_CTRL_BASE (KSEG1ADDR(0x08611600))
4260 +#define DSL_IF_BASE (KSEG1ADDR(0x08611B00))
4261 +#define INT_CTL_BASE (KSEG1ADDR(0x08612400))
4262 +#define PHY_BASE (KSEG1ADDR(0x1E000000))
4264 +/*---------------------------------*/
4265 +/* Device ID, chip version number */
4266 +/*---------------------------------*/
4268 +#define AVALANCHE_CHVN (*(volatile unsigned int *)(DEV_ID_BASE+0x14))
4269 +#define AVALANCHE_DEVID1 (*(volatile unsigned int *)(DEV_ID_BASE+0x18))
4270 +#define AVALANCHE_DEVID2 (*(volatile unsigned int *)(DEV_ID_BASE+0x1C))
4272 +/*----------------------------------*/
4273 +/* Reset Control VW changed to ptrs */
4274 +/*----------------------------------*/
4276 +#define AVALANCHE_PRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x0)) /* Peripheral reset control */
4277 +#define AVALANCHE_SWRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x4)) /* Software reset control */
4278 +#define AVALANCHE_RSR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x8)) /* Reset status register */
4280 +/* reset control bits */
4282 +#define AV_RST_UART0 (1<<0) /* Brings UART0 out of reset */
4283 +#define AV_RST_UART1 (1<<1) /* Brings UART1 out of reset */
4284 +#define AV_RST_IICM (1<<2) /* Brings the I2CM out of reset */
4285 +#define AV_RST_TIMER0 (1<<3) /* Brings Timer 0 out of reset */
4286 +#define AV_RST_TIMER1 (1<<4) /* Brings Timer 1 out of reset */
4287 +#define AV_RST_DES (1<<5) /* Brings the DES module out of reset */
4288 +#define AV_RST_GPIO (1<<6) /* Brings the GPIO module out of reset (see note below) */
4290 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4291 + If you reset the GPIO interface all of the directions (i/o) of the UART B
4292 + interface pins are inputs and must be reconfigured so as not to lose the
4293 + serial console interface
4294 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4296 +#define AV_RST_BBIF (1<<7) /* Brings the Broadband interface out of reset */
4297 +#define AV_RST_USB (1<<8) /* Brings the USB module out of reset */
4298 +#define AV_RST_SAR (1<<9) /* Brings the SAR out of reset */
4299 +#define AV_RST_HDLC (1<<10) /* Brings the HDLC module out of reset */
4300 +#define AV_RST_PCI (1<<16) /* Brings the PCI module out of reset */
4301 +#define AV_RST_ETH_MAC0 (1<<17) /* Brings the Ethernet MAC0 out of reset */
4302 +#define AV_RST_PICO_DMA (1<<18) /* Brings the PICO DMA module out of reset */
4303 +#define AV_RST_BIST (1<<19) /* Brings the BIST module out of reset */
4304 +#define AV_RST_DSP (1<<20) /* Brings the DSP sub system out of reset */
4305 +#define AV_RST_ETH_MAC1 (1<<21) /* Brings the Ethernet MAC1 out of reset */
4307 +/*----------------------*/
4308 +/* Physical interfaces */
4309 +/*----------------------*/
4312 +#define PHY_LOOPBACK 1
4316 +#define PHY0BASE (PHY_BASE)
4317 +#define PHY0RST (*(volatile unsigned char *) (PHY0BASE)) /* reset */
4318 +#define PHY0CTRL (*(volatile unsigned char *) (PHY0BASE+0x5)) /* control */
4319 +#define PHY0RACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x50)) /* RACP control/status */
4320 +#define PHY0TACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x60)) /* TACP idle/unassigned cell hdr */
4321 +#define PHY0RACPINT (*(volatile unsigned char *) (PHY0BASE+0x51)) /* RACP interrupt enable/Status */
4326 +#define PHY1BASE (PHY_BASE + 0x100000)
4327 +#define PHY1RST (*(volatile unsigned char *) (PHY1BASE)) /* reset */
4328 +#define PHY1CTRL (*(volatile unsigned char *) (PHY1BASE+0x5)) /* control */
4329 +#define PHY1RACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x50))
4330 +#define PHY1TACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x60))
4331 +#define PHY1RACPINT (*(volatile unsigned char *) (PHY1BASE+0x51))
4335 +#define PHY2BASE (PHY_BASE + 0x200000)
4336 +#define PHY2RST (*(volatile unsigned char *) (PHY2BASE)) /* reset */
4337 +#define PHY2CTRL (*(volatile unsigned char *) (PHY2BASE+0x5)) /* control */
4338 +#define PHY2RACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x50))
4339 +#define PHY2TACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x60))
4340 +#define PHY2RACPINT (*(volatile unsigned char *) (PHY2BASE+0x51))
4342 +/*-------------------*/
4343 +/* Avalanche ATM SAR */
4344 +/*-------------------*/
4346 +#define AVSAR_SYSCONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000000)) /* SAR system config register */
4347 +#define AVSAR_SYSSTATUS (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000004)) /* SAR system status register */
4348 +#define AVSAR_INT_ENABLE (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000008)) /* SAR interrupt enable register */
4349 +#define AVSAR_CONN_VPI_VCI (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000000c)) /* VPI/VCI connection config */
4350 +#define AVSAR_CONN_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000010)) /* Connection config register */
4351 +#define AVSAR_OAM_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018)) /* OAM configuration register */
4353 +/* Transmit completion ring registers */
4355 +#define AVSAR_TCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000100))
4356 +#define AVSAR_TCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000104))
4357 +#define AVSAR_TCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000108))
4358 +#define AVSAR_TCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000010c))
4359 +#define AVSAR_TCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000110))
4360 +#define AVSAR_TCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000114))
4361 +#define AVSAR_TCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000118))
4362 +#define AVSAR_TCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000011c))
4363 +#define AVSAR_TCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000120))
4364 +#define AVSAR_TCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000124))
4365 +#define AVSAR_TCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000128))
4366 +#define AVSAR_TCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000012c))
4367 +#define AVSAR_TCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000130))
4368 +#define AVSAR_TCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000134))
4370 +/* Transmit Queue Packet registers */
4371 +#define AVSAR_TXQUEUE_PKT0 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000140))
4372 +#define AVSAR_TXQUEUE_PKT1 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000144))
4373 +#define AVSAR_TXQUEUE_PKT2 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000148))
4374 +#define AVSAR_TX_FLUSH (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000014C))
4375 +/* Receive completion ring registers */
4377 +#define AVSAR_RCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000200))
4378 +#define AVSAR_RCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000204))
4379 +#define AVSAR_RCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000208))
4380 +#define AVSAR_RCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000020c))
4381 +#define AVSAR_RCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000210))
4382 +#define AVSAR_RCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000214))
4383 +#define AVSAR_RCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000218))
4384 +#define AVSAR_RCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000021c))
4385 +#define AVSAR_RCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000220))
4386 +#define AVSAR_RCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000224))
4387 +#define AVSAR_RCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000228))
4388 +#define AVSAR_RCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000022c))
4389 +#define AVSAR_RCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000230))
4390 +#define AVSAR_RCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000234))
4392 +#define AVSAR_RXFBL_ADD0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000240)) /* Rx Free buffer list add 0 */
4393 +#define AVSAR_RXFBL_ADD1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000244)) /* Rx Free buffer list add 1 */
4394 +#define AVSAR_RXFBL_ADD2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000248)) /* Rx Free buffer list add 2 */
4395 +#define AVSAR_RXFBLSIZE_0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000028c)) /* Rx Free buffer list size 0 */
4396 +#define AVSAR_RXFBLSIZE_1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000029c)) /* Rx Free buffer list size 1 */
4397 +#define AVSAR_RXFBLSIZE_2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002ac)) /* Rx Free buffer list size 2 */
4398 +#define AVSAR_RXFBLSIZE_3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002bc)) /* Rx Free buffer list size 3 */
4401 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
4403 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010480))
4404 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010484))
4405 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010488))
4406 +#define AVSAR_OAM_CPID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E0))
4407 +#define AVSAR_OAM_LLID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F0))
4408 +#define AVSAR_OAM_CPID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E4))
4409 +#define AVSAR_OAM_LLID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F4))
4410 +#define AVSAR_OAM_CPID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E8))
4411 +#define AVSAR_OAM_LLID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F8))
4412 +#define AVSAR_OAM_CPID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104EC))
4413 +#define AVSAR_OAM_LLID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104FC))
4414 +#define AVSAR_OAM_CORR_TAG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010500))
4415 +#define AVSAR_OAM_FAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010520))
4416 +#define AVSAR_OAM_NEAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010540))
4417 +#define AVSAR_OAM_CONFIG_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018))
4418 +#define AVSAR_FAIRNESS_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104B8))
4419 +#define AVSAR_UBR_PCR_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010490))
4424 +#define OAM_CPID_ADD 0xa30104e0
4426 +#define OAM_LLID_ADD 0xa30104f0
4428 +#define OAM_LLID_VAL 0xffffffff
4430 +#define OAM_CORR_TAG 0xa3010500
4432 +#define OAM_FAR_COUNT_ADD 0xa3010520
4434 +#define OAM_NEAR_COUNT_ADD 0xa3010540
4436 +#define OAM_CONFIG_REG_ADD 0xa3000018
4440 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
4442 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012000))
4443 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012004))
4444 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012008))
4445 +#define AVSAR_OAM_CPID (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012300))
4447 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
4450 +#define AVSAR_STATE_RAM (ATM_SAR_BASE + 0x010000) /* SAR state RAM */
4451 +#define AVSAR_PDSP_BASE (ATM_SAR_BASE + 0x020000) /* SAR PDSP base address */
4452 +#define AVSAR_TXDMA_BASE (ATM_SAR_BASE + 0x030000) /* Transmit DMA state base */
4453 +#define AVSAR_TDMASTATE6 0x18 /* Transmit DMA state word 6 */
4454 +#define AVSAR_RXDMA_BASE (ATM_SAR_BASE + 0x040000) /* Receive DMA state base */
4455 +#define AVSAR_RDMASTATE0 0x0 /* Receive DMA state word 0 */
4457 +/*------------------------------------------*/
4458 +/* DSL Interface */
4459 +/*------------------------------------------*/
4461 +#define AVDSL_TX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000000))
4462 +#define AVDSL_RX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000004))
4463 +#define AVDSL_POLL (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000008))
4467 +#define AVDSL_TX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000000C))
4468 +#define AVDSL_TX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000010))
4469 +#define AVDSL_TX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000014))
4470 +#define AVDSL_TX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000018))
4471 +#define AVDSL_RX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000001C))
4472 +#define AVDSL_RX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000020))
4473 +#define AVDSL_RX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000024))
4474 +#define AVDSL_RX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000028))
4478 +#define AVDSL_TX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000002C))
4479 +#define AVDSL_TX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000030))
4480 +#define AVDSL_TX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000034))
4481 +#define AVDSL_TX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000038))
4482 +#define AVDSL_RX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000003C))
4483 +#define AVDSL_RX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000040))
4484 +#define AVDSL_RX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000044))
4485 +#define AVDSL_RX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000048))
4487 +/*------------------------------------------*/
4488 +/* Broadband I/F */
4489 +/*------------------------------------------*/
4491 +#define AVBBIF_BBIF_CNTRL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000000))
4492 +#define AVBBIF_ADDR_TRANS_0 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000004))
4493 +#define AVBBIF_ADDR_TRANS_1 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000008))
4494 +#define AVBBIF_ADDR_XB_MX_BL (*(volatile unsigned int *)(BBIF_CONTROL + 0x0000000C))
4495 +#define AVBBIF_INFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000010))
4496 +#define AVBBIF_OUTFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000014))
4498 +#define AVBBIF_DISABLED 0x0
4499 +#define AVBBIF_LBT4040_INT 0x1
4500 +#define AVBBIF_XBUS 0x2
4501 +#define AVBBIF_LBT4040_EXT 0x4
4503 +#define AVBBIF_ADDR_MASK0 0xff000000 /* handles upper bits of BBIF 0 address */
4504 +#define AVBBIF_ADDR_MASK1 0xff800000 /* handles upper bits of BBIF 1 address */
4505 +#define AVBBIF_TRANS_MASK 0xff000000
4506 +/*------------------------------------------*/
4508 +/*------------------------------------------*/
4510 +#define GPIO_DATA_INPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000000))
4511 +#define GPIO_DATA_OUTPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000004))
4512 +#define GPIO_DATA_DIR (*(volatile unsigned int *)(GPIO_BASE + 0x00000008)) /* 0=output 1=input */
4513 +#define GPIO_DATA_ENABLE (*(volatile unsigned int *)(GPIO_BASE + 0x0000000C)) /* 0=GPIO Mux 1=GPIO */
4515 +#define GPIO_0 (1<<21)
4516 +#define GPIO_1 (1<<22)
4517 +#define GPIO_2 (1<<23)
4518 +#define GPIO_3 (1<<24)
4519 +#define EINT_1 (1<<18)
4522 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4523 + If you reset the GPIO interface all of the directions (i/o) of the UART B
4524 + interface pins are inputs and must be reconfigured so as not to lose the
4525 + serial console interface
4526 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4529 +/*------------------------------------------*/
4531 +/*------------------------------------------*/
4532 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
4534 +#define PCLK_0_HALF_VBUS (0<<16)
4535 +#define PCLK_EQ_INPUT (1<<16)
4536 +#define BBIF_CLK_HALF_VBUS (0<<17)
4537 +#define BBIF_CLK_EQ_VBUS (1<<17)
4538 +#define BBIF_CLK_EQ_BBCLK (3<<17)
4539 +#define DSP_MODCLK_DSPCLKI (0<<20)
4540 +#define DSP_MODCLK_REFCLKI (1<<20)
4541 +#define USB_CLK_EQ_USBCLKI (0<<21)
4542 +#define USB_CLK_EQ_REFCLKI (1<<21)
4544 +/*------------------------------------------*/
4545 +/* PCI Control Registers */
4546 +/*------------------------------------------*/
4547 +#define PCIC_CONTROL (*(volatile unsigned int *)(PCI_CONFIG_BASE))
4548 +#define PCIC_CONTROL_CFG_DONE (1<<0)
4549 +#define PCIC_CONTROL_DIS_SLAVE_TO (1<<1)
4550 +#define PCIC_CONTROL_FORCE_DELAY_READ (1<<2)
4551 +#define PCIC_CONTROL_FORCE_DELAY_READ_LINE (1<<3)
4552 +#define PCIC_CONTROL_FORCE_DELAY_READ_MULT (1<<4)
4553 +#define PCIC_CONTROL_MEM_SPACE_EN (1<<5)
4554 +#define PCIC_CONTROL_MEM_MASK (1<<6)
4555 +#define PCIC_CONTROL_IO_SPACE_EN (1<<7)
4556 +#define PCIC_CONTROL_IO_MASK (1<<8)
4557 +/* PCIC_CONTROL_RESERVED (1<<9) */
4558 +#define PCIC_CONTROL_BASE0_EN (1<<10)
4559 +#define PCIC_CONTROL_BASE1_EN (1<<11)
4560 +#define PCIC_CONTROL_BASE2_EN (1<<12)
4561 +#define PCIC_CONTROL_HOLD_MASTER_WRITE (1<<13)
4562 +#define PCIC_CONTROL_ARBITER_EN (1<<14)
4563 +#define PCIC_INT_SOURCE (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000004))
4564 +#define PCIC_INT_SOURCE_PWR_MGMT (1<<0)
4565 +#define PCIC_INT_SOURCE_PCI_TARGET (1<<1)
4566 +#define PCIC_INT_SOURCE_PCI_MASTER (1<<2)
4567 +#define PCIC_INT_SOURCE_POWER_WAKEUP (1<<3)
4568 +#define PCIC_INT_SOURCE_PMEIN (1<<4)
4569 +/* PCIC_INT_SOURCE_RESERVED (1<<5) */
4570 +/* PCIC_INT_SOURCE_RESERVED (1<<6) */
4571 +#define PCIC_INT_SOURCE_PIC_INTA (1<<7)
4572 +#define PCIC_INT_SOURCE_PIC_INTB (1<<8)
4573 +#define PCIC_INT_SOURCE_PIC_INTC (1<<9)
4574 +#define PCIC_INT_SOURCE_PIC_INTD (1<<10)
4575 +#define PCIC_INT_SOURCE_SOFT_INT0 (1<<11)
4576 +#define PCIC_INT_SOURCE_SOFT_INT1 (1<<12)
4577 +#define PCIC_INT_SOURCE_SOFT_INT2 (1<<13)
4578 +#define PCIC_INT_SOURCE_SOFT_INT3 (1<<14)
4579 +#define PCIC_INT_CLEAR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000008))
4580 +#define PCIC_INT_CLEAR_PM (1<<0)
4581 +#define PCIC_INT_CLEAR_PCI_TARGET (1<<1)
4582 +#define PCIC_INT_CLEAR_PCI_MASTER (1<<2)
4583 +/* PCIC_INT_CLEAR_RESERVED (1<<3) */
4584 +#define PCIC_INT_CLEAR_PMEIN (1<<4)
4585 +/* PCIC_INT_CLEAR_RESERVED (1<<5) */
4586 +/* PCIC_INT_CLEAR_RESERVED (1<<6) */
4587 +#define PCIC_INT_CLEAR_PCI_INTA (1<<7)
4588 +#define PCIC_INT_CLEAR_PCI_INTB (1<<8)
4589 +#define PCIC_INT_CLEAR_PCI_INTC (1<<9)
4590 +#define PCIC_INT_CLEAR_PCI_INTD (1<<10)
4591 +#define PCIC_INT_CLEAR_SOFT_INT0 (1<<11)
4592 +#define PCIC_INT_CLEAR_SOFT_INT1 (1<<12)
4593 +#define PCIC_INT_CLEAR_SOFT_INT2 (1<<13)
4594 +#define PCIC_INT_CLEAR_SOFT_INT3 (1<<14)
4595 +#define PCIC_INT_EN_AVAL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000000c))
4596 +#define PCIC_INT_EN_AVAL_PM (1<<0)
4597 +#define PCIC_INT_EN_AVAL_PCI_TARGET (1<<1)
4598 +#define PCIC_INT_EN_AVAL_PCI_MASTER (1<<2)
4599 +/* PCIC_INT_EN_AVAL_RESERVED (1<<3) */
4600 +#define PCIC_INT_EN_AVAL_PMEIN (1<<4)
4601 +/* PCIC_INT_EN_AVAL_RESERVED (1<<5) */
4602 +/* PCIC_INT_EN_AVAL_RESERVED (1<<6) */
4603 +#define PCIC_INT_EN_AVAL_PCI_INTA (1<<7)
4604 +#define PCIC_INT_EN_AVAL_PCI_INTB (1<<8)
4605 +#define PCIC_INT_EN_AVAL_PCI_INTC (1<<9)
4606 +#define PCIC_INT_EN_AVAL_PCI_INTD (1<<10)
4607 +#define PCIC_INT_EN_AVAL_SOFT_INT0 (1<<11)
4608 +#define PCIC_INT_EN_AVAL_SOFT_INT1 (1<<12)
4609 +#define PCIC_INT_EN_AVAL_SOFT_INT2 (1<<13)
4610 +#define PCIC_INT_EN_AVAL_SOFT_INT3 (1<<14)
4611 +#define PCIC_INT_EN_PCI (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000010))
4612 +#define PCIC_INT_EN_PCI_PM (1<<0)
4613 +#define PCIC_INT_EN_PCI_PCI_TARGET (1<<1)
4614 +#define PCIC_INT_EN_PCI_PCI_MASTER (1<<2)
4615 +/* PCIC_INT_EN_PCI_RESERVED (1<<3) */
4616 +#define PCIC_INT_EN_PCI_PMEIN (1<<4)
4617 +/* PCIC_INT_EN_PCI_RESERVED (1<<5) */
4618 +/* PCIC_INT_EN_PCI_RESERVED (1<<6) */
4619 +#define PCIC_INT_EN_PCI_PCI_INTA (1<<7)
4620 +#define PCIC_INT_EN_PCI_PCI_INTB (1<<8)
4621 +#define PCIC_INT_EN_PCI_PCI_INTC (1<<9)
4622 +#define PCIC_INT_EN_PCI_PCI_INTD (1<<10)
4623 +#define PCIC_INT_EN_PCI_SOFT_INT0 (1<<11)
4624 +#define PCIC_INT_EN_PCI_SOFT_INT1 (1<<12)
4625 +#define PCIC_INT_EN_PCI_SOFT_INT2 (1<<13)
4626 +#define PCIC_INT_EN_PCI_SOFT_INT3 (1<<14)
4627 +#define PCIC_INT_SWSET (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000014))
4628 +#define PCIC_INT_SWSET_SOFT_INT0 (1<<0)
4629 +#define PCIC_INT_SWSET_SOFT_INT1 (1<<1)
4630 +#define PCIC_INT_SWSET_SOFT_INT2 (1<<2)
4631 +#define PCIC_INT_SWSET_SOFT_INT3 (1<<3)
4632 +#define PCIC_PM_CTL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000018))
4633 +#define PCIC_PM_CTL_PWR_STATE_MASK (0x02)
4634 +/* PCIC_PM_CTL_RESERVED (1<<2) */
4635 +/* PCIC_PM_CTL_RESERVED (1<<3) */
4636 +/* PCIC_PM_CTL_RESERVED (1<<4) */
4637 +/* PCIC_PM_CTL_RESERVED (1<<5) */
4638 +/* PCIC_PM_CTL_RESERVED (1<<6) */
4639 +/* PCIC_PM_CTL_RESERVED (1<<7) */
4640 +/* PCIC_PM_CTL_RESERVED (1<<8) */
4641 +/* PCIC_PM_CTL_RESERVED (1<<9) */
4642 +#define PCIC_PM_CTL_PWR_SUPPORT (1<<10)
4643 +#define PCIC_PM_CTL_PMEIN (1<<11)
4644 +#define PCIC_PM_CTL_CAP_MASK (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x0000001a))
4645 +#define PCIC_PM_CONSUME (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000001c))
4646 +#define PCIC_PM_CONSUME_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001c))
4647 +#define PCIC_PM_CONSUME_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001d))
4648 +#define PCIC_PM_CONSUME_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001e))
4649 +#define PCIC_PM_CONSUME_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001f))
4650 +#define PCIC_PM_DISSAPATED (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000020))
4651 +#define PCIC_PM_DISSAPATED_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000020))
4652 +#define PCIC_PM_DISSAPATED_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000021))
4653 +#define PCIC_PM_DISSAPATED_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000022))
4654 +#define PCIC_PM_DISSAPATED_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000023))
4655 +#define PCIC_PM_DATA_SCALE (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x00000024))
4656 +#define PCIC_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000028))
4657 +#define PCIC_SUB_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000002c))
4658 +#define PCIC_CLASS_REV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000030))
4659 +#define PCIC_MAX_MIN (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000034))
4660 +#define PCIC_MAST_MEM_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000003c))
4661 +#define PCIC_MAST_MEM_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000040))
4662 +#define PCIC_MAST_MEM_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000044))
4663 +#define PCIC_SLAVE_MASK0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000004c))
4664 +#define PCIC_SLAVE_MASK1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000050))
4665 +#define PCIC_SLAVE_MASK2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000054))
4666 +#define PCIC_SLAVE_BASE_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000058))
4667 +#define PCIC_SLAVE_BASE_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000005c))
4668 +#define PCIC_SLAVE_BASE_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000060))
4669 +#define PCIC_CONF_COMMAND (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000090))
4670 +#define PCIC_CONF_ADDR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000094))
4671 +#define PCIC_CONF_DATA (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000098))
4673 +/*------------------------------------------*/
4674 +/* IIC_INTERFACE */
4675 +/*------------------------------------------*/
4676 +#define I2C_DATA_HI (*(volatile unsigned int *)(I2C_BASE + 0x0))
4677 +#define I2C_DATA_LOW (*(volatile unsigned int *)(I2C_BASE + 0x4))
4678 +#define I2C_CONFIG (*(volatile unsigned int *)(I2C_BASE + 0x8))
4679 +#define I2C_DATA_READ (*(volatile unsigned int *)(I2C_BASE + 0xC))
4680 +#define I2C_CLOCK_DIV (*(volatile unsigned int *)(I2C_BASE + 0x10))
4682 +#define I2CWRITE 0x200
4683 +#define I2CREAD 0x300
4684 +#define I2C_END_BURST 0x400
4687 +#define I2C_READ_ERROR 0x8000
4688 +#define I2C_READ_COMPLETE 0x4000
4689 +#define I2C_READ_BUSY 0x2000
4692 +#define I2C_IO_EXPANDER 0x2
4693 +#define I2C_RTC 0xd
4695 +/* device Addresses on I2C bus (EVM3) */
4696 +#define SEVEN_SEGMENT_DISP 0x23 /* Device type = 0x2, Addr = 3 */
4697 +#define EVM3_RTC 0xd0 /* Device type = 0xd, Addr = 0 */
4698 +#define EVM3_RTC_I2C_ADDR 0x0
4700 +/*------------------------------------------*/
4701 +/* Ethernet MAC register offset definitions */
4702 +/*------------------------------------------*/
4703 +#define VMAC_DMACONFIG(X) (*(volatile unsigned int *)(X + 0x00000000))
4704 +#define VMAC_INTSTS(X) (*(volatile unsigned int *)(X + 0x00000004))
4705 +#define VMAC_INTMASK(X) (*(volatile unsigned int *)(X + 0x00000008))
4707 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4708 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
4710 +#define VMAC_TCRPTR(X) (*(volatile unsigned int *)(X + 0x00000100))
4711 +#define VMAC_TCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000104))
4712 +#define VMAC_TCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000108))
4713 +#define VMAC_TCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000010C))
4714 +#define VMAC_TCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000110))
4715 +#define VMAC_TCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000114))
4716 +#define VMAC_TCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000118))
4717 +#define VMAC_TXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000011c))
4720 +#define VMAC_TDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000120))
4721 +#define VMAC_TDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000124))
4722 +#define VMAC_TDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000128))
4723 +#define VMAC_TDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000012C))
4724 +#define VMAC_TDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000130))
4725 +#define VMAC_TDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000134))
4726 +#define VMAC_TDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000138))
4727 +#define VMAC_TDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000013C))
4728 +#define VMAC_TXPADDCNT(X) (*(volatile unsigned int *)(X + 0x00000140))
4729 +#define VMAC_TXPADDSTART(X) (*(volatile unsigned int *)(X + 0x00000144))
4730 +#define VMAC_TXPADDEND(X) (*(volatile unsigned int *)(X + 0x00000148))
4731 +#define VMAC_TXQFLUSH(X) (*(volatile unsigned int *)(X + 0x0000014C))
4733 +#define VMAC_RCRPTR(X) (*(volatile unsigned int *)(X + 0x00000200))
4734 +#define VMAC_RCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000204))
4735 +#define VMAC_RCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000208))
4736 +#define VMAC_RCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000020C))
4737 +#define VMAC_RCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000210))
4738 +#define VMAC_RCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000214))
4739 +#define VMAC_RCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000218))
4740 +#define VMAC_RXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000021c))
4742 +#define VMAC_RDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000220))
4743 +#define VMAC_RDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000224))
4744 +#define VMAC_RDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000228))
4745 +#define VMAC_RDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000022C))
4746 +#define VMAC_RDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000230))
4747 +#define VMAC_RDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000234))
4748 +#define VMAC_RDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000238))
4749 +#define VMAC_RDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000023C))
4750 +#define VMAC_FBLADDCNT(X) (*(volatile unsigned int *)(X + 0x00000240))
4751 +#define VMAC_FBLADDSTART(X) (*(volatile unsigned int *)(X + 0x00000244))
4752 +#define VMAC_FBLADDEND(X) (*(volatile unsigned int *)(X + 0x00000248))
4753 +#define VMAC_RXONOFF(X) (*(volatile unsigned int *)(X + 0x0000024C))
4755 +#define VMAC_FBL0NEXTD(X) (*(volatile unsigned int *)(X + 0x00000280))
4756 +#define VMAC_FBL0LASTD(X) (*(volatile unsigned int *)(X + 0x00000284))
4757 +#define VMAC_FBL0COUNTD(X) (*(volatile unsigned int *)(X + 0x00000288))
4758 +#define VMAC_FBL0BUFSIZE(X) (*(volatile unsigned int *)(X + 0x0000028C))
4760 +#define VMAC_MACCONTROL(X) (*(volatile unsigned int *)(X + 0x00000300))
4761 +#define VMAC_MACSTATUS(X) (*(volatile unsigned int *)(X + 0x00000304))
4762 +#define VMAC_MACADDRHI(X) (*(volatile unsigned int *)(X + 0x00000308))
4763 +#define VMAC_MACADDRLO(X) (*(volatile unsigned int *)(X + 0x0000030C))
4764 +#define VMAC_MACHASH1(X) (*(volatile unsigned int *)(X + 0x00000310))
4765 +#define VMAC_MACHASH2(X) (*(volatile unsigned int *)(X + 0x00000314))
4767 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4768 +#define VMAC_BOFTEST(X) (*(volatile unsigned int *)(X + 0x00000344))
4769 +#define VMAC_PACTEST(X) (*(volatile unsigned int *)(X + 0x00000348))
4770 +#define VMAC_PAUSEOP(X) (*(volatile unsigned int *)(X + 0x0000034C))
4772 +#define VMAC_MDIOCONTROL(X) (*(volatile unsigned int *)(X + 0x00000380))
4773 +#define VMAC_MDIOUSERACCESS(X) (*(volatile unsigned int *)(X +0x00000384))
4774 +#define VMAC_MDIOACK(X) (*(volatile unsigned int *)(X + 0x00000388))
4775 +#define VMAC_MDIOLINK(X) (*(volatile unsigned int *)(X + 0x0000038C))
4776 +#define VMAC_MDIOMACPHY(X) (*(volatile unsigned int *)(X + 0x00000390))
4778 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
4780 +#endif __AVALANCHE_REGS_H
4787 diff -urN linux.old/include/asm-mips/ar7/if_port.h linux.dev/include/asm-mips/ar7/if_port.h
4788 --- linux.old/include/asm-mips/ar7/if_port.h 1970-01-01 01:00:00.000000000 +0100
4789 +++ linux.dev/include/asm-mips/ar7/if_port.h 2005-07-26 18:11:02.647500000 +0200
4791 +/*******************************************************************************
4792 + * FILE PURPOSE: Interface port id Header file
4793 + *******************************************************************************
4794 + * FILE NAME: if_port.h
4796 + * DESCRIPTION: Header file carrying information about port ids of interfaces
4799 + * (C) Copyright 2003, Texas Instruments, Inc
4800 + ******************************************************************************/
4801 +#ifndef _IF_PORT_H_
4802 +#define _IF_PORT_H_
4804 +#define AVALANCHE_CPMAC_LOW_PORT_ID 0
4805 +#define AVALANCHE_CPMAC_HIGH_PORT_ID 1
4806 +#define AVALANCHE_USB_PORT_ID 2
4807 +#define AVALANCHE_WLAN_PORT_ID 3
4810 +#define AVALANCHE_MARVELL_BASE_PORT_ID 4
4812 +/* The marvell ports occupy port ids from 4 to 8 */
4813 +/* so the next port id number should start at 9 */
4816 +#endif /* _IF_PORT_H_ */
4817 diff -urN linux.old/include/asm-mips/ar7/sangam.h linux.dev/include/asm-mips/ar7/sangam.h
4818 --- linux.old/include/asm-mips/ar7/sangam.h 1970-01-01 01:00:00.000000000 +0100
4819 +++ linux.dev/include/asm-mips/ar7/sangam.h 2005-07-26 18:11:02.648500000 +0200
4824 +#include <linux/config.h>
4825 +#include <asm/addrspace.h>
4827 +/*----------------------------------------------------
4828 + * Sangam's Module Base Addresses
4829 + *--------------------------------------------------*/
4830 +#define AVALANCHE_ADSL_SUB_SYS_MEM_BASE (KSEG1ADDR(0x01000000)) /* AVALANCHE ADSL Mem Base */
4831 +#define AVALANCHE_BROADBAND_INTERFACE__BASE (KSEG1ADDR(0x02000000)) /* AVALANCHE BBIF */
4832 +#define AVALANCHE_ATM_SAR_BASE (KSEG1ADDR(0x03000000)) /* AVALANCHE ATM SAR */
4833 +#define AVALANCHE_USB_SLAVE_BASE (KSEG1ADDR(0x03400000)) /* AVALANCHE USB SLAVE */
4834 +#define AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x04000000)) /* AVALANCHE VLYNQ 0 Mem map */
4835 +#define AVALANCHE_LOW_CPMAC_BASE (KSEG1ADDR(0x08610000)) /* AVALANCHE CPMAC 0 */
4836 +#define AVALANCHE_EMIF_CONTROL_BASE (KSEG1ADDR(0x08610800)) /* AVALANCHE EMIF */
4837 +#define AVALANCHE_GPIO_BASE (KSEG1ADDR(0x08610900)) /* AVALANCHE GPIO */
4838 +#define AVALANCHE_CLOCK_CONTROL_BASE (KSEG1ADDR(0x08610A00)) /* AVALANCHE Clock Control */
4839 +#define AVALANCHE_WATCHDOG_TIMER_BASE (KSEG1ADDR(0x08610B00)) /* AVALANCHE Watch Dog Timer */
4840 +#define AVALANCHE_TIMER0_BASE (KSEG1ADDR(0x08610C00)) /* AVALANCHE Timer 1 */
4841 +#define AVALANCHE_TIMER1_BASE (KSEG1ADDR(0x08610D00)) /* AVALANCHE Timer 2 */
4842 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
4843 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 0 */
4844 +#define AVALANCHE_I2C_BASE (KSEG1ADDR(0x08611000)) /* AVALANCHE I2C */
4845 +#define AVALANCHE_USB_SLAVE_CONTROL_BASE (KSEG1ADDR(0x08611200)) /* AVALANCHE USB DMA */
4846 +#define AVALANCHE_MCDMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* AVALANCHE MC DMA 0 (channels 0-3) */
4847 +#define AVALANCHE_RESET_CONTROL_BASE (KSEG1ADDR(0x08611600)) /* AVALANCHE Reset Control */
4848 +#define AVALANCHE_BIST_CONTROL_BASE (KSEG1ADDR(0x08611700)) /* AVALANCHE BIST Control */
4849 +#define AVALANCHE_LOW_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611800)) /* AVALANCHE VLYNQ0 Control */
4850 +#define AVALANCHE_DEVICE_CONFIG_LATCH_BASE (KSEG1ADDR(0x08611A00)) /* AVALANCHE Device Config Latch */
4851 +#define AVALANCHE_HIGH_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611C00)) /* AVALANCHE VLYNQ1 Control */
4852 +#define AVALANCHE_MDIO_BASE (KSEG1ADDR(0x08611E00)) /* AVALANCHE MDIO */
4853 +#define AVALANCHE_FSER_BASE (KSEG1ADDR(0x08612000)) /* AVALANCHE FSER base */
4854 +#define AVALANCHE_INTC_BASE (KSEG1ADDR(0x08612400)) /* AVALANCHE INTC */
4855 +#define AVALANCHE_HIGH_CPMAC_BASE (KSEG1ADDR(0x08612800)) /* AVALANCHE CPMAC 1 */
4856 +#define AVALANCHE_HIGH_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x0C000000)) /* AVALANCHE VLYNQ 1 Mem map */
4858 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
4861 +/*----------------------------------------------------
4862 + * Sangam Interrupt Map (Primary Interrupts)
4863 + *--------------------------------------------------*/
4865 +#define AVALANCHE_UNIFIED_SECONDARY_INT 0
4866 +#define AVALANCHE_EXT_INT_0 1
4867 +#define AVALANCHE_EXT_INT_1 2
4868 +/* Line# 3 to 4 are reserved */
4869 +#define AVALANCHE_TIMER_0_INT 5
4870 +#define AVALANCHE_TIMER_1_INT 6
4871 +#define AVALANCHE_UART0_INT 7
4872 +#define AVALANCHE_UART1_INT 8
4873 +#define AVALANCHE_DMA_INT0 9
4874 +#define AVALANCHE_DMA_INT1 10
4875 +/* Line# 11 to 14 are reserved */
4876 +#define AVALANCHE_ATM_SAR_INT 15
4877 +/* Line# 16 to 18 are reserved */
4878 +#define AVALANCHE_LOW_CPMAC_INT 19
4879 +/* Line# 20 is reserved */
4880 +#define AVALANCHE_LOW_VLYNQ_INT 21
4881 +#define AVALANCHE_CODEC_WAKEUP_INT 22
4882 +/* Line# 23 is reserved */
4883 +#define AVALANCHE_USB_SLAVE_INT 24
4884 +#define AVALANCHE_HIGH_VLYNQ_INT 25
4885 +/* Line# 26 to 27 are reserved */
4886 +#define AVALANCHE_UNIFIED_PHY_INT 28
4887 +#define AVALANCHE_I2C_INT 29
4888 +#define AVALANCHE_DMA_INT2 30
4889 +#define AVALANCHE_DMA_INT3 31
4890 +/* Line# 32 is reserved */
4891 +#define AVALANCHE_HIGH_CPMAC_INT 33
4892 +/* Line# 34 to 36 is reserved */
4893 +#define AVALANCHE_VDMA_VT_RX_INT 37
4894 +#define AVALANCHE_VDMA_VT_TX_INT 38
4895 +#define AVALANCHE_ADSL_SUB_SYSTEM_INT 39
4898 +#define AVALANCHE_EMIF_INT 47
4902 +/*-----------------------------------------------------------
4903 + * Sangam's Reset Bits
4904 + *---------------------------------------------------------*/
4906 +#define AVALANCHE_UART0_RESET_BIT 0
4907 +#define AVALANCHE_UART1_RESET_BIT 1
4908 +#define AVALANCHE_I2C_RESET_BIT 2
4909 +#define AVALANCHE_TIMER0_RESET_BIT 3
4910 +#define AVALANCHE_TIMER1_RESET_BIT 4
4911 +/* Reset bit 5 is reserved. */
4912 +#define AVALANCHE_GPIO_RESET_BIT 6
4913 +#define AVALANCHE_ADSL_SUB_SYS_RESET_BIT 7
4914 +#define AVALANCHE_USB_SLAVE_RESET_BIT 8
4915 +#define AVALANCHE_ATM_SAR_RESET_BIT 9
4916 +/* Reset bit 10 is reserved. */
4917 +#define AVALANCHE_VDMA_VT_RESET_BIT 11
4918 +#define AVALANCHE_FSER_RESET_BIT 12
4919 +/* Reset bit 13 to 15 are reserved */
4920 +#define AVALANCHE_HIGH_VLYNQ_RESET_BIT 16
4921 +#define AVALANCHE_LOW_CPMAC_RESET_BIT 17
4922 +#define AVALANCHE_MCDMA_RESET_BIT 18
4923 +#define AVALANCHE_BIST_RESET_BIT 19
4924 +#define AVALANCHE_LOW_VLYNQ_RESET_BIT 20
4925 +#define AVALANCHE_HIGH_CPMAC_RESET_BIT 21
4926 +#define AVALANCHE_MDIO_RESET_BIT 22
4927 +#define AVALANCHE_ADSL_SUB_SYS_DSP_RESET_BIT 23
4928 +/* Reset bit 24 to 25 are reserved */
4929 +#define AVALANCHE_LOW_EPHY_RESET_BIT 26
4930 +/* Reset bit 27 to 31 are reserved */
4933 +#define AVALANCHE_POWER_MODULE_USBSP 0
4934 +#define AVALANCHE_POWER_MODULE_WDTP 1
4935 +#define AVALANCHE_POWER_MODULE_UT0P 2
4936 +#define AVALANCHE_POWER_MODULE_UT1P 3
4937 +#define AVALANCHE_POWER_MODULE_IICP 4
4938 +#define AVALANCHE_POWER_MODULE_VDMAP 5
4939 +#define AVALANCHE_POWER_MODULE_GPIOP 6
4940 +#define AVALANCHE_POWER_MODULE_VLYNQ1P 7
4941 +#define AVALANCHE_POWER_MODULE_SARP 8
4942 +#define AVALANCHE_POWER_MODULE_ADSLP 9
4943 +#define AVALANCHE_POWER_MODULE_EMIFP 10
4944 +#define AVALANCHE_POWER_MODULE_ADSPP 12
4945 +#define AVALANCHE_POWER_MODULE_RAMP 13
4946 +#define AVALANCHE_POWER_MODULE_ROMP 14
4947 +#define AVALANCHE_POWER_MODULE_DMAP 15
4948 +#define AVALANCHE_POWER_MODULE_BISTP 16
4949 +#define AVALANCHE_POWER_MODULE_TIMER0P 18
4950 +#define AVALANCHE_POWER_MODULE_TIMER1P 19
4951 +#define AVALANCHE_POWER_MODULE_EMAC0P 20
4952 +#define AVALANCHE_POWER_MODULE_EMAC1P 22
4953 +#define AVALANCHE_POWER_MODULE_EPHYP 24
4954 +#define AVALANCHE_POWER_MODULE_VLYNQ0P 27
4961 + * Sangam board vectors
4964 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
4965 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
4967 +/*-----------------------------------------------------------------------------
4968 + * Sangam's system register.
4970 + *---------------------------------------------------------------------------*/
4971 +#define AVALANCHE_DCL_BOOTCR (KSEG1ADDR(0x08611A00))
4972 +#define AVALANCHE_EMIF_SDRAM_CFG (AVALANCHE_EMIF_CONTROL_BASE + 0x8)
4973 +#define AVALANCHE_RST_CTRL_PRCR (KSEG1ADDR(0x08611600))
4974 +#define AVALANCHE_RST_CTRL_SWRCR (KSEG1ADDR(0x08611604))
4975 +#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611600))
4977 +#define AVALANCHE_POWER_CTRL_PDCR (KSEG1ADDR(0x08610A00))
4978 +#define AVALANCHE_WAKEUP_CTRL_WKCR (KSEG1ADDR(0x08610A0C))
4980 +#define AVALANCHE_GPIO_DATA_IN (AVALANCHE_GPIO_BASE + 0x0)
4981 +#define AVALANCHE_GPIO_DATA_OUT (AVALANCHE_GPIO_BASE + 0x4)
4982 +#define AVALANCHE_GPIO_DIR (AVALANCHE_GPIO_BASE + 0x8)
4983 +#define AVALANCHE_GPIO_ENBL (AVALANCHE_GPIO_BASE + 0xC)
4984 +#define AVALANCHE_CVR (AVALANCHE_GPIO_BASE + 0x14)
4987 + * Yamon Prom print address.
4989 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
4990 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
4991 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
4993 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
4995 +#define AVALANCHE_GPIO_PIN_COUNT 32
4996 +#define AVALANCHE_GPIO_OFF_MAP {0xF34FFFC0}
4998 +#include "sangam_boards.h"
5000 +#endif /*_SANGAM_H_ */
5001 diff -urN linux.old/include/asm-mips/ar7/sangam_boards.h linux.dev/include/asm-mips/ar7/sangam_boards.h
5002 --- linux.old/include/asm-mips/ar7/sangam_boards.h 1970-01-01 01:00:00.000000000 +0100
5003 +++ linux.dev/include/asm-mips/ar7/sangam_boards.h 2005-07-26 18:11:02.647500000 +0200
5005 +#ifndef _SANGAM_BOARDS_H
5006 +#define _SANGAM_BOARDS_H
5008 +// Let us define board specific information here.
5011 +#if defined(CONFIG_AR7DB)
5013 +#define AFECLK_FREQ 35328000
5014 +#define REFCLK_FREQ 25000000
5015 +#define OSC3_FREQ 24000000
5016 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
5017 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
5018 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
5023 +#if defined(CONFIG_AR7RD)
5024 +#define AFECLK_FREQ 35328000
5025 +#define REFCLK_FREQ 25000000
5026 +#define OSC3_FREQ 24000000
5027 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
5028 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
5029 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
5033 +#if defined(CONFIG_AR7WI)
5034 +#define AFECLK_FREQ 35328000
5035 +#define REFCLK_FREQ 25000000
5036 +#define OSC3_FREQ 24000000
5037 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
5038 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
5039 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
5043 +#if defined(CONFIG_AR7V)
5044 +#define AFECLK_FREQ 35328000
5045 +#define REFCLK_FREQ 25000000
5046 +#define OSC3_FREQ 24000000
5047 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
5048 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
5049 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
5053 +#if defined(CONFIG_AR7WRD)
5054 +#define AFECLK_FREQ 35328000
5055 +#define REFCLK_FREQ 25000000
5056 +#define OSC3_FREQ 24000000
5057 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
5058 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
5059 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
5063 +#if defined(CONFIG_AR7VWI)
5064 +#define AFECLK_FREQ 35328000
5065 +#define REFCLK_FREQ 25000000
5066 +#define OSC3_FREQ 24000000
5067 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
5068 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
5069 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
5073 +#if defined CONFIG_SEAD2
5074 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0xAAAAAAAA
5075 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
5076 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0
5077 +#include <asm/mips-boards/sead.h>
5082 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx.h linux.dev/include/asm-mips/ar7/tnetd73xx.h
5083 --- linux.old/include/asm-mips/ar7/tnetd73xx.h 1970-01-01 01:00:00.000000000 +0100
5084 +++ linux.dev/include/asm-mips/ar7/tnetd73xx.h 2005-07-26 18:11:02.650500000 +0200
5086 +/******************************************************************************
5087 + * FILE PURPOSE: TNETD73xx Common Header File
5088 + ******************************************************************************
5089 + * FILE NAME: tnetd73xx.h
5091 + * DESCRIPTION: shared typedef's, constants and API for TNETD73xx
5093 + * REVISION HISTORY:
5094 + * 27 Nov 02 - PSP TII
5096 + * (C) Copyright 2002, Texas Instruments, Inc
5097 + *******************************************************************************/
5102 + * These are const, typedef, and api definitions for tnetd73xx.
5105 + * 1. This file may be included into both C and Assembly files.
5106 + * - for .s files, please do #define _ASMLANGUAGE in your ASM file to
5107 + * avoid C data types (typedefs) below;
5108 + * - for .c files, you don't have to do anything special.
5110 + * 2. This file has a number of sections for each SOC subsystem. When adding
5111 + * a new constant, find the subsystem you are working on and follow the
5112 + * name pattern. If you are adding another typedef for your interface, please,
5113 + * place it with other typedefs and function prototypes.
5115 + * 3. Please, DO NOT add any macros or types that are local to a subsystem to avoid
5116 + * cluttering. Include such items directly into the module's .c file or have a
5117 + * local .h file to pass data between smaller modules. This file defines only
5121 +#ifndef __TNETD73XX_H__
5122 +#define __TNETD73XX_H__
5124 +#ifndef _ASMLANGUAGE /* This part not for assembly language */
5126 +extern unsigned int tnetd73xx_mips_freq;
5127 +extern unsigned int tnetd73xx_vbus_freq;
5129 +#include "tnetd73xx_err.h"
5131 +#endif /* _ASMLANGUAGE */
5134 +/*******************************************************************************************
5135 +* Emerald core specific
5136 +******************************************************************************************** */
5139 +#elif defined(LITTLE_ENDIAN)
5141 +#error Need to define endianism
5145 +#define KSEG_MSK 0xE0000000 /* Most significant 3 bits denote kseg choice */
5148 +#ifndef KSEG_INV_MASK
5149 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
5153 +#define KSEG0_BASE 0x80000000
5157 +#define KSEG1_BASE 0xA0000000
5161 +#define KSEG0(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG0_BASE)
5165 +#define KSEG1(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG1_BASE)
5169 +#define KUSEG(addr) ((__u32)(addr) & ~KSEG_MSK)
5173 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
5177 +#define PHYS_TO_K0(addr) (PHYS_ADDR(addr)|KSEG0_BASE)
5181 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
5185 +#define REG8_ADDR(addr) (volatile __u8 *)(PHYS_TO_K1(addr))
5186 +#define REG8_DATA(addr) (*(volatile __u8 *)(PHYS_TO_K1(addr)))
5187 +#define REG8_WRITE(addr, data) REG8_DATA(addr) = data;
5188 +#define REG8_READ(addr, data) data = (__u8) REG8_DATA(addr);
5192 +#define REG16_ADDR(addr) (volatile __u16 *)(PHYS_TO_K1(addr))
5193 +#define REG16_DATA(addr) (*(volatile __u16 *)(PHYS_TO_K1(addr)))
5194 +#define REG16_WRITE(addr, data) REG16_DATA(addr) = data;
5195 +#define REG16_READ(addr, data) data = (__u16) REG16_DATA(addr);
5199 +#define REG32_ADDR(addr) (volatile __u32 *)(PHYS_TO_K1(addr))
5200 +#define REG32_DATA(addr) (*(volatile __u32 *)(PHYS_TO_K1(addr)))
5201 +#define REG32_WRITE(addr, data) REG32_DATA(addr) = data;
5202 +#define REG32_READ(addr, data) data = (__u32) REG32_DATA(addr);
5205 +#ifdef _LINK_KSEG0_ /* Application is linked into KSEG0 space */
5206 +#define VIRT_ADDR(addr) PHYS_TO_K0(PHYS_ADDR(addr))
5209 +#ifdef _LINK_KSEG1_ /* Application is linked into KSEG1 space */
5210 +#define VIRT_ADDR(addr) PHYS_TO_K1(PHYS_ADDR(addr))
5213 +#if !defined(_LINK_KSEG0_) && !defined(_LINK_KSEG1_)
5214 +#error You must define _LINK_KSEG0_ or _LINK_KSEG1_ to compile the code.
5217 +/* TNETD73XX chip definations */
5219 +#define FREQ_1MHZ 1000000
5220 +#define TNETD73XX_MIPS_FREQ tnetd73xx_mips_freq /* CPU clock frequency */
5221 +#define TNETD73XX_VBUS_FREQ tnetd73xx_vbus_freq /* originally (TNETD73XX_MIPS_FREQ/2) */
5224 +#define TNETD73XX_MIPS_FREQ_DEFAULT 25000000 /* 25 Mhz for sead2 board crystal */
5226 +#define TNETD73XX_MIPS_FREQ_DEFAULT 125000000 /* 125 Mhz */
5228 +#define TNETD73XX_VBUS_FREQ_DEFAULT (TNETD73XX_MIPS_FREQ_DEFAULT / 2) /* Sync mode */
5232 +/* Module base addresses */
5233 +#define TNETD73XX_ADSLSS_BASE PHYS_TO_K1(0x01000000) /* ADSLSS Module */
5234 +#define TNETD73XX_BBIF_CTRL_BASE PHYS_TO_K1(0x02000000) /* BBIF Control */
5235 +#define TNETD73XX_ATMSAR_BASE PHYS_TO_K1(0x03000000) /* ATM SAR */
5236 +#define TNETD73XX_USB_BASE PHYS_TO_K1(0x03400000) /* USB Module */
5237 +#define TNETD73XX_VLYNQ0_BASE PHYS_TO_K1(0x04000000) /* VLYNQ0 Module */
5238 +#define TNETD73xx_EMAC0_BASE PHYS_TO_K1(0x08610000) /* EMAC0 Module*/
5239 +#define TNETD73XX_EMIF_BASE PHYS_TO_K1(0x08610800) /* EMIF Module */
5240 +#define TNETD73XX_GPIO_BASE PHYS_TO_K1(0x08610900) /* GPIO control */
5241 +#define TNETD73XX_CLOCK_CTRL_BASE PHYS_TO_K1(0x08610A00) /* Clock Control */
5242 +#define TNETD73XX_WDTIMER_BASE PHYS_TO_K1(0x08610B00) /* WDTIMER Module */
5243 +#define TNETD73XX_TIMER0_BASE PHYS_TO_K1(0x08610C00) /* TIMER0 Module */
5244 +#define TNETD73XX_TIMER1_BASE PHYS_TO_K1(0x08610D00) /* TIMER1 Module */
5245 +#define TNETD73XX_UARTA_BASE PHYS_TO_K1(0x08610E00) /* UART A */
5246 +#define TNETD73XX_UARTB_BASE PHYS_TO_K1(0x08610F00) /* UART B */
5247 +#define TNETD73XX_I2C_BASE PHYS_TO_K1(0x08611000) /* I2C Module */
5248 +#define TNETD73XX_USB_DMA_BASE PHYS_TO_K1(0x08611200) /* USB Module */
5249 +#define TNETD73XX_MCDMA_BASE PHYS_TO_K1(0x08611400) /* MC-DMA */
5250 +#define TNETD73xx_VDMAVT_BASE PHYS_TO_K1(0x08611500) /* VDMAVT Control */
5251 +#define TNETD73XX_RST_CTRL_BASE PHYS_TO_K1(0x08611600) /* Reset Control */
5252 +#define TNETD73xx_BIST_CTRL_BASE PHYS_TO_K1(0x08611700) /* BIST Control */
5253 +#define TNETD73xx_VLYNQ0_CTRL_BASE PHYS_TO_K1(0x08611800) /* VLYNQ0 Control */
5254 +#define TNETD73XX_DCL_BASE PHYS_TO_K1(0x08611A00) /* Device Configuration Latch */
5255 +#define TNETD73xx_VLYNQ1_CTRL_BASE PHYS_TO_K1(0x08611C00) /* VLYNQ1 Control */
5256 +#define TNETD73xx_MDIO_BASE PHYS_TO_K1(0x08611E00) /* MDIO Control */
5257 +#define TNETD73XX_FSER_BASE PHYS_TO_K1(0x08612000) /* FSER Control */
5258 +#define TNETD73XX_INTC_BASE PHYS_TO_K1(0x08612400) /* Interrupt Controller */
5259 +#define TNETD73xx_EMAC1_BASE PHYS_TO_K1(0x08612800) /* EMAC1 Module*/
5260 +#define TNETD73XX_VLYNQ1_BASE PHYS_TO_K1(0x0C000000) /* VLYNQ1 Module */
5262 +/* BBIF Registers */
5263 +#define TNETD73XX_BBIF_ADSLADR (TNETD73XX_BBIF_CTRL_BASE + 0x0)
5265 +/* Device Configuration Latch Registers */
5266 +#define TNETD73XX_DCL_BOOTCR (TNETD73XX_DCL_BASE + 0x0)
5267 +#define TNETD73XX_DCL_DPLLSELR (TNETD73XX_DCL_BASE + 0x10)
5268 +#define TNETD73XX_DCL_SPEEDCTLR (TNETD73XX_DCL_BASE + 0x14)
5269 +#define TNETD73XX_DCL_SPEEDPWDR (TNETD73XX_DCL_BASE + 0x18)
5270 +#define TNETD73XX_DCL_SPEEDCAPR (TNETD73XX_DCL_BASE + 0x1C)
5273 +#define TNETD73XX_GPIODINR (TNETD73XX_GPIO_BASE + 0x0)
5274 +#define TNETD73XX_GPIODOUTR (TNETD73XX_GPIO_BASE + 0x4)
5275 +#define TNETD73XX_GPIOPDIRR (TNETD73XX_GPIO_BASE + 0x8)
5276 +#define TNETD73XX_GPIOENR (TNETD73XX_GPIO_BASE + 0xC)
5277 +#define TNETD73XX_CVR (TNETD73XX_GPIO_BASE + 0x14)
5278 +#define TNETD73XX_DIDR1 (TNETD73XX_GPIO_BASE + 0x18)
5279 +#define TNETD73XX_DIDR2 (TNETD73XX_GPIO_BASE + 0x1C)
5281 +/* Reset Control */
5282 +#define TNETD73XX_RST_CTRL_PRCR (TNETD73XX_RST_CTRL_BASE + 0x0)
5283 +#define TNETD73XX_RST_CTRL_SWRCR (TNETD73XX_RST_CTRL_BASE + 0x4)
5284 +#define TNETD73XX_RST_CTRL_RSR (TNETD73XX_RST_CTRL_BASE + 0x8)
5286 +/* Power Control */
5287 +#define TNETD73XX_POWER_CTRL_PDCR (TNETD73XX_CLOCK_CTRL_BASE + 0x0)
5288 +#define TNETD73XX_POWER_CTRL_PCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x4)
5289 +#define TNETD73XX_POWER_CTRL_PDUCR (TNETD73XX_CLOCK_CTRL_BASE + 0x8)
5290 +#define TNETD73XX_POWER_CTRL_WKCR (TNETD73XX_CLOCK_CTRL_BASE + 0xC)
5292 +/* Clock Control */
5293 +#define TNETD73XX_CLK_CTRL_SCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x20)
5294 +#define TNETD73XX_CLK_CTRL_SCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x30)
5295 +#define TNETD73XX_CLK_CTRL_MCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x40)
5296 +#define TNETD73XX_CLK_CTRL_MCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x50)
5297 +#define TNETD73XX_CLK_CTRL_UCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x60)
5298 +#define TNETD73XX_CLK_CTRL_UCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x70)
5299 +#define TNETD73XX_CLK_CTRL_ACLKCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x80)
5300 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x90)
5301 +#define TNETD73XX_CLK_CTRL_ACLKCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xA0)
5302 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xB0)
5305 +#define TNETD73XX_EMIF_SDRAM_CFG ( TNETD73XX_EMIF_BASE + 0x08 )
5309 +#define TNETD73XX_UART_FREQ 3686400
5311 +#define TNETD73XX_UART_FREQ TNETD73XX_VBUS_FREQ
5314 +/* Interrupt Controller */
5316 +/* Primary interrupts */
5317 +#define TNETD73XX_INTC_UNIFIED_SECONDARY 0 /* Unified secondary interrupt */
5318 +#define TNETD73XX_INTC_EXTERNAL0 1 /* External Interrupt Line 0 */
5319 +#define TNETD73XX_INTC_EXTERNAL1 2 /* External Interrupt Line 1 */
5320 +#define TNETD73XX_INTC_RESERVED3 3 /* Reserved */
5321 +#define TNETD73XX_INTC_RESERVED4 4 /* Reserved */
5322 +#define TNETD73XX_INTC_TIMER0 5 /* TIMER 0 int */
5323 +#define TNETD73XX_INTC_TIMER1 6 /* TIMER 1 int */
5324 +#define TNETD73XX_INTC_UART0 7 /* UART 0 int */
5325 +#define TNETD73XX_INTC_UART1 8 /* UART 1 int */
5326 +#define TNETD73XX_INTC_MCDMA0 9 /* MCDMA 0 int */
5327 +#define TNETD73XX_INTC_MCDMA1 10 /* MCDMA 1 int */
5328 +#define TNETD73XX_INTC_RESERVED11 11 /* Reserved */
5329 +#define TNETD73XX_INTC_RESERVED12 12 /* Reserved */
5330 +#define TNETD73XX_INTC_RESERVED13 13 /* Reserved */
5331 +#define TNETD73XX_INTC_RESERVED14 14 /* Reserved */
5332 +#define TNETD73XX_INTC_ATMSAR 15 /* ATM SAR int */
5333 +#define TNETD73XX_INTC_RESERVED16 16 /* Reserved */
5334 +#define TNETD73XX_INTC_RESERVED17 17 /* Reserved */
5335 +#define TNETD73XX_INTC_RESERVED18 18 /* Reserved */
5336 +#define TNETD73XX_INTC_EMAC0 19 /* EMAC 0 int */
5337 +#define TNETD73XX_INTC_RESERVED20 20 /* Reserved */
5338 +#define TNETD73XX_INTC_VLYNQ0 21 /* VLYNQ 0 int */
5339 +#define TNETD73XX_INTC_CODEC 22 /* CODEC int */
5340 +#define TNETD73XX_INTC_RESERVED23 23 /* Reserved */
5341 +#define TNETD73XX_INTC_USBSLAVE 24 /* USB Slave int */
5342 +#define TNETD73XX_INTC_VLYNQ1 25 /* VLYNQ 1 int */
5343 +#define TNETD73XX_INTC_RESERVED26 26 /* Reserved */
5344 +#define TNETD73XX_INTC_RESERVED27 27 /* Reserved */
5345 +#define TNETD73XX_INTC_ETH_PHY 28 /* Ethernet PHY */
5346 +#define TNETD73XX_INTC_I2C 29 /* I2C int */
5347 +#define TNETD73XX_INTC_MCDMA2 30 /* MCDMA 2 int */
5348 +#define TNETD73XX_INTC_MCDMA3 31 /* MCDMA 3 int */
5349 +#define TNETD73XX_INTC_RESERVED32 32 /* Reserved */
5350 +#define TNETD73XX_INTC_EMAC1 33 /* EMAC 1 int */
5351 +#define TNETD73XX_INTC_RESERVED34 34 /* Reserved */
5352 +#define TNETD73XX_INTC_RESERVED35 35 /* Reserved */
5353 +#define TNETD73XX_INTC_RESERVED36 36 /* Reserved */
5354 +#define TNETD73XX_INTC_VDMAVTRX 37 /* VDMAVTRX */
5355 +#define TNETD73XX_INTC_VDMAVTTX 38 /* VDMAVTTX */
5356 +#define TNETD73XX_INTC_ADSLSS 39 /* ADSLSS */
5358 +/* Secondary interrupts */
5359 +#define TNETD73XX_INTC_SEC0 40 /* Secondary */
5360 +#define TNETD73XX_INTC_SEC1 41 /* Secondary */
5361 +#define TNETD73XX_INTC_SEC2 42 /* Secondary */
5362 +#define TNETD73XX_INTC_SEC3 43 /* Secondary */
5363 +#define TNETD73XX_INTC_SEC4 44 /* Secondary */
5364 +#define TNETD73XX_INTC_SEC5 45 /* Secondary */
5365 +#define TNETD73XX_INTC_SEC6 46 /* Secondary */
5366 +#define TNETD73XX_INTC_EMIF 47 /* EMIF */
5367 +#define TNETD73XX_INTC_SEC8 48 /* Secondary */
5368 +#define TNETD73XX_INTC_SEC9 49 /* Secondary */
5369 +#define TNETD73XX_INTC_SEC10 50 /* Secondary */
5370 +#define TNETD73XX_INTC_SEC11 51 /* Secondary */
5371 +#define TNETD73XX_INTC_SEC12 52 /* Secondary */
5372 +#define TNETD73XX_INTC_SEC13 53 /* Secondary */
5373 +#define TNETD73XX_INTC_SEC14 54 /* Secondary */
5374 +#define TNETD73XX_INTC_SEC15 55 /* Secondary */
5375 +#define TNETD73XX_INTC_SEC16 56 /* Secondary */
5376 +#define TNETD73XX_INTC_SEC17 57 /* Secondary */
5377 +#define TNETD73XX_INTC_SEC18 58 /* Secondary */
5378 +#define TNETD73XX_INTC_SEC19 59 /* Secondary */
5379 +#define TNETD73XX_INTC_SEC20 60 /* Secondary */
5380 +#define TNETD73XX_INTC_SEC21 61 /* Secondary */
5381 +#define TNETD73XX_INTC_SEC22 62 /* Secondary */
5382 +#define TNETD73XX_INTC_SEC23 63 /* Secondary */
5383 +#define TNETD73XX_INTC_SEC24 64 /* Secondary */
5384 +#define TNETD73XX_INTC_SEC25 65 /* Secondary */
5385 +#define TNETD73XX_INTC_SEC26 66 /* Secondary */
5386 +#define TNETD73XX_INTC_SEC27 67 /* Secondary */
5387 +#define TNETD73XX_INTC_SEC28 68 /* Secondary */
5388 +#define TNETD73XX_INTC_SEC29 69 /* Secondary */
5389 +#define TNETD73XX_INTC_SEC30 70 /* Secondary */
5390 +#define TNETD73XX_INTC_SEC31 71 /* Secondary */
5392 +/* These ugly macros are to access the -1 registers, like config1 */
5393 +#define MFC0_SEL1_OPCODE(dst, src)\
5394 + .word (0x40000000 | ((dst)<<16) | ((src)<<11) | 1);\
5399 +#define MTC0_SEL1_OPCODE(dst, src)\
5400 + .word (0x40800000 | ((dst)<<16) | ((src)<<11) | 1);\
5406 +/* Below are Jade core specific */
5407 +#define CFG0_4K_IL_MASK 0x00380000
5408 +#define CFG0_4K_IL_SHIFT 19
5409 +#define CFG0_4K_IA_MASK 0x00070000
5410 +#define CFG0_4K_IA_SHIFT 16
5411 +#define CFG0_4K_IS_MASK 0x01c00000
5412 +#define CFG0_4K_IS_SHIFT 22
5414 +#define CFG0_4K_DL_MASK 0x00001c00
5415 +#define CFG0_4K_DL_SHIFT 10
5416 +#define CFG0_4K_DA_MASK 0x00000380
5417 +#define CFG0_4K_DA_SHIFT 7
5418 +#define CFG0_4K_DS_MASK 0x0000E000
5419 +#define CFG0_4K_DS_SHIFT 13
5423 +#endif /* __TNETD73XX_H_ */
5424 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_err.h linux.dev/include/asm-mips/ar7/tnetd73xx_err.h
5425 --- linux.old/include/asm-mips/ar7/tnetd73xx_err.h 1970-01-01 01:00:00.000000000 +0100
5426 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_err.h 2005-07-26 18:11:02.649500000 +0200
5428 +/******************************************************************************
5429 + * FILE PURPOSE: TNETD73xx Error Definations Header File
5430 + ******************************************************************************
5431 + * FILE NAME: tnetd73xx_err.h
5433 + * DESCRIPTION: Error definations for TNETD73XX
5435 + * REVISION HISTORY:
5436 + * 27 Nov 02 - PSP TII
5438 + * (C) Copyright 2002, Texas Instruments, Inc
5439 + *******************************************************************************/
5442 +#ifndef __TNETD73XX_ERR_H__
5443 +#define __TNETD73XX_ERR_H__
5445 +typedef enum TNETD73XX_ERR_t
5447 + TNETD73XX_ERR_OK = 0, /* OK or SUCCESS */
5448 + TNETD73XX_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
5450 + /* Pointers and args */
5451 + TNETD73XX_ERR_INVARG = -2, /* Invaild argument to the call */
5452 + TNETD73XX_ERR_NULLPTR = -3, /* NULL pointer */
5453 + TNETD73XX_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
5455 + /* Memory issues */
5456 + TNETD73XX_ERR_ALLOC_FAIL = -10, /* allocation failed */
5457 + TNETD73XX_ERR_FREE_FAIL = -11, /* free failed */
5458 + TNETD73XX_ERR_MEM_CORRUPT = -12, /* corrupted memory */
5459 + TNETD73XX_ERR_BUF_LINK = -13, /* buffer linking failed */
5461 + /* Device issues */
5462 + TNETD73XX_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
5463 + TNETD73XX_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
5465 + TNETD73XX_ERR_INVID = -30 /* Invalid ID */
5469 +#endif /* __TNETD73XX_ERR_H__ */
5470 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_misc.h linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h
5471 --- linux.old/include/asm-mips/ar7/tnetd73xx_misc.h 1970-01-01 01:00:00.000000000 +0100
5472 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h 2005-07-26 18:11:02.651500000 +0200
5474 +/******************************************************************************
5475 + * FILE PURPOSE: TNETD73xx Misc modules API Header
5476 + ******************************************************************************
5477 + * FILE NAME: tnetd73xx_misc.h
5479 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
5480 + * FSER Modules API
5481 + * As per TNETD73xx specifications
5483 + * REVISION HISTORY:
5484 + * 27 Nov 02 - Sharath Kumar PSP TII
5485 + * 14 Feb 03 - Anant Gole PSP TII
5487 + * (C) Copyright 2002, Texas Instruments, Inc
5488 + *******************************************************************************/
5490 +#ifndef __TNETD73XX_MISC_H__
5491 +#define __TNETD73XX_MISC_H__
5493 +/*****************************************************************************
5494 + * Reset Control Module
5495 + *****************************************************************************/
5497 +typedef enum TNETD73XX_RESET_MODULE_tag
5499 + RESET_MODULE_UART0 = 0,
5500 + RESET_MODULE_UART1 = 1,
5501 + RESET_MODULE_I2C = 2,
5502 + RESET_MODULE_TIMER0 = 3,
5503 + RESET_MODULE_TIMER1 = 4,
5504 + RESET_MODULE_GPIO = 6,
5505 + RESET_MODULE_ADSLSS = 7,
5506 + RESET_MODULE_USBS = 8,
5507 + RESET_MODULE_SAR = 9,
5508 + RESET_MODULE_VDMA_VT = 11,
5509 + RESET_MODULE_FSER = 12,
5510 + RESET_MODULE_VLYNQ1 = 16,
5511 + RESET_MODULE_EMAC0 = 17,
5512 + RESET_MODULE_DMA = 18,
5513 + RESET_MODULE_BIST = 19,
5514 + RESET_MODULE_VLYNQ0 = 20,
5515 + RESET_MODULE_EMAC1 = 21,
5516 + RESET_MODULE_MDIO = 22,
5517 + RESET_MODULE_ADSLSS_DSP = 23,
5518 + RESET_MODULE_EPHY = 26
5519 +} TNETD73XX_RESET_MODULE_T;
5521 +typedef enum TNETD73XX_RESET_CTRL_tag
5525 +} TNETD73XX_RESET_CTRL_T;
5527 +typedef enum TNETD73XX_SYS_RST_MODE_tag
5529 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
5530 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
5531 +} TNETD73XX_SYS_RST_MODE_T;
5533 +typedef enum TNETD73XX_SYS_RESET_STATUS_tag
5535 + HARDWARE_RESET = 0,
5536 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
5538 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
5539 +} TNETD73XX_SYS_RESET_STATUS_T;
5541 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module,
5542 + TNETD73XX_RESET_CTRL_T reset_ctrl);
5543 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status(TNETD73XX_RESET_MODULE_T reset_module);
5544 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode);
5545 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status(void);
5547 +/*****************************************************************************
5548 + * Power Control Module
5549 + *****************************************************************************/
5551 +typedef enum TNETD73XX_POWER_MODULE_tag
5553 + POWER_MODULE_USBSP = 0,
5554 + POWER_MODULE_WDTP = 1,
5555 + POWER_MODULE_UT0P = 2,
5556 + POWER_MODULE_UT1P = 3,
5557 + POWER_MODULE_IICP = 4,
5558 + POWER_MODULE_VDMAP = 5,
5559 + POWER_MODULE_GPIOP = 6,
5560 + POWER_MODULE_VLYNQ1P = 7,
5561 + POWER_MODULE_SARP = 8,
5562 + POWER_MODULE_ADSLP = 9,
5563 + POWER_MODULE_EMIFP = 10,
5564 + POWER_MODULE_ADSPP = 12,
5565 + POWER_MODULE_RAMP = 13,
5566 + POWER_MODULE_ROMP = 14,
5567 + POWER_MODULE_DMAP = 15,
5568 + POWER_MODULE_BISTP = 16,
5569 + POWER_MODULE_TIMER0P = 18,
5570 + POWER_MODULE_TIMER1P = 19,
5571 + POWER_MODULE_EMAC0P = 20,
5572 + POWER_MODULE_EMAC1P = 22,
5573 + POWER_MODULE_EPHYP = 24,
5574 + POWER_MODULE_VLYNQ0P = 27,
5575 +} TNETD73XX_POWER_MODULE_T;
5577 +typedef enum TNETD73XX_POWER_CTRL_tag
5579 + POWER_CTRL_POWER_UP = 0,
5580 + POWER_CTRL_POWER_DOWN
5581 +} TNETD73XX_POWER_CTRL_T;
5583 +typedef enum TNETD73XX_SYS_POWER_MODE_tag
5585 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
5586 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
5587 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
5588 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
5589 +} TNETD73XX_SYS_POWER_MODE_T;
5591 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl);
5592 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module);
5593 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode);
5594 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode(void);
5596 +/*****************************************************************************
5598 + *****************************************************************************/
5600 +typedef enum TNETD73XX_WAKEUP_INTERRUPT_tag
5606 +} TNETD73XX_WAKEUP_INTERRUPT_T;
5608 +typedef enum TNETD73XX_WAKEUP_CTRL_tag
5610 + WAKEUP_DISABLED = 0,
5612 +} TNETD73XX_WAKEUP_CTRL_T;
5614 +typedef enum TNETD73XX_WAKEUP_POLARITY_tag
5616 + WAKEUP_ACTIVE_HIGH = 0,
5618 +} TNETD73XX_WAKEUP_POLARITY_T;
5620 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
5621 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
5622 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity);
5624 +/*****************************************************************************
5626 + *****************************************************************************/
5628 +typedef enum TNETD73XX_FSER_MODE_tag
5632 +} TNETD73XX_FSER_MODE_T;
5634 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode);
5636 +/*****************************************************************************
5638 + *****************************************************************************/
5640 +#define CLK_MHZ(x) ( (x) * 1000000 )
5642 +typedef enum TNETD73XX_CLKC_ID_tag
5648 +} TNETD73XX_CLKC_ID_T;
5650 +void tnetd73xx_clkc_init(__u32 afeclk, __u32 refclk, __u32 xtal3in);
5651 +TNETD73XX_ERR tnetd73xx_clkc_set_freq(TNETD73XX_CLKC_ID_T clk_id, __u32 output_freq);
5652 +__u32 tnetd73xx_clkc_get_freq(TNETD73XX_CLKC_ID_T clk_id);
5654 +/*****************************************************************************
5656 + *****************************************************************************/
5658 +typedef enum TNETD73XX_GPIO_PIN_tag
5660 + GPIO_UART0_RD = 0,
5661 + GPIO_UART0_TD = 1,
5662 + GPIO_UART0_RTS = 2,
5663 + GPIO_UART0_CTS = 3,
5664 + GPIO_FSER_CLK = 4,
5666 + GPIO_EXT_AFE_SCLK = 6,
5667 + GPIO_EXT_AFE_TX_FS = 7,
5668 + GPIO_EXT_AFE_TXD = 8,
5669 + GPIO_EXT_AFE_RS_FS = 9,
5670 + GPIO_EXT_AFE_RXD1 = 10,
5671 + GPIO_EXT_AFE_RXD0 = 11,
5672 + GPIO_EXT_AFE_CDIN = 12,
5673 + GPIO_EXT_AFE_CDOUT = 13,
5674 + GPIO_EPHY_SPEED100 = 14,
5675 + GPIO_EPHY_LINKON = 15,
5676 + GPIO_EPHY_ACTIVITY = 16,
5677 + GPIO_EPHY_FDUPLEX = 17,
5680 + GPIO_MBSP0_TCLK = 20,
5681 + GPIO_MBSP0_RCLK = 21,
5682 + GPIO_MBSP0_RD = 22,
5683 + GPIO_MBSP0_TD = 23,
5684 + GPIO_MBSP0_RFS = 24,
5685 + GPIO_MBSP0_TFS = 25,
5686 + GPIO_MII_DIO = 26,
5687 + GPIO_MII_DCLK = 27,
5688 +} TNETD73XX_GPIO_PIN_T;
5690 +typedef enum TNETD73XX_GPIO_PIN_MODE_tag
5692 + FUNCTIONAL_PIN = 0,
5694 +} TNETD73XX_GPIO_PIN_MODE_T;
5696 +typedef enum TNETD73XX_GPIO_PIN_DIRECTION_tag
5698 + GPIO_OUTPUT_PIN = 0,
5699 + GPIO_INPUT_PIN = 1
5700 +} TNETD73XX_GPIO_PIN_DIRECTION_T;
5702 +void tnetd73xx_gpio_init(void);
5703 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
5704 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
5705 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction);
5706 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value);
5707 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin);
5709 +/* TNETD73XX Revision */
5710 +__u32 tnetd73xx_get_revision(void);
5712 +#endif /* __TNETD73XX_MISC_H__ */
5713 diff -urN linux.old/include/asm-mips/io.h linux.dev/include/asm-mips/io.h
5714 --- linux.old/include/asm-mips/io.h 2005-07-26 18:18:16.283578056 +0200
5715 +++ linux.dev/include/asm-mips/io.h 2005-07-26 18:11:02.651500000 +0200
5717 #ifdef CONFIG_64BIT_PHYS_ADDR
5718 #define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
5720 +#ifdef CONFIG_AR7_PAGING
5721 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + CONFIG_AR7_MEMORY)
5723 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
5727 #define IO_SPACE_LIMIT 0xffff
5729 diff -urN linux.old/include/asm-mips/irq.h linux.dev/include/asm-mips/irq.h
5730 --- linux.old/include/asm-mips/irq.h 2005-07-26 18:18:16.284577904 +0200
5731 +++ linux.dev/include/asm-mips/irq.h 2005-07-26 18:11:02.652500000 +0200
5733 #include <linux/config.h>
5734 #include <linux/linkage.h>
5737 +#include <asm/ar7/avalanche_intc.h>
5738 +#define NR_IRQS AVALANCHE_INT_END + 1
5740 #define NR_IRQS 128 /* Largest number of ints of all machines. */
5744 static inline int irq_cannonicalize(int irq)
5745 diff -urN linux.old/include/asm-mips/page.h linux.dev/include/asm-mips/page.h
5746 --- linux.old/include/asm-mips/page.h 2005-07-26 18:18:16.284577904 +0200
5747 +++ linux.dev/include/asm-mips/page.h 2005-07-26 18:11:02.652500000 +0200
5748 @@ -129,7 +129,11 @@
5750 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
5751 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
5752 +#ifdef CONFIG_AR7_PAGING
5753 +#define virt_to_page(kaddr) phys_to_page(__pa(kaddr))
5755 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
5757 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
5759 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
5760 diff -urN linux.old/include/asm-mips/pgtable-32.h linux.dev/include/asm-mips/pgtable-32.h
5761 --- linux.old/include/asm-mips/pgtable-32.h 2005-07-26 18:18:16.284577904 +0200
5762 +++ linux.dev/include/asm-mips/pgtable-32.h 2005-07-26 18:11:02.653499000 +0200
5763 @@ -108,7 +108,18 @@
5764 * and a page entry and page directory to the page they refer to.
5767 -#ifdef CONFIG_CPU_VR41XX
5768 +#if defined(CONFIG_AR7_PAGING)
5769 +#define mk_pte(page, pgprot) \
5773 + pte_val(__pte) = ((phys_t)(page - mem_map) << (PAGE_SHIFT) | \
5774 + CONFIG_AR7_MEMORY) | \
5775 + pgprot_val(pgprot); \
5779 +#elif defined(CONFIG_CPU_VR41XX)
5780 #define mk_pte(page, pgprot) \
5788 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
5790 #ifdef CONFIG_CPU_VR41XX
5791 @@ -175,7 +187,10 @@
5792 set_pte(ptep, __pte(0));
5795 -#ifdef CONFIG_CPU_VR41XX
5796 +#if defined(CONFIG_AR7_PAGING)
5797 +#define phys_to_page(phys) (mem_map + (((phys)-CONFIG_AR7_MEMORY) >> PAGE_SHIFT))
5798 +#define pte_page(x) phys_to_page(pte_val(x))
5799 +#elif defined(CONFIG_CPU_VR41XX)
5800 #define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> (PAGE_SHIFT+2)))))
5801 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << (PAGE_SHIFT+2)) | pgprot_val(pgprot))
5803 diff -urN linux.old/include/asm-mips/serial.h linux.dev/include/asm-mips/serial.h
5804 --- linux.old/include/asm-mips/serial.h 2005-07-26 18:18:16.285577752 +0200
5805 +++ linux.dev/include/asm-mips/serial.h 2005-07-26 18:11:02.654499000 +0200
5808 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
5811 +#include <asm/ar7/ar7.h>
5812 +#define AR7_SERIAL_PORT_DEFNS \
5813 + { 0, AR7_BASE_BAUD, AR7_UART0_REGS_BASE, LNXINTNUM(AVALANCHE_UART0_INT), STD_COM_FLAGS }, \
5814 + { 0, AR7_BASE_BAUD, AR7_UART1_REGS_BASE, LNXINTNUM(AVALANCHE_UART1_INT), STD_COM_FLAGS },
5816 +#define AR7_SERIAL_PORT_DEFNS
5819 #ifdef CONFIG_MIPS_JAZZ
5820 #define _JAZZ_SERIAL_INIT(int, base) \
5821 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
5825 #define SERIAL_PORT_DFNS \
5826 + AR7_SERIAL_PORT_DEFNS \
5827 ATLAS_SERIAL_PORT_DEFNS \
5828 AU1000_SERIAL_PORT_DEFNS \
5829 COBALT_SERIAL_PORT_DEFNS \