1 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
2 --- linux.old/arch/mips/Makefile 2005-10-21 16:43:16.316951500 +0200
3 +++ linux.dev/arch/mips/Makefile 2005-11-10 01:10:45.775570250 +0100
8 +# Texas Instruments AR7
12 +LIBS += arch/mips/ar7/ar7.o
13 +SUBDIRS += arch/mips/ar7
14 +LOADADDR += 0x94020000
20 ifdef CONFIG_DECSTATION
21 diff -urN linux.old/arch/mips/ar7/Makefile linux.dev/arch/mips/ar7/Makefile
22 --- linux.old/arch/mips/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
23 +++ linux.dev/arch/mips/ar7/Makefile 2005-11-10 01:13:51.443173750 +0100
26 + $(CPP) $(AFLAGS) $< -o $*.s
29 + $(CC) $(AFLAGS) -c $< -o $*.o
31 +EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7 -DLITTLE_ENDIAN -D_LINK_KSEG0_
34 +obj-y := tnetd73xx_misc.o misc.o
35 +export-objs := misc.o irq.o init.o
36 +obj-y += setup.o irq.o int-handler.o reset.o init.o psp_env.o memory.o promlib.o cmdline.o
38 +include $(TOPDIR)/Rules.make
39 diff -urN linux.old/arch/mips/ar7/cmdline.c linux.dev/arch/mips/ar7/cmdline.c
40 --- linux.old/arch/mips/ar7/cmdline.c 1970-01-01 01:00:00.000000000 +0100
41 +++ linux.dev/arch/mips/ar7/cmdline.c 2005-11-10 01:14:16.372731750 +0100
44 + * Carsten Langgaard, carstenl@mips.com
45 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
47 + * This program is free software; you can distribute it and/or modify it
48 + * under the terms of the GNU General Public License (Version 2) as
49 + * published by the Free Software Foundation.
51 + * This program is distributed in the hope it will be useful, but WITHOUT
52 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
53 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
56 + * You should have received a copy of the GNU General Public License along
57 + * with this program; if not, write to the Free Software Foundation, Inc.,
58 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
60 + * Kernel command line creation using the prom monitor (YAMON) argc/argv.
62 +#include <linux/init.h>
63 +#include <linux/string.h>
65 +#include <asm/bootinfo.h>
67 +extern int prom_argc;
68 +extern int *_prom_argv;
71 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
72 + * This macro take care of sign extension.
74 +#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
76 +char arcs_cmdline[CL_SIZE];
77 +#ifdef CONFIG_CMDLINE_BOOL
78 +char __initdata cfg_cmdline[] = CONFIG_CMDLINE;
81 +char * __init prom_getcmdline(void)
83 + return &(arcs_cmdline[0]);
87 +void __init prom_init_cmdline(void)
91 + char *env_cmdline = prom_getenv("kernel_args");
94 + actr = 1; /* Always ignore argv[0] */
96 + cp = end = &(arcs_cmdline[0]);
97 + end += sizeof(arcs_cmdline);
100 + len = strlen(env_cmdline);
101 + if (len > end - cp - 1)
102 + len = end - cp - 1;
103 + strncpy(cp, env_cmdline, len);
107 +#ifdef CONFIG_CMDLINE_BOOL
109 + len = strlen(cfg_cmdline);
110 + if (len > end - cp - 1)
111 + len = end - cp - 1;
112 + strncpy(cp, cfg_cmdline, len);
118 + while(actr < prom_argc) {
119 + len = strlen(prom_argv(actr));
120 + if (len > end - cp - 1)
122 + strncpy(cp, prom_argv(actr), len);
127 + if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
131 diff -urN linux.old/arch/mips/ar7/init.c linux.dev/arch/mips/ar7/init.c
132 --- linux.old/arch/mips/ar7/init.c 1970-01-01 01:00:00.000000000 +0100
133 +++ linux.dev/arch/mips/ar7/init.c 2005-11-10 01:10:45.795571500 +0100
136 + * Carsten Langgaard, carstenl@mips.com
137 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
139 + * This program is free software; you can distribute it and/or modify it
140 + * under the terms of the GNU General Public License (Version 2) as
141 + * published by the Free Software Foundation.
143 + * This program is distributed in the hope it will be useful, but WITHOUT
144 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
145 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
146 + * for more details.
148 + * You should have received a copy of the GNU General Public License along
149 + * with this program; if not, write to the Free Software Foundation, Inc.,
150 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
152 + * PROM library initialisation code.
154 +#include <linux/config.h>
155 +#include <linux/init.h>
156 +#include <linux/string.h>
157 +#include <linux/kernel.h>
158 +#include <linux/module.h>
161 +#include <asm/mips-boards/prom.h>
162 +#include <asm/mips-boards/generic.h>
164 +#include <asm/ar7/adam2_env.h>
167 +int *_prom_argv, *_prom_envp;
169 +/* max # of Adam2 environment variables */
170 +#define MAX_ENV_ENTRY 80
172 +static t_env_var local_envp[MAX_ENV_ENTRY];
173 +static int env_type = 0;
176 +unsigned int max_env_entry;
178 +extern char *prom_psp_getenv(char *envname);
180 +static inline char *prom_adam2_getenv(char *envname)
183 + * Return a pointer to the given environment variable.
184 + * In 64-bit mode: we're using 64-bit pointers, but all pointers
185 + * in the PROM structures are only 32-bit, so we need some
186 + * workarounds, if we are running in 64-bit mode.
189 + t_env_var *env = (t_env_var *) local_envp;
191 + if (strcmp("bootloader", envname) == 0)
194 + i = strlen(envname);
195 + while (env->name) {
196 + if(strncmp(envname, env->name, i) == 0) {
205 +/* XXX "bootloader" won't be returned.
206 + * Better make it an element of local_envp */
207 +static inline t_env_var *
208 +prom_adam2_iterenv(t_env_var *env) {
213 + if (env - local_envp > MAX_ENV_ENTRY || !env->name)
218 +char *prom_getenv(char *envname)
221 + return prom_psp_getenv(envname);
223 + return prom_adam2_getenv(envname);
227 +prom_iterenv(t_env_var *last)
230 + return 0; /* not yet implemented */
231 + return prom_adam2_iterenv(last);
234 +static inline unsigned char str2hexnum(unsigned char c)
236 + if (c >= '0' && c <= '9')
238 + if (c >= 'a' && c <= 'f')
239 + return c - 'a' + 10;
240 + return 0; /* foo */
243 +static inline void str2eaddr(unsigned char *ea, unsigned char *str)
247 + for (i = 0; i < 6; i++) {
250 + if((*str == '.') || (*str == ':'))
252 + num = str2hexnum(*str++) << 4;
253 + num |= (str2hexnum(*str++));
258 +int get_ethernet_addr(char *ethernet_addr)
262 + ethaddr_str = prom_getenv("ethaddr");
263 + if (!ethaddr_str) {
264 + printk("ethaddr not set in boot prom\n");
267 + str2eaddr(ethernet_addr, ethaddr_str);
269 + if (init_debug > 1) {
271 + printk("get_ethernet_addr: ");
272 + for (i=0; i<5; i++)
273 + printk("%02x:", (unsigned char)*(ethernet_addr+i));
274 + printk("%02x\n", *(ethernet_addr+i));
281 + unsigned int psbl_size;
282 + unsigned int env_base;
283 + unsigned int env_size;
284 + unsigned int ffs_base;
285 + unsigned int ffs_size;
288 +static const char psp_env_version[] = "TIENV0.8";
290 +int __init prom_init(int argc, char **argv, char **envp)
294 + t_env_var *env = (t_env_var *) envp;
295 + struct psbl_rec *psbl = (struct psbl_rec *)(KSEG1ADDR(0x94000300));
296 + void *psp_env = (void *)KSEG1ADDR(psbl->env_base);
299 + _prom_argv = (int *)argv;
300 + _prom_envp = (int *)envp;
302 + if(strcmp(psp_env, psp_env_version) == 0) {
306 + _prom_envp = psp_env;
307 + max_env_entry = (psbl->env_size / 16) - 1;
309 + /* Copy what we need locally so we are not dependent on
310 + * bootloader RAM. In Adam2, the environment parameters
311 + * are in flash but the table that references them is in
315 + for(i=0; i < MAX_ENV_ENTRY; i++, env++) {
317 + local_envp[i].name = env->name;
318 + local_envp[i].val = env->val;
320 + local_envp[i].name = NULL;
321 + local_envp[i].val = NULL;
326 + set_io_port_base(0);
328 + prom_printf("\nLINUX started...\n");
329 + prom_init_cmdline();
334 diff -urN linux.old/arch/mips/ar7/int-handler.S linux.dev/arch/mips/ar7/int-handler.S
335 --- linux.old/arch/mips/ar7/int-handler.S 1970-01-01 01:00:00.000000000 +0100
336 +++ linux.dev/arch/mips/ar7/int-handler.S 2005-11-10 01:12:43.938955000 +0100
339 + * Copyright 2004 PMC-Sierra Inc.
340 + * Author: Manish Lachwani (lachwani@pmc-sierra.com)
341 + * Adaption for AR7: Enrik Berkhan <enrik@akk.org>
343 + * First-level interrupt dispatcher for the TI AR7
345 + * This program is free software; you can redistribute it and/or modify it
346 + * under the terms of the GNU General Public License as published by the
347 + * Free Software Foundation; either version 2 of the License, or (at your
348 + * option) any later version.
350 +#define __ASSEMBLY__
351 +#include <linux/config.h>
352 +#include <asm/asm.h>
353 +#include <asm/mipsregs.h>
354 +#include <asm/addrspace.h>
355 +#include <asm/regdef.h>
356 +#include <asm/stackframe.h>
359 + * First level interrupt dispatcher for TI AR7 based boards
363 + NESTED(ar7IRQ, PT_SIZE, sp)
369 + mfc0 t2, CP0_STATUS
373 + andi t1, t0, STATUSF_IP2 /* hw0 hardware interrupt */
374 + bnez t1, ll_hw0_irq
376 + andi t1, t0, STATUSF_IP7 /* R4k CPU timer */
377 + bnez t1, ll_timer_irq
381 + /* wrong alarm or masked ... */
382 + j spurious_interrupt
401 diff -urN linux.old/arch/mips/ar7/irq.c linux.dev/arch/mips/ar7/irq.c
402 --- linux.old/arch/mips/ar7/irq.c 1970-01-01 01:00:00.000000000 +0100
403 +++ linux.dev/arch/mips/ar7/irq.c 2005-11-10 01:12:43.938955000 +0100
406 + * Nitin Dhingra, iamnd@ti.com
407 + * Copyright (C) 2002 Texas Instruments, Inc. All rights reserved.
409 + * ########################################################################
411 + * This program is free software; you can distribute it and/or modify it
412 + * under the terms of the GNU General Public License (Version 2) as
413 + * published by the Free Software Foundation.
415 + * This program is distributed in the hope it will be useful, but WITHOUT
416 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
417 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
418 + * for more details.
420 + * You should have received a copy of the GNU General Public License along
421 + * with this program; if not, write to the Free Software Foundation, Inc.,
422 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
424 + * ########################################################################
426 + * Routines for generic manipulation of the interrupts found on the Texas
427 + * Instruments avalanche board
431 +#include <linux/init.h>
432 +#include <linux/interrupt.h>
434 +#include <asm/irq.h>
435 +#include <asm/mipsregs.h>
436 +#include <asm/ar7/ar7.h>
437 +#include <asm/ar7/avalanche_intc.h>
439 +#define shutdown_avalanche_irq disable_avalanche_irq
440 +#define mask_and_ack_avalanche_irq disable_avalanche_irq
442 +static unsigned int startup_avalanche_irq(unsigned int irq);
443 +static void end_avalanche_irq(unsigned int irq);
444 +void enable_avalanche_irq(unsigned int irq_nr);
445 +void disable_avalanche_irq(unsigned int irq_nr);
446 +void ar7_hw0_interrupt(int interrupt, void *dev, struct pt_regs *regs);
448 +static struct hw_interrupt_type avalanche_irq_type = {
450 + startup_avalanche_irq,
451 + shutdown_avalanche_irq,
452 + enable_avalanche_irq,
453 + disable_avalanche_irq,
454 + mask_and_ack_avalanche_irq,
459 +static int ar7_irq_base;
461 +static struct irqaction ar7_hw0_action = {
462 + ar7_hw0_interrupt, 0, 0, "AR7 on hw0", NULL, NULL
465 +struct avalanche_ictrl_regs *avalanche_hw0_icregs; /* Interrupt control regs (primary) */
466 +struct avalanche_exctrl_regs *avalanche_hw0_ecregs; /* Exception control regs (secondary) */
467 +struct avalanche_ipace_regs *avalanche_hw0_ipaceregs;
468 +struct avalanche_channel_int_number *avalanche_hw0_chregs; /* Channel control registers */
471 + This remaps interrupts to exist on other channels than the default
472 + channels. essentially we can use the line # as the index for this
476 +static unsigned long line_to_channel[AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
477 +unsigned long uni_secondary_interrupt = 0;
479 +static void end_avalanche_irq(unsigned int irq)
481 + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
482 + enable_avalanche_irq(irq);
485 +void disable_avalanche_irq(unsigned int irq_nr)
487 + unsigned long flags;
488 + unsigned long chan_nr=0;
490 + save_and_cli(flags);
492 + /* irq_nr represents the line number for the interrupt. We must
493 + * disable the channel number associated with that line number.
496 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
497 + chan_nr = AVINTNUM(irq_nr); /*CHECK THIS ALSO*/
499 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];/* WE NEED A LINE TO CHANNEL MAPPING FUNCTION HERE*/
501 + /* disable the interrupt channel bit */
503 + /* primary interrupt #'s 0-31 */
505 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
506 + avalanche_hw0_icregs->intecr1 = (1 << chan_nr);
508 + /* primary interrupt #'s 32-39 */
510 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
511 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
512 + avalanche_hw0_icregs->intecr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
514 + else /* secondary interrupt #'s 0-31 */
515 + avalanche_hw0_ecregs->exiecr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
517 + restore_flags(flags);
520 +void enable_avalanche_irq(unsigned int irq_nr)
522 + unsigned long flags;
523 + unsigned long chan_nr=0;
525 + save_and_cli(flags);
527 + /* irq_nr represents the line number for the interrupt. We must
528 + * disable the channel number associated with that line number.
531 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
532 + chan_nr = AVINTNUM(irq_nr);
534 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];
536 + /* enable the interrupt channel bit */
538 + /* primary interrupt #'s 0-31 */
539 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
540 + avalanche_hw0_icregs->intesr1 = (1 << chan_nr);
542 + /* primary interrupt #'s 32 throuth 39 */
543 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
544 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
545 + avalanche_hw0_icregs->intesr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
547 + else /* secondary interrupt #'s 0-31 */
548 + avalanche_hw0_ecregs->exiesr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
550 + restore_flags(flags);
553 +static unsigned int startup_avalanche_irq(unsigned int irq)
555 + enable_avalanche_irq(irq);
556 + return 0; /* never anything pending */
559 +void __init ar7_irq_init(int base)
563 + avalanche_hw0_icregs = (struct avalanche_ictrl_regs *)AVALANCHE_ICTRL_REGS_BASE;
564 + avalanche_hw0_ecregs = (struct avalanche_exctrl_regs *)AVALANCHE_ECTRL_REGS_BASE;
565 + avalanche_hw0_ipaceregs = (struct avalanche_ipace_regs *)AVALANCHE_IPACE_REGS_BASE;
566 + avalanche_hw0_chregs = (struct avalanche_channel_int_number *)AVALANCHE_CHCTRL_REGS_BASE;
568 + /* Disable interrupts and clear pending
571 + avalanche_hw0_icregs->intecr1 = 0xffffffff; /* disable interrupts 0:31 */
572 + avalanche_hw0_icregs->intcr1 = 0xffffffff; /* clear interrupts 0:31 */
573 + avalanche_hw0_icregs->intecr2 = 0xff; /* disable interrupts 32:39 */
574 + avalanche_hw0_icregs->intcr2 = 0xff; /* clear interrupts 32:39 */
575 + avalanche_hw0_ecregs->exiecr = 0xffffffff; /* disable secondary interrupts 0:31 */
576 + avalanche_hw0_ecregs->excr = 0xffffffff; /* clear secondary interrupts 0:31 */
579 + // avalanche_hw0_ipaceregs->ipacep = (2*get_avalanche_vbus_freq()/1000000)*4;
580 + /* hack for speeding up the pacing. */
581 + printk("the pacing pre-scalar has been set as 600.\n");
582 + avalanche_hw0_ipaceregs->ipacep = 600;
583 + /* Channel to line mapping, Line to Channel mapping */
585 + for(i = 0; i < 40; i++)
586 + avalanche_int_set(i,i);
588 + ar7_irq_base = base;
589 + for (i = base; i <= base+40; i++)
591 + irq_desc[i].status = IRQ_DISABLED;
592 + irq_desc[i].action = 0;
593 + irq_desc[i].depth = 1;
594 + irq_desc[i].handler = &avalanche_irq_type;
597 + setup_irq(2, &ar7_hw0_action);
598 + set_c0_status(IE_IRQ0);
603 +void ar7_hw0_interrupt(int interrupt, void *dev, struct pt_regs *regs)
606 + unsigned long int_line_number, status;
607 + int i, chan_nr = 0;
609 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
610 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
612 + if(chan_nr < 32) /* primary 0-31 */
614 + if( chan_nr != uni_secondary_interrupt)
615 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
619 + if((chan_nr < 40) && (chan_nr > 31)) /* primary 32-39 */
621 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-32));
625 + /* If the Priority Interrupt Index Register returns 40 then no
626 + * interrupts are pending
632 + if(chan_nr == uni_secondary_interrupt) /* secondary 0-31 */
634 + status = avalanche_hw0_ecregs->exsr;
635 + for(i=0; i < 32; i++)
639 + /* clear secondary interrupt */
640 + avalanche_hw0_ecregs->excr = 1 << i;
646 + /* clear the universal secondary interrupt */
647 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
653 + do_IRQ(irq + ar7_irq_base, regs);
657 +void avalanche_int_set(int channel, int line)
662 + avalanche_hw0_chregs->cintnr0 = line;
665 + avalanche_hw0_chregs->cintnr1 = line;
668 + avalanche_hw0_chregs->cintnr2 = line;
671 + avalanche_hw0_chregs->cintnr3 = line;
674 + avalanche_hw0_chregs->cintnr4 = line;
677 + avalanche_hw0_chregs->cintnr5 = line;
680 + avalanche_hw0_chregs->cintnr6 = line;
683 + avalanche_hw0_chregs->cintnr7 = line;
686 + avalanche_hw0_chregs->cintnr8 = line;
689 + avalanche_hw0_chregs->cintnr9 = line;
692 + avalanche_hw0_chregs->cintnr10 = line;
695 + avalanche_hw0_chregs->cintnr11 = line;
698 + avalanche_hw0_chregs->cintnr12 = line;
701 + avalanche_hw0_chregs->cintnr13 = line;
704 + avalanche_hw0_chregs->cintnr14 = line;
707 + avalanche_hw0_chregs->cintnr15 = line;
710 + avalanche_hw0_chregs->cintnr16 = line;
713 + avalanche_hw0_chregs->cintnr17 = line;
716 + avalanche_hw0_chregs->cintnr18 = line;
719 + avalanche_hw0_chregs->cintnr19 = line;
722 + avalanche_hw0_chregs->cintnr20 = line;
725 + avalanche_hw0_chregs->cintnr21 = line;
728 + avalanche_hw0_chregs->cintnr22 = line;
731 + avalanche_hw0_chregs->cintnr23 = line;
734 + avalanche_hw0_chregs->cintnr24 = line;
737 + avalanche_hw0_chregs->cintnr25 = line;
740 + avalanche_hw0_chregs->cintnr26 = line;
743 + avalanche_hw0_chregs->cintnr27 = line;
746 + avalanche_hw0_chregs->cintnr28 = line;
749 + avalanche_hw0_chregs->cintnr29 = line;
752 + avalanche_hw0_chregs->cintnr30 = line;
755 + avalanche_hw0_chregs->cintnr31 = line;
758 + avalanche_hw0_chregs->cintnr32 = line;
761 + avalanche_hw0_chregs->cintnr33 = line;
764 + avalanche_hw0_chregs->cintnr34 = line;
767 + avalanche_hw0_chregs->cintnr35 = line;
770 + avalanche_hw0_chregs->cintnr36 = line;
773 + avalanche_hw0_chregs->cintnr37 = line;
776 + avalanche_hw0_chregs->cintnr38 = line;
779 + avalanche_hw0_chregs->cintnr39 = line;
782 + printk("Error: Unknown Avalanche interrupt channel\n");
785 + line_to_channel[line] = channel; /* Suraj check */
787 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
788 + uni_secondary_interrupt = line;
793 +#define AVALANCHE_MAX_PACING_BLK 3
794 +#define AVALANCHE_PACING_LOW_VAL 2
795 +#define AVALANCHE_PACING_HIGH_VAL 63
797 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num,
798 + unsigned int pace_value)
800 + unsigned int blk_offset;
801 + unsigned long flags;
803 + if(irq_nr < MIPS_EXCEPTION_OFFSET &&
804 + irq_nr >= AVALANCHE_INT_END_PRIMARY)
807 + if(blk_num > AVALANCHE_MAX_PACING_BLK)
810 + if(pace_value > AVALANCHE_PACING_HIGH_VAL &&
811 + pace_value < AVALANCHE_PACING_LOW_VAL)
814 + blk_offset = blk_num*8;
816 + save_and_cli(flags);
818 + /* disable the interrupt pacing, if enabled previously */
819 + avalanche_hw0_ipaceregs->ipacemax &= ~(0xff << blk_offset);
821 + /* clear the pacing map */
822 + avalanche_hw0_ipaceregs->ipacemap &= ~(0xff << blk_offset);
824 + /* setup the new values */
825 + avalanche_hw0_ipaceregs->ipacemap |= ((AVINTNUM(irq_nr)) << blk_offset);
826 + avalanche_hw0_ipaceregs->ipacemax |= ((0x80 | pace_value) << blk_offset);
828 + restore_flags(flags);
832 diff -urN linux.old/arch/mips/ar7/memory.c linux.dev/arch/mips/ar7/memory.c
833 --- linux.old/arch/mips/ar7/memory.c 1970-01-01 01:00:00.000000000 +0100
834 +++ linux.dev/arch/mips/ar7/memory.c 2005-11-10 01:14:16.372731750 +0100
837 + * Carsten Langgaard, carstenl@mips.com
838 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
840 + * ########################################################################
842 + * This program is free software; you can distribute it and/or modify it
843 + * under the terms of the GNU General Public License (Version 2) as
844 + * published by the Free Software Foundation.
846 + * This program is distributed in the hope it will be useful, but WITHOUT
847 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
848 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
849 + * for more details.
851 + * You should have received a copy of the GNU General Public License along
852 + * with this program; if not, write to the Free Software Foundation, Inc.,
853 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
855 + * ########################################################################
859 +#include <linux/config.h>
860 +#include <linux/init.h>
861 +#include <linux/mm.h>
862 +#include <linux/bootmem.h>
864 +#include <asm/bootinfo.h>
865 +#include <asm/page.h>
866 +#include <asm/mips-boards/prom.h>
869 +extern int preserve_adam2;
871 +void __init prom_meminit(void)
874 + unsigned long memsize, adam2size;
876 + /* assume block before kernel is used by bootloader */
877 + adam2size = __pa(&_ftext) - PHYS_OFFSET;
879 + memsize_str = prom_getenv("memsize");
880 + if (!memsize_str) {
881 + memsize = 0x02000000;
883 + memsize = simple_strtol(memsize_str, NULL, 0);
887 + add_memory_region(0x00000000, PHYS_OFFSET, BOOT_MEM_RESERVED);
889 + add_memory_region(PHYS_OFFSET, adam2size, BOOT_MEM_ROM_DATA);
890 + add_memory_region(PHYS_OFFSET+adam2size, memsize-adam2size,
894 +unsigned long __init prom_free_prom_memory (void)
897 + unsigned long freed = 0;
898 + unsigned long addr;
900 + if (preserve_adam2) {
901 + char *firstfree_str = prom_getenv("firstfreeaddress");
902 + unsigned long firstfree = 0;
905 + firstfree = simple_strtol(firstfree_str, NULL, 0);
907 + if (firstfree && firstfree < (unsigned long)&_ftext) {
908 + printk("Preserving ADAM2 memory.\n");
909 + } else if (firstfree) {
910 + printk("Can't preserve ADAM2 memory, "
911 + "firstfreeaddress = %08lx.\n", firstfree);
912 + preserve_adam2 = 0;
914 + printk("Can't preserve ADAM2 memory, "
915 + "firstfreeaddress unknown!\n");
916 + preserve_adam2 = 0;
920 + if (!preserve_adam2) {
921 + for (i = 0; i < boot_mem_map.nr_map; i++) {
922 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
925 + addr = boot_mem_map.map[i].addr;
926 + while (addr < boot_mem_map.map[i].addr
927 + + boot_mem_map.map[i].size) {
928 + ClearPageReserved(virt_to_page(__va(addr)));
929 + set_page_count(virt_to_page(__va(addr)), 1);
930 + free_page((unsigned long)__va(addr));
932 + freed += PAGE_SIZE;
935 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
937 + return freed >> PAGE_SHIFT;
939 diff -urN linux.old/arch/mips/ar7/misc.c linux.dev/arch/mips/ar7/misc.c
940 --- linux.old/arch/mips/ar7/misc.c 1970-01-01 01:00:00.000000000 +0100
941 +++ linux.dev/arch/mips/ar7/misc.c 2005-11-10 01:12:43.946955500 +0100
943 +#include <asm/ar7/sangam.h>
944 +#include <asm/ar7/avalanche_misc.h>
945 +#include <linux/module.h>
946 +#include <linux/spinlock.h>
950 +static unsigned int avalanche_vbus_freq;
952 +REMOTE_VLYNQ_DEV_RESET_CTRL_FN p_remote_vlynq_dev_reset_ctrl = NULL;
954 +/*****************************************************************************
955 + * Reset Control Module.
956 + *****************************************************************************/
957 +void avalanche_reset_ctrl(unsigned int module_reset_bit,
958 + AVALANCHE_RESET_CTRL_T reset_ctrl)
960 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
962 + if(module_reset_bit >= 32 && module_reset_bit < 64)
965 + if(module_reset_bit >= 64)
967 + if(p_remote_vlynq_dev_reset_ctrl) {
968 + p_remote_vlynq_dev_reset_ctrl(module_reset_bit - 64, reset_ctrl);
975 + if(reset_ctrl == OUT_OF_RESET)
976 + *reset_reg |= 1 << module_reset_bit;
978 + *reset_reg &= ~(1 << module_reset_bit);
982 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(unsigned int module_reset_bit)
984 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
986 + return (((*reset_reg) & (1 << module_reset_bit)) ? OUT_OF_RESET : IN_RESET );
989 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode)
991 + volatile unsigned int *sw_reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_SWRCR;
992 + *sw_reset_reg = mode;
995 +#define AVALANCHE_RST_CTRL_RSR_MASK 0x3
997 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status()
999 + volatile unsigned int *sys_reset_status = (unsigned int*) AVALANCHE_RST_CTRL_RSR;
1001 + return ( (AVALANCHE_SYS_RESET_STATUS_T) (*sys_reset_status & AVALANCHE_RST_CTRL_RSR_MASK) );
1005 +/*****************************************************************************
1006 + * Power Control Module
1007 + *****************************************************************************/
1008 +#define AVALANCHE_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
1009 +#define AVALANCHE_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
1012 +void avalanche_power_ctrl(unsigned int module_power_bit, AVALANCHE_POWER_CTRL_T power_ctrl)
1014 + volatile unsigned int *power_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1016 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
1017 + /* power down the module */
1018 + *power_reg |= (1 << module_power_bit);
1020 + /* power on the module */
1021 + *power_reg &= (~(1 << module_power_bit));
1024 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int module_power_bit)
1026 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1028 + return (((*power_status_reg) & (1 << module_power_bit)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP);
1031 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode)
1033 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1035 + *power_status_reg &= AVALANCHE_GLOBAL_POWER_DOWN_MASK;
1036 + *power_status_reg |= ( power_mode << AVALANCHE_GLOBAL_POWER_DOWN_BIT);
1039 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void)
1041 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1043 + return((AVALANCHE_SYS_POWER_MODE_T) (((*power_status_reg) & (~AVALANCHE_GLOBAL_POWER_DOWN_MASK))
1044 + >> AVALANCHE_GLOBAL_POWER_DOWN_BIT));
1047 +/*****************************************************************************
1049 + *****************************************************************************/
1051 +/****************************************************************************
1052 + * FUNCTION: avalanche_gpio_init
1053 + ***************************************************************************/
1054 +void avalanche_gpio_init(void)
1056 + spinlock_t closeLock;
1057 + unsigned int closeFlag;
1058 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
1059 + spin_lock_irqsave(&closeLock, closeFlag);
1060 + *reset_reg |= (1 << AVALANCHE_GPIO_RESET_BIT);
1061 + spin_unlock_irqrestore(&closeLock, closeFlag);
1064 +/****************************************************************************
1065 + * FUNCTION: avalanche_gpio_ctrl
1066 + ***************************************************************************/
1067 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
1068 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
1069 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction)
1071 + spinlock_t closeLock;
1072 + unsigned int closeFlag;
1073 + volatile unsigned int *gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_ENBL;
1075 + if(gpio_pin >= 32)
1078 + spin_lock_irqsave(&closeLock, closeFlag);
1080 + if(pin_mode == GPIO_PIN)
1082 + *gpio_ctrl |= (1 << gpio_pin);
1084 + gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_DIR;
1086 + if(pin_direction == GPIO_INPUT_PIN)
1087 + *gpio_ctrl |= (1 << gpio_pin);
1089 + *gpio_ctrl &= ~(1 << gpio_pin);
1091 + else /* FUNCTIONAL PIN */
1093 + *gpio_ctrl &= ~(1 << gpio_pin);
1096 + spin_unlock_irqrestore(&closeLock, closeFlag);
1101 +/****************************************************************************
1102 + * FUNCTION: avalanche_gpio_out
1103 + ***************************************************************************/
1104 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value)
1106 + spinlock_t closeLock;
1107 + unsigned int closeFlag;
1108 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
1110 + if(gpio_pin >= 32)
1113 + spin_lock_irqsave(&closeLock, closeFlag);
1115 + *gpio_out |= 1 << gpio_pin;
1117 + *gpio_out &= ~(1 << gpio_pin);
1118 + spin_unlock_irqrestore(&closeLock, closeFlag);
1123 +/****************************************************************************
1124 + * FUNCTION: avalanche_gpio_in
1125 + ***************************************************************************/
1126 +int avalanche_gpio_in_bit(unsigned int gpio_pin)
1128 + spinlock_t closeLock;
1129 + unsigned int closeFlag;
1130 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
1133 + if(gpio_pin >= 32)
1136 + spin_lock_irqsave(&closeLock, closeFlag);
1137 + ret_val = ((*gpio_in) & (1 << gpio_pin));
1138 + spin_unlock_irqrestore(&closeLock, closeFlag);
1143 +/****************************************************************************
1144 + * FUNCTION: avalanche_gpio_out_val
1145 + ***************************************************************************/
1146 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int out_mask,
1147 + unsigned int reg_index)
1149 + spinlock_t closeLock;
1150 + unsigned int closeFlag;
1151 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
1156 + spin_lock_irqsave(&closeLock, closeFlag);
1157 + *gpio_out &= ~out_mask;
1158 + *gpio_out |= out_val;
1159 + spin_unlock_irqrestore(&closeLock, closeFlag);
1164 +/****************************************************************************
1165 + * FUNCTION: avalanche_gpio_in_value
1166 + ***************************************************************************/
1167 +int avalanche_gpio_in_value(unsigned int* in_val, unsigned int reg_index)
1169 + spinlock_t closeLock;
1170 + unsigned int closeFlag;
1171 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
1176 + spin_lock_irqsave(&closeLock, closeFlag);
1177 + *in_val = *gpio_in;
1178 + spin_unlock_irqrestore(&closeLock, closeFlag);
1183 +/***********************************************************************
1185 + * Wakeup Control Module for TNETV1050 Communication Processor
1187 + ***********************************************************************/
1189 +#define AVALANCHE_WAKEUP_POLARITY_BIT 16
1191 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
1192 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
1193 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity)
1195 + volatile unsigned int *wakeup_status_reg = (unsigned int*) AVALANCHE_WAKEUP_CTRL_WKCR;
1197 + /* enable/disable */
1198 + if (wakeup_ctrl == WAKEUP_ENABLED)
1199 + /* enable wakeup */
1200 + *wakeup_status_reg |= wakeup_int;
1202 + /* disable wakeup */
1203 + *wakeup_status_reg &= (~wakeup_int);
1205 + /* set polarity */
1206 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
1207 + *wakeup_status_reg |= (wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
1209 + *wakeup_status_reg &= ~(wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
1212 +void avalanche_set_vbus_freq(unsigned int new_vbus_freq)
1214 + avalanche_vbus_freq = new_vbus_freq;
1217 +unsigned int avalanche_get_vbus_freq()
1219 + return(avalanche_vbus_freq);
1222 +unsigned int avalanche_get_chip_version_info()
1224 + return(*(volatile unsigned int*)AVALANCHE_CVR);
1227 +SET_MDIX_ON_CHIP_FN_T p_set_mdix_on_chip_fn = NULL;
1229 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation)
1231 + if(p_set_mdix_on_chip_fn)
1232 + return (p_set_mdix_on_chip_fn(base_addr, operation));
1237 +unsigned int avalanche_is_mdix_on_chip(void)
1239 + return(p_set_mdix_on_chip_fn ? 1:0);
1242 +EXPORT_SYMBOL(avalanche_reset_ctrl);
1243 +EXPORT_SYMBOL(avalanche_get_reset_status);
1244 +EXPORT_SYMBOL(avalanche_sys_reset);
1245 +EXPORT_SYMBOL(avalanche_get_sys_last_reset_status);
1246 +EXPORT_SYMBOL(avalanche_power_ctrl);
1247 +EXPORT_SYMBOL(avalanche_get_power_status);
1248 +EXPORT_SYMBOL(avalanche_set_global_power_mode);
1249 +EXPORT_SYMBOL(avalanche_get_global_power_mode);
1250 +EXPORT_SYMBOL(avalanche_set_mdix_on_chip);
1251 +EXPORT_SYMBOL(avalanche_is_mdix_on_chip);
1253 +EXPORT_SYMBOL(avalanche_gpio_init);
1254 +EXPORT_SYMBOL(avalanche_gpio_ctrl);
1255 +EXPORT_SYMBOL(avalanche_gpio_out_bit);
1256 +EXPORT_SYMBOL(avalanche_gpio_in_bit);
1257 +EXPORT_SYMBOL(avalanche_gpio_out_value);
1258 +EXPORT_SYMBOL(avalanche_gpio_in_value);
1260 +EXPORT_SYMBOL(avalanche_set_vbus_freq);
1261 +EXPORT_SYMBOL(avalanche_get_vbus_freq);
1263 +EXPORT_SYMBOL(avalanche_get_chip_version_info);
1265 diff -urN linux.old/arch/mips/ar7/platform.h linux.dev/arch/mips/ar7/platform.h
1266 --- linux.old/arch/mips/ar7/platform.h 1970-01-01 01:00:00.000000000 +0100
1267 +++ linux.dev/arch/mips/ar7/platform.h 2005-11-10 01:10:45.799571750 +0100
1269 +#ifndef _PLATFORM_H_
1270 +#define _PLATFORM_H_
1272 +#include <linux/config.h>
1275 +/* Important: The definition of ENV_SPACE_SIZE should match with that in
1276 + * PSPBoot. (/psp_boot/inc/psbl/env.h)
1278 +#ifdef CONFIG_MIPS_AVALANCHE_TICFG
1279 +#define ENV_SPACE_SIZE (10 * 1024)
1282 +#ifdef CONFIG_MIPS_TNETV1050SDB
1283 +#define TNETV1050SDB
1287 +#ifdef CONFIG_MIPS_AR7DB
1288 +#define TNETD73XX_BOARD
1292 +#ifdef CONFIG_MIPS_AR7RD
1293 +#define TNETD73XX_BOARD
1297 +#ifdef CONFIG_AR7WRD
1298 +#define TNETD73XX_BOARD
1302 +#ifdef CONFIG_MIPS_AR7VWI
1303 +#define TNETD73XX_BOARD
1307 +/* Merging from the DEV_DSL-PSPL4.3.2.7_Patch release. */
1308 +#ifdef CONFIG_MIPS_AR7VW
1309 +#define TNETD73XX_BOARD
1313 +#ifdef CONFIG_MIPS_AR7WI
1314 +#define TNETD73XX_BOARD
1318 +#ifdef CONFIG_MIPS_AR7V
1319 +#define TNETD73XX_BOARD
1323 +#ifdef CONFIG_MIPS_AR7V
1324 +#define TNETD73XX_BOARD
1328 +#ifdef CONFIG_MIPS_WA1130
1334 diff -urN linux.old/arch/mips/ar7/promlib.c linux.dev/arch/mips/ar7/promlib.c
1335 --- linux.old/arch/mips/ar7/promlib.c 1970-01-01 01:00:00.000000000 +0100
1336 +++ linux.dev/arch/mips/ar7/promlib.c 2005-11-10 01:14:16.372731750 +0100
1339 + * Carsten Langgaard, carstenl@mips.com
1340 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1342 + * This program is free software; you can distribute it and/or modify it
1343 + * under the terms of the GNU General Public License (Version 2) as
1344 + * published by the Free Software Foundation.
1346 + * This program is distributed in the hope it will be useful, but WITHOUT
1347 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1348 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1349 + * for more details.
1351 + * You should have received a copy of the GNU General Public License along
1352 + * with this program; if not, write to the Free Software Foundation, Inc.,
1353 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1355 + * Putting things on the screen/serial line using Adam2 facilities.
1358 +#include <linux/types.h>
1359 +#include <asm/addrspace.h>
1361 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
1362 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR \
1363 + (AVALANCHE_YAMON_FUNCTION_BASE + 1 * 0x4)
1364 +#define AVALANCHE_YAMON_PROM_EXIT \
1365 + (AVALANCHE_YAMON_FUNCTION_BASE + 8 * 0x4)
1367 +void prom_putchar(char c)
1369 + static char buf[1];
1370 + void (*prom_print_str)(unsigned int dummy, char *s, int len) =
1371 + (void *)(*(uint32_t *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR);
1374 + prom_print_str(1, buf, 1);
1378 +void adam2_exit(int retval)
1380 + void (*yamon_exit)(int retval) =
1381 + (void *)(*(uint32_t *)AVALANCHE_YAMON_PROM_EXIT);
1383 + yamon_exit(retval);
1386 diff -urN linux.old/arch/mips/ar7/psp_env.c linux.dev/arch/mips/ar7/psp_env.c
1387 --- linux.old/arch/mips/ar7/psp_env.c 1970-01-01 01:00:00.000000000 +0100
1388 +++ linux.dev/arch/mips/ar7/psp_env.c 2005-11-10 01:10:45.799571750 +0100
1390 +#include <linux/config.h>
1391 +#include <linux/init.h>
1392 +#include <linux/string.h>
1393 +#include <linux/kernel.h>
1394 +#include <linux/module.h>
1395 +#include <asm/io.h>
1397 +#include "platform.h"
1399 +#define ENV_CELL_SIZE 16
1401 +/* control field decode */
1402 +#define ENV_GARBAGE_BIT 0x01 /* Env is garbage if this bit is off */
1403 +#define ENV_DYNAMIC_BIT 0x02 /* Env is dynamic if this bit is off */
1405 +#define ENV_CTRL_MASK 0x03
1406 +#define ENV_PREFINED (ENV_GARBAGE_BIT | ENV_DYNAMIC_BIT)
1407 +#define ENV_DYNAMIC (ENV_GARBAGE_BIT)
1409 +struct env_variable {
1410 + unsigned char varNum;
1411 + unsigned char ctrl;
1412 + unsigned short chksum;
1413 + unsigned char numCells;
1414 + unsigned char data[ENV_CELL_SIZE - 5]; /* The data section starts
1415 + * here, continues for
1420 +extern unsigned int max_env_entry;
1422 +/* Internal macros */
1423 +#define get_next_block(var) ((struct env_variable *)( (char*)(var) + (var)->numCells * ENV_CELL_SIZE))
1425 +typedef enum ENV_VARS {
1426 + env_vars_start = 0,
1435 +#if !defined (AVALANCHE) || defined(TNETC401B)
1438 +#if !defined(TNETV1020_BOARD)
1441 +#if defined (TNETD73XX_BOARD)
1447 +#if !defined (AVALANCHE) || defined(TNETC401B)
1450 +#if !defined(TNETV1020_BOARD)
1453 +#if defined (TNETD73XX_BOARD)
1456 +#if !defined(TNETV1020_BOARD)
1463 +#if defined (TNETV1050_BOARD)
1466 +#if !defined(TNETV1020_BOARD)
1468 + HWA_HRNDIS, /* Host (PC) side RNDIS address */
1475 +#ifndef AVALANCHE /* Avalanche boards use only one mac port */
1488 +#if defined (TNETV1050_BOARD)
1492 + * Add new env variables here.
1493 + * NOTE: New environment variables should always be placed at the end, ie
1494 + * just before env_vars_end.
1501 +struct env_description {
1507 +#define ENVSTR(x) #x
1508 +#define _ENV_ENTRY(x) {.idx = x, .nm = ENVSTR(x), .alias = NULL}
1510 +struct env_description env_ns[] = {
1511 + _ENV_ENTRY(env_vars_start), /* start. */
1512 + _ENV_ENTRY(CPUFREQ),
1513 + _ENV_ENTRY(MEMSZ),
1514 + _ENV_ENTRY(FLASHSZ),
1515 + _ENV_ENTRY(MODETTY0),
1516 + _ENV_ENTRY(MODETTY1),
1517 + _ENV_ENTRY(PROMPT),
1518 + _ENV_ENTRY(BOOTCFG),
1519 + _ENV_ENTRY(HWA_0),
1520 +#if !defined (AVALANCHE) || defined(TNETC401B)
1521 + _ENV_ENTRY(HWA_1),
1523 +#if !defined(TNETV1020_BOARD)
1524 + _ENV_ENTRY(HWA_RNDIS),
1526 +#if defined (TNETD73XX_BOARD)
1527 + _ENV_ENTRY(HWA_3),
1530 + _ENV_ENTRY(IPA_SVR),
1531 + _ENV_ENTRY(IPA_GATEWAY),
1532 + _ENV_ENTRY(SUBNET_MASK),
1533 + _ENV_ENTRY(BLINE_MAC0),
1534 +#if !defined (AVALANCHE) || defined(TNETC401B)
1535 + _ENV_ENTRY(BLINE_MAC1),
1537 +#if !defined(TNETV1020_BOARD)
1538 + _ENV_ENTRY(BLINE_RNDIS),
1540 +#if defined (TNETD73XX_BOARD)
1541 + _ENV_ENTRY(BLINE_ATM),
1543 +#if !defined(TNETV1020_BOARD)
1544 + _ENV_ENTRY(USB_PID),
1545 + _ENV_ENTRY(USB_VID),
1546 + _ENV_ENTRY(USB_EPPOLLI),
1548 +#if defined (TNETV1050_BOARD)
1549 + _ENV_ENTRY(BLINE_ESWITCH),
1551 +#if !defined(TNETV1020_BOARD)
1552 + _ENV_ENTRY(USB_SERIAL),
1553 + _ENV_ENTRY(HWA_HRNDIS),
1555 + _ENV_ENTRY(REMOTE_USER),
1556 + _ENV_ENTRY(REMOTE_PASS),
1557 + _ENV_ENTRY(REMOTE_DIR),
1558 + _ENV_ENTRY(SYSFREQ),
1559 + _ENV_ENTRY(LINK_TIMEOUT),
1560 +#ifndef AVALANCHE /* Avalanche boards use only one mac port */
1561 + _ENV_ENTRY(MAC_PORT),
1564 + _ENV_ENTRY(HOSTNAME),
1566 + _ENV_ENTRY(HW_REV_MAJOR),
1567 + _ENV_ENTRY(HW_REV_MINOR),
1568 + _ENV_ENTRY(HW_PATCH),
1569 + _ENV_ENTRY(SW_PATCH),
1570 + _ENV_ENTRY(SERIAL_NUMBER),
1572 + _ENV_ENTRY(TFTPCFG),
1573 +#if defined (TNETV1050_BOARD)
1574 + _ENV_ENTRY(HWA_ESWITCH),
1577 + * Add new entries below this.
1579 + /* Adam2 environment name alias. */
1580 + { .idx = IPA, .nm = "my_ipaddress" },
1581 + { .idx = CPUFREQ, .nm = "cpufrequency" },
1582 + { .idx = SYSFREQ, .nm = "sysfrequency" },
1583 + { .idx = HWA_0, .nm = "maca" },
1585 + { .idx = HWA_1, .nm = "macb" },
1587 + { .idx = MODETTY0, .nm = "modetty0" },
1588 + { .idx = MODETTY1, .nm = "modetty1" },
1589 + { .idx = MEMSZ, .nm = "memsize" },
1591 + _ENV_ENTRY(env_vars_end) /* delimiter. */
1594 +static inline int var_to_idx(const char* var)
1598 + /* go over the list of pre-defined environment variables */
1599 + for (ii = env_vars_start; env_ns[ii].idx != env_vars_end; ii++){
1600 + /* check if the env variable is listed */
1601 + if (strcmp(env_ns[ii].nm, var) == 0) {
1602 + return env_ns[ii].idx;
1605 + /* if an alias is present, check if the alias matches
1608 + if (env_ns[ii].alias != NULL) {
1609 + if (strcmp(env_ns[ii].alias, var) == 0) {
1610 + return env_ns[ii].idx;
1617 +extern int *_prom_envp;
1619 +/* FIXME: reading from the flash is extremly unstable. Sometime a read returns garbage,
1620 + * the next read some seconds later is ok. It looks like something is hidding or
1621 + * overlay the flash address at 0xb0000000. Is this possible?
1623 + * The readb() and while() usage below is a attempt of a workarround - with limited success.
1626 +static inline struct env_variable* get_var_by_number(int index)
1628 + struct env_variable *env_var = (struct env_variable *)_prom_envp;
1629 + volatile unsigned char nr;
1632 + env_var++; /* skip signature */
1635 + nr = readb(&(env_var->varNum));
1637 + while (i < max_env_entry && nr != 0xFF) {
1638 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_PREFINED) {
1639 + if (nr == index) {
1644 + env_var = get_next_block(env_var);
1645 + nr = readb(&(env_var->varNum));
1651 +static inline struct env_variable* get_var_by_name(char *var)
1653 + struct env_variable *env_var = (struct env_variable *)_prom_envp;
1654 + volatile unsigned char nr;
1657 + env_var++; /* skip signature */
1659 + nr = readb(&(env_var->varNum));
1662 + while (i < max_env_entry && nr != 0xFF) {
1663 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_DYNAMIC) {
1664 + if (strcmp(var, env_var->data) == 0)
1668 + env_var = get_next_block(env_var);
1669 + nr = readb(&(env_var->varNum));
1674 +static inline struct env_variable* get_var(char *var)
1676 + int index = var_to_idx(var);
1679 + return get_var_by_number(index);
1681 + return get_var_by_name(var);
1686 +static inline char *get_value(struct env_variable* env_var)
1688 + unsigned char *name;
1689 + unsigned char *value;
1690 + unsigned short chksum;
1693 + chksum = env_var->varNum + env_var->ctrl + env_var->numCells;
1695 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_DYNAMIC) {
1696 + name = env_var->data;
1697 + value = env_var->data + strlen(name) + 1;
1699 + for(i = 0; i < strlen(name); i++)
1700 + chksum += name[i];
1702 + value = env_var->data;
1704 + for (i = 0; i < strlen(value); i++)
1705 + chksum += value[i];
1707 + chksum += env_var->chksum;
1708 + chksum = ~(chksum);
1718 + unsigned int psbl_size;
1719 + unsigned int env_base;
1720 + unsigned int env_size;
1721 + unsigned int ffs_base;
1722 + unsigned int ffs_size;
1725 +char *prom_psp_getenv(char *envname)
1727 + struct env_variable* env_var;
1730 + if (strcmp("bootloader", envname) == 0)
1733 + if (!(env_var = get_var(envname)))
1736 + value = get_value(env_var);
1740 diff -urN linux.old/arch/mips/ar7/reset.c linux.dev/arch/mips/ar7/reset.c
1741 --- linux.old/arch/mips/ar7/reset.c 1970-01-01 01:00:00.000000000 +0100
1742 +++ linux.dev/arch/mips/ar7/reset.c 2005-11-10 01:14:16.372731750 +0100
1745 + * Carsten Langgaard, carstenl@mips.com
1746 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1748 + * ########################################################################
1750 + * This program is free software; you can distribute it and/or modify it
1751 + * under the terms of the GNU General Public License (Version 2) as
1752 + * published by the Free Software Foundation.
1754 + * This program is distributed in the hope it will be useful, but WITHOUT
1755 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1756 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1757 + * for more details.
1759 + * You should have received a copy of the GNU General Public License along
1760 + * with this program; if not, write to the Free Software Foundation, Inc.,
1761 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1763 + * ########################################################################
1765 + * Reset the AR7 boards.
1769 +#include <linux/init.h>
1770 +#include <linux/kernel.h>
1771 +#include <linux/string.h>
1772 +#include <linux/types.h>
1774 +#include <asm/mipsregs.h>
1775 +#include <asm/reboot.h>
1776 +#include <asm/addrspace.h>
1778 +int preserve_adam2 = 1;
1780 +extern void adam2_exit(int retval);
1782 +static void ar7_machine_restart(char *command);
1783 +static void ar7_machine_halt(void);
1784 +static void ar7_machine_power_off(void);
1786 +static void ar7_machine_restart(char *command)
1788 + volatile uint32_t *softres_reg = (void *)(KSEG1ADDR(0x08611600 + 0x4));
1793 +static void ar7_machine_halt(void)
1796 + if (preserve_adam2) {
1797 + set_c0_status(ST0_BEV);
1800 + /* I'd like to have Alt-SysRq-b work in this state.
1801 + * What's missing here? The timer interrupt is still running.
1802 + * Why doesn't the UART work anymore? */
1804 + __asm__(".set\tmips3\n\t"
1811 +static void ar7_machine_power_off(void)
1813 + volatile uint32_t *power_reg = (void *)(KSEG1ADDR(0x08610A00));
1814 + uint32_t power_state = *power_reg;
1816 + /* add something to turn LEDs off? */
1818 + power_state &= ~(3 << 30);
1819 + power_state |= (3 << 30); /* power down */
1820 + *power_reg = power_state;
1822 + printk("after power down?\n");
1825 +void ar7_reboot_setup(void)
1827 + _machine_restart = ar7_machine_restart;
1828 + _machine_halt = ar7_machine_halt;
1829 + _machine_power_off = ar7_machine_power_off;
1832 +static int __init ar7_do_preserve_adam2(char *s)
1834 + if (!strcmp(s, "no") || !strcmp(s, "0"))
1835 + preserve_adam2 = 0;
1837 + preserve_adam2 = 1;
1841 +__setup("adam2=", ar7_do_preserve_adam2);
1842 diff -urN linux.old/arch/mips/ar7/setup.c linux.dev/arch/mips/ar7/setup.c
1843 --- linux.old/arch/mips/ar7/setup.c 1970-01-01 01:00:00.000000000 +0100
1844 +++ linux.dev/arch/mips/ar7/setup.c 2005-11-10 01:12:43.946955500 +0100
1847 + * Carsten Langgaard, carstenl@mips.com
1848 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
1850 + * This program is free software; you can distribute it and/or modify it
1851 + * under the terms of the GNU General Public License (Version 2) as
1852 + * published by the Free Software Foundation.
1854 + * This program is distributed in the hope it will be useful, but WITHOUT
1855 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1856 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1857 + * for more details.
1859 + * You should have received a copy of the GNU General Public License along
1860 + * with this program; if not, write to the Free Software Foundation, Inc.,
1861 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1864 +#include <linux/config.h>
1865 +#include <linux/init.h>
1866 +#include <linux/string.h>
1867 +#include <linux/irq.h>
1869 +#include <asm/processor.h>
1870 +#include <asm/irq.h>
1871 +#include <asm/irq_cpu.h>
1872 +#include <asm/time.h>
1873 +#include <asm/mipsregs.h>
1874 +#include <asm/mips-boards/prom.h>
1877 +extern void rs_kgdb_hook(int);
1878 +extern void breakpoint(void);
1879 +int remote_debug = 0;
1882 +extern void ar7_reboot_setup(void);
1883 +extern void ar7_irq_init(int);
1884 +extern asmlinkage void ar7IRQ(void);
1886 +void ar7_time_init(void)
1889 + mips_hpt_frequency = CONFIG_AR7_CPU * 500000;
1892 +void ar7_timer_setup(struct irqaction *irq)
1894 + setup_irq(7, irq);
1895 + set_c0_status(IE_IRQ5);
1898 +void __init init_IRQ(void)
1900 + init_generic_irq();
1901 + mips_cpu_irq_init(0);
1904 + /* Now safe to set the exception vector. */
1905 + set_except_vector(0, ar7IRQ);
1910 + set_debug_traps();
1916 +const char *get_system_type(void)
1918 + return "Texas Instruments AR7";
1921 +void __init ar7_setup(void)
1924 + int rs_putDebugChar(char);
1925 + char rs_getDebugChar(void);
1926 + extern int (*generic_putDebugChar)(char);
1927 + extern char (*generic_getDebugChar)(void);
1930 +#ifdef CONFIG_SERIAL_CONSOLE
1931 + argptr = prom_getcmdline();
1932 + if ((argptr = strstr(argptr, "console=")) == NULL) {
1937 + s = prom_getenv("modetty0");
1938 + strcpy(console, "38400");
1941 + while (s[i] >= '0' && s[i] <= '9')
1945 + strncpy(console, s, i);
1950 + argptr = prom_getcmdline();
1951 + strcat(argptr, " console=ttyS0,");
1952 + strcat(argptr, console);
1957 + argptr = prom_getcmdline();
1958 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
1960 + argptr += strlen("kgdb=ttyS");
1961 + if (*argptr != '0' && *argptr != '1')
1962 + printk("KGDB: Uknown serial line /dev/ttyS%c, "
1963 + "falling back to /dev/ttyS1\n", *argptr);
1964 + line = *argptr == '0' ? 0 : 1;
1965 + printk("KGDB: Using serial line /dev/ttyS%d for session\n",
1968 + rs_kgdb_hook(line);
1969 + generic_putDebugChar = rs_putDebugChar;
1970 + generic_getDebugChar = rs_getDebugChar;
1972 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
1973 + "please connect your debugger\n", line ? 1 : 0);
1976 + /* Breakpoints are in init_IRQ() */
1980 + argptr = prom_getcmdline();
1981 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
1982 + cpu_data[0].options &= ~MIPS_CPU_FPU;
1984 + ar7_reboot_setup();
1986 + board_time_init = ar7_time_init;
1987 + board_timer_setup = ar7_timer_setup;
1989 diff -urN linux.old/arch/mips/ar7/tnetd73xx_misc.c linux.dev/arch/mips/ar7/tnetd73xx_misc.c
1990 --- linux.old/arch/mips/ar7/tnetd73xx_misc.c 1970-01-01 01:00:00.000000000 +0100
1991 +++ linux.dev/arch/mips/ar7/tnetd73xx_misc.c 2005-11-10 01:12:43.946955500 +0100
1993 +/******************************************************************************
1994 + * FILE PURPOSE: TNETD73xx Misc modules API Source
1995 + ******************************************************************************
1996 + * FILE NAME: tnetd73xx_misc.c
1998 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
1999 + * FSER Modules API
2000 + * As per TNETD73xx specifications
2002 + * REVISION HISTORY:
2003 + * 27 Nov 02 - Sharath Kumar PSP TII
2004 + * 14 Feb 03 - Anant Gole PSP TII
2006 + * (C) Copyright 2002, Texas Instruments, Inc
2007 + *******************************************************************************/
2009 +#include <linux/types.h>
2010 +#include <asm/ar7/tnetd73xx.h>
2011 +#include <asm/ar7/tnetd73xx_misc.h>
2013 +/* TNETD73XX Revision */
2014 +u32 tnetd73xx_get_revision(void)
2016 + /* Read Chip revision register - This register is from GPIO module */
2017 + return ( (u32) REG32_DATA(TNETD73XX_CVR));
2020 +/*****************************************************************************
2021 + * Reset Control Module
2022 + *****************************************************************************/
2025 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module, TNETD73XX_RESET_CTRL_T reset_ctrl)
2029 + /* read current reset register */
2030 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2032 + if (reset_ctrl == OUT_OF_RESET)
2034 + /* bring module out of reset */
2035 + reset_status |= (1 << reset_module);
2039 + /* put module in reset */
2040 + reset_status &= (~(1 << reset_module));
2043 + /* write to the reset register */
2044 + REG32_WRITE(TNETD73XX_RST_CTRL_PRCR, reset_status);
2048 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status (TNETD73XX_RESET_MODULE_T reset_module)
2052 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2053 + return ( (reset_status & (1 << reset_module)) ? OUT_OF_RESET : IN_RESET );
2056 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode)
2058 + REG32_WRITE(TNETD73XX_RST_CTRL_SWRCR, mode);
2061 +#define TNETD73XX_RST_CTRL_RSR_MASK 0x3
2063 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status()
2065 + u32 sys_reset_status;
2067 + REG32_READ(TNETD73XX_RST_CTRL_RSR, sys_reset_status);
2069 + return ( (TNETD73XX_SYS_RESET_STATUS_T) (sys_reset_status & TNETD73XX_RST_CTRL_RSR_MASK) );
2073 +/*****************************************************************************
2074 + * Power Control Module
2075 + *****************************************************************************/
2076 +#define TNETD73XX_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
2077 +#define TNETD73XX_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
2080 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl)
2084 + /* read current power down control register */
2085 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2087 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
2089 + /* power down the module */
2090 + power_status |= (1 << power_module);
2094 + /* power on the module */
2095 + power_status &= (~(1 << power_module));
2098 + /* write to the reset register */
2099 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2102 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module)
2106 + /* read current power down control register */
2107 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2109 + return ( (power_status & (1 << power_module)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP );
2112 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode)
2116 + /* read current power down control register */
2117 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2119 + power_status &= TNETD73XX_GLOBAL_POWER_DOWN_MASK;
2120 + power_status |= ( power_mode << TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2122 + /* write to power down control register */
2123 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2126 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode()
2130 + /* read current power down control register */
2131 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2133 + power_status &= (~TNETD73XX_GLOBAL_POWER_DOWN_MASK);
2134 + power_status = ( power_status >> TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2136 + return ( (TNETD73XX_SYS_POWER_MODE_T) power_status );
2140 +/*****************************************************************************
2142 + *****************************************************************************/
2144 +#define TNETD73XX_WAKEUP_POLARITY_BIT 16
2146 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
2147 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
2148 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity)
2150 + u32 wakeup_status;
2152 + /* read the wakeup control register */
2153 + REG32_READ(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2155 + /* enable/disable */
2156 + if (wakeup_ctrl == WAKEUP_ENABLED)
2158 + /* enable wakeup */
2159 + wakeup_status |= wakeup_int;
2163 + /* disable wakeup */
2164 + wakeup_status &= (~wakeup_int);
2167 + /* set polarity */
2168 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
2170 + wakeup_status |= (wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2174 + wakeup_status &= ~(wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2177 + /* write the wakeup control register */
2178 + REG32_WRITE(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2182 +/*****************************************************************************
2184 + *****************************************************************************/
2186 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode)
2188 + REG32_WRITE(TNETD73XX_FSER_BASE, fser_mode);
2191 +/*****************************************************************************
2193 + *****************************************************************************/
2195 +#define MIN(x,y) ( ((x) < (y)) ? (x) : (y) )
2196 +#define MAX(x,y) ( ((x) > (y)) ? (x) : (y) )
2197 +#define ABS(x) ( ((signed)(x) > 0) ? (x) : (-(x)) )
2198 +#define CEIL(x,y) ( ((x) + (y) / 2) / (y) )
2200 +#define CLKC_CLKCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x20 + (0x20 * (x)))
2201 +#define CLKC_CLKPLLCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x30 + (0x20 * (x)))
2203 +#define CLKC_PRE_DIVIDER 0x0000001F
2204 +#define CLKC_POST_DIVIDER 0x001F0000
2206 +#define CLKC_PLL_STATUS 0x1
2207 +#define CLKC_PLL_FACTOR 0x0000F000
2209 +#define BOOTCR_PLL_BYPASS (1 << 5)
2210 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
2212 +#define MIPS_PLL_SELECT 0x00030000
2213 +#define SYSTEM_PLL_SELECT 0x0000C000
2214 +#define USB_PLL_SELECT 0x000C0000
2215 +#define ADSLSS_PLL_SELECT 0x00C00000
2217 +#define MIPS_AFECLKI_SELECT 0x00000000
2218 +#define MIPS_REFCLKI_SELECT 0x00010000
2219 +#define MIPS_XTAL3IN_SELECT 0x00020000
2221 +#define SYSTEM_AFECLKI_SELECT 0x00000000
2222 +#define SYSTEM_REFCLKI_SELECT 0x00004000
2223 +#define SYSTEM_XTAL3IN_SELECT 0x00008000
2224 +#define SYSTEM_MIPSPLL_SELECT 0x0000C000
2226 +#define USB_SYSPLL_SELECT 0x00000000
2227 +#define USB_REFCLKI_SELECT 0x00040000
2228 +#define USB_XTAL3IN_SELECT 0x00080000
2229 +#define USB_MIPSPLL_SELECT 0x000C0000
2231 +#define ADSLSS_AFECLKI_SELECT 0x00000000
2232 +#define ADSLSS_REFCLKI_SELECT 0x00400000
2233 +#define ADSLSS_XTAL3IN_SELECT 0x00800000
2234 +#define ADSLSS_MIPSPLL_SELECT 0x00C00000
2236 +#define SYS_MAX CLK_MHZ(150)
2237 +#define SYS_MIN CLK_MHZ(1)
2239 +#define MIPS_SYNC_MAX SYS_MAX
2240 +#define MIPS_ASYNC_MAX CLK_MHZ(160)
2241 +#define MIPS_MIN CLK_MHZ(1)
2243 +#define USB_MAX CLK_MHZ(100)
2244 +#define USB_MIN CLK_MHZ(1)
2246 +#define ADSL_MAX CLK_MHZ(180)
2247 +#define ADSL_MIN CLK_MHZ(1)
2249 +#define PLL_MUL_MAXFACTOR 15
2250 +#define MAX_DIV_VALUE 32
2251 +#define MIN_DIV_VALUE 1
2253 +#define MIN_PLL_INP_FREQ CLK_MHZ(8)
2254 +#define MAX_PLL_INP_FREQ CLK_MHZ(100)
2256 +#define DIVIDER_LOCK_TIME 10100
2257 +#define PLL_LOCK_TIME 10100 * 75
2261 + /****************************************************************************
2262 + * DATA PURPOSE: PRIVATE Variables
2263 + **************************************************************************/
2264 + static u32 *clk_src[4];
2265 + static u32 mips_pll_out;
2266 + static u32 sys_pll_out;
2267 + static u32 afeclk_inp;
2268 + static u32 refclk_inp;
2269 + static u32 xtal_inp;
2270 + static u32 present_min;
2271 + static u32 present_max;
2273 + /* Forward References */
2274 + static u32 find_gcd(u32 min, u32 max);
2275 + static u32 compute_prediv( u32 divider, u32 min, u32 max);
2276 + static void get_val(u32 base_freq, u32 output_freq,u32 *multiplier, u32 *divider);
2277 + static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id);
2278 + static void find_approx(u32 *,u32 *,u32);
2280 + /****************************************************************************
2281 + * FUNCTION: tnetd73xx_clkc_init
2282 + ****************************************************************************
2283 + * Description: The routine initializes the internal variables depending on
2284 + * on the sources selected for different clocks.
2285 + ***************************************************************************/
2286 +void tnetd73xx_clkc_init(u32 afeclk, u32 refclk, u32 xtal3in)
2291 + afeclk_inp = afeclk;
2292 + refclk_inp = refclk;
2293 + xtal_inp = xtal3in;
2295 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & MIPS_PLL_SELECT;
2298 + case MIPS_AFECLKI_SELECT:
2299 + clk_src[CLKC_MIPS] = &afeclk_inp;
2302 + case MIPS_REFCLKI_SELECT:
2303 + clk_src[CLKC_MIPS] = &refclk_inp;
2306 + case MIPS_XTAL3IN_SELECT:
2307 + clk_src[CLKC_MIPS] = &xtal_inp;
2311 + clk_src[CLKC_MIPS] = 0;
2315 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & SYSTEM_PLL_SELECT;
2318 + case SYSTEM_AFECLKI_SELECT:
2319 + clk_src[CLKC_SYS] = &afeclk_inp;
2322 + case SYSTEM_REFCLKI_SELECT:
2323 + clk_src[CLKC_SYS] = &refclk_inp;
2326 + case SYSTEM_XTAL3IN_SELECT:
2327 + clk_src[CLKC_SYS] = &xtal_inp;
2330 + case SYSTEM_MIPSPLL_SELECT:
2331 + clk_src[CLKC_SYS] = &mips_pll_out;
2335 + clk_src[CLKC_SYS] = 0;
2340 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & ADSLSS_PLL_SELECT;
2343 + case ADSLSS_AFECLKI_SELECT:
2344 + clk_src[CLKC_ADSLSS] = &afeclk_inp;
2347 + case ADSLSS_REFCLKI_SELECT:
2348 + clk_src[CLKC_ADSLSS] = &refclk_inp;
2351 + case ADSLSS_XTAL3IN_SELECT:
2352 + clk_src[CLKC_ADSLSS] = &xtal_inp;
2355 + case ADSLSS_MIPSPLL_SELECT:
2356 + clk_src[CLKC_ADSLSS] = &mips_pll_out;
2360 + clk_src[CLKC_ADSLSS] = 0;
2365 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & USB_PLL_SELECT;
2368 + case USB_SYSPLL_SELECT:
2369 + clk_src[CLKC_USB] = &sys_pll_out ;
2372 + case USB_REFCLKI_SELECT:
2373 + clk_src[CLKC_USB] = &refclk_inp;
2376 + case USB_XTAL3IN_SELECT:
2377 + clk_src[CLKC_USB] = &xtal_inp;
2380 + case USB_MIPSPLL_SELECT:
2381 + clk_src[CLKC_USB] = &mips_pll_out;
2385 + clk_src[CLKC_USB] = 0;
2392 +/****************************************************************************
2393 + * FUNCTION: tnetd73xx_clkc_set_freq
2394 + ****************************************************************************
2395 + * Description: The above routine is called to set the output_frequency of the
2396 + * selected clock(using clk_id) to the required value given
2397 + * by the variable output_freq.
2398 + ***************************************************************************/
2399 +TNETD73XX_ERR tnetd73xx_clkc_set_freq
2401 + TNETD73XX_CLKC_ID_T clk_id,
2414 + /* check if PLLs are bypassed*/
2415 + if(REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS)
2417 + return TNETD73XX_ERR_ERROR;
2420 + /*check if the requested output_frequency is in valid range*/
2424 + if( output_freq < SYS_MIN || output_freq > SYS_MAX)
2426 + return TNETD73XX_ERR_ERROR;
2428 + present_min = SYS_MIN;
2429 + present_max = SYS_MAX;
2433 + if((output_freq < MIPS_MIN) ||
2434 + (output_freq > ((REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX)))
2436 + return TNETD73XX_ERR_ERROR;
2438 + present_min = MIPS_MIN;
2439 + present_max = (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX;
2443 + if( output_freq < USB_MIN || output_freq > USB_MAX)
2445 + return TNETD73XX_ERR_ERROR;
2447 + present_min = USB_MIN;
2448 + present_max = USB_MAX;
2452 + if( output_freq < ADSL_MIN || output_freq > ADSL_MAX)
2454 + return TNETD73XX_ERR_ERROR;
2456 + present_min = ADSL_MIN;
2457 + present_max = ADSL_MAX;
2462 + base_freq = get_base_frequency(clk_id);
2465 + /* check for minimum base frequency value */
2466 + if( base_freq < MIN_PLL_INP_FREQ)
2468 + return TNETD73XX_ERR_ERROR;
2471 + get_val(output_freq, base_freq, &multiplier, ÷r);
2473 + /* check multiplier range */
2474 + if( (multiplier > PLL_MUL_MAXFACTOR) || (multiplier <= 0) )
2476 + return TNETD73XX_ERR_ERROR;
2479 + /* check divider value */
2480 + if( divider == 0 )
2482 + return TNETD73XX_ERR_ERROR;
2485 + /*compute minimum and maximum predivider values */
2486 + min_prediv = MAX(base_freq / MAX_PLL_INP_FREQ + 1, divider / MAX_DIV_VALUE + 1);
2487 + max_prediv = MIN(base_freq / MIN_PLL_INP_FREQ, MAX_DIV_VALUE);
2489 + /*adjust the value of divider so that it not less than minimum predivider value*/
2490 + if (divider < min_prediv)
2492 + temp = CEIL(min_prediv, divider);
2493 + if ((temp * multiplier) > PLL_MUL_MAXFACTOR)
2495 + return TNETD73XX_ERR_ERROR ;
2499 + multiplier = temp * multiplier;
2500 + divider = min_prediv;
2505 + /* compute predivider and postdivider values */
2506 + prediv = compute_prediv (divider, min_prediv, max_prediv);
2507 + postdiv = CEIL(divider,prediv);
2509 + /*return fail if postdivider value falls out of range */
2510 + if(postdiv > MAX_DIV_VALUE)
2512 + return TNETD73XX_ERR_ERROR;
2516 + /*write predivider and postdivider values*/
2517 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2518 + REG32_WRITE(CLKC_CLKCR(clk_id), ((postdiv -1) & 0x1F) << 16 | ((prediv -1) & 0x1F) );
2520 + /*wait for divider output to stabilise*/
2521 + for(temp =0; temp < DIVIDER_LOCK_TIME; temp++);
2523 + /*write to PLL clock register*/
2525 + if(clk_id == CLKC_SYS)
2527 + /* but before writing put DRAM to hold mode */
2528 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) |= 0x80000000;
2530 + /*Bring PLL into div mode */
2531 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), 0x4);
2533 + /*compute the word to be written to PLLCR
2534 + *corresponding to multiplier value
2536 + multiplier = (((multiplier - 1) & 0xf) << 12)| ((255 <<3) | 0x0e);
2538 + /* wait till PLL enters div mode */
2539 + while(REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2542 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), multiplier);
2544 + while(!REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2548 + /*wait for External pll to lock*/
2549 + for(temp =0; temp < PLL_LOCK_TIME; temp++);
2551 + if(clk_id == CLKC_SYS)
2553 + /* Bring DRAM out of hold */
2554 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) &= ~0x80000000;
2557 + return TNETD73XX_ERR_OK ;
2560 +/****************************************************************************
2561 + * FUNCTION: tnetd73xx_clkc_get_freq
2562 + ****************************************************************************
2563 + * Description: The above routine is called to get the output_frequency of the
2564 + * selected clock( clk_id)
2565 + ***************************************************************************/
2566 +u32 tnetd73xx_clkc_get_freq
2568 + TNETD73XX_CLKC_ID_T clk_id
2572 + u32 clk_ctrl_register;
2573 + u32 clk_pll_setting;
2574 + u32 clk_predivider;
2575 + u32 clk_postdivider;
2580 + base_freq = get_base_frequency(clk_id);
2582 + clk_ctrl_register = REG32_DATA(CLKC_CLKCR(clk_id));
2584 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2585 + clk_predivider = (CLKC_PRE_DIVIDER & clk_ctrl_register) + 1;
2586 + clk_postdivider = ((CLKC_POST_DIVIDER & clk_ctrl_register) >> 16) + 1;
2588 + divider = clk_predivider * clk_postdivider;
2591 + if( (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS))
2593 + return (CEIL(base_freq, divider)); /* PLLs bypassed.*/
2599 + /* return the current clock speed based upon the PLL setting */
2600 + clk_pll_setting = REG32_DATA(CLKC_CLKPLLCR(clk_id));
2602 + /* Get the PLL multiplication factor */
2603 + pll_factor = ((clk_pll_setting & CLKC_PLL_FACTOR) >> 12) + 1;
2605 + /* Check if we're in divide mode or multiply mode */
2606 + if((clk_pll_setting & 0x1) == 0)
2608 + /* We're in divide mode */
2609 + if(pll_factor < 0x10)
2610 + return (CEIL(base_freq >> 1, divider));
2612 + return (CEIL(base_freq >> 2, divider));
2615 + else /* We're in PLL mode */
2617 + /* See if PLLNDIV & PLLDIV are set */
2618 + if((clk_pll_setting & 0x0800) && (clk_pll_setting & 0x2))
2620 + if(clk_pll_setting & 0x1000)
2622 + /* clk = base_freq * k/2 */
2623 + return(CEIL((base_freq * pll_factor) >> 1, divider));
2627 + /* clk = base_freq * (k-1) / 4)*/
2628 + return(CEIL((base_freq * (pll_factor - 1)) >>2, divider));
2633 + if(pll_factor < 0x10)
2635 + /* clk = base_freq * k */
2636 + return(CEIL(base_freq * pll_factor, divider));
2641 + /* clk = base_freq */
2642 + return(CEIL(base_freq, divider));
2646 + return(0); /* Should never reach here */
2653 +/* local helper functions */
2655 +/****************************************************************************
2656 + * FUNCTION: get_base_frequency
2657 + ****************************************************************************
2658 + * Description: The above routine is called to get base frequency of the clocks.
2659 + ***************************************************************************/
2661 +static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id)
2663 + /* update the current MIPs PLL output value, if the required
2664 + * source is MIPS PLL
2666 + if ( clk_src[clk_id] == &mips_pll_out)
2668 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_MIPS);
2672 + /* update the current System PLL output value, if the required
2673 + * source is system PLL
2675 + if ( clk_src[clk_id] == &sys_pll_out)
2677 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_SYS);
2680 + return (*clk_src[clk_id]);
2686 +/****************************************************************************
2687 + * FUNCTION: find_gcd
2688 + ****************************************************************************
2689 + * Description: The above routine is called to find gcd of 2 numbers.
2690 + ***************************************************************************/
2691 +static u32 find_gcd
2697 + if (max % min == 0)
2703 + return find_gcd(max % min, min);
2707 +/****************************************************************************
2708 + * FUNCTION: compute_prediv
2709 + ****************************************************************************
2710 + * Description: The above routine is called to compute predivider value
2711 + ***************************************************************************/
2712 +static u32 compute_prediv(u32 divider, u32 min, u32 max)
2716 + /* return the divider itself it it falls within the range of predivider*/
2717 + if (min <= divider && divider <= max)
2722 + /* find a value for prediv such that it is a factor of divider */
2723 + for (prediv = max; prediv >= min ; prediv--)
2725 + if ( (divider % prediv) == 0 )
2731 + /* No such factor exists, return min as prediv */
2735 +/****************************************************************************
2736 + * FUNCTION: get_val
2737 + ****************************************************************************
2738 + * Description: This routine is called to get values of divider and multiplier.
2739 + ***************************************************************************/
2741 +static void get_val(u32 output_freq, u32 base_freq,u32 *multiplier, u32 *divider)
2749 + /* find gcd of base_freq, output_freq */
2750 + min_freq = (base_freq < output_freq) ? base_freq : output_freq;
2751 + max_freq = (base_freq > output_freq) ? base_freq : output_freq;
2752 + gcd = find_gcd(min_freq , max_freq);
2755 + return; /* ERROR */
2757 + /* compute values of multiplier and divider */
2758 + temp_mul = output_freq / gcd;
2759 + temp_div = base_freq / gcd;
2762 + /* set multiplier such that 1 <= multiplier <= PLL_MUL_MAXFACTOR */
2763 + if( temp_mul > PLL_MUL_MAXFACTOR )
2765 + if((temp_mul / temp_div) > PLL_MUL_MAXFACTOR)
2768 + find_approx(&temp_mul,&temp_div,base_freq);
2771 + *multiplier = temp_mul;
2772 + *divider = temp_div;
2775 +/****************************************************************************
2776 + * FUNCTION: find_approx
2777 + ****************************************************************************
2778 + * Description: This function gets the approx value of num/denom.
2779 + ***************************************************************************/
2781 +static void find_approx(u32 *num,u32 *denom,u32 base_freq)
2788 + int32_t prev_closest;
2798 + prev_closest = 0x7fffffff; /* maximum possible value */
2802 + /* start with max */
2803 + for(temp_num = 15; temp_num >=1; temp_num--)
2806 + temp_denom = CEIL(temp_num * denom1, num1);
2807 + output_freq = (temp_num * base_freq) / temp_denom;
2809 + if(temp_denom < 1)
2815 + normalize = CEIL(num1,temp_num);
2816 + closest = (ABS((num1 * (temp_denom) ) - (temp_num * denom1))) * normalize;
2817 + if(closest < prev_closest && output_freq > present_min && output_freq <present_max)
2819 + prev_closest = closest;
2821 + denom2 = temp_denom;
2828 + gcd = find_gcd(num2,denom2);
2829 + num2 = num2 / gcd;
2830 + denom2 = denom2 /gcd;
2837 +/*****************************************************************************
2839 + *****************************************************************************/
2841 +/****************************************************************************
2842 + * FUNCTION: tnetd73xx_gpio_init
2843 + ***************************************************************************/
2844 +void tnetd73xx_gpio_init()
2846 + /* Bring module out of reset */
2847 + tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
2848 + REG32_WRITE(TNETD73XX_GPIOENR, 0xFFFFFFFF);
2851 +/****************************************************************************
2852 + * FUNCTION: tnetd73xx_gpio_ctrl
2853 + ***************************************************************************/
2854 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
2855 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
2856 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction)
2859 + REG32_READ(TNETD73XX_GPIOENR, pin_status);
2860 + if (pin_mode == GPIO_PIN)
2862 + pin_status |= (1 << gpio_pin);
2863 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2865 + /* Set pin direction */
2866 + REG32_READ(TNETD73XX_GPIOPDIRR, pin_status);
2867 + if (pin_direction == GPIO_INPUT_PIN)
2869 + pin_status |= (1 << gpio_pin);
2871 + else /* GPIO_OUTPUT_PIN */
2873 + pin_status &= (~(1 << gpio_pin));
2875 + REG32_WRITE(TNETD73XX_GPIOPDIRR, pin_status);
2877 + else /* FUNCTIONAL PIN */
2879 + pin_status &= (~(1 << gpio_pin));
2880 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2885 +/****************************************************************************
2886 + * FUNCTION: tnetd73xx_gpio_out
2887 + ***************************************************************************/
2888 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value)
2892 + REG32_READ(TNETD73XX_GPIODOUTR, pin_value);
2895 + pin_value |= (1 << gpio_pin);
2899 + pin_value &= (~(1 << gpio_pin));
2901 + REG32_WRITE(TNETD73XX_GPIODOUTR, pin_value);
2904 +/****************************************************************************
2905 + * FUNCTION: tnetd73xx_gpio_in
2906 + ***************************************************************************/
2907 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin)
2910 + REG32_READ(TNETD73XX_GPIODINR, pin_value);
2911 + return ( (pin_value & (1 << gpio_pin)) ? 1 : 0 );
2914 diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared.in
2915 --- linux.old/arch/mips/config-shared.in 2005-10-21 16:43:18.917114000 +0200
2916 +++ linux.dev/arch/mips/config-shared.in 2005-11-10 01:12:43.950955750 +0100
2918 mainmenu_option next_comment
2919 comment 'Machine selection'
2920 dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL
2921 +dep_bool 'Support for Texas Instruments AR7 (EXPERIMENTAL)' CONFIG_AR7 $CONFIG_MIPS32 $CONFIG_EXPERIMENTAL
2922 +if [ "$CONFIG_AR7" = "y" ]; then
2923 + choice 'Texas Instruments Reference Platform' \
2924 + "AR7DB CONFIG_AR7DB \
2925 + AR7RD CONFIG_AR7RD \
2926 + AR7WRD CONFIG_AR7WRD" AR7DB
2927 + int 'Texas Instruments AR7 CPU Frequency' CONFIG_AR7_CPU 150
2928 + int 'Texas Instruments AR7 System Frequency' CONFIG_AR7_SYS 125
2929 + hex 'Texas Instruments AR7 SDRAM Start' CONFIG_AR7_MEMORY 0x14000000
2931 dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32
2932 dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32
2933 dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32
2934 @@ -239,6 +249,11 @@
2935 define_bool CONFIG_NONCOHERENT_IO y
2936 define_bool CONFIG_PC_KEYB y
2938 +if [ "$CONFIG_AR7" = "y" ]; then
2939 + define_bool CONFIG_IRQ_CPU y
2940 + define_bool CONFIG_NONCOHERENT_IO y
2941 + define_bool CONFIG_SWAP_IO_SPACE y
2943 if [ "$CONFIG_CASIO_E55" = "y" ]; then
2944 define_bool CONFIG_IRQ_CPU y
2945 define_bool CONFIG_NONCOHERENT_IO y
2947 mainmenu_option next_comment
2948 comment 'General setup'
2949 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2950 + "$CONFIG_AR7" = "y" -o \
2951 "$CONFIG_CASIO_E55" = "y" -o \
2952 "$CONFIG_DDB5074" = "y" -o \
2953 "$CONFIG_DDB5476" = "y" -o \
2955 bool 'Networking support' CONFIG_NET
2957 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2958 + "$CONFIG_AR7" = "y" -o \
2959 "$CONFIG_CASIO_E55" = "y" -o \
2960 "$CONFIG_DECSTATION" = "y" -o \
2961 "$CONFIG_IBM_WORKPAD" = "y" -o \
2962 diff -urN linux.old/arch/mips/kernel/head.S linux.dev/arch/mips/kernel/head.S
2963 --- linux.old/arch/mips/kernel/head.S 2005-10-21 16:43:16.396956500 +0200
2964 +++ linux.dev/arch/mips/kernel/head.S 2005-11-10 01:10:45.807572250 +0100
2968 NESTED(except_vec4, 0, sp)
2971 -1: j 1b /* Dummy, will be replaced */
2982 diff -urN linux.old/arch/mips/kernel/mips_ksyms.c linux.dev/arch/mips/kernel/mips_ksyms.c
2983 --- linux.old/arch/mips/kernel/mips_ksyms.c 2004-02-18 14:36:30.000000000 +0100
2984 +++ linux.dev/arch/mips/kernel/mips_ksyms.c 2005-11-10 01:10:45.811572500 +0100
2986 extern long __strnlen_user_nocheck_asm(const char *s);
2987 extern long __strnlen_user_asm(const char *s);
2990 +#include <asm/ar7/adam2_env.h>
2991 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num, unsigned int pace_value);
2995 EXPORT_SYMBOL(mips_machtype);
2997 EXPORT_SYMBOL(EISA_bus);
2998 @@ -103,3 +109,10 @@
3001 EXPORT_SYMBOL(get_wchan);
3004 +EXPORT_SYMBOL_NOVERS(avalanche_request_pacing);
3005 +EXPORT_SYMBOL_NOVERS(prom_getenv);
3006 +EXPORT_SYMBOL_NOVERS(prom_iterenv);
3009 diff -urN linux.old/arch/mips/kernel/setup.c linux.dev/arch/mips/kernel/setup.c
3010 --- linux.old/arch/mips/kernel/setup.c 2005-10-21 16:43:16.396956500 +0200
3011 +++ linux.dev/arch/mips/kernel/setup.c 2005-11-10 01:14:16.376732000 +0100
3014 #include <asm/ptrace.h>
3015 #include <asm/system.h>
3016 +#include <asm/addrspace.h>
3018 struct cpuinfo_mips cpu_data[NR_CPUS];
3019 EXPORT_SYMBOL(cpu_data);
3021 struct boot_mem_map boot_mem_map;
3023 unsigned char aux_device_present;
3024 -extern char _ftext, _etext, _fdata, _edata, _end;
3025 +extern char _ftext, _etext, _fdata, _edata, _fbss, _end;
3027 static char command_line[CL_SIZE];
3028 char saved_command_line[CL_SIZE];
3031 static struct resource code_resource = { "Kernel code" };
3032 static struct resource data_resource = { "Kernel data" };
3033 +static struct resource bss_resource = { "Kernel bss" };
3035 asmlinkage void __init
3036 init_arch(int argc, char **argv, char **envp, int *prom_vec)
3038 for (i = 0; i < boot_mem_map.nr_map; i++) {
3039 unsigned long start, end;
3041 - if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
3042 + if (boot_mem_map.map[i].type == BOOT_MEM_RESERVED)
3045 start = PFN_UP(boot_mem_map.map[i].addr);
3049 /* Initialize the boot-time allocator with low memory only. */
3050 - bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn);
3051 + bootmap_size = init_bootmem_node(NODE_DATA(0), first_usable_pfn,
3052 + PFN_UP(PHYS_OFFSET), max_low_pfn);
3055 * Register fully available low RAM pages with the bootmem allocator.
3056 @@ -371,11 +374,12 @@
3059 /* Register lowmem ranges */
3060 - free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
3061 + free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
3062 + size<<PAGE_SHIFT);
3065 /* Reserve the bootmap memory. */
3066 - reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
3067 + reserve_bootmem_node(NODE_DATA(0), PFN_PHYS(first_usable_pfn), bootmap_size);
3069 #ifdef CONFIG_BLK_DEV_INITRD
3070 /* Board specific code should have set up initrd_start and initrd_end */
3072 code_resource.end = virt_to_bus(&_etext) - 1;
3073 data_resource.start = virt_to_bus(&_fdata);
3074 data_resource.end = virt_to_bus(&_edata) - 1;
3075 + bss_resource.start = virt_to_bus(&_fbss);
3076 + bss_resource.end = virt_to_bus(&_end) - 1;
3079 * Request address space for all standard RAM.
3082 request_resource(res, &code_resource);
3083 request_resource(res, &data_resource);
3084 + request_resource(res, &bss_resource);
3089 void hp_setup(void);
3090 void au1x00_setup(void);
3091 void frame_info_init(void);
3092 + void ar7_setup(void);
3095 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
3096 @@ -691,6 +699,11 @@
3097 pmc_yosemite_setup();
3101 + case MACH_GROUP_UNKNOWN:
3106 panic("Unsupported architecture");
3108 diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
3109 --- linux.old/arch/mips/kernel/time.c 2005-01-19 15:09:29.000000000 +0100
3110 +++ linux.dev/arch/mips/kernel/time.c 2005-11-10 01:12:43.950955750 +0100
3112 expirelo = (count / cycles_per_jiffy + 1) * cycles_per_jiffy;
3113 write_c0_count(expirelo - cycles_per_jiffy);
3114 write_c0_compare(expirelo);
3115 - write_c0_count(count);
3118 int (*mips_timer_state)(void);
3119 diff -urN linux.old/arch/mips/kernel/traps.c linux.dev/arch/mips/kernel/traps.c
3120 --- linux.old/arch/mips/kernel/traps.c 2005-10-21 16:43:16.400956750 +0200
3121 +++ linux.dev/arch/mips/kernel/traps.c 2005-11-10 01:13:28.301727500 +0100
3122 @@ -869,9 +869,24 @@
3124 exception_handlers[n] = handler;
3125 if (n == 0 && cpu_has_divec) {
3126 + printk(KERN_DEBUG "%s: using long jump via k0 to reach %08x\n",
3127 + __FUNCTION__, handler);
3128 + /* where does the 8 byte limit mentioned in head.S come from??? */
3129 + if (handler > 0x0fffffff) { /* maximum for single J instruction */
3130 + /* lui k0, 0x0000 */
3131 + *(volatile u32 *)(KSEG0+0x200) = 0x3c1a0000 | (handler >> 16);
3132 + /* ori k0, 0x0000 */
3133 + *(volatile u32 *)(KSEG0+0x204) = 0x375a0000 | (handler & 0xffff);
3135 + *(volatile u32 *)(KSEG0+0x208) = 0x03400008;
3137 + *(volatile u32 *)(KSEG0+0x20C) = 0x00000000;
3138 + flush_icache_range(KSEG0+0x200, KSEG0+0x210);
3140 *(volatile u32 *)(KSEG0+0x200) = 0x08000000 |
3141 (0x03ffffff & (handler >> 2));
3142 - flush_icache_range(KSEG0+0x200, KSEG0 + 0x204);
3143 + flush_icache_range(KSEG0+0x200, KSEG0+0x204);
3146 return (void *)old_handler;
3148 diff -urN linux.old/arch/mips/mm/init.c linux.dev/arch/mips/mm/init.c
3149 --- linux.old/arch/mips/mm/init.c 2004-02-18 14:36:30.000000000 +0100
3150 +++ linux.dev/arch/mips/mm/init.c 2005-11-10 01:14:16.376732000 +0100
3151 @@ -235,10 +235,13 @@
3155 +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
3156 +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
3158 void __init paging_init(void)
3160 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
3161 - unsigned long max_dma, high, low;
3162 + unsigned long max_dma, high, low, start;
3169 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
3170 - low = max_low_pfn;
3171 + start = START_PFN;
3172 + low = MAX_LOW_PFN - start;
3177 zones_size[ZONE_HIGHMEM] = high - low;
3180 - free_area_init(zones_size);
3181 + free_area_init_node(0, NODE_DATA(0), 0, zones_size,
3182 + start << PAGE_SHIFT, 0);
3185 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
3187 for (i = 0; i < boot_mem_map.nr_map; i++) {
3188 unsigned long addr, end;
3190 - if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
3191 + if (boot_mem_map.map[i].type == BOOT_MEM_RESERVED)
3192 /* not usable memory */
3195 @@ -313,16 +318,17 @@
3196 max_mapnr = num_physpages = highend_pfn;
3197 num_mappedpages = max_low_pfn;
3199 - max_mapnr = num_mappedpages = num_physpages = max_low_pfn;
3200 + max_mapnr = num_mappedpages = num_physpages = MAX_LOW_PFN - START_PFN;
3202 - high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
3204 - totalram_pages += free_all_bootmem();
3206 + high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE);
3208 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
3209 totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */
3211 reservedpages = ram = 0;
3212 - for (tmp = 0; tmp < max_low_pfn; tmp++)
3213 - if (page_is_ram(tmp)) {
3214 + for (tmp = 0; tmp < max_mapnr; tmp++)
3215 + if (page_is_ram(START_PFN + tmp)) {
3217 if (PageReserved(mem_map+tmp))
3219 @@ -377,13 +383,13 @@
3222 extern char __init_begin, __init_end;
3223 -extern void prom_free_prom_memory(void) __init;
3224 +extern unsigned long prom_free_prom_memory(void) __init;
3226 void free_initmem(void)
3230 - prom_free_prom_memory ();
3231 + totalram_pages += prom_free_prom_memory ();
3233 addr = (unsigned long) &__init_begin;
3234 while (addr < (unsigned long) &__init_end) {
3235 diff -urN linux.old/drivers/char/Config.in linux.dev/drivers/char/Config.in
3236 --- linux.old/drivers/char/Config.in 2005-10-21 16:43:16.440959250 +0200
3237 +++ linux.dev/drivers/char/Config.in 2005-11-10 01:10:45.843574500 +0100
3238 @@ -188,6 +188,14 @@
3239 tristate 'Total Impact briQ front panel driver' CONFIG_BRIQ_PANEL
3242 +if [ "$CONFIG_AR7" = "y" ]; then
3243 + bool 'VLYNQ support for the TI SOC' CONFIG_AR7_VLYNQ
3244 + dep_bool 'VLYNQ clock source Internal' CONFIG_VLYNQ_CLK_LOCAL $CONFIG_AR7_VLYNQ
3246 + define_int CONFIG_AR7_VLYNQ_PORTS 2
3247 + tristate 'ADAM2 environment support (read-only)' CONFIG_AR7_ADAM2
3250 source drivers/i2c/Config.in
3252 mainmenu_option next_comment
3253 diff -urN linux.old/drivers/char/Config.in.orig linux.dev/drivers/char/Config.in.orig
3254 --- linux.old/drivers/char/Config.in.orig 1970-01-01 01:00:00.000000000 +0100
3255 +++ linux.dev/drivers/char/Config.in.orig 2005-11-10 01:10:45.863575750 +0100
3258 +# Character device configuration
3260 +mainmenu_option next_comment
3261 +comment 'Character devices'
3263 +bool 'Virtual terminal' CONFIG_VT
3264 +if [ "$CONFIG_VT" = "y" ]; then
3265 + bool ' Support for console on virtual terminal' CONFIG_VT_CONSOLE
3266 + if [ "$CONFIG_GSC_LASI" = "y" ]; then
3267 + bool ' Support for Lasi/Dino PS2 port' CONFIG_GSC_PS2
3270 +tristate 'Standard/generic (8250/16550 and compatible UARTs) serial support' CONFIG_SERIAL
3271 +if [ "$CONFIG_SERIAL" = "y" ]; then
3272 + bool ' Support for console on serial port' CONFIG_SERIAL_CONSOLE
3273 + if [ "$CONFIG_GSC_LASI" = "y" ]; then
3274 + bool ' serial port on GSC support' CONFIG_SERIAL_GSC
3276 + if [ "$CONFIG_IA64" = "y" ]; then
3277 + bool ' Support for serial port described by EFI HCDP table' CONFIG_SERIAL_HCDP
3279 + if [ "$CONFIG_ARCH_ACORN" = "y" ]; then
3280 + tristate ' Atomwide serial port support' CONFIG_ATOMWIDE_SERIAL
3281 + tristate ' Dual serial port support' CONFIG_DUALSP_SERIAL
3284 +dep_mbool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL
3285 +if [ "$CONFIG_SERIAL_EXTENDED" = "y" ]; then
3286 + bool ' Support more than 4 serial ports' CONFIG_SERIAL_MANY_PORTS
3287 + bool ' Support for sharing serial interrupts' CONFIG_SERIAL_SHARE_IRQ
3288 + bool ' Autodetect IRQ on standard ports (unsafe)' CONFIG_SERIAL_DETECT_IRQ
3289 + bool ' Support special multiport boards' CONFIG_SERIAL_MULTIPORT
3290 + bool ' Support the Bell Technologies HUB6 card' CONFIG_HUB6
3292 +bool 'Non-standard serial port support' CONFIG_SERIAL_NONSTANDARD
3293 +if [ "$CONFIG_SERIAL_NONSTANDARD" = "y" ]; then
3294 + tristate ' Computone IntelliPort Plus serial support' CONFIG_COMPUTONE
3295 + tristate ' Comtrol Rocketport support' CONFIG_ROCKETPORT
3296 + tristate ' Cyclades async mux support' CONFIG_CYCLADES
3297 + if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_CYCLADES" != "n" ]; then
3298 + bool ' Cyclades-Z interrupt mode operation (EXPERIMENTAL)' CONFIG_CYZ_INTR
3300 + if [ "$CONFIG_X86_64" != "y" ]; then
3301 + tristate ' Digiboard Intelligent Async Support' CONFIG_DIGIEPCA
3302 + if [ "$CONFIG_DIGIEPCA" = "n" ]; then
3303 + tristate ' Digiboard PC/Xx Support' CONFIG_DIGI
3306 + dep_tristate ' Hayes ESP serial port support' CONFIG_ESPSERIAL $CONFIG_ISA
3307 + tristate ' Moxa Intellio support' CONFIG_MOXA_INTELLIO
3308 + tristate ' Moxa SmartIO support' CONFIG_MOXA_SMARTIO
3309 + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
3310 + dep_tristate ' Multi-Tech multiport card support (EXPERIMENTAL)' CONFIG_ISI m
3312 + tristate ' Microgate SyncLink card support' CONFIG_SYNCLINK
3313 + tristate ' SyncLink Multiport support' CONFIG_SYNCLINKMP
3314 + tristate ' HDLC line discipline support' CONFIG_N_HDLC
3315 + tristate ' SDL RISCom/8 card support' CONFIG_RISCOM8
3316 + if [ "$CONFIG_X86_64" != "y" ]; then
3317 + tristate ' Specialix IO8+ card support' CONFIG_SPECIALIX
3318 + if [ "$CONFIG_SPECIALIX" != "n" ]; then
3319 + bool ' Specialix DTR/RTS pin is RTS' CONFIG_SPECIALIX_RTSCTS
3321 + tristate ' Specialix SX (and SI) card support' CONFIG_SX
3322 + tristate ' Specialix RIO system support' CONFIG_RIO
3323 + if [ "$CONFIG_RIO" != "n" ]; then
3324 + bool ' Support really old RIO/PCI cards' CONFIG_RIO_OLDPCI
3327 + bool ' Stallion multiport serial support' CONFIG_STALDRV
3328 + if [ "$CONFIG_STALDRV" = "y" ]; then
3329 + tristate ' Stallion EasyIO or EC8/32 support' CONFIG_STALLION
3330 + tristate ' Stallion EC8/64, ONboard, Brumby support' CONFIG_ISTALLION
3332 + if [ "$CONFIG_PARISC" = "y" ]; then
3333 + if [ "$CONFIG_PDC_CONSOLE" != "y" ]; then
3334 + bool ' Serial MUX support' CONFIG_SERIAL_MUX CONFIG_SERIAL_NONSTANDARD
3336 + if [ "$CONFIG_SERIAL_MUX" != "y" ]; then
3337 + bool ' PDC software console support' CONFIG_PDC_CONSOLE CONFIG_SERIAL_NONSTANDARD
3340 + if [ "$CONFIG_MIPS" = "y" ]; then
3341 + bool ' TX3912/PR31700 serial port support' CONFIG_SERIAL_TX3912
3342 + dep_bool ' Console on TX3912/PR31700 serial port' CONFIG_SERIAL_TX3912_CONSOLE $CONFIG_SERIAL_TX3912
3343 + bool ' TMPTX39XX/49XX serial port support' CONFIG_SERIAL_TXX9
3344 + dep_bool ' Console on TMPTX39XX/49XX serial port' CONFIG_SERIAL_TXX9_CONSOLE $CONFIG_SERIAL_TXX9
3345 + if [ "$CONFIG_SOC_AU1X00" = "y" ]; then
3346 + bool ' Enable Au1x00 UART Support' CONFIG_AU1X00_UART
3347 + if [ "$CONFIG_AU1X00_UART" = "y" ]; then
3348 + bool ' Enable Au1x00 serial console' CONFIG_AU1X00_SERIAL_CONSOLE
3350 + dep_tristate ' Au1x00 USB TTY Device support' CONFIG_AU1X00_USB_TTY $CONFIG_SOC_AU1X00
3351 + if [ "$CONFIG_AU1000_USB_TTY" != "y" ]; then
3352 + dep_tristate ' Au1x00 USB Raw Device support' CONFIG_AU1X00_USB_RAW $CONFIG_SOC_AU1X00
3354 + if [ "$CONFIG_AU1X00_USB_TTY" != "n" -o \
3355 + "$CONFIG_AU1X00_USB_RAW" != "n" ]; then
3356 + define_bool CONFIG_AU1X00_USB_DEVICE y
3359 + bool ' TXx927 SIO support' CONFIG_TXX927_SERIAL
3360 + if [ "$CONFIG_TXX927_SERIAL" = "y" ]; then
3361 + bool ' TXx927 SIO Console support' CONFIG_TXX927_SERIAL_CONSOLE
3363 + if [ "$CONFIG_SIBYTE_SB1xxx_SOC" = "y" ]; then
3364 + bool ' Support for BCM1xxx onchip DUART' CONFIG_SIBYTE_SB1250_DUART
3365 + if [ "$CONFIG_SIBYTE_SB1250_DUART" = "y" ]; then
3366 + bool ' Console on BCM1xxx DUART' CONFIG_SIBYTE_SB1250_DUART_CONSOLE
3367 + if [ "$CONFIG_SIBYTE_SB1250_DUART_CONSOLE" = "y" ]; then
3368 + define_bool CONFIG_SERIAL_CONSOLE y
3373 + if [ "$CONFIG_DECSTATION" = "y" ]; then
3374 + bool ' DECstation serial support' CONFIG_SERIAL_DEC
3375 + dep_bool ' Support for console on a DECstation serial port' CONFIG_SERIAL_DEC_CONSOLE $CONFIG_SERIAL_DEC
3376 + dep_bool ' DZ11 serial support' CONFIG_DZ $CONFIG_SERIAL_DEC $CONFIG_MIPS32
3377 + dep_bool ' Z85C30 serial support' CONFIG_ZS $CONFIG_SERIAL_DEC $CONFIG_TC
3379 + if [ "$CONFIG_SGI_IP22" = "y" ]; then
3380 + bool ' SGI Zilog85C30 serial support' CONFIG_IP22_SERIAL
3382 + if [ "$CONFIG_IA64" = "y" ]; then
3383 + bool ' SGI SN2 l1 serial port support' CONFIG_SGI_L1_SERIAL
3384 + if [ "$CONFIG_SGI_L1_SERIAL" = "y" ]; then
3385 + bool ' SGI SN2 l1 Console support' CONFIG_SGI_L1_SERIAL_CONSOLE
3387 + if [ "$CONFIG_IA64_GENERIC" = "y" -o "$CONFIG_IA64_SGI_SN2" = "y" ]; then
3388 + bool ' SGI SN2 IOC4 serial port support' CONFIG_SGI_IOC4_SERIAL
3392 +if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_ZORRO" = "y" ]; then
3393 + tristate 'Commodore A2232 serial support (EXPERIMENTAL)' CONFIG_A2232
3395 +if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then
3396 + bool 'DC21285 serial port support' CONFIG_SERIAL_21285
3397 + if [ "$CONFIG_SERIAL_21285" = "y" ]; then
3398 + if [ "$CONFIG_OBSOLETE" = "y" ]; then
3399 + bool ' Use /dev/ttyS0 device (OBSOLETE)' CONFIG_SERIAL_21285_OLD
3401 + bool ' Console on DC21285 serial port' CONFIG_SERIAL_21285_CONSOLE
3403 + if [ "$CONFIG_PARISC" = "y" ]; then
3404 + bool ' PDC software console support' CONFIG_PDC_CONSOLE
3407 +if [ "$CONFIG_MIPS_ITE8172" = "y" ]; then
3408 + bool 'Enable Qtronix 990P Keyboard Support' CONFIG_QTRONIX_KEYBOARD
3409 + if [ "$CONFIG_QTRONIX_KEYBOARD" = "y" ]; then
3410 + define_bool CONFIG_IT8172_CIR y
3412 + bool ' Enable PS2 Keyboard Support' CONFIG_PC_KEYB
3414 + bool 'Enable Smart Card Reader 0 Support ' CONFIG_IT8172_SCR0
3415 + bool 'Enable Smart Card Reader 1 Support ' CONFIG_IT8172_SCR1
3417 +if [ "$CONFIG_MIPS_IVR" = "y" ]; then
3418 + bool 'Enable Qtronix 990P Keyboard Support' CONFIG_QTRONIX_KEYBOARD
3419 + if [ "$CONFIG_QTRONIX_KEYBOARD" = "y" ]; then
3420 + define_bool CONFIG_IT8172_CIR y
3422 + bool 'Enable Smart Card Reader 0 Support ' CONFIG_IT8172_SCR0
3424 +if [ "$CONFIG_CPU_VR41XX" = "y" ]; then
3425 + bool 'NEC VR4100 series Keyboard Interface Unit Support ' CONFIG_VR41XX_KIU
3427 +bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS
3428 +if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
3429 + int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
3431 +if [ "$CONFIG_PARPORT" != "n" ]; then
3432 + dep_tristate 'Parallel printer support' CONFIG_PRINTER $CONFIG_PARPORT
3433 + if [ "$CONFIG_PRINTER" != "n" ]; then
3434 + bool ' Support for console on line printer' CONFIG_LP_CONSOLE
3436 + dep_tristate 'Support for user-space parallel port device drivers' CONFIG_PPDEV $CONFIG_PARPORT
3437 + dep_tristate 'Texas Instruments parallel link cable support' CONFIG_TIPAR $CONFIG_PARPORT
3440 +if [ "$CONFIG_PPC64" = "y" ] ; then
3441 + bool 'pSeries Hypervisor Virtual Console support' CONFIG_HVC_CONSOLE
3443 +if [ "$CONFIG_ALL_PPC" = "y" ]; then
3444 + tristate 'Total Impact briQ front panel driver' CONFIG_BRIQ_PANEL
3447 +if [ "$CONFIG_AR7" = "y" ]; then
3448 + bool 'VLYNQ support for the TI SOC' CONFIG_AR7_VLYNQ
3449 + dep_bool 'VLYNQ clock source Internal' CONFIG_VLYNQ_CLK_LOCAL $CONFIG_AR7_VLYNQ
3451 + define_int CONFIG_AR7_VLYNQ_PORTS 2
3454 +source drivers/i2c/Config.in
3456 +mainmenu_option next_comment
3458 +tristate 'Bus Mouse Support' CONFIG_BUSMOUSE
3459 +if [ "$CONFIG_BUSMOUSE" != "n" ]; then
3460 + dep_tristate ' ATIXL busmouse support' CONFIG_ATIXL_BUSMOUSE $CONFIG_BUSMOUSE
3461 + dep_tristate ' Logitech busmouse support' CONFIG_LOGIBUSMOUSE $CONFIG_BUSMOUSE
3462 + dep_tristate ' Microsoft busmouse support' CONFIG_MS_BUSMOUSE $CONFIG_BUSMOUSE
3463 + if [ "$CONFIG_ADB" = "y" -a "$CONFIG_ADB_KEYBOARD" = "y" ]; then
3464 + dep_tristate ' Apple Desktop Bus mouse support (old driver)' CONFIG_ADBMOUSE $CONFIG_BUSMOUSE
3466 +# if [ "$CONFIG_DECSTATION" = "y" ]; then
3467 +# dep_bool ' MAXINE Access.Bus mouse (VSXXX-BB/GB) support' CONFIG_DTOP_MOUSE $CONFIG_ACCESSBUS
3471 +tristate 'Mouse Support (not serial and bus mice)' CONFIG_MOUSE
3472 +if [ "$CONFIG_MOUSE" != "n" ]; then
3473 + bool ' PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE
3474 + tristate ' C&T 82C710 mouse port support (as on TI Travelmate)' CONFIG_82C710_MOUSE
3475 + tristate ' PC110 digitizer pad support' CONFIG_PC110_PAD
3476 + tristate ' MK712 touch screen support' CONFIG_MK712_MOUSE
3480 +source drivers/char/joystick/Config.in
3482 +tristate 'QIC-02 tape support' CONFIG_QIC02_TAPE
3483 +if [ "$CONFIG_QIC02_TAPE" != "n" ]; then
3484 + bool ' Do you want runtime configuration for QIC-02' CONFIG_QIC02_DYNCONF
3485 + if [ "$CONFIG_QIC02_DYNCONF" != "y" ]; then
3486 + comment ' Edit configuration parameters in ./include/linux/tpqic02.h!'
3488 + comment ' Setting runtime QIC-02 configuration is done with qic02conf'
3489 + comment ' from the tpqic02-support package. It is available at'
3490 + comment ' metalab.unc.edu or ftp://titus.cfw.com/pub/Linux/util/'
3494 +tristate 'IPMI top-level message handler' CONFIG_IPMI_HANDLER
3495 +dep_mbool ' Generate a panic event to all BMCs on a panic' CONFIG_IPMI_PANIC_EVENT $CONFIG_IPMI_HANDLER
3496 +dep_tristate ' Device interface for IPMI' CONFIG_IPMI_DEVICE_INTERFACE $CONFIG_IPMI_HANDLER
3497 +dep_tristate ' IPMI KCS handler' CONFIG_IPMI_KCS $CONFIG_IPMI_HANDLER
3498 +dep_tristate ' IPMI Watchdog Timer' CONFIG_IPMI_WATCHDOG $CONFIG_IPMI_HANDLER
3500 +mainmenu_option next_comment
3501 +comment 'Watchdog Cards'
3502 +bool 'Watchdog Timer Support' CONFIG_WATCHDOG
3503 +if [ "$CONFIG_WATCHDOG" != "n" ]; then
3504 + bool ' Disable watchdog shutdown on close' CONFIG_WATCHDOG_NOWAYOUT
3505 + tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT
3506 + tristate ' Advantech SBC Watchdog Timer' CONFIG_ADVANTECH_WDT
3507 + tristate ' ALi M7101 PMU on ALi 1535D+ Watchdog Timer' CONFIG_ALIM1535_WDT
3508 + tristate ' ALi M7101 PMU Watchdog Timer' CONFIG_ALIM7101_WDT
3509 + tristate ' AMD "Elan" SC520 Watchdog Timer' CONFIG_SC520_WDT
3510 + tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG
3511 + if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then
3512 + tristate ' DC21285 watchdog' CONFIG_21285_WATCHDOG
3513 + if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then
3514 + tristate ' NetWinder WB83C977 watchdog' CONFIG_977_WATCHDOG
3517 + tristate ' Eurotech CPU-1220/1410 Watchdog Timer' CONFIG_EUROTECH_WDT
3518 + tristate ' IB700 SBC Watchdog Timer' CONFIG_IB700_WDT
3519 + tristate ' ICP ELectronics Wafer 5823 Watchdog' CONFIG_WAFER_WDT
3520 + tristate ' Intel i810 TCO timer / Watchdog' CONFIG_I810_TCO
3521 + tristate ' Mixcom Watchdog' CONFIG_MIXCOMWD
3522 + tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
3523 + dep_tristate ' SC1200 Watchdog Timer (EXPERIMENTAL)' CONFIG_SC1200_WDT $CONFIG_EXPERIMENTAL
3524 + tristate ' NatSemi SCx200 Watchdog' CONFIG_SCx200_WDT
3525 + tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
3526 + tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
3527 + tristate ' WDT Watchdog timer' CONFIG_WDT
3528 + tristate ' WDT PCI Watchdog timer' CONFIG_WDTPCI
3529 + if [ "$CONFIG_WDT" != "n" ]; then
3530 + bool ' WDT501 features' CONFIG_WDT_501
3531 + if [ "$CONFIG_WDT_501" = "y" ]; then
3532 + bool ' Fan Tachometer' CONFIG_WDT_501_FAN
3535 + tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
3536 + if [ "$CONFIG_SGI_IP22" = "y" ]; then
3537 + dep_tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG $CONFIG_SGI_IP22
3539 + if [ "$CONFIG_8xx" = "y" ]; then
3540 + tristate ' MPC8xx Watchdog Timer' CONFIG_8xx_WDT
3545 +if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then
3546 + tristate 'NetWinder thermometer support' CONFIG_DS1620
3547 + tristate 'NetWinder Button' CONFIG_NWBUTTON
3548 + if [ "$CONFIG_NWBUTTON" != "n" ]; then
3549 + bool ' Reboot Using Button' CONFIG_NWBUTTON_REBOOT
3551 + tristate 'NetWinder flash support' CONFIG_NWFLASH
3553 +tristate 'NatSemi SCx200 Support' CONFIG_SCx200
3554 +dep_tristate ' NatSemi SCx200 GPIO Support' CONFIG_SCx200_GPIO $CONFIG_SCx200
3556 +if [ "$CONFIG_IA64_GENERIC" = "y" -o "$CONFIG_IA64_SGI_SN2" = "y" ] ; then
3557 + bool 'SGI SN2 fetchop support' CONFIG_FETCHOP
3560 +if [ "$CONFIG_X86" = "y" -o "$CONFIG_X86_64" = "y" ]; then
3561 + dep_tristate 'AMD 768/8111 Random Number Generator support' CONFIG_AMD_RNG $CONFIG_PCI
3563 +if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" ]; then
3564 + dep_tristate 'Intel i8x0 Random Number Generator support' CONFIG_INTEL_RNG $CONFIG_PCI
3566 +if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" -o \
3567 + "$CONFIG_X86_64" = "y" ]; then
3568 + dep_tristate 'Intel/AMD/VIA HW Random Number Generator support' CONFIG_HW_RANDOM $CONFIG_PCI
3570 +dep_tristate 'AMD 76x native power management (Experimental)' CONFIG_AMD_PM768 $CONFIG_PCI
3571 +tristate '/dev/nvram support' CONFIG_NVRAM
3572 +tristate 'Enhanced Real Time Clock Support' CONFIG_RTC
3573 +if [ "$CONFIG_IA64" = "y" ]; then
3574 + bool 'EFI Real Time Clock Services' CONFIG_EFI_RTC
3576 +if [ "$CONFIG_OBSOLETE" = "y" -a "$CONFIG_ALPHA_BOOK1" = "y" ]; then
3577 + bool 'Tadpole ANA H8 Support (OBSOLETE)' CONFIG_H8
3579 +if [ "$CONFIG_SGI_IP22" = "y" ]; then
3580 + tristate 'Dallas DS1286 RTC support' CONFIG_DS1286
3582 +if [ "$CONFIG_SGI_IP27" = "y" ]; then
3583 + tristate 'SGI M48T35 RTC support' CONFIG_SGI_IP27_RTC
3585 +if [ "$CONFIG_TOSHIBA_RBTX4927" = "y" -o "$CONFIG_TOSHIBA_JMR3927" = "y" ]; then
3586 + tristate 'Dallas DS1742 RTC support' CONFIG_DS1742
3589 +tristate 'Double Talk PC internal speech card support' CONFIG_DTLK
3590 +tristate 'Siemens R3964 line discipline' CONFIG_R3964
3591 +tristate 'Applicom intelligent fieldbus card support' CONFIG_APPLICOM
3592 +if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_X86" = "y" -a "$CONFIG_X86_64" != "y" ]; then
3593 + dep_tristate 'Sony Vaio Programmable I/O Control Device support (EXPERIMENTAL)' CONFIG_SONYPI $CONFIG_PCI
3596 +mainmenu_option next_comment
3597 +comment 'Ftape, the floppy tape device driver'
3598 +tristate 'Ftape (QIC-80/Travan) support' CONFIG_FTAPE
3599 +if [ "$CONFIG_FTAPE" != "n" ]; then
3600 + source drivers/char/ftape/Config.in
3605 +if [ "$CONFIG_GART_IOMMU" = "y" ]; then
3606 + bool '/dev/agpgart (AGP Support)' CONFIG_AGP
3607 + define_bool CONFIG_AGP_AMD_K8 y
3609 + tristate '/dev/agpgart (AGP Support)' CONFIG_AGP
3611 +if [ "$CONFIG_AGP" != "n" ]; then
3612 + bool ' Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support' CONFIG_AGP_INTEL
3613 + bool ' Intel I810/I815/I830M (on-board) support' CONFIG_AGP_I810
3614 + bool ' VIA chipset support' CONFIG_AGP_VIA
3615 + bool ' AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
3616 + if [ "$CONFIG_GART_IOMMU" != "y" ]; then
3617 + bool ' AMD Opteron/Athlon64 on-CPU GART support' CONFIG_AGP_AMD_K8
3619 + bool ' Generic SiS support' CONFIG_AGP_SIS
3620 + bool ' ALI chipset support' CONFIG_AGP_ALI
3621 + bool ' Serverworks LE/HE support' CONFIG_AGP_SWORKS
3622 + if [ "$CONFIG_X86" = "y" ]; then
3623 + bool ' NVIDIA chipset support' CONFIG_AGP_NVIDIA
3625 + if [ "$CONFIG_IA64" = "y" ]; then
3626 + bool ' Intel 460GX support' CONFIG_AGP_I460
3627 + bool ' HP ZX1 AGP support' CONFIG_AGP_HP_ZX1
3629 + bool ' ATI IGP chipset support' CONFIG_AGP_ATI
3632 +mainmenu_option next_comment
3633 +comment 'Direct Rendering Manager (XFree86 DRI support)'
3634 +bool 'Direct Rendering Manager (XFree86 DRI support)' CONFIG_DRM
3635 +if [ "$CONFIG_DRM" = "y" ]; then
3636 + bool ' Build drivers for old (XFree 4.0) DRM' CONFIG_DRM_OLD
3637 + if [ "$CONFIG_DRM_OLD" = "y" ]; then
3638 + comment 'DRM 4.0 drivers'
3639 + source drivers/char/drm-4.0/Config.in
3641 + comment 'DRM 4.1 drivers'
3642 + define_bool CONFIG_DRM_NEW y
3643 + source drivers/char/drm/Config.in
3647 +if [ "$CONFIG_X86" = "y" ]; then
3648 + tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE
3653 +if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then
3654 + source drivers/char/pcmcia/Config.in
3656 +if [ "$CONFIG_SOC_AU1X00" = "y" ]; then
3657 + tristate ' Alchemy Au1x00 GPIO device support' CONFIG_AU1X00_GPIO
3658 + tristate ' Au1000/ADS7846 touchscreen support' CONFIG_TS_AU1X00_ADS7846
3659 + #tristate ' Alchemy Au1550 PSC SPI support' CONFIG_AU1550_PSC_SPI
3661 +if [ "$CONFIG_MIPS_ITE8172" = "y" ]; then
3662 + tristate ' ITE GPIO' CONFIG_ITE_GPIO
3665 +if [ "$CONFIG_X86" = "y" ]; then
3666 + tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE
3667 + dep_tristate 'HP OB600 C/CT Pop-up mouse support' CONFIG_OBMOUSE $CONFIG_INPUT_MOUSEDEV
3671 diff -urN linux.old/drivers/char/Makefile linux.dev/drivers/char/Makefile
3672 --- linux.old/drivers/char/Makefile 2005-10-21 16:43:16.460960500 +0200
3673 +++ linux.dev/drivers/char/Makefile 2005-11-10 01:10:45.871576250 +0100
3674 @@ -240,6 +240,13 @@
3675 obj-y += joystick/js.o
3679 +# Texas Intruments VLYNQ driver
3682 +subdir-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq
3683 +obj-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq/avalanche_vlynq.o
3685 obj-$(CONFIG_FETCHOP) += fetchop.o
3686 obj-$(CONFIG_BUSMOUSE) += busmouse.o
3687 obj-$(CONFIG_DTLK) += dtlk.o
3688 @@ -340,6 +347,11 @@
3689 obj-y += ipmi/ipmi.o
3692 +subdir-$(CONFIG_AR7_ADAM2) += ticfg
3693 +ifeq ($(CONFIG_AR7_ADAM2),y)
3694 + obj-y += ticfg/ticfg.o
3697 include $(TOPDIR)/Rules.make
3700 diff -urN linux.old/drivers/char/Makefile.orig linux.dev/drivers/char/Makefile.orig
3701 --- linux.old/drivers/char/Makefile.orig 1970-01-01 01:00:00.000000000 +0100
3702 +++ linux.dev/drivers/char/Makefile.orig 2005-11-10 01:10:45.871576250 +0100
3705 +# Makefile for the kernel character device drivers.
3707 +# Note! Dependencies are done automagically by 'make dep', which also
3708 +# removes any old dependencies. DON'T put your own dependencies here
3709 +# unless it's something special (ie not a .c file).
3711 +# Note 2! The CFLAGS definitions are now inherited from the
3716 +# This file contains the font map for the default (hardware) font
3718 +FONTMAPFILE = cp437.uni
3722 +obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o
3724 +# All of the (potential) objects that export symbols.
3725 +# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
3727 +export-objs := busmouse.o console.o keyboard.o sysrq.o \
3728 + misc.o pty.o random.o selection.o serial.o \
3729 + sonypi.o tty_io.o tty_ioctl.o generic_serial.o \
3730 + au1000_gpio.o vac-serial.o hp_psaux.o nvram.o \
3731 + scx200.o fetchop.o
3733 +mod-subdirs := joystick ftape drm drm-4.0 pcmcia
3737 +KEYMAP =defkeymap.o
3742 +ifeq ($(ARCH),s390)
3749 +ifeq ($(ARCH),mips)
3750 + ifneq ($(CONFIG_PC_KEYB),y)
3753 + ifeq ($(CONFIG_VR41XX_KIU),y)
3754 + ifeq ($(CONFIG_IBM_WORKPAD),y)
3755 + KEYMAP = ibm_workpad_keymap.o
3757 + ifeq ($(CONFIG_VICTOR_MPC30X),y)
3758 + KEYMAP = victor_mpc30x_keymap.o
3760 + KEYBD = vr41xx_keyb.o
3764 +ifeq ($(ARCH),s390x)
3771 +ifeq ($(ARCH),m68k)
3772 + ifdef CONFIG_AMIGA
3782 +ifeq ($(ARCH),parisc)
3783 + ifdef CONFIG_GSC_PS2
3784 + KEYBD = hp_psaux.o hp_keyb.o
3788 + ifdef CONFIG_SERIAL_MUX
3791 + ifdef CONFIG_PDC_CONSOLE
3792 + CONSOLE += pdc_console.o
3797 + KEYBD += q40_keyb.o
3801 +ifdef CONFIG_APOLLO
3802 + KEYBD += dn_keyb.o
3805 +ifeq ($(ARCH),parisc)
3806 + ifdef CONFIG_GSC_PS2
3807 + KEYBD = hp_psaux.o hp_keyb.o
3811 + ifdef CONFIG_PDC_CONSOLE
3812 + CONSOLE += pdc_console.o
3817 + ifneq ($(CONFIG_PC_KEYMAP),y)
3820 + ifneq ($(CONFIG_PC_KEYB),y)
3829 + ifeq ($(CONFIG_SH_HP600),y)
3830 + KEYMAP = defkeymap.o
3831 + KEYBD = scan_keyb.o hp600_keyb.o
3832 + CONSOLE = console.o
3834 + ifeq ($(CONFIG_SH_DMIDA),y)
3835 + # DMIDA does not connect the HD64465 PS/2 keyboard port
3836 + # but we allow for USB keyboards to be plugged in.
3837 + KEYMAP = defkeymap.o
3838 + KEYBD = # hd64465_keyb.o pc_keyb.o
3839 + CONSOLE = console.o
3841 + ifeq ($(CONFIG_SH_EC3104),y)
3842 + KEYMAP = defkeymap.o
3843 + KEYBD = ec3104_keyb.o
3844 + CONSOLE = console.o
3846 + ifeq ($(CONFIG_SH_DREAMCAST),y)
3847 + KEYMAP = defkeymap.o
3849 + CONSOLE = console.o
3853 +ifeq ($(CONFIG_DECSTATION),y)
3858 +ifeq ($(CONFIG_BAGET_MIPS),y)
3860 + SERIAL = vac-serial.o
3863 +ifeq ($(CONFIG_NINO),y)
3867 +ifneq ($(CONFIG_SUN_SERIAL),)
3871 +ifeq ($(CONFIG_QTRONIX_KEYBOARD),y)
3873 + KEYMAP = qtronixmap.o
3876 +ifeq ($(CONFIG_DUMMY_KEYB),y)
3877 + KEYBD = dummy_keyb.o
3880 +obj-$(CONFIG_VT) += vt.o vc_screen.o consolemap.o consolemap_deftbl.o $(CONSOLE) selection.o
3881 +obj-$(CONFIG_SERIAL) += $(SERIAL)
3882 +obj-$(CONFIG_PARPORT_SERIAL) += parport_serial.o
3883 +obj-$(CONFIG_SERIAL_HCDP) += hcdp_serial.o
3884 +obj-$(CONFIG_SERIAL_21285) += serial_21285.o
3885 +obj-$(CONFIG_SERIAL_SA1100) += serial_sa1100.o
3886 +obj-$(CONFIG_SERIAL_AMBA) += serial_amba.o
3887 +obj-$(CONFIG_TS_AU1X00_ADS7846) += au1000_ts.o
3888 +obj-$(CONFIG_SERIAL_DEC) += decserial.o
3890 +ifndef CONFIG_SUN_KEYBOARD
3891 + obj-$(CONFIG_VT) += keyboard.o $(KEYMAP) $(KEYBD)
3893 + obj-$(CONFIG_PCI) += keyboard.o $(KEYMAP)
3896 +obj-$(CONFIG_HIL) += hp_keyb.o
3897 +obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
3898 +obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
3899 +obj-$(CONFIG_ROCKETPORT) += rocket.o
3900 +obj-$(CONFIG_MOXA_SMARTIO) += mxser.o
3901 +obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
3902 +obj-$(CONFIG_DIGI) += pcxx.o
3903 +obj-$(CONFIG_DIGIEPCA) += epca.o
3904 +obj-$(CONFIG_CYCLADES) += cyclades.o
3905 +obj-$(CONFIG_STALLION) += stallion.o
3906 +obj-$(CONFIG_ISTALLION) += istallion.o
3907 +obj-$(CONFIG_SIBYTE_SB1250_DUART) += sb1250_duart.o
3908 +obj-$(CONFIG_COMPUTONE) += ip2.o ip2main.o
3909 +obj-$(CONFIG_RISCOM8) += riscom8.o
3910 +obj-$(CONFIG_ISI) += isicom.o
3911 +obj-$(CONFIG_ESPSERIAL) += esp.o
3912 +obj-$(CONFIG_SYNCLINK) += synclink.o
3913 +obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o
3914 +obj-$(CONFIG_N_HDLC) += n_hdlc.o
3915 +obj-$(CONFIG_SPECIALIX) += specialix.o
3916 +obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
3917 +obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o
3918 +obj-$(CONFIG_SX) += sx.o generic_serial.o
3919 +obj-$(CONFIG_RIO) += rio/rio.o generic_serial.o
3920 +obj-$(CONFIG_SH_SCI) += sh-sci.o generic_serial.o
3921 +obj-$(CONFIG_SERIAL167) += serial167.o
3922 +obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
3923 +obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
3924 +obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
3925 +obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o
3926 +obj-$(CONFIG_SERIAL_TX3912) += generic_serial.o serial_tx3912.o
3927 +obj-$(CONFIG_TXX927_SERIAL) += serial_txx927.o
3928 +obj-$(CONFIG_SERIAL_TXX9) += generic_serial.o serial_txx9.o
3929 +obj-$(CONFIG_IP22_SERIAL) += sgiserial.o
3930 +obj-$(CONFIG_AU1X00_UART) += au1x00-serial.o
3931 +obj-$(CONFIG_SGI_L1_SERIAL) += sn_serial.o
3933 +subdir-$(CONFIG_RIO) += rio
3934 +subdir-$(CONFIG_INPUT) += joystick
3936 +obj-$(CONFIG_ATIXL_BUSMOUSE) += atixlmouse.o
3937 +obj-$(CONFIG_LOGIBUSMOUSE) += logibusmouse.o
3938 +obj-$(CONFIG_PRINTER) += lp.o
3939 +obj-$(CONFIG_TIPAR) += tipar.o
3940 +obj-$(CONFIG_OBMOUSE) += obmouse.o
3942 +ifeq ($(CONFIG_INPUT),y)
3943 +obj-y += joystick/js.o
3947 +# Texas Intruments VLYNQ driver
3950 +subdir-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq
3951 +obj-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq/avalanche_vlynq.o
3953 +obj-$(CONFIG_FETCHOP) += fetchop.o
3954 +obj-$(CONFIG_BUSMOUSE) += busmouse.o
3955 +obj-$(CONFIG_DTLK) += dtlk.o
3956 +obj-$(CONFIG_R3964) += n_r3964.o
3957 +obj-$(CONFIG_APPLICOM) += applicom.o
3958 +obj-$(CONFIG_SONYPI) += sonypi.o
3959 +obj-$(CONFIG_MS_BUSMOUSE) += msbusmouse.o
3960 +obj-$(CONFIG_82C710_MOUSE) += qpmouse.o
3961 +obj-$(CONFIG_AMIGAMOUSE) += amigamouse.o
3962 +obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
3963 +obj-$(CONFIG_ADBMOUSE) += adbmouse.o
3964 +obj-$(CONFIG_PC110_PAD) += pc110pad.o
3965 +obj-$(CONFIG_MK712_MOUSE) += mk712.o
3966 +obj-$(CONFIG_RTC) += rtc.o
3967 +obj-$(CONFIG_GEN_RTC) += genrtc.o
3968 +obj-$(CONFIG_EFI_RTC) += efirtc.o
3969 +obj-$(CONFIG_MIPS_RTC) += mips_rtc.o
3970 +obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o
3971 +ifeq ($(CONFIG_PPC),)
3972 + obj-$(CONFIG_NVRAM) += nvram.o
3974 +obj-$(CONFIG_TOSHIBA) += toshiba.o
3975 +obj-$(CONFIG_I8K) += i8k.o
3976 +obj-$(CONFIG_DS1286) += ds1286.o
3977 +obj-$(CONFIG_DS1620) += ds1620.o
3978 +obj-$(CONFIG_DS1742) += ds1742.o
3979 +obj-$(CONFIG_INTEL_RNG) += i810_rng.o
3980 +obj-$(CONFIG_AMD_RNG) += amd768_rng.o
3981 +obj-$(CONFIG_HW_RANDOM) += hw_random.o
3982 +obj-$(CONFIG_AMD_PM768) += amd76x_pm.o
3983 +obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o
3985 +obj-$(CONFIG_ITE_GPIO) += ite_gpio.o
3986 +obj-$(CONFIG_AU1X00_GPIO) += au1000_gpio.o
3987 +obj-$(CONFIG_AU1550_PSC_SPI) += au1550_psc_spi.o
3988 +obj-$(CONFIG_AU1X00_USB_TTY) += au1000_usbtty.o
3989 +obj-$(CONFIG_AU1X00_USB_RAW) += au1000_usbraw.o
3990 +obj-$(CONFIG_COBALT_LCD) += lcd.o
3992 +obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
3994 +subdir-$(CONFIG_FTAPE) += ftape
3995 +subdir-$(CONFIG_DRM_OLD) += drm-4.0
3996 +subdir-$(CONFIG_DRM_NEW) += drm
3997 +subdir-$(CONFIG_PCMCIA) += pcmcia
3998 +subdir-$(CONFIG_AGP) += agp
4000 +ifeq ($(CONFIG_FTAPE),y)
4001 +obj-y += ftape/ftape.o
4004 +obj-$(CONFIG_H8) += h8.o
4005 +obj-$(CONFIG_PPDEV) += ppdev.o
4006 +obj-$(CONFIG_DZ) += dz.o
4007 +obj-$(CONFIG_NWBUTTON) += nwbutton.o
4008 +obj-$(CONFIG_NWFLASH) += nwflash.o
4009 +obj-$(CONFIG_SCx200) += scx200.o
4010 +obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o
4012 +# Only one watchdog can succeed. We probe the hardware watchdog
4013 +# drivers first, then the softdog driver. This means if your hardware
4014 +# watchdog dies or is 'borrowed' for some reason the software watchdog
4015 +# still gives you some cover.
4017 +obj-$(CONFIG_PCWATCHDOG) += pcwd.o
4018 +obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
4019 +obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
4020 +obj-$(CONFIG_IB700_WDT) += ib700wdt.o
4021 +obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
4022 +obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
4023 +obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
4024 +obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
4025 +obj-$(CONFIG_WDT) += wdt.o
4026 +obj-$(CONFIG_WDTPCI) += wdt_pci.o
4027 +obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
4028 +obj-$(CONFIG_977_WATCHDOG) += wdt977.o
4029 +obj-$(CONFIG_I810_TCO) += i810-tco.o
4030 +obj-$(CONFIG_MACHZ_WDT) += machzwd.o
4031 +obj-$(CONFIG_SH_WDT) += shwdt.o
4032 +obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
4033 +obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
4034 +obj-$(CONFIG_ALIM1535_WDT) += alim1535d_wdt.o
4035 +obj-$(CONFIG_INDYDOG) += indydog.o
4036 +obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
4037 +obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
4038 +obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
4039 +obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
4040 +obj-$(CONFIG_INDYDOG) += indydog.o
4041 +obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
4043 +subdir-$(CONFIG_MWAVE) += mwave
4044 +ifeq ($(CONFIG_MWAVE),y)
4045 + obj-y += mwave/mwave.o
4048 +subdir-$(CONFIG_IPMI_HANDLER) += ipmi
4049 +ifeq ($(CONFIG_IPMI_HANDLER),y)
4050 + obj-y += ipmi/ipmi.o
4053 +include $(TOPDIR)/Rules.make
4057 +conmakehash: conmakehash.c
4058 + $(HOSTCC) $(HOSTCFLAGS) -o conmakehash conmakehash.c
4060 +consolemap_deftbl.c: $(FONTMAPFILE) conmakehash
4061 + ./conmakehash $(FONTMAPFILE) > consolemap_deftbl.c
4063 +consolemap_deftbl.o: consolemap_deftbl.c $(TOPDIR)/include/linux/types.h
4067 +defkeymap.c: defkeymap.map
4068 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4070 +qtronixmap.c: qtronixmap.map
4071 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4073 +ibm_workpad_keymap.c: ibm_workpad_keymap.map
4074 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4076 +victor_mpc30x_keymap.c: victor_mpc30x_keymap.map
4077 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4078 diff -urN linux.old/drivers/char/avalanche_vlynq/Makefile linux.dev/drivers/char/avalanche_vlynq/Makefile
4079 --- linux.old/drivers/char/avalanche_vlynq/Makefile 1970-01-01 01:00:00.000000000 +0100
4080 +++ linux.dev/drivers/char/avalanche_vlynq/Makefile 2005-11-10 01:10:45.871576250 +0100
4083 +# Makefile for the linux kernel.
4085 +# Note! Dependencies are done automagically by 'make dep', which also
4086 +# removes any old dependencies. DON'T put your own dependencies here
4087 +# unless it's something special (ie not a .c file).
4089 +# Note 2! The CFLAGS definitions are now in the main makefile...
4091 +O_TARGET := avalanche_vlynq.o
4093 +export-objs := vlynq_board.o
4095 +obj-y += vlynq_drv.o vlynq_hal.o vlynq_board.o
4097 +include $(TOPDIR)/Rules.make
4098 diff -urN linux.old/drivers/char/avalanche_vlynq/vlynq_board.c linux.dev/drivers/char/avalanche_vlynq/vlynq_board.c
4099 --- linux.old/drivers/char/avalanche_vlynq/vlynq_board.c 1970-01-01 01:00:00.000000000 +0100
4100 +++ linux.dev/drivers/char/avalanche_vlynq/vlynq_board.c 2005-11-10 01:10:45.871576250 +0100
4103 + * Jeff Harrell, jharrell@ti.com
4104 + * Copyright (C) 2001 Texas Instruments, Inc. All rights reserved.
4106 + * This program is free software; you can distribute it and/or modify it
4107 + * under the terms of the GNU General Public License (Version 2) as
4108 + * published by the Free Software Foundation.
4110 + * This program is distributed in the hope it will be useful, but WITHOUT
4111 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4112 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4113 + * for more details.
4115 + * You should have received a copy of the GNU General Public License along
4116 + * with this program; if not, write to the Free Software Foundation, Inc.,
4117 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4119 + * Texas Instruments Sangam specific setup.
4121 +#include <linux/config.h>
4122 +#include <linux/module.h>
4123 +#include <asm/ar7/sangam.h>
4124 +#include <asm/ar7/avalanche_misc.h>
4125 +#include <asm/ar7/vlynq.h>
4127 +#define SYS_VLYNQ_LOCAL_INTERRUPT_VECTOR 30 /* MSB - 1 bit */
4128 +#define SYS_VLYNQ_REMOTE_INTERRUPT_VECTOR 31 /* MSB bit */
4129 +#define SYS_VLYNQ_OPTIONS 0x7F; /* all options*/
4131 +/* These defines are board specific */
4134 +#define VLYNQ0_REMOTE_WINDOW1_OFFSET (0x0C000000)
4135 +#define VLYNQ0_REMOTE_WINDOW1_SIZE (0x500)
4138 +#define VLYNQ1_REMOTE_WINDOW1_OFFSET (0x0C000000)
4139 +#define VLYNQ1_REMOTE_WINDOW1_SIZE (0x500)
4142 +extern VLYNQ_DEV vlynqDevice0, vlynqDevice1;
4143 +int vlynq_init_status[2] = {0, 0};
4144 +EXPORT_SYMBOL(vlynq_init_status);
4145 +static int reset_hack = 1;
4147 +void vlynq_ar7wrd_dev_init()
4149 + *(unsigned long*) AVALANCHE_GPIO_ENBL |= (1<<18);
4150 + vlynq_delay(20000);
4151 + *(unsigned long*) AVALANCHE_GPIO_DIR &= ~(1<<18);
4152 + vlynq_delay(20000);
4153 + *(unsigned long*) AVALANCHE_GPIO_DATA_OUT&= ~(1<<18);
4154 + vlynq_delay(50000);
4155 + *(unsigned long*) AVALANCHE_GPIO_DATA_OUT|= (1<<18);
4156 + vlynq_delay(50000);
4158 + /* Initialize the MIPS host vlynq driver for a given vlynq interface */
4159 + vlynqDevice0.dev_idx = 0; /* first vlynq module - this parameter is for reference only */
4160 + vlynqDevice0.module_base = AVALANCHE_LOW_VLYNQ_CONTROL_BASE; /* vlynq0 module base address */
4162 +#if defined(CONFIG_VLYNQ_CLK_LOCAL)
4163 + vlynqDevice0.clk_source = VLYNQ_CLK_SOURCE_LOCAL;
4165 + vlynqDevice0.clk_source = VLYNQ_CLK_SOURCE_REMOTE;
4167 + vlynqDevice0.clk_div = 0x01; /* board/hardware specific */
4168 + vlynqDevice0.state = VLYNQ_DRV_STATE_UNINIT; /* uninitialized module */
4170 + /* Populate vlynqDevice0.local_mem & Vlynq0.remote_mem based on system configuration */
4171 + /*Local memory configuration */
4173 + /* Demiurg : not good !*/
4175 + vlynqDevice0.local_mem.Txmap= AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE & ~(0xc0000000) ; /* physical address */
4176 + vlynqDevice0.remote_mem.RxOffset[0]= VLYNQ0_REMOTE_WINDOW1_OFFSET; /* This is specific to the board on the other end */
4177 + vlynqDevice0.remote_mem.RxSize[0]=VLYNQ0_REMOTE_WINDOW1_SIZE;
4180 + /* Demiurg : This is how it should be ! */
4181 + vlynqDevice0.local_mem.Txmap = PHYSADDR(AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE);
4182 +#define VLYNQ_ACX111_MEM_OFFSET 0xC0000000 /* Physical address of ACX111 memory */
4183 +#define VLYNQ_ACX111_MEM_SIZE 0x00040000 /* Total size of the ACX111 memory */
4184 +#define VLYNQ_ACX111_REG_OFFSET 0xF0000000 /* PHYS_ADDR of ACX111 control registers */
4185 +#define VLYNQ_ACX111_REG_SIZE 0x00022000 /* Size of ACX111 registers area, MAC+PHY */
4186 +#define ACX111_VL1_REMOTE_SIZE 0x1000000
4187 + vlynqDevice0.remote_mem.RxOffset[0] = VLYNQ_ACX111_MEM_OFFSET;
4188 + vlynqDevice0.remote_mem.RxSize[0] = VLYNQ_ACX111_MEM_SIZE ;
4189 + vlynqDevice0.remote_mem.RxOffset[1] = VLYNQ_ACX111_REG_OFFSET;
4190 + vlynqDevice0.remote_mem.RxSize[1] = VLYNQ_ACX111_REG_SIZE ;
4191 + vlynqDevice0.remote_mem.Txmap = 0;
4192 + vlynqDevice0.local_mem.RxOffset[0] = AVALANCHE_SDRAM_BASE;
4193 + vlynqDevice0.local_mem.RxSize[0] = ACX111_VL1_REMOTE_SIZE;
4196 + /* Local interrupt configuration */
4197 + vlynqDevice0.local_irq.intLocal = VLYNQ_INT_LOCAL; /* Host handles vlynq interrupts*/
4198 + vlynqDevice0.local_irq.intRemote = VLYNQ_INT_ROOT_ISR; /* vlynq root isr used */
4199 + vlynqDevice0.local_irq.map_vector = SYS_VLYNQ_LOCAL_INTERRUPT_VECTOR;
4200 + vlynqDevice0.local_irq.intr_ptr = 0; /* Since remote interrupts part of vlynq root isr this is unused */
4202 + /* Remote interrupt configuration */
4203 + vlynqDevice0.remote_irq.intLocal = VLYNQ_INT_REMOTE; /* MIPS handles interrupts */
4204 + vlynqDevice0.remote_irq.intRemote = VLYNQ_INT_ROOT_ISR; /* Not significant since MIPS handles interrupts */
4205 + vlynqDevice0.remote_irq.map_vector = SYS_VLYNQ_REMOTE_INTERRUPT_VECTOR;
4206 + vlynqDevice0. remote_irq.intr_ptr = AVALANCHE_INTC_BASE; /* Not significant since MIPS handles interrupts */
4208 + if(reset_hack != 1)
4209 + printk("About to re-init the VLYNQ.\n");
4211 + if(vlynq_init(&vlynqDevice0,VLYNQ_INIT_PERFORM_ALL)== 0)
4213 + /* Suraj added the following to keep the 1130 going. */
4214 + vlynq_interrupt_vector_set(&vlynqDevice0, 0 /* intr vector line running into 1130 vlynq */,
4215 + 0 /* intr mapped onto the interrupt register on remote vlynq and this vlynq */,
4216 + VLYNQ_REMOTE_DVC, 0 /* polarity active high */, 0 /* interrupt Level triggered */);
4218 + /* System wide interrupt is 80 for 1130, please note. */
4219 + vlynq_init_status[0] = 1;
4224 + if(reset_hack == 1)
4225 + printk("VLYNQ INIT FAILED: Please try cold reboot. \n");
4227 + printk("Failed to initialize the VLYNQ interface at insmod.\n");
4232 +void vlynq_dev_init(void)
4234 + volatile unsigned int *reset_base = (unsigned int *) AVALANCHE_RESET_CONTROL_BASE;
4236 + *reset_base &= ~((1 << AVALANCHE_LOW_VLYNQ_RESET_BIT)); /* | (1 << AVALANCHE_HIGH_VLYNQ_RESET_BIT)); */
4238 + vlynq_delay(20000);
4240 + /* Bring vlynq out of reset if not already done */
4241 + *reset_base |= (1 << AVALANCHE_LOW_VLYNQ_RESET_BIT); /* | (1 << AVALANCHE_HIGH_VLYNQ_RESET_BIT); */
4242 + vlynq_delay(20000); /* Allowing sufficient time to VLYNQ to settle down.*/
4244 + vlynq_ar7wrd_dev_init( );
4248 +/* This function is board specific and should be ported for each board. */
4249 +void remote_vlynq_dev_reset_ctrl(unsigned int module_reset_bit,
4250 + AVALANCHE_RESET_CTRL_T reset_ctrl)
4252 + if(module_reset_bit >= 32)
4255 + switch(module_reset_bit)
4258 + if(OUT_OF_RESET == reset_ctrl)
4260 + if(reset_hack) return;
4262 + vlynq_delay(20000);
4263 + printk("Un-resetting the remote device.\n");
4265 + printk("Re-initialized the VLYNQ.\n");
4268 + else if(IN_RESET == reset_ctrl)
4270 + *(unsigned long*) AVALANCHE_GPIO_DATA_OUT &= ~(1<<18);
4272 + vlynq_delay(20000);
4273 + printk("Resetting the remote device.\n");
4286 diff -urN linux.old/drivers/char/avalanche_vlynq/vlynq_drv.c linux.dev/drivers/char/avalanche_vlynq/vlynq_drv.c
4287 --- linux.old/drivers/char/avalanche_vlynq/vlynq_drv.c 1970-01-01 01:00:00.000000000 +0100
4288 +++ linux.dev/drivers/char/avalanche_vlynq/vlynq_drv.c 2005-11-10 01:10:45.891577500 +0100
4290 +/******************************************************************************
4291 + * FILE PURPOSE: Vlynq Linux Device Driver Source
4292 + ******************************************************************************
4293 + * FILE NAME: vlynq_drv.c
4295 + * DESCRIPTION: Vlynq Linux Device Driver Source
4297 + * REVISION HISTORY:
4299 + * Date Description Author
4300 + *-----------------------------------------------------------------------------
4301 + * 17 July 2003 Initial Creation Anant Gole
4302 + * 17 Dec 2003 Updates Sharath Kumar
4304 + * (C) Copyright 2003, Texas Instruments, Inc
4305 + *******************************************************************************/
4307 +#include <linux/config.h>
4308 +#include <linux/init.h>
4309 +#include <linux/module.h>
4310 +#include <linux/sched.h>
4311 +#include <linux/miscdevice.h>
4312 +#include <linux/smp_lock.h>
4313 +#include <linux/delay.h>
4314 +#include <linux/proc_fs.h>
4315 +#include <linux/capability.h>
4316 +#include <asm/ar7/avalanche_intc.h>
4317 +#include <asm/ar7/sangam.h>
4318 +#include <asm/ar7/vlynq.h>
4321 +#define TI_VLYNQ_VERSION "0.2"
4324 +#define VLYNQ_DEBUG
4326 +/* Macro for debug and error printf's */
4328 +#define DBGPRINT printk
4330 +#define DBGPRINT(x)
4333 +#define ERRPRINT printk
4335 +/* Define the max vlynq ports this driver will support.
4336 + Device name strings are statically added here */
4337 +#define MAX_VLYNQ_PORTS 2
4340 +/* Type define for VLYNQ private structure */
4341 +typedef struct vlynqPriv{
4343 + VLYNQ_DEV *vlynqDevice;
4346 +extern int vlynq_init_status[2];
4348 +/* Extern Global variable for vlynq devices used in initialization of the vlynq device
4349 + * These variables need to be populated/initialized by the system as part of initialization
4350 + * process. The vlynq enumerator can run at initialization and populate these globals
4353 +VLYNQ_DEV vlynqDevice0;
4354 +VLYNQ_DEV vlynqDevice1;
4356 +/* Defining dummy macro AVALANCHE_HIGH_VLYNQ_INT to take
4357 + * care of compilation in case of single vlynq device
4360 +#ifndef AVALANCHE_HIGH_VLYNQ_INT
4361 +#define AVALANCHE_HIGH_VLYNQ_INT 0
4366 +/* vlynq private object */
4367 +VLYNQ_PRIV vlynq_priv[CONFIG_AR7_VLYNQ_PORTS] = {
4368 + { LNXINTNUM(AVALANCHE_LOW_VLYNQ_INT),&vlynqDevice0},
4369 + { LNXINTNUM(AVALANCHE_HIGH_VLYNQ_INT),&vlynqDevice1},
4372 +extern void vlynq_dev_init(void);
4375 +/* =================================== all the operations */
4378 +vlynq_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
4383 +static struct file_operations vlynq_fops = {
4384 + owner: THIS_MODULE,
4385 + ioctl: vlynq_ioctl,
4388 +/* Vlynq device object */
4389 +static struct miscdevice vlynq_dev [MAX_VLYNQ_PORTS] = {
4390 + { MISC_DYNAMIC_MINOR , "vlynq0", &vlynq_fops },
4391 + { MISC_DYNAMIC_MINOR , "vlynq1", &vlynq_fops },
4395 +/* Proc read function */
4397 +vlynq_read_link_proc(char *buf, char **start, off_t offset, int count, int *eof, void *unused)
4402 + len += sprintf(buf +len,"VLYNQ Devices : %d\n",CONFIG_AR7_VLYNQ_PORTS);
4404 + for(instance =0;instance < CONFIG_AR7_VLYNQ_PORTS;instance++)
4407 + char *link_msg[] = {" DOWN "," UP "};
4409 + if(vlynq_init_status[instance] == 0)
4412 + else if (vlynq_link_check(vlynq_priv[instance].vlynqDevice))
4418 + len += sprintf(buf + len, "VLYNQ %d: Link state: %s\n",instance,link_msg[link_state]);
4421 + /* Print info about vlynq device 1 */
4427 +/* Proc function to display driver version */
4429 +vlynq_read_ver_proc(char *buf, char **start, off_t offset, int count, int *eof, void *data)
4434 + len += sprintf(buf +len,"\nTI Linux VLYNQ Driver Version %s\n",TI_VLYNQ_VERSION);
4441 +/* Wrapper for vlynq ISR */
4442 +static void lnx_vlynq_root_isr(int irq, void * arg, struct pt_regs *regs)
4444 + vlynq_root_isr(arg);
4447 +/* =================================== init and cleanup */
4449 +int vlynq_init_module(void)
4453 + int instance_count = CONFIG_AR7_VLYNQ_PORTS;
4454 + volatile int *ptr;
4458 + DBGPRINT("Vlynq CONFIG_AR7_VLYNQ_PORTS=%d\n", CONFIG_AR7_VLYNQ_PORTS);
4459 + /* If num of configured vlynq ports > supported by driver return error */
4460 + if (instance_count > MAX_VLYNQ_PORTS)
4462 + ERRPRINT("ERROR: vlynq_init_module(): Max %d supported\n", MAX_VLYNQ_PORTS);
4466 + /* register the misc device */
4467 + for (unit = 0; unit < CONFIG_AR7_VLYNQ_PORTS; unit++)
4469 + ret = misc_register(&vlynq_dev[unit]);
4473 + ERRPRINT("ERROR:Could not register vlynq device:%d\n",unit);
4477 + DBGPRINT("Vlynq Device %s registered with minor no %d as misc device. Result=%d\n",
4478 + vlynq_dev[unit].name, vlynq_dev[unit].minor, ret);
4481 + DBGPRINT("Calling vlynq init\n");
4483 + /* Read the global variable for VLYNQ device structure and initialize vlynq driver */
4484 + ret = vlynq_init(vlynq_priv[unit].vlynqDevice,VLYNQ_INIT_PERFORM_ALL );
4487 + if(vlynq_init_status[unit] == 0)
4489 + printk("VLYNQ %d : init failed\n",unit);
4493 + /* Check link before proceeding */
4494 + if (!vlynq_link_check(vlynq_priv[unit].vlynqDevice))
4496 + DBGPRINT("\nError: Vlynq link not available.trying once before Exiting");
4500 + DBGPRINT("Vlynq instance:%d Link UP\n",unit);
4502 + /* Install the vlynq local root ISR */
4503 + request_irq(vlynq_priv[unit].irq,lnx_vlynq_root_isr,0,vlynq_dev[unit].name,vlynq_priv[unit].vlynqDevice);
4507 + proc_mkdir("avalanche", NULL);
4508 + /* Creating proc entry for the devices */
4509 + create_proc_read_entry("avalanche/vlynq_link", 0, NULL, vlynq_read_link_proc, NULL);
4510 + create_proc_read_entry("avalanche/vlynq_ver", 0, NULL, vlynq_read_ver_proc, NULL);
4515 +void vlynq_cleanup_module(void)
4519 + for (unit = 0; unit < CONFIG_AR7_VLYNQ_PORTS; unit++)
4521 + DBGPRINT("vlynq_cleanup_module(): Unregistring misc device %s\n",vlynq_dev[unit].name);
4522 + misc_deregister(&vlynq_dev[unit]);
4525 + remove_proc_entry("avalanche/vlynq_link", NULL);
4526 + remove_proc_entry("avalanche/vlynq_ver", NULL);
4530 +module_init(vlynq_init_module);
4531 +module_exit(vlynq_cleanup_module);
4533 diff -urN linux.old/drivers/char/avalanche_vlynq/vlynq_hal.c linux.dev/drivers/char/avalanche_vlynq/vlynq_hal.c
4534 --- linux.old/drivers/char/avalanche_vlynq/vlynq_hal.c 1970-01-01 01:00:00.000000000 +0100
4535 +++ linux.dev/drivers/char/avalanche_vlynq/vlynq_hal.c 2005-11-10 01:10:45.975582750 +0100
4537 +/***************************************************************************
4538 +**+----------------------------------------------------------------------+**
4542 +**| ********_///_**** |**
4543 +**| ***** /_//_/ **** |**
4544 +**| ** ** (__/ **** |**
4549 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
4550 +**| ALL RIGHTS RESERVED |**
4552 +**| Permission is hereby granted to licensees of Texas Instruments |**
4553 +**| Incorporated (TI) products to use this computer program for the sole |**
4554 +**| purpose of implementing a licensee product based on TI products. |**
4555 +**| No other rights to reproduce, use, or disseminate this computer |**
4556 +**| program, whether in part or in whole, are granted. |**
4558 +**| TI makes no representation or warranties with respect to the |**
4559 +**| performance of this computer program, and specifically disclaims |**
4560 +**| any responsibility for any damages, special or consequential, |**
4561 +**| connected with the use of this program. |**
4563 +**+----------------------------------------------------------------------+**
4564 +***************************************************************************/
4566 +/***************************************************************************
4567 + * ------------------------------------------------------------------------------
4568 + * Module : vlynq_hal.c
4569 + * Description : This file implements VLYNQ HAL API.
4570 + * ------------------------------------------------------------------------------
4571 + ***************************************************************************/
4573 +#include <linux/stddef.h>
4574 +#include <linux/types.h>
4575 +#include <asm/ar7/vlynq.h>
4577 +/**** Local Function prototypes *******/
4578 +static int vlynqInterruptInit(VLYNQ_DEV *pdev);
4579 +static void vlynq_configClock(VLYNQ_DEV *pdev);
4581 +/*** Second argument must be explicitly type casted to
4582 + * (VLYNQ_DEV*) inside the following functions */
4583 +static void vlynq_local_module_isr(void *arg1, void *arg2, void *arg3);
4584 +static void vlynq_remote_module_isr(void *arg1, void *arg2, void *arg3);
4587 +volatile int vlynq_delay_value = 0;
4589 +/* Code adopted from original vlynq driver */
4590 +void vlynq_delay(unsigned int clktime)
4593 + volatile int *ptr = &vlynq_delay_value;
4596 + /* We are assuming that the each cycle takes about
4597 + * 23 assembly instructions. */
4598 + for(i = 0; i < (clktime + 23)/23; i++)
4605 +/* ----------------------------------------------------------------------------
4606 + * Function : vlynq_configClock()
4607 + * Description: Configures clock settings based on input parameters
4608 + * Adapted from original vlyna driver from Cable
4610 +static void vlynq_configClock(VLYNQ_DEV * pdev)
4614 + switch( pdev->clk_source)
4616 + case VLYNQ_CLK_SOURCE_LOCAL: /* we output the clock, clk_div in range [1..8]. */
4617 + tmp = ((pdev->clk_div - 1) << 16) | VLYNQ_CTL_CLKDIR_MASK ;
4618 + VLYNQ_CTRL_REG = tmp;
4619 + VLYNQ_R_CTRL_REG = 0ul;
4621 + case VLYNQ_CLK_SOURCE_REMOTE: /* we need to set the clock pin as input */
4622 + VLYNQ_CTRL_REG = 0ul;
4623 + tmp = ((pdev->clk_div - 1) << 16) | VLYNQ_CTL_CLKDIR_MASK ;
4624 + VLYNQ_R_CTRL_REG = tmp;
4626 + default: /* do nothing about the clock, but clear other bits. */
4627 + tmp = ~(VLYNQ_CTL_CLKDIR_MASK | VLYNQ_CTL_CLKDIV_MASK);
4628 + VLYNQ_CTRL_REG &= tmp;
4633 + /* ----------------------------------------------------------------------------
4634 + * Function : vlynq_link_check()
4635 + * Description: This function checks the current VLYNQ for a link.
4636 + * An arbitrary amount of time is allowed for the link to come up .
4637 + * Returns 0 for "no link / failure " and 1 for "link available".
4638 + * -----------------------------------------------------------------------------
4640 +unsigned int vlynq_link_check( VLYNQ_DEV * pdev)
4642 + /*sleep for 64 cycles, allow link to come up*/
4645 + /* check status register return OK if link is found. */
4646 + if (VLYNQ_STATUS_REG & VLYNQ_STS_LINK_MASK)
4648 + return 1; /* Link Available */
4652 + return 0; /* Link Failure */
4656 +/* ----------------------------------------------------------------------------
4657 + * Function : vlynq_init()
4658 + * Description: Initialization function accepting paramaters for VLYNQ module
4659 + * initialization. The Options bitmap decides what operations are performed
4660 + * as a part of initialization. The Input parameters are obtained through the
4661 + * sub fields of VLYNQ_DEV structure.
4664 +int vlynq_init(VLYNQ_DEV *pdev, VLYNQ_INIT_OPTIONS options)
4667 + unsigned int val=0,cnt,tmp;
4668 + unsigned int counter=0;
4669 + VLYNQ_INTERRUPT_CNTRL *intSetting=NULL;
4671 + /* validate arguments */
4672 + if( VLYNQ_OUTRANGE(pdev->clk_source, VLYNQ_CLK_SOURCE_REMOTE, VLYNQ_CLK_SOURCE_NONE) ||
4673 + VLYNQ_OUTRANGE(pdev->clk_div, 8, 1) )
4675 + return VLYNQ_INVALID_ARG;
4678 + /** perform all sanity checks first **/
4679 + if(pdev->state != VLYNQ_DRV_STATE_UNINIT)
4680 + return VLYNQ_INVALID_DRV_STATE;
4682 + /** Initialize local and remote register set addresses- additional
4683 + * provision to access the registers directly if need be */
4684 + pdev->local = (VLYNQ_REG_SET*)pdev->module_base;
4685 + pdev->remote = (VLYNQ_REG_SET*) (pdev->module_base + VLYNQ_REMOTE_REGS_OFFSET);
4687 + /* Detect faulty int configuration that might induce int pkt looping */
4688 + if ( (options & VLYNQ_INIT_LOCAL_INTERRUPTS) && (options & VLYNQ_INIT_REMOTE_INTERRUPTS) )
4690 + /* case when both local and remote are configured */
4691 + if((pdev->local_irq.intLocal== VLYNQ_INT_REMOTE ) /* interrupts transfered to remote from local */
4692 + && (pdev->remote_irq.intLocal== VLYNQ_INT_REMOTE) /* interrupts transfered from remote to local */
4693 + && ((pdev->local_irq.intRemote == VLYNQ_INT_ROOT_ISR) || (pdev->remote_irq.intRemote == VLYNQ_INT_ROOT_ISR)) )
4695 + return (VLYNQ_INT_CONFIG_ERR);
4699 + pdev->state = VLYNQ_DRV_STATE_ININIT;
4700 + pdev->intCount = 0;
4701 + pdev->isrCount = 0;
4703 + /*** Its assumed that the vlynq module has been brought out of reset
4704 + * before invocation of vlynq_init. Since, this operation is board specific
4705 + * it must be handled outside this generic driver */
4707 + /* Assert reset the remote device, call reset_cb,
4708 + * reset CB holds Reset according to the device needs. */
4709 + VLYNQ_RESETCB(VLYNQ_RESET_ASSERT);
4711 + /* Handle VLYNQ clock, HW default (Sense On Reset) is
4712 + * usually input for all the devices. */
4713 + if (options & VLYNQ_INIT_CONFIG_CLOCK)
4715 + vlynq_configClock(pdev);
4718 + /* Call reset_cb again. It will release the remote device
4719 + * from reset, and wait for a while. */
4720 + VLYNQ_RESETCB(VLYNQ_RESET_DEASSERT);
4722 + if(options & VLYNQ_INIT_CHECK_LINK )
4724 + /* Check for link up during initialization*/
4725 + while( counter < 25 )
4727 + /* loop around giving a chance for link status to settle down */
4729 + if(vlynq_link_check(pdev))
4731 + /* Link is up exit loop*/
4735 + vlynq_delay(4000);
4736 + }/*end of while counter loop */
4738 + if(!vlynq_link_check(pdev))
4740 + /* Handle this case as abort */
4741 + pdev->state = VLYNQ_DRV_STATE_ERROR;
4742 + VLYNQ_RESETCB( VLYNQ_RESET_INITFAIL);
4743 + return VLYNQ_LINK_DOWN;
4744 + }/* end of if not vlynq_link_check conditional block */
4746 + }/*end of if options & VLYNQ_INIT_CHECK_LINK conditional block */
4749 + if (options & VLYNQ_INIT_LOCAL_MEM_REGIONS)
4751 + /* Initialise local memory regions . This initialization lets
4752 + * the local host access remote device memory regions*/
4755 + /* configure the VLYNQ portal window to a PHYSICAL
4756 + * address of the local CPU */
4757 + VLYNQ_ALIGN4(pdev->local_mem.Txmap);
4758 + VLYNQ_TXMAP_REG = (pdev->local_mem.Txmap);
4760 + /*This code assumes input parameter is itself a physical address */
4761 + for(i=0; i < VLYNQ_MAX_MEMORY_REGIONS ; i++)
4763 + /* Physical address on the remote */
4765 + VLYNQ_R_RXMAP_SIZE_REG(map) = 0;
4766 + if( pdev->remote_mem.RxSize[i])
4768 + VLYNQ_ALIGN4(pdev->remote_mem.RxOffset[i]);
4769 + VLYNQ_ALIGN4(pdev->remote_mem.RxSize[i]);
4770 + VLYNQ_R_RXMAP_OFFSET_REG(map) = pdev->remote_mem.RxOffset[i];
4771 + VLYNQ_R_RXMAP_SIZE_REG(map) = pdev->remote_mem.RxSize[i];
4776 + if(options & VLYNQ_INIT_REMOTE_MEM_REGIONS )
4780 + /* Initialise remote memory regions. This initialization lets remote
4781 + * device access local host memory regions. It configures the VLYNQ portal
4782 + * window to a PHYSICAL address of the remote */
4783 + VLYNQ_ALIGN4(pdev->remote_mem.Txmap);
4784 + VLYNQ_R_TXMAP_REG = pdev->remote_mem.Txmap;
4786 + for( i=0; i<VLYNQ_MAX_MEMORY_REGIONS; i++)
4788 + /* Physical address on the local */
4790 + VLYNQ_RXMAP_SIZE_REG(map) = 0;
4791 + if( pdev->local_mem.RxSize[i])
4793 + VLYNQ_ALIGN4(pdev->local_mem.RxOffset[i]);
4794 + VLYNQ_ALIGN4(pdev->local_mem.RxSize[i]);
4795 + VLYNQ_RXMAP_OFFSET_REG(map) = (pdev->local_mem.RxOffset[i]);
4796 + VLYNQ_RXMAP_SIZE_REG(map) = (pdev->local_mem.RxSize[i]);
4801 + /* Adapted from original vlynq driver from cable - Calculate VLYNQ bus width */
4802 + pdev->width = 3 + VLYNQ_STATUS_FLD_WIDTH(VLYNQ_STATUS_REG)
4803 + + VLYNQ_STATUS_FLD_WIDTH(VLYNQ_R_STATUS_REG);
4805 + /* chance to initialize the device, e.g. to boost VLYNQ
4806 + * clock by modifying pdev->clk_div or and verify the width. */
4807 + VLYNQ_RESETCB(VLYNQ_RESET_LINKESTABLISH);
4809 + /* Handle VLYNQ clock, HW default (Sense On Reset) is
4810 + * usually input for all the devices. */
4811 + if(options & VLYNQ_INIT_CONFIG_CLOCK )
4813 + vlynq_configClock(pdev);
4816 + /* last check for link*/
4817 + if(options & VLYNQ_INIT_CHECK_LINK )
4819 + /* Final Check for link during initialization*/
4820 + while( counter < 25 )
4822 + /* loop around giving a chance for link status to settle down */
4824 + if(vlynq_link_check(pdev))
4826 + /* Link is up exit loop*/
4830 + vlynq_delay(4000);
4831 + }/*end of while counter loop */
4833 + if(!vlynq_link_check(pdev))
4835 + /* Handle this case as abort */
4836 + pdev->state = VLYNQ_DRV_STATE_ERROR;
4837 + VLYNQ_RESETCB( VLYNQ_RESET_INITFAIL);
4838 + return VLYNQ_LINK_DOWN;
4839 + }/* end of if not vlynq_link_check conditional block */
4841 + } /* end of if options & VLYNQ_INIT_CHECK_LINK */
4843 + if(options & VLYNQ_INIT_LOCAL_INTERRUPTS )
4845 + /* Configure local interrupt settings */
4846 + intSetting = &(pdev->local_irq);
4848 + /* Map local module status interrupts to interrupt vector*/
4849 + val = intSetting->map_vector << VLYNQ_CTL_INTVEC_SHIFT ;
4851 + /* enable local module status interrupts */
4852 + val |= 0x01 << VLYNQ_CTL_INTEN_SHIFT;
4854 + if ( intSetting->intLocal == VLYNQ_INT_LOCAL )
4856 + /*set the intLocal bit*/
4857 + val |= 0x01 << VLYNQ_CTL_INTLOCAL_SHIFT;
4860 + /* Irrespective of whether interrupts are handled locally, program
4861 + * int2Cfg. Error checking for accidental loop(when intLocal=0 and int2Cfg=1
4862 + * i.e remote packets are set intPending register->which will result in
4863 + * same packet being sent out) has been done already
4866 + if (intSetting->intRemote == VLYNQ_INT_ROOT_ISR)
4868 + /* Set the int2Cfg register, so that remote interrupt
4869 + * packets are written to intPending register */
4870 + val |= 0x01 << VLYNQ_CTL_INT2CFG_SHIFT;
4872 + /* Set intPtr register to point to intPending register */
4873 + VLYNQ_INT_PTR_REG = VLYNQ_INT_PENDING_REG_PTR ;
4877 + /*set the interrupt pointer register*/
4878 + VLYNQ_INT_PTR_REG = intSetting->intr_ptr;
4879 + /* Dont bother to modify int2Cfg as it would be zero */
4882 + /** Clear bits related to INT settings in control register **/
4883 + VLYNQ_CTRL_REG = VLYNQ_CTRL_REG & (~VLYNQ_CTL_INTFIELDS_CLEAR_MASK);
4885 + /** Or the bits to be set with Control register **/
4886 + VLYNQ_CTRL_REG = VLYNQ_CTRL_REG | val;
4888 + /* initialise local ICB */
4889 + if(vlynqInterruptInit(pdev)==VLYNQ_MEMALLOC_FAIL)
4890 + return VLYNQ_MEMALLOC_FAIL;
4892 + /* Install handler for local module status interrupts. By default when
4893 + * local interrupt setting is initialised, the local module status are
4894 + * enabled and handler hooked up */
4895 + if(vlynq_install_isr(pdev, intSetting->map_vector, vlynq_local_module_isr,
4896 + pdev, NULL, NULL) == VLYNQ_INVALID_ARG)
4897 + return VLYNQ_INVALID_ARG;
4898 + } /* end of init local interrupts */
4900 + if(options & VLYNQ_INIT_REMOTE_INTERRUPTS )
4902 + /* Configure remote interrupt settings from configuration */
4903 + intSetting = &(pdev->remote_irq);
4905 + /* Map remote module status interrupts to remote interrupt vector*/
4906 + val = intSetting->map_vector << VLYNQ_CTL_INTVEC_SHIFT ;
4907 + /* enable remote module status interrupts */
4908 + val |= 0x01 << VLYNQ_CTL_INTEN_SHIFT;
4910 + if ( intSetting->intLocal == VLYNQ_INT_LOCAL )
4912 + /*set the intLocal bit*/
4913 + val |= 0x01 << VLYNQ_CTL_INTLOCAL_SHIFT;
4916 + /* Irrespective of whether interrupts are handled locally, program
4917 + * int2Cfg. Error checking for accidental loop(when intLocal=0 and int2Cfg=1
4918 + * i.e remote packets are set intPending register->which will result in
4919 + * same packet being sent out) has been done already
4922 + if (intSetting->intRemote == VLYNQ_INT_ROOT_ISR)
4924 + /* Set the int2Cfg register, so that remote interrupt
4925 + * packets are written to intPending register */
4926 + val |= 0x01 << VLYNQ_CTL_INT2CFG_SHIFT;
4927 + /* Set intPtr register to point to intPending register */
4928 + VLYNQ_R_INT_PTR_REG = VLYNQ_R_INT_PENDING_REG_PTR ;
4932 + /*set the interrupt pointer register*/
4933 + VLYNQ_R_INT_PTR_REG = intSetting->intr_ptr;
4934 + /* Dont bother to modify int2Cfg as it would be zero */
4937 + if( (intSetting->intLocal == VLYNQ_INT_REMOTE) &&
4938 + (options & VLYNQ_INIT_LOCAL_INTERRUPTS) &&
4939 + (pdev->local_irq.intRemote == VLYNQ_INT_ROOT_ISR) )
4941 + /* Install handler for remote module status interrupts. By default when
4942 + * remote interrupts are forwarded to local root_isr then remote_module_isr is
4943 + * enabled and handler hooked up */
4944 + if(vlynq_install_isr(pdev,intSetting->map_vector,vlynq_remote_module_isr,
4945 + pdev, NULL, NULL) == VLYNQ_INVALID_ARG)
4946 + return VLYNQ_INVALID_ARG;
4950 + /** Clear bits related to INT settings in control register **/
4951 + VLYNQ_R_CTRL_REG = VLYNQ_R_CTRL_REG & (~VLYNQ_CTL_INTFIELDS_CLEAR_MASK);
4953 + /** Or the bits to be set with the remote Control register **/
4954 + VLYNQ_R_CTRL_REG = VLYNQ_R_CTRL_REG | val;
4956 + } /* init remote interrupt settings*/
4958 + if(options & VLYNQ_INIT_CLEAR_ERRORS )
4960 + /* Clear errors during initialization */
4961 + tmp = VLYNQ_STATUS_REG & (VLYNQ_STS_RERROR_MASK | VLYNQ_STS_LERROR_MASK);
4962 + VLYNQ_STATUS_REG = tmp;
4963 + tmp = VLYNQ_R_STATUS_REG & (VLYNQ_STS_RERROR_MASK | VLYNQ_STS_LERROR_MASK);
4964 + VLYNQ_R_STATUS_REG = tmp;
4967 + /* clear int status */
4968 + val = VLYNQ_INT_STAT_REG;
4969 + VLYNQ_INT_STAT_REG = val;
4971 + /* finish initialization */
4972 + pdev->state = VLYNQ_DRV_STATE_RUN;
4973 + VLYNQ_RESETCB( VLYNQ_RESET_INITOK);
4974 + return VLYNQ_SUCCESS;
4979 +/* ----------------------------------------------------------------------------
4980 + * Function : vlynqInterruptInit()
4981 + * Description: This local function is used to set up the ICB table for the
4982 + * VLYNQ_STATUS_REG vlynq module. The input parameter "pdev" points the vlynq
4983 + * device instance whose ICB is allocated.
4984 + * Return : returns VLYNQ_SUCCESS or vlynq error for failure
4985 + * -----------------------------------------------------------------------------
4987 +static int vlynqInterruptInit(VLYNQ_DEV *pdev)
4991 + /* Memory allocated statically.
4992 + * Initialise ICB,free list.Indicate primary slot empty.
4993 + * Intialise intVector <==> map_vector translation table*/
4994 + for(i=0; i < VLYNQ_NUM_INT_BITS; i++)
4996 + pdev->pIntrCB[i].isr = NULL;
4997 + pdev->pIntrCB[i].next = NULL; /*nothing chained */
4998 + pdev->vector_map[i] = -1; /* indicates unmapped */
5001 + /* In the ICB slots, [VLYNQ_NUM_INT_BITS i.e 32 to ICB array size) are expansion slots
5002 + * required only when interrupt chaining/sharing is supported. In case
5003 + * of chained interrupts the list starts from primary slot and the
5004 + * additional slots are obtained from the common free area */
5006 + /* Initialise freelist */
5008 + numslots = VLYNQ_NUM_INT_BITS + VLYNQ_IVR_CHAIN_SLOTS;
5010 + if (numslots > VLYNQ_NUM_INT_BITS)
5012 + pdev->freelist = &(pdev->pIntrCB[VLYNQ_NUM_INT_BITS]);
5014 + for(i = VLYNQ_NUM_INT_BITS; i < (numslots-1) ; i++)
5016 + pdev->pIntrCB[i].next = &(pdev->pIntrCB[i+1]);
5017 + pdev->pIntrCB[i].isr = NULL;
5019 + pdev->pIntrCB[i].next=NULL; /* Indicate end of freelist*/
5020 + pdev->pIntrCB[i].isr=NULL;
5024 + pdev->freelist = NULL;
5027 + /** Reset mapping for IV 0-7 **/
5028 + VLYNQ_IVR_03TO00_REG = 0;
5029 + VLYNQ_IVR_07TO04_REG = 0;
5031 + return VLYNQ_SUCCESS;
5034 +/** remember that hooking up of root ISR handler with the interrupt controller
5035 + * is not done as a part of this driver. Typically, it must be done after
5036 + * invoking vlynq_init*/
5039 + /* ----------------------------------------------------------------------------
5040 + * ISR with the SOC interrupt controller. This ISR typically scans
5041 + * the Int PENDING/SET register in the VLYNQ module and calls the
5042 + * appropriate ISR associated with the correponding vector number.
5043 + * -----------------------------------------------------------------------------
5045 +void vlynq_root_isr(void *arg)
5047 + int source; /* Bit position of pending interrupt, start from 0 */
5048 + unsigned int interrupts, clrInterrupts;
5050 + VLYNQ_INTR_CNTRL_ICB *entry;
5052 + pdev=(VLYNQ_DEV*)(arg); /*obtain the vlynq device pointer*/
5054 + interrupts = VLYNQ_INT_STAT_REG; /* Get the list of pending interrupts */
5055 + VLYNQ_INT_STAT_REG = interrupts; /* clear the int CR register */
5056 + clrInterrupts = interrupts; /* save them for further analysis */
5058 + debugPrint("vlynq_root_isr: dev %u. INTCR = 0x%08lx\n", pdev->dev_idx, clrInterrupts,0,0,0,0);
5060 + /* Scan interrupt bits */
5062 + while( clrInterrupts != 0)
5064 + /* test if bit is set? */
5065 + if( 0x1ul & clrInterrupts)
5067 + entry = &(pdev->pIntrCB[source]); /* Get the ISR entry */
5068 + pdev->intCount++; /* update interrupt count */
5069 + if(entry->isr != NULL)
5073 + pdev->isrCount++; /* update isr invocation count */
5074 + /* Call the user ISR and update the count for ISR */
5075 + entry->isrCount++;
5076 + entry->isr(entry->arg1, entry->arg2, entry->arg3);
5077 + if (entry->next == NULL) break;
5078 + entry = entry->next;
5080 + } while (entry->isr != NULL);
5084 + debugPrint(" ISR not installed for vlynq vector:%d\n",source,0,0,0,0,0);
5087 + clrInterrupts >>= 1; /* Next source bit */
5089 + } /* endWhile clrInterrupts != 0 */
5093 + /* ----------------------------------------------------------------------------
5094 + * Function : vlynq_local__module_isr()
5095 + * Description: This ISR is attached to the local VLYNQ interrupt vector
5096 + * by the Vlynq Driver when local interrupts are being handled. i.e.
5097 + * intLocal=1. This ISR handles local Vlynq module status interrupts only
5098 + * AS a part of this ISR, user callback in VLYNQ_DEV structure
5100 + * VLYNQ_DEV is passed as arg1. arg2 and arg3 are unused.
5101 + * -----------------------------------------------------------------------------
5103 +static void vlynq_local_module_isr(void *arg1,void *arg2, void *arg3)
5105 + VLYNQ_REPORT_CB func;
5106 + unsigned int dwStatRegVal;
5109 + pdev = (VLYNQ_DEV*) arg1;
5110 + /* Callback function is read from the device pointer that is passed as an argument */
5111 + func = pdev->report_cb;
5113 + /* read local status register */
5114 + dwStatRegVal = VLYNQ_STATUS_REG;
5116 + /* clear pending events */
5117 + VLYNQ_STATUS_REG = dwStatRegVal;
5119 + /* invoke user callback */
5121 + func( pdev, VLYNQ_LOCAL_DVC, dwStatRegVal);
5125 + /* ----------------------------------------------------------------------------
5126 + * Function : vlynq_remote_module_isr()
5127 + * Description: This ISR is attached to the remote VLYNQ interrupt vector
5128 + * by the Vlynq Driver when remote interrupts are being handled locally. i.e.
5129 + * intLocal=1. This ISR handles local Vlynq module status interrupts only
5130 + * AS a part of this ISR, user callback in VLYNQ_DEV structure
5132 + * The parameters irq,regs ar unused.
5133 + * -----------------------------------------------------------------------------
5135 +static void vlynq_remote_module_isr(void *arg1,void *arg2, void *arg3)
5137 + VLYNQ_REPORT_CB func;
5138 + unsigned int dwStatRegVal;
5142 + pdev = (VLYNQ_DEV*) arg1;
5144 + /* Callback function is read from the device pointer that is passed as an argument */
5145 + func = pdev->report_cb;
5147 + /* read local status register */
5148 + dwStatRegVal = VLYNQ_R_STATUS_REG;
5150 + /* clear pending events */
5151 + VLYNQ_R_STATUS_REG = dwStatRegVal;
5153 + /* invoke user callback */
5155 + func( pdev, VLYNQ_REMOTE_DVC, dwStatRegVal);
5159 +/* ----------------------------------------------------------------------------
5160 + * Function : vlynq_interrupt_get_count()
5161 + * Description: This function returns the number of times a particular intr
5162 + * has been invoked.
5164 + * It returns 0, if erroneous map_vector is specified or if the corres isr
5165 + * has not been registered with VLYNQ.
5167 +unsigned int vlynq_interrupt_get_count(VLYNQ_DEV *pdev,
5168 + unsigned int map_vector)
5170 + VLYNQ_INTR_CNTRL_ICB *entry;
5171 + unsigned int count = 0;
5173 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5176 + entry = &(pdev->pIntrCB[map_vector]);
5179 + count = entry->isrCount;
5185 +/* ----------------------------------------------------------------------------
5186 + * Function : vlynq_install_isr()
5187 + * Description: This function installs ISR for Vlynq interrupt vector
5188 + * bits(in IntPending register). This function should be used only when
5189 + * Vlynq interrupts are being handled locally(remote may be programmed to send
5190 + * interrupt packets).Also, the int2cfg should be 1 and the least significant
5191 + * 8 bits of the Interrupt Pointer Register must point to Interrupt
5192 + * Pending/Set Register).
5193 + * If host int2cfg=0 and the Interrupt Pointer register contains
5194 + * the address of the interrupt set register in the interrupt controller
5195 + * module of the local device , then the ISR for the remote interrupt must be
5196 + * directly registered with the Interrupt controller and must not use this API
5197 + * Note: this function simply installs the ISR in ICB It doesnt modify
5198 + * any register settings
5201 +vlynq_install_isr(VLYNQ_DEV *pdev,
5202 + unsigned int map_vector,
5203 + VLYNQ_INTR_CNTRL_ISR isr,
5204 + void *arg1, void *arg2, void *arg3)
5206 + VLYNQ_INTR_CNTRL_ICB *entry;
5208 + if ( (map_vector > (VLYNQ_NUM_INT_BITS-1)) || (isr == NULL) )
5209 + return VLYNQ_INVALID_ARG;
5211 + entry = &(pdev->pIntrCB[map_vector]);
5213 + if(entry->isr == NULL)
5216 + entry->arg1 = arg1;
5217 + entry->arg2 = arg2;
5218 + entry->arg3 = arg3;
5219 + entry->next = NULL;
5223 + /** No more empty slots,return error */
5224 + if(pdev->freelist == NULL)
5225 + return VLYNQ_MEMALLOC_FAIL;
5227 + while(entry->next != NULL)
5229 + entry = entry->next;
5232 + /* Append new node to the chain */
5233 + entry->next = pdev->freelist;
5234 + /* Remove the appended node from freelist */
5235 + pdev->freelist = pdev->freelist->next;
5236 + entry= entry->next;
5238 + /*** Set the ICB fields ***/
5240 + entry->arg1 = arg1;
5241 + entry->arg2 = arg2;
5242 + entry->arg3 = arg3;
5243 + entry->next = NULL;
5246 + return VLYNQ_SUCCESS;
5251 +/* ----------------------------------------------------------------------------
5252 + * Function : vlynq_uninstall_isr
5253 + * Description: This function is used to uninstall a previously
5254 + * registered ISR. In case of shared/chained interrupts, the
5255 + * void * arg parameter must uniquely identify the ISR to be
5257 + * Note: this function simply uninstalls the ISR in ICB
5258 + * It doesnt modify any register settings
5261 +vlynq_uninstall_isr(VLYNQ_DEV *pdev,
5262 + unsigned int map_vector,
5263 + void *arg1, void *arg2, void *arg3)
5265 + VLYNQ_INTR_CNTRL_ICB *entry,*temp;
5267 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5268 + return VLYNQ_INVALID_ARG;
5270 + entry = &(pdev->pIntrCB[map_vector]);
5272 + if(entry->isr == NULL )
5273 + return VLYNQ_ISR_NON_EXISTENT;
5275 + if ( (entry->arg1 == arg1) && (entry->arg2 == arg2) && (entry->arg3 == arg3) )
5277 + if(entry->next == NULL)
5280 + return VLYNQ_SUCCESS;
5284 + temp = entry->next;
5285 + /* Copy next node in the chain to prim.slot */
5286 + entry->isr = temp->isr;
5287 + entry->arg1 = temp->arg1;
5288 + entry->arg2 = temp->arg2;
5289 + entry->arg3 = temp->arg3;
5290 + entry->next = temp->next;
5291 + /* Free the just copied node */
5293 + temp->arg1 = NULL;
5294 + temp->arg2 = NULL;
5295 + temp->arg3 = NULL;
5296 + temp->next = pdev->freelist;
5297 + pdev->freelist = temp;
5298 + return VLYNQ_SUCCESS;
5304 + while ( (entry = temp->next) != NULL)
5306 + if ( (entry->arg1 == arg1) && (entry->arg2 == arg2) && (entry->arg3 == arg3) )
5308 + /* remove node from chain */
5309 + temp->next = entry->next;
5310 + /* Add the removed node to freelist */
5311 + entry->isr = NULL;
5312 + entry->arg1 = NULL;
5313 + entry->arg2 = NULL;
5314 + entry->arg3 = NULL;
5315 + entry->next = pdev->freelist;
5316 + entry->isrCount = 0;
5317 + pdev->freelist = entry;
5318 + return VLYNQ_SUCCESS;
5323 + return VLYNQ_ISR_NON_EXISTENT;
5330 +/* ----------------------------------------------------------------------------
5331 + * function : vlynq_interrupt_vector_set()
5332 + * description:configures interrupt vector mapping,interrupt type
5333 + * polarity -all in one go.
5336 +vlynq_interrupt_vector_set(VLYNQ_DEV *pdev, /* vlynq device */
5337 + unsigned int int_vector, /* int vector on vlynq device */
5338 + unsigned int map_vector, /* bit for this interrupt */
5339 + VLYNQ_DEV_TYPE dev_type, /* local or remote device */
5340 + VLYNQ_INTR_POLARITY pol, /* polarity of interrupt */
5341 + VLYNQ_INTR_TYPE type) /* pulsed/level interrupt */
5343 + volatile unsigned int * vecreg;
5344 + unsigned int val=0;
5345 + unsigned int bytemask=0XFF;
5347 + /* use the lower 8 bits of val to set the value , shift it to
5348 + * appropriate byte position in the ivr and write it to the
5349 + * corresponding register */
5351 + /* validate the number of interrupts supported */
5352 + if (int_vector >= VLYNQ_IVR_MAXIVR)
5353 + return VLYNQ_INVALID_ARG;
5355 + if(map_vector > (VLYNQ_NUM_INT_BITS - 1) )
5356 + return VLYNQ_INVALID_ARG;
5358 + if (dev_type == VLYNQ_LOCAL_DVC)
5360 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5364 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5367 + /* Update the intVector<==> bit position translation table */
5368 + pdev->vector_map[map_vector] = int_vector;
5370 + /* val has been initialised to zero. we only have to turn on appropriate bits*/
5371 + if(type == VLYNQ_INTR_PULSED)
5372 + val |= VLYNQ_IVR_INTTYPE_MASK;
5374 + if(pol == VLYNQ_INTR_ACTIVE_LOW)
5375 + val |= VLYNQ_IVR_INTPOL_MASK;
5377 + val |= map_vector;
5379 + /** clear the correct byte position and then or val **/
5380 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5382 + /** write to correct byte position in vecreg*/
5383 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5385 + /* Setting a interrupt vector, leaves the interrupt disabled
5386 + * which must be enabled subsequently */
5388 + return VLYNQ_SUCCESS;
5392 +/* ----------------------------------------------------------------------------
5393 + * Function : vlynq_interrupt_vector_cntl()
5394 + * Description:enables/disable interrupt
5396 +int vlynq_interrupt_vector_cntl( VLYNQ_DEV *pdev,
5397 + unsigned int int_vector,
5398 + VLYNQ_DEV_TYPE dev_type,
5399 + unsigned int enable)
5401 + volatile unsigned int *vecReg;
5402 + unsigned int val=0;
5403 + unsigned int intenMask=0x80;
5405 + /* validate the number of interrupts supported */
5406 + if (int_vector >= VLYNQ_IVR_MAXIVR)
5407 + return VLYNQ_INVALID_ARG;
5409 + if (dev_type == VLYNQ_LOCAL_DVC)
5411 + vecReg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5415 + vecReg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5418 + /** Clear the correct byte position and then or val **/
5419 + *vecReg = (*vecReg) & ( ~(intenMask << ( (int_vector %4)*8) ) );
5423 + val |= VLYNQ_IVR_INTEN_MASK;
5424 + /** Write to correct byte position in vecReg*/
5425 + *vecReg = (*vecReg) | (val << ( (int_vector % 4)*8) ) ;
5428 + return VLYNQ_SUCCESS;
5430 +}/* end of function vlynq_interrupt_vector_cntl */
5434 +/* ----------------------------------------------------------------------------
5435 + * Function : vlynq_interrupt_vector_map()
5436 + * Description:Configures interrupt vector mapping alone
5439 +vlynq_interrupt_vector_map( VLYNQ_DEV *pdev,
5440 + VLYNQ_DEV_TYPE dev_type,
5441 + unsigned int int_vector,
5442 + unsigned int map_vector)
5444 + volatile unsigned int * vecreg;
5445 + unsigned int val=0;
5446 + unsigned int bytemask=0x1f; /* mask to turn off bits corresponding to int vector */
5448 + /* use the lower 8 bits of val to set the value , shift it to
5449 + * appropriate byte position in the ivr and write it to the
5450 + * corresponding register */
5452 + /* validate the number of interrupts supported */
5453 + if (int_vector >= VLYNQ_IVR_MAXIVR)
5454 + return VLYNQ_INVALID_ARG;
5456 + if(map_vector > (VLYNQ_NUM_INT_BITS - 1) )
5457 + return VLYNQ_INVALID_ARG;
5459 + if (dev_type == VLYNQ_LOCAL_DVC)
5461 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5465 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5468 + /* Update the intVector<==> bit position translation table */
5469 + pdev->vector_map[map_vector] = int_vector;
5471 + /** val has been initialised to zero. we only have to turn on
5472 + * appropriate bits*/
5473 + val |= map_vector;
5475 + /** clear the correct byte position and then or val **/
5476 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5478 + /** write to correct byte position in vecreg*/
5479 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5481 + return VLYNQ_SUCCESS;
5485 +/* ----------------------------------------------------------------------------
5486 + * function : vlynq_interrupt_set_polarity()
5487 + * description:configures interrupt polarity .
5490 +vlynq_interrupt_set_polarity( VLYNQ_DEV *pdev ,
5491 + VLYNQ_DEV_TYPE dev_type,
5492 + unsigned int map_vector,
5493 + VLYNQ_INTR_POLARITY pol)
5495 + volatile unsigned int * vecreg;
5497 + unsigned int val=0;
5498 + unsigned int bytemask=0x20; /** mask to turn off bits corresponding to int polarity */
5500 + /* get the int_vector from map_vector */
5501 + int_vector = pdev->vector_map[map_vector];
5503 + if(int_vector == -1)
5504 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5506 + /* use the lower 8 bits of val to set the value , shift it to
5507 + * appropriate byte position in the ivr and write it to the
5508 + * corresponding register */
5510 + if (dev_type == VLYNQ_LOCAL_DVC)
5512 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5516 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5519 + /* val has been initialised to zero. we only have to turn on
5520 + * appropriate bits, if need be*/
5522 + /** clear the correct byte position and then or val **/
5523 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5525 + if( pol == VLYNQ_INTR_ACTIVE_LOW)
5527 + val |= VLYNQ_IVR_INTPOL_MASK;
5528 + /** write to correct byte position in vecreg*/
5529 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5532 + return VLYNQ_SUCCESS;
5535 +int vlynq_interrupt_get_polarity( VLYNQ_DEV *pdev ,
5536 + VLYNQ_DEV_TYPE dev_type,
5537 + unsigned int map_vector)
5539 + volatile unsigned int * vecreg;
5541 + unsigned int val=0;
5543 + /* get the int_vector from map_vector */
5544 + int_vector = pdev->vector_map[map_vector];
5546 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5549 + if(int_vector == -1)
5550 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5552 + /* use the lower 8 bits of val to set the value , shift it to
5553 + * appropriate byte position in the ivr and write it to the
5554 + * corresponding register */
5556 + if (dev_type == VLYNQ_LOCAL_DVC)
5558 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5562 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5565 + /** read the information into val **/
5566 + val = (*vecreg) & ((VLYNQ_IVR_INTPOL_MASK << ( (int_vector %4)*8) ) );
5568 + return (val ? (VLYNQ_INTR_ACTIVE_LOW) : (VLYNQ_INTR_ACTIVE_HIGH));
5572 +/* ----------------------------------------------------------------------------
5573 + * function : vlynq_interrupt_set_type()
5574 + * description:configures interrupt type .
5576 +int vlynq_interrupt_set_type( VLYNQ_DEV *pdev,
5577 + VLYNQ_DEV_TYPE dev_type,
5578 + unsigned int map_vector,
5579 + VLYNQ_INTR_TYPE type)
5581 + volatile unsigned int * vecreg;
5582 + unsigned int val=0;
5585 + /** mask to turn off bits corresponding to interrupt type */
5586 + unsigned int bytemask=0x40;
5588 + /* get the int_vector from map_vector */
5589 + int_vector = pdev->vector_map[map_vector];
5590 + if(int_vector == -1)
5591 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5593 + /* use the lower 8 bits of val to set the value , shift it to
5594 + * appropriate byte position in the ivr and write it to the
5595 + * corresponding register */
5596 + if (dev_type == VLYNQ_LOCAL_DVC)
5598 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5602 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5605 + /** val has been initialised to zero. we only have to turn on
5606 + * appropriate bits if need be*/
5608 + /** clear the correct byte position and then or val **/
5609 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5611 + if( type == VLYNQ_INTR_PULSED)
5613 + val |= VLYNQ_IVR_INTTYPE_MASK;
5614 + /** write to correct byte position in vecreg*/
5615 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5618 + return VLYNQ_SUCCESS;
5621 +/* ----------------------------------------------------------------------------
5622 + * function : vlynq_interrupt_get_type()
5623 + * description:returns interrupt type .
5625 +int vlynq_interrupt_get_type( VLYNQ_DEV *pdev, VLYNQ_DEV_TYPE dev_type,
5626 + unsigned int map_vector)
5628 + volatile unsigned int * vecreg;
5629 + unsigned int val=0;
5632 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5635 + /* get the int_vector from map_vector */
5636 + int_vector = pdev->vector_map[map_vector];
5637 + if(int_vector == -1)
5638 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5640 + /* use the lower 8 bits of val to set the value , shift it to
5641 + * appropriate byte position in the ivr and write it to the
5642 + * corresponding register */
5643 + if (dev_type == VLYNQ_LOCAL_DVC)
5645 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5649 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5652 + /** Read the correct bit position into val **/
5653 + val = (*vecreg) & ((VLYNQ_IVR_INTTYPE_MASK << ( (int_vector %4)*8) ) );
5655 + return (val ? (VLYNQ_INTR_PULSED) : (VLYNQ_INTR_LEVEL));
5658 +/* ----------------------------------------------------------------------------
5659 + * function : vlynq_interrupt_enable()
5660 + * description:Enable interrupt by writing to IVR register.
5662 +int vlynq_interrupt_enable( VLYNQ_DEV *pdev,
5663 + VLYNQ_DEV_TYPE dev_type,
5664 + unsigned int map_vector)
5666 + volatile unsigned int * vecreg;
5667 + unsigned int val=0;
5670 + /** mask to turn off bits corresponding to interrupt enable */
5671 + unsigned int bytemask=0x80;
5673 + /* get the int_vector from map_vector */
5674 + int_vector = pdev->vector_map[map_vector];
5675 + if(int_vector == -1)
5676 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5678 + /* use the lower 8 bits of val to set the value , shift it to
5679 + * appropriate byte position in the ivr and write it to the
5680 + * corresponding register */
5682 + if (dev_type == VLYNQ_LOCAL_DVC)
5684 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5688 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5691 + /** val has been initialised to zero. we only have to turn on
5692 + * bit corresponding to interrupt enable*/
5693 + val |= VLYNQ_IVR_INTEN_MASK;
5695 + /** clear the correct byte position and then or val **/
5696 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5698 + /** write to correct byte position in vecreg*/
5699 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5701 + return VLYNQ_SUCCESS;
5705 +/* ----------------------------------------------------------------------------
5706 + * function : vlynq_interrupt_disable()
5707 + * description:Disable interrupt by writing to IVR register.
5710 +vlynq_interrupt_disable( VLYNQ_DEV *pdev,
5711 + VLYNQ_DEV_TYPE dev_type,
5712 + unsigned int map_vector)
5714 + volatile unsigned int * vecreg;
5717 + /** mask to turn off bits corresponding to interrupt enable */
5718 + unsigned int bytemask=0x80;
5720 + /* get the int_vector from map_vector */
5721 + int_vector = pdev->vector_map[map_vector];
5722 + if(int_vector == -1)
5723 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5725 + /* use the lower 8 bits of val to set the value , shift it to
5726 + * appropriate byte position in the ivr and write it to the
5727 + * corresponding register */
5728 + if (dev_type == VLYNQ_LOCAL_DVC)
5730 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5734 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5737 + /* We disable the interrupt by simply turning off the bit
5738 + * corresponding to Interrupt enable.
5739 + * Clear the interrupt enable bit in the correct byte position **/
5740 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5742 + /* Dont have to set any bit positions */
5744 + return VLYNQ_SUCCESS;
5751 diff -urN linux.old/drivers/char/serial.c linux.dev/drivers/char/serial.c
5752 --- linux.old/drivers/char/serial.c 2005-10-21 16:43:20.709226000 +0200
5753 +++ linux.dev/drivers/char/serial.c 2005-11-10 01:10:46.015585250 +0100
5754 @@ -419,7 +419,40 @@
5758 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
5759 +#if defined(CONFIG_AR7)
5761 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
5763 + return (inb(info->port + (offset * 4)) & 0xff);
5767 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
5769 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
5770 + return (inb(info->port + (offset * 4)) & 0xff);
5772 + return (inb_p(info->port + (offset * 4)) & 0xff);
5776 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
5778 + outb(value, info->port + (offset * 4));
5782 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
5785 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
5786 + outb(value, info->port + (offset * 4));
5788 + outb_p(value, info->port + (offset * 4));
5792 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
5794 #include <asm/mips-boards/atlas.h>
5796 @@ -478,8 +511,10 @@
5797 * needed for certain old 386 machines, I've left these #define's
5801 #define serial_inp(info, offset) serial_in(info, offset)
5802 #define serial_outp(info, offset, value) serial_out(info, offset, value)
5807 @@ -1728,7 +1763,15 @@
5808 /* Special case since 134 is really 134.5 */
5809 quot = (2*baud_base / 269);
5812 + quot = (CONFIG_AR7_SYS*500000) / baud;
5818 quot = baud_base / baud;
5821 /* If the quotient is zero refuse the change */
5822 if (!quot && old_termios) {
5823 @@ -5540,8 +5583,10 @@
5824 state->irq = irq_cannonicalize(state->irq);
5826 state->io_type = SERIAL_IO_HUB6;
5828 if (state->port && check_region(state->port,8))
5832 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
5834 @@ -5997,7 +6042,15 @@
5835 info->io_type = state->io_type;
5836 info->iomem_base = state->iomem_base;
5837 info->iomem_reg_shift = state->iomem_reg_shift;
5839 + quot = (CONFIG_AR7_SYS*500000) / baud;
5845 quot = state->baud_base / baud;
5847 cval = cflag & (CSIZE | CSTOPB);
5848 #if defined(__powerpc__) || defined(__alpha__)
5850 diff -urN linux.old/drivers/char/ticfg/Makefile linux.dev/drivers/char/ticfg/Makefile
5851 --- linux.old/drivers/char/ticfg/Makefile 1970-01-01 01:00:00.000000000 +0100
5852 +++ linux.dev/drivers/char/ticfg/Makefile 2005-11-10 01:10:46.051587500 +0100
5855 +O_TARGET := ticfg.o
5857 +obj-$(CONFIG_AR7_ADAM2) := adam2_env.o
5859 +include $(TOPDIR)/Rules.make
5860 diff -urN linux.old/drivers/char/ticfg/adam2_env.c linux.dev/drivers/char/ticfg/adam2_env.c
5861 --- linux.old/drivers/char/ticfg/adam2_env.c 1970-01-01 01:00:00.000000000 +0100
5862 +++ linux.dev/drivers/char/ticfg/adam2_env.c 2005-11-10 01:10:46.051587500 +0100
5864 +#include <linux/types.h>
5865 +#include <linux/errno.h>
5866 +#include <linux/module.h>
5867 +#include <linux/kernel.h>
5868 +#include <linux/proc_fs.h>
5869 +#include <linux/fcntl.h>
5870 +#include <linux/init.h>
5872 +#include <asm/ar7/adam2_env.h>
5874 +#undef ADAM2_ENV_DEBUG
5876 +#ifdef ADAM2_ENV_DEBUG
5877 +#define DPRINTK(args...) do { printk(args); } while(0);
5879 +#define DPRINTK(args...) do { } while(0);
5882 +#define ADAM2_ENV_DIR "ticfg"
5883 +#define ADAM2_ENV_NAME "env"
5885 +static struct proc_dir_entry *adam2_env_proc_dir;
5886 +static struct proc_dir_entry *adam2_env_proc_ent;
5889 +adam2_proc_read_env(char *page, char **start, off_t pos, int count,
5890 + int *eof, void *data)
5899 + for (env = prom_iterenv(0); env; env = prom_iterenv(env)) {
5901 + /* XXX check for page len */
5902 + len += sprintf(page + len, "%s\t%s\n",
5903 + env->name, env->val);
5912 +adam2_env_init(void)
5915 + DPRINTK("%s\n", __FUNCTION__);
5917 + adam2_env_proc_dir = proc_mkdir(ADAM2_ENV_DIR, NULL);
5918 + if (!adam2_env_proc_dir) {
5919 + printk(KERN_ERR "%s: Unable to create /proc/%s entry\n",
5920 + __FUNCTION__, ADAM2_ENV_DIR);
5924 + adam2_env_proc_ent =
5925 + create_proc_entry(ADAM2_ENV_NAME, 0444, adam2_env_proc_dir);
5926 + if (!adam2_env_proc_ent) {
5927 + printk(KERN_ERR "%s: Unable to create /proc/%s/%s entry\n",
5928 + __FUNCTION__, ADAM2_ENV_DIR, ADAM2_ENV_NAME);
5929 + remove_proc_entry(ADAM2_ENV_DIR, NULL);
5932 + adam2_env_proc_ent->read_proc = adam2_proc_read_env;
5939 +adam2_env_cleanup(void)
5941 + remove_proc_entry(ADAM2_ENV_NAME, adam2_env_proc_dir);
5942 + remove_proc_entry(ADAM2_ENV_DIR, NULL);
5945 +module_init(adam2_env_init);
5946 +module_exit(adam2_env_cleanup);
5948 +MODULE_LICENSE("GPL");
5949 diff -urN linux.old/include/asm-mips/addrspace.h linux.dev/include/asm-mips/addrspace.h
5950 --- linux.old/include/asm-mips/addrspace.h 2002-11-29 00:53:15.000000000 +0100
5951 +++ linux.dev/include/asm-mips/addrspace.h 2005-11-10 01:14:16.400733500 +0100
5953 #ifndef __ASM_MIPS_ADDRSPACE_H
5954 #define __ASM_MIPS_ADDRSPACE_H
5956 +#include <linux/config.h>
5959 * Configure language
5961 @@ -102,4 +104,11 @@
5962 #define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
5963 #define PHYS_TO_XKPHYS(cm,a) (0x8000000000000000 | ((cm)<<59) | (a))
5965 +#ifdef CONFIG_AR7_MEMORY
5966 +#define PHYS_OFFSET ((unsigned long)(CONFIG_AR7_MEMORY))
5968 +#define PHYS_OFFSET (0)
5970 +#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
5972 #endif /* __ASM_MIPS_ADDRSPACE_H */
5973 diff -urN linux.old/include/asm-mips/ar7/adam2_env.h linux.dev/include/asm-mips/ar7/adam2_env.h
5974 --- linux.old/include/asm-mips/ar7/adam2_env.h 1970-01-01 01:00:00.000000000 +0100
5975 +++ linux.dev/include/asm-mips/ar7/adam2_env.h 2005-11-10 01:10:46.067588500 +0100
5977 +#ifndef _INCLUDE_ASM_AR7_ADAM2_ENV_H_
5978 +#define _INCLUDE_ASM_AR7_ADAM2_ENV_H_
5980 +/* Environment variable */
5986 +char *prom_getenv(char *);
5987 +t_env_var *prom_iterenv(t_env_var *);
5989 +#endif /* _INCLUDE_ASM_AR7_ADAM2_ENV_H_ */
5990 diff -urN linux.old/include/asm-mips/ar7/ar7.h linux.dev/include/asm-mips/ar7/ar7.h
5991 --- linux.old/include/asm-mips/ar7/ar7.h 1970-01-01 01:00:00.000000000 +0100
5992 +++ linux.dev/include/asm-mips/ar7/ar7.h 2005-11-10 01:10:46.067588500 +0100
5996 + * Copyright (C) $Date$ $Author$
5998 + * This program is free software; you can redistribute it and/or modify
5999 + * it under the terms of the GNU General Public License as published by
6000 + * the Free Software Foundation; either version 2 of the License, or
6001 + * (at your option) any later version.
6003 + * This program is distributed in the hope that it will be useful,
6004 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6005 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6006 + * GNU General Public License for more details.
6008 + * You should have received a copy of the GNU General Public License
6009 + * along with this program; if not, write to the Free Software
6010 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6017 +#include <asm/addrspace.h>
6018 +#include <linux/config.h>
6020 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(CONFIG_AR7_MEMORY))
6022 +#define AR7_UART0_REGS_BASE (KSEG1ADDR(0x08610E00))
6023 +#define AR7_UART1_REGS_BASE (KSEG1ADDR(0x08610F00))
6024 +#define AR7_BASE_BAUD ( 3686400 / 16 )
6027 diff -urN linux.old/include/asm-mips/ar7/avalanche_intc.h linux.dev/include/asm-mips/ar7/avalanche_intc.h
6028 --- linux.old/include/asm-mips/ar7/avalanche_intc.h 1970-01-01 01:00:00.000000000 +0100
6029 +++ linux.dev/include/asm-mips/ar7/avalanche_intc.h 2005-11-10 01:10:46.067588500 +0100
6032 + * Nitin Dhingra, iamnd@ti.com
6033 + * Copyright (C) 2000 Texas Instruments Inc.
6036 + * ########################################################################
6038 + * This program is free software; you can distribute it and/or modify it
6039 + * under the terms of the GNU General Public License (Version 2) as
6040 + * published by the Free Software Foundation.
6042 + * This program is distributed in the hope it will be useful, but WITHOUT
6043 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6044 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6045 + * for more details.
6047 + * You should have received a copy of the GNU General Public License along
6048 + * with this program; if not, write to the Free Software Foundation, Inc.,
6049 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
6051 + * ########################################################################
6053 + * Defines of the Sead board specific address-MAP, registers, etc.
6056 +#ifndef _AVALANCHE_INTC_H
6057 +#define _AVALANCHE_INTC_H
6059 +#include <linux/config.h>
6063 +#define KSEG1_BASE 0xA0000000
6064 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
6065 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
6066 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
6067 +#define AVALANCHE_INTC_BASE PHYS_TO_K1(0x08612400)
6071 +#define MIPS_EXCEPTION_OFFSET 8
6073 +/******************************************************************************
6074 + Avalanche Interrupt number
6075 +******************************************************************************/
6076 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
6078 +/*******************************************************************************
6079 +*Linux Interrupt number
6080 +*******************************************************************************/
6081 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
6085 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
6086 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
6088 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
6089 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
6091 +#define AVALANCHE_INTC_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
6092 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) + \
6093 + MIPS_EXCEPTION_OFFSET)
6095 +#if defined(CONFIG_AR7_VLYNQ)
6096 +#define AVALANCHE_INT_END_LOW_VLYNQ (AVALANCHE_INTC_END + 32)
6097 +#define AVALANCHE_INT_END_VLYNQ (AVALANCHE_INTC_END + 32 * CONFIG_AR7_VLYNQ_PORTS)
6098 +#define AVALANCHE_INT_END AVALANCHE_INT_END_VLYNQ
6100 +#define AVALANCHE_INT_END AVALANCHE_INTC_END
6105 + * Avalanche interrupt controller register base (primary)
6107 +#define AVALANCHE_ICTRL_REGS_BASE AVALANCHE_INTC_BASE
6109 +/******************************************************************************
6110 + * Avalanche exception controller register base (secondary)
6111 + ******************************************************************************/
6112 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
6115 +/******************************************************************************
6116 + * Avalanche Interrupt pacing register base (secondary)
6117 + ******************************************************************************/
6118 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
6122 +/******************************************************************************
6123 + * Avalanche Interrupt Channel Control register base
6124 + *****************************************************************************/
6125 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
6128 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
6130 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 0x00 */
6131 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 0x04 */
6132 + volatile unsigned long unused1; /*0x08 */
6133 + volatile unsigned long unused2; /*0x0C */
6134 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 0x10 */
6135 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 0x14 */
6136 + volatile unsigned long unused3; /*0x18 */
6137 + volatile unsigned long unused4; /*0x1C */
6138 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 0x20 */
6139 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 0x24 */
6140 + volatile unsigned long unused5; /*0x28 */
6141 + volatile unsigned long unused6; /*0x2C */
6142 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 0x30 */
6143 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 0x34 */
6144 + volatile unsigned long unused7; /* 0x38 */
6145 + volatile unsigned long unused8; /* 0x3c */
6146 + volatile unsigned long pintir; /* Priority Interrupt Index Register 0x40 */
6147 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg 0x44 */
6148 + volatile unsigned long unused9; /* 0x48 */
6149 + volatile unsigned long unused10; /* 0x4C */
6150 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 10x50 */
6151 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 20x54 */
6152 + volatile unsigned long unused11; /* 0x58 */
6153 + volatile unsigned long unused12; /*0x5C */
6154 + volatile unsigned long inttypr1; /* Interrupt Type Mask register 10x60 */
6155 + volatile unsigned long inttypr2; /* Interrupt Type Mask register 20x64 */
6158 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
6160 + volatile unsigned long exsr; /* Exceptions Status/Set register 0x80 */
6161 + volatile unsigned long reserved; /*0x84 */
6162 + volatile unsigned long excr; /* Exceptions Clear Register 0x88 */
6163 + volatile unsigned long reserved1; /*0x8c */
6164 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) 0x90 */
6165 + volatile unsigned long reserved2; /*0x94 */
6166 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable(clear)0x98 */
6168 +struct avalanche_ipace_regs
6171 + volatile unsigned long ipacep; /* Interrupt pacing register 0xa0 */
6172 + volatile unsigned long ipacemap; /*Interrupt Pacing Map Register 0xa4 */
6173 + volatile unsigned long ipacemax; /*Interrupt Pacing Max Register 0xa8 */
6175 +struct avalanche_channel_int_number
6177 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register0x200 */
6178 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register0x204 */
6179 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register0x208 */
6180 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register0x20C */
6181 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register0x210 */
6182 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register0x214 */
6183 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register0x218 */
6184 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register0x21C */
6185 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register0x220 */
6186 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register0x224 */
6187 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register0x228 */
6188 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register0x22C */
6189 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register0x230 */
6190 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register0x234 */
6191 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register0x238 */
6192 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register0x23C */
6193 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register0x240 */
6194 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register0x244 */
6195 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register0x248 */
6196 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register0x24C */
6197 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register0x250 */
6198 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register0x254 */
6199 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register0x358 */
6200 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register0x35C */
6201 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register0x260 */
6202 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register0x264 */
6203 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register0x268 */
6204 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register0x26C */
6205 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register0x270 */
6206 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register0x274 */
6207 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register0x278 */
6208 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register0x27C */
6209 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register0x280 */
6210 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register0x284 */
6211 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register0x288 */
6212 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register0x28C */
6213 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register0x290 */
6214 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register0x294 */
6215 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register0x298 */
6216 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register0x29C */
6219 +struct avalanche_interrupt_line_to_channel
6221 + unsigned long int_line0; /* Start of primary interrupts */
6222 + unsigned long int_line1;
6223 + unsigned long int_line2;
6224 + unsigned long int_line3;
6225 + unsigned long int_line4;
6226 + unsigned long int_line5;
6227 + unsigned long int_line6;
6228 + unsigned long int_line7;
6229 + unsigned long int_line8;
6230 + unsigned long int_line9;
6231 + unsigned long int_line10;
6232 + unsigned long int_line11;
6233 + unsigned long int_line12;
6234 + unsigned long int_line13;
6235 + unsigned long int_line14;
6236 + unsigned long int_line15;
6237 + unsigned long int_line16;
6238 + unsigned long int_line17;
6239 + unsigned long int_line18;
6240 + unsigned long int_line19;
6241 + unsigned long int_line20;
6242 + unsigned long int_line21;
6243 + unsigned long int_line22;
6244 + unsigned long int_line23;
6245 + unsigned long int_line24;
6246 + unsigned long int_line25;
6247 + unsigned long int_line26;
6248 + unsigned long int_line27;
6249 + unsigned long int_line28;
6250 + unsigned long int_line29;
6251 + unsigned long int_line30;
6252 + unsigned long int_line31;
6253 + unsigned long int_line32;
6254 + unsigned long int_line33;
6255 + unsigned long int_line34;
6256 + unsigned long int_line35;
6257 + unsigned long int_line36;
6258 + unsigned long int_line37;
6259 + unsigned long int_line38;
6260 + unsigned long int_line39;
6264 +/* Interrupt Line #'s (Sangam peripherals) */
6266 +/*------------------------------*/
6267 +/* Sangam primary interrupts */
6268 +/*------------------------------*/
6270 +#define UNIFIED_SECONDARY_INTERRUPT 0
6271 +#define AVALANCHE_EXT_INT_0 1
6272 +#define AVALANCHE_EXT_INT_1 2
6273 +/* Line #3 Reserved */
6274 +/* Line #4 Reserved */
6275 +#define AVALANCHE_TIMER_0_INT 5
6276 +#define AVALANCHE_TIMER_1_INT 6
6277 +#define AVALANCHE_UART0_INT 7
6278 +#define AVALANCHE_UART1_INT 8
6279 +#define AVALANCHE_PDMA_INT0 9
6280 +#define AVALANCHE_PDMA_INT1 10
6281 +/* Line #11 Reserved */
6282 +/* Line #12 Reserved */
6283 +/* Line #13 Reserved */
6284 +/* Line #14 Reserved */
6285 +#define AVALANCHE_ATM_SAR_INT 15
6286 +/* Line #16 Reserved */
6287 +/* Line #17 Reserved */
6288 +/* Line #18 Reserved */
6289 +#define AVALANCHE_MAC0_INT 19
6290 +/* Line #20 Reserved */
6291 +#define AVALANCHE_VLYNQ0_INT 21
6292 +#define AVALANCHE_CODEC_WAKE_INT 22
6293 +/* Line #23 Reserved */
6294 +#define AVALANCHE_USB_INT 24
6295 +#define AVALANCHE_VLYNQ1_INT 25
6296 +/* Line #26 Reserved */
6297 +/* Line #27 Reserved */
6298 +#define AVALANCHE_MAC1_INT 28
6299 +#define AVALANCHE_I2CM_INT 29
6300 +#define AVALANCHE_PDMA_INT2 30
6301 +#define AVALANCHE_PDMA_INT3 31
6302 +/* Line #32 Reserved */
6303 +/* Line #33 Reserved */
6304 +/* Line #34 Reserved */
6305 +/* Line #35 Reserved */
6306 +/* Line #36 Reserved */
6307 +#define AVALANCHE_VDMA_VT_RX_INT 37
6308 +#define AVALANCHE_VDMA_VT_TX_INT 38
6309 +#define AVALANCHE_ADSLSS_INT 39
6311 +/*-----------------------------------*/
6312 +/* Sangam Secondary Interrupts */
6313 +/*-----------------------------------*/
6314 +#define PRIMARY_INTS 40
6316 +#define EMIF_INT (7 + PRIMARY_INTS)
6319 +extern void avalanche_int_set(int channel, int line);
6322 +#endif /* _AVALANCHE_INTC_H */
6323 diff -urN linux.old/include/asm-mips/ar7/avalanche_misc.h linux.dev/include/asm-mips/ar7/avalanche_misc.h
6324 --- linux.old/include/asm-mips/ar7/avalanche_misc.h 1970-01-01 01:00:00.000000000 +0100
6325 +++ linux.dev/include/asm-mips/ar7/avalanche_misc.h 2005-11-10 01:10:46.067588500 +0100
6327 +#ifndef _AVALANCHE_MISC_H_
6328 +#define _AVALANCHE_MISC_H_
6330 +typedef enum AVALANCHE_ERR_t
6332 + AVALANCHE_ERR_OK = 0, /* OK or SUCCESS */
6333 + AVALANCHE_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
6335 + /* Pointers and args */
6336 + AVALANCHE_ERR_INVARG = -2, /* Invaild argument to the call */
6337 + AVALANCHE_ERR_NULLPTR = -3, /* NULL pointer */
6338 + AVALANCHE_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
6340 + /* Memory issues */
6341 + AVALANCHE_ERR_ALLOC_FAIL = -10, /* allocation failed */
6342 + AVALANCHE_ERR_FREE_FAIL = -11, /* free failed */
6343 + AVALANCHE_ERR_MEM_CORRUPT = -12, /* corrupted memory */
6344 + AVALANCHE_ERR_BUF_LINK = -13, /* buffer linking failed */
6346 + /* Device issues */
6347 + AVALANCHE_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
6348 + AVALANCHE_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
6350 + AVALANCHE_ERR_INVID = -30 /* Invalid ID */
6354 +/*****************************************************************************
6355 + * Reset Control Module
6356 + *****************************************************************************/
6358 +typedef enum AVALANCHE_RESET_MODULE_tag
6360 + RESET_MODULE_UART0 = 0,
6361 + RESET_MODULE_UART1 = 1,
6362 + RESET_MODULE_I2C = 2,
6363 + RESET_MODULE_TIMER0 = 3,
6364 + RESET_MODULE_TIMER1 = 4,
6365 + RESET_MODULE_GPIO = 6,
6366 + RESET_MODULE_ADSLSS = 7,
6367 + RESET_MODULE_USBS = 8,
6368 + RESET_MODULE_SAR = 9,
6369 + RESET_MODULE_VDMA_VT = 11,
6370 + RESET_MODULE_FSER = 12,
6371 + RESET_MODULE_VLYNQ1 = 16,
6372 + RESET_MODULE_EMAC0 = 17,
6373 + RESET_MODULE_DMA = 18,
6374 + RESET_MODULE_BIST = 19,
6375 + RESET_MODULE_VLYNQ0 = 20,
6376 + RESET_MODULE_EMAC1 = 21,
6377 + RESET_MODULE_MDIO = 22,
6378 + RESET_MODULE_ADSLSS_DSP = 23,
6379 + RESET_MODULE_EPHY = 26
6380 +} AVALANCHE_RESET_MODULE_T;
6382 +typedef enum AVALANCHE_RESET_CTRL_tag
6386 +} AVALANCHE_RESET_CTRL_T;
6388 +typedef enum AVALANCHE_SYS_RST_MODE_tag
6390 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
6391 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
6392 +} AVALANCHE_SYS_RST_MODE_T;
6394 +typedef enum AVALANCHE_SYS_RESET_STATUS_tag
6396 + HARDWARE_RESET = 0,
6397 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
6399 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
6400 +} AVALANCHE_SYS_RESET_STATUS_T;
6402 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(AVALANCHE_RESET_MODULE_T reset_module);
6403 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode);
6404 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status(void);
6406 +typedef int (*REMOTE_VLYNQ_DEV_RESET_CTRL_FN)(unsigned int reset_module, AVALANCHE_RESET_CTRL_T reset_ctrl);
6408 +/*****************************************************************************
6409 + * Power Control Module
6410 + *****************************************************************************/
6412 +typedef enum AVALANCHE_POWER_CTRL_tag
6414 + POWER_CTRL_POWER_UP = 0,
6415 + POWER_CTRL_POWER_DOWN
6416 +} AVALANCHE_POWER_CTRL_T;
6418 +typedef enum AVALANCHE_SYS_POWER_MODE_tag
6420 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
6421 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
6422 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
6423 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
6424 +} AVALANCHE_SYS_POWER_MODE_T;
6426 +void avalanche_power_ctrl(unsigned int power_module, AVALANCHE_POWER_CTRL_T power_ctrl);
6427 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int power_module);
6428 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode);
6429 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void);
6431 +/*****************************************************************************
6433 + *****************************************************************************/
6435 +typedef enum AVALANCHE_WAKEUP_INTERRUPT_tag
6441 +} AVALANCHE_WAKEUP_INTERRUPT_T;
6443 +typedef enum TNETV1050_WAKEUP_CTRL_tag
6445 + WAKEUP_DISABLED = 0,
6447 +} AVALANCHE_WAKEUP_CTRL_T;
6449 +typedef enum TNETV1050_WAKEUP_POLARITY_tag
6451 + WAKEUP_ACTIVE_HIGH = 0,
6453 +} AVALANCHE_WAKEUP_POLARITY_T;
6455 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
6456 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
6457 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity);
6459 +/*****************************************************************************
6461 + *****************************************************************************/
6463 +typedef enum AVALANCHE_GPIO_PIN_MODE_tag
6465 + FUNCTIONAL_PIN = 0,
6467 +} AVALANCHE_GPIO_PIN_MODE_T;
6469 +typedef enum AVALANCHE_GPIO_PIN_DIRECTION_tag
6471 + GPIO_OUTPUT_PIN = 0,
6472 + GPIO_INPUT_PIN = 1
6473 +} AVALANCHE_GPIO_PIN_DIRECTION_T;
6475 +typedef enum { GPIO_FALSE, GPIO_TRUE } AVALANCHE_GPIO_BOOL_T;
6477 +void avalanche_gpio_init(void);
6478 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
6479 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
6480 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
6481 +int avalanche_gpio_ctrl_with_link_count(unsigned int gpio_pin,
6482 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
6483 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
6484 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value);
6485 +int avalanche_gpio_in_bit(unsigned int gpio_pin);
6486 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
6487 +int avalanche_gpio_out_value_with_link_count(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
6488 +int avalanche_gpio_in_value(unsigned int *in_val, unsigned int reg_index);
6490 +unsigned int avalanche_get_chip_version_info(void);
6492 +unsigned int avalanche_get_vbus_freq(void);
6493 +void avalanche_set_vbus_freq(unsigned int);
6496 +typedef int (*SET_MDIX_ON_CHIP_FN_T)(unsigned int base_addr, unsigned int operation);
6497 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation);
6498 +unsigned int avalanche_is_mdix_on_chip(void);
6501 diff -urN linux.old/include/asm-mips/ar7/avalanche_regs.h linux.dev/include/asm-mips/ar7/avalanche_regs.h
6502 --- linux.old/include/asm-mips/ar7/avalanche_regs.h 1970-01-01 01:00:00.000000000 +0100
6503 +++ linux.dev/include/asm-mips/ar7/avalanche_regs.h 2005-11-10 01:10:46.071588750 +0100
6507 + * Avalanche Register Descriptions
6509 + * Jeff Harrell, jharrell@ti.com
6510 + * 2000 (c) Texas Instruments Inc.
6513 +#ifndef __AVALANCHE_REGS_H
6514 +#define __AVALANCHE_REGS_H
6516 +#include <asm/addrspace.h>
6517 +#include <linux/config.h>
6519 +/*----------------------------------------*/
6520 +/* Base offsets within the Avalanche ASIC */
6521 +/*----------------------------------------*/
6523 +#define BBIF_SPACE0 (KSEG1ADDR(0x01000000))
6524 +#define BBIF_SPACE1 (KSEG1ADDR(0x01800000))
6525 +#define BBIF_CONTROL (KSEG1ADDR(0x02000000))
6526 +#define ATM_SAR_BASE (KSEG1ADDR(0x03000000))
6527 +#define USB_MCU_BASE (KSEG1ADDR(0x03400000))
6528 +#define DES_BASE (KSEG1ADDR(0x08600000))
6529 +#define ETH_MACA_BASE (KSEG1ADDR(0x08610000))
6530 +#define ETH_MACB_BASE (KSEG1ADDR(0x08612800))
6531 +#define MEM_CTRLR_BASE (KSEG1ADDR(0x08610800))
6532 +#define GPIO_BASE (KSEG1ADDR(0x08610900))
6533 +#define CLK_CTRL_BASE (KSEG1ADDR(0x08610A00))
6534 +#define WATCH_DOG_BASE (KSEG1ADDR(0x08610B00))
6535 +#define TMR1_BASE (KSEG1ADDR(0x08610C00))
6536 +#define TRM2_BASE (KSEG1ADDR(0x08610D00))
6537 +#define UARTA_BASE (KSEG1ADDR(0x08610E00))
6538 +#define UARTB_BASE (KSEG1ADDR(0x08610F00))
6539 +#define I2C_BASE (KSEG1ADDR(0x08611000))
6540 +#define DEV_ID_BASE (KSEG1ADDR(0x08611100))
6541 +#define USB_BASE (KSEG1ADDR(0x08611200))
6542 +#define PCI_CONFIG_BASE (KSEG1ADDR(0x08611300))
6543 +#define DMA_BASE (KSEG1ADDR(0x08611400))
6544 +#define RESET_CTRL_BASE (KSEG1ADDR(0x08611600))
6545 +#define DSL_IF_BASE (KSEG1ADDR(0x08611B00))
6546 +#define INT_CTL_BASE (KSEG1ADDR(0x08612400))
6547 +#define PHY_BASE (KSEG1ADDR(0x1E000000))
6549 +/*---------------------------------*/
6550 +/* Device ID, chip version number */
6551 +/*---------------------------------*/
6553 +#define AVALANCHE_CHVN (*(volatile unsigned int *)(DEV_ID_BASE+0x14))
6554 +#define AVALANCHE_DEVID1 (*(volatile unsigned int *)(DEV_ID_BASE+0x18))
6555 +#define AVALANCHE_DEVID2 (*(volatile unsigned int *)(DEV_ID_BASE+0x1C))
6557 +/*----------------------------------*/
6558 +/* Reset Control VW changed to ptrs */
6559 +/*----------------------------------*/
6561 +#define AVALANCHE_PRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x0)) /* Peripheral reset control */
6562 +#define AVALANCHE_SWRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x4)) /* Software reset control */
6563 +#define AVALANCHE_RSR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x8)) /* Reset status register */
6565 +/* reset control bits */
6567 +#define AV_RST_UART0 (1<<0) /* Brings UART0 out of reset */
6568 +#define AV_RST_UART1 (1<<1) /* Brings UART1 out of reset */
6569 +#define AV_RST_IICM (1<<2) /* Brings the I2CM out of reset */
6570 +#define AV_RST_TIMER0 (1<<3) /* Brings Timer 0 out of reset */
6571 +#define AV_RST_TIMER1 (1<<4) /* Brings Timer 1 out of reset */
6572 +#define AV_RST_DES (1<<5) /* Brings the DES module out of reset */
6573 +#define AV_RST_GPIO (1<<6) /* Brings the GPIO module out of reset (see note below) */
6575 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
6576 + If you reset the GPIO interface all of the directions (i/o) of the UART B
6577 + interface pins are inputs and must be reconfigured so as not to lose the
6578 + serial console interface
6579 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
6581 +#define AV_RST_BBIF (1<<7) /* Brings the Broadband interface out of reset */
6582 +#define AV_RST_USB (1<<8) /* Brings the USB module out of reset */
6583 +#define AV_RST_SAR (1<<9) /* Brings the SAR out of reset */
6584 +#define AV_RST_HDLC (1<<10) /* Brings the HDLC module out of reset */
6585 +#define AV_RST_PCI (1<<16) /* Brings the PCI module out of reset */
6586 +#define AV_RST_ETH_MAC0 (1<<17) /* Brings the Ethernet MAC0 out of reset */
6587 +#define AV_RST_PICO_DMA (1<<18) /* Brings the PICO DMA module out of reset */
6588 +#define AV_RST_BIST (1<<19) /* Brings the BIST module out of reset */
6589 +#define AV_RST_DSP (1<<20) /* Brings the DSP sub system out of reset */
6590 +#define AV_RST_ETH_MAC1 (1<<21) /* Brings the Ethernet MAC1 out of reset */
6592 +/*----------------------*/
6593 +/* Physical interfaces */
6594 +/*----------------------*/
6597 +#define PHY_LOOPBACK 1
6601 +#define PHY0BASE (PHY_BASE)
6602 +#define PHY0RST (*(volatile unsigned char *) (PHY0BASE)) /* reset */
6603 +#define PHY0CTRL (*(volatile unsigned char *) (PHY0BASE+0x5)) /* control */
6604 +#define PHY0RACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x50)) /* RACP control/status */
6605 +#define PHY0TACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x60)) /* TACP idle/unassigned cell hdr */
6606 +#define PHY0RACPINT (*(volatile unsigned char *) (PHY0BASE+0x51)) /* RACP interrupt enable/Status */
6611 +#define PHY1BASE (PHY_BASE + 0x100000)
6612 +#define PHY1RST (*(volatile unsigned char *) (PHY1BASE)) /* reset */
6613 +#define PHY1CTRL (*(volatile unsigned char *) (PHY1BASE+0x5)) /* control */
6614 +#define PHY1RACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x50))
6615 +#define PHY1TACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x60))
6616 +#define PHY1RACPINT (*(volatile unsigned char *) (PHY1BASE+0x51))
6620 +#define PHY2BASE (PHY_BASE + 0x200000)
6621 +#define PHY2RST (*(volatile unsigned char *) (PHY2BASE)) /* reset */
6622 +#define PHY2CTRL (*(volatile unsigned char *) (PHY2BASE+0x5)) /* control */
6623 +#define PHY2RACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x50))
6624 +#define PHY2TACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x60))
6625 +#define PHY2RACPINT (*(volatile unsigned char *) (PHY2BASE+0x51))
6627 +/*-------------------*/
6628 +/* Avalanche ATM SAR */
6629 +/*-------------------*/
6631 +#define AVSAR_SYSCONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000000)) /* SAR system config register */
6632 +#define AVSAR_SYSSTATUS (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000004)) /* SAR system status register */
6633 +#define AVSAR_INT_ENABLE (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000008)) /* SAR interrupt enable register */
6634 +#define AVSAR_CONN_VPI_VCI (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000000c)) /* VPI/VCI connection config */
6635 +#define AVSAR_CONN_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000010)) /* Connection config register */
6636 +#define AVSAR_OAM_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018)) /* OAM configuration register */
6638 +/* Transmit completion ring registers */
6640 +#define AVSAR_TCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000100))
6641 +#define AVSAR_TCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000104))
6642 +#define AVSAR_TCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000108))
6643 +#define AVSAR_TCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000010c))
6644 +#define AVSAR_TCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000110))
6645 +#define AVSAR_TCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000114))
6646 +#define AVSAR_TCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000118))
6647 +#define AVSAR_TCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000011c))
6648 +#define AVSAR_TCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000120))
6649 +#define AVSAR_TCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000124))
6650 +#define AVSAR_TCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000128))
6651 +#define AVSAR_TCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000012c))
6652 +#define AVSAR_TCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000130))
6653 +#define AVSAR_TCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000134))
6655 +/* Transmit Queue Packet registers */
6656 +#define AVSAR_TXQUEUE_PKT0 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000140))
6657 +#define AVSAR_TXQUEUE_PKT1 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000144))
6658 +#define AVSAR_TXQUEUE_PKT2 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000148))
6659 +#define AVSAR_TX_FLUSH (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000014C))
6660 +/* Receive completion ring registers */
6662 +#define AVSAR_RCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000200))
6663 +#define AVSAR_RCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000204))
6664 +#define AVSAR_RCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000208))
6665 +#define AVSAR_RCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000020c))
6666 +#define AVSAR_RCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000210))
6667 +#define AVSAR_RCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000214))
6668 +#define AVSAR_RCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000218))
6669 +#define AVSAR_RCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000021c))
6670 +#define AVSAR_RCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000220))
6671 +#define AVSAR_RCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000224))
6672 +#define AVSAR_RCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000228))
6673 +#define AVSAR_RCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000022c))
6674 +#define AVSAR_RCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000230))
6675 +#define AVSAR_RCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000234))
6677 +#define AVSAR_RXFBL_ADD0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000240)) /* Rx Free buffer list add 0 */
6678 +#define AVSAR_RXFBL_ADD1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000244)) /* Rx Free buffer list add 1 */
6679 +#define AVSAR_RXFBL_ADD2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000248)) /* Rx Free buffer list add 2 */
6680 +#define AVSAR_RXFBLSIZE_0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000028c)) /* Rx Free buffer list size 0 */
6681 +#define AVSAR_RXFBLSIZE_1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000029c)) /* Rx Free buffer list size 1 */
6682 +#define AVSAR_RXFBLSIZE_2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002ac)) /* Rx Free buffer list size 2 */
6683 +#define AVSAR_RXFBLSIZE_3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002bc)) /* Rx Free buffer list size 3 */
6686 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
6688 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010480))
6689 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010484))
6690 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010488))
6691 +#define AVSAR_OAM_CPID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E0))
6692 +#define AVSAR_OAM_LLID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F0))
6693 +#define AVSAR_OAM_CPID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E4))
6694 +#define AVSAR_OAM_LLID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F4))
6695 +#define AVSAR_OAM_CPID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E8))
6696 +#define AVSAR_OAM_LLID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F8))
6697 +#define AVSAR_OAM_CPID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104EC))
6698 +#define AVSAR_OAM_LLID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104FC))
6699 +#define AVSAR_OAM_CORR_TAG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010500))
6700 +#define AVSAR_OAM_FAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010520))
6701 +#define AVSAR_OAM_NEAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010540))
6702 +#define AVSAR_OAM_CONFIG_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018))
6703 +#define AVSAR_FAIRNESS_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104B8))
6704 +#define AVSAR_UBR_PCR_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010490))
6709 +#define OAM_CPID_ADD 0xa30104e0
6711 +#define OAM_LLID_ADD 0xa30104f0
6713 +#define OAM_LLID_VAL 0xffffffff
6715 +#define OAM_CORR_TAG 0xa3010500
6717 +#define OAM_FAR_COUNT_ADD 0xa3010520
6719 +#define OAM_NEAR_COUNT_ADD 0xa3010540
6721 +#define OAM_CONFIG_REG_ADD 0xa3000018
6725 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
6727 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012000))
6728 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012004))
6729 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012008))
6730 +#define AVSAR_OAM_CPID (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012300))
6732 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
6735 +#define AVSAR_STATE_RAM (ATM_SAR_BASE + 0x010000) /* SAR state RAM */
6736 +#define AVSAR_PDSP_BASE (ATM_SAR_BASE + 0x020000) /* SAR PDSP base address */
6737 +#define AVSAR_TXDMA_BASE (ATM_SAR_BASE + 0x030000) /* Transmit DMA state base */
6738 +#define AVSAR_TDMASTATE6 0x18 /* Transmit DMA state word 6 */
6739 +#define AVSAR_RXDMA_BASE (ATM_SAR_BASE + 0x040000) /* Receive DMA state base */
6740 +#define AVSAR_RDMASTATE0 0x0 /* Receive DMA state word 0 */
6742 +/*------------------------------------------*/
6743 +/* DSL Interface */
6744 +/*------------------------------------------*/
6746 +#define AVDSL_TX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000000))
6747 +#define AVDSL_RX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000004))
6748 +#define AVDSL_POLL (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000008))
6752 +#define AVDSL_TX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000000C))
6753 +#define AVDSL_TX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000010))
6754 +#define AVDSL_TX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000014))
6755 +#define AVDSL_TX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000018))
6756 +#define AVDSL_RX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000001C))
6757 +#define AVDSL_RX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000020))
6758 +#define AVDSL_RX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000024))
6759 +#define AVDSL_RX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000028))
6763 +#define AVDSL_TX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000002C))
6764 +#define AVDSL_TX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000030))
6765 +#define AVDSL_TX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000034))
6766 +#define AVDSL_TX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000038))
6767 +#define AVDSL_RX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000003C))
6768 +#define AVDSL_RX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000040))
6769 +#define AVDSL_RX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000044))
6770 +#define AVDSL_RX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000048))
6772 +/*------------------------------------------*/
6773 +/* Broadband I/F */
6774 +/*------------------------------------------*/
6776 +#define AVBBIF_BBIF_CNTRL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000000))
6777 +#define AVBBIF_ADDR_TRANS_0 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000004))
6778 +#define AVBBIF_ADDR_TRANS_1 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000008))
6779 +#define AVBBIF_ADDR_XB_MX_BL (*(volatile unsigned int *)(BBIF_CONTROL + 0x0000000C))
6780 +#define AVBBIF_INFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000010))
6781 +#define AVBBIF_OUTFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000014))
6783 +#define AVBBIF_DISABLED 0x0
6784 +#define AVBBIF_LBT4040_INT 0x1
6785 +#define AVBBIF_XBUS 0x2
6786 +#define AVBBIF_LBT4040_EXT 0x4
6788 +#define AVBBIF_ADDR_MASK0 0xff000000 /* handles upper bits of BBIF 0 address */
6789 +#define AVBBIF_ADDR_MASK1 0xff800000 /* handles upper bits of BBIF 1 address */
6790 +#define AVBBIF_TRANS_MASK 0xff000000
6791 +/*------------------------------------------*/
6793 +/*------------------------------------------*/
6795 +#define GPIO_DATA_INPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000000))
6796 +#define GPIO_DATA_OUTPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000004))
6797 +#define GPIO_DATA_DIR (*(volatile unsigned int *)(GPIO_BASE + 0x00000008)) /* 0=output 1=input */
6798 +#define GPIO_DATA_ENABLE (*(volatile unsigned int *)(GPIO_BASE + 0x0000000C)) /* 0=GPIO Mux 1=GPIO */
6800 +#define GPIO_0 (1<<21)
6801 +#define GPIO_1 (1<<22)
6802 +#define GPIO_2 (1<<23)
6803 +#define GPIO_3 (1<<24)
6804 +#define EINT_1 (1<<18)
6807 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
6808 + If you reset the GPIO interface all of the directions (i/o) of the UART B
6809 + interface pins are inputs and must be reconfigured so as not to lose the
6810 + serial console interface
6811 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
6814 +/*------------------------------------------*/
6816 +/*------------------------------------------*/
6817 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
6819 +#define PCLK_0_HALF_VBUS (0<<16)
6820 +#define PCLK_EQ_INPUT (1<<16)
6821 +#define BBIF_CLK_HALF_VBUS (0<<17)
6822 +#define BBIF_CLK_EQ_VBUS (1<<17)
6823 +#define BBIF_CLK_EQ_BBCLK (3<<17)
6824 +#define DSP_MODCLK_DSPCLKI (0<<20)
6825 +#define DSP_MODCLK_REFCLKI (1<<20)
6826 +#define USB_CLK_EQ_USBCLKI (0<<21)
6827 +#define USB_CLK_EQ_REFCLKI (1<<21)
6829 +/*------------------------------------------*/
6830 +/* PCI Control Registers */
6831 +/*------------------------------------------*/
6832 +#define PCIC_CONTROL (*(volatile unsigned int *)(PCI_CONFIG_BASE))
6833 +#define PCIC_CONTROL_CFG_DONE (1<<0)
6834 +#define PCIC_CONTROL_DIS_SLAVE_TO (1<<1)
6835 +#define PCIC_CONTROL_FORCE_DELAY_READ (1<<2)
6836 +#define PCIC_CONTROL_FORCE_DELAY_READ_LINE (1<<3)
6837 +#define PCIC_CONTROL_FORCE_DELAY_READ_MULT (1<<4)
6838 +#define PCIC_CONTROL_MEM_SPACE_EN (1<<5)
6839 +#define PCIC_CONTROL_MEM_MASK (1<<6)
6840 +#define PCIC_CONTROL_IO_SPACE_EN (1<<7)
6841 +#define PCIC_CONTROL_IO_MASK (1<<8)
6842 +/* PCIC_CONTROL_RESERVED (1<<9) */
6843 +#define PCIC_CONTROL_BASE0_EN (1<<10)
6844 +#define PCIC_CONTROL_BASE1_EN (1<<11)
6845 +#define PCIC_CONTROL_BASE2_EN (1<<12)
6846 +#define PCIC_CONTROL_HOLD_MASTER_WRITE (1<<13)
6847 +#define PCIC_CONTROL_ARBITER_EN (1<<14)
6848 +#define PCIC_INT_SOURCE (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000004))
6849 +#define PCIC_INT_SOURCE_PWR_MGMT (1<<0)
6850 +#define PCIC_INT_SOURCE_PCI_TARGET (1<<1)
6851 +#define PCIC_INT_SOURCE_PCI_MASTER (1<<2)
6852 +#define PCIC_INT_SOURCE_POWER_WAKEUP (1<<3)
6853 +#define PCIC_INT_SOURCE_PMEIN (1<<4)
6854 +/* PCIC_INT_SOURCE_RESERVED (1<<5) */
6855 +/* PCIC_INT_SOURCE_RESERVED (1<<6) */
6856 +#define PCIC_INT_SOURCE_PIC_INTA (1<<7)
6857 +#define PCIC_INT_SOURCE_PIC_INTB (1<<8)
6858 +#define PCIC_INT_SOURCE_PIC_INTC (1<<9)
6859 +#define PCIC_INT_SOURCE_PIC_INTD (1<<10)
6860 +#define PCIC_INT_SOURCE_SOFT_INT0 (1<<11)
6861 +#define PCIC_INT_SOURCE_SOFT_INT1 (1<<12)
6862 +#define PCIC_INT_SOURCE_SOFT_INT2 (1<<13)
6863 +#define PCIC_INT_SOURCE_SOFT_INT3 (1<<14)
6864 +#define PCIC_INT_CLEAR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000008))
6865 +#define PCIC_INT_CLEAR_PM (1<<0)
6866 +#define PCIC_INT_CLEAR_PCI_TARGET (1<<1)
6867 +#define PCIC_INT_CLEAR_PCI_MASTER (1<<2)
6868 +/* PCIC_INT_CLEAR_RESERVED (1<<3) */
6869 +#define PCIC_INT_CLEAR_PMEIN (1<<4)
6870 +/* PCIC_INT_CLEAR_RESERVED (1<<5) */
6871 +/* PCIC_INT_CLEAR_RESERVED (1<<6) */
6872 +#define PCIC_INT_CLEAR_PCI_INTA (1<<7)
6873 +#define PCIC_INT_CLEAR_PCI_INTB (1<<8)
6874 +#define PCIC_INT_CLEAR_PCI_INTC (1<<9)
6875 +#define PCIC_INT_CLEAR_PCI_INTD (1<<10)
6876 +#define PCIC_INT_CLEAR_SOFT_INT0 (1<<11)
6877 +#define PCIC_INT_CLEAR_SOFT_INT1 (1<<12)
6878 +#define PCIC_INT_CLEAR_SOFT_INT2 (1<<13)
6879 +#define PCIC_INT_CLEAR_SOFT_INT3 (1<<14)
6880 +#define PCIC_INT_EN_AVAL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000000c))
6881 +#define PCIC_INT_EN_AVAL_PM (1<<0)
6882 +#define PCIC_INT_EN_AVAL_PCI_TARGET (1<<1)
6883 +#define PCIC_INT_EN_AVAL_PCI_MASTER (1<<2)
6884 +/* PCIC_INT_EN_AVAL_RESERVED (1<<3) */
6885 +#define PCIC_INT_EN_AVAL_PMEIN (1<<4)
6886 +/* PCIC_INT_EN_AVAL_RESERVED (1<<5) */
6887 +/* PCIC_INT_EN_AVAL_RESERVED (1<<6) */
6888 +#define PCIC_INT_EN_AVAL_PCI_INTA (1<<7)
6889 +#define PCIC_INT_EN_AVAL_PCI_INTB (1<<8)
6890 +#define PCIC_INT_EN_AVAL_PCI_INTC (1<<9)
6891 +#define PCIC_INT_EN_AVAL_PCI_INTD (1<<10)
6892 +#define PCIC_INT_EN_AVAL_SOFT_INT0 (1<<11)
6893 +#define PCIC_INT_EN_AVAL_SOFT_INT1 (1<<12)
6894 +#define PCIC_INT_EN_AVAL_SOFT_INT2 (1<<13)
6895 +#define PCIC_INT_EN_AVAL_SOFT_INT3 (1<<14)
6896 +#define PCIC_INT_EN_PCI (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000010))
6897 +#define PCIC_INT_EN_PCI_PM (1<<0)
6898 +#define PCIC_INT_EN_PCI_PCI_TARGET (1<<1)
6899 +#define PCIC_INT_EN_PCI_PCI_MASTER (1<<2)
6900 +/* PCIC_INT_EN_PCI_RESERVED (1<<3) */
6901 +#define PCIC_INT_EN_PCI_PMEIN (1<<4)
6902 +/* PCIC_INT_EN_PCI_RESERVED (1<<5) */
6903 +/* PCIC_INT_EN_PCI_RESERVED (1<<6) */
6904 +#define PCIC_INT_EN_PCI_PCI_INTA (1<<7)
6905 +#define PCIC_INT_EN_PCI_PCI_INTB (1<<8)
6906 +#define PCIC_INT_EN_PCI_PCI_INTC (1<<9)
6907 +#define PCIC_INT_EN_PCI_PCI_INTD (1<<10)
6908 +#define PCIC_INT_EN_PCI_SOFT_INT0 (1<<11)
6909 +#define PCIC_INT_EN_PCI_SOFT_INT1 (1<<12)
6910 +#define PCIC_INT_EN_PCI_SOFT_INT2 (1<<13)
6911 +#define PCIC_INT_EN_PCI_SOFT_INT3 (1<<14)
6912 +#define PCIC_INT_SWSET (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000014))
6913 +#define PCIC_INT_SWSET_SOFT_INT0 (1<<0)
6914 +#define PCIC_INT_SWSET_SOFT_INT1 (1<<1)
6915 +#define PCIC_INT_SWSET_SOFT_INT2 (1<<2)
6916 +#define PCIC_INT_SWSET_SOFT_INT3 (1<<3)
6917 +#define PCIC_PM_CTL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000018))
6918 +#define PCIC_PM_CTL_PWR_STATE_MASK (0x02)
6919 +/* PCIC_PM_CTL_RESERVED (1<<2) */
6920 +/* PCIC_PM_CTL_RESERVED (1<<3) */
6921 +/* PCIC_PM_CTL_RESERVED (1<<4) */
6922 +/* PCIC_PM_CTL_RESERVED (1<<5) */
6923 +/* PCIC_PM_CTL_RESERVED (1<<6) */
6924 +/* PCIC_PM_CTL_RESERVED (1<<7) */
6925 +/* PCIC_PM_CTL_RESERVED (1<<8) */
6926 +/* PCIC_PM_CTL_RESERVED (1<<9) */
6927 +#define PCIC_PM_CTL_PWR_SUPPORT (1<<10)
6928 +#define PCIC_PM_CTL_PMEIN (1<<11)
6929 +#define PCIC_PM_CTL_CAP_MASK (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x0000001a))
6930 +#define PCIC_PM_CONSUME (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000001c))
6931 +#define PCIC_PM_CONSUME_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001c))
6932 +#define PCIC_PM_CONSUME_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001d))
6933 +#define PCIC_PM_CONSUME_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001e))
6934 +#define PCIC_PM_CONSUME_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001f))
6935 +#define PCIC_PM_DISSAPATED (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000020))
6936 +#define PCIC_PM_DISSAPATED_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000020))
6937 +#define PCIC_PM_DISSAPATED_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000021))
6938 +#define PCIC_PM_DISSAPATED_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000022))
6939 +#define PCIC_PM_DISSAPATED_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000023))
6940 +#define PCIC_PM_DATA_SCALE (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x00000024))
6941 +#define PCIC_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000028))
6942 +#define PCIC_SUB_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000002c))
6943 +#define PCIC_CLASS_REV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000030))
6944 +#define PCIC_MAX_MIN (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000034))
6945 +#define PCIC_MAST_MEM_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000003c))
6946 +#define PCIC_MAST_MEM_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000040))
6947 +#define PCIC_MAST_MEM_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000044))
6948 +#define PCIC_SLAVE_MASK0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000004c))
6949 +#define PCIC_SLAVE_MASK1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000050))
6950 +#define PCIC_SLAVE_MASK2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000054))
6951 +#define PCIC_SLAVE_BASE_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000058))
6952 +#define PCIC_SLAVE_BASE_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000005c))
6953 +#define PCIC_SLAVE_BASE_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000060))
6954 +#define PCIC_CONF_COMMAND (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000090))
6955 +#define PCIC_CONF_ADDR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000094))
6956 +#define PCIC_CONF_DATA (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000098))
6958 +/*------------------------------------------*/
6959 +/* IIC_INTERFACE */
6960 +/*------------------------------------------*/
6961 +#define I2C_DATA_HI (*(volatile unsigned int *)(I2C_BASE + 0x0))
6962 +#define I2C_DATA_LOW (*(volatile unsigned int *)(I2C_BASE + 0x4))
6963 +#define I2C_CONFIG (*(volatile unsigned int *)(I2C_BASE + 0x8))
6964 +#define I2C_DATA_READ (*(volatile unsigned int *)(I2C_BASE + 0xC))
6965 +#define I2C_CLOCK_DIV (*(volatile unsigned int *)(I2C_BASE + 0x10))
6967 +#define I2CWRITE 0x200
6968 +#define I2CREAD 0x300
6969 +#define I2C_END_BURST 0x400
6972 +#define I2C_READ_ERROR 0x8000
6973 +#define I2C_READ_COMPLETE 0x4000
6974 +#define I2C_READ_BUSY 0x2000
6977 +#define I2C_IO_EXPANDER 0x2
6978 +#define I2C_RTC 0xd
6980 +/* device Addresses on I2C bus (EVM3) */
6981 +#define SEVEN_SEGMENT_DISP 0x23 /* Device type = 0x2, Addr = 3 */
6982 +#define EVM3_RTC 0xd0 /* Device type = 0xd, Addr = 0 */
6983 +#define EVM3_RTC_I2C_ADDR 0x0
6985 +/*------------------------------------------*/
6986 +/* Ethernet MAC register offset definitions */
6987 +/*------------------------------------------*/
6988 +#define VMAC_DMACONFIG(X) (*(volatile unsigned int *)(X + 0x00000000))
6989 +#define VMAC_INTSTS(X) (*(volatile unsigned int *)(X + 0x00000004))
6990 +#define VMAC_INTMASK(X) (*(volatile unsigned int *)(X + 0x00000008))
6992 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
6993 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
6995 +#define VMAC_TCRPTR(X) (*(volatile unsigned int *)(X + 0x00000100))
6996 +#define VMAC_TCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000104))
6997 +#define VMAC_TCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000108))
6998 +#define VMAC_TCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000010C))
6999 +#define VMAC_TCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000110))
7000 +#define VMAC_TCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000114))
7001 +#define VMAC_TCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000118))
7002 +#define VMAC_TXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000011c))
7005 +#define VMAC_TDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000120))
7006 +#define VMAC_TDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000124))
7007 +#define VMAC_TDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000128))
7008 +#define VMAC_TDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000012C))
7009 +#define VMAC_TDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000130))
7010 +#define VMAC_TDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000134))
7011 +#define VMAC_TDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000138))
7012 +#define VMAC_TDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000013C))
7013 +#define VMAC_TXPADDCNT(X) (*(volatile unsigned int *)(X + 0x00000140))
7014 +#define VMAC_TXPADDSTART(X) (*(volatile unsigned int *)(X + 0x00000144))
7015 +#define VMAC_TXPADDEND(X) (*(volatile unsigned int *)(X + 0x00000148))
7016 +#define VMAC_TXQFLUSH(X) (*(volatile unsigned int *)(X + 0x0000014C))
7018 +#define VMAC_RCRPTR(X) (*(volatile unsigned int *)(X + 0x00000200))
7019 +#define VMAC_RCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000204))
7020 +#define VMAC_RCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000208))
7021 +#define VMAC_RCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000020C))
7022 +#define VMAC_RCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000210))
7023 +#define VMAC_RCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000214))
7024 +#define VMAC_RCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000218))
7025 +#define VMAC_RXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000021c))
7027 +#define VMAC_RDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000220))
7028 +#define VMAC_RDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000224))
7029 +#define VMAC_RDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000228))
7030 +#define VMAC_RDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000022C))
7031 +#define VMAC_RDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000230))
7032 +#define VMAC_RDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000234))
7033 +#define VMAC_RDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000238))
7034 +#define VMAC_RDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000023C))
7035 +#define VMAC_FBLADDCNT(X) (*(volatile unsigned int *)(X + 0x00000240))
7036 +#define VMAC_FBLADDSTART(X) (*(volatile unsigned int *)(X + 0x00000244))
7037 +#define VMAC_FBLADDEND(X) (*(volatile unsigned int *)(X + 0x00000248))
7038 +#define VMAC_RXONOFF(X) (*(volatile unsigned int *)(X + 0x0000024C))
7040 +#define VMAC_FBL0NEXTD(X) (*(volatile unsigned int *)(X + 0x00000280))
7041 +#define VMAC_FBL0LASTD(X) (*(volatile unsigned int *)(X + 0x00000284))
7042 +#define VMAC_FBL0COUNTD(X) (*(volatile unsigned int *)(X + 0x00000288))
7043 +#define VMAC_FBL0BUFSIZE(X) (*(volatile unsigned int *)(X + 0x0000028C))
7045 +#define VMAC_MACCONTROL(X) (*(volatile unsigned int *)(X + 0x00000300))
7046 +#define VMAC_MACSTATUS(X) (*(volatile unsigned int *)(X + 0x00000304))
7047 +#define VMAC_MACADDRHI(X) (*(volatile unsigned int *)(X + 0x00000308))
7048 +#define VMAC_MACADDRLO(X) (*(volatile unsigned int *)(X + 0x0000030C))
7049 +#define VMAC_MACHASH1(X) (*(volatile unsigned int *)(X + 0x00000310))
7050 +#define VMAC_MACHASH2(X) (*(volatile unsigned int *)(X + 0x00000314))
7052 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
7053 +#define VMAC_BOFTEST(X) (*(volatile unsigned int *)(X + 0x00000344))
7054 +#define VMAC_PACTEST(X) (*(volatile unsigned int *)(X + 0x00000348))
7055 +#define VMAC_PAUSEOP(X) (*(volatile unsigned int *)(X + 0x0000034C))
7057 +#define VMAC_MDIOCONTROL(X) (*(volatile unsigned int *)(X + 0x00000380))
7058 +#define VMAC_MDIOUSERACCESS(X) (*(volatile unsigned int *)(X +0x00000384))
7059 +#define VMAC_MDIOACK(X) (*(volatile unsigned int *)(X + 0x00000388))
7060 +#define VMAC_MDIOLINK(X) (*(volatile unsigned int *)(X + 0x0000038C))
7061 +#define VMAC_MDIOMACPHY(X) (*(volatile unsigned int *)(X + 0x00000390))
7063 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
7065 +#endif __AVALANCHE_REGS_H
7072 diff -urN linux.old/include/asm-mips/ar7/avalanche_types.h linux.dev/include/asm-mips/ar7/avalanche_types.h
7073 --- linux.old/include/asm-mips/ar7/avalanche_types.h 1970-01-01 01:00:00.000000000 +0100
7074 +++ linux.dev/include/asm-mips/ar7/avalanche_types.h 2005-11-10 01:10:46.071588750 +0100
7076 +/*------------------------------------------------------------------------------------------*\
7077 +\*------------------------------------------------------------------------------------------*/
7078 +#ifndef _avalanche_types_h_
7079 +#define _avalanche_types_h_
7081 +/*--- #include <asm/avalanche/generic/hal_modules/haltypes.h> ---*/
7089 +#define NULL (void *)0
7092 +/*------------------------------------------------------------------------------------------*\
7093 + * Typen für Texas GPL Module
7094 +\*------------------------------------------------------------------------------------------*/
7095 +#ifndef __UINT8_T__
7096 +typedef unsigned char UINT8;
7097 +#define __UINT8_T__
7100 +#ifndef __UCHAR_T__
7101 +typedef unsigned char UCHAR;
7102 +#define __UCHAR_T__
7106 +typedef signed char INT8;
7110 +#ifndef __UINT16_T__
7111 +typedef unsigned short UINT16;
7112 +#define __UINT16_T__
7115 +#ifndef __USHORT_T__
7116 +typedef unsigned short USHORT;
7117 +#define __USHORT_T__
7120 +#ifndef __INT16_T__
7121 +typedef signed short INT16;
7122 +#define __INT16_T__
7125 +#ifndef __UINT32_T__
7126 +typedef unsigned int UINT32;
7127 +#define __UINT32_T__
7131 +typedef unsigned int UINT;
7135 +#ifndef __INT32_T__
7136 +typedef signed int INT32;
7137 +#define __INT32_T__
7140 +#ifndef __ULONG_T__
7141 +typedef unsigned long ULONG;
7142 +#define __ULONG_T__
7150 +#ifndef __STATUS_T__
7151 +typedef int STATUS;
7152 +#define __STATUS_T__
7155 +/*------------------------------------------------------------------------------------------*\
7156 +\*------------------------------------------------------------------------------------------*/
7157 +typedef void (*p_vlynq_intr_cntrl_isr_t)(void *,void *,void *);
7158 +typedef INT32 (*p_vlynq_interrupt_vector_set_t)(void *, UINT32, UINT32, INT32, INT32, INT32);
7159 +typedef INT32 (*p_vlynq_interrupt_vector_cntl_t)(void *, UINT32, INT32, UINT32);
7160 +typedef UINT32 (*p_vlynq_interrupt_get_count_t)(void *, UINT32);
7161 +typedef INT32 (*p_vlynq_install_isr_t)(void *, UINT32, p_vlynq_intr_cntrl_isr_t, void *, void *, void *);
7162 +typedef INT32 (*p_vlynq_uninstall_isr_t)(void *, UINT32, void *, void *, void *);
7163 +typedef void (*p_vlynq_root_isr_t)(void *);
7164 +typedef void (*p_vlynq_delay_t)(UINT32);
7165 +typedef INT32 (*p_vlynq_interrupt_vector_map_t)(void *, INT32, UINT32, UINT32);
7166 +typedef INT32 (*p_vlynq_interrupt_set_polarity_t)(void *, INT32, UINT32, INT32);
7167 +typedef INT32 (*p_vlynq_interrupt_get_polarity_t)(void *, INT32, UINT32);
7168 +typedef INT32 (*p_vlynq_interrupt_set_type_t)(void *, INT32, UINT32, INT32);
7169 +typedef INT32 (*p_vlynq_interrupt_get_type_t)(void *, INT32, UINT32);
7170 +typedef INT32 (*p_vlynq_interrupt_enable_t)(void *, INT32, UINT32);
7171 +typedef INT32 (*p_vlynq_interrupt_disable_t)(void *, INT32, UINT32);
7173 +/*------------------------------------------------------------------------------------------*\
7174 +\*------------------------------------------------------------------------------------------*/
7175 +extern p_vlynq_interrupt_vector_set_t p_vlynq_interrupt_vector_set;
7176 +extern p_vlynq_interrupt_vector_cntl_t p_vlynq_interrupt_vector_cntl;
7177 +extern p_vlynq_interrupt_get_count_t p_vlynq_interrupt_get_count;
7178 +extern p_vlynq_install_isr_t p_vlynq_install_isr;
7179 +extern p_vlynq_uninstall_isr_t p_vlynq_uninstall_isr;
7180 +extern p_vlynq_root_isr_t p_vlynq_root_isr;
7181 +extern p_vlynq_delay_t p_vlynq_delay;
7182 +extern p_vlynq_interrupt_vector_map_t p_vlynq_interrupt_vector_map;
7183 +extern p_vlynq_interrupt_set_polarity_t p_vlynq_interrupt_set_polarity;
7184 +extern p_vlynq_interrupt_get_polarity_t p_vlynq_interrupt_get_polarity;
7185 +extern p_vlynq_interrupt_set_type_t p_vlynq_interrupt_set_type;
7186 +extern p_vlynq_interrupt_get_type_t p_vlynq_interrupt_get_type;
7187 +extern p_vlynq_interrupt_enable_t p_vlynq_interrupt_enable;
7188 +extern p_vlynq_interrupt_disable_t p_vlynq_interrupt_disable;
7189 +extern void *p_vlynqDevice0;
7190 +extern void *p_vlynqDevice1;
7192 +/*------------------------------------------------------------------------------------------*\
7193 +\*------------------------------------------------------------------------------------------*/
7194 +enum _avalanche_need_ {
7195 + avalanche_need_vlynq,
7196 + avalanche_need_auto_mdix
7199 +int avalanche_need(enum _avalanche_need_);
7201 +#endif /*--- #ifndef _avalanche_types_h_ ---*/
7202 diff -urN linux.old/include/asm-mips/ar7/if_port.h linux.dev/include/asm-mips/ar7/if_port.h
7203 --- linux.old/include/asm-mips/ar7/if_port.h 1970-01-01 01:00:00.000000000 +0100
7204 +++ linux.dev/include/asm-mips/ar7/if_port.h 2005-11-10 01:10:46.071588750 +0100
7206 +/*******************************************************************************
7207 + * FILE PURPOSE: Interface port id Header file
7208 + *******************************************************************************
7209 + * FILE NAME: if_port.h
7211 + * DESCRIPTION: Header file carrying information about port ids of interfaces
7214 + * (C) Copyright 2003, Texas Instruments, Inc
7215 + ******************************************************************************/
7216 +#ifndef _IF_PORT_H_
7217 +#define _IF_PORT_H_
7219 +#define AVALANCHE_CPMAC_LOW_PORT_ID 0
7220 +#define AVALANCHE_CPMAC_HIGH_PORT_ID 1
7221 +#define AVALANCHE_USB_PORT_ID 2
7222 +#define AVALANCHE_WLAN_PORT_ID 3
7225 +#define AVALANCHE_MARVELL_BASE_PORT_ID 4
7227 +/* The marvell ports occupy port ids from 4 to 8 */
7228 +/* so the next port id number should start at 9 */
7231 +#endif /* _IF_PORT_H_ */
7232 diff -urN linux.old/include/asm-mips/ar7/sangam.h linux.dev/include/asm-mips/ar7/sangam.h
7233 --- linux.old/include/asm-mips/ar7/sangam.h 1970-01-01 01:00:00.000000000 +0100
7234 +++ linux.dev/include/asm-mips/ar7/sangam.h 2005-11-10 01:10:46.071588750 +0100
7239 +#include <linux/config.h>
7240 +#include <asm/addrspace.h>
7242 +/*----------------------------------------------------
7243 + * Sangam's Module Base Addresses
7244 + *--------------------------------------------------*/
7245 +#define AVALANCHE_ADSL_SUB_SYS_MEM_BASE (KSEG1ADDR(0x01000000)) /* AVALANCHE ADSL Mem Base */
7246 +#define AVALANCHE_BROADBAND_INTERFACE__BASE (KSEG1ADDR(0x02000000)) /* AVALANCHE BBIF */
7247 +#define AVALANCHE_ATM_SAR_BASE (KSEG1ADDR(0x03000000)) /* AVALANCHE ATM SAR */
7248 +#define AVALANCHE_USB_SLAVE_BASE (KSEG1ADDR(0x03400000)) /* AVALANCHE USB SLAVE */
7249 +#define AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x04000000)) /* AVALANCHE VLYNQ 0 Mem map */
7250 +#define AVALANCHE_LOW_CPMAC_BASE (KSEG1ADDR(0x08610000)) /* AVALANCHE CPMAC 0 */
7251 +#define AVALANCHE_EMIF_CONTROL_BASE (KSEG1ADDR(0x08610800)) /* AVALANCHE EMIF */
7252 +#define AVALANCHE_GPIO_BASE (KSEG1ADDR(0x08610900)) /* AVALANCHE GPIO */
7253 +#define AVALANCHE_CLOCK_CONTROL_BASE (KSEG1ADDR(0x08610A00)) /* AVALANCHE Clock Control */
7254 +#define AVALANCHE_WATCHDOG_TIMER_BASE (KSEG1ADDR(0x08610B00)) /* AVALANCHE Watch Dog Timer */
7255 +#define AVALANCHE_TIMER0_BASE (KSEG1ADDR(0x08610C00)) /* AVALANCHE Timer 1 */
7256 +#define AVALANCHE_TIMER1_BASE (KSEG1ADDR(0x08610D00)) /* AVALANCHE Timer 2 */
7257 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
7258 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 0 */
7259 +#define AVALANCHE_I2C_BASE (KSEG1ADDR(0x08611000)) /* AVALANCHE I2C */
7260 +#define AVALANCHE_USB_SLAVE_CONTROL_BASE (KSEG1ADDR(0x08611200)) /* AVALANCHE USB DMA */
7261 +#define AVALANCHE_MCDMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* AVALANCHE MC DMA 0 (channels 0-3) */
7262 +#define AVALANCHE_RESET_CONTROL_BASE (KSEG1ADDR(0x08611600)) /* AVALANCHE Reset Control */
7263 +#define AVALANCHE_BIST_CONTROL_BASE (KSEG1ADDR(0x08611700)) /* AVALANCHE BIST Control */
7264 +#define AVALANCHE_LOW_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611800)) /* AVALANCHE VLYNQ0 Control */
7265 +#define AVALANCHE_DEVICE_CONFIG_LATCH_BASE (KSEG1ADDR(0x08611A00)) /* AVALANCHE Device Config Latch */
7266 +#define AVALANCHE_HIGH_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611C00)) /* AVALANCHE VLYNQ1 Control */
7267 +#define AVALANCHE_MDIO_BASE (KSEG1ADDR(0x08611E00)) /* AVALANCHE MDIO */
7268 +#define AVALANCHE_FSER_BASE (KSEG1ADDR(0x08612000)) /* AVALANCHE FSER base */
7269 +#define AVALANCHE_INTC_BASE (KSEG1ADDR(0x08612400)) /* AVALANCHE INTC */
7270 +#define AVALANCHE_HIGH_CPMAC_BASE (KSEG1ADDR(0x08612800)) /* AVALANCHE CPMAC 1 */
7271 +#define AVALANCHE_HIGH_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x0C000000)) /* AVALANCHE VLYNQ 1 Mem map */
7273 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
7276 +/*----------------------------------------------------
7277 + * Sangam Interrupt Map (Primary Interrupts)
7278 + *--------------------------------------------------*/
7280 +#define AVALANCHE_UNIFIED_SECONDARY_INT 0
7281 +#define AVALANCHE_EXT_INT_0 1
7282 +#define AVALANCHE_EXT_INT_1 2
7283 +/* Line# 3 to 4 are reserved */
7284 +#define AVALANCHE_TIMER_0_INT 5
7285 +#define AVALANCHE_TIMER_1_INT 6
7286 +#define AVALANCHE_UART0_INT 7
7287 +#define AVALANCHE_UART1_INT 8
7288 +#define AVALANCHE_DMA_INT0 9
7289 +#define AVALANCHE_DMA_INT1 10
7290 +/* Line# 11 to 14 are reserved */
7291 +#define AVALANCHE_ATM_SAR_INT 15
7292 +/* Line# 16 to 18 are reserved */
7293 +#define AVALANCHE_LOW_CPMAC_INT 19
7294 +/* Line# 20 is reserved */
7295 +#define AVALANCHE_LOW_VLYNQ_INT 21
7296 +#define AVALANCHE_CODEC_WAKEUP_INT 22
7297 +/* Line# 23 is reserved */
7298 +#define AVALANCHE_USB_SLAVE_INT 24
7299 +#define AVALANCHE_HIGH_VLYNQ_INT 25
7300 +/* Line# 26 to 27 are reserved */
7301 +#define AVALANCHE_UNIFIED_PHY_INT 28
7302 +#define AVALANCHE_I2C_INT 29
7303 +#define AVALANCHE_DMA_INT2 30
7304 +#define AVALANCHE_DMA_INT3 31
7305 +/* Line# 32 is reserved */
7306 +#define AVALANCHE_HIGH_CPMAC_INT 33
7307 +/* Line# 34 to 36 is reserved */
7308 +#define AVALANCHE_VDMA_VT_RX_INT 37
7309 +#define AVALANCHE_VDMA_VT_TX_INT 38
7310 +#define AVALANCHE_ADSL_SUB_SYSTEM_INT 39
7313 +#define AVALANCHE_EMIF_INT 47
7317 +/*-----------------------------------------------------------
7318 + * Sangam's Reset Bits
7319 + *---------------------------------------------------------*/
7321 +#define AVALANCHE_UART0_RESET_BIT 0
7322 +#define AVALANCHE_UART1_RESET_BIT 1
7323 +#define AVALANCHE_I2C_RESET_BIT 2
7324 +#define AVALANCHE_TIMER0_RESET_BIT 3
7325 +#define AVALANCHE_TIMER1_RESET_BIT 4
7326 +/* Reset bit 5 is reserved. */
7327 +#define AVALANCHE_GPIO_RESET_BIT 6
7328 +#define AVALANCHE_ADSL_SUB_SYS_RESET_BIT 7
7329 +#define AVALANCHE_USB_SLAVE_RESET_BIT 8
7330 +#define AVALANCHE_ATM_SAR_RESET_BIT 9
7331 +/* Reset bit 10 is reserved. */
7332 +#define AVALANCHE_VDMA_VT_RESET_BIT 11
7333 +#define AVALANCHE_FSER_RESET_BIT 12
7334 +/* Reset bit 13 to 15 are reserved */
7335 +#define AVALANCHE_HIGH_VLYNQ_RESET_BIT 16
7336 +#define AVALANCHE_LOW_CPMAC_RESET_BIT 17
7337 +#define AVALANCHE_MCDMA_RESET_BIT 18
7338 +#define AVALANCHE_BIST_RESET_BIT 19
7339 +#define AVALANCHE_LOW_VLYNQ_RESET_BIT 20
7340 +#define AVALANCHE_HIGH_CPMAC_RESET_BIT 21
7341 +#define AVALANCHE_MDIO_RESET_BIT 22
7342 +#define AVALANCHE_ADSL_SUB_SYS_DSP_RESET_BIT 23
7343 +/* Reset bit 24 to 25 are reserved */
7344 +#define AVALANCHE_LOW_EPHY_RESET_BIT 26
7345 +/* Reset bit 27 to 31 are reserved */
7348 +#define AVALANCHE_POWER_MODULE_USBSP 0
7349 +#define AVALANCHE_POWER_MODULE_WDTP 1
7350 +#define AVALANCHE_POWER_MODULE_UT0P 2
7351 +#define AVALANCHE_POWER_MODULE_UT1P 3
7352 +#define AVALANCHE_POWER_MODULE_IICP 4
7353 +#define AVALANCHE_POWER_MODULE_VDMAP 5
7354 +#define AVALANCHE_POWER_MODULE_GPIOP 6
7355 +#define AVALANCHE_POWER_MODULE_VLYNQ1P 7
7356 +#define AVALANCHE_POWER_MODULE_SARP 8
7357 +#define AVALANCHE_POWER_MODULE_ADSLP 9
7358 +#define AVALANCHE_POWER_MODULE_EMIFP 10
7359 +#define AVALANCHE_POWER_MODULE_ADSPP 12
7360 +#define AVALANCHE_POWER_MODULE_RAMP 13
7361 +#define AVALANCHE_POWER_MODULE_ROMP 14
7362 +#define AVALANCHE_POWER_MODULE_DMAP 15
7363 +#define AVALANCHE_POWER_MODULE_BISTP 16
7364 +#define AVALANCHE_POWER_MODULE_TIMER0P 18
7365 +#define AVALANCHE_POWER_MODULE_TIMER1P 19
7366 +#define AVALANCHE_POWER_MODULE_EMAC0P 20
7367 +#define AVALANCHE_POWER_MODULE_EMAC1P 22
7368 +#define AVALANCHE_POWER_MODULE_EPHYP 24
7369 +#define AVALANCHE_POWER_MODULE_VLYNQ0P 27
7376 + * Sangam board vectors
7379 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
7380 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
7382 +/*-----------------------------------------------------------------------------
7383 + * Sangam's system register.
7385 + *---------------------------------------------------------------------------*/
7386 +#define AVALANCHE_DCL_BOOTCR (KSEG1ADDR(0x08611A00))
7387 +#define AVALANCHE_EMIF_SDRAM_CFG (AVALANCHE_EMIF_CONTROL_BASE + 0x8)
7388 +#define AVALANCHE_RST_CTRL_PRCR (KSEG1ADDR(0x08611600))
7389 +#define AVALANCHE_RST_CTRL_SWRCR (KSEG1ADDR(0x08611604))
7390 +#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611600))
7392 +#define AVALANCHE_POWER_CTRL_PDCR (KSEG1ADDR(0x08610A00))
7393 +#define AVALANCHE_WAKEUP_CTRL_WKCR (KSEG1ADDR(0x08610A0C))
7395 +#define AVALANCHE_GPIO_DATA_IN (AVALANCHE_GPIO_BASE + 0x0)
7396 +#define AVALANCHE_GPIO_DATA_OUT (AVALANCHE_GPIO_BASE + 0x4)
7397 +#define AVALANCHE_GPIO_DIR (AVALANCHE_GPIO_BASE + 0x8)
7398 +#define AVALANCHE_GPIO_ENBL (AVALANCHE_GPIO_BASE + 0xC)
7399 +#define AVALANCHE_CVR (AVALANCHE_GPIO_BASE + 0x14)
7402 + * Yamon Prom print address.
7404 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
7405 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
7406 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
7408 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
7410 +#define AVALANCHE_GPIO_PIN_COUNT 32
7411 +#define AVALANCHE_GPIO_OFF_MAP {0xF34FFFC0}
7413 +#include "sangam_boards.h"
7415 +#endif /*_SANGAM_H_ */
7416 diff -urN linux.old/include/asm-mips/ar7/sangam_boards.h linux.dev/include/asm-mips/ar7/sangam_boards.h
7417 --- linux.old/include/asm-mips/ar7/sangam_boards.h 1970-01-01 01:00:00.000000000 +0100
7418 +++ linux.dev/include/asm-mips/ar7/sangam_boards.h 2005-11-10 01:10:46.071588750 +0100
7420 +#ifndef _SANGAM_BOARDS_H
7421 +#define _SANGAM_BOARDS_H
7423 +// Let us define board specific information here.
7426 +#if defined(CONFIG_AR7DB)
7428 +#define AFECLK_FREQ 35328000
7429 +#define REFCLK_FREQ 25000000
7430 +#define OSC3_FREQ 24000000
7431 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
7432 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
7433 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
7438 +#if defined(CONFIG_AR7RD)
7439 +#define AFECLK_FREQ 35328000
7440 +#define REFCLK_FREQ 25000000
7441 +#define OSC3_FREQ 24000000
7442 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
7443 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
7444 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
7448 +#if defined(CONFIG_AR7WI)
7449 +#define AFECLK_FREQ 35328000
7450 +#define REFCLK_FREQ 25000000
7451 +#define OSC3_FREQ 24000000
7452 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
7453 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
7454 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
7458 +#if defined(CONFIG_AR7V)
7459 +#define AFECLK_FREQ 35328000
7460 +#define REFCLK_FREQ 25000000
7461 +#define OSC3_FREQ 24000000
7462 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
7463 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
7464 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
7468 +#if defined(CONFIG_AR7WRD)
7469 +#define AFECLK_FREQ 35328000
7470 +#define REFCLK_FREQ 25000000
7471 +#define OSC3_FREQ 24000000
7472 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
7473 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
7474 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
7478 +#if defined(CONFIG_AR7VWI)
7479 +#define AFECLK_FREQ 35328000
7480 +#define REFCLK_FREQ 25000000
7481 +#define OSC3_FREQ 24000000
7482 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
7483 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
7484 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
7488 +#if defined CONFIG_SEAD2
7489 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0xAAAAAAAA
7490 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
7491 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0
7492 +#include <asm/mips-boards/sead.h>
7497 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx.h linux.dev/include/asm-mips/ar7/tnetd73xx.h
7498 --- linux.old/include/asm-mips/ar7/tnetd73xx.h 1970-01-01 01:00:00.000000000 +0100
7499 +++ linux.dev/include/asm-mips/ar7/tnetd73xx.h 2005-11-10 01:10:46.075589000 +0100
7501 +/******************************************************************************
7502 + * FILE PURPOSE: TNETD73xx Common Header File
7503 + ******************************************************************************
7504 + * FILE NAME: tnetd73xx.h
7506 + * DESCRIPTION: shared typedef's, constants and API for TNETD73xx
7508 + * REVISION HISTORY:
7509 + * 27 Nov 02 - PSP TII
7511 + * (C) Copyright 2002, Texas Instruments, Inc
7512 + *******************************************************************************/
7517 + * These are const, typedef, and api definitions for tnetd73xx.
7520 + * 1. This file may be included into both C and Assembly files.
7521 + * - for .s files, please do #define _ASMLANGUAGE in your ASM file to
7522 + * avoid C data types (typedefs) below;
7523 + * - for .c files, you don't have to do anything special.
7525 + * 2. This file has a number of sections for each SOC subsystem. When adding
7526 + * a new constant, find the subsystem you are working on and follow the
7527 + * name pattern. If you are adding another typedef for your interface, please,
7528 + * place it with other typedefs and function prototypes.
7530 + * 3. Please, DO NOT add any macros or types that are local to a subsystem to avoid
7531 + * cluttering. Include such items directly into the module's .c file or have a
7532 + * local .h file to pass data between smaller modules. This file defines only
7536 +#ifndef __TNETD73XX_H__
7537 +#define __TNETD73XX_H__
7539 +#ifndef _ASMLANGUAGE /* This part not for assembly language */
7541 +extern unsigned int tnetd73xx_mips_freq;
7542 +extern unsigned int tnetd73xx_vbus_freq;
7544 +#include "tnetd73xx_err.h"
7546 +#endif /* _ASMLANGUAGE */
7549 +/*******************************************************************************************
7550 +* Emerald core specific
7551 +******************************************************************************************** */
7554 +#elif defined(LITTLE_ENDIAN)
7556 +#error Need to define endianism
7560 +#define KSEG_MSK 0xE0000000 /* Most significant 3 bits denote kseg choice */
7563 +#ifndef KSEG_INV_MASK
7564 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
7568 +#define KSEG0_BASE 0x80000000
7572 +#define KSEG1_BASE 0xA0000000
7576 +#define KSEG0(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG0_BASE)
7580 +#define KSEG1(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG1_BASE)
7584 +#define KUSEG(addr) ((__u32)(addr) & ~KSEG_MSK)
7588 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
7592 +#define PHYS_TO_K0(addr) (PHYS_ADDR(addr)|KSEG0_BASE)
7596 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
7600 +#define REG8_ADDR(addr) (volatile __u8 *)(PHYS_TO_K1(addr))
7601 +#define REG8_DATA(addr) (*(volatile __u8 *)(PHYS_TO_K1(addr)))
7602 +#define REG8_WRITE(addr, data) REG8_DATA(addr) = data;
7603 +#define REG8_READ(addr, data) data = (__u8) REG8_DATA(addr);
7607 +#define REG16_ADDR(addr) (volatile __u16 *)(PHYS_TO_K1(addr))
7608 +#define REG16_DATA(addr) (*(volatile __u16 *)(PHYS_TO_K1(addr)))
7609 +#define REG16_WRITE(addr, data) REG16_DATA(addr) = data;
7610 +#define REG16_READ(addr, data) data = (__u16) REG16_DATA(addr);
7614 +#define REG32_ADDR(addr) (volatile __u32 *)(PHYS_TO_K1(addr))
7615 +#define REG32_DATA(addr) (*(volatile __u32 *)(PHYS_TO_K1(addr)))
7616 +#define REG32_WRITE(addr, data) REG32_DATA(addr) = data;
7617 +#define REG32_READ(addr, data) data = (__u32) REG32_DATA(addr);
7620 +#ifdef _LINK_KSEG0_ /* Application is linked into KSEG0 space */
7621 +#define VIRT_ADDR(addr) PHYS_TO_K0(PHYS_ADDR(addr))
7624 +#ifdef _LINK_KSEG1_ /* Application is linked into KSEG1 space */
7625 +#define VIRT_ADDR(addr) PHYS_TO_K1(PHYS_ADDR(addr))
7628 +#if !defined(_LINK_KSEG0_) && !defined(_LINK_KSEG1_)
7629 +#error You must define _LINK_KSEG0_ or _LINK_KSEG1_ to compile the code.
7632 +/* TNETD73XX chip definations */
7634 +#define FREQ_1MHZ 1000000
7635 +#define TNETD73XX_MIPS_FREQ tnetd73xx_mips_freq /* CPU clock frequency */
7636 +#define TNETD73XX_VBUS_FREQ tnetd73xx_vbus_freq /* originally (TNETD73XX_MIPS_FREQ/2) */
7639 +#define TNETD73XX_MIPS_FREQ_DEFAULT 25000000 /* 25 Mhz for sead2 board crystal */
7641 +#define TNETD73XX_MIPS_FREQ_DEFAULT 125000000 /* 125 Mhz */
7643 +#define TNETD73XX_VBUS_FREQ_DEFAULT (TNETD73XX_MIPS_FREQ_DEFAULT / 2) /* Sync mode */
7647 +/* Module base addresses */
7648 +#define TNETD73XX_ADSLSS_BASE PHYS_TO_K1(0x01000000) /* ADSLSS Module */
7649 +#define TNETD73XX_BBIF_CTRL_BASE PHYS_TO_K1(0x02000000) /* BBIF Control */
7650 +#define TNETD73XX_ATMSAR_BASE PHYS_TO_K1(0x03000000) /* ATM SAR */
7651 +#define TNETD73XX_USB_BASE PHYS_TO_K1(0x03400000) /* USB Module */
7652 +#define TNETD73XX_VLYNQ0_BASE PHYS_TO_K1(0x04000000) /* VLYNQ0 Module */
7653 +#define TNETD73xx_EMAC0_BASE PHYS_TO_K1(0x08610000) /* EMAC0 Module*/
7654 +#define TNETD73XX_EMIF_BASE PHYS_TO_K1(0x08610800) /* EMIF Module */
7655 +#define TNETD73XX_GPIO_BASE PHYS_TO_K1(0x08610900) /* GPIO control */
7656 +#define TNETD73XX_CLOCK_CTRL_BASE PHYS_TO_K1(0x08610A00) /* Clock Control */
7657 +#define TNETD73XX_WDTIMER_BASE PHYS_TO_K1(0x08610B00) /* WDTIMER Module */
7658 +#define TNETD73XX_TIMER0_BASE PHYS_TO_K1(0x08610C00) /* TIMER0 Module */
7659 +#define TNETD73XX_TIMER1_BASE PHYS_TO_K1(0x08610D00) /* TIMER1 Module */
7660 +#define TNETD73XX_UARTA_BASE PHYS_TO_K1(0x08610E00) /* UART A */
7661 +#define TNETD73XX_UARTB_BASE PHYS_TO_K1(0x08610F00) /* UART B */
7662 +#define TNETD73XX_I2C_BASE PHYS_TO_K1(0x08611000) /* I2C Module */
7663 +#define TNETD73XX_USB_DMA_BASE PHYS_TO_K1(0x08611200) /* USB Module */
7664 +#define TNETD73XX_MCDMA_BASE PHYS_TO_K1(0x08611400) /* MC-DMA */
7665 +#define TNETD73xx_VDMAVT_BASE PHYS_TO_K1(0x08611500) /* VDMAVT Control */
7666 +#define TNETD73XX_RST_CTRL_BASE PHYS_TO_K1(0x08611600) /* Reset Control */
7667 +#define TNETD73xx_BIST_CTRL_BASE PHYS_TO_K1(0x08611700) /* BIST Control */
7668 +#define TNETD73xx_VLYNQ0_CTRL_BASE PHYS_TO_K1(0x08611800) /* VLYNQ0 Control */
7669 +#define TNETD73XX_DCL_BASE PHYS_TO_K1(0x08611A00) /* Device Configuration Latch */
7670 +#define TNETD73xx_VLYNQ1_CTRL_BASE PHYS_TO_K1(0x08611C00) /* VLYNQ1 Control */
7671 +#define TNETD73xx_MDIO_BASE PHYS_TO_K1(0x08611E00) /* MDIO Control */
7672 +#define TNETD73XX_FSER_BASE PHYS_TO_K1(0x08612000) /* FSER Control */
7673 +#define TNETD73XX_INTC_BASE PHYS_TO_K1(0x08612400) /* Interrupt Controller */
7674 +#define TNETD73xx_EMAC1_BASE PHYS_TO_K1(0x08612800) /* EMAC1 Module*/
7675 +#define TNETD73XX_VLYNQ1_BASE PHYS_TO_K1(0x0C000000) /* VLYNQ1 Module */
7677 +/* BBIF Registers */
7678 +#define TNETD73XX_BBIF_ADSLADR (TNETD73XX_BBIF_CTRL_BASE + 0x0)
7680 +/* Device Configuration Latch Registers */
7681 +#define TNETD73XX_DCL_BOOTCR (TNETD73XX_DCL_BASE + 0x0)
7682 +#define TNETD73XX_DCL_DPLLSELR (TNETD73XX_DCL_BASE + 0x10)
7683 +#define TNETD73XX_DCL_SPEEDCTLR (TNETD73XX_DCL_BASE + 0x14)
7684 +#define TNETD73XX_DCL_SPEEDPWDR (TNETD73XX_DCL_BASE + 0x18)
7685 +#define TNETD73XX_DCL_SPEEDCAPR (TNETD73XX_DCL_BASE + 0x1C)
7688 +#define TNETD73XX_GPIODINR (TNETD73XX_GPIO_BASE + 0x0)
7689 +#define TNETD73XX_GPIODOUTR (TNETD73XX_GPIO_BASE + 0x4)
7690 +#define TNETD73XX_GPIOPDIRR (TNETD73XX_GPIO_BASE + 0x8)
7691 +#define TNETD73XX_GPIOENR (TNETD73XX_GPIO_BASE + 0xC)
7692 +#define TNETD73XX_CVR (TNETD73XX_GPIO_BASE + 0x14)
7693 +#define TNETD73XX_DIDR1 (TNETD73XX_GPIO_BASE + 0x18)
7694 +#define TNETD73XX_DIDR2 (TNETD73XX_GPIO_BASE + 0x1C)
7696 +/* Reset Control */
7697 +#define TNETD73XX_RST_CTRL_PRCR (TNETD73XX_RST_CTRL_BASE + 0x0)
7698 +#define TNETD73XX_RST_CTRL_SWRCR (TNETD73XX_RST_CTRL_BASE + 0x4)
7699 +#define TNETD73XX_RST_CTRL_RSR (TNETD73XX_RST_CTRL_BASE + 0x8)
7701 +/* Power Control */
7702 +#define TNETD73XX_POWER_CTRL_PDCR (TNETD73XX_CLOCK_CTRL_BASE + 0x0)
7703 +#define TNETD73XX_POWER_CTRL_PCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x4)
7704 +#define TNETD73XX_POWER_CTRL_PDUCR (TNETD73XX_CLOCK_CTRL_BASE + 0x8)
7705 +#define TNETD73XX_POWER_CTRL_WKCR (TNETD73XX_CLOCK_CTRL_BASE + 0xC)
7707 +/* Clock Control */
7708 +#define TNETD73XX_CLK_CTRL_SCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x20)
7709 +#define TNETD73XX_CLK_CTRL_SCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x30)
7710 +#define TNETD73XX_CLK_CTRL_MCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x40)
7711 +#define TNETD73XX_CLK_CTRL_MCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x50)
7712 +#define TNETD73XX_CLK_CTRL_UCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x60)
7713 +#define TNETD73XX_CLK_CTRL_UCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x70)
7714 +#define TNETD73XX_CLK_CTRL_ACLKCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x80)
7715 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x90)
7716 +#define TNETD73XX_CLK_CTRL_ACLKCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xA0)
7717 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xB0)
7720 +#define TNETD73XX_EMIF_SDRAM_CFG ( TNETD73XX_EMIF_BASE + 0x08 )
7724 +#define TNETD73XX_UART_FREQ 3686400
7726 +#define TNETD73XX_UART_FREQ TNETD73XX_VBUS_FREQ
7729 +/* Interrupt Controller */
7731 +/* Primary interrupts */
7732 +#define TNETD73XX_INTC_UNIFIED_SECONDARY 0 /* Unified secondary interrupt */
7733 +#define TNETD73XX_INTC_EXTERNAL0 1 /* External Interrupt Line 0 */
7734 +#define TNETD73XX_INTC_EXTERNAL1 2 /* External Interrupt Line 1 */
7735 +#define TNETD73XX_INTC_RESERVED3 3 /* Reserved */
7736 +#define TNETD73XX_INTC_RESERVED4 4 /* Reserved */
7737 +#define TNETD73XX_INTC_TIMER0 5 /* TIMER 0 int */
7738 +#define TNETD73XX_INTC_TIMER1 6 /* TIMER 1 int */
7739 +#define TNETD73XX_INTC_UART0 7 /* UART 0 int */
7740 +#define TNETD73XX_INTC_UART1 8 /* UART 1 int */
7741 +#define TNETD73XX_INTC_MCDMA0 9 /* MCDMA 0 int */
7742 +#define TNETD73XX_INTC_MCDMA1 10 /* MCDMA 1 int */
7743 +#define TNETD73XX_INTC_RESERVED11 11 /* Reserved */
7744 +#define TNETD73XX_INTC_RESERVED12 12 /* Reserved */
7745 +#define TNETD73XX_INTC_RESERVED13 13 /* Reserved */
7746 +#define TNETD73XX_INTC_RESERVED14 14 /* Reserved */
7747 +#define TNETD73XX_INTC_ATMSAR 15 /* ATM SAR int */
7748 +#define TNETD73XX_INTC_RESERVED16 16 /* Reserved */
7749 +#define TNETD73XX_INTC_RESERVED17 17 /* Reserved */
7750 +#define TNETD73XX_INTC_RESERVED18 18 /* Reserved */
7751 +#define TNETD73XX_INTC_EMAC0 19 /* EMAC 0 int */
7752 +#define TNETD73XX_INTC_RESERVED20 20 /* Reserved */
7753 +#define TNETD73XX_INTC_VLYNQ0 21 /* VLYNQ 0 int */
7754 +#define TNETD73XX_INTC_CODEC 22 /* CODEC int */
7755 +#define TNETD73XX_INTC_RESERVED23 23 /* Reserved */
7756 +#define TNETD73XX_INTC_USBSLAVE 24 /* USB Slave int */
7757 +#define TNETD73XX_INTC_VLYNQ1 25 /* VLYNQ 1 int */
7758 +#define TNETD73XX_INTC_RESERVED26 26 /* Reserved */
7759 +#define TNETD73XX_INTC_RESERVED27 27 /* Reserved */
7760 +#define TNETD73XX_INTC_ETH_PHY 28 /* Ethernet PHY */
7761 +#define TNETD73XX_INTC_I2C 29 /* I2C int */
7762 +#define TNETD73XX_INTC_MCDMA2 30 /* MCDMA 2 int */
7763 +#define TNETD73XX_INTC_MCDMA3 31 /* MCDMA 3 int */
7764 +#define TNETD73XX_INTC_RESERVED32 32 /* Reserved */
7765 +#define TNETD73XX_INTC_EMAC1 33 /* EMAC 1 int */
7766 +#define TNETD73XX_INTC_RESERVED34 34 /* Reserved */
7767 +#define TNETD73XX_INTC_RESERVED35 35 /* Reserved */
7768 +#define TNETD73XX_INTC_RESERVED36 36 /* Reserved */
7769 +#define TNETD73XX_INTC_VDMAVTRX 37 /* VDMAVTRX */
7770 +#define TNETD73XX_INTC_VDMAVTTX 38 /* VDMAVTTX */
7771 +#define TNETD73XX_INTC_ADSLSS 39 /* ADSLSS */
7773 +/* Secondary interrupts */
7774 +#define TNETD73XX_INTC_SEC0 40 /* Secondary */
7775 +#define TNETD73XX_INTC_SEC1 41 /* Secondary */
7776 +#define TNETD73XX_INTC_SEC2 42 /* Secondary */
7777 +#define TNETD73XX_INTC_SEC3 43 /* Secondary */
7778 +#define TNETD73XX_INTC_SEC4 44 /* Secondary */
7779 +#define TNETD73XX_INTC_SEC5 45 /* Secondary */
7780 +#define TNETD73XX_INTC_SEC6 46 /* Secondary */
7781 +#define TNETD73XX_INTC_EMIF 47 /* EMIF */
7782 +#define TNETD73XX_INTC_SEC8 48 /* Secondary */
7783 +#define TNETD73XX_INTC_SEC9 49 /* Secondary */
7784 +#define TNETD73XX_INTC_SEC10 50 /* Secondary */
7785 +#define TNETD73XX_INTC_SEC11 51 /* Secondary */
7786 +#define TNETD73XX_INTC_SEC12 52 /* Secondary */
7787 +#define TNETD73XX_INTC_SEC13 53 /* Secondary */
7788 +#define TNETD73XX_INTC_SEC14 54 /* Secondary */
7789 +#define TNETD73XX_INTC_SEC15 55 /* Secondary */
7790 +#define TNETD73XX_INTC_SEC16 56 /* Secondary */
7791 +#define TNETD73XX_INTC_SEC17 57 /* Secondary */
7792 +#define TNETD73XX_INTC_SEC18 58 /* Secondary */
7793 +#define TNETD73XX_INTC_SEC19 59 /* Secondary */
7794 +#define TNETD73XX_INTC_SEC20 60 /* Secondary */
7795 +#define TNETD73XX_INTC_SEC21 61 /* Secondary */
7796 +#define TNETD73XX_INTC_SEC22 62 /* Secondary */
7797 +#define TNETD73XX_INTC_SEC23 63 /* Secondary */
7798 +#define TNETD73XX_INTC_SEC24 64 /* Secondary */
7799 +#define TNETD73XX_INTC_SEC25 65 /* Secondary */
7800 +#define TNETD73XX_INTC_SEC26 66 /* Secondary */
7801 +#define TNETD73XX_INTC_SEC27 67 /* Secondary */
7802 +#define TNETD73XX_INTC_SEC28 68 /* Secondary */
7803 +#define TNETD73XX_INTC_SEC29 69 /* Secondary */
7804 +#define TNETD73XX_INTC_SEC30 70 /* Secondary */
7805 +#define TNETD73XX_INTC_SEC31 71 /* Secondary */
7807 +/* These ugly macros are to access the -1 registers, like config1 */
7808 +#define MFC0_SEL1_OPCODE(dst, src)\
7809 + .word (0x40000000 | ((dst)<<16) | ((src)<<11) | 1);\
7814 +#define MTC0_SEL1_OPCODE(dst, src)\
7815 + .word (0x40800000 | ((dst)<<16) | ((src)<<11) | 1);\
7821 +/* Below are Jade core specific */
7822 +#define CFG0_4K_IL_MASK 0x00380000
7823 +#define CFG0_4K_IL_SHIFT 19
7824 +#define CFG0_4K_IA_MASK 0x00070000
7825 +#define CFG0_4K_IA_SHIFT 16
7826 +#define CFG0_4K_IS_MASK 0x01c00000
7827 +#define CFG0_4K_IS_SHIFT 22
7829 +#define CFG0_4K_DL_MASK 0x00001c00
7830 +#define CFG0_4K_DL_SHIFT 10
7831 +#define CFG0_4K_DA_MASK 0x00000380
7832 +#define CFG0_4K_DA_SHIFT 7
7833 +#define CFG0_4K_DS_MASK 0x0000E000
7834 +#define CFG0_4K_DS_SHIFT 13
7838 +#endif /* __TNETD73XX_H_ */
7839 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_err.h linux.dev/include/asm-mips/ar7/tnetd73xx_err.h
7840 --- linux.old/include/asm-mips/ar7/tnetd73xx_err.h 1970-01-01 01:00:00.000000000 +0100
7841 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_err.h 2005-11-10 01:10:46.075589000 +0100
7843 +/******************************************************************************
7844 + * FILE PURPOSE: TNETD73xx Error Definations Header File
7845 + ******************************************************************************
7846 + * FILE NAME: tnetd73xx_err.h
7848 + * DESCRIPTION: Error definations for TNETD73XX
7850 + * REVISION HISTORY:
7851 + * 27 Nov 02 - PSP TII
7853 + * (C) Copyright 2002, Texas Instruments, Inc
7854 + *******************************************************************************/
7857 +#ifndef __TNETD73XX_ERR_H__
7858 +#define __TNETD73XX_ERR_H__
7860 +typedef enum TNETD73XX_ERR_t
7862 + TNETD73XX_ERR_OK = 0, /* OK or SUCCESS */
7863 + TNETD73XX_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
7865 + /* Pointers and args */
7866 + TNETD73XX_ERR_INVARG = -2, /* Invaild argument to the call */
7867 + TNETD73XX_ERR_NULLPTR = -3, /* NULL pointer */
7868 + TNETD73XX_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
7870 + /* Memory issues */
7871 + TNETD73XX_ERR_ALLOC_FAIL = -10, /* allocation failed */
7872 + TNETD73XX_ERR_FREE_FAIL = -11, /* free failed */
7873 + TNETD73XX_ERR_MEM_CORRUPT = -12, /* corrupted memory */
7874 + TNETD73XX_ERR_BUF_LINK = -13, /* buffer linking failed */
7876 + /* Device issues */
7877 + TNETD73XX_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
7878 + TNETD73XX_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
7880 + TNETD73XX_ERR_INVID = -30 /* Invalid ID */
7884 +#endif /* __TNETD73XX_ERR_H__ */
7885 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_misc.h linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h
7886 --- linux.old/include/asm-mips/ar7/tnetd73xx_misc.h 1970-01-01 01:00:00.000000000 +0100
7887 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h 2005-11-10 01:10:46.075589000 +0100
7889 +/******************************************************************************
7890 + * FILE PURPOSE: TNETD73xx Misc modules API Header
7891 + ******************************************************************************
7892 + * FILE NAME: tnetd73xx_misc.h
7894 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
7895 + * FSER Modules API
7896 + * As per TNETD73xx specifications
7898 + * REVISION HISTORY:
7899 + * 27 Nov 02 - Sharath Kumar PSP TII
7900 + * 14 Feb 03 - Anant Gole PSP TII
7902 + * (C) Copyright 2002, Texas Instruments, Inc
7903 + *******************************************************************************/
7905 +#ifndef __TNETD73XX_MISC_H__
7906 +#define __TNETD73XX_MISC_H__
7908 +/*****************************************************************************
7909 + * Reset Control Module
7910 + *****************************************************************************/
7912 +typedef enum TNETD73XX_RESET_MODULE_tag
7914 + RESET_MODULE_UART0 = 0,
7915 + RESET_MODULE_UART1 = 1,
7916 + RESET_MODULE_I2C = 2,
7917 + RESET_MODULE_TIMER0 = 3,
7918 + RESET_MODULE_TIMER1 = 4,
7919 + RESET_MODULE_GPIO = 6,
7920 + RESET_MODULE_ADSLSS = 7,
7921 + RESET_MODULE_USBS = 8,
7922 + RESET_MODULE_SAR = 9,
7923 + RESET_MODULE_VDMA_VT = 11,
7924 + RESET_MODULE_FSER = 12,
7925 + RESET_MODULE_VLYNQ1 = 16,
7926 + RESET_MODULE_EMAC0 = 17,
7927 + RESET_MODULE_DMA = 18,
7928 + RESET_MODULE_BIST = 19,
7929 + RESET_MODULE_VLYNQ0 = 20,
7930 + RESET_MODULE_EMAC1 = 21,
7931 + RESET_MODULE_MDIO = 22,
7932 + RESET_MODULE_ADSLSS_DSP = 23,
7933 + RESET_MODULE_EPHY = 26
7934 +} TNETD73XX_RESET_MODULE_T;
7936 +typedef enum TNETD73XX_RESET_CTRL_tag
7940 +} TNETD73XX_RESET_CTRL_T;
7942 +typedef enum TNETD73XX_SYS_RST_MODE_tag
7944 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
7945 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
7946 +} TNETD73XX_SYS_RST_MODE_T;
7948 +typedef enum TNETD73XX_SYS_RESET_STATUS_tag
7950 + HARDWARE_RESET = 0,
7951 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
7953 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
7954 +} TNETD73XX_SYS_RESET_STATUS_T;
7956 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module,
7957 + TNETD73XX_RESET_CTRL_T reset_ctrl);
7958 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status(TNETD73XX_RESET_MODULE_T reset_module);
7959 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode);
7960 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status(void);
7962 +/*****************************************************************************
7963 + * Power Control Module
7964 + *****************************************************************************/
7966 +typedef enum TNETD73XX_POWER_MODULE_tag
7968 + POWER_MODULE_USBSP = 0,
7969 + POWER_MODULE_WDTP = 1,
7970 + POWER_MODULE_UT0P = 2,
7971 + POWER_MODULE_UT1P = 3,
7972 + POWER_MODULE_IICP = 4,
7973 + POWER_MODULE_VDMAP = 5,
7974 + POWER_MODULE_GPIOP = 6,
7975 + POWER_MODULE_VLYNQ1P = 7,
7976 + POWER_MODULE_SARP = 8,
7977 + POWER_MODULE_ADSLP = 9,
7978 + POWER_MODULE_EMIFP = 10,
7979 + POWER_MODULE_ADSPP = 12,
7980 + POWER_MODULE_RAMP = 13,
7981 + POWER_MODULE_ROMP = 14,
7982 + POWER_MODULE_DMAP = 15,
7983 + POWER_MODULE_BISTP = 16,
7984 + POWER_MODULE_TIMER0P = 18,
7985 + POWER_MODULE_TIMER1P = 19,
7986 + POWER_MODULE_EMAC0P = 20,
7987 + POWER_MODULE_EMAC1P = 22,
7988 + POWER_MODULE_EPHYP = 24,
7989 + POWER_MODULE_VLYNQ0P = 27,
7990 +} TNETD73XX_POWER_MODULE_T;
7992 +typedef enum TNETD73XX_POWER_CTRL_tag
7994 + POWER_CTRL_POWER_UP = 0,
7995 + POWER_CTRL_POWER_DOWN
7996 +} TNETD73XX_POWER_CTRL_T;
7998 +typedef enum TNETD73XX_SYS_POWER_MODE_tag
8000 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
8001 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
8002 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
8003 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
8004 +} TNETD73XX_SYS_POWER_MODE_T;
8006 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl);
8007 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module);
8008 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode);
8009 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode(void);
8011 +/*****************************************************************************
8013 + *****************************************************************************/
8015 +typedef enum TNETD73XX_WAKEUP_INTERRUPT_tag
8021 +} TNETD73XX_WAKEUP_INTERRUPT_T;
8023 +typedef enum TNETD73XX_WAKEUP_CTRL_tag
8025 + WAKEUP_DISABLED = 0,
8027 +} TNETD73XX_WAKEUP_CTRL_T;
8029 +typedef enum TNETD73XX_WAKEUP_POLARITY_tag
8031 + WAKEUP_ACTIVE_HIGH = 0,
8033 +} TNETD73XX_WAKEUP_POLARITY_T;
8035 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
8036 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
8037 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity);
8039 +/*****************************************************************************
8041 + *****************************************************************************/
8043 +typedef enum TNETD73XX_FSER_MODE_tag
8047 +} TNETD73XX_FSER_MODE_T;
8049 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode);
8051 +/*****************************************************************************
8053 + *****************************************************************************/
8055 +#define CLK_MHZ(x) ( (x) * 1000000 )
8057 +typedef enum TNETD73XX_CLKC_ID_tag
8063 +} TNETD73XX_CLKC_ID_T;
8065 +void tnetd73xx_clkc_init(__u32 afeclk, __u32 refclk, __u32 xtal3in);
8066 +TNETD73XX_ERR tnetd73xx_clkc_set_freq(TNETD73XX_CLKC_ID_T clk_id, __u32 output_freq);
8067 +__u32 tnetd73xx_clkc_get_freq(TNETD73XX_CLKC_ID_T clk_id);
8069 +/*****************************************************************************
8071 + *****************************************************************************/
8073 +typedef enum TNETD73XX_GPIO_PIN_tag
8075 + GPIO_UART0_RD = 0,
8076 + GPIO_UART0_TD = 1,
8077 + GPIO_UART0_RTS = 2,
8078 + GPIO_UART0_CTS = 3,
8079 + GPIO_FSER_CLK = 4,
8081 + GPIO_EXT_AFE_SCLK = 6,
8082 + GPIO_EXT_AFE_TX_FS = 7,
8083 + GPIO_EXT_AFE_TXD = 8,
8084 + GPIO_EXT_AFE_RS_FS = 9,
8085 + GPIO_EXT_AFE_RXD1 = 10,
8086 + GPIO_EXT_AFE_RXD0 = 11,
8087 + GPIO_EXT_AFE_CDIN = 12,
8088 + GPIO_EXT_AFE_CDOUT = 13,
8089 + GPIO_EPHY_SPEED100 = 14,
8090 + GPIO_EPHY_LINKON = 15,
8091 + GPIO_EPHY_ACTIVITY = 16,
8092 + GPIO_EPHY_FDUPLEX = 17,
8095 + GPIO_MBSP0_TCLK = 20,
8096 + GPIO_MBSP0_RCLK = 21,
8097 + GPIO_MBSP0_RD = 22,
8098 + GPIO_MBSP0_TD = 23,
8099 + GPIO_MBSP0_RFS = 24,
8100 + GPIO_MBSP0_TFS = 25,
8101 + GPIO_MII_DIO = 26,
8102 + GPIO_MII_DCLK = 27,
8103 +} TNETD73XX_GPIO_PIN_T;
8105 +typedef enum TNETD73XX_GPIO_PIN_MODE_tag
8107 + FUNCTIONAL_PIN = 0,
8109 +} TNETD73XX_GPIO_PIN_MODE_T;
8111 +typedef enum TNETD73XX_GPIO_PIN_DIRECTION_tag
8113 + GPIO_OUTPUT_PIN = 0,
8114 + GPIO_INPUT_PIN = 1
8115 +} TNETD73XX_GPIO_PIN_DIRECTION_T;
8117 +void tnetd73xx_gpio_init(void);
8118 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
8119 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
8120 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction);
8121 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value);
8122 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin);
8124 +/* TNETD73XX Revision */
8125 +__u32 tnetd73xx_get_revision(void);
8127 +#endif /* __TNETD73XX_MISC_H__ */
8128 diff -urN linux.old/include/asm-mips/ar7/vlynq.h linux.dev/include/asm-mips/ar7/vlynq.h
8129 --- linux.old/include/asm-mips/ar7/vlynq.h 1970-01-01 01:00:00.000000000 +0100
8130 +++ linux.dev/include/asm-mips/ar7/vlynq.h 2005-11-10 01:10:46.095590250 +0100
8132 +/***************************************************************************
8133 +**+----------------------------------------------------------------------+**
8137 +**| ********_///_**** |**
8138 +**| ***** /_//_/ **** |**
8139 +**| ** ** (__/ **** |**
8144 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
8145 +**| ALL RIGHTS RESERVED |**
8147 +**| Permission is hereby granted to licensees of Texas Instruments |**
8148 +**| Incorporated (TI) products to use this computer program for the sole |**
8149 +**| purpose of implementing a licensee product based on TI products. |**
8150 +**| No other rights to reproduce, use, or disseminate this computer |**
8151 +**| program, whether in part or in whole, are granted. |**
8153 +**| TI makes no representation or warranties with respect to the |**
8154 +**| performance of this computer program, and specifically disclaims |**
8155 +**| any responsibility for any damages, special or consequential, |**
8156 +**| connected with the use of this program. |**
8158 +**+----------------------------------------------------------------------+**
8159 +***************************************************************************/
8161 +/*********************************************************************************
8162 + * ------------------------------------------------------------------------------
8163 + * Module : vlynq_hal.h
8165 + * This header file provides the set of functions exported by the
8166 + * VLYNQ HAL. This file is included from the SOC specific VLYNQ driver wrapper.
8167 + * ------------------------------------------------------------------------------
8168 + *********************************************************************************/
8170 +#ifndef _VLYNQ_HAL_H_
8171 +#define _VLYNQ_HAL_H_
8173 +/* Enable/Disable debug feature */
8176 +#ifdef VLYNQ_DEBUG /* This needs to be OS abstracted - for testing use vxworks/linux calls */
8177 +#define debugPrint(format,args...)
8179 +#define debugPrint(format,args...)
8182 + /* number of VLYNQ memory regions supported */
8183 +#define VLYNQ_MAX_MEMORY_REGIONS 0x04
8185 + /* Max.number of external interrupt inputs supported by VLYNQ module */
8186 +#define VLYNQ_IVR_MAXIVR 0x08
8188 +#define VLYNQ_CLK_DIV_MAX 0x08
8189 +#define VLYNQ_CLK_DIV_MIN 0x01
8192 +/*** the total number of entries allocated for ICB would be
8193 + * 32(for 32 bits in IntPending register) + VLYNQ_IVR_CHAIN_SLOTS*/
8194 +#define VLYNQ_IVR_CHAIN_SLOTS 10
8197 +/* Error defines */
8198 +#define VLYNQ_SUCCESS 0
8200 +#define VLYNQ_ERRCODE_BASE 0 /* Chosen by system */
8201 +#define VLYNQ_INVALID_ARG -(VLYNQ_ERRCODE_BASE+1)
8202 +#define VLYNQ_INVALID_DRV_STATE -(VLYNQ_ERRCODE_BASE+2)
8203 +#define VLYNQ_INT_CONFIG_ERR -(VLYNQ_ERRCODE_BASE+3)
8204 +#define VLYNQ_LINK_DOWN -(VLYNQ_ERRCODE_BASE+4)
8205 +#define VLYNQ_MEMALLOC_FAIL -(VLYNQ_ERRCODE_BASE+5)
8206 +#define VLYNQ_ISR_NON_EXISTENT -(VLYNQ_ERRCODE_BASE+6)
8207 +#define VLYNQ_INTVEC_MAP_NOT_FOUND -(VLYNQ_ERRCODE_BASE+7)
8209 +/* Vlynq Defines and Macros */
8211 +#define VLYNQ_NUM_INT_BITS 32 /* 32 bit interrupt staus register */
8213 +/* Base address of module */
8214 +#define VLYNQ_BASE (pdev->module_base)
8216 +#define VLYNQ_REMOTE_REGS_OFFSET 0x0080
8218 +#define VLYNQ_REV_OFFSET 0x0000
8219 +#define VLYNQ_CTRL_OFFSET 0x0004
8220 +#define VLYNQ_STATUS_OFFSET 0x0008
8221 +#define VLYNQ_INT_STAT_OFFSET 0x0010
8222 +#define VLYNQ_INT_PEND_OFFSET 0x0014
8223 +#define VLYNQ_INT_PTR_OFFSET 0x0018
8224 +#define VLYNQ_TXMAP_OFFSET 0x001c
8226 +#define VLYNQ_RX0MAP_SIZE_REG_OFFSET 0x0020
8227 +#define VLYNQ_RX0MAP_OFFSET_REG_OFFSET 0x0024
8229 +#define VLYNQ_CHIP_VER_OFFSET 0x0040
8230 +#define VLYNQ_IVR_REGS_OFFSET 0x0060
8232 +#define VLYNQ_INT_PENDING_REG_PTR 0x14
8233 +#define VLYNQ_R_INT_PENDING_REG_PTR VLYNQ_REMOTE_REGS_OFFSET + 0x14
8235 +#define VLYNQ_REV_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_REV_OFFSET))
8236 +#define VLYNQ_CTRL_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_CTRL_OFFSET))
8237 +#define VLYNQ_STATUS_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_STATUS_OFFSET))
8238 +#define VLYNQ_INT_STAT_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_INT_STAT_OFFSET))
8239 +#define VLYNQ_INT_PEND_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_INT_PEND_OFFSET))
8240 +#define VLYNQ_INT_PTR_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_INT_PTR_OFFSET))
8241 +#define VLYNQ_TXMAP_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_TXMAP_OFFSET))
8243 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8244 +#define VLYNQ_RXMAP_SIZE_REG(map) \
8245 + *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_RX0MAP_SIZE_REG_OFFSET+( (map-1)<<3)))
8247 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8248 +#define VLYNQ_RXMAP_OFFSET_REG(map) \
8249 + *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_RX0MAP_OFFSET_REG_OFFSET+( (map-1)<<3)))
8251 +#define VLYNQ_CHIP_VER_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_CHIP_VER_OFFSET))
8253 +/* 0 =< ivr <= 31; currently ivr < VLYNQ_IVR_MAXIVR=8) */
8254 +#define VLYNQ_IVR_OFFSET(ivr) \
8255 + (VLYNQ_BASE + VLYNQ_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3) )
8257 +#define VLYNQ_IVR_03TO00_REG *((volatile unsigned int*) (VLYNQ_IVR_OFFSET(0)) )
8258 +#define VLYNQ_IVR_07TO04_REG *((volatile unsigned int*) (VLYNQ_IVR_OFFSET(4)) )
8259 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
8261 +#define VLYNQ_IVR_INTEN(ivr) (((unsigned int)(0x80)) << ((((unsigned)(ivr)) % 4) * 8))
8262 +#define VLYNQ_IVR_INTTYPE(ivr) (((unsigned int)(0x40)) << ((((unsigned)(ivr)) % 4) * 8))
8263 +#define VLYNQ_IVR_INTPOL(ivr) (((unsigned int)(0x20)) << ((((unsigned)(ivr)) % 4) * 8))
8264 +#define VLYNQ_IVR_INTVEC(ivr) (((unsigned int)(0x1F)) << ((((unsigned)(ivr)) % 4) * 8))
8265 +#define VLYNQ_IVR_INTALL(ivr) (((unsigned int)(0xFF)) << ((((unsigned)(ivr)) % 4) * 8))
8269 +/*********************************
8270 + * Remote VLYNQ register set *
8271 + *********************************/
8273 +#define VLYNQ_R_REV_OFFSET 0x0080
8274 +#define VLYNQ_R_CTRL_OFFSET 0x0084
8275 +#define VLYNQ_R_STATUS_OFFSET 0x0088
8276 +#define VLYNQ_R_INT_STAT_OFFSET 0x0090
8277 +#define VLYNQ_R_INT_PEND_OFFSET 0x0094
8278 +#define VLYNQ_R_INT_PTR_OFFSET 0x0098
8279 +#define VLYNQ_R_TXMAP_OFFSET 0x009c
8281 +#define VLYNQ_R_RX0MAP_SIZE_REG_OFFSET 0x00A0
8282 +#define VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET 0x00A4
8284 +#define VLYNQ_R_CHIP_VER_OFFSET 0x00C0
8285 +#define VLYNQ_R_IVR_REGS_OFFSET 0x00E0
8287 +#define VLYNQ_R_REV_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_REV_OFFSET))
8288 +#define VLYNQ_R_CTRL_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_CTRL_OFFSET))
8289 +#define VLYNQ_R_STATUS_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_STATUS_OFFSET))
8290 +#define VLYNQ_R_INT_STAT_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_INT_STAT_OFFSET))
8291 +#define VLYNQ_R_INT_PEND_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_INT_PEND_OFFSET))
8292 +#define VLYNQ_R_INT_PTR_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_INT_PTR_OFFSET))
8293 +#define VLYNQ_R_TXMAP_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_TXMAP_OFFSET))
8295 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8296 +#define VLYNQ_R_RXMAP_SIZE_REG(map) \
8297 + *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_SIZE_REG_OFFSET + ((map-1)<<3)))
8299 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8300 +#define VLYNQ_R_RXMAP_OFFSET_REG(map) \
8301 + *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET + ((map-1)<<3)))
8303 +#define VLYNQ_R_CHIP_VER_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_CHIP_VER_OFFSET)
8305 +#define VLYNQ_R_IVR_OFFSET(ivr) \
8306 + (VLYNQ_BASE + VLYNQ_R_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3))
8309 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
8310 +#define VLYNQ_R_IVR_03TO00_REG *((volatile unsigned int*) (VLYNQ_R_IVR_OFFSET(0)) )
8311 +#define VLYNQ_R_IVR_07TO04_REG *((volatile unsigned int*) (VLYNQ_R_IVR_OFFSET(4)) )
8314 +/****End of remote register set definition******/
8317 +/*** Masks for individual register fields ***/
8319 +#define VLYNQ_MODULE_ID_MASK 0xffff0000
8320 +#define VLYNQ_MAJOR_REV_MASK 0x0000ff00
8321 +#define VLYNQ_MINOR_REV_MASK 0x000000ff
8324 +#define VLYNQ_CTL_ILOOP_MASK 0x00000002
8325 +#define VLYNQ_CTL_INT2CFG_MASK 0x00000080
8326 +#define VLYNQ_CTL_INTVEC_MASK 0x00001f00
8327 +#define VLYNQ_CTL_INTEN_MASK 0x00002000
8328 +#define VLYNQ_CTL_INTLOCAL_MASK 0x00004000
8329 +#define VLYNQ_CTL_CLKDIR_MASK 0x00008000
8330 +#define VLYNQ_CTL_CLKDIV_MASK 0x00070000
8331 +#define VLYNQ_CTL_MODE_MASK 0x00e00000
8334 +#define VLYNQ_STS_LINK_MASK 0x00000001 /* Link is active */
8335 +#define VLYNQ_STS_MPEND_MASK 0x00000002 /* Pending master requests */
8336 +#define VLYNQ_STS_SPEND_MASK 0x00000004 /* Pending slave requests */
8337 +#define VLYNQ_STS_NFEMPTY0_MASK 0x00000008 /* Master data FIFO not empty */
8338 +#define VLYNQ_STS_NFEMPTY1_MASK 0x00000010 /* Master command FIFO not empty */
8339 +#define VLYNQ_STS_NFEMPTY2_MASK 0x00000020 /* Slave data FIFO not empty */
8340 +#define VLYNQ_STS_NFEMPTY3_MASK 0x00000040 /* Slave command FIFO not empty */
8341 +#define VLYNQ_STS_LERROR_MASK 0x00000080 /* Local error, w/c */
8342 +#define VLYNQ_STS_RERROR_MASK 0x00000100 /* remote error w/c */
8343 +#define VLYNQ_STS_OFLOW_MASK 0x00000200
8344 +#define VLYNQ_STS_IFLOW_MASK 0x00000400
8345 +#define VLYNQ_STS_MODESUP_MASK 0x00E00000 /* Highest mode supported */
8346 +#define VLYNQ_STS_SWIDTH_MASK 0x07000000 /* Used for reading the width of VLYNQ bus */
8347 +#define VLYNQ_STS_DEBUG_MASK 0xE0000000
8349 +#define VLYNQ_CTL_INTVEC_SHIFT 0x08
8350 +#define VLYNQ_CTL_INTEN_SHIFT 0x0D
8351 +#define VLYNQ_CTL_INT2CFG_SHIFT 0x07
8352 +#define VLYNQ_CTL_INTLOCAL_SHIFT 0x0E
8354 +#define VLYNQ_CTL_INTFIELDS_CLEAR_MASK 0x7F80
8356 +#define VLYNQ_CHIPVER_DEVREV_MASK 0xffff0000
8357 +#define VLYNQ_CHIPVER_DEVID_MASK 0x0000ffff
8359 +#define VLYNQ_IVR_INTEN_MASK 0x80
8360 +#define VLYNQ_IVR_INTTYPE_MASK 0x40
8361 +#define VLYNQ_IVR_INTPOL_MASK 0x20
8364 +/**** Helper macros ****/
8366 +#define VLYNQ_RESETCB(arg) \
8367 + if( pdev->reset_cb != NULL) \
8369 + (pdev->reset_cb)(pdev, (arg)); \
8372 +#define VLYNQ_STATUS_FLD_WIDTH(sts) (((sts) & VLYNQ_STS_SWIDTH_MASK) >> 24 )
8373 +#define VLYNQ_CTL_INTVEC(x) (((x) & 31) << 8 )
8375 +#define VLYNQ_INRANGE(x,hi,lo) (((x) <= (hi)) && ((x) >= (lo)))
8376 +#define VLYNQ_OUTRANGE(x,hi,lo) (((x) > (hi)) || ((x) < (lo)))
8378 +#define VLYNQ_ALIGN4(x) (x)=(x)&(~3)
8381 +/*************************************
8383 + *************************************/
8385 +/* Initialization options define what operations are
8386 + * undertaken during vlynq module initialization */
8389 + /* Init host local memory regions.This allows
8390 + * local host access remote memory regions */
8391 + VLYNQ_INIT_LOCAL_MEM_REGIONS = 0x01,
8392 + /* Init host remote memory regions.This allows
8393 + * remote device access local memory regions */
8394 + VLYNQ_INIT_REMOTE_MEM_REGIONS =0x02,
8395 + /* Init local interrupt config*/
8396 + VLYNQ_INIT_LOCAL_INTERRUPTS =0x04,
8397 + /* Init remote interrupt config*/
8398 + VLYNQ_INIT_REMOTE_INTERRUPTS =0x08,
8399 + /* Check link during initialization*/
8400 + VLYNQ_INIT_CHECK_LINK =0x10,
8401 + /* configure clock during init */
8402 + VLYNQ_INIT_CONFIG_CLOCK =0x20,
8403 + /* Clear errors during init */
8404 + VLYNQ_INIT_CLEAR_ERRORS =0x40,
8406 + VLYNQ_INIT_PERFORM_ALL =0x7F
8407 +}VLYNQ_INIT_OPTIONS;
8410 +/* VLYNQ_DEV_TYPE identifies local or remote device */
8413 + VLYNQ_LOCAL_DVC = 0, /* vlynq local device (SOC's vlynq module) */
8414 + VLYNQ_REMOTE_DVC = 1 /* vlynq remote device (remote vlynq module) */
8418 +/* VLYNQ_CLK_SOURCE identifies the vlynq module clock source */
8421 + VLYNQ_CLK_SOURCE_NONE = 0, /* do not initialize clock generator*/
8422 + VLYNQ_CLK_SOURCE_LOCAL = 1, /* clock is generated by local machine */
8423 + VLYNQ_CLK_SOURCE_REMOTE = 2 /* clock is generated by remote machine */
8427 +/* VLYNQ_DRV_STATE indicates the current driver state */
8430 + VLYNQ_DRV_STATE_UNINIT = 0, /* driver is uninitialized */
8431 + VLYNQ_DRV_STATE_ININIT = 1, /* VLYNQ is being initialized */
8432 + VLYNQ_DRV_STATE_RUN = 2, /* VLYNQ is running properly */
8433 + VLYNQ_DRV_STATE_HOLD = 3, /* driver stopped temporarily */
8434 + VLYNQ_DRV_STATE_ERROR = 4 /* driver stopped on unrecoverable error */
8438 +/* VLYNQ_BUS_WIDTH identifies the vlynq module bus width */
8441 + VLYNQ_BUS_WIDTH_3 = 3,
8442 + VLYNQ_BUS_WIDTH_5 = 5,
8443 + VLYNQ_BUS_WIDTH_7 = 7,
8444 + VLYNQ_BUS_WIDTH_9 = 9
8448 +/* VLYNQ_LOCAL_INT_CONFIG indicates whether the local vlynq
8449 + * interrupts are processed by the host or passed on to the
8454 + VLYNQ_INT_REMOTE = 0, /* Interrupt packets sent to remote, intlocal=0 */
8455 + VLYNQ_INT_LOCAL = 1 /* Interrupts are handled locally, intlocal=1 */
8456 +}VLYNQ_LOCAL_INT_CONFIG;
8459 +/* VLYNQ_REMOTE_INT_CONFIG indicates whether the remote
8460 + * interrupts are to be handled by the SOC system ISR
8461 + * or via the vlynq root ISR
8465 + VLYNQ_INT_ROOT_ISR = 0, /* remote ints handled via vlynq root ISR */
8466 + VLYNQ_INT_SYSTEM_ISR = 1 /* remote ints handled via system ISR */
8467 +}VLYNQ_REMOTE_INT_CONFIG;
8470 +/* VLYNQ_INTR_POLARITY - vlynq interrupt polarity setting */
8473 + VLYNQ_INTR_ACTIVE_HIGH = 0,
8474 + VLYNQ_INTR_ACTIVE_LOW = 1
8475 +}VLYNQ_INTR_POLARITY;
8478 +/* VLYNQ_INTR_TYPE - vlynq interrupt type */
8481 + VLYNQ_INTR_LEVEL = 0,
8482 + VLYNQ_INTR_PULSED = 1
8486 +/* VLYNQ_RESET_MODE - vlynq reset mode */
8489 + VLYNQ_RESET_ASSERT, /* hold device in reset state */
8490 + VLYNQ_RESET_DEASSERT, /* release device from reset state */
8491 + VLYNQ_RESET_INITFAIL, /* handle the device in case driver initialization fails */
8492 + VLYNQ_RESET_LINKESTABLISH, /* handle the device in case driver established link */
8493 + VLYNQ_RESET_INITFAIL2, /* Driver initialization failed but VLYNQ link exist. */
8494 + VLYNQ_RESET_INITOK /* Driver initialization finished OK. */
8499 +/*************************************
8501 + *************************************/
8503 +struct VLYNQ_DEV_t; /*forward declaration*/
8505 +/*--------Function Pointers defintions -----------*/
8507 +/* prototype for interrupt handler definition */
8508 +typedef void (*VLYNQ_INTR_CNTRL_ISR)(void *arg1,void *arg2,void *arg3);
8511 +(*VLYNQ_RESET_REMOTE)(struct VLYNQ_DEV_t *pDev, VLYNQ_RESET_MODE mode);
8514 +(*VLYNQ_REPORT_CB)( struct VLYNQ_DEV_t *pDev, /* This VLYNQ */
8515 + VLYNQ_DEV_TYPE aSrcDvc, /* Event Cause -local/remote? */
8516 + unsigned int dwStatRegVal); /* Value of the relevant status register */
8519 +/*-------Structure Definitions------------*/
8521 +typedef struct VLYNQ_MEMORY_MAP_t
8523 + unsigned int Txmap;
8524 + unsigned int RxOffset[VLYNQ_MAX_MEMORY_REGIONS];
8525 + unsigned int RxSize[VLYNQ_MAX_MEMORY_REGIONS];
8529 +/**VLYNQ_INTERRUPT_CNTRL - defines the vlynq module interrupt
8530 + * settings in vlynq Control register */
8531 +typedef struct VLYNQ_INTERRUPT_CNTRL_t
8533 + /* vlynq interrupts handled by host or remote - maps to
8534 + * intLocal bit in vlynq control register */
8535 + VLYNQ_LOCAL_INT_CONFIG intLocal;
8537 + /* remote interrupts handled by vlynq isr or host system
8538 + * interrupt controller - maps to the int2Cfg in vlynq
8539 + * control register */
8540 + VLYNQ_REMOTE_INT_CONFIG intRemote;
8542 + /* bit in pending/set register used for module interrupts*/
8543 + unsigned int map_vector;
8545 + /* used only if remote interrupts are to be handled by system ISR*/
8546 + unsigned int intr_ptr;
8548 +}VLYNQ_INTERRUPT_CNTRL;
8551 +/* VLYNQ_INTR_CNTRL_ICB - defines the Interrupt control block which hold
8552 + * the interrupt dispatch table. The vlynq_root_isr() indexes into this
8553 + * table to identify the ISR to be invoked
8555 +typedef struct VLYNQ_INTR_CNTRL_ICB_t
8557 + VLYNQ_INTR_CNTRL_ISR isr; /* Clear errors during initialization */
8558 + void *arg1 ; /* Arg 1 for the ISR */
8559 + void *arg2 ; /* Arg 2 for the ISR */
8560 + void *arg3 ; /* Arg 3 for the ISR */
8561 + unsigned int isrCount; /* number of ISR invocations so far */
8562 + struct VLYNQ_INTR_CNTRL_ICB_t *next;
8563 +}VLYNQ_INTR_CNTRL_ICB;
8565 +/* overlay of vlynq register set */
8566 +typedef struct VLYNQ_REG_SET_t
8568 + unsigned int revision; /*offset : 0x00 */
8569 + unsigned int control; /* 0x04*/
8570 + unsigned int status; /* 0x08*/
8571 + unsigned int pad1; /* 0x0c*/
8572 + unsigned int intStatus; /*0x10*/
8573 + unsigned int intPending; /*0x14*/
8574 + unsigned int intPtr; /*0x18*/
8575 + unsigned int txMap; /*0x1C*/
8576 + unsigned int rxSize1; /*0x20*/
8577 + unsigned int rxOffset1; /*0x24*/
8578 + unsigned int rxSize2; /*0x28*/
8579 + unsigned int rxOffset2; /*0x2C*/
8580 + unsigned int rxSize3; /*0x30*/
8581 + unsigned int rxOffset3; /*0x34*/
8582 + unsigned int rxSize4; /*0x38*/
8583 + unsigned int rxOffset4; /*0x3C*/
8584 + unsigned int chipVersion; /*0x40*/
8585 + unsigned int pad2[8];
8586 + unsigned int ivr30; /*0x60*/
8587 + unsigned int ivr74; /*0x64*/
8588 + unsigned int pad3[7];
8592 +typedef struct VLYNQ_DEV_t
8594 + /** module index:1,2,3... used for debugging purposes */
8595 + unsigned int dev_idx;
8597 + /*VLYNQ module base address */
8598 + unsigned int module_base;
8600 + /* clock source selection */
8601 + VLYNQ_CLK_SOURCE clk_source;
8603 + /* Clock Divider.Val=1 to 8. VLYNQ_clk = VBUSCLK/clk_div */
8604 + unsigned int clk_div;
8606 + /* State of the VLYNQ driver, set to VLYNQ_DRV_STATE_UNINIT, when initializing */
8607 + VLYNQ_DRV_STATE state;
8609 + /* Valid VLYNQ bus width, filled by driver */
8610 + VLYNQ_BUS_WIDTH width;
8612 + /* local memory mapping */
8613 + VLYNQ_MEMORY_MAP local_mem;
8615 + /* remote memory mapping */
8616 + VLYNQ_MEMORY_MAP remote_mem;
8618 + /* Local module interrupt params */
8619 + VLYNQ_INTERRUPT_CNTRL local_irq;
8621 + /* remote module interrupt params */
8622 + VLYNQ_INTERRUPT_CNTRL remote_irq;
8624 + /*** ICB related fields **/
8626 + /* Sizeof of ICB = VLYNQ_NUM_INT_BITS(for 32 bits in IntPending) +
8627 + * expansion slots for shared interrupts*/
8628 + VLYNQ_INTR_CNTRL_ICB pIntrCB[VLYNQ_NUM_INT_BITS + VLYNQ_IVR_CHAIN_SLOTS];
8629 + VLYNQ_INTR_CNTRL_ICB *freelist;
8631 + /* table holding mapping between intVector and the bit position the interrupt
8632 + * is mapped to(mapVector)*/
8633 + char vector_map[32];
8635 + /* user callback for vlynq events, NULL if unused */
8636 + VLYNQ_REPORT_CB report_cb;
8638 + /* user callback for resetting/realeasing remote device */
8639 + VLYNQ_RESET_REMOTE reset_cb;
8641 + /*** Handles provided for direct access to register set if need be
8642 + * Must be intialized to point to appropriate address during
8644 + volatile VLYNQ_REG_SET * local;
8645 + volatile VLYNQ_REG_SET * remote;
8647 + unsigned int intCount; /* number of interrupts generated so far */
8648 + unsigned int isrCount; /* number of ISR invocations so far */
8652 +typedef struct VLYNQ_ISR_ARGS_t
8660 +/****************************************
8661 + * Function Prototypes *
8662 + * API exported by generic vlynq driver *
8663 + ****************************************/
8664 +/* Initialization function */
8665 +int vlynq_init( VLYNQ_DEV *pdev, VLYNQ_INIT_OPTIONS options);
8667 +/* Check vlynq link */
8668 +unsigned int vlynq_link_check( VLYNQ_DEV * pdev);
8670 +/* Set interrupt vector in local or remote device */
8671 +int vlynq_interrupt_vector_set( VLYNQ_DEV *pdev,
8672 + unsigned int int_vector,
8673 + unsigned int map_vector,
8674 + VLYNQ_DEV_TYPE dev,
8675 + VLYNQ_INTR_POLARITY pol,
8676 + VLYNQ_INTR_TYPE type);
8679 +int vlynq_interrupt_vector_cntl( VLYNQ_DEV *pdev,
8680 + unsigned int int_vector,
8681 + VLYNQ_DEV_TYPE dev,
8682 + unsigned int enable);
8684 +unsigned int vlynq_interrupt_get_count( VLYNQ_DEV *pdev,
8685 + unsigned int map_vector);
8687 +int vlynq_install_isr( VLYNQ_DEV *pdev,
8688 + unsigned int map_vector,
8689 + VLYNQ_INTR_CNTRL_ISR isr,
8690 + void *arg1, void *arg2, void *arg3);
8692 +int vlynq_uninstall_isr( VLYNQ_DEV *pdev,
8693 + unsigned int map_vector,
8694 + void *arg1, void *arg2, void *arg3);
8697 +void vlynq_root_isr(void *arg);
8699 +void vlynq_delay(unsigned int clktime);
8701 +/* The following functions, provide better granularity in setting
8702 + * interrupt parameters. (for better support of linux INT Controller)
8703 + * Note: The interrupt source is identified by "map_vector"- the bit
8704 + * position in interrupt status register*/
8706 +int vlynq_interrupt_vector_map(VLYNQ_DEV * pdev,
8707 + VLYNQ_DEV_TYPE dev,
8708 + unsigned int int_vector,
8709 + unsigned int map_vector);
8711 +int vlynq_interrupt_set_polarity(VLYNQ_DEV * pdev,
8712 + VLYNQ_DEV_TYPE dev,
8713 + unsigned int map_vector,
8714 + VLYNQ_INTR_POLARITY pol);
8716 +int vlynq_interrupt_get_polarity( VLYNQ_DEV *pdev ,
8717 + VLYNQ_DEV_TYPE dev_type,
8718 + unsigned int map_vector);
8720 +int vlynq_interrupt_set_type(VLYNQ_DEV * pdev,
8721 + VLYNQ_DEV_TYPE dev,
8722 + unsigned int map_vector,
8723 + VLYNQ_INTR_TYPE type);
8725 +int vlynq_interrupt_get_type( VLYNQ_DEV *pdev,
8726 + VLYNQ_DEV_TYPE dev_type,
8727 + unsigned int map_vector);
8729 +int vlynq_interrupt_enable(VLYNQ_DEV* pdev,
8730 + VLYNQ_DEV_TYPE dev,
8731 + unsigned int map_vector);
8733 +int vlynq_interrupt_disable(VLYNQ_DEV * pdev,
8734 + VLYNQ_DEV_TYPE dev,
8735 + unsigned int map_vector);
8741 +#endif /* _VLYNQ_HAL_H_ */
8742 diff -urN linux.old/include/asm-mips/ar7/vlynq_hal.h linux.dev/include/asm-mips/ar7/vlynq_hal.h
8743 --- linux.old/include/asm-mips/ar7/vlynq_hal.h 1970-01-01 01:00:00.000000000 +0100
8744 +++ linux.dev/include/asm-mips/ar7/vlynq_hal.h 2005-11-10 01:10:46.095590250 +0100
8746 +/***************************************************************************
8747 +**+----------------------------------------------------------------------+**
8751 +**| ********_///_**** |**
8752 +**| ***** /_//_/ **** |**
8753 +**| ** ** (__/ **** |**
8758 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
8759 +**| ALL RIGHTS RESERVED |**
8761 +**| Permission is hereby granted to licensees of Texas Instruments |**
8762 +**| Incorporated (TI) products to use this computer program for the sole |**
8763 +**| purpose of implementing a licensee product based on TI products. |**
8764 +**| No other rights to reproduce, use, or disseminate this computer |**
8765 +**| program, whether in part or in whole, are granted. |**
8767 +**| TI makes no representation or warranties with respect to the |**
8768 +**| performance of this computer program, and specifically disclaims |**
8769 +**| any responsibility for any damages, special or consequential, |**
8770 +**| connected with the use of this program. |**
8772 +**+----------------------------------------------------------------------+**
8773 +***************************************************************************/
8775 +/*********************************************************************************
8776 + * ------------------------------------------------------------------------------
8777 + * Module : vlynq_hal.h
8779 + * This header file provides the set of functions exported by the
8780 + * VLYNQ HAL. This file is included from the SOC specific VLYNQ driver wrapper.
8781 + * ------------------------------------------------------------------------------
8782 + *********************************************************************************/
8784 +#ifndef _VLYNQ_HAL_H_
8785 +#define _VLYNQ_HAL_H_
8787 +#include <asm/ar7/avalanche_types.h>
8788 +#include <asm/ar7/vlynq_hal_params.h>
8791 +#define PRIVATE static
8798 +/* Enable/Disable debug feature */
8801 +#ifdef VLYNQ_DEBUG /* This needs to be OS abstracted - for testing use vxworks/linux calls */
8802 +#define debugPrint(format,args...)
8804 +#define debugPrint(format,args...)
8807 +/* Error defines */
8808 +#define VLYNQ_SUCCESS 0
8810 +#define VLYNQ_ERRCODE_BASE 0 /* Chosen by system */
8811 +#define VLYNQ_INVALID_ARG -(VLYNQ_ERRCODE_BASE+1)
8812 +#define VLYNQ_INVALID_DRV_STATE -(VLYNQ_ERRCODE_BASE+2)
8813 +#define VLYNQ_INT_CONFIG_ERR -(VLYNQ_ERRCODE_BASE+3)
8814 +#define VLYNQ_LINK_DOWN -(VLYNQ_ERRCODE_BASE+4)
8815 +#define VLYNQ_MEMALLOC_FAIL -(VLYNQ_ERRCODE_BASE+5)
8816 +#define VLYNQ_ISR_NON_EXISTENT -(VLYNQ_ERRCODE_BASE+6)
8817 +#define VLYNQ_INTVEC_MAP_NOT_FOUND -(VLYNQ_ERRCODE_BASE+7)
8819 +/* Vlynq Defines and Macros */
8821 +#define VLYNQ_NUM_INT_BITS 32 /* 32 bit interrupt staus register */
8823 +/* Base address of module */
8824 +#define VLYNQ_BASE (pdev->module_base)
8826 +#define VLYNQ_REMOTE_REGS_OFFSET 0x0080
8828 +#define VLYNQ_REV_OFFSET 0x0000
8829 +#define VLYNQ_CTRL_OFFSET 0x0004
8830 +#define VLYNQ_STATUS_OFFSET 0x0008
8831 +#define VLYNQ_INT_STAT_OFFSET 0x0010
8832 +#define VLYNQ_INT_PEND_OFFSET 0x0014
8833 +#define VLYNQ_INT_PTR_OFFSET 0x0018
8834 +#define VLYNQ_TXMAP_OFFSET 0x001c
8836 +#define VLYNQ_RX0MAP_SIZE_REG_OFFSET 0x0020
8837 +#define VLYNQ_RX0MAP_OFFSET_REG_OFFSET 0x0024
8839 +#define VLYNQ_CHIP_VER_OFFSET 0x0040
8840 +#define VLYNQ_IVR_REGS_OFFSET 0x0060
8842 +#define VLYNQ_INT_PENDING_REG_PTR 0x14
8843 +#define VLYNQ_R_INT_PENDING_REG_PTR VLYNQ_REMOTE_REGS_OFFSET + 0x14
8845 +#define VLYNQ_REV_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_REV_OFFSET))
8846 +#define VLYNQ_CTRL_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_CTRL_OFFSET))
8847 +#define VLYNQ_STATUS_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_STATUS_OFFSET))
8848 +#define VLYNQ_INT_STAT_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_INT_STAT_OFFSET))
8849 +#define VLYNQ_INT_PEND_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_INT_PEND_OFFSET))
8850 +#define VLYNQ_INT_PTR_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_INT_PTR_OFFSET))
8851 +#define VLYNQ_TXMAP_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_TXMAP_OFFSET))
8853 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8854 +#define VLYNQ_RXMAP_SIZE_REG(map) \
8855 + *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_RX0MAP_SIZE_REG_OFFSET+( (map-1)<<3)))
8857 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8858 +#define VLYNQ_RXMAP_OFFSET_REG(map) \
8859 + *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_RX0MAP_OFFSET_REG_OFFSET+( (map-1)<<3)))
8861 +#define VLYNQ_CHIP_VER_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_CHIP_VER_OFFSET))
8863 +/* 0 =< ivr <= 31; currently ivr < VLYNQ_IVR_MAXIVR=8) */
8864 +#define VLYNQ_IVR_OFFSET(ivr) \
8865 + (VLYNQ_BASE + VLYNQ_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3) )
8867 +#define VLYNQ_IVR_03TO00_REG *((volatile UINT32*) (VLYNQ_IVR_OFFSET(0)) )
8868 +#define VLYNQ_IVR_07TO04_REG *((volatile UINT32*) (VLYNQ_IVR_OFFSET(4)) )
8869 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
8871 +#define VLYNQ_IVR_INTEN(ivr) (((UINT32)(0x80)) << ((((unsigned)(ivr)) % 4) * 8))
8872 +#define VLYNQ_IVR_INTTYPE(ivr) (((UINT32)(0x40)) << ((((unsigned)(ivr)) % 4) * 8))
8873 +#define VLYNQ_IVR_INTPOL(ivr) (((UINT32)(0x20)) << ((((unsigned)(ivr)) % 4) * 8))
8874 +#define VLYNQ_IVR_INTVEC(ivr) (((UINT32)(0x1F)) << ((((unsigned)(ivr)) % 4) * 8))
8875 +#define VLYNQ_IVR_INTALL(ivr) (((UINT32)(0xFF)) << ((((unsigned)(ivr)) % 4) * 8))
8879 +/*********************************
8880 + * Remote VLYNQ register set *
8881 + *********************************/
8883 +#define VLYNQ_R_REV_OFFSET 0x0080
8884 +#define VLYNQ_R_CTRL_OFFSET 0x0084
8885 +#define VLYNQ_R_STATUS_OFFSET 0x0088
8886 +#define VLYNQ_R_INT_STAT_OFFSET 0x0090
8887 +#define VLYNQ_R_INT_PEND_OFFSET 0x0094
8888 +#define VLYNQ_R_INT_PTR_OFFSET 0x0098
8889 +#define VLYNQ_R_TXMAP_OFFSET 0x009c
8891 +#define VLYNQ_R_RX0MAP_SIZE_REG_OFFSET 0x00A0
8892 +#define VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET 0x00A4
8894 +#define VLYNQ_R_CHIP_VER_OFFSET 0x00C0
8895 +#define VLYNQ_R_IVR_REGS_OFFSET 0x00E0
8897 +#define VLYNQ_R_REV_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_REV_OFFSET))
8898 +#define VLYNQ_R_CTRL_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_CTRL_OFFSET))
8899 +#define VLYNQ_R_STATUS_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_STATUS_OFFSET))
8900 +#define VLYNQ_R_INT_STAT_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_INT_STAT_OFFSET))
8901 +#define VLYNQ_R_INT_PEND_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_INT_PEND_OFFSET))
8902 +#define VLYNQ_R_INT_PTR_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_INT_PTR_OFFSET))
8903 +#define VLYNQ_R_TXMAP_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_TXMAP_OFFSET))
8905 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8906 +#define VLYNQ_R_RXMAP_SIZE_REG(map) \
8907 + *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_SIZE_REG_OFFSET + ((map-1)<<3)))
8909 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
8910 +#define VLYNQ_R_RXMAP_OFFSET_REG(map) \
8911 + *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET + ((map-1)<<3)))
8913 +#define VLYNQ_R_CHIP_VER_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_CHIP_VER_OFFSET)
8915 +#define VLYNQ_R_IVR_OFFSET(ivr) \
8916 + (VLYNQ_BASE + VLYNQ_R_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3))
8919 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
8920 +#define VLYNQ_R_IVR_03TO00_REG *((volatile UINT32*) (VLYNQ_R_IVR_OFFSET(0)) )
8921 +#define VLYNQ_R_IVR_07TO04_REG *((volatile UINT32*) (VLYNQ_R_IVR_OFFSET(4)) )
8924 +/****End of remote register set definition******/
8927 +/*** Masks for individual register fields ***/
8929 +#define VLYNQ_MODULE_ID_MASK 0xffff0000
8930 +#define VLYNQ_MAJOR_REV_MASK 0x0000ff00
8931 +#define VLYNQ_MINOR_REV_MASK 0x000000ff
8934 +#define VLYNQ_CTL_ILOOP_MASK 0x00000002
8935 +#define VLYNQ_CTL_INT2CFG_MASK 0x00000080
8936 +#define VLYNQ_CTL_INTVEC_MASK 0x00001f00
8937 +#define VLYNQ_CTL_INTEN_MASK 0x00002000
8938 +#define VLYNQ_CTL_INTLOCAL_MASK 0x00004000
8939 +#define VLYNQ_CTL_CLKDIR_MASK 0x00008000
8940 +#define VLYNQ_CTL_CLKDIV_MASK 0x00070000
8941 +#define VLYNQ_CTL_MODE_MASK 0x00e00000
8944 +#define VLYNQ_STS_LINK_MASK 0x00000001 /* Link is active */
8945 +#define VLYNQ_STS_MPEND_MASK 0x00000002 /* Pending master requests */
8946 +#define VLYNQ_STS_SPEND_MASK 0x00000004 /* Pending slave requests */
8947 +#define VLYNQ_STS_NFEMPTY0_MASK 0x00000008 /* Master data FIFO not empty */
8948 +#define VLYNQ_STS_NFEMPTY1_MASK 0x00000010 /* Master command FIFO not empty */
8949 +#define VLYNQ_STS_NFEMPTY2_MASK 0x00000020 /* Slave data FIFO not empty */
8950 +#define VLYNQ_STS_NFEMPTY3_MASK 0x00000040 /* Slave command FIFO not empty */
8951 +#define VLYNQ_STS_LERROR_MASK 0x00000080 /* Local error, w/c */
8952 +#define VLYNQ_STS_RERROR_MASK 0x00000100 /* remote error w/c */
8953 +#define VLYNQ_STS_OFLOW_MASK 0x00000200
8954 +#define VLYNQ_STS_IFLOW_MASK 0x00000400
8955 +#define VLYNQ_STS_MODESUP_MASK 0x00E00000 /* Highest mode supported */
8956 +#define VLYNQ_STS_SWIDTH_MASK 0x07000000 /* Used for reading the width of VLYNQ bus */
8957 +#define VLYNQ_STS_DEBUG_MASK 0xE0000000
8959 +#define VLYNQ_CTL_INTVEC_SHIFT 0x08
8960 +#define VLYNQ_CTL_INTEN_SHIFT 0x0D
8961 +#define VLYNQ_CTL_INT2CFG_SHIFT 0x07
8962 +#define VLYNQ_CTL_INTLOCAL_SHIFT 0x0E
8964 +#define VLYNQ_CTL_INTFIELDS_CLEAR_MASK 0x7F80
8966 +#define VLYNQ_CHIPVER_DEVREV_MASK 0xffff0000
8967 +#define VLYNQ_CHIPVER_DEVID_MASK 0x0000ffff
8969 +#define VLYNQ_IVR_INTEN_MASK 0x80
8970 +#define VLYNQ_IVR_INTTYPE_MASK 0x40
8971 +#define VLYNQ_IVR_INTPOL_MASK 0x20
8974 +/**** Helper macros ****/
8976 +#define VLYNQ_RESETCB(arg) \
8977 + if( pdev->reset_cb != NULL) \
8979 + (pdev->reset_cb)(pdev, (arg)); \
8982 +#define VLYNQ_STATUS_FLD_WIDTH(sts) (((sts) & VLYNQ_STS_SWIDTH_MASK) >> 24 )
8983 +#define VLYNQ_CTL_INTVEC(x) (((x) & 31) << 8 )
8985 +#define VLYNQ_INRANGE(x,hi,lo) (((x) <= (hi)) && ((x) >= (lo)))
8986 +#define VLYNQ_OUTRANGE(x,hi,lo) (((x) > (hi)) || ((x) < (lo)))
8988 +#define VLYNQ_ALIGN4(x) (x)=(x)&(~3)
8991 +/*************************************
8993 + *************************************/
8995 +/* Initialization options define what operations are
8996 + * undertaken during vlynq module initialization */
8999 + /* Init host local memory regions.This allows
9000 + * local host access remote memory regions */
9001 + VLYNQ_INIT_LOCAL_MEM_REGIONS = 0x01,
9002 + /* Init host remote memory regions.This allows
9003 + * remote device access local memory regions */
9004 + VLYNQ_INIT_REMOTE_MEM_REGIONS =0x02,
9005 + /* Init local interrupt config*/
9006 + VLYNQ_INIT_LOCAL_INTERRUPTS =0x04,
9007 + /* Init remote interrupt config*/
9008 + VLYNQ_INIT_REMOTE_INTERRUPTS =0x08,
9009 + /* Check link during initialization*/
9010 + VLYNQ_INIT_CHECK_LINK =0x10,
9011 + /* configure clock during init */
9012 + VLYNQ_INIT_CONFIG_CLOCK =0x20,
9013 + /* Clear errors during init */
9014 + VLYNQ_INIT_CLEAR_ERRORS =0x40,
9016 + VLYNQ_INIT_PERFORM_ALL =0x7F
9017 +}VLYNQ_INIT_OPTIONS;
9020 +/* VLYNQ_DEV_TYPE identifies local or remote device */
9023 + VLYNQ_LOCAL_DVC = 0, /* vlynq local device (SOC's vlynq module) */
9024 + VLYNQ_REMOTE_DVC = 1 /* vlynq remote device (remote vlynq module) */
9028 +/* VLYNQ_CLK_SOURCE identifies the vlynq module clock source */
9031 + VLYNQ_CLK_SOURCE_NONE = 0, /* do not initialize clock generator*/
9032 + VLYNQ_CLK_SOURCE_LOCAL = 1, /* clock is generated by local machine */
9033 + VLYNQ_CLK_SOURCE_REMOTE = 2 /* clock is generated by remote machine */
9037 +/* VLYNQ_DRV_STATE indicates the current driver state */
9040 + VLYNQ_DRV_STATE_UNINIT = 0, /* driver is uninitialized */
9041 + VLYNQ_DRV_STATE_ININIT = 1, /* VLYNQ is being initialized */
9042 + VLYNQ_DRV_STATE_RUN = 2, /* VLYNQ is running properly */
9043 + VLYNQ_DRV_STATE_HOLD = 3, /* driver stopped temporarily */
9044 + VLYNQ_DRV_STATE_ERROR = 4 /* driver stopped on unrecoverable error */
9048 +/* VLYNQ_BUS_WIDTH identifies the vlynq module bus width */
9051 + VLYNQ_BUS_WIDTH_3 = 3,
9052 + VLYNQ_BUS_WIDTH_5 = 5,
9053 + VLYNQ_BUS_WIDTH_7 = 7,
9054 + VLYNQ_BUS_WIDTH_9 = 9
9058 +/* VLYNQ_LOCAL_INT_CONFIG indicates whether the local vlynq
9059 + * interrupts are processed by the host or passed on to the
9064 + VLYNQ_INT_REMOTE = 0, /* Interrupt packets sent to remote, intlocal=0 */
9065 + VLYNQ_INT_LOCAL = 1 /* Interrupts are handled locally, intlocal=1 */
9066 +}VLYNQ_LOCAL_INT_CONFIG;
9069 +/* VLYNQ_REMOTE_INT_CONFIG indicates whether the remote
9070 + * interrupts are to be handled by the SOC system ISR
9071 + * or via the vlynq root ISR
9075 + VLYNQ_INT_ROOT_ISR = 0, /* remote ints handled via vlynq root ISR */
9076 + VLYNQ_INT_SYSTEM_ISR = 1 /* remote ints handled via system ISR */
9077 +}VLYNQ_REMOTE_INT_CONFIG;
9080 +/* VLYNQ_INTR_POLARITY - vlynq interrupt polarity setting */
9083 + VLYNQ_INTR_ACTIVE_HIGH = 0,
9084 + VLYNQ_INTR_ACTIVE_LOW = 1
9085 +}VLYNQ_INTR_POLARITY;
9088 +/* VLYNQ_INTR_TYPE - vlynq interrupt type */
9091 + VLYNQ_INTR_LEVEL = 0,
9092 + VLYNQ_INTR_PULSED = 1
9096 +/* VLYNQ_RESET_MODE - vlynq reset mode */
9099 + VLYNQ_RESET_ASSERT, /* hold device in reset state */
9100 + VLYNQ_RESET_DEASSERT, /* release device from reset state */
9101 + VLYNQ_RESET_INITFAIL, /* handle the device in case driver initialization fails */
9102 + VLYNQ_RESET_LINKESTABLISH, /* handle the device in case driver established link */
9103 + VLYNQ_RESET_INITFAIL2, /* Driver initialization failed but VLYNQ link exist. */
9104 + VLYNQ_RESET_INITOK /* Driver initialization finished OK. */
9109 +/*************************************
9111 + *************************************/
9113 +struct VLYNQ_DEV_t; /*forward declaration*/
9115 +/*--------Function Pointers defintions -----------*/
9117 +/* prototype for interrupt handler definition */
9118 +typedef void (*VLYNQ_INTR_CNTRL_ISR)(void *arg1,void *arg2,void *arg3);
9121 +(*VLYNQ_RESET_REMOTE)(struct VLYNQ_DEV_t *pDev, VLYNQ_RESET_MODE mode);
9124 +(*VLYNQ_REPORT_CB)( struct VLYNQ_DEV_t *pDev, /* This VLYNQ */
9125 + VLYNQ_DEV_TYPE aSrcDvc, /* Event Cause -local/remote? */
9126 + UINT32 dwStatRegVal); /* Value of the relevant status register */
9129 +/*-------Structure Definitions------------*/
9131 +typedef struct VLYNQ_MEMORY_MAP_t
9134 + UINT32 RxOffset[VLYNQ_MAX_MEMORY_REGIONS];
9135 + UINT32 RxSize[VLYNQ_MAX_MEMORY_REGIONS];
9139 +/**VLYNQ_INTERRUPT_CNTRL - defines the vlynq module interrupt
9140 + * settings in vlynq Control register */
9141 +typedef struct VLYNQ_INTERRUPT_CNTRL_t
9143 + /* vlynq interrupts handled by host or remote - maps to
9144 + * intLocal bit in vlynq control register */
9145 + VLYNQ_LOCAL_INT_CONFIG intLocal;
9147 + /* remote interrupts handled by vlynq isr or host system
9148 + * interrupt controller - maps to the int2Cfg in vlynq
9149 + * control register */
9150 + VLYNQ_REMOTE_INT_CONFIG intRemote;
9152 + /* bit in pending/set register used for module interrupts*/
9153 + UINT32 map_vector;
9155 + /* used only if remote interrupts are to be handled by system ISR*/
9158 +}VLYNQ_INTERRUPT_CNTRL;
9161 +/* VLYNQ_INTR_CNTRL_ICB - defines the Interrupt control block which hold
9162 + * the interrupt dispatch table. The vlynq_root_isr() indexes into this
9163 + * table to identify the ISR to be invoked
9165 +typedef struct VLYNQ_INTR_CNTRL_ICB_t
9167 + VLYNQ_INTR_CNTRL_ISR isr; /* Clear errors during initialization */
9168 + void *arg1 ; /* Arg 1 for the ISR */
9169 + void *arg2 ; /* Arg 2 for the ISR */
9170 + void *arg3 ; /* Arg 3 for the ISR */
9171 + UINT32 isrCount; /* number of ISR invocations so far */
9172 + struct VLYNQ_INTR_CNTRL_ICB_t *next;
9173 +}VLYNQ_INTR_CNTRL_ICB;
9175 +/* overlay of vlynq register set */
9176 +typedef struct VLYNQ_REG_SET_t
9178 + UINT32 revision; /*offset : 0x00 */
9179 + UINT32 control; /* 0x04*/
9180 + UINT32 status; /* 0x08*/
9181 + UINT32 pad1; /* 0x0c*/
9182 + UINT32 intStatus; /*0x10*/
9183 + UINT32 intPending; /*0x14*/
9184 + UINT32 intPtr; /*0x18*/
9185 + UINT32 txMap; /*0x1C*/
9186 + UINT32 rxSize1; /*0x20*/
9187 + UINT32 rxOffset1; /*0x24*/
9188 + UINT32 rxSize2; /*0x28*/
9189 + UINT32 rxOffset2; /*0x2C*/
9190 + UINT32 rxSize3; /*0x30*/
9191 + UINT32 rxOffset3; /*0x34*/
9192 + UINT32 rxSize4; /*0x38*/
9193 + UINT32 rxOffset4; /*0x3C*/
9194 + UINT32 chipVersion; /*0x40*/
9196 + UINT32 ivr30; /*0x60*/
9197 + UINT32 ivr74; /*0x64*/
9202 +typedef struct VLYNQ_DEV_t
9204 + /** module index:1,2,3... used for debugging purposes */
9207 + /*VLYNQ module base address */
9208 + UINT32 module_base;
9210 + /* clock source selection */
9211 + VLYNQ_CLK_SOURCE clk_source;
9213 + /* Clock Divider.Val=1 to 8. VLYNQ_clk = VBUSCLK/clk_div */
9216 + /* State of the VLYNQ driver, set to VLYNQ_DRV_STATE_UNINIT, when initializing */
9217 + VLYNQ_DRV_STATE state;
9219 + /* Valid VLYNQ bus width, filled by driver */
9220 + VLYNQ_BUS_WIDTH width;
9222 + /* local memory mapping */
9223 + VLYNQ_MEMORY_MAP local_mem;
9225 + /* remote memory mapping */
9226 + VLYNQ_MEMORY_MAP remote_mem;
9228 + /* Local module interrupt params */
9229 + VLYNQ_INTERRUPT_CNTRL local_irq;
9231 + /* remote module interrupt params */
9232 + VLYNQ_INTERRUPT_CNTRL remote_irq;
9234 + /*** ICB related fields **/
9236 + /* Sizeof of ICB = VLYNQ_NUM_INT_BITS(for 32 bits in IntPending) +
9237 + * expansion slots for shared interrupts*/
9238 + VLYNQ_INTR_CNTRL_ICB pIntrCB[VLYNQ_NUM_INT_BITS + VLYNQ_IVR_CHAIN_SLOTS];
9239 + VLYNQ_INTR_CNTRL_ICB *freelist;
9241 + /* table holding mapping between intVector and the bit position the interrupt
9242 + * is mapped to(mapVector)*/
9243 + INT8 vector_map[32];
9245 + /* user callback for vlynq events, NULL if unused */
9246 + VLYNQ_REPORT_CB report_cb;
9248 + /* user callback for resetting/realeasing remote device */
9249 + VLYNQ_RESET_REMOTE reset_cb;
9251 + /*** Handles provided for direct access to register set if need be
9252 + * Must be intialized to point to appropriate address during
9254 + volatile VLYNQ_REG_SET * local;
9255 + volatile VLYNQ_REG_SET * remote;
9257 + UINT32 intCount; /* number of interrupts generated so far */
9258 + UINT32 isrCount; /* number of ISR invocations so far */
9262 +typedef struct VLYNQ_ISR_ARGS_t
9270 +/****************************************
9271 + * Function Prototypes *
9272 + * API exported by generic vlynq driver *
9273 + ****************************************/
9274 +/* Initialization function */
9275 +GLOBAL INT32 vlynq_init( VLYNQ_DEV *pdev, VLYNQ_INIT_OPTIONS options);
9277 +/* Check vlynq link */
9278 +GLOBAL UINT32 vlynq_link_check( VLYNQ_DEV * pdev);
9280 +/* Set interrupt vector in local or remote device */
9281 +GLOBAL INT32 vlynq_interrupt_vector_set( VLYNQ_DEV *pdev,
9282 + UINT32 int_vector,
9283 + UINT32 map_vector,
9284 + VLYNQ_DEV_TYPE dev,
9285 + VLYNQ_INTR_POLARITY pol,
9286 + VLYNQ_INTR_TYPE type);
9289 +GLOBAL INT32 vlynq_interrupt_vector_cntl( VLYNQ_DEV *pdev,
9290 + UINT32 int_vector,
9291 + VLYNQ_DEV_TYPE dev,
9294 +GLOBAL UINT32 vlynq_interrupt_get_count( VLYNQ_DEV *pdev,
9295 + UINT32 map_vector);
9297 +GLOBAL INT32 vlynq_install_isr( VLYNQ_DEV *pdev,
9298 + UINT32 map_vector,
9299 + VLYNQ_INTR_CNTRL_ISR isr,
9300 + void *arg1, void *arg2, void *arg3);
9302 +GLOBAL INT32 vlynq_uninstall_isr( VLYNQ_DEV *pdev,
9303 + UINT32 map_vector,
9304 + void *arg1, void *arg2, void *arg3);
9307 +GLOBAL void vlynq_root_isr(void *arg);
9309 +GLOBAL void vlynq_delay(UINT32 clktime);
9311 +/* The following functions, provide better granularity in setting
9312 + * interrupt parameters. (for better support of linux INT Controller)
9313 + * Note: The interrupt source is identified by "map_vector"- the bit
9314 + * position in interrupt status register*/
9316 +GLOBAL INT32 vlynq_interrupt_vector_map(VLYNQ_DEV * pdev,
9317 + VLYNQ_DEV_TYPE dev,
9318 + UINT32 int_vector,
9319 + UINT32 map_vector);
9321 +GLOBAL INT32 vlynq_interrupt_set_polarity(VLYNQ_DEV * pdev,
9322 + VLYNQ_DEV_TYPE dev,
9323 + UINT32 map_vector,
9324 + VLYNQ_INTR_POLARITY pol);
9326 +GLOBAL INT32 vlynq_interrupt_get_polarity( VLYNQ_DEV *pdev ,
9327 + VLYNQ_DEV_TYPE dev_type,
9328 + UINT32 map_vector);
9330 +GLOBAL INT32 vlynq_interrupt_set_type(VLYNQ_DEV * pdev,
9331 + VLYNQ_DEV_TYPE dev,
9332 + UINT32 map_vector,
9333 + VLYNQ_INTR_TYPE type);
9335 +GLOBAL INT32 vlynq_interrupt_get_type( VLYNQ_DEV *pdev,
9336 + VLYNQ_DEV_TYPE dev_type,
9337 + UINT32 map_vector);
9339 +GLOBAL INT32 vlynq_interrupt_enable(VLYNQ_DEV* pdev,
9340 + VLYNQ_DEV_TYPE dev,
9341 + UINT32 map_vector);
9343 +GLOBAL INT32 vlynq_interrupt_disable(VLYNQ_DEV * pdev,
9344 + VLYNQ_DEV_TYPE dev,
9345 + UINT32 map_vector);
9351 +#endif /* _VLYNQ_HAL_H_ */
9352 diff -urN linux.old/include/asm-mips/ar7/vlynq_hal_params.h linux.dev/include/asm-mips/ar7/vlynq_hal_params.h
9353 --- linux.old/include/asm-mips/ar7/vlynq_hal_params.h 1970-01-01 01:00:00.000000000 +0100
9354 +++ linux.dev/include/asm-mips/ar7/vlynq_hal_params.h 2005-11-10 01:10:46.095590250 +0100
9356 +/***************************************************************************
9357 +**+----------------------------------------------------------------------+**
9361 +**| ********_///_**** |**
9362 +**| ***** /_//_/ **** |**
9363 +**| ** ** (__/ **** |**
9368 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
9369 +**| ALL RIGHTS RESERVED |**
9371 +**| Permission is hereby granted to licensees of Texas Instruments |**
9372 +**| Incorporated (TI) products to use this computer program for the sole |**
9373 +**| purpose of implementing a licensee product based on TI products. |**
9374 +**| No other rights to reproduce, use, or disseminate this computer |**
9375 +**| program, whether in part or in whole, are granted. |**
9377 +**| TI makes no representation or warranties with respect to the |**
9378 +**| performance of this computer program, and specifically disclaims |**
9379 +**| any responsibility for any damages, special or consequential, |**
9380 +**| connected with the use of this program. |**
9382 +**+----------------------------------------------------------------------+**
9383 +***************************************************************************/
9385 +/* This file defines Vlynq module parameters*/
9387 +#ifndef _VLYNQ_HAL_PARAMS_H
9388 +#define _VLYNQ_HAL_PARAMS_H
9390 + /* number of VLYNQ memory regions supported */
9391 +#define VLYNQ_MAX_MEMORY_REGIONS 0x04
9393 + /* Max.number of external interrupt inputs supported by VLYNQ module */
9394 +#define VLYNQ_IVR_MAXIVR 0x08
9396 +#define VLYNQ_CLK_DIV_MAX 0x08
9397 +#define VLYNQ_CLK_DIV_MIN 0x01
9400 +/*** the total number of entries allocated for ICB would be
9401 + * 32(for 32 bits in IntPending register) + VLYNQ_IVR_CHAIN_SLOTS*/
9402 +#define VLYNQ_IVR_CHAIN_SLOTS 10
9405 +#endif /* _VLYNQ_HAL_PARAMS_H */
9406 diff -urN linux.old/include/asm-mips/io.h linux.dev/include/asm-mips/io.h
9407 --- linux.old/include/asm-mips/io.h 2003-08-25 13:44:43.000000000 +0200
9408 +++ linux.dev/include/asm-mips/io.h 2005-11-10 01:14:16.400733500 +0100
9410 * Change "struct page" to physical address.
9412 #ifdef CONFIG_64BIT_PHYS_ADDR
9413 -#define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
9414 +#define page_to_phys(page) (((u64)(page - mem_map) << PAGE_SHIFT) + PHYS_OFFSET)
9416 -#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
9417 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + PHYS_OFFSET)
9420 #define IO_SPACE_LIMIT 0xffff
9421 diff -urN linux.old/include/asm-mips/irq.h linux.dev/include/asm-mips/irq.h
9422 --- linux.old/include/asm-mips/irq.h 2003-08-25 13:44:43.000000000 +0200
9423 +++ linux.dev/include/asm-mips/irq.h 2005-11-10 01:12:43.950955750 +0100
9425 #include <linux/config.h>
9426 #include <linux/linkage.h>
9430 + * AR7 has 40 primary and 32 secondary irqs
9431 + * vlynq0 has 32 irqs
9432 + * vlynq1 has 32 irqs
9434 +#ifdef CONFIG_AR7_VLYNQ
9435 +#define NR_IRQS (80 + 32 * CONFIG_AR7_VLYNQ_PORTS)
9440 #define NR_IRQS 128 /* Largest number of ints of all machines. */
9444 static inline int irq_cannonicalize(int irq)
9445 diff -urN linux.old/include/asm-mips/mips-boards/prom.h linux.dev/include/asm-mips/mips-boards/prom.h
9446 --- linux.old/include/asm-mips/mips-boards/prom.h 2001-09-09 19:43:02.000000000 +0200
9447 +++ linux.dev/include/asm-mips/mips-boards/prom.h 2005-11-10 01:14:16.436735750 +0100
9449 extern void prom_init_cmdline(void);
9450 extern void prom_meminit(void);
9451 extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
9452 -extern void prom_free_prom_memory (void);
9453 +extern unsigned long prom_free_prom_memory (void);
9454 extern void mips_display_message(const char *str);
9455 extern void mips_display_word(unsigned int num);
9456 extern int get_ethernet_addr(char *ethernet_addr);
9457 diff -urN linux.old/include/asm-mips/page.h linux.dev/include/asm-mips/page.h
9458 --- linux.old/include/asm-mips/page.h 2004-02-18 14:36:32.000000000 +0100
9459 +++ linux.dev/include/asm-mips/page.h 2005-11-10 01:14:16.436735750 +0100
9462 #include <linux/config.h>
9463 #include <asm/break.h>
9464 +#include <asm/addrspace.h>
9470 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
9471 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
9472 -#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
9473 +#define virt_to_page(kaddr) (mem_map + ((__pa(kaddr)-PHYS_OFFSET) >> PAGE_SHIFT))
9474 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
9476 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
9477 diff -urN linux.old/include/asm-mips/pgtable-32.h linux.dev/include/asm-mips/pgtable-32.h
9478 --- linux.old/include/asm-mips/pgtable-32.h 2004-02-18 14:36:32.000000000 +0100
9479 +++ linux.dev/include/asm-mips/pgtable-32.h 2005-11-10 01:14:16.436735750 +0100
9481 * and a page entry and page directory to the page they refer to.
9484 -#ifdef CONFIG_CPU_VR41XX
9485 +#if defined(CONFIG_CPU_VR41XX)
9486 #define mk_pte(page, pgprot) \
9489 @@ -123,13 +123,14 @@
9493 - pte_val(__pte) = ((phys_t)(page - mem_map) << PAGE_SHIFT) | \
9494 - pgprot_val(pgprot); \
9495 + pte_val(__pte) = (((phys_t)(page - mem_map) << PAGE_SHIFT) + \
9496 + PHYS_OFFSET) | pgprot_val(pgprot); \
9503 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
9505 #ifdef CONFIG_CPU_VR41XX
9506 @@ -175,12 +176,12 @@
9507 set_pte(ptep, __pte(0));
9510 -#ifdef CONFIG_CPU_VR41XX
9511 +#if defined(CONFIG_CPU_VR41XX)
9512 #define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> (PAGE_SHIFT+2)))))
9513 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << (PAGE_SHIFT+2)) | pgprot_val(pgprot))
9515 -#define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> PAGE_SHIFT))))
9516 -#define __mk_pte(page_nr,pgprot) __pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
9517 +#define pte_page(x) (mem_map+((unsigned long)((((x).pte_low-PHYS_OFFSET) >> PAGE_SHIFT))))
9518 +#define __mk_pte(page_nr,pgprot) __pte((((page_nr) << PAGE_SHIFT)+PHYS_OFFSET)|pgprot_val(pgprot))
9522 diff -urN linux.old/include/asm-mips/serial.h linux.dev/include/asm-mips/serial.h
9523 --- linux.old/include/asm-mips/serial.h 2005-01-19 15:10:12.000000000 +0100
9524 +++ linux.dev/include/asm-mips/serial.h 2005-11-10 01:14:16.436735750 +0100
9527 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
9530 +#include <asm/ar7/ar7.h>
9531 +#include <asm/ar7/avalanche_intc.h>
9532 +#define AR7_SERIAL_PORT_DEFNS \
9533 + { 0, AR7_BASE_BAUD, AR7_UART0_REGS_BASE, LNXINTNUM(AVALANCHE_UART0_INT), STD_COM_FLAGS }, \
9534 + { 0, AR7_BASE_BAUD, AR7_UART1_REGS_BASE, LNXINTNUM(AVALANCHE_UART1_INT), STD_COM_FLAGS },
9536 +#define AR7_SERIAL_PORT_DEFNS
9539 #ifdef CONFIG_MIPS_JAZZ
9540 #define _JAZZ_SERIAL_INIT(int, base) \
9541 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
9545 #define SERIAL_PORT_DFNS \
9546 + AR7_SERIAL_PORT_DEFNS \
9547 ATLAS_SERIAL_PORT_DEFNS \
9548 AU1000_SERIAL_PORT_DEFNS \
9549 COBALT_SERIAL_PORT_DEFNS \