1 diff -urN linux.old/arch/mips/ar7/cmdline.c linux.dev/arch/mips/ar7/cmdline.c
2 --- linux.old/arch/mips/ar7/cmdline.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux.dev/arch/mips/ar7/cmdline.c 2005-08-12 19:32:05.137225512 +0200
6 + * Carsten Langgaard, carstenl@mips.com
7 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
9 + * This program is free software; you can distribute it and/or modify it
10 + * under the terms of the GNU General Public License (Version 2) as
11 + * published by the Free Software Foundation.
13 + * This program is distributed in the hope it will be useful, but WITHOUT
14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 + * You should have received a copy of the GNU General Public License along
19 + * with this program; if not, write to the Free Software Foundation, Inc.,
20 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 + * Kernel command line creation using the prom monitor (YAMON) argc/argv.
24 +#include <linux/init.h>
25 +#include <linux/string.h>
27 +#include <asm/bootinfo.h>
29 +extern int prom_argc;
30 +extern int *_prom_argv;
33 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
34 + * This macro take care of sign extension.
36 +#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
38 +char arcs_cmdline[CL_SIZE];
40 +char * __init prom_getcmdline(void)
42 + return &(arcs_cmdline[0]);
46 +void __init prom_init_cmdline(void)
51 + actr = 1; /* Always ignore argv[0] */
53 + cp = &(arcs_cmdline[0]);
54 +#ifdef CONFIG_CMDLINE_BOOL
55 + strcpy(cp, CONFIG_CMDLINE);
56 + cp += strlen(CONFIG_CMDLINE);
59 + while(actr < prom_argc) {
60 + strcpy(cp, prom_argv(actr));
61 + cp += strlen(prom_argv(actr));
65 + if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
69 diff -urN linux.old/arch/mips/ar7/init.c linux.dev/arch/mips/ar7/init.c
70 --- linux.old/arch/mips/ar7/init.c 1970-01-01 01:00:00.000000000 +0100
71 +++ linux.dev/arch/mips/ar7/init.c 2005-08-12 19:34:07.215666768 +0200
74 + * Carsten Langgaard, carstenl@mips.com
75 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
77 + * This program is free software; you can distribute it and/or modify it
78 + * under the terms of the GNU General Public License (Version 2) as
79 + * published by the Free Software Foundation.
81 + * This program is distributed in the hope it will be useful, but WITHOUT
82 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
83 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
86 + * You should have received a copy of the GNU General Public License along
87 + * with this program; if not, write to the Free Software Foundation, Inc.,
88 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
90 + * PROM library initialisation code.
92 +#include <linux/config.h>
93 +#include <linux/init.h>
94 +#include <linux/string.h>
95 +#include <linux/kernel.h>
96 +#include <linux/module.h>
99 +#include <asm/mips-boards/prom.h>
100 +#include <asm/mips-boards/generic.h>
102 +/* Environment variable */
109 +int *_prom_argv, *_prom_envp;
111 +/* max # of Adam2 environment variables */
112 +#define MAX_ENV_ENTRY 80
114 +static t_env_var local_envp[MAX_ENV_ENTRY];
115 +static int env_type = 0;
118 +unsigned int max_env_entry;
120 +extern char *prom_psp_getenv(char *envname);
122 +static inline char *prom_adam2_getenv(char *envname)
125 + * Return a pointer to the given environment variable.
126 + * In 64-bit mode: we're using 64-bit pointers, but all pointers
127 + * in the PROM structures are only 32-bit, so we need some
128 + * workarounds, if we are running in 64-bit mode.
131 + t_env_var *env = (t_env_var *) local_envp;
133 + if (strcmp("bootloader", envname) == 0)
136 + i = strlen(envname);
137 + while (env->name) {
138 + if(strncmp(envname, env->name, i) == 0) {
147 +char *prom_getenv(char *envname)
150 + return prom_psp_getenv(envname);
152 + return prom_adam2_getenv(envname);
155 +static inline unsigned char str2hexnum(unsigned char c)
157 + if (c >= '0' && c <= '9')
159 + if (c >= 'a' && c <= 'f')
160 + return c - 'a' + 10;
161 + return 0; /* foo */
164 +static inline void str2eaddr(unsigned char *ea, unsigned char *str)
168 + for (i = 0; i < 6; i++) {
171 + if((*str == '.') || (*str == ':'))
173 + num = str2hexnum(*str++) << 4;
174 + num |= (str2hexnum(*str++));
179 +int get_ethernet_addr(char *ethernet_addr)
183 + ethaddr_str = prom_getenv("ethaddr");
184 + if (!ethaddr_str) {
185 + printk("ethaddr not set in boot prom\n");
188 + str2eaddr(ethernet_addr, ethaddr_str);
190 + if (init_debug > 1) {
192 + printk("get_ethernet_addr: ");
193 + for (i=0; i<5; i++)
194 + printk("%02x:", (unsigned char)*(ethernet_addr+i));
195 + printk("%02x\n", *(ethernet_addr+i));
202 + unsigned int psbl_size;
203 + unsigned int env_base;
204 + unsigned int env_size;
205 + unsigned int ffs_base;
206 + unsigned int ffs_size;
209 +static const char psp_env_version[] = "TIENV0.8";
211 +int __init prom_init(int argc, char **argv, char **envp)
215 + t_env_var *env = (t_env_var *) envp;
216 + struct psbl_rec *psbl = (struct psbl_rec *)(KSEG1ADDR(0x94000300));
217 + void *psp_env = (void *)KSEG1ADDR(psbl->env_base);
220 + _prom_argv = (int *)argv;
221 + _prom_envp = (int *)envp;
223 + if(strcmp(psp_env, psp_env_version) == 0) {
227 + _prom_envp = psp_env;
228 + max_env_entry = (psbl->env_size / 16) - 1;
230 + /* Copy what we need locally so we are not dependent on
231 + * bootloader RAM. In Adam2, the environment parameters
232 + * are in flash but the table that references them is in
236 + for(i=0; i < MAX_ENV_ENTRY; i++, env++) {
238 + local_envp[i].name = env->name;
239 + local_envp[i].val = env->val;
241 + local_envp[i].name = NULL;
242 + local_envp[i].val = NULL;
247 + set_io_port_base(0);
249 + prom_printf("\nLINUX started...\n");
250 + prom_init_cmdline();
255 diff -urN linux.old/arch/mips/ar7/irq.c linux.dev/arch/mips/ar7/irq.c
256 --- linux.old/arch/mips/ar7/irq.c 1970-01-01 01:00:00.000000000 +0100
257 +++ linux.dev/arch/mips/ar7/irq.c 2005-08-12 23:42:18.679820112 +0200
260 + * Nitin Dhingra, iamnd@ti.com
261 + * Copyright (C) 2002 Texas Instruments, Inc. All rights reserved.
263 + * ########################################################################
265 + * This program is free software; you can distribute it and/or modify it
266 + * under the terms of the GNU General Public License (Version 2) as
267 + * published by the Free Software Foundation.
269 + * This program is distributed in the hope it will be useful, but WITHOUT
270 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
271 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
272 + * for more details.
274 + * You should have received a copy of the GNU General Public License along
275 + * with this program; if not, write to the Free Software Foundation, Inc.,
276 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
278 + * ########################################################################
280 + * Routines for generic manipulation of the interrupts found on the Texas
281 + * Instruments avalanche board
285 +#include <linux/config.h>
286 +#include <linux/init.h>
287 +#include <linux/sched.h>
288 +#include <linux/slab.h>
289 +#include <linux/interrupt.h>
290 +#include <linux/kernel_stat.h>
291 +#include <linux/proc_fs.h>
292 +#include <asm/irq.h>
293 +#include <asm/mips-boards/prom.h>
294 +#include <asm/ar7/ar7.h>
295 +#include <asm/ar7/avalanche_intc.h>
296 +#include <asm/gdb-stub.h>
299 +#define shutdown_avalanche_irq disable_avalanche_irq
300 +#define mask_and_ack_avalanche_irq disable_avalanche_irq
302 +static unsigned int startup_avalanche_irq(unsigned int irq);
303 +static void end_avalanche_irq(unsigned int irq);
304 +void enable_avalanche_irq(unsigned int irq_nr);
305 +void disable_avalanche_irq(unsigned int irq_nr);
307 +static struct hw_interrupt_type avalanche_irq_type = {
309 + startup_avalanche_irq,
310 + shutdown_avalanche_irq,
311 + enable_avalanche_irq,
312 + disable_avalanche_irq,
313 + mask_and_ack_avalanche_irq,
318 +irq_desc_t irq_desc_ti[AVALANCHE_INT_END+1] __cacheline_aligned =
319 +{ [0 ... AVALANCHE_INT_END] = { 0, &avalanche_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}};
322 +unsigned long spurious_count = 0;
324 +struct avalanche_ictrl_regs *avalanche_hw0_icregs; /* Interrupt control regs (primary) */
325 +struct avalanche_exctrl_regs *avalanche_hw0_ecregs; /* Exception control regs (secondary) */
326 +struct avalanche_ipace_regs *avalanche_hw0_ipaceregs;
327 +struct avalanche_channel_int_number *avalanche_hw0_chregs; /* Channel control registers */
329 +extern asmlinkage void mipsIRQ(void);
333 + * The avalanche/MIPS interrupt line numbers are used to represent the
334 + * interrupts within the irqaction arrays. The index notation is
337 + * 0-7 MIPS CPU Exceptions (HW/SW)
338 + * 8-47 Primary Interrupts (Avalanche)
339 + * 48-79 Secondary Interrupts (Avalanche)
344 +static struct irqaction *hw0_irq_action_primary[AVINTNUM(AVALANCHE_INT_END_PRIMARY)] =
346 + NULL, NULL, NULL, NULL,
347 + NULL, NULL, NULL, NULL,
348 + NULL, NULL, NULL, NULL,
349 + NULL, NULL, NULL, NULL,
350 + NULL, NULL, NULL, NULL,
351 + NULL, NULL, NULL, NULL,
352 + NULL, NULL, NULL, NULL,
353 + NULL, NULL, NULL, NULL,
354 + NULL, NULL, NULL, NULL,
355 + NULL, NULL, NULL, NULL
358 +static struct irqaction *hw0_irq_action_secondary[AVINTNUM(AVALANCHE_INT_END_SECONDARY)] =
360 + NULL, NULL, NULL, NULL,
361 + NULL, NULL, NULL, NULL,
362 + NULL, NULL, NULL, NULL,
363 + NULL, NULL, NULL, NULL,
364 + NULL, NULL, NULL, NULL,
365 + NULL, NULL, NULL, NULL,
366 + NULL, NULL, NULL, NULL,
367 + NULL, NULL, NULL, NULL
371 + This remaps interrupts to exist on other channels than the default
372 + channels. essentially we can use the line # as the index for this
377 +static unsigned long line_to_channel[AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
378 +unsigned long uni_secondary_interrupt = 0;
380 +static struct irqaction r4ktimer_action = {
381 + NULL, 0, 0, "R4000 timer/counter", NULL, NULL,
384 +static struct irqaction *irq_action[8] = {
385 + NULL, /* SW int 0 */
386 + NULL, /* SW int 1 */
387 + NULL, /* HW int 0 */
390 + NULL, /* HW int 3 */
391 + NULL, /* HW int 4 */
392 + &r4ktimer_action /* HW int 5 */
395 +static void end_avalanche_irq(unsigned int irq)
397 + if (!(irq_desc_ti[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
398 + enable_avalanche_irq(irq);
401 +void disable_avalanche_irq(unsigned int irq_nr)
403 + unsigned long flags;
404 + unsigned long chan_nr=0;
405 + unsigned long int_bit=0;
407 + if(irq_nr >= AVALANCHE_INT_END)
409 + printk("whee, invalid irq_nr %d\n", irq_nr);
410 + panic("IRQ, you lose...");
413 + save_and_cli(flags);
416 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
418 + /* disable mips exception */
420 + int_bit = read_c0_status() & ~(1 << (8+irq_nr));
421 + change_c0_status(ST0_IM,int_bit);
422 + restore_flags(flags);
426 + /* irq_nr represents the line number for the interrupt. We must
427 + * disable the channel number associated with that line number.
430 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
431 + chan_nr = AVINTNUM(irq_nr); /*CHECK THIS ALSO*/
433 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];/* WE NEED A LINE TO CHANNEL MAPPING FUNCTION HERE*/
435 + /* disable the interrupt channel bit */
437 + /* primary interrupt #'s 0-31 */
439 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
440 + avalanche_hw0_icregs->intecr1 = (1 << chan_nr);
442 + /* primary interrupt #'s 32-39 */
444 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
445 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
446 + avalanche_hw0_icregs->intecr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
448 + else /* secondary interrupt #'s 0-31 */
449 + avalanche_hw0_ecregs->exiecr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
451 + restore_flags(flags);
454 +void enable_avalanche_irq(unsigned int irq_nr)
456 + unsigned long flags;
457 + unsigned long chan_nr=0;
458 + unsigned long int_bit=0;
460 + if(irq_nr > AVALANCHE_INT_END) {
461 + printk("whee, invalid irq_nr %d\n", irq_nr);
462 + panic("IRQ, you lose...");
465 + save_and_cli(flags);
468 + if(irq_nr < MIPS_EXCEPTION_OFFSET)
470 + /* Enable MIPS exceptions */
471 + int_bit = read_c0_status();
472 + change_c0_status(ST0_IM,int_bit | (1<<(8+irq_nr)));
473 + restore_flags(flags);
477 + /* irq_nr represents the line number for the interrupt. We must
478 + * disable the channel number associated with that line number.
481 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
482 + chan_nr = AVINTNUM(irq_nr);
484 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];
486 + /* enable the interrupt channel bit */
488 + /* primary interrupt #'s 0-31 */
489 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
490 + avalanche_hw0_icregs->intesr1 = (1 << chan_nr);
492 + /* primary interrupt #'s 32 throuth 39 */
493 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
494 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
495 + avalanche_hw0_icregs->intesr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
497 + else /* secondary interrupt #'s 0-31 */
498 + avalanche_hw0_ecregs->exiesr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
500 + restore_flags(flags);
503 +static unsigned int startup_avalanche_irq(unsigned int irq)
505 + enable_avalanche_irq(irq);
506 + return 0; /* never anything pending */
510 +int get_irq_list(char *buf)
514 + struct irqaction *action;
516 + for (i = 0; i < MIPS_EXCEPTION_OFFSET; i++, num++)
518 + action = irq_action[i];
521 + len += sprintf(buf+len, "%2d: %8d %c %s",
522 + num, kstat.irqs[0][num],
523 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
525 + for (action=action->next; action; action = action->next) {
526 + len += sprintf(buf+len, ",%s %s",
527 + (action->flags & SA_INTERRUPT) ? " +" : "",
530 + len += sprintf(buf+len, " [MIPS interrupt]\n");
534 + for (i = 0; i < AVINTNUM(AVALANCHE_INT_END); i++,num++)
536 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
537 + action = hw0_irq_action_primary[i];
539 + action = hw0_irq_action_secondary[i-AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
542 + len += sprintf(buf+len, "%2d: %8d %c %s",
543 + num, kstat.irqs[0][ LNXINTNUM(i) ],
544 + (action->flags & SA_INTERRUPT) ? '+' : ' ',
547 + for (action=action->next; action; action = action->next)
549 + len += sprintf(buf+len, ",%s %s",
550 + (action->flags & SA_INTERRUPT) ? " +" : "",
554 + if(i < AVINTNUM(AVALANCHE_INT_END_PRIMARY))
555 + len += sprintf(buf+len, " [hw0 (Avalanche Primary)]\n");
557 + len += sprintf(buf+len, " [hw0 (Avalanche Secondary)]\n");
564 +int request_irq(unsigned int irq,
565 + void (*handler)(int, void *, struct pt_regs *),
566 + unsigned long irqflags,
567 + const char * devname,
570 + struct irqaction *action;
572 + if (irq > AVALANCHE_INT_END)
577 + action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
581 + action->handler = handler;
582 + action->flags = irqflags;
584 + action->name = devname;
585 + irq_desc_ti[irq].action = action;
586 + action->dev_id = dev_id;
590 + if(irq < MIPS_EXCEPTION_OFFSET)
592 + irq_action[irq] = action;
593 + enable_avalanche_irq(irq);
597 + if(irq < AVALANCHE_INT_END_PRIMARY)
598 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = action;
600 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = action;
602 + enable_avalanche_irq(irq);
607 +void free_irq(unsigned int irq, void *dev_id)
609 + struct irqaction *action;
611 + if (irq > AVALANCHE_INT_END) {
612 + printk("Trying to free IRQ%d\n",irq);
616 + if(irq < MIPS_EXCEPTION_OFFSET)
618 + action = irq_action[irq];
619 + irq_action[irq] = NULL;
620 + irq_desc_ti[irq].action = NULL;
621 + disable_avalanche_irq(irq);
626 + if(irq < AVALANCHE_INT_END_PRIMARY) {
627 + action = hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]];
628 + hw0_irq_action_primary[line_to_channel[AVINTNUM(irq)]] = NULL;
629 + irq_desc_ti[irq].action = NULL;
632 + action = hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY];
633 + hw0_irq_action_secondary[irq - AVALANCHE_INT_END_PRIMARY] = NULL;
634 + irq_desc_ti[irq].action = NULL;
637 + disable_avalanche_irq(irq);
642 +extern void breakpoint(void);
643 +extern int remote_debug;
647 +//void init_IRQ(void) __init;
648 +void __init init_IRQ(void)
652 + avalanche_hw0_icregs = (struct avalanche_ictrl_regs *)AVALANCHE_ICTRL_REGS_BASE;
653 + avalanche_hw0_ecregs = (struct avalanche_exctrl_regs *)AVALANCHE_ECTRL_REGS_BASE;
654 + avalanche_hw0_ipaceregs = (struct avalanche_ipace_regs *)AVALANCHE_IPACE_REGS_BASE;
655 + avalanche_hw0_chregs = (struct avalanche_channel_int_number *)AVALANCHE_CHCTRL_REGS_BASE;
657 + /* Disable interrupts and clear pending
660 + avalanche_hw0_icregs->intecr1 = 0xffffffff; /* disable interrupts 0:31 */
661 + avalanche_hw0_icregs->intcr1 = 0xffffffff; /* clear interrupts 0:31 */
662 + avalanche_hw0_icregs->intecr2 = 0xff; /* disable interrupts 32:39 */
663 + avalanche_hw0_icregs->intcr2 = 0xff; /* clear interrupts 32:39 */
664 + avalanche_hw0_ecregs->exiecr = 0xffffffff; /* disable secondary interrupts 0:31 */
665 + avalanche_hw0_ecregs->excr = 0xffffffff; /* clear secondary interrupts 0:31 */
668 + // avalanche_hw0_ipaceregs->ipacep = (2*get_avalanche_vbus_freq()/1000000)*4;
669 + /* hack for speeding up the pacing. */
670 + printk("the pacing pre-scalar has been set as 600.\n");
671 + avalanche_hw0_ipaceregs->ipacep = 600;
672 + /* Channel to line mapping, Line to Channel mapping */
674 + for(i = 0; i < 40; i++)
675 + avalanche_int_set(i,i);
677 + /* Now safe to set the exception vector. */
678 + set_except_vector(0, mipsIRQ);
680 + /* Setup the IRQ description array. These will be mapped
681 + * as flat interrupts numbers. The mapping is as follows
683 + * 0-7 MIPS CPU Exceptions (HW/SW)
684 + * 8-46 Primary Interrupts (Avalanche)
685 + * 47-78 Secondary Interrupts (Avalanche)
688 + for (i = 0; i <= AVALANCHE_INT_END; i++)
690 + irq_desc_ti[i].status = IRQ_DISABLED;
691 + irq_desc_ti[i].action = 0;
692 + irq_desc_ti[i].depth = 1;
693 + irq_desc_ti[i].handler = &avalanche_irq_type;
705 +void avalanche_hw0_irqdispatch(struct pt_regs *regs)
707 + struct irqaction *action;
708 + int irq, cpu = smp_processor_id();
709 + unsigned long int_line_number,status;
710 + int i,secondary = 0;
713 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
714 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
719 + if( chan_nr != uni_secondary_interrupt)
720 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
724 + if((chan_nr < 40) && (chan_nr > 31))
726 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
730 + /* If the Priority Interrupt Index Register returns 40 then no
731 + * interrupts are pending
737 + if(chan_nr == uni_secondary_interrupt)
739 + status = avalanche_hw0_ecregs->exsr;
740 + for(i=0; i < AVINTNUM(AVALANCHE_INT_END_SECONDARY); i++)
744 + /* clear secondary interrupt */
745 + avalanche_hw0_ecregs->excr = 1 << i;
752 + /* clear the universal secondary interrupt */
753 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
759 + /* Suraj Add code to clear secondary interrupt */
762 + action = hw0_irq_action_secondary[irq];
764 + action = hw0_irq_action_primary[irq];
766 + /* if action == NULL, then we don't have a handler for the irq */
768 + if ( action == NULL ) {
769 + printk("No handler for hw0 irq: %i\n", irq);
773 + irq_enter(cpu,irq);
776 + kstat.irqs[0][(irq + AVINTNUM(AVALANCHE_INT_END_PRIMARY)) + 8]++;
777 + action->handler((irq + AVALANCHE_INT_END_PRIMARY), action->dev_id, regs);
781 + kstat.irqs[0][irq + 8]++;
782 + action->handler(LNXINTNUM(irq), action->dev_id, regs);
787 + if(softirq_pending(cpu))
793 +void avalanche_int_set(int channel, int line)
798 + avalanche_hw0_chregs->cintnr0 = line;
801 + avalanche_hw0_chregs->cintnr1 = line;
804 + avalanche_hw0_chregs->cintnr2 = line;
807 + avalanche_hw0_chregs->cintnr3 = line;
810 + avalanche_hw0_chregs->cintnr4 = line;
813 + avalanche_hw0_chregs->cintnr5 = line;
816 + avalanche_hw0_chregs->cintnr6 = line;
819 + avalanche_hw0_chregs->cintnr7 = line;
822 + avalanche_hw0_chregs->cintnr8 = line;
825 + avalanche_hw0_chregs->cintnr9 = line;
828 + avalanche_hw0_chregs->cintnr10 = line;
831 + avalanche_hw0_chregs->cintnr11 = line;
834 + avalanche_hw0_chregs->cintnr12 = line;
837 + avalanche_hw0_chregs->cintnr13 = line;
840 + avalanche_hw0_chregs->cintnr14 = line;
843 + avalanche_hw0_chregs->cintnr15 = line;
846 + avalanche_hw0_chregs->cintnr16 = line;
849 + avalanche_hw0_chregs->cintnr17 = line;
852 + avalanche_hw0_chregs->cintnr18 = line;
855 + avalanche_hw0_chregs->cintnr19 = line;
858 + avalanche_hw0_chregs->cintnr20 = line;
861 + avalanche_hw0_chregs->cintnr21 = line;
864 + avalanche_hw0_chregs->cintnr22 = line;
867 + avalanche_hw0_chregs->cintnr23 = line;
870 + avalanche_hw0_chregs->cintnr24 = line;
873 + avalanche_hw0_chregs->cintnr25 = line;
876 + avalanche_hw0_chregs->cintnr26 = line;
879 + avalanche_hw0_chregs->cintnr27 = line;
882 + avalanche_hw0_chregs->cintnr28 = line;
885 + avalanche_hw0_chregs->cintnr29 = line;
888 + avalanche_hw0_chregs->cintnr30 = line;
891 + avalanche_hw0_chregs->cintnr31 = line;
894 + avalanche_hw0_chregs->cintnr32 = line;
897 + avalanche_hw0_chregs->cintnr33 = line;
900 + avalanche_hw0_chregs->cintnr34 = line;
903 + avalanche_hw0_chregs->cintnr35 = line;
906 + avalanche_hw0_chregs->cintnr36 = line;
909 + avalanche_hw0_chregs->cintnr37 = line;
912 + avalanche_hw0_chregs->cintnr38 = line;
915 + avalanche_hw0_chregs->cintnr39 = line;
918 + printk("Error: Unknown Avalanche interrupt channel\n");
921 + line_to_channel[line] = channel; /* Suraj check */
923 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
924 + uni_secondary_interrupt = line;
929 +#define AVALANCHE_MAX_PACING_BLK 3
930 +#define AVALANCHE_PACING_LOW_VAL 2
931 +#define AVALANCHE_PACING_HIGH_VAL 63
933 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num,
934 + unsigned int pace_value)
936 + unsigned int blk_offset;
937 + unsigned long flags;
939 + if(irq_nr < MIPS_EXCEPTION_OFFSET &&
940 + irq_nr >= AVALANCHE_INT_END_PRIMARY)
943 + if(blk_num > AVALANCHE_MAX_PACING_BLK)
946 + if(pace_value > AVALANCHE_PACING_HIGH_VAL &&
947 + pace_value < AVALANCHE_PACING_LOW_VAL)
950 + blk_offset = blk_num*8;
952 + save_and_cli(flags);
954 + /* disable the interrupt pacing, if enabled previously */
955 + avalanche_hw0_ipaceregs->ipacemax &= ~(0xff << blk_offset);
957 + /* clear the pacing map */
958 + avalanche_hw0_ipaceregs->ipacemap &= ~(0xff << blk_offset);
960 + /* setup the new values */
961 + avalanche_hw0_ipaceregs->ipacemap |= ((AVINTNUM(irq_nr)) << blk_offset);
962 + avalanche_hw0_ipaceregs->ipacemax |= ((0x80 | pace_value) << blk_offset);
964 + restore_flags(flags);
968 diff -urN linux.old/arch/mips/ar7/Makefile linux.dev/arch/mips/ar7/Makefile
969 --- linux.old/arch/mips/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
970 +++ linux.dev/arch/mips/ar7/Makefile 2005-08-12 21:21:30.425150040 +0200
973 + $(CPP) $(AFLAGS) $< -o $*.s
976 + $(CC) $(AFLAGS) -c $< -o $*.o
978 +EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7 -DLITTLE_ENDIAN -D_LINK_KSEG0_
981 +obj-y := tnetd73xx_misc.o misc.o
982 +export-objs := misc.o
983 +obj-y += setup.o irq.o mipsIRQ.o reset.o init.o psp_env.o memory.o printf.o cmdline.o time.o
985 +include $(TOPDIR)/Rules.make
986 diff -urN linux.old/arch/mips/ar7/memory.c linux.dev/arch/mips/ar7/memory.c
987 --- linux.old/arch/mips/ar7/memory.c 1970-01-01 01:00:00.000000000 +0100
988 +++ linux.dev/arch/mips/ar7/memory.c 2005-08-12 19:52:25.301732312 +0200
991 + * Carsten Langgaard, carstenl@mips.com
992 + * Copyright (C) 1999,2000 MIPS Technologies, 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 + * PROM library functions for acquiring/using memory descriptors given to
1012 + * us from the YAMON.
1015 +#include <linux/config.h>
1016 +#include <linux/init.h>
1017 +#include <linux/mm.h>
1018 +#include <linux/bootmem.h>
1020 +#include <asm/bootinfo.h>
1021 +#include <asm/page.h>
1022 +#include <asm/mips-boards/prom.h>
1024 +enum yamon_memtypes {
1029 +struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS];
1031 +/* References to section boundaries */
1034 +#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
1037 +struct prom_pmemblock * __init prom_getmdesc(void)
1039 + char *memsize_str;
1040 + unsigned int memsize;
1042 + memsize_str = prom_getenv("memsize");
1043 + if (!memsize_str) {
1044 + memsize = 0x02000000;
1046 + memsize = simple_strtol(memsize_str, NULL, 0);
1049 + memset(mdesc, 0, sizeof(mdesc));
1051 + mdesc[0].type = yamon_dontuse;
1052 + mdesc[0].base = 0x00000000;
1053 + mdesc[0].size = CONFIG_AR7_MEMORY;
1055 + mdesc[1].type = yamon_prom;
1056 + mdesc[1].base = CONFIG_AR7_MEMORY;
1057 + mdesc[1].size = 0x00020000;
1059 + mdesc[2].type = yamon_free;
1060 + mdesc[2].base = CONFIG_AR7_MEMORY + 0x00020000;
1061 + mdesc[2].size = (memsize + CONFIG_AR7_MEMORY) - mdesc[2].base;
1066 +static int __init prom_memtype_classify (unsigned int type)
1070 + return BOOT_MEM_RAM;
1072 + return BOOT_MEM_ROM_DATA;
1074 + return BOOT_MEM_RESERVED;
1078 +void __init prom_meminit(void)
1080 + struct prom_pmemblock *p;
1082 + p = prom_getmdesc();
1086 + unsigned long base, size;
1088 + type = prom_memtype_classify (p->type);
1092 + add_memory_region(base, size, type);
1097 +void __init prom_free_prom_memory (void)
1101 + unsigned long freed = 0;
1102 + unsigned long addr;
1104 + for (i = 0; i < boot_mem_map.nr_map; i++) {
1105 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
1108 + addr = boot_mem_map.map[i].addr;
1109 + while (addr < boot_mem_map.map[i].addr
1110 + + boot_mem_map.map[i].size) {
1111 + ClearPageReserved(virt_to_page(__va(addr)));
1112 + set_page_count(virt_to_page(__va(addr)), 1);
1113 + free_page((unsigned long)__va(addr));
1114 + addr += PAGE_SIZE;
1115 + freed += PAGE_SIZE;
1118 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
1121 diff -urN linux.old/arch/mips/ar7/mipsIRQ.S linux.dev/arch/mips/ar7/mipsIRQ.S
1122 --- linux.old/arch/mips/ar7/mipsIRQ.S 1970-01-01 01:00:00.000000000 +0100
1123 +++ linux.dev/arch/mips/ar7/mipsIRQ.S 2005-08-12 19:32:05.138225360 +0200
1126 + * Carsten Langgaard, carstenl@mips.com
1127 + * Copyright (C) 1999, 2000 MIPS Technologies, Inc. All rights reserved.
1129 + * ########################################################################
1131 + * This program is free software; you can distribute it and/or modify it
1132 + * under the terms of the GNU General Public License (Version 2) as
1133 + * published by the Free Software Foundation.
1135 + * This program is distributed in the hope it will be useful, but WITHOUT
1136 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1137 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1138 + * for more details.
1140 + * You should have received a copy of the GNU General Public License along
1141 + * with this program; if not, write to the Free Software Foundation, Inc.,
1142 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1144 + * ########################################################################
1146 + * Interrupt exception dispatch code.
1149 +#include <linux/config.h>
1151 +#include <asm/asm.h>
1152 +#include <asm/mipsregs.h>
1153 +#include <asm/regdef.h>
1154 +#include <asm/stackframe.h>
1156 +/* A lot of complication here is taken away because:
1158 + * 1) We handle one interrupt and return, sitting in a loop and moving across
1159 + * all the pending IRQ bits in the cause register is _NOT_ the answer, the
1160 + * common case is one pending IRQ so optimize in that direction.
1162 + * 2) We need not check against bits in the status register IRQ mask, that
1163 + * would make this routine slow as hell.
1165 + * 3) Linux only thinks in terms of all IRQs on or all IRQs off, nothing in
1166 + * between like BSD spl() brain-damage.
1168 + * Furthermore, the IRQs on the MIPS board look basically (barring software
1169 + * IRQs which we don't use at all and all external interrupt sources are
1170 + * combined together on hardware interrupt 0 (MIPS IRQ 2)) like:
1174 + * 0 Software (ignored)
1175 + * 1 Software (ignored)
1176 + * 2 Combined hardware interrupt (hw0)
1177 + * 3 Hardware (ignored)
1178 + * 4 Hardware (ignored)
1179 + * 5 Hardware (ignored)
1180 + * 6 Hardware (ignored)
1181 + * 7 R4k timer (what we use)
1183 + * Note: On the SEAD board thing are a little bit different.
1184 + * Here IRQ 2 (hw0) is wired to the UART0 and IRQ 3 (hw1) is wired
1187 + * We handle the IRQ according to _our_ priority which is:
1189 + * Highest ---- R4k Timer
1190 + * Lowest ---- Combined hardware interrupt
1192 + * then we just return, if multiple IRQs are pending then we will just take
1193 + * another exception, big deal.
1200 +NESTED(mipsIRQ, PT_SIZE, sp)
1205 + mfc0 s0, CP0_CAUSE # get irq bits
1207 + /* First we check for r4k counter/timer IRQ. */
1208 + andi a0, s0, CAUSEF_IP7
1210 + andi a0, s0, CAUSEF_IP2 # delay slot, check hw0 interrupt
1212 + /* Wheee, a timer interrupt. */
1214 + jal ar7_timer_interrupt
1221 + beq a0, zero, 1f # delay slot, check hw3 interrupt
1224 + /* Wheee, combined hardware level zero interrupt. */
1225 + jal avalanche_hw0_irqdispatch
1226 + move a0, sp # delay slot
1233 + * Here by mistake? This is possible, what can happen is that by the
1234 + * time we take the exception the IRQ pin goes low, so just leave if
1235 + * this is the case.
1238 + PRINT("Got interrupt: c0_cause = %08x\n")
1240 + PRINT("c0_epc = %08x\n")
1245 diff -urN linux.old/arch/mips/ar7/misc.c linux.dev/arch/mips/ar7/misc.c
1246 --- linux.old/arch/mips/ar7/misc.c 1970-01-01 01:00:00.000000000 +0100
1247 +++ linux.dev/arch/mips/ar7/misc.c 2005-08-12 19:32:05.136225664 +0200
1249 +#include <asm/ar7/sangam.h>
1250 +#include <asm/ar7/avalanche_misc.h>
1251 +#include <linux/module.h>
1252 +#include <linux/spinlock.h>
1256 +static unsigned int avalanche_vbus_freq;
1258 +REMOTE_VLYNQ_DEV_RESET_CTRL_FN p_remote_vlynq_dev_reset_ctrl = NULL;
1260 +/*****************************************************************************
1261 + * Reset Control Module.
1262 + *****************************************************************************/
1263 +void avalanche_reset_ctrl(unsigned int module_reset_bit,
1264 + AVALANCHE_RESET_CTRL_T reset_ctrl)
1266 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
1268 + if(module_reset_bit >= 32 && module_reset_bit < 64)
1271 + if(module_reset_bit >= 64)
1273 + if(p_remote_vlynq_dev_reset_ctrl)
1274 + return(p_remote_vlynq_dev_reset_ctrl(module_reset_bit - 64, reset_ctrl));
1279 + if(reset_ctrl == OUT_OF_RESET)
1280 + *reset_reg |= 1 << module_reset_bit;
1282 + *reset_reg &= ~(1 << module_reset_bit);
1285 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(unsigned int module_reset_bit)
1287 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
1289 + return (((*reset_reg) & (1 << module_reset_bit)) ? OUT_OF_RESET : IN_RESET );
1292 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode)
1294 + volatile unsigned int *sw_reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_SWRCR;
1295 + *sw_reset_reg = mode;
1298 +#define AVALANCHE_RST_CTRL_RSR_MASK 0x3
1300 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status()
1302 + volatile unsigned int *sys_reset_status = (unsigned int*) AVALANCHE_RST_CTRL_RSR;
1304 + return ( (AVALANCHE_SYS_RESET_STATUS_T) (*sys_reset_status & AVALANCHE_RST_CTRL_RSR_MASK) );
1308 +/*****************************************************************************
1309 + * Power Control Module
1310 + *****************************************************************************/
1311 +#define AVALANCHE_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
1312 +#define AVALANCHE_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
1315 +void avalanche_power_ctrl(unsigned int module_power_bit, AVALANCHE_POWER_CTRL_T power_ctrl)
1317 + volatile unsigned int *power_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1319 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
1320 + /* power down the module */
1321 + *power_reg |= (1 << module_power_bit);
1323 + /* power on the module */
1324 + *power_reg &= (~(1 << module_power_bit));
1327 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int module_power_bit)
1329 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1331 + return (((*power_status_reg) & (1 << module_power_bit)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP);
1334 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode)
1336 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1338 + *power_status_reg &= AVALANCHE_GLOBAL_POWER_DOWN_MASK;
1339 + *power_status_reg |= ( power_mode << AVALANCHE_GLOBAL_POWER_DOWN_BIT);
1342 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void)
1344 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1346 + return((AVALANCHE_SYS_POWER_MODE_T) (((*power_status_reg) & (~AVALANCHE_GLOBAL_POWER_DOWN_MASK))
1347 + >> AVALANCHE_GLOBAL_POWER_DOWN_BIT));
1350 +/*****************************************************************************
1352 + *****************************************************************************/
1354 +/****************************************************************************
1355 + * FUNCTION: avalanche_gpio_init
1356 + ***************************************************************************/
1357 +void avalanche_gpio_init(void)
1359 + spinlock_t closeLock;
1360 + unsigned int closeFlag;
1361 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
1362 + spin_lock_irqsave(&closeLock, closeFlag);
1363 + *reset_reg |= (1 << AVALANCHE_GPIO_RESET_BIT);
1364 + spin_unlock_irqrestore(&closeLock, closeFlag);
1367 +/****************************************************************************
1368 + * FUNCTION: avalanche_gpio_ctrl
1369 + ***************************************************************************/
1370 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
1371 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
1372 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction)
1374 + spinlock_t closeLock;
1375 + unsigned int closeFlag;
1376 + volatile unsigned int *gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_ENBL;
1378 + if(gpio_pin >= 32)
1381 + spin_lock_irqsave(&closeLock, closeFlag);
1383 + if(pin_mode == GPIO_PIN)
1385 + *gpio_ctrl |= (1 << gpio_pin);
1387 + gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_DIR;
1389 + if(pin_direction == GPIO_INPUT_PIN)
1390 + *gpio_ctrl |= (1 << gpio_pin);
1392 + *gpio_ctrl &= ~(1 << gpio_pin);
1394 + else /* FUNCTIONAL PIN */
1396 + *gpio_ctrl &= ~(1 << gpio_pin);
1399 + spin_unlock_irqrestore(&closeLock, closeFlag);
1404 +/****************************************************************************
1405 + * FUNCTION: avalanche_gpio_out
1406 + ***************************************************************************/
1407 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value)
1409 + spinlock_t closeLock;
1410 + unsigned int closeFlag;
1411 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
1413 + if(gpio_pin >= 32)
1416 + spin_lock_irqsave(&closeLock, closeFlag);
1418 + *gpio_out |= 1 << gpio_pin;
1420 + *gpio_out &= ~(1 << gpio_pin);
1421 + spin_unlock_irqrestore(&closeLock, closeFlag);
1426 +/****************************************************************************
1427 + * FUNCTION: avalanche_gpio_in
1428 + ***************************************************************************/
1429 +int avalanche_gpio_in_bit(unsigned int gpio_pin)
1431 + spinlock_t closeLock;
1432 + unsigned int closeFlag;
1433 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
1436 + if(gpio_pin >= 32)
1439 + spin_lock_irqsave(&closeLock, closeFlag);
1440 + ret_val = ((*gpio_in) & (1 << gpio_pin));
1441 + spin_unlock_irqrestore(&closeLock, closeFlag);
1446 +/****************************************************************************
1447 + * FUNCTION: avalanche_gpio_out_val
1448 + ***************************************************************************/
1449 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int out_mask,
1450 + unsigned int reg_index)
1452 + spinlock_t closeLock;
1453 + unsigned int closeFlag;
1454 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
1459 + spin_lock_irqsave(&closeLock, closeFlag);
1460 + *gpio_out &= ~out_mask;
1461 + *gpio_out |= out_val;
1462 + spin_unlock_irqrestore(&closeLock, closeFlag);
1467 +/****************************************************************************
1468 + * FUNCTION: avalanche_gpio_in_value
1469 + ***************************************************************************/
1470 +int avalanche_gpio_in_value(unsigned int* in_val, unsigned int reg_index)
1472 + spinlock_t closeLock;
1473 + unsigned int closeFlag;
1474 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
1479 + spin_lock_irqsave(&closeLock, closeFlag);
1480 + *in_val = *gpio_in;
1481 + spin_unlock_irqrestore(&closeLock, closeFlag);
1486 +/***********************************************************************
1488 + * Wakeup Control Module for TNETV1050 Communication Processor
1490 + ***********************************************************************/
1492 +#define AVALANCHE_WAKEUP_POLARITY_BIT 16
1494 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
1495 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
1496 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity)
1498 + volatile unsigned int *wakeup_status_reg = (unsigned int*) AVALANCHE_WAKEUP_CTRL_WKCR;
1500 + /* enable/disable */
1501 + if (wakeup_ctrl == WAKEUP_ENABLED)
1502 + /* enable wakeup */
1503 + *wakeup_status_reg |= wakeup_int;
1505 + /* disable wakeup */
1506 + *wakeup_status_reg &= (~wakeup_int);
1508 + /* set polarity */
1509 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
1510 + *wakeup_status_reg |= (wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
1512 + *wakeup_status_reg &= ~(wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
1515 +void avalanche_set_vbus_freq(unsigned int new_vbus_freq)
1517 + avalanche_vbus_freq = new_vbus_freq;
1520 +unsigned int avalanche_get_vbus_freq()
1522 + return(avalanche_vbus_freq);
1525 +unsigned int avalanche_get_chip_version_info()
1527 + return(*(volatile unsigned int*)AVALANCHE_CVR);
1530 +SET_MDIX_ON_CHIP_FN_T p_set_mdix_on_chip_fn = NULL;
1532 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation)
1534 + if(p_set_mdix_on_chip_fn)
1535 + return (p_set_mdix_on_chip_fn(base_addr, operation));
1540 +unsigned int avalanche_is_mdix_on_chip(void)
1542 + return(p_set_mdix_on_chip_fn ? 1:0);
1545 +EXPORT_SYMBOL(avalanche_reset_ctrl);
1546 +EXPORT_SYMBOL(avalanche_get_reset_status);
1547 +EXPORT_SYMBOL(avalanche_sys_reset);
1548 +EXPORT_SYMBOL(avalanche_get_sys_last_reset_status);
1549 +EXPORT_SYMBOL(avalanche_power_ctrl);
1550 +EXPORT_SYMBOL(avalanche_get_power_status);
1551 +EXPORT_SYMBOL(avalanche_set_global_power_mode);
1552 +EXPORT_SYMBOL(avalanche_get_global_power_mode);
1553 +EXPORT_SYMBOL(avalanche_set_mdix_on_chip);
1554 +EXPORT_SYMBOL(avalanche_is_mdix_on_chip);
1556 +EXPORT_SYMBOL(avalanche_gpio_init);
1557 +EXPORT_SYMBOL(avalanche_gpio_ctrl);
1558 +EXPORT_SYMBOL(avalanche_gpio_out_bit);
1559 +EXPORT_SYMBOL(avalanche_gpio_in_bit);
1560 +EXPORT_SYMBOL(avalanche_gpio_out_value);
1561 +EXPORT_SYMBOL(avalanche_gpio_in_value);
1563 +EXPORT_SYMBOL(avalanche_set_vbus_freq);
1564 +EXPORT_SYMBOL(avalanche_get_vbus_freq);
1566 +EXPORT_SYMBOL(avalanche_get_chip_version_info);
1568 diff -urN linux.old/arch/mips/ar7/platform.h linux.dev/arch/mips/ar7/platform.h
1569 --- linux.old/arch/mips/ar7/platform.h 1970-01-01 01:00:00.000000000 +0100
1570 +++ linux.dev/arch/mips/ar7/platform.h 2005-08-12 19:34:07.216666616 +0200
1572 +#ifndef _PLATFORM_H_
1573 +#define _PLATFORM_H_
1575 +#include <linux/config.h>
1578 +/* Important: The definition of ENV_SPACE_SIZE should match with that in
1579 + * PSPBoot. (/psp_boot/inc/psbl/env.h)
1581 +#ifdef CONFIG_MIPS_AVALANCHE_TICFG
1582 +#define ENV_SPACE_SIZE (10 * 1024)
1585 +#ifdef CONFIG_MIPS_TNETV1050SDB
1586 +#define TNETV1050SDB
1590 +#ifdef CONFIG_MIPS_AR7DB
1591 +#define TNETD73XX_BOARD
1595 +#ifdef CONFIG_MIPS_AR7RD
1596 +#define TNETD73XX_BOARD
1600 +#ifdef CONFIG_AR7WRD
1601 +#define TNETD73XX_BOARD
1605 +#ifdef CONFIG_MIPS_AR7VWI
1606 +#define TNETD73XX_BOARD
1610 +/* Merging from the DEV_DSL-PSPL4.3.2.7_Patch release. */
1611 +#ifdef CONFIG_MIPS_AR7VW
1612 +#define TNETD73XX_BOARD
1616 +#ifdef CONFIG_MIPS_AR7WI
1617 +#define TNETD73XX_BOARD
1621 +#ifdef CONFIG_MIPS_AR7V
1622 +#define TNETD73XX_BOARD
1626 +#ifdef CONFIG_MIPS_AR7V
1627 +#define TNETD73XX_BOARD
1631 +#ifdef CONFIG_MIPS_WA1130
1637 diff -urN linux.old/arch/mips/ar7/printf.c linux.dev/arch/mips/ar7/printf.c
1638 --- linux.old/arch/mips/ar7/printf.c 1970-01-01 01:00:00.000000000 +0100
1639 +++ linux.dev/arch/mips/ar7/printf.c 2005-08-12 19:32:05.139225208 +0200
1642 + * Carsten Langgaard, carstenl@mips.com
1643 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1645 + * This program is free software; you can distribute it and/or modify it
1646 + * under the terms of the GNU General Public License (Version 2) as
1647 + * published by the Free Software Foundation.
1649 + * This program is distributed in the hope it will be useful, but WITHOUT
1650 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1651 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1652 + * for more details.
1654 + * You should have received a copy of the GNU General Public License along
1655 + * with this program; if not, write to the Free Software Foundation, Inc.,
1656 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1658 + * Putting things on the screen/serial line using Adam2 facilities.
1661 +#include <linux/config.h>
1662 +#include <linux/init.h>
1663 +#include <linux/kernel.h>
1664 +#include <linux/serial_reg.h>
1665 +#include <linux/spinlock.h>
1666 +#include <asm/io.h>
1667 +#include <asm/serial.h>
1668 +#include <asm/addrspace.h>
1670 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
1671 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4)
1673 +static char ppbuf[1024];
1675 +void (*prom_print_str)(unsigned int out, char *s, int len);
1677 +void prom_printf(char *fmt, ...) __init;
1678 +void prom_printf(char *fmt, ...)
1682 + prom_print_str = (void *)*(unsigned int *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR;
1684 + va_start(args, fmt);
1685 + vsprintf(ppbuf, fmt, args);
1686 + len = strlen(ppbuf);
1688 + prom_print_str(1, ppbuf, len);
1694 diff -urN linux.old/arch/mips/ar7/psp_env.c linux.dev/arch/mips/ar7/psp_env.c
1695 --- linux.old/arch/mips/ar7/psp_env.c 1970-01-01 01:00:00.000000000 +0100
1696 +++ linux.dev/arch/mips/ar7/psp_env.c 2005-08-12 19:34:07.216666616 +0200
1698 +#include <linux/config.h>
1699 +#include <linux/init.h>
1700 +#include <linux/string.h>
1701 +#include <linux/kernel.h>
1702 +#include <linux/module.h>
1703 +#include <asm/io.h>
1705 +#include "platform.h"
1707 +#define ENV_CELL_SIZE 16
1709 +/* control field decode */
1710 +#define ENV_GARBAGE_BIT 0x01 /* Env is garbage if this bit is off */
1711 +#define ENV_DYNAMIC_BIT 0x02 /* Env is dynamic if this bit is off */
1713 +#define ENV_CTRL_MASK 0x03
1714 +#define ENV_PREFINED (ENV_GARBAGE_BIT | ENV_DYNAMIC_BIT)
1715 +#define ENV_DYNAMIC (ENV_GARBAGE_BIT)
1717 +struct env_variable {
1718 + unsigned char varNum;
1719 + unsigned char ctrl;
1720 + unsigned short chksum;
1721 + unsigned char numCells;
1722 + unsigned char data[ENV_CELL_SIZE - 5]; /* The data section starts
1723 + * here, continues for
1728 +extern unsigned int max_env_entry;
1730 +/* Internal macros */
1731 +#define get_next_block(var) ((struct env_variable *)( (char*)(var) + (var)->numCells * ENV_CELL_SIZE))
1733 +typedef enum ENV_VARS {
1734 + env_vars_start = 0,
1743 +#if !defined (AVALANCHE) || defined(TNETC401B)
1746 +#if !defined(TNETV1020_BOARD)
1749 +#if defined (TNETD73XX_BOARD)
1755 +#if !defined (AVALANCHE) || defined(TNETC401B)
1758 +#if !defined(TNETV1020_BOARD)
1761 +#if defined (TNETD73XX_BOARD)
1764 +#if !defined(TNETV1020_BOARD)
1771 +#if defined (TNETV1050_BOARD)
1774 +#if !defined(TNETV1020_BOARD)
1776 + HWA_HRNDIS, /* Host (PC) side RNDIS address */
1783 +#ifndef AVALANCHE /* Avalanche boards use only one mac port */
1796 +#if defined (TNETV1050_BOARD)
1800 + * Add new env variables here.
1801 + * NOTE: New environment variables should always be placed at the end, ie
1802 + * just before env_vars_end.
1809 +struct env_description {
1815 +#define ENVSTR(x) #x
1816 +#define _ENV_ENTRY(x) {.idx = x, .nm = ENVSTR(x), .alias = NULL}
1818 +struct env_description env_ns[] = {
1819 + _ENV_ENTRY(env_vars_start), /* start. */
1820 + _ENV_ENTRY(CPUFREQ),
1821 + _ENV_ENTRY(MEMSZ),
1822 + _ENV_ENTRY(FLASHSZ),
1823 + _ENV_ENTRY(MODETTY0),
1824 + _ENV_ENTRY(MODETTY1),
1825 + _ENV_ENTRY(PROMPT),
1826 + _ENV_ENTRY(BOOTCFG),
1827 + _ENV_ENTRY(HWA_0),
1828 +#if !defined (AVALANCHE) || defined(TNETC401B)
1829 + _ENV_ENTRY(HWA_1),
1831 +#if !defined(TNETV1020_BOARD)
1832 + _ENV_ENTRY(HWA_RNDIS),
1834 +#if defined (TNETD73XX_BOARD)
1835 + _ENV_ENTRY(HWA_3),
1838 + _ENV_ENTRY(IPA_SVR),
1839 + _ENV_ENTRY(IPA_GATEWAY),
1840 + _ENV_ENTRY(SUBNET_MASK),
1841 + _ENV_ENTRY(BLINE_MAC0),
1842 +#if !defined (AVALANCHE) || defined(TNETC401B)
1843 + _ENV_ENTRY(BLINE_MAC1),
1845 +#if !defined(TNETV1020_BOARD)
1846 + _ENV_ENTRY(BLINE_RNDIS),
1848 +#if defined (TNETD73XX_BOARD)
1849 + _ENV_ENTRY(BLINE_ATM),
1851 +#if !defined(TNETV1020_BOARD)
1852 + _ENV_ENTRY(USB_PID),
1853 + _ENV_ENTRY(USB_VID),
1854 + _ENV_ENTRY(USB_EPPOLLI),
1856 +#if defined (TNETV1050_BOARD)
1857 + _ENV_ENTRY(BLINE_ESWITCH),
1859 +#if !defined(TNETV1020_BOARD)
1860 + _ENV_ENTRY(USB_SERIAL),
1861 + _ENV_ENTRY(HWA_HRNDIS),
1863 + _ENV_ENTRY(REMOTE_USER),
1864 + _ENV_ENTRY(REMOTE_PASS),
1865 + _ENV_ENTRY(REMOTE_DIR),
1866 + _ENV_ENTRY(SYSFREQ),
1867 + _ENV_ENTRY(LINK_TIMEOUT),
1868 +#ifndef AVALANCHE /* Avalanche boards use only one mac port */
1869 + _ENV_ENTRY(MAC_PORT),
1872 + _ENV_ENTRY(HOSTNAME),
1874 + _ENV_ENTRY(HW_REV_MAJOR),
1875 + _ENV_ENTRY(HW_REV_MINOR),
1876 + _ENV_ENTRY(HW_PATCH),
1877 + _ENV_ENTRY(SW_PATCH),
1878 + _ENV_ENTRY(SERIAL_NUMBER),
1880 + _ENV_ENTRY(TFTPCFG),
1881 +#if defined (TNETV1050_BOARD)
1882 + _ENV_ENTRY(HWA_ESWITCH),
1885 + * Add new entries below this.
1887 + /* Adam2 environment name alias. */
1888 + { .idx = IPA, .nm = "my_ipaddress" },
1889 + { .idx = CPUFREQ, .nm = "cpufrequency" },
1890 + { .idx = SYSFREQ, .nm = "sysfrequency" },
1891 + { .idx = HWA_0, .nm = "maca" },
1893 + { .idx = HWA_1, .nm = "macb" },
1895 + { .idx = MODETTY0, .nm = "modetty0" },
1896 + { .idx = MODETTY1, .nm = "modetty1" },
1897 + { .idx = MEMSZ, .nm = "memsize" },
1899 + _ENV_ENTRY(env_vars_end) /* delimiter. */
1902 +static inline int var_to_idx(const char* var)
1906 + /* go over the list of pre-defined environment variables */
1907 + for (ii = env_vars_start; env_ns[ii].idx != env_vars_end; ii++){
1908 + /* check if the env variable is listed */
1909 + if (strcmp(env_ns[ii].nm, var) == 0) {
1910 + return env_ns[ii].idx;
1913 + /* if an alias is present, check if the alias matches
1916 + if (env_ns[ii].alias != NULL) {
1917 + if (strcmp(env_ns[ii].alias, var) == 0) {
1918 + return env_ns[ii].idx;
1925 +extern int *_prom_envp;
1927 +/* FIXME: reading from the flash is extremly unstable. Sometime a read returns garbage,
1928 + * the next read some seconds later is ok. It looks like something is hidding or
1929 + * overlay the flash address at 0xb0000000. Is this possible?
1931 + * The readb() and while() usage below is a attempt of a workarround - with limited success.
1934 +static inline struct env_variable* get_var_by_number(int index)
1936 + struct env_variable *env_var = (struct env_variable *)_prom_envp;
1937 + volatile unsigned char nr;
1940 + env_var++; /* skip signature */
1943 + nr = readb(&(env_var->varNum));
1945 + while (i < max_env_entry && nr != 0xFF) {
1946 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_PREFINED) {
1947 + if (nr == index) {
1952 + env_var = get_next_block(env_var);
1953 + nr = readb(&(env_var->varNum));
1959 +static inline struct env_variable* get_var_by_name(char *var)
1961 + struct env_variable *env_var = (struct env_variable *)_prom_envp;
1962 + volatile unsigned char nr;
1965 + env_var++; /* skip signature */
1967 + nr = readb(&(env_var->varNum));
1970 + while (i < max_env_entry && nr != 0xFF) {
1971 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_DYNAMIC) {
1972 + if (strcmp(var, env_var->data) == 0)
1976 + env_var = get_next_block(env_var);
1977 + nr = readb(&(env_var->varNum));
1982 +static inline struct env_variable* get_var(char *var)
1984 + int index = var_to_idx(var);
1987 + return get_var_by_number(index);
1989 + return get_var_by_name(var);
1994 +static inline char *get_value(struct env_variable* env_var)
1996 + unsigned char *name;
1997 + unsigned char *value;
1998 + unsigned short chksum;
2001 + chksum = env_var->varNum + env_var->ctrl + env_var->numCells;
2003 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_DYNAMIC) {
2004 + name = env_var->data;
2005 + value = env_var->data + strlen(name) + 1;
2007 + for(i = 0; i < strlen(name); i++)
2008 + chksum += name[i];
2010 + value = env_var->data;
2012 + for (i = 0; i < strlen(value); i++)
2013 + chksum += value[i];
2015 + chksum += env_var->chksum;
2016 + chksum = ~(chksum);
2026 + unsigned int psbl_size;
2027 + unsigned int env_base;
2028 + unsigned int env_size;
2029 + unsigned int ffs_base;
2030 + unsigned int ffs_size;
2033 +char *prom_psp_getenv(char *envname)
2035 + struct env_variable* env_var;
2038 + if (strcmp("bootloader", envname) == 0)
2041 + if (!(env_var = get_var(envname)))
2044 + value = get_value(env_var);
2048 diff -urN linux.old/arch/mips/ar7/reset.c linux.dev/arch/mips/ar7/reset.c
2049 --- linux.old/arch/mips/ar7/reset.c 1970-01-01 01:00:00.000000000 +0100
2050 +++ linux.dev/arch/mips/ar7/reset.c 2005-08-12 19:32:05.139225208 +0200
2053 + * Carsten Langgaard, carstenl@mips.com
2054 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
2056 + * ########################################################################
2058 + * This program is free software; you can distribute it and/or modify it
2059 + * under the terms of the GNU General Public License (Version 2) as
2060 + * published by the Free Software Foundation.
2062 + * This program is distributed in the hope it will be useful, but WITHOUT
2063 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2064 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2065 + * for more details.
2067 + * You should have received a copy of the GNU General Public License along
2068 + * with this program; if not, write to the Free Software Foundation, Inc.,
2069 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2071 + * ########################################################################
2073 + * Reset the MIPS boards.
2076 +#include <linux/config.h>
2078 +#include <asm/reboot.h>
2079 +#include <asm/mips-boards/generic.h>
2081 +static void ar7_machine_restart(char *command);
2082 +static void ar7_machine_halt(void);
2083 +static void ar7_machine_power_off(void);
2085 +static void ar7_machine_restart(char *command)
2087 + volatile unsigned int *softres_reg = (void *)(KSEG1ADDR(0x08611600 + 0x4));
2092 +static void ar7_machine_halt(void)
2097 +static void ar7_machine_power_off(void)
2102 +void ar7_reboot_setup(void)
2104 + _machine_restart = ar7_machine_restart;
2105 + _machine_halt = ar7_machine_halt;
2106 + _machine_power_off = ar7_machine_power_off;
2108 diff -urN linux.old/arch/mips/ar7/setup.c linux.dev/arch/mips/ar7/setup.c
2109 --- linux.old/arch/mips/ar7/setup.c 1970-01-01 01:00:00.000000000 +0100
2110 +++ linux.dev/arch/mips/ar7/setup.c 2005-08-12 19:32:05.139225208 +0200
2113 + * Carsten Langgaard, carstenl@mips.com
2114 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
2116 + * This program is free software; you can distribute it and/or modify it
2117 + * under the terms of the GNU General Public License (Version 2) as
2118 + * published by the Free Software Foundation.
2120 + * This program is distributed in the hope it will be useful, but WITHOUT
2121 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2122 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2123 + * for more details.
2125 + * You should have received a copy of the GNU General Public License along
2126 + * with this program; if not, write to the Free Software Foundation, Inc.,
2127 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2129 +#include <linux/config.h>
2130 +#include <linux/init.h>
2131 +#include <linux/sched.h>
2132 +#include <linux/mc146818rtc.h>
2133 +#include <linux/ioport.h>
2135 +#include <asm/cpu.h>
2136 +#include <asm/bootinfo.h>
2137 +#include <asm/irq.h>
2138 +#include <asm/mips-boards/generic.h>
2139 +#include <asm/mips-boards/prom.h>
2141 +#include <asm/dma.h>
2142 +#include <asm/time.h>
2143 +#include <asm/traps.h>
2146 +extern void rs_kgdb_hook(int);
2147 +int remote_debug = 0;
2150 +extern struct rtc_ops no_rtc_ops;
2152 +extern void ar7_reboot_setup(void);
2154 +extern void ar7_time_init(void);
2155 +extern void ar7_timer_setup(struct irqaction *irq);
2157 +const char *get_system_type(void)
2159 + return "Texas Instruments AR7";
2162 +void __init ar7_setup(void)
2165 + int rs_putDebugChar(char);
2166 + char rs_getDebugChar(void);
2167 + extern int (*generic_putDebugChar)(char);
2168 + extern char (*generic_getDebugChar)(void);
2171 +#ifdef CONFIG_SERIAL_CONSOLE
2172 + argptr = prom_getcmdline();
2173 + if ((argptr = strstr(argptr, "console=")) == NULL) {
2178 + s = prom_getenv("modetty0");
2179 + strcpy(console, "38400");
2182 + while (s[i] >= '0' && s[i] <= '9')
2186 + strncpy(console, s, i);
2191 + argptr = prom_getcmdline();
2192 + strcat(argptr, " console=ttyS0,");
2193 + strcat(argptr, console);
2198 + argptr = prom_getcmdline();
2199 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
2201 + argptr += strlen("kgdb=ttyS");
2202 + if (*argptr != '0' && *argptr != '1')
2203 + printk("KGDB: Uknown serial line /dev/ttyS%c, "
2204 + "falling back to /dev/ttyS1\n", *argptr);
2205 + line = *argptr == '0' ? 0 : 1;
2206 + printk("KGDB: Using serial line /dev/ttyS%d for session\n",
2209 + rs_kgdb_hook(line);
2210 + generic_putDebugChar = rs_putDebugChar;
2211 + generic_getDebugChar = rs_getDebugChar;
2213 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
2214 + "please connect your debugger\n", line ? 1 : 0);
2217 + /* Breakpoints are in init_IRQ() */
2221 + argptr = prom_getcmdline();
2222 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
2223 + cpu_data[0].options &= ~MIPS_CPU_FPU;
2225 + rtc_ops = &no_rtc_ops;
2227 + ar7_reboot_setup();
2229 + board_time_init = ar7_time_init;
2230 + board_timer_setup = ar7_timer_setup;
2232 diff -urN linux.old/arch/mips/ar7/time.c linux.dev/arch/mips/ar7/time.c
2233 --- linux.old/arch/mips/ar7/time.c 1970-01-01 01:00:00.000000000 +0100
2234 +++ linux.dev/arch/mips/ar7/time.c 2005-08-12 23:34:00.272589528 +0200
2237 + * Carsten Langgaard, carstenl@mips.com
2238 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
2240 + * ########################################################################
2242 + * This program is free software; you can distribute it and/or modify it
2243 + * under the terms of the GNU General Public License (Version 2) as
2244 + * published by the Free Software Foundation.
2246 + * This program is distributed in the hope it will be useful, but WITHOUT
2247 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2248 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2249 + * for more details.
2251 + * You should have received a copy of the GNU General Public License along
2252 + * with this program; if not, write to the Free Software Foundation, Inc.,
2253 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2255 + * ########################################################################
2257 + * Setting up the clock on the MIPS boards.
2261 +#include <linux/types.h>
2262 +#include <linux/config.h>
2263 +#include <linux/init.h>
2264 +#include <linux/kernel_stat.h>
2265 +#include <linux/sched.h>
2266 +#include <linux/spinlock.h>
2268 +#include <asm/mipsregs.h>
2269 +#include <asm/ptrace.h>
2270 +#include <asm/hardirq.h>
2271 +#include <asm/div64.h>
2273 +#include <linux/interrupt.h>
2274 +#include <linux/mc146818rtc.h>
2275 +#include <linux/timex.h>
2277 +#include <asm/mips-boards/generic.h>
2278 +#include <asm/mips-boards/prom.h>
2280 +extern asmlinkage void mipsIRQ(void);
2282 +static unsigned long r4k_offset; /* Amount to increment compare reg each time */
2283 +static unsigned long r4k_cur; /* What counter should be at next timer irq */
2285 +#define MIPS_CPU_TIMER_IRQ 7
2286 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
2288 +static inline void ack_r4ktimer(unsigned long newval)
2290 + write_c0_compare(newval);
2293 +void ar7_timer_interrupt(struct pt_regs *regs)
2295 + int cpu = smp_processor_id();
2297 + irq_enter(cpu, MIPS_CPU_TIMER_IRQ);
2299 + if (r4k_offset == 0)
2303 + kstat.irqs[cpu][MIPS_CPU_TIMER_IRQ]++;
2305 + r4k_cur += r4k_offset;
2306 + ack_r4ktimer(r4k_cur);
2308 + } while (((unsigned long)read_c0_count()
2309 + - r4k_cur) < 0x7fffffff);
2311 + irq_exit(cpu, MIPS_CPU_TIMER_IRQ);
2313 + if (softirq_pending(cpu))
2323 + * Figure out the r4k offset, the amount to increment the compare
2324 + * register for each time tick.
2326 +static unsigned long __init cal_r4koff(void)
2328 + return ((CONFIG_AR7_CPU*500000)/HZ);
2331 +void __init ar7_time_init(void)
2333 + unsigned long flags;
2334 + unsigned int est_freq;
2336 + set_except_vector(0, mipsIRQ);
2337 + write_c0_count(0);
2339 + printk("calculating r4koff... ");
2340 + r4k_offset = cal_r4koff();
2341 + printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
2343 + est_freq = 2*r4k_offset*HZ;
2344 + est_freq += 5000; /* round */
2345 + est_freq -= est_freq%10000;
2346 + printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
2347 + (est_freq%1000000)*100/1000000);
2350 +void __init ar7_timer_setup(struct irqaction *irq)
2352 + /* we are using the cpu counter for timer interrupts */
2353 + irq->handler = no_action; /* we use our own handler */
2354 + setup_irq(MIPS_CPU_TIMER_IRQ, irq);
2356 + r4k_cur = (read_c0_count() + r4k_offset);
2357 + write_c0_compare(r4k_cur);
2358 + set_c0_status(ALLINTS);
2360 diff -urN linux.old/arch/mips/ar7/tnetd73xx_misc.c linux.dev/arch/mips/ar7/tnetd73xx_misc.c
2361 --- linux.old/arch/mips/ar7/tnetd73xx_misc.c 1970-01-01 01:00:00.000000000 +0100
2362 +++ linux.dev/arch/mips/ar7/tnetd73xx_misc.c 2005-08-12 19:32:05.140225056 +0200
2364 +/******************************************************************************
2365 + * FILE PURPOSE: TNETD73xx Misc modules API Source
2366 + ******************************************************************************
2367 + * FILE NAME: tnetd73xx_misc.c
2369 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
2370 + * FSER Modules API
2371 + * As per TNETD73xx specifications
2373 + * REVISION HISTORY:
2374 + * 27 Nov 02 - Sharath Kumar PSP TII
2375 + * 14 Feb 03 - Anant Gole PSP TII
2377 + * (C) Copyright 2002, Texas Instruments, Inc
2378 + *******************************************************************************/
2380 +#define LITTLE_ENDIAN
2381 +#define _LINK_KSEG0_
2383 +#include <linux/types.h>
2384 +#include <asm/ar7/tnetd73xx.h>
2385 +#include <asm/ar7/tnetd73xx_misc.h>
2387 +/* TNETD73XX Revision */
2388 +u32 tnetd73xx_get_revision(void)
2390 + /* Read Chip revision register - This register is from GPIO module */
2391 + return ( (u32) REG32_DATA(TNETD73XX_CVR));
2394 +/*****************************************************************************
2395 + * Reset Control Module
2396 + *****************************************************************************/
2399 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module, TNETD73XX_RESET_CTRL_T reset_ctrl)
2403 + /* read current reset register */
2404 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2406 + if (reset_ctrl == OUT_OF_RESET)
2408 + /* bring module out of reset */
2409 + reset_status |= (1 << reset_module);
2413 + /* put module in reset */
2414 + reset_status &= (~(1 << reset_module));
2417 + /* write to the reset register */
2418 + REG32_WRITE(TNETD73XX_RST_CTRL_PRCR, reset_status);
2422 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status (TNETD73XX_RESET_MODULE_T reset_module)
2426 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2427 + return ( (reset_status & (1 << reset_module)) ? OUT_OF_RESET : IN_RESET );
2430 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode)
2432 + REG32_WRITE(TNETD73XX_RST_CTRL_SWRCR, mode);
2435 +#define TNETD73XX_RST_CTRL_RSR_MASK 0x3
2437 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status()
2439 + u32 sys_reset_status;
2441 + REG32_READ(TNETD73XX_RST_CTRL_RSR, sys_reset_status);
2443 + return ( (TNETD73XX_SYS_RESET_STATUS_T) (sys_reset_status & TNETD73XX_RST_CTRL_RSR_MASK) );
2447 +/*****************************************************************************
2448 + * Power Control Module
2449 + *****************************************************************************/
2450 +#define TNETD73XX_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
2451 +#define TNETD73XX_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
2454 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl)
2458 + /* read current power down control register */
2459 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2461 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
2463 + /* power down the module */
2464 + power_status |= (1 << power_module);
2468 + /* power on the module */
2469 + power_status &= (~(1 << power_module));
2472 + /* write to the reset register */
2473 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2476 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module)
2480 + /* read current power down control register */
2481 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2483 + return ( (power_status & (1 << power_module)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP );
2486 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode)
2490 + /* read current power down control register */
2491 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2493 + power_status &= TNETD73XX_GLOBAL_POWER_DOWN_MASK;
2494 + power_status |= ( power_mode << TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2496 + /* write to power down control register */
2497 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2500 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode()
2504 + /* read current power down control register */
2505 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2507 + power_status &= (~TNETD73XX_GLOBAL_POWER_DOWN_MASK);
2508 + power_status = ( power_status >> TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2510 + return ( (TNETD73XX_SYS_POWER_MODE_T) power_status );
2514 +/*****************************************************************************
2516 + *****************************************************************************/
2518 +#define TNETD73XX_WAKEUP_POLARITY_BIT 16
2520 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
2521 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
2522 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity)
2524 + u32 wakeup_status;
2526 + /* read the wakeup control register */
2527 + REG32_READ(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2529 + /* enable/disable */
2530 + if (wakeup_ctrl == WAKEUP_ENABLED)
2532 + /* enable wakeup */
2533 + wakeup_status |= wakeup_int;
2537 + /* disable wakeup */
2538 + wakeup_status &= (~wakeup_int);
2541 + /* set polarity */
2542 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
2544 + wakeup_status |= (wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2548 + wakeup_status &= ~(wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2551 + /* write the wakeup control register */
2552 + REG32_WRITE(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2556 +/*****************************************************************************
2558 + *****************************************************************************/
2560 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode)
2562 + REG32_WRITE(TNETD73XX_FSER_BASE, fser_mode);
2565 +/*****************************************************************************
2567 + *****************************************************************************/
2569 +#define MIN(x,y) ( ((x) < (y)) ? (x) : (y) )
2570 +#define MAX(x,y) ( ((x) > (y)) ? (x) : (y) )
2571 +#define ABS(x) ( ((signed)(x) > 0) ? (x) : (-(x)) )
2572 +#define CEIL(x,y) ( ((x) + (y) / 2) / (y) )
2574 +#define CLKC_CLKCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x20 + (0x20 * (x)))
2575 +#define CLKC_CLKPLLCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x30 + (0x20 * (x)))
2577 +#define CLKC_PRE_DIVIDER 0x0000001F
2578 +#define CLKC_POST_DIVIDER 0x001F0000
2580 +#define CLKC_PLL_STATUS 0x1
2581 +#define CLKC_PLL_FACTOR 0x0000F000
2583 +#define BOOTCR_PLL_BYPASS (1 << 5)
2584 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
2586 +#define MIPS_PLL_SELECT 0x00030000
2587 +#define SYSTEM_PLL_SELECT 0x0000C000
2588 +#define USB_PLL_SELECT 0x000C0000
2589 +#define ADSLSS_PLL_SELECT 0x00C00000
2591 +#define MIPS_AFECLKI_SELECT 0x00000000
2592 +#define MIPS_REFCLKI_SELECT 0x00010000
2593 +#define MIPS_XTAL3IN_SELECT 0x00020000
2595 +#define SYSTEM_AFECLKI_SELECT 0x00000000
2596 +#define SYSTEM_REFCLKI_SELECT 0x00004000
2597 +#define SYSTEM_XTAL3IN_SELECT 0x00008000
2598 +#define SYSTEM_MIPSPLL_SELECT 0x0000C000
2600 +#define USB_SYSPLL_SELECT 0x00000000
2601 +#define USB_REFCLKI_SELECT 0x00040000
2602 +#define USB_XTAL3IN_SELECT 0x00080000
2603 +#define USB_MIPSPLL_SELECT 0x000C0000
2605 +#define ADSLSS_AFECLKI_SELECT 0x00000000
2606 +#define ADSLSS_REFCLKI_SELECT 0x00400000
2607 +#define ADSLSS_XTAL3IN_SELECT 0x00800000
2608 +#define ADSLSS_MIPSPLL_SELECT 0x00C00000
2610 +#define SYS_MAX CLK_MHZ(150)
2611 +#define SYS_MIN CLK_MHZ(1)
2613 +#define MIPS_SYNC_MAX SYS_MAX
2614 +#define MIPS_ASYNC_MAX CLK_MHZ(160)
2615 +#define MIPS_MIN CLK_MHZ(1)
2617 +#define USB_MAX CLK_MHZ(100)
2618 +#define USB_MIN CLK_MHZ(1)
2620 +#define ADSL_MAX CLK_MHZ(180)
2621 +#define ADSL_MIN CLK_MHZ(1)
2623 +#define PLL_MUL_MAXFACTOR 15
2624 +#define MAX_DIV_VALUE 32
2625 +#define MIN_DIV_VALUE 1
2627 +#define MIN_PLL_INP_FREQ CLK_MHZ(8)
2628 +#define MAX_PLL_INP_FREQ CLK_MHZ(100)
2630 +#define DIVIDER_LOCK_TIME 10100
2631 +#define PLL_LOCK_TIME 10100 * 75
2635 + /****************************************************************************
2636 + * DATA PURPOSE: PRIVATE Variables
2637 + **************************************************************************/
2638 + static u32 *clk_src[4];
2639 + static u32 mips_pll_out;
2640 + static u32 sys_pll_out;
2641 + static u32 afeclk_inp;
2642 + static u32 refclk_inp;
2643 + static u32 xtal_inp;
2644 + static u32 present_min;
2645 + static u32 present_max;
2647 + /* Forward References */
2648 + static u32 find_gcd(u32 min, u32 max);
2649 + static u32 compute_prediv( u32 divider, u32 min, u32 max);
2650 + static void get_val(u32 base_freq, u32 output_freq,u32 *multiplier, u32 *divider);
2651 + static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id);
2652 + static void find_approx(u32 *,u32 *,u32);
2654 + /****************************************************************************
2655 + * FUNCTION: tnetd73xx_clkc_init
2656 + ****************************************************************************
2657 + * Description: The routine initializes the internal variables depending on
2658 + * on the sources selected for different clocks.
2659 + ***************************************************************************/
2660 +void tnetd73xx_clkc_init(u32 afeclk, u32 refclk, u32 xtal3in)
2665 + afeclk_inp = afeclk;
2666 + refclk_inp = refclk;
2667 + xtal_inp = xtal3in;
2669 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & MIPS_PLL_SELECT;
2672 + case MIPS_AFECLKI_SELECT:
2673 + clk_src[CLKC_MIPS] = &afeclk_inp;
2676 + case MIPS_REFCLKI_SELECT:
2677 + clk_src[CLKC_MIPS] = &refclk_inp;
2680 + case MIPS_XTAL3IN_SELECT:
2681 + clk_src[CLKC_MIPS] = &xtal_inp;
2685 + clk_src[CLKC_MIPS] = 0;
2689 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & SYSTEM_PLL_SELECT;
2692 + case SYSTEM_AFECLKI_SELECT:
2693 + clk_src[CLKC_SYS] = &afeclk_inp;
2696 + case SYSTEM_REFCLKI_SELECT:
2697 + clk_src[CLKC_SYS] = &refclk_inp;
2700 + case SYSTEM_XTAL3IN_SELECT:
2701 + clk_src[CLKC_SYS] = &xtal_inp;
2704 + case SYSTEM_MIPSPLL_SELECT:
2705 + clk_src[CLKC_SYS] = &mips_pll_out;
2709 + clk_src[CLKC_SYS] = 0;
2714 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & ADSLSS_PLL_SELECT;
2717 + case ADSLSS_AFECLKI_SELECT:
2718 + clk_src[CLKC_ADSLSS] = &afeclk_inp;
2721 + case ADSLSS_REFCLKI_SELECT:
2722 + clk_src[CLKC_ADSLSS] = &refclk_inp;
2725 + case ADSLSS_XTAL3IN_SELECT:
2726 + clk_src[CLKC_ADSLSS] = &xtal_inp;
2729 + case ADSLSS_MIPSPLL_SELECT:
2730 + clk_src[CLKC_ADSLSS] = &mips_pll_out;
2734 + clk_src[CLKC_ADSLSS] = 0;
2739 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & USB_PLL_SELECT;
2742 + case USB_SYSPLL_SELECT:
2743 + clk_src[CLKC_USB] = &sys_pll_out ;
2746 + case USB_REFCLKI_SELECT:
2747 + clk_src[CLKC_USB] = &refclk_inp;
2750 + case USB_XTAL3IN_SELECT:
2751 + clk_src[CLKC_USB] = &xtal_inp;
2754 + case USB_MIPSPLL_SELECT:
2755 + clk_src[CLKC_USB] = &mips_pll_out;
2759 + clk_src[CLKC_USB] = 0;
2766 +/****************************************************************************
2767 + * FUNCTION: tnetd73xx_clkc_set_freq
2768 + ****************************************************************************
2769 + * Description: The above routine is called to set the output_frequency of the
2770 + * selected clock(using clk_id) to the required value given
2771 + * by the variable output_freq.
2772 + ***************************************************************************/
2773 +TNETD73XX_ERR tnetd73xx_clkc_set_freq
2775 + TNETD73XX_CLKC_ID_T clk_id,
2788 + /* check if PLLs are bypassed*/
2789 + if(REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS)
2791 + return TNETD73XX_ERR_ERROR;
2794 + /*check if the requested output_frequency is in valid range*/
2798 + if( output_freq < SYS_MIN || output_freq > SYS_MAX)
2800 + return TNETD73XX_ERR_ERROR;
2802 + present_min = SYS_MIN;
2803 + present_max = SYS_MAX;
2807 + if((output_freq < MIPS_MIN) ||
2808 + (output_freq > ((REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX)))
2810 + return TNETD73XX_ERR_ERROR;
2812 + present_min = MIPS_MIN;
2813 + present_max = (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX;
2817 + if( output_freq < USB_MIN || output_freq > USB_MAX)
2819 + return TNETD73XX_ERR_ERROR;
2821 + present_min = USB_MIN;
2822 + present_max = USB_MAX;
2826 + if( output_freq < ADSL_MIN || output_freq > ADSL_MAX)
2828 + return TNETD73XX_ERR_ERROR;
2830 + present_min = ADSL_MIN;
2831 + present_max = ADSL_MAX;
2836 + base_freq = get_base_frequency(clk_id);
2839 + /* check for minimum base frequency value */
2840 + if( base_freq < MIN_PLL_INP_FREQ)
2842 + return TNETD73XX_ERR_ERROR;
2845 + get_val(output_freq, base_freq, &multiplier, ÷r);
2847 + /* check multiplier range */
2848 + if( (multiplier > PLL_MUL_MAXFACTOR) || (multiplier <= 0) )
2850 + return TNETD73XX_ERR_ERROR;
2853 + /* check divider value */
2854 + if( divider == 0 )
2856 + return TNETD73XX_ERR_ERROR;
2859 + /*compute minimum and maximum predivider values */
2860 + min_prediv = MAX(base_freq / MAX_PLL_INP_FREQ + 1, divider / MAX_DIV_VALUE + 1);
2861 + max_prediv = MIN(base_freq / MIN_PLL_INP_FREQ, MAX_DIV_VALUE);
2863 + /*adjust the value of divider so that it not less than minimum predivider value*/
2864 + if (divider < min_prediv)
2866 + temp = CEIL(min_prediv, divider);
2867 + if ((temp * multiplier) > PLL_MUL_MAXFACTOR)
2869 + return TNETD73XX_ERR_ERROR ;
2873 + multiplier = temp * multiplier;
2874 + divider = min_prediv;
2879 + /* compute predivider and postdivider values */
2880 + prediv = compute_prediv (divider, min_prediv, max_prediv);
2881 + postdiv = CEIL(divider,prediv);
2883 + /*return fail if postdivider value falls out of range */
2884 + if(postdiv > MAX_DIV_VALUE)
2886 + return TNETD73XX_ERR_ERROR;
2890 + /*write predivider and postdivider values*/
2891 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2892 + REG32_WRITE(CLKC_CLKCR(clk_id), ((postdiv -1) & 0x1F) << 16 | ((prediv -1) & 0x1F) );
2894 + /*wait for divider output to stabilise*/
2895 + for(temp =0; temp < DIVIDER_LOCK_TIME; temp++);
2897 + /*write to PLL clock register*/
2899 + if(clk_id == CLKC_SYS)
2901 + /* but before writing put DRAM to hold mode */
2902 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) |= 0x80000000;
2904 + /*Bring PLL into div mode */
2905 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), 0x4);
2907 + /*compute the word to be written to PLLCR
2908 + *corresponding to multiplier value
2910 + multiplier = (((multiplier - 1) & 0xf) << 12)| ((255 <<3) | 0x0e);
2912 + /* wait till PLL enters div mode */
2913 + while(REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2916 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), multiplier);
2918 + while(!REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2922 + /*wait for External pll to lock*/
2923 + for(temp =0; temp < PLL_LOCK_TIME; temp++);
2925 + if(clk_id == CLKC_SYS)
2927 + /* Bring DRAM out of hold */
2928 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) &= ~0x80000000;
2931 + return TNETD73XX_ERR_OK ;
2934 +/****************************************************************************
2935 + * FUNCTION: tnetd73xx_clkc_get_freq
2936 + ****************************************************************************
2937 + * Description: The above routine is called to get the output_frequency of the
2938 + * selected clock( clk_id)
2939 + ***************************************************************************/
2940 +u32 tnetd73xx_clkc_get_freq
2942 + TNETD73XX_CLKC_ID_T clk_id
2946 + u32 clk_ctrl_register;
2947 + u32 clk_pll_setting;
2948 + u32 clk_predivider;
2949 + u32 clk_postdivider;
2954 + base_freq = get_base_frequency(clk_id);
2956 + clk_ctrl_register = REG32_DATA(CLKC_CLKCR(clk_id));
2958 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2959 + clk_predivider = (CLKC_PRE_DIVIDER & clk_ctrl_register) + 1;
2960 + clk_postdivider = ((CLKC_POST_DIVIDER & clk_ctrl_register) >> 16) + 1;
2962 + divider = clk_predivider * clk_postdivider;
2965 + if( (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS))
2967 + return (CEIL(base_freq, divider)); /* PLLs bypassed.*/
2973 + /* return the current clock speed based upon the PLL setting */
2974 + clk_pll_setting = REG32_DATA(CLKC_CLKPLLCR(clk_id));
2976 + /* Get the PLL multiplication factor */
2977 + pll_factor = ((clk_pll_setting & CLKC_PLL_FACTOR) >> 12) + 1;
2979 + /* Check if we're in divide mode or multiply mode */
2980 + if((clk_pll_setting & 0x1) == 0)
2982 + /* We're in divide mode */
2983 + if(pll_factor < 0x10)
2984 + return (CEIL(base_freq >> 1, divider));
2986 + return (CEIL(base_freq >> 2, divider));
2989 + else /* We're in PLL mode */
2991 + /* See if PLLNDIV & PLLDIV are set */
2992 + if((clk_pll_setting & 0x0800) && (clk_pll_setting & 0x2))
2994 + if(clk_pll_setting & 0x1000)
2996 + /* clk = base_freq * k/2 */
2997 + return(CEIL((base_freq * pll_factor) >> 1, divider));
3001 + /* clk = base_freq * (k-1) / 4)*/
3002 + return(CEIL((base_freq * (pll_factor - 1)) >>2, divider));
3007 + if(pll_factor < 0x10)
3009 + /* clk = base_freq * k */
3010 + return(CEIL(base_freq * pll_factor, divider));
3015 + /* clk = base_freq */
3016 + return(CEIL(base_freq, divider));
3020 + return(0); /* Should never reach here */
3027 +/* local helper functions */
3029 +/****************************************************************************
3030 + * FUNCTION: get_base_frequency
3031 + ****************************************************************************
3032 + * Description: The above routine is called to get base frequency of the clocks.
3033 + ***************************************************************************/
3035 +static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id)
3037 + /* update the current MIPs PLL output value, if the required
3038 + * source is MIPS PLL
3040 + if ( clk_src[clk_id] == &mips_pll_out)
3042 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_MIPS);
3046 + /* update the current System PLL output value, if the required
3047 + * source is system PLL
3049 + if ( clk_src[clk_id] == &sys_pll_out)
3051 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_SYS);
3054 + return (*clk_src[clk_id]);
3060 +/****************************************************************************
3061 + * FUNCTION: find_gcd
3062 + ****************************************************************************
3063 + * Description: The above routine is called to find gcd of 2 numbers.
3064 + ***************************************************************************/
3065 +static u32 find_gcd
3071 + if (max % min == 0)
3077 + return find_gcd(max % min, min);
3081 +/****************************************************************************
3082 + * FUNCTION: compute_prediv
3083 + ****************************************************************************
3084 + * Description: The above routine is called to compute predivider value
3085 + ***************************************************************************/
3086 +static u32 compute_prediv(u32 divider, u32 min, u32 max)
3090 + /* return the divider itself it it falls within the range of predivider*/
3091 + if (min <= divider && divider <= max)
3096 + /* find a value for prediv such that it is a factor of divider */
3097 + for (prediv = max; prediv >= min ; prediv--)
3099 + if ( (divider % prediv) == 0 )
3105 + /* No such factor exists, return min as prediv */
3109 +/****************************************************************************
3110 + * FUNCTION: get_val
3111 + ****************************************************************************
3112 + * Description: This routine is called to get values of divider and multiplier.
3113 + ***************************************************************************/
3115 +static void get_val(u32 output_freq, u32 base_freq,u32 *multiplier, u32 *divider)
3123 + /* find gcd of base_freq, output_freq */
3124 + min_freq = (base_freq < output_freq) ? base_freq : output_freq;
3125 + max_freq = (base_freq > output_freq) ? base_freq : output_freq;
3126 + gcd = find_gcd(min_freq , max_freq);
3129 + return; /* ERROR */
3131 + /* compute values of multiplier and divider */
3132 + temp_mul = output_freq / gcd;
3133 + temp_div = base_freq / gcd;
3136 + /* set multiplier such that 1 <= multiplier <= PLL_MUL_MAXFACTOR */
3137 + if( temp_mul > PLL_MUL_MAXFACTOR )
3139 + if((temp_mul / temp_div) > PLL_MUL_MAXFACTOR)
3142 + find_approx(&temp_mul,&temp_div,base_freq);
3145 + *multiplier = temp_mul;
3146 + *divider = temp_div;
3149 +/****************************************************************************
3150 + * FUNCTION: find_approx
3151 + ****************************************************************************
3152 + * Description: This function gets the approx value of num/denom.
3153 + ***************************************************************************/
3155 +static void find_approx(u32 *num,u32 *denom,u32 base_freq)
3162 + int32_t prev_closest;
3172 + prev_closest = 0x7fffffff; /* maximum possible value */
3176 + /* start with max */
3177 + for(temp_num = 15; temp_num >=1; temp_num--)
3180 + temp_denom = CEIL(temp_num * denom1, num1);
3181 + output_freq = (temp_num * base_freq) / temp_denom;
3183 + if(temp_denom < 1)
3189 + normalize = CEIL(num1,temp_num);
3190 + closest = (ABS((num1 * (temp_denom) ) - (temp_num * denom1))) * normalize;
3191 + if(closest < prev_closest && output_freq > present_min && output_freq <present_max)
3193 + prev_closest = closest;
3195 + denom2 = temp_denom;
3202 + gcd = find_gcd(num2,denom2);
3203 + num2 = num2 / gcd;
3204 + denom2 = denom2 /gcd;
3211 +/*****************************************************************************
3213 + *****************************************************************************/
3215 +/****************************************************************************
3216 + * FUNCTION: tnetd73xx_gpio_init
3217 + ***************************************************************************/
3218 +void tnetd73xx_gpio_init()
3220 + /* Bring module out of reset */
3221 + tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
3222 + REG32_WRITE(TNETD73XX_GPIOENR, 0xFFFFFFFF);
3225 +/****************************************************************************
3226 + * FUNCTION: tnetd73xx_gpio_ctrl
3227 + ***************************************************************************/
3228 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
3229 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
3230 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction)
3233 + REG32_READ(TNETD73XX_GPIOENR, pin_status);
3234 + if (pin_mode == GPIO_PIN)
3236 + pin_status |= (1 << gpio_pin);
3237 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
3239 + /* Set pin direction */
3240 + REG32_READ(TNETD73XX_GPIOPDIRR, pin_status);
3241 + if (pin_direction == GPIO_INPUT_PIN)
3243 + pin_status |= (1 << gpio_pin);
3245 + else /* GPIO_OUTPUT_PIN */
3247 + pin_status &= (~(1 << gpio_pin));
3249 + REG32_WRITE(TNETD73XX_GPIOPDIRR, pin_status);
3251 + else /* FUNCTIONAL PIN */
3253 + pin_status &= (~(1 << gpio_pin));
3254 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
3259 +/****************************************************************************
3260 + * FUNCTION: tnetd73xx_gpio_out
3261 + ***************************************************************************/
3262 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value)
3266 + REG32_READ(TNETD73XX_GPIODOUTR, pin_value);
3269 + pin_value |= (1 << gpio_pin);
3273 + pin_value &= (~(1 << gpio_pin));
3275 + REG32_WRITE(TNETD73XX_GPIODOUTR, pin_value);
3278 +/****************************************************************************
3279 + * FUNCTION: tnetd73xx_gpio_in
3280 + ***************************************************************************/
3281 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin)
3284 + REG32_READ(TNETD73XX_GPIODINR, pin_value);
3285 + return ( (pin_value & (1 << gpio_pin)) ? 1 : 0 );
3288 diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared.in
3289 --- linux.old/arch/mips/config-shared.in 2005-07-10 03:00:44.000000000 +0200
3290 +++ linux.dev/arch/mips/config-shared.in 2005-08-12 19:53:15.060167880 +0200
3292 mainmenu_option next_comment
3293 comment 'Machine selection'
3294 dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL
3295 +dep_bool 'Support for Texas Instruments AR7 (EXPERIMENTAL)' CONFIG_AR7 $CONFIG_MIPS32 $CONFIG_EXPERIMENTAL
3296 +if [ "$CONFIG_AR7" = "y" ]; then
3297 + choice 'Texas Instruments Reference Platform' \
3298 + "AR7DB CONFIG_AR7DB \
3299 + AR7RD CONFIG_AR7RD \
3300 + AR7WRD CONFIG_AR7WRD" AR7DB
3301 + int 'Texas Instruments AR7 CPU Frequency' CONFIG_AR7_CPU 150
3302 + int 'Texas Instruments AR7 System Frequency' CONFIG_AR7_SYS 125
3303 + hex 'Texas Instruments AR7 SDRAM Start' CONFIG_AR7_MEMORY 0x14000000
3305 dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32
3306 dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32
3307 dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32
3308 @@ -239,6 +249,10 @@
3309 define_bool CONFIG_NONCOHERENT_IO y
3310 define_bool CONFIG_PC_KEYB y
3312 +if [ "$CONFIG_AR7" = "y" ]; then
3313 + define_bool CONFIG_NONCOHERENT_IO y
3314 + define_bool CONFIG_SWAP_IO_SPACE y
3316 if [ "$CONFIG_CASIO_E55" = "y" ]; then
3317 define_bool CONFIG_IRQ_CPU y
3318 define_bool CONFIG_NONCOHERENT_IO y
3320 mainmenu_option next_comment
3321 comment 'General setup'
3322 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
3323 + "$CONFIG_AR7" = "y" -o \
3324 "$CONFIG_CASIO_E55" = "y" -o \
3325 "$CONFIG_DDB5074" = "y" -o \
3326 "$CONFIG_DDB5476" = "y" -o \
3328 bool 'Networking support' CONFIG_NET
3330 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
3331 + "$CONFIG_AR7" = "y" -o \
3332 "$CONFIG_CASIO_E55" = "y" -o \
3333 "$CONFIG_DECSTATION" = "y" -o \
3334 "$CONFIG_IBM_WORKPAD" = "y" -o \
3335 diff -urN linux.old/arch/mips/kernel/head.S linux.dev/arch/mips/kernel/head.S
3336 --- linux.old/arch/mips/kernel/head.S 2005-07-10 02:55:18.000000000 +0200
3337 +++ linux.dev/arch/mips/kernel/head.S 2005-08-12 23:05:36.954533232 +0200
3341 NESTED(except_vec4, 0, sp)
3344 -1: j 1b /* Dummy, will be replaced */
3355 diff -urN linux.old/arch/mips/kernel/irq.c linux.dev/arch/mips/kernel/irq.c
3356 --- linux.old/arch/mips/kernel/irq.c 2005-07-10 03:00:44.000000000 +0200
3357 +++ linux.dev/arch/mips/kernel/irq.c 2005-08-12 19:32:05.142224752 +0200
3359 * Generic, controller-independent functions:
3363 int get_irq_list(char *buf)
3367 p += sprintf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
3373 int global_irq_holder = NO_PROC_ID;
3379 int request_irq(unsigned int irq,
3380 void (*handler)(int, void *, struct pt_regs *),
3381 unsigned long irqflags,
3389 * free_irq - free an interrupt
3395 void free_irq(unsigned int irq, void *dev_id)
3405 * IRQ autodetection code..
3406 diff -urN linux.old/arch/mips/kernel/mips_ksyms.c linux.dev/arch/mips/kernel/mips_ksyms.c
3407 --- linux.old/arch/mips/kernel/mips_ksyms.c 2004-02-18 14:36:30.000000000 +0100
3408 +++ linux.dev/arch/mips/kernel/mips_ksyms.c 2005-08-12 19:32:05.142224752 +0200
3410 extern long __strnlen_user_nocheck_asm(const char *s);
3411 extern long __strnlen_user_asm(const char *s);
3414 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num, unsigned int pace_value);
3415 +char *prom_getenv(char *envname);
3419 EXPORT_SYMBOL(mips_machtype);
3421 EXPORT_SYMBOL(EISA_bus);
3425 EXPORT_SYMBOL(get_wchan);
3428 +EXPORT_SYMBOL_NOVERS(avalanche_request_pacing);
3429 +EXPORT_SYMBOL_NOVERS(prom_getenv);
3432 diff -urN linux.old/arch/mips/kernel/setup.c linux.dev/arch/mips/kernel/setup.c
3433 --- linux.old/arch/mips/kernel/setup.c 2005-07-10 03:00:44.000000000 +0200
3434 +++ linux.dev/arch/mips/kernel/setup.c 2005-08-12 19:56:27.917849056 +0200
3435 @@ -235,7 +235,11 @@
3436 #define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
3437 #define PFN_PHYS(x) ((x) << PAGE_SHIFT)
3440 +#define MAXMEM HIGHMEM_START + CONFIG_AR7_MEMORY
3442 #define MAXMEM HIGHMEM_START
3444 #define MAXMEM_PFN PFN_DOWN(MAXMEM)
3446 static inline void bootmem_init(void)
3447 @@ -320,7 +324,12 @@
3450 /* Initialize the boot-time allocator with low memory only. */
3452 + bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
3453 + CONFIG_AR7_MEMORY >> PAGE_SHIFT, max_low_pfn);
3455 bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn);
3459 * Register fully available low RAM pages with the bootmem allocator.
3461 void hp_setup(void);
3462 void au1x00_setup(void);
3463 void frame_info_init(void);
3464 + void ar7_setup(void);
3467 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
3468 @@ -691,6 +701,11 @@
3469 pmc_yosemite_setup();
3473 + case MACH_GROUP_UNKNOWN:
3478 panic("Unsupported architecture");
3480 diff -urN linux.old/arch/mips/kernel/traps.c linux.dev/arch/mips/kernel/traps.c
3481 --- linux.old/arch/mips/kernel/traps.c 2005-07-10 03:00:44.000000000 +0200
3482 +++ linux.dev/arch/mips/kernel/traps.c 2005-08-12 23:38:46.505075576 +0200
3483 @@ -869,9 +869,15 @@
3485 exception_handlers[n] = handler;
3486 if (n == 0 && cpu_has_divec) {
3488 + *(volatile u32 *)(KSEG0+0x200+CONFIG_AR7_MEMORY) = 0x08000000 |
3489 + (0x03ffffff & (handler >> 2));
3490 + flush_icache_range(KSEG0+0x200+CONFIG_AR7_MEMORY, KSEG0 + 0x204 + CONFIG_AR7_MEMORY);
3492 *(volatile u32 *)(KSEG0+0x200) = 0x08000000 |
3493 (0x03ffffff & (handler >> 2));
3494 flush_icache_range(KSEG0+0x200, KSEG0 + 0x204);
3497 return (void *)old_handler;
3499 @@ -1022,6 +1028,12 @@
3501 if (board_nmi_handler_setup)
3502 board_nmi_handler_setup();
3504 + memcpy((void *)(KSEG0 + CONFIG_AR7_MEMORY + 0x80), &except_vec1_generic, 0x80);
3505 + memcpy((void *)(KSEG0 + CONFIG_AR7_MEMORY + 0x180), &except_vec3_generic, 0x80);
3506 + memcpy((void *)(KSEG0 + CONFIG_AR7_MEMORY + 0x200), &except_vec4, 8);
3507 + flush_icache_range(KSEG0 + CONFIG_AR7_MEMORY, KSEG0 + CONFIG_AR7_MEMORY + 0x208);
3510 flush_icache_range(KSEG0, KSEG0 + 0x400);
3512 diff -urN linux.old/arch/mips/lib/promlib.c linux.dev/arch/mips/lib/promlib.c
3513 --- linux.old/arch/mips/lib/promlib.c 2005-07-10 03:00:44.000000000 +0200
3514 +++ linux.dev/arch/mips/lib/promlib.c 2005-08-12 20:39:57.087195024 +0200
3517 #include <linux/kernel.h>
3518 +#include <linux/config.h>
3521 extern void prom_putchar(char);
3523 void prom_printf(char *fmt, ...)
3529 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
3530 --- linux.old/arch/mips/Makefile 2005-07-10 03:00:44.000000000 +0200
3531 +++ linux.dev/arch/mips/Makefile 2005-08-12 20:38:28.398677728 +0200
3532 @@ -369,6 +369,16 @@
3536 +# Texas Instruments AR7
3540 +LIBS += arch/mips/ar7/ar7.o
3541 +SUBDIRS += arch/mips/ar7
3542 +LOADADDR += 0x94020000
3548 ifdef CONFIG_DECSTATION
3549 diff -urN linux.old/arch/mips/mm/init.c linux.dev/arch/mips/mm/init.c
3550 --- linux.old/arch/mips/mm/init.c 2005-07-10 03:00:44.000000000 +0200
3551 +++ linux.dev/arch/mips/mm/init.c 2005-08-12 21:08:04.420681344 +0200
3554 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
3557 + low = NODE_DATA(0)->bdata->node_low_pfn - (CONFIG_AR7_MEMORY >> PAGE_SHIFT);
3562 @@ -270,7 +273,11 @@
3563 zones_size[ZONE_HIGHMEM] = high - low;
3567 + free_area_init_node(0, NODE_DATA(0), 0, zones_size, CONFIG_AR7_MEMORY, 0);
3569 free_area_init(zones_size);
3573 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
3574 @@ -298,6 +305,10 @@
3579 +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
3580 +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
3582 void __init mem_init(void)
3584 unsigned long codesize, reservedpages, datasize, initsize;
3585 @@ -315,9 +326,21 @@
3587 max_mapnr = num_mappedpages = num_physpages = max_low_pfn;
3591 + max_mapnr = num_mappedpages = num_physpages = MAX_LOW_PFN - START_PFN;
3592 + high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE);
3596 + free_bootmem_node(NODE_DATA(0), (CONFIG_AR7_MEMORY+PAGE_SIZE), (__pa(&_ftext))-(CONFIG_AR7_MEMORY+PAGE_SIZE));
3598 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
3600 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
3602 totalram_pages += free_all_bootmem();
3605 totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */
3607 reservedpages = ram = 0;
3608 diff -urN linux.old/drivers/char/serial.c linux.dev/drivers/char/serial.c
3609 --- linux.old/drivers/char/serial.c 2005-07-10 03:00:44.000000000 +0200
3610 +++ linux.dev/drivers/char/serial.c 2005-08-12 19:32:05.147223992 +0200
3611 @@ -419,7 +419,40 @@
3615 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3616 +#if defined(CONFIG_AR7)
3618 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
3620 + return (inb(info->port + (offset * 4)) & 0xff);
3624 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
3626 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3627 + return (inb(info->port + (offset * 4)) & 0xff);
3629 + return (inb_p(info->port + (offset * 4)) & 0xff);
3633 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
3635 + outb(value, info->port + (offset * 4));
3639 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
3642 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
3643 + outb(value, info->port + (offset * 4));
3645 + outb_p(value, info->port + (offset * 4));
3649 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
3651 #include <asm/mips-boards/atlas.h>
3653 @@ -478,8 +511,10 @@
3654 * needed for certain old 386 machines, I've left these #define's
3658 #define serial_inp(info, offset) serial_in(info, offset)
3659 #define serial_outp(info, offset, value) serial_out(info, offset, value)
3664 @@ -1728,7 +1763,15 @@
3665 /* Special case since 134 is really 134.5 */
3666 quot = (2*baud_base / 269);
3669 + quot = (CONFIG_AR7_SYS*500000) / baud;
3675 quot = baud_base / baud;
3678 /* If the quotient is zero refuse the change */
3679 if (!quot && old_termios) {
3680 @@ -5552,8 +5595,10 @@
3681 state->irq = irq_cannonicalize(state->irq);
3683 state->io_type = SERIAL_IO_HUB6;
3685 if (state->port && check_region(state->port,8))
3689 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
3691 @@ -6009,7 +6054,15 @@
3692 info->io_type = state->io_type;
3693 info->iomem_base = state->iomem_base;
3694 info->iomem_reg_shift = state->iomem_reg_shift;
3696 + quot = (CONFIG_AR7_SYS*500000) / baud;
3702 quot = state->baud_base / baud;
3704 cval = cflag & (CSIZE | CSTOPB);
3705 #if defined(__powerpc__) || defined(__alpha__)
3707 diff -urN linux.old/include/asm-mips/ar7/ar7.h linux.dev/include/asm-mips/ar7/ar7.h
3708 --- linux.old/include/asm-mips/ar7/ar7.h 1970-01-01 01:00:00.000000000 +0100
3709 +++ linux.dev/include/asm-mips/ar7/ar7.h 2005-08-12 19:32:05.147223992 +0200
3713 + * Copyright (C) $Date$ $Author$
3715 + * This program is free software; you can redistribute it and/or modify
3716 + * it under the terms of the GNU General Public License as published by
3717 + * the Free Software Foundation; either version 2 of the License, or
3718 + * (at your option) any later version.
3720 + * This program is distributed in the hope that it will be useful,
3721 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3722 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3723 + * GNU General Public License for more details.
3725 + * You should have received a copy of the GNU General Public License
3726 + * along with this program; if not, write to the Free Software
3727 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3734 +#include <asm/addrspace.h>
3735 +#include <linux/config.h>
3737 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(CONFIG_AR7_MEMORY))
3739 +#define AR7_UART0_REGS_BASE (KSEG1ADDR(0x08610E00))
3740 +#define AR7_UART1_REGS_BASE (KSEG1ADDR(0x08610F00))
3741 +#define AR7_BASE_BAUD ( 3686400 / 16 )
3744 diff -urN linux.old/include/asm-mips/ar7/avalanche_intc.h linux.dev/include/asm-mips/ar7/avalanche_intc.h
3745 --- linux.old/include/asm-mips/ar7/avalanche_intc.h 1970-01-01 01:00:00.000000000 +0100
3746 +++ linux.dev/include/asm-mips/ar7/avalanche_intc.h 2005-08-12 19:32:05.148223840 +0200
3749 + * Nitin Dhingra, iamnd@ti.com
3750 + * Copyright (C) 2000 Texas Instruments Inc.
3753 + * ########################################################################
3755 + * This program is free software; you can distribute it and/or modify it
3756 + * under the terms of the GNU General Public License (Version 2) as
3757 + * published by the Free Software Foundation.
3759 + * This program is distributed in the hope it will be useful, but WITHOUT
3760 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3761 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3762 + * for more details.
3764 + * You should have received a copy of the GNU General Public License along
3765 + * with this program; if not, write to the Free Software Foundation, Inc.,
3766 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
3768 + * ########################################################################
3770 + * Defines of the Sead board specific address-MAP, registers, etc.
3773 +#ifndef _AVALANCHE_INTC_H
3774 +#define _AVALANCHE_INTC_H
3778 +#define KSEG1_BASE 0xA0000000
3779 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
3780 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
3781 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
3782 +#define AVALANCHE_INTC_BASE PHYS_TO_K1(0x08612400)
3786 +#define MIPS_EXCEPTION_OFFSET 8
3788 +/******************************************************************************
3789 + Avalanche Interrupt number
3790 +******************************************************************************/
3791 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
3793 +/*******************************************************************************
3794 +*Linux Interrupt number
3795 +*******************************************************************************/
3796 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
3800 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
3801 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
3803 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
3804 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
3807 +#define AVALANCHE_INT_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
3808 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) \
3809 + + MIPS_EXCEPTION_OFFSET - 1) /* Suraj, check */
3813 + * Avalanche interrupt controller register base (primary)
3815 +#define AVALANCHE_ICTRL_REGS_BASE AVALANCHE_INTC_BASE
3817 +/******************************************************************************
3818 + * Avalanche exception controller register base (secondary)
3819 + ******************************************************************************/
3820 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
3823 +/******************************************************************************
3824 + * Avalanche Interrupt pacing register base (secondary)
3825 + ******************************************************************************/
3826 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
3830 +/******************************************************************************
3831 + * Avalanche Interrupt Channel Control register base
3832 + *****************************************************************************/
3833 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
3836 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
3838 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 0x00 */
3839 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 0x04 */
3840 + volatile unsigned long unused1; /*0x08 */
3841 + volatile unsigned long unused2; /*0x0C */
3842 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 0x10 */
3843 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 0x14 */
3844 + volatile unsigned long unused3; /*0x18 */
3845 + volatile unsigned long unused4; /*0x1C */
3846 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 0x20 */
3847 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 0x24 */
3848 + volatile unsigned long unused5; /*0x28 */
3849 + volatile unsigned long unused6; /*0x2C */
3850 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 0x30 */
3851 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 0x34 */
3852 + volatile unsigned long unused7; /* 0x38 */
3853 + volatile unsigned long unused8; /* 0x3c */
3854 + volatile unsigned long pintir; /* Priority Interrupt Index Register 0x40 */
3855 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg 0x44 */
3856 + volatile unsigned long unused9; /* 0x48 */
3857 + volatile unsigned long unused10; /* 0x4C */
3858 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 10x50 */
3859 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 20x54 */
3860 + volatile unsigned long unused11; /* 0x58 */
3861 + volatile unsigned long unused12; /*0x5C */
3862 + volatile unsigned long inttypr1; /* Interrupt Type Mask register 10x60 */
3863 + volatile unsigned long inttypr2; /* Interrupt Type Mask register 20x64 */
3866 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
3868 + volatile unsigned long exsr; /* Exceptions Status/Set register 0x80 */
3869 + volatile unsigned long reserved; /*0x84 */
3870 + volatile unsigned long excr; /* Exceptions Clear Register 0x88 */
3871 + volatile unsigned long reserved1; /*0x8c */
3872 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) 0x90 */
3873 + volatile unsigned long reserved2; /*0x94 */
3874 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable(clear)0x98 */
3876 +struct avalanche_ipace_regs
3879 + volatile unsigned long ipacep; /* Interrupt pacing register 0xa0 */
3880 + volatile unsigned long ipacemap; /*Interrupt Pacing Map Register 0xa4 */
3881 + volatile unsigned long ipacemax; /*Interrupt Pacing Max Register 0xa8 */
3883 +struct avalanche_channel_int_number
3885 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register0x200 */
3886 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register0x204 */
3887 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register0x208 */
3888 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register0x20C */
3889 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register0x210 */
3890 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register0x214 */
3891 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register0x218 */
3892 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register0x21C */
3893 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register0x220 */
3894 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register0x224 */
3895 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register0x228 */
3896 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register0x22C */
3897 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register0x230 */
3898 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register0x234 */
3899 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register0x238 */
3900 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register0x23C */
3901 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register0x240 */
3902 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register0x244 */
3903 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register0x248 */
3904 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register0x24C */
3905 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register0x250 */
3906 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register0x254 */
3907 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register0x358 */
3908 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register0x35C */
3909 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register0x260 */
3910 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register0x264 */
3911 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register0x268 */
3912 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register0x26C */
3913 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register0x270 */
3914 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register0x274 */
3915 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register0x278 */
3916 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register0x27C */
3917 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register0x280 */
3918 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register0x284 */
3919 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register0x288 */
3920 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register0x28C */
3921 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register0x290 */
3922 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register0x294 */
3923 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register0x298 */
3924 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register0x29C */
3927 +struct avalanche_interrupt_line_to_channel
3929 + unsigned long int_line0; /* Start of primary interrupts */
3930 + unsigned long int_line1;
3931 + unsigned long int_line2;
3932 + unsigned long int_line3;
3933 + unsigned long int_line4;
3934 + unsigned long int_line5;
3935 + unsigned long int_line6;
3936 + unsigned long int_line7;
3937 + unsigned long int_line8;
3938 + unsigned long int_line9;
3939 + unsigned long int_line10;
3940 + unsigned long int_line11;
3941 + unsigned long int_line12;
3942 + unsigned long int_line13;
3943 + unsigned long int_line14;
3944 + unsigned long int_line15;
3945 + unsigned long int_line16;
3946 + unsigned long int_line17;
3947 + unsigned long int_line18;
3948 + unsigned long int_line19;
3949 + unsigned long int_line20;
3950 + unsigned long int_line21;
3951 + unsigned long int_line22;
3952 + unsigned long int_line23;
3953 + unsigned long int_line24;
3954 + unsigned long int_line25;
3955 + unsigned long int_line26;
3956 + unsigned long int_line27;
3957 + unsigned long int_line28;
3958 + unsigned long int_line29;
3959 + unsigned long int_line30;
3960 + unsigned long int_line31;
3961 + unsigned long int_line32;
3962 + unsigned long int_line33;
3963 + unsigned long int_line34;
3964 + unsigned long int_line35;
3965 + unsigned long int_line36;
3966 + unsigned long int_line37;
3967 + unsigned long int_line38;
3968 + unsigned long int_line39;
3972 +/* Interrupt Line #'s (Sangam peripherals) */
3974 +/*------------------------------*/
3975 +/* Sangam primary interrupts */
3976 +/*------------------------------*/
3978 +#define UNIFIED_SECONDARY_INTERRUPT 0
3979 +#define AVALANCHE_EXT_INT_0 1
3980 +#define AVALANCHE_EXT_INT_1 2
3981 +/* Line #3 Reserved */
3982 +/* Line #4 Reserved */
3983 +#define AVALANCHE_TIMER_0_INT 5
3984 +#define AVALANCHE_TIMER_1_INT 6
3985 +#define AVALANCHE_UART0_INT 7
3986 +#define AVALANCHE_UART1_INT 8
3987 +#define AVALANCHE_PDMA_INT0 9
3988 +#define AVALANCHE_PDMA_INT1 10
3989 +/* Line #11 Reserved */
3990 +/* Line #12 Reserved */
3991 +/* Line #13 Reserved */
3992 +/* Line #14 Reserved */
3993 +#define AVALANCHE_ATM_SAR_INT 15
3994 +/* Line #16 Reserved */
3995 +/* Line #17 Reserved */
3996 +/* Line #18 Reserved */
3997 +#define AVALANCHE_MAC0_INT 19
3998 +/* Line #20 Reserved */
3999 +#define AVALANCHE_VLYNQ0_INT 21
4000 +#define AVALANCHE_CODEC_WAKE_INT 22
4001 +/* Line #23 Reserved */
4002 +#define AVALANCHE_USB_INT 24
4003 +#define AVALANCHE_VLYNQ1_INT 25
4004 +/* Line #26 Reserved */
4005 +/* Line #27 Reserved */
4006 +#define AVALANCHE_MAC1_INT 28
4007 +#define AVALANCHE_I2CM_INT 29
4008 +#define AVALANCHE_PDMA_INT2 30
4009 +#define AVALANCHE_PDMA_INT3 31
4010 +/* Line #32 Reserved */
4011 +/* Line #33 Reserved */
4012 +/* Line #34 Reserved */
4013 +/* Line #35 Reserved */
4014 +/* Line #36 Reserved */
4015 +#define AVALANCHE_VDMA_VT_RX_INT 37
4016 +#define AVALANCHE_VDMA_VT_TX_INT 38
4017 +#define AVALANCHE_ADSLSS_INT 39
4019 +/*-----------------------------------*/
4020 +/* Sangam Secondary Interrupts */
4021 +/*-----------------------------------*/
4022 +#define PRIMARY_INTS 40
4024 +#define EMIF_INT (7 + PRIMARY_INTS)
4027 +extern void avalanche_int_set(int channel, int line);
4030 +#endif /* _AVALANCHE_INTC_H */
4031 diff -urN linux.old/include/asm-mips/ar7/avalanche_misc.h linux.dev/include/asm-mips/ar7/avalanche_misc.h
4032 --- linux.old/include/asm-mips/ar7/avalanche_misc.h 1970-01-01 01:00:00.000000000 +0100
4033 +++ linux.dev/include/asm-mips/ar7/avalanche_misc.h 2005-08-12 19:32:05.148223840 +0200
4035 +#ifndef _AVALANCHE_MISC_H_
4036 +#define _AVALANCHE_MISC_H_
4038 +typedef enum AVALANCHE_ERR_t
4040 + AVALANCHE_ERR_OK = 0, /* OK or SUCCESS */
4041 + AVALANCHE_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
4043 + /* Pointers and args */
4044 + AVALANCHE_ERR_INVARG = -2, /* Invaild argument to the call */
4045 + AVALANCHE_ERR_NULLPTR = -3, /* NULL pointer */
4046 + AVALANCHE_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
4048 + /* Memory issues */
4049 + AVALANCHE_ERR_ALLOC_FAIL = -10, /* allocation failed */
4050 + AVALANCHE_ERR_FREE_FAIL = -11, /* free failed */
4051 + AVALANCHE_ERR_MEM_CORRUPT = -12, /* corrupted memory */
4052 + AVALANCHE_ERR_BUF_LINK = -13, /* buffer linking failed */
4054 + /* Device issues */
4055 + AVALANCHE_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
4056 + AVALANCHE_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
4058 + AVALANCHE_ERR_INVID = -30 /* Invalid ID */
4062 +/*****************************************************************************
4063 + * Reset Control Module
4064 + *****************************************************************************/
4066 +typedef enum AVALANCHE_RESET_MODULE_tag
4068 + RESET_MODULE_UART0 = 0,
4069 + RESET_MODULE_UART1 = 1,
4070 + RESET_MODULE_I2C = 2,
4071 + RESET_MODULE_TIMER0 = 3,
4072 + RESET_MODULE_TIMER1 = 4,
4073 + RESET_MODULE_GPIO = 6,
4074 + RESET_MODULE_ADSLSS = 7,
4075 + RESET_MODULE_USBS = 8,
4076 + RESET_MODULE_SAR = 9,
4077 + RESET_MODULE_VDMA_VT = 11,
4078 + RESET_MODULE_FSER = 12,
4079 + RESET_MODULE_VLYNQ1 = 16,
4080 + RESET_MODULE_EMAC0 = 17,
4081 + RESET_MODULE_DMA = 18,
4082 + RESET_MODULE_BIST = 19,
4083 + RESET_MODULE_VLYNQ0 = 20,
4084 + RESET_MODULE_EMAC1 = 21,
4085 + RESET_MODULE_MDIO = 22,
4086 + RESET_MODULE_ADSLSS_DSP = 23,
4087 + RESET_MODULE_EPHY = 26
4088 +} AVALANCHE_RESET_MODULE_T;
4090 +typedef enum AVALANCHE_RESET_CTRL_tag
4094 +} AVALANCHE_RESET_CTRL_T;
4096 +typedef enum AVALANCHE_SYS_RST_MODE_tag
4098 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
4099 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
4100 +} AVALANCHE_SYS_RST_MODE_T;
4102 +typedef enum AVALANCHE_SYS_RESET_STATUS_tag
4104 + HARDWARE_RESET = 0,
4105 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
4107 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
4108 +} AVALANCHE_SYS_RESET_STATUS_T;
4110 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(AVALANCHE_RESET_MODULE_T reset_module);
4111 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode);
4112 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status(void);
4114 +typedef int (*REMOTE_VLYNQ_DEV_RESET_CTRL_FN)(unsigned int reset_module, AVALANCHE_RESET_CTRL_T reset_ctrl);
4116 +/*****************************************************************************
4117 + * Power Control Module
4118 + *****************************************************************************/
4120 +typedef enum AVALANCHE_POWER_CTRL_tag
4122 + POWER_CTRL_POWER_UP = 0,
4123 + POWER_CTRL_POWER_DOWN
4124 +} AVALANCHE_POWER_CTRL_T;
4126 +typedef enum AVALANCHE_SYS_POWER_MODE_tag
4128 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
4129 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
4130 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
4131 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
4132 +} AVALANCHE_SYS_POWER_MODE_T;
4134 +void avalanche_power_ctrl(unsigned int power_module, AVALANCHE_POWER_CTRL_T power_ctrl);
4135 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int power_module);
4136 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode);
4137 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void);
4139 +/*****************************************************************************
4141 + *****************************************************************************/
4143 +typedef enum AVALANCHE_WAKEUP_INTERRUPT_tag
4149 +} AVALANCHE_WAKEUP_INTERRUPT_T;
4151 +typedef enum TNETV1050_WAKEUP_CTRL_tag
4153 + WAKEUP_DISABLED = 0,
4155 +} AVALANCHE_WAKEUP_CTRL_T;
4157 +typedef enum TNETV1050_WAKEUP_POLARITY_tag
4159 + WAKEUP_ACTIVE_HIGH = 0,
4161 +} AVALANCHE_WAKEUP_POLARITY_T;
4163 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
4164 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
4165 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity);
4167 +/*****************************************************************************
4169 + *****************************************************************************/
4171 +typedef enum AVALANCHE_GPIO_PIN_MODE_tag
4173 + FUNCTIONAL_PIN = 0,
4175 +} AVALANCHE_GPIO_PIN_MODE_T;
4177 +typedef enum AVALANCHE_GPIO_PIN_DIRECTION_tag
4179 + GPIO_OUTPUT_PIN = 0,
4180 + GPIO_INPUT_PIN = 1
4181 +} AVALANCHE_GPIO_PIN_DIRECTION_T;
4183 +typedef enum { GPIO_FALSE, GPIO_TRUE } AVALANCHE_GPIO_BOOL_T;
4185 +void avalanche_gpio_init(void);
4186 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
4187 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
4188 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
4189 +int avalanche_gpio_ctrl_with_link_count(unsigned int gpio_pin,
4190 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
4191 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
4192 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value);
4193 +int avalanche_gpio_in_bit(unsigned int gpio_pin);
4194 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
4195 +int avalanche_gpio_out_value_with_link_count(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
4196 +int avalanche_gpio_in_value(unsigned int *in_val, unsigned int reg_index);
4198 +unsigned int avalanche_get_chip_version_info(void);
4200 +unsigned int avalanche_get_vbus_freq(void);
4201 +void avalanche_set_vbus_freq(unsigned int);
4204 +typedef int (*SET_MDIX_ON_CHIP_FN_T)(unsigned int base_addr, unsigned int operation);
4205 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation);
4206 +unsigned int avalanche_is_mdix_on_chip(void);
4209 diff -urN linux.old/include/asm-mips/ar7/avalanche_regs.h linux.dev/include/asm-mips/ar7/avalanche_regs.h
4210 --- linux.old/include/asm-mips/ar7/avalanche_regs.h 1970-01-01 01:00:00.000000000 +0100
4211 +++ linux.dev/include/asm-mips/ar7/avalanche_regs.h 2005-08-12 19:32:05.149223688 +0200
4215 + * Avalanche Register Descriptions
4217 + * Jeff Harrell, jharrell@ti.com
4218 + * 2000 (c) Texas Instruments Inc.
4221 +#ifndef __AVALANCHE_REGS_H
4222 +#define __AVALANCHE_REGS_H
4224 +#include <asm/addrspace.h>
4225 +#include <linux/config.h>
4227 +/*----------------------------------------*/
4228 +/* Base offsets within the Avalanche ASIC */
4229 +/*----------------------------------------*/
4231 +#define BBIF_SPACE0 (KSEG1ADDR(0x01000000))
4232 +#define BBIF_SPACE1 (KSEG1ADDR(0x01800000))
4233 +#define BBIF_CONTROL (KSEG1ADDR(0x02000000))
4234 +#define ATM_SAR_BASE (KSEG1ADDR(0x03000000))
4235 +#define USB_MCU_BASE (KSEG1ADDR(0x03400000))
4236 +#define DES_BASE (KSEG1ADDR(0x08600000))
4237 +#define ETH_MACA_BASE (KSEG1ADDR(0x08610000))
4238 +#define ETH_MACB_BASE (KSEG1ADDR(0x08612800))
4239 +#define MEM_CTRLR_BASE (KSEG1ADDR(0x08610800))
4240 +#define GPIO_BASE (KSEG1ADDR(0x08610900))
4241 +#define CLK_CTRL_BASE (KSEG1ADDR(0x08610A00))
4242 +#define WATCH_DOG_BASE (KSEG1ADDR(0x08610B00))
4243 +#define TMR1_BASE (KSEG1ADDR(0x08610C00))
4244 +#define TRM2_BASE (KSEG1ADDR(0x08610D00))
4245 +#define UARTA_BASE (KSEG1ADDR(0x08610E00))
4246 +#define UARTB_BASE (KSEG1ADDR(0x08610F00))
4247 +#define I2C_BASE (KSEG1ADDR(0x08611000))
4248 +#define DEV_ID_BASE (KSEG1ADDR(0x08611100))
4249 +#define USB_BASE (KSEG1ADDR(0x08611200))
4250 +#define PCI_CONFIG_BASE (KSEG1ADDR(0x08611300))
4251 +#define DMA_BASE (KSEG1ADDR(0x08611400))
4252 +#define RESET_CTRL_BASE (KSEG1ADDR(0x08611600))
4253 +#define DSL_IF_BASE (KSEG1ADDR(0x08611B00))
4254 +#define INT_CTL_BASE (KSEG1ADDR(0x08612400))
4255 +#define PHY_BASE (KSEG1ADDR(0x1E000000))
4257 +/*---------------------------------*/
4258 +/* Device ID, chip version number */
4259 +/*---------------------------------*/
4261 +#define AVALANCHE_CHVN (*(volatile unsigned int *)(DEV_ID_BASE+0x14))
4262 +#define AVALANCHE_DEVID1 (*(volatile unsigned int *)(DEV_ID_BASE+0x18))
4263 +#define AVALANCHE_DEVID2 (*(volatile unsigned int *)(DEV_ID_BASE+0x1C))
4265 +/*----------------------------------*/
4266 +/* Reset Control VW changed to ptrs */
4267 +/*----------------------------------*/
4269 +#define AVALANCHE_PRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x0)) /* Peripheral reset control */
4270 +#define AVALANCHE_SWRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x4)) /* Software reset control */
4271 +#define AVALANCHE_RSR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x8)) /* Reset status register */
4273 +/* reset control bits */
4275 +#define AV_RST_UART0 (1<<0) /* Brings UART0 out of reset */
4276 +#define AV_RST_UART1 (1<<1) /* Brings UART1 out of reset */
4277 +#define AV_RST_IICM (1<<2) /* Brings the I2CM out of reset */
4278 +#define AV_RST_TIMER0 (1<<3) /* Brings Timer 0 out of reset */
4279 +#define AV_RST_TIMER1 (1<<4) /* Brings Timer 1 out of reset */
4280 +#define AV_RST_DES (1<<5) /* Brings the DES module out of reset */
4281 +#define AV_RST_GPIO (1<<6) /* Brings the GPIO module out of reset (see note below) */
4283 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4284 + If you reset the GPIO interface all of the directions (i/o) of the UART B
4285 + interface pins are inputs and must be reconfigured so as not to lose the
4286 + serial console interface
4287 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4289 +#define AV_RST_BBIF (1<<7) /* Brings the Broadband interface out of reset */
4290 +#define AV_RST_USB (1<<8) /* Brings the USB module out of reset */
4291 +#define AV_RST_SAR (1<<9) /* Brings the SAR out of reset */
4292 +#define AV_RST_HDLC (1<<10) /* Brings the HDLC module out of reset */
4293 +#define AV_RST_PCI (1<<16) /* Brings the PCI module out of reset */
4294 +#define AV_RST_ETH_MAC0 (1<<17) /* Brings the Ethernet MAC0 out of reset */
4295 +#define AV_RST_PICO_DMA (1<<18) /* Brings the PICO DMA module out of reset */
4296 +#define AV_RST_BIST (1<<19) /* Brings the BIST module out of reset */
4297 +#define AV_RST_DSP (1<<20) /* Brings the DSP sub system out of reset */
4298 +#define AV_RST_ETH_MAC1 (1<<21) /* Brings the Ethernet MAC1 out of reset */
4300 +/*----------------------*/
4301 +/* Physical interfaces */
4302 +/*----------------------*/
4305 +#define PHY_LOOPBACK 1
4309 +#define PHY0BASE (PHY_BASE)
4310 +#define PHY0RST (*(volatile unsigned char *) (PHY0BASE)) /* reset */
4311 +#define PHY0CTRL (*(volatile unsigned char *) (PHY0BASE+0x5)) /* control */
4312 +#define PHY0RACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x50)) /* RACP control/status */
4313 +#define PHY0TACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x60)) /* TACP idle/unassigned cell hdr */
4314 +#define PHY0RACPINT (*(volatile unsigned char *) (PHY0BASE+0x51)) /* RACP interrupt enable/Status */
4319 +#define PHY1BASE (PHY_BASE + 0x100000)
4320 +#define PHY1RST (*(volatile unsigned char *) (PHY1BASE)) /* reset */
4321 +#define PHY1CTRL (*(volatile unsigned char *) (PHY1BASE+0x5)) /* control */
4322 +#define PHY1RACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x50))
4323 +#define PHY1TACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x60))
4324 +#define PHY1RACPINT (*(volatile unsigned char *) (PHY1BASE+0x51))
4328 +#define PHY2BASE (PHY_BASE + 0x200000)
4329 +#define PHY2RST (*(volatile unsigned char *) (PHY2BASE)) /* reset */
4330 +#define PHY2CTRL (*(volatile unsigned char *) (PHY2BASE+0x5)) /* control */
4331 +#define PHY2RACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x50))
4332 +#define PHY2TACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x60))
4333 +#define PHY2RACPINT (*(volatile unsigned char *) (PHY2BASE+0x51))
4335 +/*-------------------*/
4336 +/* Avalanche ATM SAR */
4337 +/*-------------------*/
4339 +#define AVSAR_SYSCONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000000)) /* SAR system config register */
4340 +#define AVSAR_SYSSTATUS (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000004)) /* SAR system status register */
4341 +#define AVSAR_INT_ENABLE (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000008)) /* SAR interrupt enable register */
4342 +#define AVSAR_CONN_VPI_VCI (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000000c)) /* VPI/VCI connection config */
4343 +#define AVSAR_CONN_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000010)) /* Connection config register */
4344 +#define AVSAR_OAM_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018)) /* OAM configuration register */
4346 +/* Transmit completion ring registers */
4348 +#define AVSAR_TCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000100))
4349 +#define AVSAR_TCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000104))
4350 +#define AVSAR_TCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000108))
4351 +#define AVSAR_TCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000010c))
4352 +#define AVSAR_TCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000110))
4353 +#define AVSAR_TCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000114))
4354 +#define AVSAR_TCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000118))
4355 +#define AVSAR_TCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000011c))
4356 +#define AVSAR_TCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000120))
4357 +#define AVSAR_TCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000124))
4358 +#define AVSAR_TCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000128))
4359 +#define AVSAR_TCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000012c))
4360 +#define AVSAR_TCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000130))
4361 +#define AVSAR_TCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000134))
4363 +/* Transmit Queue Packet registers */
4364 +#define AVSAR_TXQUEUE_PKT0 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000140))
4365 +#define AVSAR_TXQUEUE_PKT1 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000144))
4366 +#define AVSAR_TXQUEUE_PKT2 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000148))
4367 +#define AVSAR_TX_FLUSH (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000014C))
4368 +/* Receive completion ring registers */
4370 +#define AVSAR_RCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000200))
4371 +#define AVSAR_RCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000204))
4372 +#define AVSAR_RCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000208))
4373 +#define AVSAR_RCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000020c))
4374 +#define AVSAR_RCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000210))
4375 +#define AVSAR_RCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000214))
4376 +#define AVSAR_RCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000218))
4377 +#define AVSAR_RCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000021c))
4378 +#define AVSAR_RCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000220))
4379 +#define AVSAR_RCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000224))
4380 +#define AVSAR_RCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000228))
4381 +#define AVSAR_RCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000022c))
4382 +#define AVSAR_RCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000230))
4383 +#define AVSAR_RCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000234))
4385 +#define AVSAR_RXFBL_ADD0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000240)) /* Rx Free buffer list add 0 */
4386 +#define AVSAR_RXFBL_ADD1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000244)) /* Rx Free buffer list add 1 */
4387 +#define AVSAR_RXFBL_ADD2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000248)) /* Rx Free buffer list add 2 */
4388 +#define AVSAR_RXFBLSIZE_0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000028c)) /* Rx Free buffer list size 0 */
4389 +#define AVSAR_RXFBLSIZE_1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000029c)) /* Rx Free buffer list size 1 */
4390 +#define AVSAR_RXFBLSIZE_2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002ac)) /* Rx Free buffer list size 2 */
4391 +#define AVSAR_RXFBLSIZE_3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002bc)) /* Rx Free buffer list size 3 */
4394 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
4396 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010480))
4397 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010484))
4398 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010488))
4399 +#define AVSAR_OAM_CPID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E0))
4400 +#define AVSAR_OAM_LLID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F0))
4401 +#define AVSAR_OAM_CPID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E4))
4402 +#define AVSAR_OAM_LLID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F4))
4403 +#define AVSAR_OAM_CPID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E8))
4404 +#define AVSAR_OAM_LLID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F8))
4405 +#define AVSAR_OAM_CPID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104EC))
4406 +#define AVSAR_OAM_LLID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104FC))
4407 +#define AVSAR_OAM_CORR_TAG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010500))
4408 +#define AVSAR_OAM_FAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010520))
4409 +#define AVSAR_OAM_NEAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010540))
4410 +#define AVSAR_OAM_CONFIG_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018))
4411 +#define AVSAR_FAIRNESS_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104B8))
4412 +#define AVSAR_UBR_PCR_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010490))
4417 +#define OAM_CPID_ADD 0xa30104e0
4419 +#define OAM_LLID_ADD 0xa30104f0
4421 +#define OAM_LLID_VAL 0xffffffff
4423 +#define OAM_CORR_TAG 0xa3010500
4425 +#define OAM_FAR_COUNT_ADD 0xa3010520
4427 +#define OAM_NEAR_COUNT_ADD 0xa3010540
4429 +#define OAM_CONFIG_REG_ADD 0xa3000018
4433 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
4435 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012000))
4436 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012004))
4437 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012008))
4438 +#define AVSAR_OAM_CPID (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012300))
4440 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
4443 +#define AVSAR_STATE_RAM (ATM_SAR_BASE + 0x010000) /* SAR state RAM */
4444 +#define AVSAR_PDSP_BASE (ATM_SAR_BASE + 0x020000) /* SAR PDSP base address */
4445 +#define AVSAR_TXDMA_BASE (ATM_SAR_BASE + 0x030000) /* Transmit DMA state base */
4446 +#define AVSAR_TDMASTATE6 0x18 /* Transmit DMA state word 6 */
4447 +#define AVSAR_RXDMA_BASE (ATM_SAR_BASE + 0x040000) /* Receive DMA state base */
4448 +#define AVSAR_RDMASTATE0 0x0 /* Receive DMA state word 0 */
4450 +/*------------------------------------------*/
4451 +/* DSL Interface */
4452 +/*------------------------------------------*/
4454 +#define AVDSL_TX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000000))
4455 +#define AVDSL_RX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000004))
4456 +#define AVDSL_POLL (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000008))
4460 +#define AVDSL_TX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000000C))
4461 +#define AVDSL_TX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000010))
4462 +#define AVDSL_TX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000014))
4463 +#define AVDSL_TX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000018))
4464 +#define AVDSL_RX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000001C))
4465 +#define AVDSL_RX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000020))
4466 +#define AVDSL_RX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000024))
4467 +#define AVDSL_RX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000028))
4471 +#define AVDSL_TX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000002C))
4472 +#define AVDSL_TX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000030))
4473 +#define AVDSL_TX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000034))
4474 +#define AVDSL_TX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000038))
4475 +#define AVDSL_RX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000003C))
4476 +#define AVDSL_RX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000040))
4477 +#define AVDSL_RX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000044))
4478 +#define AVDSL_RX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000048))
4480 +/*------------------------------------------*/
4481 +/* Broadband I/F */
4482 +/*------------------------------------------*/
4484 +#define AVBBIF_BBIF_CNTRL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000000))
4485 +#define AVBBIF_ADDR_TRANS_0 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000004))
4486 +#define AVBBIF_ADDR_TRANS_1 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000008))
4487 +#define AVBBIF_ADDR_XB_MX_BL (*(volatile unsigned int *)(BBIF_CONTROL + 0x0000000C))
4488 +#define AVBBIF_INFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000010))
4489 +#define AVBBIF_OUTFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000014))
4491 +#define AVBBIF_DISABLED 0x0
4492 +#define AVBBIF_LBT4040_INT 0x1
4493 +#define AVBBIF_XBUS 0x2
4494 +#define AVBBIF_LBT4040_EXT 0x4
4496 +#define AVBBIF_ADDR_MASK0 0xff000000 /* handles upper bits of BBIF 0 address */
4497 +#define AVBBIF_ADDR_MASK1 0xff800000 /* handles upper bits of BBIF 1 address */
4498 +#define AVBBIF_TRANS_MASK 0xff000000
4499 +/*------------------------------------------*/
4501 +/*------------------------------------------*/
4503 +#define GPIO_DATA_INPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000000))
4504 +#define GPIO_DATA_OUTPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000004))
4505 +#define GPIO_DATA_DIR (*(volatile unsigned int *)(GPIO_BASE + 0x00000008)) /* 0=output 1=input */
4506 +#define GPIO_DATA_ENABLE (*(volatile unsigned int *)(GPIO_BASE + 0x0000000C)) /* 0=GPIO Mux 1=GPIO */
4508 +#define GPIO_0 (1<<21)
4509 +#define GPIO_1 (1<<22)
4510 +#define GPIO_2 (1<<23)
4511 +#define GPIO_3 (1<<24)
4512 +#define EINT_1 (1<<18)
4515 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4516 + If you reset the GPIO interface all of the directions (i/o) of the UART B
4517 + interface pins are inputs and must be reconfigured so as not to lose the
4518 + serial console interface
4519 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
4522 +/*------------------------------------------*/
4524 +/*------------------------------------------*/
4525 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
4527 +#define PCLK_0_HALF_VBUS (0<<16)
4528 +#define PCLK_EQ_INPUT (1<<16)
4529 +#define BBIF_CLK_HALF_VBUS (0<<17)
4530 +#define BBIF_CLK_EQ_VBUS (1<<17)
4531 +#define BBIF_CLK_EQ_BBCLK (3<<17)
4532 +#define DSP_MODCLK_DSPCLKI (0<<20)
4533 +#define DSP_MODCLK_REFCLKI (1<<20)
4534 +#define USB_CLK_EQ_USBCLKI (0<<21)
4535 +#define USB_CLK_EQ_REFCLKI (1<<21)
4537 +/*------------------------------------------*/
4538 +/* PCI Control Registers */
4539 +/*------------------------------------------*/
4540 +#define PCIC_CONTROL (*(volatile unsigned int *)(PCI_CONFIG_BASE))
4541 +#define PCIC_CONTROL_CFG_DONE (1<<0)
4542 +#define PCIC_CONTROL_DIS_SLAVE_TO (1<<1)
4543 +#define PCIC_CONTROL_FORCE_DELAY_READ (1<<2)
4544 +#define PCIC_CONTROL_FORCE_DELAY_READ_LINE (1<<3)
4545 +#define PCIC_CONTROL_FORCE_DELAY_READ_MULT (1<<4)
4546 +#define PCIC_CONTROL_MEM_SPACE_EN (1<<5)
4547 +#define PCIC_CONTROL_MEM_MASK (1<<6)
4548 +#define PCIC_CONTROL_IO_SPACE_EN (1<<7)
4549 +#define PCIC_CONTROL_IO_MASK (1<<8)
4550 +/* PCIC_CONTROL_RESERVED (1<<9) */
4551 +#define PCIC_CONTROL_BASE0_EN (1<<10)
4552 +#define PCIC_CONTROL_BASE1_EN (1<<11)
4553 +#define PCIC_CONTROL_BASE2_EN (1<<12)
4554 +#define PCIC_CONTROL_HOLD_MASTER_WRITE (1<<13)
4555 +#define PCIC_CONTROL_ARBITER_EN (1<<14)
4556 +#define PCIC_INT_SOURCE (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000004))
4557 +#define PCIC_INT_SOURCE_PWR_MGMT (1<<0)
4558 +#define PCIC_INT_SOURCE_PCI_TARGET (1<<1)
4559 +#define PCIC_INT_SOURCE_PCI_MASTER (1<<2)
4560 +#define PCIC_INT_SOURCE_POWER_WAKEUP (1<<3)
4561 +#define PCIC_INT_SOURCE_PMEIN (1<<4)
4562 +/* PCIC_INT_SOURCE_RESERVED (1<<5) */
4563 +/* PCIC_INT_SOURCE_RESERVED (1<<6) */
4564 +#define PCIC_INT_SOURCE_PIC_INTA (1<<7)
4565 +#define PCIC_INT_SOURCE_PIC_INTB (1<<8)
4566 +#define PCIC_INT_SOURCE_PIC_INTC (1<<9)
4567 +#define PCIC_INT_SOURCE_PIC_INTD (1<<10)
4568 +#define PCIC_INT_SOURCE_SOFT_INT0 (1<<11)
4569 +#define PCIC_INT_SOURCE_SOFT_INT1 (1<<12)
4570 +#define PCIC_INT_SOURCE_SOFT_INT2 (1<<13)
4571 +#define PCIC_INT_SOURCE_SOFT_INT3 (1<<14)
4572 +#define PCIC_INT_CLEAR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000008))
4573 +#define PCIC_INT_CLEAR_PM (1<<0)
4574 +#define PCIC_INT_CLEAR_PCI_TARGET (1<<1)
4575 +#define PCIC_INT_CLEAR_PCI_MASTER (1<<2)
4576 +/* PCIC_INT_CLEAR_RESERVED (1<<3) */
4577 +#define PCIC_INT_CLEAR_PMEIN (1<<4)
4578 +/* PCIC_INT_CLEAR_RESERVED (1<<5) */
4579 +/* PCIC_INT_CLEAR_RESERVED (1<<6) */
4580 +#define PCIC_INT_CLEAR_PCI_INTA (1<<7)
4581 +#define PCIC_INT_CLEAR_PCI_INTB (1<<8)
4582 +#define PCIC_INT_CLEAR_PCI_INTC (1<<9)
4583 +#define PCIC_INT_CLEAR_PCI_INTD (1<<10)
4584 +#define PCIC_INT_CLEAR_SOFT_INT0 (1<<11)
4585 +#define PCIC_INT_CLEAR_SOFT_INT1 (1<<12)
4586 +#define PCIC_INT_CLEAR_SOFT_INT2 (1<<13)
4587 +#define PCIC_INT_CLEAR_SOFT_INT3 (1<<14)
4588 +#define PCIC_INT_EN_AVAL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000000c))
4589 +#define PCIC_INT_EN_AVAL_PM (1<<0)
4590 +#define PCIC_INT_EN_AVAL_PCI_TARGET (1<<1)
4591 +#define PCIC_INT_EN_AVAL_PCI_MASTER (1<<2)
4592 +/* PCIC_INT_EN_AVAL_RESERVED (1<<3) */
4593 +#define PCIC_INT_EN_AVAL_PMEIN (1<<4)
4594 +/* PCIC_INT_EN_AVAL_RESERVED (1<<5) */
4595 +/* PCIC_INT_EN_AVAL_RESERVED (1<<6) */
4596 +#define PCIC_INT_EN_AVAL_PCI_INTA (1<<7)
4597 +#define PCIC_INT_EN_AVAL_PCI_INTB (1<<8)
4598 +#define PCIC_INT_EN_AVAL_PCI_INTC (1<<9)
4599 +#define PCIC_INT_EN_AVAL_PCI_INTD (1<<10)
4600 +#define PCIC_INT_EN_AVAL_SOFT_INT0 (1<<11)
4601 +#define PCIC_INT_EN_AVAL_SOFT_INT1 (1<<12)
4602 +#define PCIC_INT_EN_AVAL_SOFT_INT2 (1<<13)
4603 +#define PCIC_INT_EN_AVAL_SOFT_INT3 (1<<14)
4604 +#define PCIC_INT_EN_PCI (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000010))
4605 +#define PCIC_INT_EN_PCI_PM (1<<0)
4606 +#define PCIC_INT_EN_PCI_PCI_TARGET (1<<1)
4607 +#define PCIC_INT_EN_PCI_PCI_MASTER (1<<2)
4608 +/* PCIC_INT_EN_PCI_RESERVED (1<<3) */
4609 +#define PCIC_INT_EN_PCI_PMEIN (1<<4)
4610 +/* PCIC_INT_EN_PCI_RESERVED (1<<5) */
4611 +/* PCIC_INT_EN_PCI_RESERVED (1<<6) */
4612 +#define PCIC_INT_EN_PCI_PCI_INTA (1<<7)
4613 +#define PCIC_INT_EN_PCI_PCI_INTB (1<<8)
4614 +#define PCIC_INT_EN_PCI_PCI_INTC (1<<9)
4615 +#define PCIC_INT_EN_PCI_PCI_INTD (1<<10)
4616 +#define PCIC_INT_EN_PCI_SOFT_INT0 (1<<11)
4617 +#define PCIC_INT_EN_PCI_SOFT_INT1 (1<<12)
4618 +#define PCIC_INT_EN_PCI_SOFT_INT2 (1<<13)
4619 +#define PCIC_INT_EN_PCI_SOFT_INT3 (1<<14)
4620 +#define PCIC_INT_SWSET (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000014))
4621 +#define PCIC_INT_SWSET_SOFT_INT0 (1<<0)
4622 +#define PCIC_INT_SWSET_SOFT_INT1 (1<<1)
4623 +#define PCIC_INT_SWSET_SOFT_INT2 (1<<2)
4624 +#define PCIC_INT_SWSET_SOFT_INT3 (1<<3)
4625 +#define PCIC_PM_CTL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000018))
4626 +#define PCIC_PM_CTL_PWR_STATE_MASK (0x02)
4627 +/* PCIC_PM_CTL_RESERVED (1<<2) */
4628 +/* PCIC_PM_CTL_RESERVED (1<<3) */
4629 +/* PCIC_PM_CTL_RESERVED (1<<4) */
4630 +/* PCIC_PM_CTL_RESERVED (1<<5) */
4631 +/* PCIC_PM_CTL_RESERVED (1<<6) */
4632 +/* PCIC_PM_CTL_RESERVED (1<<7) */
4633 +/* PCIC_PM_CTL_RESERVED (1<<8) */
4634 +/* PCIC_PM_CTL_RESERVED (1<<9) */
4635 +#define PCIC_PM_CTL_PWR_SUPPORT (1<<10)
4636 +#define PCIC_PM_CTL_PMEIN (1<<11)
4637 +#define PCIC_PM_CTL_CAP_MASK (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x0000001a))
4638 +#define PCIC_PM_CONSUME (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000001c))
4639 +#define PCIC_PM_CONSUME_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001c))
4640 +#define PCIC_PM_CONSUME_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001d))
4641 +#define PCIC_PM_CONSUME_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001e))
4642 +#define PCIC_PM_CONSUME_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001f))
4643 +#define PCIC_PM_DISSAPATED (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000020))
4644 +#define PCIC_PM_DISSAPATED_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000020))
4645 +#define PCIC_PM_DISSAPATED_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000021))
4646 +#define PCIC_PM_DISSAPATED_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000022))
4647 +#define PCIC_PM_DISSAPATED_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000023))
4648 +#define PCIC_PM_DATA_SCALE (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x00000024))
4649 +#define PCIC_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000028))
4650 +#define PCIC_SUB_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000002c))
4651 +#define PCIC_CLASS_REV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000030))
4652 +#define PCIC_MAX_MIN (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000034))
4653 +#define PCIC_MAST_MEM_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000003c))
4654 +#define PCIC_MAST_MEM_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000040))
4655 +#define PCIC_MAST_MEM_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000044))
4656 +#define PCIC_SLAVE_MASK0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000004c))
4657 +#define PCIC_SLAVE_MASK1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000050))
4658 +#define PCIC_SLAVE_MASK2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000054))
4659 +#define PCIC_SLAVE_BASE_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000058))
4660 +#define PCIC_SLAVE_BASE_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000005c))
4661 +#define PCIC_SLAVE_BASE_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000060))
4662 +#define PCIC_CONF_COMMAND (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000090))
4663 +#define PCIC_CONF_ADDR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000094))
4664 +#define PCIC_CONF_DATA (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000098))
4666 +/*------------------------------------------*/
4667 +/* IIC_INTERFACE */
4668 +/*------------------------------------------*/
4669 +#define I2C_DATA_HI (*(volatile unsigned int *)(I2C_BASE + 0x0))
4670 +#define I2C_DATA_LOW (*(volatile unsigned int *)(I2C_BASE + 0x4))
4671 +#define I2C_CONFIG (*(volatile unsigned int *)(I2C_BASE + 0x8))
4672 +#define I2C_DATA_READ (*(volatile unsigned int *)(I2C_BASE + 0xC))
4673 +#define I2C_CLOCK_DIV (*(volatile unsigned int *)(I2C_BASE + 0x10))
4675 +#define I2CWRITE 0x200
4676 +#define I2CREAD 0x300
4677 +#define I2C_END_BURST 0x400
4680 +#define I2C_READ_ERROR 0x8000
4681 +#define I2C_READ_COMPLETE 0x4000
4682 +#define I2C_READ_BUSY 0x2000
4685 +#define I2C_IO_EXPANDER 0x2
4686 +#define I2C_RTC 0xd
4688 +/* device Addresses on I2C bus (EVM3) */
4689 +#define SEVEN_SEGMENT_DISP 0x23 /* Device type = 0x2, Addr = 3 */
4690 +#define EVM3_RTC 0xd0 /* Device type = 0xd, Addr = 0 */
4691 +#define EVM3_RTC_I2C_ADDR 0x0
4693 +/*------------------------------------------*/
4694 +/* Ethernet MAC register offset definitions */
4695 +/*------------------------------------------*/
4696 +#define VMAC_DMACONFIG(X) (*(volatile unsigned int *)(X + 0x00000000))
4697 +#define VMAC_INTSTS(X) (*(volatile unsigned int *)(X + 0x00000004))
4698 +#define VMAC_INTMASK(X) (*(volatile unsigned int *)(X + 0x00000008))
4700 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4701 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
4703 +#define VMAC_TCRPTR(X) (*(volatile unsigned int *)(X + 0x00000100))
4704 +#define VMAC_TCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000104))
4705 +#define VMAC_TCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000108))
4706 +#define VMAC_TCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000010C))
4707 +#define VMAC_TCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000110))
4708 +#define VMAC_TCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000114))
4709 +#define VMAC_TCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000118))
4710 +#define VMAC_TXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000011c))
4713 +#define VMAC_TDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000120))
4714 +#define VMAC_TDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000124))
4715 +#define VMAC_TDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000128))
4716 +#define VMAC_TDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000012C))
4717 +#define VMAC_TDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000130))
4718 +#define VMAC_TDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000134))
4719 +#define VMAC_TDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000138))
4720 +#define VMAC_TDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000013C))
4721 +#define VMAC_TXPADDCNT(X) (*(volatile unsigned int *)(X + 0x00000140))
4722 +#define VMAC_TXPADDSTART(X) (*(volatile unsigned int *)(X + 0x00000144))
4723 +#define VMAC_TXPADDEND(X) (*(volatile unsigned int *)(X + 0x00000148))
4724 +#define VMAC_TXQFLUSH(X) (*(volatile unsigned int *)(X + 0x0000014C))
4726 +#define VMAC_RCRPTR(X) (*(volatile unsigned int *)(X + 0x00000200))
4727 +#define VMAC_RCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000204))
4728 +#define VMAC_RCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000208))
4729 +#define VMAC_RCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000020C))
4730 +#define VMAC_RCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000210))
4731 +#define VMAC_RCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000214))
4732 +#define VMAC_RCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000218))
4733 +#define VMAC_RXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000021c))
4735 +#define VMAC_RDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000220))
4736 +#define VMAC_RDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000224))
4737 +#define VMAC_RDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000228))
4738 +#define VMAC_RDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000022C))
4739 +#define VMAC_RDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000230))
4740 +#define VMAC_RDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000234))
4741 +#define VMAC_RDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000238))
4742 +#define VMAC_RDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000023C))
4743 +#define VMAC_FBLADDCNT(X) (*(volatile unsigned int *)(X + 0x00000240))
4744 +#define VMAC_FBLADDSTART(X) (*(volatile unsigned int *)(X + 0x00000244))
4745 +#define VMAC_FBLADDEND(X) (*(volatile unsigned int *)(X + 0x00000248))
4746 +#define VMAC_RXONOFF(X) (*(volatile unsigned int *)(X + 0x0000024C))
4748 +#define VMAC_FBL0NEXTD(X) (*(volatile unsigned int *)(X + 0x00000280))
4749 +#define VMAC_FBL0LASTD(X) (*(volatile unsigned int *)(X + 0x00000284))
4750 +#define VMAC_FBL0COUNTD(X) (*(volatile unsigned int *)(X + 0x00000288))
4751 +#define VMAC_FBL0BUFSIZE(X) (*(volatile unsigned int *)(X + 0x0000028C))
4753 +#define VMAC_MACCONTROL(X) (*(volatile unsigned int *)(X + 0x00000300))
4754 +#define VMAC_MACSTATUS(X) (*(volatile unsigned int *)(X + 0x00000304))
4755 +#define VMAC_MACADDRHI(X) (*(volatile unsigned int *)(X + 0x00000308))
4756 +#define VMAC_MACADDRLO(X) (*(volatile unsigned int *)(X + 0x0000030C))
4757 +#define VMAC_MACHASH1(X) (*(volatile unsigned int *)(X + 0x00000310))
4758 +#define VMAC_MACHASH2(X) (*(volatile unsigned int *)(X + 0x00000314))
4760 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
4761 +#define VMAC_BOFTEST(X) (*(volatile unsigned int *)(X + 0x00000344))
4762 +#define VMAC_PACTEST(X) (*(volatile unsigned int *)(X + 0x00000348))
4763 +#define VMAC_PAUSEOP(X) (*(volatile unsigned int *)(X + 0x0000034C))
4765 +#define VMAC_MDIOCONTROL(X) (*(volatile unsigned int *)(X + 0x00000380))
4766 +#define VMAC_MDIOUSERACCESS(X) (*(volatile unsigned int *)(X +0x00000384))
4767 +#define VMAC_MDIOACK(X) (*(volatile unsigned int *)(X + 0x00000388))
4768 +#define VMAC_MDIOLINK(X) (*(volatile unsigned int *)(X + 0x0000038C))
4769 +#define VMAC_MDIOMACPHY(X) (*(volatile unsigned int *)(X + 0x00000390))
4771 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
4773 +#endif __AVALANCHE_REGS_H
4780 diff -urN linux.old/include/asm-mips/ar7/if_port.h linux.dev/include/asm-mips/ar7/if_port.h
4781 --- linux.old/include/asm-mips/ar7/if_port.h 1970-01-01 01:00:00.000000000 +0100
4782 +++ linux.dev/include/asm-mips/ar7/if_port.h 2005-08-12 19:32:05.149223688 +0200
4784 +/*******************************************************************************
4785 + * FILE PURPOSE: Interface port id Header file
4786 + *******************************************************************************
4787 + * FILE NAME: if_port.h
4789 + * DESCRIPTION: Header file carrying information about port ids of interfaces
4792 + * (C) Copyright 2003, Texas Instruments, Inc
4793 + ******************************************************************************/
4794 +#ifndef _IF_PORT_H_
4795 +#define _IF_PORT_H_
4797 +#define AVALANCHE_CPMAC_LOW_PORT_ID 0
4798 +#define AVALANCHE_CPMAC_HIGH_PORT_ID 1
4799 +#define AVALANCHE_USB_PORT_ID 2
4800 +#define AVALANCHE_WLAN_PORT_ID 3
4803 +#define AVALANCHE_MARVELL_BASE_PORT_ID 4
4805 +/* The marvell ports occupy port ids from 4 to 8 */
4806 +/* so the next port id number should start at 9 */
4809 +#endif /* _IF_PORT_H_ */
4810 diff -urN linux.old/include/asm-mips/ar7/sangam_boards.h linux.dev/include/asm-mips/ar7/sangam_boards.h
4811 --- linux.old/include/asm-mips/ar7/sangam_boards.h 1970-01-01 01:00:00.000000000 +0100
4812 +++ linux.dev/include/asm-mips/ar7/sangam_boards.h 2005-08-12 19:32:05.150223536 +0200
4814 +#ifndef _SANGAM_BOARDS_H
4815 +#define _SANGAM_BOARDS_H
4817 +// Let us define board specific information here.
4820 +#if defined(CONFIG_AR7DB)
4822 +#define AFECLK_FREQ 35328000
4823 +#define REFCLK_FREQ 25000000
4824 +#define OSC3_FREQ 24000000
4825 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4826 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
4827 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4832 +#if defined(CONFIG_AR7RD)
4833 +#define AFECLK_FREQ 35328000
4834 +#define REFCLK_FREQ 25000000
4835 +#define OSC3_FREQ 24000000
4836 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4837 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
4838 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4842 +#if defined(CONFIG_AR7WI)
4843 +#define AFECLK_FREQ 35328000
4844 +#define REFCLK_FREQ 25000000
4845 +#define OSC3_FREQ 24000000
4846 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4847 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
4848 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4852 +#if defined(CONFIG_AR7V)
4853 +#define AFECLK_FREQ 35328000
4854 +#define REFCLK_FREQ 25000000
4855 +#define OSC3_FREQ 24000000
4856 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4857 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
4858 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4862 +#if defined(CONFIG_AR7WRD)
4863 +#define AFECLK_FREQ 35328000
4864 +#define REFCLK_FREQ 25000000
4865 +#define OSC3_FREQ 24000000
4866 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4867 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
4868 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4872 +#if defined(CONFIG_AR7VWI)
4873 +#define AFECLK_FREQ 35328000
4874 +#define REFCLK_FREQ 25000000
4875 +#define OSC3_FREQ 24000000
4876 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
4877 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
4878 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
4882 +#if defined CONFIG_SEAD2
4883 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0xAAAAAAAA
4884 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
4885 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0
4886 +#include <asm/mips-boards/sead.h>
4891 diff -urN linux.old/include/asm-mips/ar7/sangam.h linux.dev/include/asm-mips/ar7/sangam.h
4892 --- linux.old/include/asm-mips/ar7/sangam.h 1970-01-01 01:00:00.000000000 +0100
4893 +++ linux.dev/include/asm-mips/ar7/sangam.h 2005-08-12 19:32:05.150223536 +0200
4898 +#include <linux/config.h>
4899 +#include <asm/addrspace.h>
4901 +/*----------------------------------------------------
4902 + * Sangam's Module Base Addresses
4903 + *--------------------------------------------------*/
4904 +#define AVALANCHE_ADSL_SUB_SYS_MEM_BASE (KSEG1ADDR(0x01000000)) /* AVALANCHE ADSL Mem Base */
4905 +#define AVALANCHE_BROADBAND_INTERFACE__BASE (KSEG1ADDR(0x02000000)) /* AVALANCHE BBIF */
4906 +#define AVALANCHE_ATM_SAR_BASE (KSEG1ADDR(0x03000000)) /* AVALANCHE ATM SAR */
4907 +#define AVALANCHE_USB_SLAVE_BASE (KSEG1ADDR(0x03400000)) /* AVALANCHE USB SLAVE */
4908 +#define AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x04000000)) /* AVALANCHE VLYNQ 0 Mem map */
4909 +#define AVALANCHE_LOW_CPMAC_BASE (KSEG1ADDR(0x08610000)) /* AVALANCHE CPMAC 0 */
4910 +#define AVALANCHE_EMIF_CONTROL_BASE (KSEG1ADDR(0x08610800)) /* AVALANCHE EMIF */
4911 +#define AVALANCHE_GPIO_BASE (KSEG1ADDR(0x08610900)) /* AVALANCHE GPIO */
4912 +#define AVALANCHE_CLOCK_CONTROL_BASE (KSEG1ADDR(0x08610A00)) /* AVALANCHE Clock Control */
4913 +#define AVALANCHE_WATCHDOG_TIMER_BASE (KSEG1ADDR(0x08610B00)) /* AVALANCHE Watch Dog Timer */
4914 +#define AVALANCHE_TIMER0_BASE (KSEG1ADDR(0x08610C00)) /* AVALANCHE Timer 1 */
4915 +#define AVALANCHE_TIMER1_BASE (KSEG1ADDR(0x08610D00)) /* AVALANCHE Timer 2 */
4916 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
4917 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 0 */
4918 +#define AVALANCHE_I2C_BASE (KSEG1ADDR(0x08611000)) /* AVALANCHE I2C */
4919 +#define AVALANCHE_USB_SLAVE_CONTROL_BASE (KSEG1ADDR(0x08611200)) /* AVALANCHE USB DMA */
4920 +#define AVALANCHE_MCDMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* AVALANCHE MC DMA 0 (channels 0-3) */
4921 +#define AVALANCHE_RESET_CONTROL_BASE (KSEG1ADDR(0x08611600)) /* AVALANCHE Reset Control */
4922 +#define AVALANCHE_BIST_CONTROL_BASE (KSEG1ADDR(0x08611700)) /* AVALANCHE BIST Control */
4923 +#define AVALANCHE_LOW_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611800)) /* AVALANCHE VLYNQ0 Control */
4924 +#define AVALANCHE_DEVICE_CONFIG_LATCH_BASE (KSEG1ADDR(0x08611A00)) /* AVALANCHE Device Config Latch */
4925 +#define AVALANCHE_HIGH_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611C00)) /* AVALANCHE VLYNQ1 Control */
4926 +#define AVALANCHE_MDIO_BASE (KSEG1ADDR(0x08611E00)) /* AVALANCHE MDIO */
4927 +#define AVALANCHE_FSER_BASE (KSEG1ADDR(0x08612000)) /* AVALANCHE FSER base */
4928 +#define AVALANCHE_INTC_BASE (KSEG1ADDR(0x08612400)) /* AVALANCHE INTC */
4929 +#define AVALANCHE_HIGH_CPMAC_BASE (KSEG1ADDR(0x08612800)) /* AVALANCHE CPMAC 1 */
4930 +#define AVALANCHE_HIGH_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x0C000000)) /* AVALANCHE VLYNQ 1 Mem map */
4932 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
4935 +/*----------------------------------------------------
4936 + * Sangam Interrupt Map (Primary Interrupts)
4937 + *--------------------------------------------------*/
4939 +#define AVALANCHE_UNIFIED_SECONDARY_INT 0
4940 +#define AVALANCHE_EXT_INT_0 1
4941 +#define AVALANCHE_EXT_INT_1 2
4942 +/* Line# 3 to 4 are reserved */
4943 +#define AVALANCHE_TIMER_0_INT 5
4944 +#define AVALANCHE_TIMER_1_INT 6
4945 +#define AVALANCHE_UART0_INT 7
4946 +#define AVALANCHE_UART1_INT 8
4947 +#define AVALANCHE_DMA_INT0 9
4948 +#define AVALANCHE_DMA_INT1 10
4949 +/* Line# 11 to 14 are reserved */
4950 +#define AVALANCHE_ATM_SAR_INT 15
4951 +/* Line# 16 to 18 are reserved */
4952 +#define AVALANCHE_LOW_CPMAC_INT 19
4953 +/* Line# 20 is reserved */
4954 +#define AVALANCHE_LOW_VLYNQ_INT 21
4955 +#define AVALANCHE_CODEC_WAKEUP_INT 22
4956 +/* Line# 23 is reserved */
4957 +#define AVALANCHE_USB_SLAVE_INT 24
4958 +#define AVALANCHE_HIGH_VLYNQ_INT 25
4959 +/* Line# 26 to 27 are reserved */
4960 +#define AVALANCHE_UNIFIED_PHY_INT 28
4961 +#define AVALANCHE_I2C_INT 29
4962 +#define AVALANCHE_DMA_INT2 30
4963 +#define AVALANCHE_DMA_INT3 31
4964 +/* Line# 32 is reserved */
4965 +#define AVALANCHE_HIGH_CPMAC_INT 33
4966 +/* Line# 34 to 36 is reserved */
4967 +#define AVALANCHE_VDMA_VT_RX_INT 37
4968 +#define AVALANCHE_VDMA_VT_TX_INT 38
4969 +#define AVALANCHE_ADSL_SUB_SYSTEM_INT 39
4972 +#define AVALANCHE_EMIF_INT 47
4976 +/*-----------------------------------------------------------
4977 + * Sangam's Reset Bits
4978 + *---------------------------------------------------------*/
4980 +#define AVALANCHE_UART0_RESET_BIT 0
4981 +#define AVALANCHE_UART1_RESET_BIT 1
4982 +#define AVALANCHE_I2C_RESET_BIT 2
4983 +#define AVALANCHE_TIMER0_RESET_BIT 3
4984 +#define AVALANCHE_TIMER1_RESET_BIT 4
4985 +/* Reset bit 5 is reserved. */
4986 +#define AVALANCHE_GPIO_RESET_BIT 6
4987 +#define AVALANCHE_ADSL_SUB_SYS_RESET_BIT 7
4988 +#define AVALANCHE_USB_SLAVE_RESET_BIT 8
4989 +#define AVALANCHE_ATM_SAR_RESET_BIT 9
4990 +/* Reset bit 10 is reserved. */
4991 +#define AVALANCHE_VDMA_VT_RESET_BIT 11
4992 +#define AVALANCHE_FSER_RESET_BIT 12
4993 +/* Reset bit 13 to 15 are reserved */
4994 +#define AVALANCHE_HIGH_VLYNQ_RESET_BIT 16
4995 +#define AVALANCHE_LOW_CPMAC_RESET_BIT 17
4996 +#define AVALANCHE_MCDMA_RESET_BIT 18
4997 +#define AVALANCHE_BIST_RESET_BIT 19
4998 +#define AVALANCHE_LOW_VLYNQ_RESET_BIT 20
4999 +#define AVALANCHE_HIGH_CPMAC_RESET_BIT 21
5000 +#define AVALANCHE_MDIO_RESET_BIT 22
5001 +#define AVALANCHE_ADSL_SUB_SYS_DSP_RESET_BIT 23
5002 +/* Reset bit 24 to 25 are reserved */
5003 +#define AVALANCHE_LOW_EPHY_RESET_BIT 26
5004 +/* Reset bit 27 to 31 are reserved */
5007 +#define AVALANCHE_POWER_MODULE_USBSP 0
5008 +#define AVALANCHE_POWER_MODULE_WDTP 1
5009 +#define AVALANCHE_POWER_MODULE_UT0P 2
5010 +#define AVALANCHE_POWER_MODULE_UT1P 3
5011 +#define AVALANCHE_POWER_MODULE_IICP 4
5012 +#define AVALANCHE_POWER_MODULE_VDMAP 5
5013 +#define AVALANCHE_POWER_MODULE_GPIOP 6
5014 +#define AVALANCHE_POWER_MODULE_VLYNQ1P 7
5015 +#define AVALANCHE_POWER_MODULE_SARP 8
5016 +#define AVALANCHE_POWER_MODULE_ADSLP 9
5017 +#define AVALANCHE_POWER_MODULE_EMIFP 10
5018 +#define AVALANCHE_POWER_MODULE_ADSPP 12
5019 +#define AVALANCHE_POWER_MODULE_RAMP 13
5020 +#define AVALANCHE_POWER_MODULE_ROMP 14
5021 +#define AVALANCHE_POWER_MODULE_DMAP 15
5022 +#define AVALANCHE_POWER_MODULE_BISTP 16
5023 +#define AVALANCHE_POWER_MODULE_TIMER0P 18
5024 +#define AVALANCHE_POWER_MODULE_TIMER1P 19
5025 +#define AVALANCHE_POWER_MODULE_EMAC0P 20
5026 +#define AVALANCHE_POWER_MODULE_EMAC1P 22
5027 +#define AVALANCHE_POWER_MODULE_EPHYP 24
5028 +#define AVALANCHE_POWER_MODULE_VLYNQ0P 27
5035 + * Sangam board vectors
5038 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
5039 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
5041 +/*-----------------------------------------------------------------------------
5042 + * Sangam's system register.
5044 + *---------------------------------------------------------------------------*/
5045 +#define AVALANCHE_DCL_BOOTCR (KSEG1ADDR(0x08611A00))
5046 +#define AVALANCHE_EMIF_SDRAM_CFG (AVALANCHE_EMIF_CONTROL_BASE + 0x8)
5047 +#define AVALANCHE_RST_CTRL_PRCR (KSEG1ADDR(0x08611600))
5048 +#define AVALANCHE_RST_CTRL_SWRCR (KSEG1ADDR(0x08611604))
5049 +#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611600))
5051 +#define AVALANCHE_POWER_CTRL_PDCR (KSEG1ADDR(0x08610A00))
5052 +#define AVALANCHE_WAKEUP_CTRL_WKCR (KSEG1ADDR(0x08610A0C))
5054 +#define AVALANCHE_GPIO_DATA_IN (AVALANCHE_GPIO_BASE + 0x0)
5055 +#define AVALANCHE_GPIO_DATA_OUT (AVALANCHE_GPIO_BASE + 0x4)
5056 +#define AVALANCHE_GPIO_DIR (AVALANCHE_GPIO_BASE + 0x8)
5057 +#define AVALANCHE_GPIO_ENBL (AVALANCHE_GPIO_BASE + 0xC)
5058 +#define AVALANCHE_CVR (AVALANCHE_GPIO_BASE + 0x14)
5061 + * Yamon Prom print address.
5063 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
5064 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
5065 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
5067 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
5069 +#define AVALANCHE_GPIO_PIN_COUNT 32
5070 +#define AVALANCHE_GPIO_OFF_MAP {0xF34FFFC0}
5072 +#include "sangam_boards.h"
5074 +#endif /*_SANGAM_H_ */
5075 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_err.h linux.dev/include/asm-mips/ar7/tnetd73xx_err.h
5076 --- linux.old/include/asm-mips/ar7/tnetd73xx_err.h 1970-01-01 01:00:00.000000000 +0100
5077 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_err.h 2005-08-12 19:32:05.171220344 +0200
5079 +/******************************************************************************
5080 + * FILE PURPOSE: TNETD73xx Error Definations Header File
5081 + ******************************************************************************
5082 + * FILE NAME: tnetd73xx_err.h
5084 + * DESCRIPTION: Error definations for TNETD73XX
5086 + * REVISION HISTORY:
5087 + * 27 Nov 02 - PSP TII
5089 + * (C) Copyright 2002, Texas Instruments, Inc
5090 + *******************************************************************************/
5093 +#ifndef __TNETD73XX_ERR_H__
5094 +#define __TNETD73XX_ERR_H__
5096 +typedef enum TNETD73XX_ERR_t
5098 + TNETD73XX_ERR_OK = 0, /* OK or SUCCESS */
5099 + TNETD73XX_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
5101 + /* Pointers and args */
5102 + TNETD73XX_ERR_INVARG = -2, /* Invaild argument to the call */
5103 + TNETD73XX_ERR_NULLPTR = -3, /* NULL pointer */
5104 + TNETD73XX_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
5106 + /* Memory issues */
5107 + TNETD73XX_ERR_ALLOC_FAIL = -10, /* allocation failed */
5108 + TNETD73XX_ERR_FREE_FAIL = -11, /* free failed */
5109 + TNETD73XX_ERR_MEM_CORRUPT = -12, /* corrupted memory */
5110 + TNETD73XX_ERR_BUF_LINK = -13, /* buffer linking failed */
5112 + /* Device issues */
5113 + TNETD73XX_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
5114 + TNETD73XX_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
5116 + TNETD73XX_ERR_INVID = -30 /* Invalid ID */
5120 +#endif /* __TNETD73XX_ERR_H__ */
5121 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx.h linux.dev/include/asm-mips/ar7/tnetd73xx.h
5122 --- linux.old/include/asm-mips/ar7/tnetd73xx.h 1970-01-01 01:00:00.000000000 +0100
5123 +++ linux.dev/include/asm-mips/ar7/tnetd73xx.h 2005-08-12 19:32:05.151223384 +0200
5125 +/******************************************************************************
5126 + * FILE PURPOSE: TNETD73xx Common Header File
5127 + ******************************************************************************
5128 + * FILE NAME: tnetd73xx.h
5130 + * DESCRIPTION: shared typedef's, constants and API for TNETD73xx
5132 + * REVISION HISTORY:
5133 + * 27 Nov 02 - PSP TII
5135 + * (C) Copyright 2002, Texas Instruments, Inc
5136 + *******************************************************************************/
5141 + * These are const, typedef, and api definitions for tnetd73xx.
5144 + * 1. This file may be included into both C and Assembly files.
5145 + * - for .s files, please do #define _ASMLANGUAGE in your ASM file to
5146 + * avoid C data types (typedefs) below;
5147 + * - for .c files, you don't have to do anything special.
5149 + * 2. This file has a number of sections for each SOC subsystem. When adding
5150 + * a new constant, find the subsystem you are working on and follow the
5151 + * name pattern. If you are adding another typedef for your interface, please,
5152 + * place it with other typedefs and function prototypes.
5154 + * 3. Please, DO NOT add any macros or types that are local to a subsystem to avoid
5155 + * cluttering. Include such items directly into the module's .c file or have a
5156 + * local .h file to pass data between smaller modules. This file defines only
5160 +#ifndef __TNETD73XX_H__
5161 +#define __TNETD73XX_H__
5163 +#ifndef _ASMLANGUAGE /* This part not for assembly language */
5165 +extern unsigned int tnetd73xx_mips_freq;
5166 +extern unsigned int tnetd73xx_vbus_freq;
5168 +#include "tnetd73xx_err.h"
5170 +#endif /* _ASMLANGUAGE */
5173 +/*******************************************************************************************
5174 +* Emerald core specific
5175 +******************************************************************************************** */
5178 +#elif defined(LITTLE_ENDIAN)
5180 +#error Need to define endianism
5184 +#define KSEG_MSK 0xE0000000 /* Most significant 3 bits denote kseg choice */
5187 +#ifndef KSEG_INV_MASK
5188 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
5192 +#define KSEG0_BASE 0x80000000
5196 +#define KSEG1_BASE 0xA0000000
5200 +#define KSEG0(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG0_BASE)
5204 +#define KSEG1(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG1_BASE)
5208 +#define KUSEG(addr) ((__u32)(addr) & ~KSEG_MSK)
5212 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
5216 +#define PHYS_TO_K0(addr) (PHYS_ADDR(addr)|KSEG0_BASE)
5220 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
5224 +#define REG8_ADDR(addr) (volatile __u8 *)(PHYS_TO_K1(addr))
5225 +#define REG8_DATA(addr) (*(volatile __u8 *)(PHYS_TO_K1(addr)))
5226 +#define REG8_WRITE(addr, data) REG8_DATA(addr) = data;
5227 +#define REG8_READ(addr, data) data = (__u8) REG8_DATA(addr);
5231 +#define REG16_ADDR(addr) (volatile __u16 *)(PHYS_TO_K1(addr))
5232 +#define REG16_DATA(addr) (*(volatile __u16 *)(PHYS_TO_K1(addr)))
5233 +#define REG16_WRITE(addr, data) REG16_DATA(addr) = data;
5234 +#define REG16_READ(addr, data) data = (__u16) REG16_DATA(addr);
5238 +#define REG32_ADDR(addr) (volatile __u32 *)(PHYS_TO_K1(addr))
5239 +#define REG32_DATA(addr) (*(volatile __u32 *)(PHYS_TO_K1(addr)))
5240 +#define REG32_WRITE(addr, data) REG32_DATA(addr) = data;
5241 +#define REG32_READ(addr, data) data = (__u32) REG32_DATA(addr);
5244 +#ifdef _LINK_KSEG0_ /* Application is linked into KSEG0 space */
5245 +#define VIRT_ADDR(addr) PHYS_TO_K0(PHYS_ADDR(addr))
5248 +#ifdef _LINK_KSEG1_ /* Application is linked into KSEG1 space */
5249 +#define VIRT_ADDR(addr) PHYS_TO_K1(PHYS_ADDR(addr))
5252 +#if !defined(_LINK_KSEG0_) && !defined(_LINK_KSEG1_)
5253 +#error You must define _LINK_KSEG0_ or _LINK_KSEG1_ to compile the code.
5256 +/* TNETD73XX chip definations */
5258 +#define FREQ_1MHZ 1000000
5259 +#define TNETD73XX_MIPS_FREQ tnetd73xx_mips_freq /* CPU clock frequency */
5260 +#define TNETD73XX_VBUS_FREQ tnetd73xx_vbus_freq /* originally (TNETD73XX_MIPS_FREQ/2) */
5263 +#define TNETD73XX_MIPS_FREQ_DEFAULT 25000000 /* 25 Mhz for sead2 board crystal */
5265 +#define TNETD73XX_MIPS_FREQ_DEFAULT 125000000 /* 125 Mhz */
5267 +#define TNETD73XX_VBUS_FREQ_DEFAULT (TNETD73XX_MIPS_FREQ_DEFAULT / 2) /* Sync mode */
5271 +/* Module base addresses */
5272 +#define TNETD73XX_ADSLSS_BASE PHYS_TO_K1(0x01000000) /* ADSLSS Module */
5273 +#define TNETD73XX_BBIF_CTRL_BASE PHYS_TO_K1(0x02000000) /* BBIF Control */
5274 +#define TNETD73XX_ATMSAR_BASE PHYS_TO_K1(0x03000000) /* ATM SAR */
5275 +#define TNETD73XX_USB_BASE PHYS_TO_K1(0x03400000) /* USB Module */
5276 +#define TNETD73XX_VLYNQ0_BASE PHYS_TO_K1(0x04000000) /* VLYNQ0 Module */
5277 +#define TNETD73xx_EMAC0_BASE PHYS_TO_K1(0x08610000) /* EMAC0 Module*/
5278 +#define TNETD73XX_EMIF_BASE PHYS_TO_K1(0x08610800) /* EMIF Module */
5279 +#define TNETD73XX_GPIO_BASE PHYS_TO_K1(0x08610900) /* GPIO control */
5280 +#define TNETD73XX_CLOCK_CTRL_BASE PHYS_TO_K1(0x08610A00) /* Clock Control */
5281 +#define TNETD73XX_WDTIMER_BASE PHYS_TO_K1(0x08610B00) /* WDTIMER Module */
5282 +#define TNETD73XX_TIMER0_BASE PHYS_TO_K1(0x08610C00) /* TIMER0 Module */
5283 +#define TNETD73XX_TIMER1_BASE PHYS_TO_K1(0x08610D00) /* TIMER1 Module */
5284 +#define TNETD73XX_UARTA_BASE PHYS_TO_K1(0x08610E00) /* UART A */
5285 +#define TNETD73XX_UARTB_BASE PHYS_TO_K1(0x08610F00) /* UART B */
5286 +#define TNETD73XX_I2C_BASE PHYS_TO_K1(0x08611000) /* I2C Module */
5287 +#define TNETD73XX_USB_DMA_BASE PHYS_TO_K1(0x08611200) /* USB Module */
5288 +#define TNETD73XX_MCDMA_BASE PHYS_TO_K1(0x08611400) /* MC-DMA */
5289 +#define TNETD73xx_VDMAVT_BASE PHYS_TO_K1(0x08611500) /* VDMAVT Control */
5290 +#define TNETD73XX_RST_CTRL_BASE PHYS_TO_K1(0x08611600) /* Reset Control */
5291 +#define TNETD73xx_BIST_CTRL_BASE PHYS_TO_K1(0x08611700) /* BIST Control */
5292 +#define TNETD73xx_VLYNQ0_CTRL_BASE PHYS_TO_K1(0x08611800) /* VLYNQ0 Control */
5293 +#define TNETD73XX_DCL_BASE PHYS_TO_K1(0x08611A00) /* Device Configuration Latch */
5294 +#define TNETD73xx_VLYNQ1_CTRL_BASE PHYS_TO_K1(0x08611C00) /* VLYNQ1 Control */
5295 +#define TNETD73xx_MDIO_BASE PHYS_TO_K1(0x08611E00) /* MDIO Control */
5296 +#define TNETD73XX_FSER_BASE PHYS_TO_K1(0x08612000) /* FSER Control */
5297 +#define TNETD73XX_INTC_BASE PHYS_TO_K1(0x08612400) /* Interrupt Controller */
5298 +#define TNETD73xx_EMAC1_BASE PHYS_TO_K1(0x08612800) /* EMAC1 Module*/
5299 +#define TNETD73XX_VLYNQ1_BASE PHYS_TO_K1(0x0C000000) /* VLYNQ1 Module */
5301 +/* BBIF Registers */
5302 +#define TNETD73XX_BBIF_ADSLADR (TNETD73XX_BBIF_CTRL_BASE + 0x0)
5304 +/* Device Configuration Latch Registers */
5305 +#define TNETD73XX_DCL_BOOTCR (TNETD73XX_DCL_BASE + 0x0)
5306 +#define TNETD73XX_DCL_DPLLSELR (TNETD73XX_DCL_BASE + 0x10)
5307 +#define TNETD73XX_DCL_SPEEDCTLR (TNETD73XX_DCL_BASE + 0x14)
5308 +#define TNETD73XX_DCL_SPEEDPWDR (TNETD73XX_DCL_BASE + 0x18)
5309 +#define TNETD73XX_DCL_SPEEDCAPR (TNETD73XX_DCL_BASE + 0x1C)
5312 +#define TNETD73XX_GPIODINR (TNETD73XX_GPIO_BASE + 0x0)
5313 +#define TNETD73XX_GPIODOUTR (TNETD73XX_GPIO_BASE + 0x4)
5314 +#define TNETD73XX_GPIOPDIRR (TNETD73XX_GPIO_BASE + 0x8)
5315 +#define TNETD73XX_GPIOENR (TNETD73XX_GPIO_BASE + 0xC)
5316 +#define TNETD73XX_CVR (TNETD73XX_GPIO_BASE + 0x14)
5317 +#define TNETD73XX_DIDR1 (TNETD73XX_GPIO_BASE + 0x18)
5318 +#define TNETD73XX_DIDR2 (TNETD73XX_GPIO_BASE + 0x1C)
5320 +/* Reset Control */
5321 +#define TNETD73XX_RST_CTRL_PRCR (TNETD73XX_RST_CTRL_BASE + 0x0)
5322 +#define TNETD73XX_RST_CTRL_SWRCR (TNETD73XX_RST_CTRL_BASE + 0x4)
5323 +#define TNETD73XX_RST_CTRL_RSR (TNETD73XX_RST_CTRL_BASE + 0x8)
5325 +/* Power Control */
5326 +#define TNETD73XX_POWER_CTRL_PDCR (TNETD73XX_CLOCK_CTRL_BASE + 0x0)
5327 +#define TNETD73XX_POWER_CTRL_PCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x4)
5328 +#define TNETD73XX_POWER_CTRL_PDUCR (TNETD73XX_CLOCK_CTRL_BASE + 0x8)
5329 +#define TNETD73XX_POWER_CTRL_WKCR (TNETD73XX_CLOCK_CTRL_BASE + 0xC)
5331 +/* Clock Control */
5332 +#define TNETD73XX_CLK_CTRL_SCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x20)
5333 +#define TNETD73XX_CLK_CTRL_SCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x30)
5334 +#define TNETD73XX_CLK_CTRL_MCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x40)
5335 +#define TNETD73XX_CLK_CTRL_MCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x50)
5336 +#define TNETD73XX_CLK_CTRL_UCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x60)
5337 +#define TNETD73XX_CLK_CTRL_UCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x70)
5338 +#define TNETD73XX_CLK_CTRL_ACLKCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x80)
5339 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x90)
5340 +#define TNETD73XX_CLK_CTRL_ACLKCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xA0)
5341 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xB0)
5344 +#define TNETD73XX_EMIF_SDRAM_CFG ( TNETD73XX_EMIF_BASE + 0x08 )
5348 +#define TNETD73XX_UART_FREQ 3686400
5350 +#define TNETD73XX_UART_FREQ TNETD73XX_VBUS_FREQ
5353 +/* Interrupt Controller */
5355 +/* Primary interrupts */
5356 +#define TNETD73XX_INTC_UNIFIED_SECONDARY 0 /* Unified secondary interrupt */
5357 +#define TNETD73XX_INTC_EXTERNAL0 1 /* External Interrupt Line 0 */
5358 +#define TNETD73XX_INTC_EXTERNAL1 2 /* External Interrupt Line 1 */
5359 +#define TNETD73XX_INTC_RESERVED3 3 /* Reserved */
5360 +#define TNETD73XX_INTC_RESERVED4 4 /* Reserved */
5361 +#define TNETD73XX_INTC_TIMER0 5 /* TIMER 0 int */
5362 +#define TNETD73XX_INTC_TIMER1 6 /* TIMER 1 int */
5363 +#define TNETD73XX_INTC_UART0 7 /* UART 0 int */
5364 +#define TNETD73XX_INTC_UART1 8 /* UART 1 int */
5365 +#define TNETD73XX_INTC_MCDMA0 9 /* MCDMA 0 int */
5366 +#define TNETD73XX_INTC_MCDMA1 10 /* MCDMA 1 int */
5367 +#define TNETD73XX_INTC_RESERVED11 11 /* Reserved */
5368 +#define TNETD73XX_INTC_RESERVED12 12 /* Reserved */
5369 +#define TNETD73XX_INTC_RESERVED13 13 /* Reserved */
5370 +#define TNETD73XX_INTC_RESERVED14 14 /* Reserved */
5371 +#define TNETD73XX_INTC_ATMSAR 15 /* ATM SAR int */
5372 +#define TNETD73XX_INTC_RESERVED16 16 /* Reserved */
5373 +#define TNETD73XX_INTC_RESERVED17 17 /* Reserved */
5374 +#define TNETD73XX_INTC_RESERVED18 18 /* Reserved */
5375 +#define TNETD73XX_INTC_EMAC0 19 /* EMAC 0 int */
5376 +#define TNETD73XX_INTC_RESERVED20 20 /* Reserved */
5377 +#define TNETD73XX_INTC_VLYNQ0 21 /* VLYNQ 0 int */
5378 +#define TNETD73XX_INTC_CODEC 22 /* CODEC int */
5379 +#define TNETD73XX_INTC_RESERVED23 23 /* Reserved */
5380 +#define TNETD73XX_INTC_USBSLAVE 24 /* USB Slave int */
5381 +#define TNETD73XX_INTC_VLYNQ1 25 /* VLYNQ 1 int */
5382 +#define TNETD73XX_INTC_RESERVED26 26 /* Reserved */
5383 +#define TNETD73XX_INTC_RESERVED27 27 /* Reserved */
5384 +#define TNETD73XX_INTC_ETH_PHY 28 /* Ethernet PHY */
5385 +#define TNETD73XX_INTC_I2C 29 /* I2C int */
5386 +#define TNETD73XX_INTC_MCDMA2 30 /* MCDMA 2 int */
5387 +#define TNETD73XX_INTC_MCDMA3 31 /* MCDMA 3 int */
5388 +#define TNETD73XX_INTC_RESERVED32 32 /* Reserved */
5389 +#define TNETD73XX_INTC_EMAC1 33 /* EMAC 1 int */
5390 +#define TNETD73XX_INTC_RESERVED34 34 /* Reserved */
5391 +#define TNETD73XX_INTC_RESERVED35 35 /* Reserved */
5392 +#define TNETD73XX_INTC_RESERVED36 36 /* Reserved */
5393 +#define TNETD73XX_INTC_VDMAVTRX 37 /* VDMAVTRX */
5394 +#define TNETD73XX_INTC_VDMAVTTX 38 /* VDMAVTTX */
5395 +#define TNETD73XX_INTC_ADSLSS 39 /* ADSLSS */
5397 +/* Secondary interrupts */
5398 +#define TNETD73XX_INTC_SEC0 40 /* Secondary */
5399 +#define TNETD73XX_INTC_SEC1 41 /* Secondary */
5400 +#define TNETD73XX_INTC_SEC2 42 /* Secondary */
5401 +#define TNETD73XX_INTC_SEC3 43 /* Secondary */
5402 +#define TNETD73XX_INTC_SEC4 44 /* Secondary */
5403 +#define TNETD73XX_INTC_SEC5 45 /* Secondary */
5404 +#define TNETD73XX_INTC_SEC6 46 /* Secondary */
5405 +#define TNETD73XX_INTC_EMIF 47 /* EMIF */
5406 +#define TNETD73XX_INTC_SEC8 48 /* Secondary */
5407 +#define TNETD73XX_INTC_SEC9 49 /* Secondary */
5408 +#define TNETD73XX_INTC_SEC10 50 /* Secondary */
5409 +#define TNETD73XX_INTC_SEC11 51 /* Secondary */
5410 +#define TNETD73XX_INTC_SEC12 52 /* Secondary */
5411 +#define TNETD73XX_INTC_SEC13 53 /* Secondary */
5412 +#define TNETD73XX_INTC_SEC14 54 /* Secondary */
5413 +#define TNETD73XX_INTC_SEC15 55 /* Secondary */
5414 +#define TNETD73XX_INTC_SEC16 56 /* Secondary */
5415 +#define TNETD73XX_INTC_SEC17 57 /* Secondary */
5416 +#define TNETD73XX_INTC_SEC18 58 /* Secondary */
5417 +#define TNETD73XX_INTC_SEC19 59 /* Secondary */
5418 +#define TNETD73XX_INTC_SEC20 60 /* Secondary */
5419 +#define TNETD73XX_INTC_SEC21 61 /* Secondary */
5420 +#define TNETD73XX_INTC_SEC22 62 /* Secondary */
5421 +#define TNETD73XX_INTC_SEC23 63 /* Secondary */
5422 +#define TNETD73XX_INTC_SEC24 64 /* Secondary */
5423 +#define TNETD73XX_INTC_SEC25 65 /* Secondary */
5424 +#define TNETD73XX_INTC_SEC26 66 /* Secondary */
5425 +#define TNETD73XX_INTC_SEC27 67 /* Secondary */
5426 +#define TNETD73XX_INTC_SEC28 68 /* Secondary */
5427 +#define TNETD73XX_INTC_SEC29 69 /* Secondary */
5428 +#define TNETD73XX_INTC_SEC30 70 /* Secondary */
5429 +#define TNETD73XX_INTC_SEC31 71 /* Secondary */
5431 +/* These ugly macros are to access the -1 registers, like config1 */
5432 +#define MFC0_SEL1_OPCODE(dst, src)\
5433 + .word (0x40000000 | ((dst)<<16) | ((src)<<11) | 1);\
5438 +#define MTC0_SEL1_OPCODE(dst, src)\
5439 + .word (0x40800000 | ((dst)<<16) | ((src)<<11) | 1);\
5445 +/* Below are Jade core specific */
5446 +#define CFG0_4K_IL_MASK 0x00380000
5447 +#define CFG0_4K_IL_SHIFT 19
5448 +#define CFG0_4K_IA_MASK 0x00070000
5449 +#define CFG0_4K_IA_SHIFT 16
5450 +#define CFG0_4K_IS_MASK 0x01c00000
5451 +#define CFG0_4K_IS_SHIFT 22
5453 +#define CFG0_4K_DL_MASK 0x00001c00
5454 +#define CFG0_4K_DL_SHIFT 10
5455 +#define CFG0_4K_DA_MASK 0x00000380
5456 +#define CFG0_4K_DA_SHIFT 7
5457 +#define CFG0_4K_DS_MASK 0x0000E000
5458 +#define CFG0_4K_DS_SHIFT 13
5462 +#endif /* __TNETD73XX_H_ */
5463 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_misc.h linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h
5464 --- linux.old/include/asm-mips/ar7/tnetd73xx_misc.h 1970-01-01 01:00:00.000000000 +0100
5465 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h 2005-08-12 19:32:05.172220192 +0200
5467 +/******************************************************************************
5468 + * FILE PURPOSE: TNETD73xx Misc modules API Header
5469 + ******************************************************************************
5470 + * FILE NAME: tnetd73xx_misc.h
5472 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
5473 + * FSER Modules API
5474 + * As per TNETD73xx specifications
5476 + * REVISION HISTORY:
5477 + * 27 Nov 02 - Sharath Kumar PSP TII
5478 + * 14 Feb 03 - Anant Gole PSP TII
5480 + * (C) Copyright 2002, Texas Instruments, Inc
5481 + *******************************************************************************/
5483 +#ifndef __TNETD73XX_MISC_H__
5484 +#define __TNETD73XX_MISC_H__
5486 +/*****************************************************************************
5487 + * Reset Control Module
5488 + *****************************************************************************/
5490 +typedef enum TNETD73XX_RESET_MODULE_tag
5492 + RESET_MODULE_UART0 = 0,
5493 + RESET_MODULE_UART1 = 1,
5494 + RESET_MODULE_I2C = 2,
5495 + RESET_MODULE_TIMER0 = 3,
5496 + RESET_MODULE_TIMER1 = 4,
5497 + RESET_MODULE_GPIO = 6,
5498 + RESET_MODULE_ADSLSS = 7,
5499 + RESET_MODULE_USBS = 8,
5500 + RESET_MODULE_SAR = 9,
5501 + RESET_MODULE_VDMA_VT = 11,
5502 + RESET_MODULE_FSER = 12,
5503 + RESET_MODULE_VLYNQ1 = 16,
5504 + RESET_MODULE_EMAC0 = 17,
5505 + RESET_MODULE_DMA = 18,
5506 + RESET_MODULE_BIST = 19,
5507 + RESET_MODULE_VLYNQ0 = 20,
5508 + RESET_MODULE_EMAC1 = 21,
5509 + RESET_MODULE_MDIO = 22,
5510 + RESET_MODULE_ADSLSS_DSP = 23,
5511 + RESET_MODULE_EPHY = 26
5512 +} TNETD73XX_RESET_MODULE_T;
5514 +typedef enum TNETD73XX_RESET_CTRL_tag
5518 +} TNETD73XX_RESET_CTRL_T;
5520 +typedef enum TNETD73XX_SYS_RST_MODE_tag
5522 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
5523 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
5524 +} TNETD73XX_SYS_RST_MODE_T;
5526 +typedef enum TNETD73XX_SYS_RESET_STATUS_tag
5528 + HARDWARE_RESET = 0,
5529 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
5531 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
5532 +} TNETD73XX_SYS_RESET_STATUS_T;
5534 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module,
5535 + TNETD73XX_RESET_CTRL_T reset_ctrl);
5536 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status(TNETD73XX_RESET_MODULE_T reset_module);
5537 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode);
5538 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status(void);
5540 +/*****************************************************************************
5541 + * Power Control Module
5542 + *****************************************************************************/
5544 +typedef enum TNETD73XX_POWER_MODULE_tag
5546 + POWER_MODULE_USBSP = 0,
5547 + POWER_MODULE_WDTP = 1,
5548 + POWER_MODULE_UT0P = 2,
5549 + POWER_MODULE_UT1P = 3,
5550 + POWER_MODULE_IICP = 4,
5551 + POWER_MODULE_VDMAP = 5,
5552 + POWER_MODULE_GPIOP = 6,
5553 + POWER_MODULE_VLYNQ1P = 7,
5554 + POWER_MODULE_SARP = 8,
5555 + POWER_MODULE_ADSLP = 9,
5556 + POWER_MODULE_EMIFP = 10,
5557 + POWER_MODULE_ADSPP = 12,
5558 + POWER_MODULE_RAMP = 13,
5559 + POWER_MODULE_ROMP = 14,
5560 + POWER_MODULE_DMAP = 15,
5561 + POWER_MODULE_BISTP = 16,
5562 + POWER_MODULE_TIMER0P = 18,
5563 + POWER_MODULE_TIMER1P = 19,
5564 + POWER_MODULE_EMAC0P = 20,
5565 + POWER_MODULE_EMAC1P = 22,
5566 + POWER_MODULE_EPHYP = 24,
5567 + POWER_MODULE_VLYNQ0P = 27,
5568 +} TNETD73XX_POWER_MODULE_T;
5570 +typedef enum TNETD73XX_POWER_CTRL_tag
5572 + POWER_CTRL_POWER_UP = 0,
5573 + POWER_CTRL_POWER_DOWN
5574 +} TNETD73XX_POWER_CTRL_T;
5576 +typedef enum TNETD73XX_SYS_POWER_MODE_tag
5578 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
5579 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
5580 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
5581 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
5582 +} TNETD73XX_SYS_POWER_MODE_T;
5584 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl);
5585 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module);
5586 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode);
5587 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode(void);
5589 +/*****************************************************************************
5591 + *****************************************************************************/
5593 +typedef enum TNETD73XX_WAKEUP_INTERRUPT_tag
5599 +} TNETD73XX_WAKEUP_INTERRUPT_T;
5601 +typedef enum TNETD73XX_WAKEUP_CTRL_tag
5603 + WAKEUP_DISABLED = 0,
5605 +} TNETD73XX_WAKEUP_CTRL_T;
5607 +typedef enum TNETD73XX_WAKEUP_POLARITY_tag
5609 + WAKEUP_ACTIVE_HIGH = 0,
5611 +} TNETD73XX_WAKEUP_POLARITY_T;
5613 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
5614 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
5615 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity);
5617 +/*****************************************************************************
5619 + *****************************************************************************/
5621 +typedef enum TNETD73XX_FSER_MODE_tag
5625 +} TNETD73XX_FSER_MODE_T;
5627 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode);
5629 +/*****************************************************************************
5631 + *****************************************************************************/
5633 +#define CLK_MHZ(x) ( (x) * 1000000 )
5635 +typedef enum TNETD73XX_CLKC_ID_tag
5641 +} TNETD73XX_CLKC_ID_T;
5643 +void tnetd73xx_clkc_init(__u32 afeclk, __u32 refclk, __u32 xtal3in);
5644 +TNETD73XX_ERR tnetd73xx_clkc_set_freq(TNETD73XX_CLKC_ID_T clk_id, __u32 output_freq);
5645 +__u32 tnetd73xx_clkc_get_freq(TNETD73XX_CLKC_ID_T clk_id);
5647 +/*****************************************************************************
5649 + *****************************************************************************/
5651 +typedef enum TNETD73XX_GPIO_PIN_tag
5653 + GPIO_UART0_RD = 0,
5654 + GPIO_UART0_TD = 1,
5655 + GPIO_UART0_RTS = 2,
5656 + GPIO_UART0_CTS = 3,
5657 + GPIO_FSER_CLK = 4,
5659 + GPIO_EXT_AFE_SCLK = 6,
5660 + GPIO_EXT_AFE_TX_FS = 7,
5661 + GPIO_EXT_AFE_TXD = 8,
5662 + GPIO_EXT_AFE_RS_FS = 9,
5663 + GPIO_EXT_AFE_RXD1 = 10,
5664 + GPIO_EXT_AFE_RXD0 = 11,
5665 + GPIO_EXT_AFE_CDIN = 12,
5666 + GPIO_EXT_AFE_CDOUT = 13,
5667 + GPIO_EPHY_SPEED100 = 14,
5668 + GPIO_EPHY_LINKON = 15,
5669 + GPIO_EPHY_ACTIVITY = 16,
5670 + GPIO_EPHY_FDUPLEX = 17,
5673 + GPIO_MBSP0_TCLK = 20,
5674 + GPIO_MBSP0_RCLK = 21,
5675 + GPIO_MBSP0_RD = 22,
5676 + GPIO_MBSP0_TD = 23,
5677 + GPIO_MBSP0_RFS = 24,
5678 + GPIO_MBSP0_TFS = 25,
5679 + GPIO_MII_DIO = 26,
5680 + GPIO_MII_DCLK = 27,
5681 +} TNETD73XX_GPIO_PIN_T;
5683 +typedef enum TNETD73XX_GPIO_PIN_MODE_tag
5685 + FUNCTIONAL_PIN = 0,
5687 +} TNETD73XX_GPIO_PIN_MODE_T;
5689 +typedef enum TNETD73XX_GPIO_PIN_DIRECTION_tag
5691 + GPIO_OUTPUT_PIN = 0,
5692 + GPIO_INPUT_PIN = 1
5693 +} TNETD73XX_GPIO_PIN_DIRECTION_T;
5695 +void tnetd73xx_gpio_init(void);
5696 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
5697 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
5698 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction);
5699 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value);
5700 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin);
5702 +/* TNETD73XX Revision */
5703 +__u32 tnetd73xx_get_revision(void);
5705 +#endif /* __TNETD73XX_MISC_H__ */
5706 diff -urN linux.old/include/asm-mips/io.h linux.dev/include/asm-mips/io.h
5707 --- linux.old/include/asm-mips/io.h 2005-07-10 03:00:44.000000000 +0200
5708 +++ linux.dev/include/asm-mips/io.h 2005-08-12 21:13:28.133469520 +0200
5710 #ifdef CONFIG_64BIT_PHYS_ADDR
5711 #define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
5714 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + CONFIG_AR7_MEMORY)
5716 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
5720 #define IO_SPACE_LIMIT 0xffff
5722 diff -urN linux.old/include/asm-mips/irq.h linux.dev/include/asm-mips/irq.h
5723 --- linux.old/include/asm-mips/irq.h 2005-07-10 03:00:44.000000000 +0200
5724 +++ linux.dev/include/asm-mips/irq.h 2005-08-12 19:32:05.172220192 +0200
5726 #include <linux/config.h>
5727 #include <linux/linkage.h>
5730 +#include <asm/ar7/avalanche_intc.h>
5731 +#define NR_IRQS AVALANCHE_INT_END + 1
5733 #define NR_IRQS 128 /* Largest number of ints of all machines. */
5737 static inline int irq_cannonicalize(int irq)
5738 diff -urN linux.old/include/asm-mips/page.h linux.dev/include/asm-mips/page.h
5739 --- linux.old/include/asm-mips/page.h 2005-07-10 03:00:44.000000000 +0200
5740 +++ linux.dev/include/asm-mips/page.h 2005-08-12 21:13:38.481896320 +0200
5741 @@ -129,7 +129,11 @@
5743 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
5744 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
5746 +#define virt_to_page(kaddr) phys_to_page(__pa(kaddr))
5748 #define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
5750 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
5752 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
5753 diff -urN linux.old/include/asm-mips/pgtable-32.h linux.dev/include/asm-mips/pgtable-32.h
5754 --- linux.old/include/asm-mips/pgtable-32.h 2005-07-10 03:00:44.000000000 +0200
5755 +++ linux.dev/include/asm-mips/pgtable-32.h 2005-08-12 21:13:46.898616784 +0200
5756 @@ -108,7 +108,18 @@
5757 * and a page entry and page directory to the page they refer to.
5760 -#ifdef CONFIG_CPU_VR41XX
5761 +#if defined(CONFIG_AR7)
5762 +#define mk_pte(page, pgprot) \
5766 + pte_val(__pte) = ((phys_t)(page - mem_map) << (PAGE_SHIFT) | \
5767 + CONFIG_AR7_MEMORY) | \
5768 + pgprot_val(pgprot); \
5772 +#elif defined(CONFIG_CPU_VR41XX)
5773 #define mk_pte(page, pgprot) \
5781 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
5783 #ifdef CONFIG_CPU_VR41XX
5784 @@ -175,7 +187,10 @@
5785 set_pte(ptep, __pte(0));
5788 -#ifdef CONFIG_CPU_VR41XX
5789 +#if defined(CONFIG_AR7)
5790 +#define phys_to_page(phys) (mem_map + (((phys)-CONFIG_AR7_MEMORY) >> PAGE_SHIFT))
5791 +#define pte_page(x) phys_to_page(pte_val(x))
5792 +#elif defined(CONFIG_CPU_VR41XX)
5793 #define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> (PAGE_SHIFT+2)))))
5794 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << (PAGE_SHIFT+2)) | pgprot_val(pgprot))
5796 diff -urN linux.old/include/asm-mips/serial.h linux.dev/include/asm-mips/serial.h
5797 --- linux.old/include/asm-mips/serial.h 2005-07-10 03:00:44.000000000 +0200
5798 +++ linux.dev/include/asm-mips/serial.h 2005-08-12 19:32:05.174219888 +0200
5801 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
5804 +#include <asm/ar7/ar7.h>
5805 +#define AR7_SERIAL_PORT_DEFNS \
5806 + { 0, AR7_BASE_BAUD, AR7_UART0_REGS_BASE, LNXINTNUM(AVALANCHE_UART0_INT), STD_COM_FLAGS }, \
5807 + { 0, AR7_BASE_BAUD, AR7_UART1_REGS_BASE, LNXINTNUM(AVALANCHE_UART1_INT), STD_COM_FLAGS },
5809 +#define AR7_SERIAL_PORT_DEFNS
5812 #ifdef CONFIG_MIPS_JAZZ
5813 #define _JAZZ_SERIAL_INIT(int, base) \
5814 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
5818 #define SERIAL_PORT_DFNS \
5819 + AR7_SERIAL_PORT_DEFNS \
5820 ATLAS_SERIAL_PORT_DEFNS \
5821 AU1000_SERIAL_PORT_DEFNS \
5822 COBALT_SERIAL_PORT_DEFNS \
5823 diff -urN linux.old/Makefile linux.dev/Makefile
5824 --- linux.old/Makefile 2005-07-10 03:00:44.000000000 +0200
5825 +++ linux.dev/Makefile 2005-08-12 19:32:05.122227792 +0200
5828 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
5830 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
5831 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
5832 -fno-strict-aliasing -fno-common
5833 ifndef CONFIG_FRAME_POINTER
5834 CFLAGS += -fomit-frame-pointer