1 diff -urN linux.old/Makefile linux.dev/Makefile
2 --- linux.old/Makefile 2005-10-21 16:43:16.316951500 +0200
3 +++ linux.dev/Makefile 2005-11-10 01:10:45.771570000 +0100
6 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
8 -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
9 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
10 -fno-strict-aliasing -fno-common
11 ifndef CONFIG_FRAME_POINTER
12 CFLAGS += -fomit-frame-pointer
13 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
14 --- linux.old/arch/mips/Makefile 2005-10-21 16:43:16.316951500 +0200
15 +++ linux.dev/arch/mips/Makefile 2005-11-10 01:10:45.775570250 +0100
20 +# Texas Instruments AR7
24 +LIBS += arch/mips/ar7/ar7.o
25 +SUBDIRS += arch/mips/ar7
26 +LOADADDR += 0x94020000
32 ifdef CONFIG_DECSTATION
33 diff -urN linux.old/arch/mips/ar7/Makefile linux.dev/arch/mips/ar7/Makefile
34 --- linux.old/arch/mips/ar7/Makefile 1970-01-01 01:00:00.000000000 +0100
35 +++ linux.dev/arch/mips/ar7/Makefile 2005-11-10 01:13:51.443173750 +0100
38 + $(CPP) $(AFLAGS) $< -o $*.s
41 + $(CC) $(AFLAGS) -c $< -o $*.o
43 +EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7 -DLITTLE_ENDIAN -D_LINK_KSEG0_
46 +obj-y := tnetd73xx_misc.o misc.o
47 +export-objs := misc.o irq.o init.o
48 +obj-y += setup.o irq.o int-handler.o reset.o init.o psp_env.o memory.o promlib.o cmdline.o
50 +include $(TOPDIR)/Rules.make
51 diff -urN linux.old/arch/mips/ar7/cmdline.c linux.dev/arch/mips/ar7/cmdline.c
52 --- linux.old/arch/mips/ar7/cmdline.c 1970-01-01 01:00:00.000000000 +0100
53 +++ linux.dev/arch/mips/ar7/cmdline.c 2005-11-10 01:14:16.372731750 +0100
56 + * Carsten Langgaard, carstenl@mips.com
57 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
59 + * This program is free software; you can distribute it and/or modify it
60 + * under the terms of the GNU General Public License (Version 2) as
61 + * published by the Free Software Foundation.
63 + * This program is distributed in the hope it will be useful, but WITHOUT
64 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
65 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
68 + * You should have received a copy of the GNU General Public License along
69 + * with this program; if not, write to the Free Software Foundation, Inc.,
70 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
72 + * Kernel command line creation using the prom monitor (YAMON) argc/argv.
74 +#include <linux/init.h>
75 +#include <linux/string.h>
77 +#include <asm/bootinfo.h>
79 +extern int prom_argc;
80 +extern int *_prom_argv;
83 + * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer.
84 + * This macro take care of sign extension.
86 +#define prom_argv(index) ((char *)(((int *)(int)_prom_argv)[(index)]))
88 +char arcs_cmdline[CL_SIZE];
89 +#ifdef CONFIG_CMDLINE_BOOL
90 +char __initdata cfg_cmdline[] = CONFIG_CMDLINE;
93 +char * __init prom_getcmdline(void)
95 + return &(arcs_cmdline[0]);
99 +void __init prom_init_cmdline(void)
103 + char *env_cmdline = prom_getenv("kernel_args");
106 + actr = 1; /* Always ignore argv[0] */
108 + cp = end = &(arcs_cmdline[0]);
109 + end += sizeof(arcs_cmdline);
112 + len = strlen(env_cmdline);
113 + if (len > end - cp - 1)
114 + len = end - cp - 1;
115 + strncpy(cp, env_cmdline, len);
119 +#ifdef CONFIG_CMDLINE_BOOL
121 + len = strlen(cfg_cmdline);
122 + if (len > end - cp - 1)
123 + len = end - cp - 1;
124 + strncpy(cp, cfg_cmdline, len);
130 + while(actr < prom_argc) {
131 + len = strlen(prom_argv(actr));
132 + if (len > end - cp - 1)
134 + strncpy(cp, prom_argv(actr), len);
139 + if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
143 diff -urN linux.old/arch/mips/ar7/init.c linux.dev/arch/mips/ar7/init.c
144 --- linux.old/arch/mips/ar7/init.c 1970-01-01 01:00:00.000000000 +0100
145 +++ linux.dev/arch/mips/ar7/init.c 2005-11-10 01:10:45.795571500 +0100
148 + * Carsten Langgaard, carstenl@mips.com
149 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
151 + * This program is free software; you can distribute it and/or modify it
152 + * under the terms of the GNU General Public License (Version 2) as
153 + * published by the Free Software Foundation.
155 + * This program is distributed in the hope it will be useful, but WITHOUT
156 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
157 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
158 + * for more details.
160 + * You should have received a copy of the GNU General Public License along
161 + * with this program; if not, write to the Free Software Foundation, Inc.,
162 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
164 + * PROM library initialisation code.
166 +#include <linux/config.h>
167 +#include <linux/init.h>
168 +#include <linux/string.h>
169 +#include <linux/kernel.h>
170 +#include <linux/module.h>
173 +#include <asm/mips-boards/prom.h>
174 +#include <asm/mips-boards/generic.h>
176 +#include <asm/ar7/adam2_env.h>
179 +int *_prom_argv, *_prom_envp;
181 +/* max # of Adam2 environment variables */
182 +#define MAX_ENV_ENTRY 80
184 +static t_env_var local_envp[MAX_ENV_ENTRY];
185 +static int env_type = 0;
188 +unsigned int max_env_entry;
190 +extern char *prom_psp_getenv(char *envname);
192 +static inline char *prom_adam2_getenv(char *envname)
195 + * Return a pointer to the given environment variable.
196 + * In 64-bit mode: we're using 64-bit pointers, but all pointers
197 + * in the PROM structures are only 32-bit, so we need some
198 + * workarounds, if we are running in 64-bit mode.
201 + t_env_var *env = (t_env_var *) local_envp;
203 + if (strcmp("bootloader", envname) == 0)
206 + i = strlen(envname);
207 + while (env->name) {
208 + if(strncmp(envname, env->name, i) == 0) {
217 +/* XXX "bootloader" won't be returned.
218 + * Better make it an element of local_envp */
219 +static inline t_env_var *
220 +prom_adam2_iterenv(t_env_var *env) {
225 + if (env - local_envp > MAX_ENV_ENTRY || !env->name)
230 +char *prom_getenv(char *envname)
233 + return prom_psp_getenv(envname);
235 + return prom_adam2_getenv(envname);
239 +prom_iterenv(t_env_var *last)
242 + return 0; /* not yet implemented */
243 + return prom_adam2_iterenv(last);
246 +static inline unsigned char str2hexnum(unsigned char c)
248 + if (c >= '0' && c <= '9')
250 + if (c >= 'a' && c <= 'f')
251 + return c - 'a' + 10;
252 + return 0; /* foo */
255 +static inline void str2eaddr(unsigned char *ea, unsigned char *str)
259 + for (i = 0; i < 6; i++) {
262 + if((*str == '.') || (*str == ':'))
264 + num = str2hexnum(*str++) << 4;
265 + num |= (str2hexnum(*str++));
270 +int get_ethernet_addr(char *ethernet_addr)
274 + ethaddr_str = prom_getenv("ethaddr");
275 + if (!ethaddr_str) {
276 + printk("ethaddr not set in boot prom\n");
279 + str2eaddr(ethernet_addr, ethaddr_str);
281 + if (init_debug > 1) {
283 + printk("get_ethernet_addr: ");
284 + for (i=0; i<5; i++)
285 + printk("%02x:", (unsigned char)*(ethernet_addr+i));
286 + printk("%02x\n", *(ethernet_addr+i));
293 + unsigned int psbl_size;
294 + unsigned int env_base;
295 + unsigned int env_size;
296 + unsigned int ffs_base;
297 + unsigned int ffs_size;
300 +static const char psp_env_version[] = "TIENV0.8";
302 +int __init prom_init(int argc, char **argv, char **envp)
306 + t_env_var *env = (t_env_var *) envp;
307 + struct psbl_rec *psbl = (struct psbl_rec *)(KSEG1ADDR(0x94000300));
308 + void *psp_env = (void *)KSEG1ADDR(psbl->env_base);
311 + _prom_argv = (int *)argv;
312 + _prom_envp = (int *)envp;
314 + if(strcmp(psp_env, psp_env_version) == 0) {
318 + _prom_envp = psp_env;
319 + max_env_entry = (psbl->env_size / 16) - 1;
321 + /* Copy what we need locally so we are not dependent on
322 + * bootloader RAM. In Adam2, the environment parameters
323 + * are in flash but the table that references them is in
327 + for(i=0; i < MAX_ENV_ENTRY; i++, env++) {
329 + local_envp[i].name = env->name;
330 + local_envp[i].val = env->val;
332 + local_envp[i].name = NULL;
333 + local_envp[i].val = NULL;
338 + set_io_port_base(0);
340 + prom_printf("\nLINUX started...\n");
341 + prom_init_cmdline();
346 diff -urN linux.old/arch/mips/ar7/int-handler.S linux.dev/arch/mips/ar7/int-handler.S
347 --- linux.old/arch/mips/ar7/int-handler.S 1970-01-01 01:00:00.000000000 +0100
348 +++ linux.dev/arch/mips/ar7/int-handler.S 2005-11-10 01:12:43.938955000 +0100
351 + * Copyright 2004 PMC-Sierra Inc.
352 + * Author: Manish Lachwani (lachwani@pmc-sierra.com)
353 + * Adaption for AR7: Enrik Berkhan <enrik@akk.org>
355 + * First-level interrupt dispatcher for the TI AR7
357 + * This program is free software; you can redistribute it and/or modify it
358 + * under the terms of the GNU General Public License as published by the
359 + * Free Software Foundation; either version 2 of the License, or (at your
360 + * option) any later version.
362 +#define __ASSEMBLY__
363 +#include <linux/config.h>
364 +#include <asm/asm.h>
365 +#include <asm/mipsregs.h>
366 +#include <asm/addrspace.h>
367 +#include <asm/regdef.h>
368 +#include <asm/stackframe.h>
371 + * First level interrupt dispatcher for TI AR7 based boards
375 + NESTED(ar7IRQ, PT_SIZE, sp)
381 + mfc0 t2, CP0_STATUS
385 + andi t1, t0, STATUSF_IP2 /* hw0 hardware interrupt */
386 + bnez t1, ll_hw0_irq
388 + andi t1, t0, STATUSF_IP7 /* R4k CPU timer */
389 + bnez t1, ll_timer_irq
393 + /* wrong alarm or masked ... */
394 + j spurious_interrupt
413 diff -urN linux.old/arch/mips/ar7/irq.c linux.dev/arch/mips/ar7/irq.c
414 --- linux.old/arch/mips/ar7/irq.c 1970-01-01 01:00:00.000000000 +0100
415 +++ linux.dev/arch/mips/ar7/irq.c 2005-11-10 01:12:43.938955000 +0100
418 + * Nitin Dhingra, iamnd@ti.com
419 + * Copyright (C) 2002 Texas Instruments, Inc. All rights reserved.
421 + * ########################################################################
423 + * This program is free software; you can distribute it and/or modify it
424 + * under the terms of the GNU General Public License (Version 2) as
425 + * published by the Free Software Foundation.
427 + * This program is distributed in the hope it will be useful, but WITHOUT
428 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
429 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
430 + * for more details.
432 + * You should have received a copy of the GNU General Public License along
433 + * with this program; if not, write to the Free Software Foundation, Inc.,
434 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
436 + * ########################################################################
438 + * Routines for generic manipulation of the interrupts found on the Texas
439 + * Instruments avalanche board
443 +#include <linux/init.h>
444 +#include <linux/interrupt.h>
446 +#include <asm/irq.h>
447 +#include <asm/mipsregs.h>
448 +#include <asm/ar7/ar7.h>
449 +#include <asm/ar7/avalanche_intc.h>
451 +#define shutdown_avalanche_irq disable_avalanche_irq
452 +#define mask_and_ack_avalanche_irq disable_avalanche_irq
454 +static unsigned int startup_avalanche_irq(unsigned int irq);
455 +static void end_avalanche_irq(unsigned int irq);
456 +void enable_avalanche_irq(unsigned int irq_nr);
457 +void disable_avalanche_irq(unsigned int irq_nr);
458 +void ar7_hw0_interrupt(int interrupt, void *dev, struct pt_regs *regs);
460 +static struct hw_interrupt_type avalanche_irq_type = {
462 + startup_avalanche_irq,
463 + shutdown_avalanche_irq,
464 + enable_avalanche_irq,
465 + disable_avalanche_irq,
466 + mask_and_ack_avalanche_irq,
471 +static int ar7_irq_base;
473 +static struct irqaction ar7_hw0_action = {
474 + ar7_hw0_interrupt, 0, 0, "AR7 on hw0", NULL, NULL
477 +struct avalanche_ictrl_regs *avalanche_hw0_icregs; /* Interrupt control regs (primary) */
478 +struct avalanche_exctrl_regs *avalanche_hw0_ecregs; /* Exception control regs (secondary) */
479 +struct avalanche_ipace_regs *avalanche_hw0_ipaceregs;
480 +struct avalanche_channel_int_number *avalanche_hw0_chregs; /* Channel control registers */
483 + This remaps interrupts to exist on other channels than the default
484 + channels. essentially we can use the line # as the index for this
488 +static unsigned long line_to_channel[AVINTNUM(AVALANCHE_INT_END_PRIMARY)];
489 +unsigned long uni_secondary_interrupt = 0;
491 +static void end_avalanche_irq(unsigned int irq)
493 + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
494 + enable_avalanche_irq(irq);
497 +void disable_avalanche_irq(unsigned int irq_nr)
499 + unsigned long flags;
500 + unsigned long chan_nr=0;
502 + save_and_cli(flags);
504 + /* irq_nr represents the line number for the interrupt. We must
505 + * disable the channel number associated with that line number.
508 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
509 + chan_nr = AVINTNUM(irq_nr); /*CHECK THIS ALSO*/
511 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];/* WE NEED A LINE TO CHANNEL MAPPING FUNCTION HERE*/
513 + /* disable the interrupt channel bit */
515 + /* primary interrupt #'s 0-31 */
517 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
518 + avalanche_hw0_icregs->intecr1 = (1 << chan_nr);
520 + /* primary interrupt #'s 32-39 */
522 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
523 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
524 + avalanche_hw0_icregs->intecr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
526 + else /* secondary interrupt #'s 0-31 */
527 + avalanche_hw0_ecregs->exiecr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
529 + restore_flags(flags);
532 +void enable_avalanche_irq(unsigned int irq_nr)
534 + unsigned long flags;
535 + unsigned long chan_nr=0;
537 + save_and_cli(flags);
539 + /* irq_nr represents the line number for the interrupt. We must
540 + * disable the channel number associated with that line number.
543 + if(irq_nr > AVALANCHE_INT_END_PRIMARY_REG2)
544 + chan_nr = AVINTNUM(irq_nr);
546 + chan_nr = line_to_channel[AVINTNUM(irq_nr)];
548 + /* enable the interrupt channel bit */
550 + /* primary interrupt #'s 0-31 */
551 + if(chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1))
552 + avalanche_hw0_icregs->intesr1 = (1 << chan_nr);
554 + /* primary interrupt #'s 32 throuth 39 */
555 + else if ((chan_nr <= AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG2)) &&
556 + (chan_nr > AVINTNUM(AVALANCHE_INT_END_PRIMARY_REG1)))
557 + avalanche_hw0_icregs->intesr2 = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_SECONDARY)));
559 + else /* secondary interrupt #'s 0-31 */
560 + avalanche_hw0_ecregs->exiesr = (1 << (chan_nr - AVINTNUM(AVALANCHE_INT_END_PRIMARY)));
562 + restore_flags(flags);
565 +static unsigned int startup_avalanche_irq(unsigned int irq)
567 + enable_avalanche_irq(irq);
568 + return 0; /* never anything pending */
571 +void __init ar7_irq_init(int base)
575 + avalanche_hw0_icregs = (struct avalanche_ictrl_regs *)AVALANCHE_ICTRL_REGS_BASE;
576 + avalanche_hw0_ecregs = (struct avalanche_exctrl_regs *)AVALANCHE_ECTRL_REGS_BASE;
577 + avalanche_hw0_ipaceregs = (struct avalanche_ipace_regs *)AVALANCHE_IPACE_REGS_BASE;
578 + avalanche_hw0_chregs = (struct avalanche_channel_int_number *)AVALANCHE_CHCTRL_REGS_BASE;
580 + /* Disable interrupts and clear pending
583 + avalanche_hw0_icregs->intecr1 = 0xffffffff; /* disable interrupts 0:31 */
584 + avalanche_hw0_icregs->intcr1 = 0xffffffff; /* clear interrupts 0:31 */
585 + avalanche_hw0_icregs->intecr2 = 0xff; /* disable interrupts 32:39 */
586 + avalanche_hw0_icregs->intcr2 = 0xff; /* clear interrupts 32:39 */
587 + avalanche_hw0_ecregs->exiecr = 0xffffffff; /* disable secondary interrupts 0:31 */
588 + avalanche_hw0_ecregs->excr = 0xffffffff; /* clear secondary interrupts 0:31 */
591 + // avalanche_hw0_ipaceregs->ipacep = (2*get_avalanche_vbus_freq()/1000000)*4;
592 + /* hack for speeding up the pacing. */
593 + printk("the pacing pre-scalar has been set as 600.\n");
594 + avalanche_hw0_ipaceregs->ipacep = 600;
595 + /* Channel to line mapping, Line to Channel mapping */
597 + for(i = 0; i < 40; i++)
598 + avalanche_int_set(i,i);
600 + ar7_irq_base = base;
601 + for (i = base; i <= base+40; i++)
603 + irq_desc[i].status = IRQ_DISABLED;
604 + irq_desc[i].action = 0;
605 + irq_desc[i].depth = 1;
606 + irq_desc[i].handler = &avalanche_irq_type;
609 + setup_irq(2, &ar7_hw0_action);
610 + set_c0_status(IE_IRQ0);
615 +void ar7_hw0_interrupt(int interrupt, void *dev, struct pt_regs *regs)
618 + unsigned long int_line_number, status;
619 + int i, chan_nr = 0;
621 + int_line_number = ((avalanche_hw0_icregs->pintir >> 16) & 0x3F);
622 + chan_nr = ((avalanche_hw0_icregs->pintir) & 0x3F);
624 + if(chan_nr < 32) /* primary 0-31 */
626 + if( chan_nr != uni_secondary_interrupt)
627 + avalanche_hw0_icregs->intcr1 = (1<<chan_nr);
631 + if((chan_nr < 40) && (chan_nr > 31)) /* primary 32-39 */
633 + avalanche_hw0_icregs->intcr2 = (1<<(chan_nr-32));
637 + /* If the Priority Interrupt Index Register returns 40 then no
638 + * interrupts are pending
644 + if(chan_nr == uni_secondary_interrupt) /* secondary 0-31 */
646 + status = avalanche_hw0_ecregs->exsr;
647 + for(i=0; i < 32; i++)
651 + /* clear secondary interrupt */
652 + avalanche_hw0_ecregs->excr = 1 << i;
658 + /* clear the universal secondary interrupt */
659 + avalanche_hw0_icregs->intcr1 = 1 << uni_secondary_interrupt;
665 + do_IRQ(irq + ar7_irq_base, regs);
669 +void avalanche_int_set(int channel, int line)
674 + avalanche_hw0_chregs->cintnr0 = line;
677 + avalanche_hw0_chregs->cintnr1 = line;
680 + avalanche_hw0_chregs->cintnr2 = line;
683 + avalanche_hw0_chregs->cintnr3 = line;
686 + avalanche_hw0_chregs->cintnr4 = line;
689 + avalanche_hw0_chregs->cintnr5 = line;
692 + avalanche_hw0_chregs->cintnr6 = line;
695 + avalanche_hw0_chregs->cintnr7 = line;
698 + avalanche_hw0_chregs->cintnr8 = line;
701 + avalanche_hw0_chregs->cintnr9 = line;
704 + avalanche_hw0_chregs->cintnr10 = line;
707 + avalanche_hw0_chregs->cintnr11 = line;
710 + avalanche_hw0_chregs->cintnr12 = line;
713 + avalanche_hw0_chregs->cintnr13 = line;
716 + avalanche_hw0_chregs->cintnr14 = line;
719 + avalanche_hw0_chregs->cintnr15 = line;
722 + avalanche_hw0_chregs->cintnr16 = line;
725 + avalanche_hw0_chregs->cintnr17 = line;
728 + avalanche_hw0_chregs->cintnr18 = line;
731 + avalanche_hw0_chregs->cintnr19 = line;
734 + avalanche_hw0_chregs->cintnr20 = line;
737 + avalanche_hw0_chregs->cintnr21 = line;
740 + avalanche_hw0_chregs->cintnr22 = line;
743 + avalanche_hw0_chregs->cintnr23 = line;
746 + avalanche_hw0_chregs->cintnr24 = line;
749 + avalanche_hw0_chregs->cintnr25 = line;
752 + avalanche_hw0_chregs->cintnr26 = line;
755 + avalanche_hw0_chregs->cintnr27 = line;
758 + avalanche_hw0_chregs->cintnr28 = line;
761 + avalanche_hw0_chregs->cintnr29 = line;
764 + avalanche_hw0_chregs->cintnr30 = line;
767 + avalanche_hw0_chregs->cintnr31 = line;
770 + avalanche_hw0_chregs->cintnr32 = line;
773 + avalanche_hw0_chregs->cintnr33 = line;
776 + avalanche_hw0_chregs->cintnr34 = line;
779 + avalanche_hw0_chregs->cintnr35 = line;
782 + avalanche_hw0_chregs->cintnr36 = line;
785 + avalanche_hw0_chregs->cintnr37 = line;
788 + avalanche_hw0_chregs->cintnr38 = line;
791 + avalanche_hw0_chregs->cintnr39 = line;
794 + printk("Error: Unknown Avalanche interrupt channel\n");
797 + line_to_channel[line] = channel; /* Suraj check */
799 + if (channel == UNIFIED_SECONDARY_INTERRUPT)
800 + uni_secondary_interrupt = line;
805 +#define AVALANCHE_MAX_PACING_BLK 3
806 +#define AVALANCHE_PACING_LOW_VAL 2
807 +#define AVALANCHE_PACING_HIGH_VAL 63
809 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num,
810 + unsigned int pace_value)
812 + unsigned int blk_offset;
813 + unsigned long flags;
815 + if(irq_nr < MIPS_EXCEPTION_OFFSET &&
816 + irq_nr >= AVALANCHE_INT_END_PRIMARY)
819 + if(blk_num > AVALANCHE_MAX_PACING_BLK)
822 + if(pace_value > AVALANCHE_PACING_HIGH_VAL &&
823 + pace_value < AVALANCHE_PACING_LOW_VAL)
826 + blk_offset = blk_num*8;
828 + save_and_cli(flags);
830 + /* disable the interrupt pacing, if enabled previously */
831 + avalanche_hw0_ipaceregs->ipacemax &= ~(0xff << blk_offset);
833 + /* clear the pacing map */
834 + avalanche_hw0_ipaceregs->ipacemap &= ~(0xff << blk_offset);
836 + /* setup the new values */
837 + avalanche_hw0_ipaceregs->ipacemap |= ((AVINTNUM(irq_nr)) << blk_offset);
838 + avalanche_hw0_ipaceregs->ipacemax |= ((0x80 | pace_value) << blk_offset);
840 + restore_flags(flags);
844 diff -urN linux.old/arch/mips/ar7/memory.c linux.dev/arch/mips/ar7/memory.c
845 --- linux.old/arch/mips/ar7/memory.c 1970-01-01 01:00:00.000000000 +0100
846 +++ linux.dev/arch/mips/ar7/memory.c 2005-11-10 01:14:16.372731750 +0100
849 + * Carsten Langgaard, carstenl@mips.com
850 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
852 + * ########################################################################
854 + * This program is free software; you can distribute it and/or modify it
855 + * under the terms of the GNU General Public License (Version 2) as
856 + * published by the Free Software Foundation.
858 + * This program is distributed in the hope it will be useful, but WITHOUT
859 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
860 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
861 + * for more details.
863 + * You should have received a copy of the GNU General Public License along
864 + * with this program; if not, write to the Free Software Foundation, Inc.,
865 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
867 + * ########################################################################
871 +#include <linux/config.h>
872 +#include <linux/init.h>
873 +#include <linux/mm.h>
874 +#include <linux/bootmem.h>
876 +#include <asm/bootinfo.h>
877 +#include <asm/page.h>
878 +#include <asm/mips-boards/prom.h>
881 +extern int preserve_adam2;
883 +void __init prom_meminit(void)
886 + unsigned long memsize, adam2size;
888 + /* assume block before kernel is used by bootloader */
889 + adam2size = __pa(&_ftext) - PHYS_OFFSET;
891 + memsize_str = prom_getenv("memsize");
892 + if (!memsize_str) {
893 + memsize = 0x02000000;
895 + memsize = simple_strtol(memsize_str, NULL, 0);
899 + add_memory_region(0x00000000, PHYS_OFFSET, BOOT_MEM_RESERVED);
901 + add_memory_region(PHYS_OFFSET, adam2size, BOOT_MEM_ROM_DATA);
902 + add_memory_region(PHYS_OFFSET+adam2size, memsize-adam2size,
906 +unsigned long __init prom_free_prom_memory (void)
909 + unsigned long freed = 0;
910 + unsigned long addr;
912 + if (preserve_adam2) {
913 + char *firstfree_str = prom_getenv("firstfreeaddress");
914 + unsigned long firstfree = 0;
917 + firstfree = simple_strtol(firstfree_str, NULL, 0);
919 + if (firstfree && firstfree < (unsigned long)&_ftext) {
920 + printk("Preserving ADAM2 memory.\n");
921 + } else if (firstfree) {
922 + printk("Can't preserve ADAM2 memory, "
923 + "firstfreeaddress = %08lx.\n", firstfree);
924 + preserve_adam2 = 0;
926 + printk("Can't preserve ADAM2 memory, "
927 + "firstfreeaddress unknown!\n");
928 + preserve_adam2 = 0;
932 + if (!preserve_adam2) {
933 + for (i = 0; i < boot_mem_map.nr_map; i++) {
934 + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
937 + addr = boot_mem_map.map[i].addr;
938 + while (addr < boot_mem_map.map[i].addr
939 + + boot_mem_map.map[i].size) {
940 + ClearPageReserved(virt_to_page(__va(addr)));
941 + set_page_count(virt_to_page(__va(addr)), 1);
942 + free_page((unsigned long)__va(addr));
944 + freed += PAGE_SIZE;
947 + printk("Freeing prom memory: %ldkb freed\n", freed >> 10);
949 + return freed >> PAGE_SHIFT;
951 diff -urN linux.old/arch/mips/ar7/misc.c linux.dev/arch/mips/ar7/misc.c
952 --- linux.old/arch/mips/ar7/misc.c 1970-01-01 01:00:00.000000000 +0100
953 +++ linux.dev/arch/mips/ar7/misc.c 2005-11-10 01:12:43.946955500 +0100
955 +#include <asm/ar7/sangam.h>
956 +#include <asm/ar7/avalanche_misc.h>
957 +#include <linux/module.h>
958 +#include <linux/spinlock.h>
962 +static unsigned int avalanche_vbus_freq;
964 +REMOTE_VLYNQ_DEV_RESET_CTRL_FN p_remote_vlynq_dev_reset_ctrl = NULL;
966 +/*****************************************************************************
967 + * Reset Control Module.
968 + *****************************************************************************/
969 +void avalanche_reset_ctrl(unsigned int module_reset_bit,
970 + AVALANCHE_RESET_CTRL_T reset_ctrl)
972 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
974 + if(module_reset_bit >= 32 && module_reset_bit < 64)
977 + if(module_reset_bit >= 64)
979 + if(p_remote_vlynq_dev_reset_ctrl) {
980 + p_remote_vlynq_dev_reset_ctrl(module_reset_bit - 64, reset_ctrl);
987 + if(reset_ctrl == OUT_OF_RESET)
988 + *reset_reg |= 1 << module_reset_bit;
990 + *reset_reg &= ~(1 << module_reset_bit);
994 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(unsigned int module_reset_bit)
996 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
998 + return (((*reset_reg) & (1 << module_reset_bit)) ? OUT_OF_RESET : IN_RESET );
1001 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode)
1003 + volatile unsigned int *sw_reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_SWRCR;
1004 + *sw_reset_reg = mode;
1007 +#define AVALANCHE_RST_CTRL_RSR_MASK 0x3
1009 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status()
1011 + volatile unsigned int *sys_reset_status = (unsigned int*) AVALANCHE_RST_CTRL_RSR;
1013 + return ( (AVALANCHE_SYS_RESET_STATUS_T) (*sys_reset_status & AVALANCHE_RST_CTRL_RSR_MASK) );
1017 +/*****************************************************************************
1018 + * Power Control Module
1019 + *****************************************************************************/
1020 +#define AVALANCHE_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
1021 +#define AVALANCHE_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
1024 +void avalanche_power_ctrl(unsigned int module_power_bit, AVALANCHE_POWER_CTRL_T power_ctrl)
1026 + volatile unsigned int *power_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1028 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
1029 + /* power down the module */
1030 + *power_reg |= (1 << module_power_bit);
1032 + /* power on the module */
1033 + *power_reg &= (~(1 << module_power_bit));
1036 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int module_power_bit)
1038 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1040 + return (((*power_status_reg) & (1 << module_power_bit)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP);
1043 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode)
1045 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1047 + *power_status_reg &= AVALANCHE_GLOBAL_POWER_DOWN_MASK;
1048 + *power_status_reg |= ( power_mode << AVALANCHE_GLOBAL_POWER_DOWN_BIT);
1051 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void)
1053 + volatile unsigned int *power_status_reg = (unsigned int*)AVALANCHE_POWER_CTRL_PDCR;
1055 + return((AVALANCHE_SYS_POWER_MODE_T) (((*power_status_reg) & (~AVALANCHE_GLOBAL_POWER_DOWN_MASK))
1056 + >> AVALANCHE_GLOBAL_POWER_DOWN_BIT));
1059 +/*****************************************************************************
1061 + *****************************************************************************/
1063 +/****************************************************************************
1064 + * FUNCTION: avalanche_gpio_init
1065 + ***************************************************************************/
1066 +void avalanche_gpio_init(void)
1068 + spinlock_t closeLock;
1069 + unsigned int closeFlag;
1070 + volatile unsigned int *reset_reg = (unsigned int*) AVALANCHE_RST_CTRL_PRCR;
1071 + spin_lock_irqsave(&closeLock, closeFlag);
1072 + *reset_reg |= (1 << AVALANCHE_GPIO_RESET_BIT);
1073 + spin_unlock_irqrestore(&closeLock, closeFlag);
1076 +/****************************************************************************
1077 + * FUNCTION: avalanche_gpio_ctrl
1078 + ***************************************************************************/
1079 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
1080 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
1081 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction)
1083 + spinlock_t closeLock;
1084 + unsigned int closeFlag;
1085 + volatile unsigned int *gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_ENBL;
1087 + if(gpio_pin >= 32)
1090 + spin_lock_irqsave(&closeLock, closeFlag);
1092 + if(pin_mode == GPIO_PIN)
1094 + *gpio_ctrl |= (1 << gpio_pin);
1096 + gpio_ctrl = (unsigned int*)AVALANCHE_GPIO_DIR;
1098 + if(pin_direction == GPIO_INPUT_PIN)
1099 + *gpio_ctrl |= (1 << gpio_pin);
1101 + *gpio_ctrl &= ~(1 << gpio_pin);
1103 + else /* FUNCTIONAL PIN */
1105 + *gpio_ctrl &= ~(1 << gpio_pin);
1108 + spin_unlock_irqrestore(&closeLock, closeFlag);
1113 +/****************************************************************************
1114 + * FUNCTION: avalanche_gpio_out
1115 + ***************************************************************************/
1116 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value)
1118 + spinlock_t closeLock;
1119 + unsigned int closeFlag;
1120 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
1122 + if(gpio_pin >= 32)
1125 + spin_lock_irqsave(&closeLock, closeFlag);
1127 + *gpio_out |= 1 << gpio_pin;
1129 + *gpio_out &= ~(1 << gpio_pin);
1130 + spin_unlock_irqrestore(&closeLock, closeFlag);
1135 +/****************************************************************************
1136 + * FUNCTION: avalanche_gpio_in
1137 + ***************************************************************************/
1138 +int avalanche_gpio_in_bit(unsigned int gpio_pin)
1140 + spinlock_t closeLock;
1141 + unsigned int closeFlag;
1142 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
1145 + if(gpio_pin >= 32)
1148 + spin_lock_irqsave(&closeLock, closeFlag);
1149 + ret_val = ((*gpio_in) & (1 << gpio_pin));
1150 + spin_unlock_irqrestore(&closeLock, closeFlag);
1155 +/****************************************************************************
1156 + * FUNCTION: avalanche_gpio_out_val
1157 + ***************************************************************************/
1158 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int out_mask,
1159 + unsigned int reg_index)
1161 + spinlock_t closeLock;
1162 + unsigned int closeFlag;
1163 + volatile unsigned int *gpio_out = (unsigned int*) AVALANCHE_GPIO_DATA_OUT;
1168 + spin_lock_irqsave(&closeLock, closeFlag);
1169 + *gpio_out &= ~out_mask;
1170 + *gpio_out |= out_val;
1171 + spin_unlock_irqrestore(&closeLock, closeFlag);
1176 +/****************************************************************************
1177 + * FUNCTION: avalanche_gpio_in_value
1178 + ***************************************************************************/
1179 +int avalanche_gpio_in_value(unsigned int* in_val, unsigned int reg_index)
1181 + spinlock_t closeLock;
1182 + unsigned int closeFlag;
1183 + volatile unsigned int *gpio_in = (unsigned int*) AVALANCHE_GPIO_DATA_IN;
1188 + spin_lock_irqsave(&closeLock, closeFlag);
1189 + *in_val = *gpio_in;
1190 + spin_unlock_irqrestore(&closeLock, closeFlag);
1195 +/***********************************************************************
1197 + * Wakeup Control Module for TNETV1050 Communication Processor
1199 + ***********************************************************************/
1201 +#define AVALANCHE_WAKEUP_POLARITY_BIT 16
1203 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
1204 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
1205 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity)
1207 + volatile unsigned int *wakeup_status_reg = (unsigned int*) AVALANCHE_WAKEUP_CTRL_WKCR;
1209 + /* enable/disable */
1210 + if (wakeup_ctrl == WAKEUP_ENABLED)
1211 + /* enable wakeup */
1212 + *wakeup_status_reg |= wakeup_int;
1214 + /* disable wakeup */
1215 + *wakeup_status_reg &= (~wakeup_int);
1217 + /* set polarity */
1218 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
1219 + *wakeup_status_reg |= (wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
1221 + *wakeup_status_reg &= ~(wakeup_int << AVALANCHE_WAKEUP_POLARITY_BIT);
1224 +void avalanche_set_vbus_freq(unsigned int new_vbus_freq)
1226 + avalanche_vbus_freq = new_vbus_freq;
1229 +unsigned int avalanche_get_vbus_freq()
1231 + return(avalanche_vbus_freq);
1234 +unsigned int avalanche_get_chip_version_info()
1236 + return(*(volatile unsigned int*)AVALANCHE_CVR);
1239 +SET_MDIX_ON_CHIP_FN_T p_set_mdix_on_chip_fn = NULL;
1241 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation)
1243 + if(p_set_mdix_on_chip_fn)
1244 + return (p_set_mdix_on_chip_fn(base_addr, operation));
1249 +unsigned int avalanche_is_mdix_on_chip(void)
1251 + return(p_set_mdix_on_chip_fn ? 1:0);
1254 +EXPORT_SYMBOL(avalanche_reset_ctrl);
1255 +EXPORT_SYMBOL(avalanche_get_reset_status);
1256 +EXPORT_SYMBOL(avalanche_sys_reset);
1257 +EXPORT_SYMBOL(avalanche_get_sys_last_reset_status);
1258 +EXPORT_SYMBOL(avalanche_power_ctrl);
1259 +EXPORT_SYMBOL(avalanche_get_power_status);
1260 +EXPORT_SYMBOL(avalanche_set_global_power_mode);
1261 +EXPORT_SYMBOL(avalanche_get_global_power_mode);
1262 +EXPORT_SYMBOL(avalanche_set_mdix_on_chip);
1263 +EXPORT_SYMBOL(avalanche_is_mdix_on_chip);
1265 +EXPORT_SYMBOL(avalanche_gpio_init);
1266 +EXPORT_SYMBOL(avalanche_gpio_ctrl);
1267 +EXPORT_SYMBOL(avalanche_gpio_out_bit);
1268 +EXPORT_SYMBOL(avalanche_gpio_in_bit);
1269 +EXPORT_SYMBOL(avalanche_gpio_out_value);
1270 +EXPORT_SYMBOL(avalanche_gpio_in_value);
1272 +EXPORT_SYMBOL(avalanche_set_vbus_freq);
1273 +EXPORT_SYMBOL(avalanche_get_vbus_freq);
1275 +EXPORT_SYMBOL(avalanche_get_chip_version_info);
1277 diff -urN linux.old/arch/mips/ar7/platform.h linux.dev/arch/mips/ar7/platform.h
1278 --- linux.old/arch/mips/ar7/platform.h 1970-01-01 01:00:00.000000000 +0100
1279 +++ linux.dev/arch/mips/ar7/platform.h 2005-11-10 01:10:45.799571750 +0100
1281 +#ifndef _PLATFORM_H_
1282 +#define _PLATFORM_H_
1284 +#include <linux/config.h>
1287 +/* Important: The definition of ENV_SPACE_SIZE should match with that in
1288 + * PSPBoot. (/psp_boot/inc/psbl/env.h)
1290 +#ifdef CONFIG_MIPS_AVALANCHE_TICFG
1291 +#define ENV_SPACE_SIZE (10 * 1024)
1294 +#ifdef CONFIG_MIPS_TNETV1050SDB
1295 +#define TNETV1050SDB
1299 +#ifdef CONFIG_MIPS_AR7DB
1300 +#define TNETD73XX_BOARD
1304 +#ifdef CONFIG_MIPS_AR7RD
1305 +#define TNETD73XX_BOARD
1309 +#ifdef CONFIG_AR7WRD
1310 +#define TNETD73XX_BOARD
1314 +#ifdef CONFIG_MIPS_AR7VWI
1315 +#define TNETD73XX_BOARD
1319 +/* Merging from the DEV_DSL-PSPL4.3.2.7_Patch release. */
1320 +#ifdef CONFIG_MIPS_AR7VW
1321 +#define TNETD73XX_BOARD
1325 +#ifdef CONFIG_MIPS_AR7WI
1326 +#define TNETD73XX_BOARD
1330 +#ifdef CONFIG_MIPS_AR7V
1331 +#define TNETD73XX_BOARD
1335 +#ifdef CONFIG_MIPS_AR7V
1336 +#define TNETD73XX_BOARD
1340 +#ifdef CONFIG_MIPS_WA1130
1346 diff -urN linux.old/arch/mips/ar7/promlib.c linux.dev/arch/mips/ar7/promlib.c
1347 --- linux.old/arch/mips/ar7/promlib.c 1970-01-01 01:00:00.000000000 +0100
1348 +++ linux.dev/arch/mips/ar7/promlib.c 2005-11-10 01:14:16.372731750 +0100
1351 + * Carsten Langgaard, carstenl@mips.com
1352 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1354 + * This program is free software; you can distribute it and/or modify it
1355 + * under the terms of the GNU General Public License (Version 2) as
1356 + * published by the Free Software Foundation.
1358 + * This program is distributed in the hope it will be useful, but WITHOUT
1359 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1360 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1361 + * for more details.
1363 + * You should have received a copy of the GNU General Public License along
1364 + * with this program; if not, write to the Free Software Foundation, Inc.,
1365 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1367 + * Putting things on the screen/serial line using Adam2 facilities.
1370 +#include <linux/types.h>
1371 +#include <asm/addrspace.h>
1373 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
1374 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR \
1375 + (AVALANCHE_YAMON_FUNCTION_BASE + 1 * 0x4)
1376 +#define AVALANCHE_YAMON_PROM_EXIT \
1377 + (AVALANCHE_YAMON_FUNCTION_BASE + 8 * 0x4)
1379 +void prom_putchar(char c)
1381 + static char buf[1];
1382 + void (*prom_print_str)(unsigned int dummy, char *s, int len) =
1383 + (void *)(*(uint32_t *)AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR);
1386 + prom_print_str(1, buf, 1);
1390 +void adam2_exit(int retval)
1392 + void (*yamon_exit)(int retval) =
1393 + (void *)(*(uint32_t *)AVALANCHE_YAMON_PROM_EXIT);
1395 + yamon_exit(retval);
1398 diff -urN linux.old/arch/mips/ar7/psp_env.c linux.dev/arch/mips/ar7/psp_env.c
1399 --- linux.old/arch/mips/ar7/psp_env.c 1970-01-01 01:00:00.000000000 +0100
1400 +++ linux.dev/arch/mips/ar7/psp_env.c 2005-11-10 01:10:45.799571750 +0100
1402 +#include <linux/config.h>
1403 +#include <linux/init.h>
1404 +#include <linux/string.h>
1405 +#include <linux/kernel.h>
1406 +#include <linux/module.h>
1407 +#include <asm/io.h>
1409 +#include "platform.h"
1411 +#define ENV_CELL_SIZE 16
1413 +/* control field decode */
1414 +#define ENV_GARBAGE_BIT 0x01 /* Env is garbage if this bit is off */
1415 +#define ENV_DYNAMIC_BIT 0x02 /* Env is dynamic if this bit is off */
1417 +#define ENV_CTRL_MASK 0x03
1418 +#define ENV_PREFINED (ENV_GARBAGE_BIT | ENV_DYNAMIC_BIT)
1419 +#define ENV_DYNAMIC (ENV_GARBAGE_BIT)
1421 +struct env_variable {
1422 + unsigned char varNum;
1423 + unsigned char ctrl;
1424 + unsigned short chksum;
1425 + unsigned char numCells;
1426 + unsigned char data[ENV_CELL_SIZE - 5]; /* The data section starts
1427 + * here, continues for
1432 +extern unsigned int max_env_entry;
1434 +/* Internal macros */
1435 +#define get_next_block(var) ((struct env_variable *)( (char*)(var) + (var)->numCells * ENV_CELL_SIZE))
1437 +typedef enum ENV_VARS {
1438 + env_vars_start = 0,
1447 +#if !defined (AVALANCHE) || defined(TNETC401B)
1450 +#if !defined(TNETV1020_BOARD)
1453 +#if defined (TNETD73XX_BOARD)
1459 +#if !defined (AVALANCHE) || defined(TNETC401B)
1462 +#if !defined(TNETV1020_BOARD)
1465 +#if defined (TNETD73XX_BOARD)
1468 +#if !defined(TNETV1020_BOARD)
1475 +#if defined (TNETV1050_BOARD)
1478 +#if !defined(TNETV1020_BOARD)
1480 + HWA_HRNDIS, /* Host (PC) side RNDIS address */
1487 +#ifndef AVALANCHE /* Avalanche boards use only one mac port */
1500 +#if defined (TNETV1050_BOARD)
1504 + * Add new env variables here.
1505 + * NOTE: New environment variables should always be placed at the end, ie
1506 + * just before env_vars_end.
1513 +struct env_description {
1519 +#define ENVSTR(x) #x
1520 +#define _ENV_ENTRY(x) {.idx = x, .nm = ENVSTR(x), .alias = NULL}
1522 +struct env_description env_ns[] = {
1523 + _ENV_ENTRY(env_vars_start), /* start. */
1524 + _ENV_ENTRY(CPUFREQ),
1525 + _ENV_ENTRY(MEMSZ),
1526 + _ENV_ENTRY(FLASHSZ),
1527 + _ENV_ENTRY(MODETTY0),
1528 + _ENV_ENTRY(MODETTY1),
1529 + _ENV_ENTRY(PROMPT),
1530 + _ENV_ENTRY(BOOTCFG),
1531 + _ENV_ENTRY(HWA_0),
1532 +#if !defined (AVALANCHE) || defined(TNETC401B)
1533 + _ENV_ENTRY(HWA_1),
1535 +#if !defined(TNETV1020_BOARD)
1536 + _ENV_ENTRY(HWA_RNDIS),
1538 +#if defined (TNETD73XX_BOARD)
1539 + _ENV_ENTRY(HWA_3),
1542 + _ENV_ENTRY(IPA_SVR),
1543 + _ENV_ENTRY(IPA_GATEWAY),
1544 + _ENV_ENTRY(SUBNET_MASK),
1545 + _ENV_ENTRY(BLINE_MAC0),
1546 +#if !defined (AVALANCHE) || defined(TNETC401B)
1547 + _ENV_ENTRY(BLINE_MAC1),
1549 +#if !defined(TNETV1020_BOARD)
1550 + _ENV_ENTRY(BLINE_RNDIS),
1552 +#if defined (TNETD73XX_BOARD)
1553 + _ENV_ENTRY(BLINE_ATM),
1555 +#if !defined(TNETV1020_BOARD)
1556 + _ENV_ENTRY(USB_PID),
1557 + _ENV_ENTRY(USB_VID),
1558 + _ENV_ENTRY(USB_EPPOLLI),
1560 +#if defined (TNETV1050_BOARD)
1561 + _ENV_ENTRY(BLINE_ESWITCH),
1563 +#if !defined(TNETV1020_BOARD)
1564 + _ENV_ENTRY(USB_SERIAL),
1565 + _ENV_ENTRY(HWA_HRNDIS),
1567 + _ENV_ENTRY(REMOTE_USER),
1568 + _ENV_ENTRY(REMOTE_PASS),
1569 + _ENV_ENTRY(REMOTE_DIR),
1570 + _ENV_ENTRY(SYSFREQ),
1571 + _ENV_ENTRY(LINK_TIMEOUT),
1572 +#ifndef AVALANCHE /* Avalanche boards use only one mac port */
1573 + _ENV_ENTRY(MAC_PORT),
1576 + _ENV_ENTRY(HOSTNAME),
1578 + _ENV_ENTRY(HW_REV_MAJOR),
1579 + _ENV_ENTRY(HW_REV_MINOR),
1580 + _ENV_ENTRY(HW_PATCH),
1581 + _ENV_ENTRY(SW_PATCH),
1582 + _ENV_ENTRY(SERIAL_NUMBER),
1584 + _ENV_ENTRY(TFTPCFG),
1585 +#if defined (TNETV1050_BOARD)
1586 + _ENV_ENTRY(HWA_ESWITCH),
1589 + * Add new entries below this.
1591 + /* Adam2 environment name alias. */
1592 + { .idx = IPA, .nm = "my_ipaddress" },
1593 + { .idx = CPUFREQ, .nm = "cpufrequency" },
1594 + { .idx = SYSFREQ, .nm = "sysfrequency" },
1595 + { .idx = HWA_0, .nm = "maca" },
1597 + { .idx = HWA_1, .nm = "macb" },
1599 + { .idx = MODETTY0, .nm = "modetty0" },
1600 + { .idx = MODETTY1, .nm = "modetty1" },
1601 + { .idx = MEMSZ, .nm = "memsize" },
1603 + _ENV_ENTRY(env_vars_end) /* delimiter. */
1606 +static inline int var_to_idx(const char* var)
1610 + /* go over the list of pre-defined environment variables */
1611 + for (ii = env_vars_start; env_ns[ii].idx != env_vars_end; ii++){
1612 + /* check if the env variable is listed */
1613 + if (strcmp(env_ns[ii].nm, var) == 0) {
1614 + return env_ns[ii].idx;
1617 + /* if an alias is present, check if the alias matches
1620 + if (env_ns[ii].alias != NULL) {
1621 + if (strcmp(env_ns[ii].alias, var) == 0) {
1622 + return env_ns[ii].idx;
1629 +extern int *_prom_envp;
1631 +/* FIXME: reading from the flash is extremly unstable. Sometime a read returns garbage,
1632 + * the next read some seconds later is ok. It looks like something is hidding or
1633 + * overlay the flash address at 0xb0000000. Is this possible?
1635 + * The readb() and while() usage below is a attempt of a workarround - with limited success.
1638 +static inline struct env_variable* get_var_by_number(int index)
1640 + struct env_variable *env_var = (struct env_variable *)_prom_envp;
1641 + volatile unsigned char nr;
1644 + env_var++; /* skip signature */
1647 + nr = readb(&(env_var->varNum));
1649 + while (i < max_env_entry && nr != 0xFF) {
1650 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_PREFINED) {
1651 + if (nr == index) {
1656 + env_var = get_next_block(env_var);
1657 + nr = readb(&(env_var->varNum));
1663 +static inline struct env_variable* get_var_by_name(char *var)
1665 + struct env_variable *env_var = (struct env_variable *)_prom_envp;
1666 + volatile unsigned char nr;
1669 + env_var++; /* skip signature */
1671 + nr = readb(&(env_var->varNum));
1674 + while (i < max_env_entry && nr != 0xFF) {
1675 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_DYNAMIC) {
1676 + if (strcmp(var, env_var->data) == 0)
1680 + env_var = get_next_block(env_var);
1681 + nr = readb(&(env_var->varNum));
1686 +static inline struct env_variable* get_var(char *var)
1688 + int index = var_to_idx(var);
1691 + return get_var_by_number(index);
1693 + return get_var_by_name(var);
1698 +static inline char *get_value(struct env_variable* env_var)
1700 + unsigned char *name;
1701 + unsigned char *value;
1702 + unsigned short chksum;
1705 + chksum = env_var->varNum + env_var->ctrl + env_var->numCells;
1707 + if ((env_var->ctrl & ENV_CTRL_MASK) == ENV_DYNAMIC) {
1708 + name = env_var->data;
1709 + value = env_var->data + strlen(name) + 1;
1711 + for(i = 0; i < strlen(name); i++)
1712 + chksum += name[i];
1714 + value = env_var->data;
1716 + for (i = 0; i < strlen(value); i++)
1717 + chksum += value[i];
1719 + chksum += env_var->chksum;
1720 + chksum = ~(chksum);
1730 + unsigned int psbl_size;
1731 + unsigned int env_base;
1732 + unsigned int env_size;
1733 + unsigned int ffs_base;
1734 + unsigned int ffs_size;
1737 +char *prom_psp_getenv(char *envname)
1739 + struct env_variable* env_var;
1742 + if (strcmp("bootloader", envname) == 0)
1745 + if (!(env_var = get_var(envname)))
1748 + value = get_value(env_var);
1752 diff -urN linux.old/arch/mips/ar7/reset.c linux.dev/arch/mips/ar7/reset.c
1753 --- linux.old/arch/mips/ar7/reset.c 1970-01-01 01:00:00.000000000 +0100
1754 +++ linux.dev/arch/mips/ar7/reset.c 2005-11-10 01:14:16.372731750 +0100
1757 + * Carsten Langgaard, carstenl@mips.com
1758 + * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
1760 + * ########################################################################
1762 + * This program is free software; you can distribute it and/or modify it
1763 + * under the terms of the GNU General Public License (Version 2) as
1764 + * published by the Free Software Foundation.
1766 + * This program is distributed in the hope it will be useful, but WITHOUT
1767 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1768 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1769 + * for more details.
1771 + * You should have received a copy of the GNU General Public License along
1772 + * with this program; if not, write to the Free Software Foundation, Inc.,
1773 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1775 + * ########################################################################
1777 + * Reset the AR7 boards.
1781 +#include <linux/init.h>
1782 +#include <linux/kernel.h>
1783 +#include <linux/string.h>
1784 +#include <linux/types.h>
1786 +#include <asm/mipsregs.h>
1787 +#include <asm/reboot.h>
1788 +#include <asm/addrspace.h>
1790 +int preserve_adam2 = 1;
1792 +extern void adam2_exit(int retval);
1794 +static void ar7_machine_restart(char *command);
1795 +static void ar7_machine_halt(void);
1796 +static void ar7_machine_power_off(void);
1798 +static void ar7_machine_restart(char *command)
1800 + volatile uint32_t *softres_reg = (void *)(KSEG1ADDR(0x08611600 + 0x4));
1805 +static void ar7_machine_halt(void)
1808 + if (preserve_adam2) {
1809 + set_c0_status(ST0_BEV);
1812 + /* I'd like to have Alt-SysRq-b work in this state.
1813 + * What's missing here? The timer interrupt is still running.
1814 + * Why doesn't the UART work anymore? */
1816 + __asm__(".set\tmips3\n\t"
1823 +static void ar7_machine_power_off(void)
1825 + volatile uint32_t *power_reg = (void *)(KSEG1ADDR(0x08610A00));
1826 + uint32_t power_state = *power_reg;
1828 + /* add something to turn LEDs off? */
1830 + power_state &= ~(3 << 30);
1831 + power_state |= (3 << 30); /* power down */
1832 + *power_reg = power_state;
1834 + printk("after power down?\n");
1837 +void ar7_reboot_setup(void)
1839 + _machine_restart = ar7_machine_restart;
1840 + _machine_halt = ar7_machine_halt;
1841 + _machine_power_off = ar7_machine_power_off;
1844 +static int __init ar7_do_preserve_adam2(char *s)
1846 + if (!strcmp(s, "no") || !strcmp(s, "0"))
1847 + preserve_adam2 = 0;
1849 + preserve_adam2 = 1;
1853 +__setup("adam2=", ar7_do_preserve_adam2);
1854 diff -urN linux.old/arch/mips/ar7/setup.c linux.dev/arch/mips/ar7/setup.c
1855 --- linux.old/arch/mips/ar7/setup.c 1970-01-01 01:00:00.000000000 +0100
1856 +++ linux.dev/arch/mips/ar7/setup.c 2005-11-10 01:12:43.946955500 +0100
1859 + * Carsten Langgaard, carstenl@mips.com
1860 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
1862 + * This program is free software; you can distribute it and/or modify it
1863 + * under the terms of the GNU General Public License (Version 2) as
1864 + * published by the Free Software Foundation.
1866 + * This program is distributed in the hope it will be useful, but WITHOUT
1867 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1868 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1869 + * for more details.
1871 + * You should have received a copy of the GNU General Public License along
1872 + * with this program; if not, write to the Free Software Foundation, Inc.,
1873 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1876 +#include <linux/config.h>
1877 +#include <linux/init.h>
1878 +#include <linux/string.h>
1879 +#include <linux/irq.h>
1881 +#include <asm/processor.h>
1882 +#include <asm/irq.h>
1883 +#include <asm/irq_cpu.h>
1884 +#include <asm/time.h>
1885 +#include <asm/mipsregs.h>
1886 +#include <asm/mips-boards/prom.h>
1889 +extern void rs_kgdb_hook(int);
1890 +extern void breakpoint(void);
1891 +int remote_debug = 0;
1894 +extern void ar7_reboot_setup(void);
1895 +extern void ar7_irq_init(int);
1896 +extern asmlinkage void ar7IRQ(void);
1898 +void ar7_time_init(void)
1901 + mips_hpt_frequency = CONFIG_AR7_CPU * 500000;
1904 +void ar7_timer_setup(struct irqaction *irq)
1906 + setup_irq(7, irq);
1907 + set_c0_status(IE_IRQ5);
1910 +void __init init_IRQ(void)
1912 + init_generic_irq();
1913 + mips_cpu_irq_init(0);
1916 + /* Now safe to set the exception vector. */
1917 + set_except_vector(0, ar7IRQ);
1922 + set_debug_traps();
1928 +const char *get_system_type(void)
1930 + return "Texas Instruments AR7";
1933 +void __init ar7_setup(void)
1936 + int rs_putDebugChar(char);
1937 + char rs_getDebugChar(void);
1938 + extern int (*generic_putDebugChar)(char);
1939 + extern char (*generic_getDebugChar)(void);
1942 +#ifdef CONFIG_SERIAL_CONSOLE
1943 + argptr = prom_getcmdline();
1944 + if ((argptr = strstr(argptr, "console=")) == NULL) {
1949 + s = prom_getenv("modetty0");
1950 + strcpy(console, "38400");
1953 + while (s[i] >= '0' && s[i] <= '9')
1957 + strncpy(console, s, i);
1962 + argptr = prom_getcmdline();
1963 + strcat(argptr, " console=ttyS0,");
1964 + strcat(argptr, console);
1969 + argptr = prom_getcmdline();
1970 + if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
1972 + argptr += strlen("kgdb=ttyS");
1973 + if (*argptr != '0' && *argptr != '1')
1974 + printk("KGDB: Uknown serial line /dev/ttyS%c, "
1975 + "falling back to /dev/ttyS1\n", *argptr);
1976 + line = *argptr == '0' ? 0 : 1;
1977 + printk("KGDB: Using serial line /dev/ttyS%d for session\n",
1980 + rs_kgdb_hook(line);
1981 + generic_putDebugChar = rs_putDebugChar;
1982 + generic_getDebugChar = rs_getDebugChar;
1984 + prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
1985 + "please connect your debugger\n", line ? 1 : 0);
1988 + /* Breakpoints are in init_IRQ() */
1992 + argptr = prom_getcmdline();
1993 + if ((argptr = strstr(argptr, "nofpu")) != NULL)
1994 + cpu_data[0].options &= ~MIPS_CPU_FPU;
1996 + ar7_reboot_setup();
1998 + board_time_init = ar7_time_init;
1999 + board_timer_setup = ar7_timer_setup;
2001 diff -urN linux.old/arch/mips/ar7/tnetd73xx_misc.c linux.dev/arch/mips/ar7/tnetd73xx_misc.c
2002 --- linux.old/arch/mips/ar7/tnetd73xx_misc.c 1970-01-01 01:00:00.000000000 +0100
2003 +++ linux.dev/arch/mips/ar7/tnetd73xx_misc.c 2005-11-10 01:12:43.946955500 +0100
2005 +/******************************************************************************
2006 + * FILE PURPOSE: TNETD73xx Misc modules API Source
2007 + ******************************************************************************
2008 + * FILE NAME: tnetd73xx_misc.c
2010 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
2011 + * FSER Modules API
2012 + * As per TNETD73xx specifications
2014 + * REVISION HISTORY:
2015 + * 27 Nov 02 - Sharath Kumar PSP TII
2016 + * 14 Feb 03 - Anant Gole PSP TII
2018 + * (C) Copyright 2002, Texas Instruments, Inc
2019 + *******************************************************************************/
2021 +#include <linux/types.h>
2022 +#include <asm/ar7/tnetd73xx.h>
2023 +#include <asm/ar7/tnetd73xx_misc.h>
2025 +/* TNETD73XX Revision */
2026 +u32 tnetd73xx_get_revision(void)
2028 + /* Read Chip revision register - This register is from GPIO module */
2029 + return ( (u32) REG32_DATA(TNETD73XX_CVR));
2032 +/*****************************************************************************
2033 + * Reset Control Module
2034 + *****************************************************************************/
2037 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module, TNETD73XX_RESET_CTRL_T reset_ctrl)
2041 + /* read current reset register */
2042 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2044 + if (reset_ctrl == OUT_OF_RESET)
2046 + /* bring module out of reset */
2047 + reset_status |= (1 << reset_module);
2051 + /* put module in reset */
2052 + reset_status &= (~(1 << reset_module));
2055 + /* write to the reset register */
2056 + REG32_WRITE(TNETD73XX_RST_CTRL_PRCR, reset_status);
2060 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status (TNETD73XX_RESET_MODULE_T reset_module)
2064 + REG32_READ(TNETD73XX_RST_CTRL_PRCR, reset_status);
2065 + return ( (reset_status & (1 << reset_module)) ? OUT_OF_RESET : IN_RESET );
2068 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode)
2070 + REG32_WRITE(TNETD73XX_RST_CTRL_SWRCR, mode);
2073 +#define TNETD73XX_RST_CTRL_RSR_MASK 0x3
2075 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status()
2077 + u32 sys_reset_status;
2079 + REG32_READ(TNETD73XX_RST_CTRL_RSR, sys_reset_status);
2081 + return ( (TNETD73XX_SYS_RESET_STATUS_T) (sys_reset_status & TNETD73XX_RST_CTRL_RSR_MASK) );
2085 +/*****************************************************************************
2086 + * Power Control Module
2087 + *****************************************************************************/
2088 +#define TNETD73XX_GLOBAL_POWER_DOWN_MASK 0x3FFFFFFF /* bit 31, 30 masked */
2089 +#define TNETD73XX_GLOBAL_POWER_DOWN_BIT 30 /* shift to bit 30, 31 */
2092 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl)
2096 + /* read current power down control register */
2097 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2099 + if (power_ctrl == POWER_CTRL_POWER_DOWN)
2101 + /* power down the module */
2102 + power_status |= (1 << power_module);
2106 + /* power on the module */
2107 + power_status &= (~(1 << power_module));
2110 + /* write to the reset register */
2111 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2114 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module)
2118 + /* read current power down control register */
2119 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2121 + return ( (power_status & (1 << power_module)) ? POWER_CTRL_POWER_DOWN : POWER_CTRL_POWER_UP );
2124 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode)
2128 + /* read current power down control register */
2129 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2131 + power_status &= TNETD73XX_GLOBAL_POWER_DOWN_MASK;
2132 + power_status |= ( power_mode << TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2134 + /* write to power down control register */
2135 + REG32_WRITE(TNETD73XX_POWER_CTRL_PDCR, power_status);
2138 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode()
2142 + /* read current power down control register */
2143 + REG32_READ(TNETD73XX_POWER_CTRL_PDCR, power_status);
2145 + power_status &= (~TNETD73XX_GLOBAL_POWER_DOWN_MASK);
2146 + power_status = ( power_status >> TNETD73XX_GLOBAL_POWER_DOWN_BIT);
2148 + return ( (TNETD73XX_SYS_POWER_MODE_T) power_status );
2152 +/*****************************************************************************
2154 + *****************************************************************************/
2156 +#define TNETD73XX_WAKEUP_POLARITY_BIT 16
2158 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
2159 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
2160 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity)
2162 + u32 wakeup_status;
2164 + /* read the wakeup control register */
2165 + REG32_READ(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2167 + /* enable/disable */
2168 + if (wakeup_ctrl == WAKEUP_ENABLED)
2170 + /* enable wakeup */
2171 + wakeup_status |= wakeup_int;
2175 + /* disable wakeup */
2176 + wakeup_status &= (~wakeup_int);
2179 + /* set polarity */
2180 + if (wakeup_polarity == WAKEUP_ACTIVE_LOW)
2182 + wakeup_status |= (wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2186 + wakeup_status &= ~(wakeup_int << TNETD73XX_WAKEUP_POLARITY_BIT);
2189 + /* write the wakeup control register */
2190 + REG32_WRITE(TNETD73XX_POWER_CTRL_WKCR, wakeup_status);
2194 +/*****************************************************************************
2196 + *****************************************************************************/
2198 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode)
2200 + REG32_WRITE(TNETD73XX_FSER_BASE, fser_mode);
2203 +/*****************************************************************************
2205 + *****************************************************************************/
2207 +#define MIN(x,y) ( ((x) < (y)) ? (x) : (y) )
2208 +#define MAX(x,y) ( ((x) > (y)) ? (x) : (y) )
2209 +#define ABS(x) ( ((signed)(x) > 0) ? (x) : (-(x)) )
2210 +#define CEIL(x,y) ( ((x) + (y) / 2) / (y) )
2212 +#define CLKC_CLKCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x20 + (0x20 * (x)))
2213 +#define CLKC_CLKPLLCR(x) (TNETD73XX_CLOCK_CTRL_BASE + 0x30 + (0x20 * (x)))
2215 +#define CLKC_PRE_DIVIDER 0x0000001F
2216 +#define CLKC_POST_DIVIDER 0x001F0000
2218 +#define CLKC_PLL_STATUS 0x1
2219 +#define CLKC_PLL_FACTOR 0x0000F000
2221 +#define BOOTCR_PLL_BYPASS (1 << 5)
2222 +#define BOOTCR_MIPS_ASYNC_MODE (1 << 25)
2224 +#define MIPS_PLL_SELECT 0x00030000
2225 +#define SYSTEM_PLL_SELECT 0x0000C000
2226 +#define USB_PLL_SELECT 0x000C0000
2227 +#define ADSLSS_PLL_SELECT 0x00C00000
2229 +#define MIPS_AFECLKI_SELECT 0x00000000
2230 +#define MIPS_REFCLKI_SELECT 0x00010000
2231 +#define MIPS_XTAL3IN_SELECT 0x00020000
2233 +#define SYSTEM_AFECLKI_SELECT 0x00000000
2234 +#define SYSTEM_REFCLKI_SELECT 0x00004000
2235 +#define SYSTEM_XTAL3IN_SELECT 0x00008000
2236 +#define SYSTEM_MIPSPLL_SELECT 0x0000C000
2238 +#define USB_SYSPLL_SELECT 0x00000000
2239 +#define USB_REFCLKI_SELECT 0x00040000
2240 +#define USB_XTAL3IN_SELECT 0x00080000
2241 +#define USB_MIPSPLL_SELECT 0x000C0000
2243 +#define ADSLSS_AFECLKI_SELECT 0x00000000
2244 +#define ADSLSS_REFCLKI_SELECT 0x00400000
2245 +#define ADSLSS_XTAL3IN_SELECT 0x00800000
2246 +#define ADSLSS_MIPSPLL_SELECT 0x00C00000
2248 +#define SYS_MAX CLK_MHZ(150)
2249 +#define SYS_MIN CLK_MHZ(1)
2251 +#define MIPS_SYNC_MAX SYS_MAX
2252 +#define MIPS_ASYNC_MAX CLK_MHZ(160)
2253 +#define MIPS_MIN CLK_MHZ(1)
2255 +#define USB_MAX CLK_MHZ(100)
2256 +#define USB_MIN CLK_MHZ(1)
2258 +#define ADSL_MAX CLK_MHZ(180)
2259 +#define ADSL_MIN CLK_MHZ(1)
2261 +#define PLL_MUL_MAXFACTOR 15
2262 +#define MAX_DIV_VALUE 32
2263 +#define MIN_DIV_VALUE 1
2265 +#define MIN_PLL_INP_FREQ CLK_MHZ(8)
2266 +#define MAX_PLL_INP_FREQ CLK_MHZ(100)
2268 +#define DIVIDER_LOCK_TIME 10100
2269 +#define PLL_LOCK_TIME 10100 * 75
2273 + /****************************************************************************
2274 + * DATA PURPOSE: PRIVATE Variables
2275 + **************************************************************************/
2276 + static u32 *clk_src[4];
2277 + static u32 mips_pll_out;
2278 + static u32 sys_pll_out;
2279 + static u32 afeclk_inp;
2280 + static u32 refclk_inp;
2281 + static u32 xtal_inp;
2282 + static u32 present_min;
2283 + static u32 present_max;
2285 + /* Forward References */
2286 + static u32 find_gcd(u32 min, u32 max);
2287 + static u32 compute_prediv( u32 divider, u32 min, u32 max);
2288 + static void get_val(u32 base_freq, u32 output_freq,u32 *multiplier, u32 *divider);
2289 + static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id);
2290 + static void find_approx(u32 *,u32 *,u32);
2292 + /****************************************************************************
2293 + * FUNCTION: tnetd73xx_clkc_init
2294 + ****************************************************************************
2295 + * Description: The routine initializes the internal variables depending on
2296 + * on the sources selected for different clocks.
2297 + ***************************************************************************/
2298 +void tnetd73xx_clkc_init(u32 afeclk, u32 refclk, u32 xtal3in)
2303 + afeclk_inp = afeclk;
2304 + refclk_inp = refclk;
2305 + xtal_inp = xtal3in;
2307 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & MIPS_PLL_SELECT;
2310 + case MIPS_AFECLKI_SELECT:
2311 + clk_src[CLKC_MIPS] = &afeclk_inp;
2314 + case MIPS_REFCLKI_SELECT:
2315 + clk_src[CLKC_MIPS] = &refclk_inp;
2318 + case MIPS_XTAL3IN_SELECT:
2319 + clk_src[CLKC_MIPS] = &xtal_inp;
2323 + clk_src[CLKC_MIPS] = 0;
2327 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & SYSTEM_PLL_SELECT;
2330 + case SYSTEM_AFECLKI_SELECT:
2331 + clk_src[CLKC_SYS] = &afeclk_inp;
2334 + case SYSTEM_REFCLKI_SELECT:
2335 + clk_src[CLKC_SYS] = &refclk_inp;
2338 + case SYSTEM_XTAL3IN_SELECT:
2339 + clk_src[CLKC_SYS] = &xtal_inp;
2342 + case SYSTEM_MIPSPLL_SELECT:
2343 + clk_src[CLKC_SYS] = &mips_pll_out;
2347 + clk_src[CLKC_SYS] = 0;
2352 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & ADSLSS_PLL_SELECT;
2355 + case ADSLSS_AFECLKI_SELECT:
2356 + clk_src[CLKC_ADSLSS] = &afeclk_inp;
2359 + case ADSLSS_REFCLKI_SELECT:
2360 + clk_src[CLKC_ADSLSS] = &refclk_inp;
2363 + case ADSLSS_XTAL3IN_SELECT:
2364 + clk_src[CLKC_ADSLSS] = &xtal_inp;
2367 + case ADSLSS_MIPSPLL_SELECT:
2368 + clk_src[CLKC_ADSLSS] = &mips_pll_out;
2372 + clk_src[CLKC_ADSLSS] = 0;
2377 + choice = REG32_DATA(TNETD73XX_DCL_BOOTCR) & USB_PLL_SELECT;
2380 + case USB_SYSPLL_SELECT:
2381 + clk_src[CLKC_USB] = &sys_pll_out ;
2384 + case USB_REFCLKI_SELECT:
2385 + clk_src[CLKC_USB] = &refclk_inp;
2388 + case USB_XTAL3IN_SELECT:
2389 + clk_src[CLKC_USB] = &xtal_inp;
2392 + case USB_MIPSPLL_SELECT:
2393 + clk_src[CLKC_USB] = &mips_pll_out;
2397 + clk_src[CLKC_USB] = 0;
2404 +/****************************************************************************
2405 + * FUNCTION: tnetd73xx_clkc_set_freq
2406 + ****************************************************************************
2407 + * Description: The above routine is called to set the output_frequency of the
2408 + * selected clock(using clk_id) to the required value given
2409 + * by the variable output_freq.
2410 + ***************************************************************************/
2411 +TNETD73XX_ERR tnetd73xx_clkc_set_freq
2413 + TNETD73XX_CLKC_ID_T clk_id,
2426 + /* check if PLLs are bypassed*/
2427 + if(REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS)
2429 + return TNETD73XX_ERR_ERROR;
2432 + /*check if the requested output_frequency is in valid range*/
2436 + if( output_freq < SYS_MIN || output_freq > SYS_MAX)
2438 + return TNETD73XX_ERR_ERROR;
2440 + present_min = SYS_MIN;
2441 + present_max = SYS_MAX;
2445 + if((output_freq < MIPS_MIN) ||
2446 + (output_freq > ((REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX)))
2448 + return TNETD73XX_ERR_ERROR;
2450 + present_min = MIPS_MIN;
2451 + present_max = (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_MIPS_ASYNC_MODE) ? MIPS_ASYNC_MAX: MIPS_SYNC_MAX;
2455 + if( output_freq < USB_MIN || output_freq > USB_MAX)
2457 + return TNETD73XX_ERR_ERROR;
2459 + present_min = USB_MIN;
2460 + present_max = USB_MAX;
2464 + if( output_freq < ADSL_MIN || output_freq > ADSL_MAX)
2466 + return TNETD73XX_ERR_ERROR;
2468 + present_min = ADSL_MIN;
2469 + present_max = ADSL_MAX;
2474 + base_freq = get_base_frequency(clk_id);
2477 + /* check for minimum base frequency value */
2478 + if( base_freq < MIN_PLL_INP_FREQ)
2480 + return TNETD73XX_ERR_ERROR;
2483 + get_val(output_freq, base_freq, &multiplier, ÷r);
2485 + /* check multiplier range */
2486 + if( (multiplier > PLL_MUL_MAXFACTOR) || (multiplier <= 0) )
2488 + return TNETD73XX_ERR_ERROR;
2491 + /* check divider value */
2492 + if( divider == 0 )
2494 + return TNETD73XX_ERR_ERROR;
2497 + /*compute minimum and maximum predivider values */
2498 + min_prediv = MAX(base_freq / MAX_PLL_INP_FREQ + 1, divider / MAX_DIV_VALUE + 1);
2499 + max_prediv = MIN(base_freq / MIN_PLL_INP_FREQ, MAX_DIV_VALUE);
2501 + /*adjust the value of divider so that it not less than minimum predivider value*/
2502 + if (divider < min_prediv)
2504 + temp = CEIL(min_prediv, divider);
2505 + if ((temp * multiplier) > PLL_MUL_MAXFACTOR)
2507 + return TNETD73XX_ERR_ERROR ;
2511 + multiplier = temp * multiplier;
2512 + divider = min_prediv;
2517 + /* compute predivider and postdivider values */
2518 + prediv = compute_prediv (divider, min_prediv, max_prediv);
2519 + postdiv = CEIL(divider,prediv);
2521 + /*return fail if postdivider value falls out of range */
2522 + if(postdiv > MAX_DIV_VALUE)
2524 + return TNETD73XX_ERR_ERROR;
2528 + /*write predivider and postdivider values*/
2529 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2530 + REG32_WRITE(CLKC_CLKCR(clk_id), ((postdiv -1) & 0x1F) << 16 | ((prediv -1) & 0x1F) );
2532 + /*wait for divider output to stabilise*/
2533 + for(temp =0; temp < DIVIDER_LOCK_TIME; temp++);
2535 + /*write to PLL clock register*/
2537 + if(clk_id == CLKC_SYS)
2539 + /* but before writing put DRAM to hold mode */
2540 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) |= 0x80000000;
2542 + /*Bring PLL into div mode */
2543 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), 0x4);
2545 + /*compute the word to be written to PLLCR
2546 + *corresponding to multiplier value
2548 + multiplier = (((multiplier - 1) & 0xf) << 12)| ((255 <<3) | 0x0e);
2550 + /* wait till PLL enters div mode */
2551 + while(REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2554 + REG32_WRITE(CLKC_CLKPLLCR(clk_id), multiplier);
2556 + while(!REG32_DATA(CLKC_CLKPLLCR(clk_id)) & CLKC_PLL_STATUS)
2560 + /*wait for External pll to lock*/
2561 + for(temp =0; temp < PLL_LOCK_TIME; temp++);
2563 + if(clk_id == CLKC_SYS)
2565 + /* Bring DRAM out of hold */
2566 + REG32_DATA(TNETD73XX_EMIF_SDRAM_CFG) &= ~0x80000000;
2569 + return TNETD73XX_ERR_OK ;
2572 +/****************************************************************************
2573 + * FUNCTION: tnetd73xx_clkc_get_freq
2574 + ****************************************************************************
2575 + * Description: The above routine is called to get the output_frequency of the
2576 + * selected clock( clk_id)
2577 + ***************************************************************************/
2578 +u32 tnetd73xx_clkc_get_freq
2580 + TNETD73XX_CLKC_ID_T clk_id
2584 + u32 clk_ctrl_register;
2585 + u32 clk_pll_setting;
2586 + u32 clk_predivider;
2587 + u32 clk_postdivider;
2592 + base_freq = get_base_frequency(clk_id);
2594 + clk_ctrl_register = REG32_DATA(CLKC_CLKCR(clk_id));
2596 + /* pre-Divider and post-divider are 5 bit N+1 dividers */
2597 + clk_predivider = (CLKC_PRE_DIVIDER & clk_ctrl_register) + 1;
2598 + clk_postdivider = ((CLKC_POST_DIVIDER & clk_ctrl_register) >> 16) + 1;
2600 + divider = clk_predivider * clk_postdivider;
2603 + if( (REG32_DATA(TNETD73XX_DCL_BOOTCR) & BOOTCR_PLL_BYPASS))
2605 + return (CEIL(base_freq, divider)); /* PLLs bypassed.*/
2611 + /* return the current clock speed based upon the PLL setting */
2612 + clk_pll_setting = REG32_DATA(CLKC_CLKPLLCR(clk_id));
2614 + /* Get the PLL multiplication factor */
2615 + pll_factor = ((clk_pll_setting & CLKC_PLL_FACTOR) >> 12) + 1;
2617 + /* Check if we're in divide mode or multiply mode */
2618 + if((clk_pll_setting & 0x1) == 0)
2620 + /* We're in divide mode */
2621 + if(pll_factor < 0x10)
2622 + return (CEIL(base_freq >> 1, divider));
2624 + return (CEIL(base_freq >> 2, divider));
2627 + else /* We're in PLL mode */
2629 + /* See if PLLNDIV & PLLDIV are set */
2630 + if((clk_pll_setting & 0x0800) && (clk_pll_setting & 0x2))
2632 + if(clk_pll_setting & 0x1000)
2634 + /* clk = base_freq * k/2 */
2635 + return(CEIL((base_freq * pll_factor) >> 1, divider));
2639 + /* clk = base_freq * (k-1) / 4)*/
2640 + return(CEIL((base_freq * (pll_factor - 1)) >>2, divider));
2645 + if(pll_factor < 0x10)
2647 + /* clk = base_freq * k */
2648 + return(CEIL(base_freq * pll_factor, divider));
2653 + /* clk = base_freq */
2654 + return(CEIL(base_freq, divider));
2658 + return(0); /* Should never reach here */
2665 +/* local helper functions */
2667 +/****************************************************************************
2668 + * FUNCTION: get_base_frequency
2669 + ****************************************************************************
2670 + * Description: The above routine is called to get base frequency of the clocks.
2671 + ***************************************************************************/
2673 +static u32 get_base_frequency(TNETD73XX_CLKC_ID_T clk_id)
2675 + /* update the current MIPs PLL output value, if the required
2676 + * source is MIPS PLL
2678 + if ( clk_src[clk_id] == &mips_pll_out)
2680 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_MIPS);
2684 + /* update the current System PLL output value, if the required
2685 + * source is system PLL
2687 + if ( clk_src[clk_id] == &sys_pll_out)
2689 + *clk_src[clk_id] = tnetd73xx_clkc_get_freq(CLKC_SYS);
2692 + return (*clk_src[clk_id]);
2698 +/****************************************************************************
2699 + * FUNCTION: find_gcd
2700 + ****************************************************************************
2701 + * Description: The above routine is called to find gcd of 2 numbers.
2702 + ***************************************************************************/
2703 +static u32 find_gcd
2709 + if (max % min == 0)
2715 + return find_gcd(max % min, min);
2719 +/****************************************************************************
2720 + * FUNCTION: compute_prediv
2721 + ****************************************************************************
2722 + * Description: The above routine is called to compute predivider value
2723 + ***************************************************************************/
2724 +static u32 compute_prediv(u32 divider, u32 min, u32 max)
2728 + /* return the divider itself it it falls within the range of predivider*/
2729 + if (min <= divider && divider <= max)
2734 + /* find a value for prediv such that it is a factor of divider */
2735 + for (prediv = max; prediv >= min ; prediv--)
2737 + if ( (divider % prediv) == 0 )
2743 + /* No such factor exists, return min as prediv */
2747 +/****************************************************************************
2748 + * FUNCTION: get_val
2749 + ****************************************************************************
2750 + * Description: This routine is called to get values of divider and multiplier.
2751 + ***************************************************************************/
2753 +static void get_val(u32 output_freq, u32 base_freq,u32 *multiplier, u32 *divider)
2761 + /* find gcd of base_freq, output_freq */
2762 + min_freq = (base_freq < output_freq) ? base_freq : output_freq;
2763 + max_freq = (base_freq > output_freq) ? base_freq : output_freq;
2764 + gcd = find_gcd(min_freq , max_freq);
2767 + return; /* ERROR */
2769 + /* compute values of multiplier and divider */
2770 + temp_mul = output_freq / gcd;
2771 + temp_div = base_freq / gcd;
2774 + /* set multiplier such that 1 <= multiplier <= PLL_MUL_MAXFACTOR */
2775 + if( temp_mul > PLL_MUL_MAXFACTOR )
2777 + if((temp_mul / temp_div) > PLL_MUL_MAXFACTOR)
2780 + find_approx(&temp_mul,&temp_div,base_freq);
2783 + *multiplier = temp_mul;
2784 + *divider = temp_div;
2787 +/****************************************************************************
2788 + * FUNCTION: find_approx
2789 + ****************************************************************************
2790 + * Description: This function gets the approx value of num/denom.
2791 + ***************************************************************************/
2793 +static void find_approx(u32 *num,u32 *denom,u32 base_freq)
2800 + int32_t prev_closest;
2810 + prev_closest = 0x7fffffff; /* maximum possible value */
2814 + /* start with max */
2815 + for(temp_num = 15; temp_num >=1; temp_num--)
2818 + temp_denom = CEIL(temp_num * denom1, num1);
2819 + output_freq = (temp_num * base_freq) / temp_denom;
2821 + if(temp_denom < 1)
2827 + normalize = CEIL(num1,temp_num);
2828 + closest = (ABS((num1 * (temp_denom) ) - (temp_num * denom1))) * normalize;
2829 + if(closest < prev_closest && output_freq > present_min && output_freq <present_max)
2831 + prev_closest = closest;
2833 + denom2 = temp_denom;
2840 + gcd = find_gcd(num2,denom2);
2841 + num2 = num2 / gcd;
2842 + denom2 = denom2 /gcd;
2849 +/*****************************************************************************
2851 + *****************************************************************************/
2853 +/****************************************************************************
2854 + * FUNCTION: tnetd73xx_gpio_init
2855 + ***************************************************************************/
2856 +void tnetd73xx_gpio_init()
2858 + /* Bring module out of reset */
2859 + tnetd73xx_reset_ctrl(RESET_MODULE_GPIO, OUT_OF_RESET);
2860 + REG32_WRITE(TNETD73XX_GPIOENR, 0xFFFFFFFF);
2863 +/****************************************************************************
2864 + * FUNCTION: tnetd73xx_gpio_ctrl
2865 + ***************************************************************************/
2866 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
2867 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
2868 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction)
2871 + REG32_READ(TNETD73XX_GPIOENR, pin_status);
2872 + if (pin_mode == GPIO_PIN)
2874 + pin_status |= (1 << gpio_pin);
2875 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2877 + /* Set pin direction */
2878 + REG32_READ(TNETD73XX_GPIOPDIRR, pin_status);
2879 + if (pin_direction == GPIO_INPUT_PIN)
2881 + pin_status |= (1 << gpio_pin);
2883 + else /* GPIO_OUTPUT_PIN */
2885 + pin_status &= (~(1 << gpio_pin));
2887 + REG32_WRITE(TNETD73XX_GPIOPDIRR, pin_status);
2889 + else /* FUNCTIONAL PIN */
2891 + pin_status &= (~(1 << gpio_pin));
2892 + REG32_WRITE(TNETD73XX_GPIOENR, pin_status);
2897 +/****************************************************************************
2898 + * FUNCTION: tnetd73xx_gpio_out
2899 + ***************************************************************************/
2900 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value)
2904 + REG32_READ(TNETD73XX_GPIODOUTR, pin_value);
2907 + pin_value |= (1 << gpio_pin);
2911 + pin_value &= (~(1 << gpio_pin));
2913 + REG32_WRITE(TNETD73XX_GPIODOUTR, pin_value);
2916 +/****************************************************************************
2917 + * FUNCTION: tnetd73xx_gpio_in
2918 + ***************************************************************************/
2919 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin)
2922 + REG32_READ(TNETD73XX_GPIODINR, pin_value);
2923 + return ( (pin_value & (1 << gpio_pin)) ? 1 : 0 );
2926 diff -urN linux.old/arch/mips/config-shared.in linux.dev/arch/mips/config-shared.in
2927 --- linux.old/arch/mips/config-shared.in 2005-10-21 16:43:18.917114000 +0200
2928 +++ linux.dev/arch/mips/config-shared.in 2005-11-10 01:12:43.950955750 +0100
2930 mainmenu_option next_comment
2931 comment 'Machine selection'
2932 dep_bool 'Support for Acer PICA 1 chipset (EXPERIMENTAL)' CONFIG_ACER_PICA_61 $CONFIG_EXPERIMENTAL
2933 +dep_bool 'Support for Texas Instruments AR7 (EXPERIMENTAL)' CONFIG_AR7 $CONFIG_MIPS32 $CONFIG_EXPERIMENTAL
2934 +if [ "$CONFIG_AR7" = "y" ]; then
2935 + choice 'Texas Instruments Reference Platform' \
2936 + "AR7DB CONFIG_AR7DB \
2937 + AR7RD CONFIG_AR7RD \
2938 + AR7WRD CONFIG_AR7WRD" AR7DB
2939 + int 'Texas Instruments AR7 CPU Frequency' CONFIG_AR7_CPU 150
2940 + int 'Texas Instruments AR7 System Frequency' CONFIG_AR7_SYS 125
2941 + hex 'Texas Instruments AR7 SDRAM Start' CONFIG_AR7_MEMORY 0x14000000
2943 dep_bool 'Support for Alchemy Bosporus board' CONFIG_MIPS_BOSPORUS $CONFIG_MIPS32
2944 dep_bool 'Support for FIC Multimedia Player board' CONFIG_MIPS_FICMMP $CONFIG_MIPS32
2945 dep_bool 'Support for Alchemy Mirage board' CONFIG_MIPS_MIRAGE $CONFIG_MIPS32
2946 @@ -239,6 +249,11 @@
2947 define_bool CONFIG_NONCOHERENT_IO y
2948 define_bool CONFIG_PC_KEYB y
2950 +if [ "$CONFIG_AR7" = "y" ]; then
2951 + define_bool CONFIG_IRQ_CPU y
2952 + define_bool CONFIG_NONCOHERENT_IO y
2953 + define_bool CONFIG_SWAP_IO_SPACE y
2955 if [ "$CONFIG_CASIO_E55" = "y" ]; then
2956 define_bool CONFIG_IRQ_CPU y
2957 define_bool CONFIG_NONCOHERENT_IO y
2959 mainmenu_option next_comment
2960 comment 'General setup'
2961 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2962 + "$CONFIG_AR7" = "y" -o \
2963 "$CONFIG_CASIO_E55" = "y" -o \
2964 "$CONFIG_DDB5074" = "y" -o \
2965 "$CONFIG_DDB5476" = "y" -o \
2967 bool 'Networking support' CONFIG_NET
2969 if [ "$CONFIG_ACER_PICA_61" = "y" -o \
2970 + "$CONFIG_AR7" = "y" -o \
2971 "$CONFIG_CASIO_E55" = "y" -o \
2972 "$CONFIG_DECSTATION" = "y" -o \
2973 "$CONFIG_IBM_WORKPAD" = "y" -o \
2974 diff -urN linux.old/arch/mips/kernel/head.S linux.dev/arch/mips/kernel/head.S
2975 --- linux.old/arch/mips/kernel/head.S 2005-10-21 16:43:16.396956500 +0200
2976 +++ linux.dev/arch/mips/kernel/head.S 2005-11-10 01:10:45.807572250 +0100
2980 NESTED(except_vec4, 0, sp)
2983 -1: j 1b /* Dummy, will be replaced */
2994 diff -urN linux.old/arch/mips/kernel/mips_ksyms.c linux.dev/arch/mips/kernel/mips_ksyms.c
2995 --- linux.old/arch/mips/kernel/mips_ksyms.c 2004-02-18 14:36:30.000000000 +0100
2996 +++ linux.dev/arch/mips/kernel/mips_ksyms.c 2005-11-10 01:10:45.811572500 +0100
2998 extern long __strnlen_user_nocheck_asm(const char *s);
2999 extern long __strnlen_user_asm(const char *s);
3002 +#include <asm/ar7/adam2_env.h>
3003 +int avalanche_request_pacing(int irq_nr, unsigned int blk_num, unsigned int pace_value);
3007 EXPORT_SYMBOL(mips_machtype);
3009 EXPORT_SYMBOL(EISA_bus);
3010 @@ -103,3 +109,10 @@
3013 EXPORT_SYMBOL(get_wchan);
3016 +EXPORT_SYMBOL_NOVERS(avalanche_request_pacing);
3017 +EXPORT_SYMBOL_NOVERS(prom_getenv);
3018 +EXPORT_SYMBOL_NOVERS(prom_iterenv);
3021 diff -urN linux.old/arch/mips/kernel/setup.c linux.dev/arch/mips/kernel/setup.c
3022 --- linux.old/arch/mips/kernel/setup.c 2005-10-21 16:43:16.396956500 +0200
3023 +++ linux.dev/arch/mips/kernel/setup.c 2005-11-10 01:14:16.376732000 +0100
3026 #include <asm/ptrace.h>
3027 #include <asm/system.h>
3028 +#include <asm/addrspace.h>
3030 struct cpuinfo_mips cpu_data[NR_CPUS];
3031 EXPORT_SYMBOL(cpu_data);
3033 struct boot_mem_map boot_mem_map;
3035 unsigned char aux_device_present;
3036 -extern char _ftext, _etext, _fdata, _edata, _end;
3037 +extern char _ftext, _etext, _fdata, _edata, _fbss, _end;
3039 static char command_line[CL_SIZE];
3040 char saved_command_line[CL_SIZE];
3043 static struct resource code_resource = { "Kernel code" };
3044 static struct resource data_resource = { "Kernel data" };
3045 +static struct resource bss_resource = { "Kernel bss" };
3047 asmlinkage void __init
3048 init_arch(int argc, char **argv, char **envp, int *prom_vec)
3050 for (i = 0; i < boot_mem_map.nr_map; i++) {
3051 unsigned long start, end;
3053 - if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
3054 + if (boot_mem_map.map[i].type == BOOT_MEM_RESERVED)
3057 start = PFN_UP(boot_mem_map.map[i].addr);
3061 /* Initialize the boot-time allocator with low memory only. */
3062 - bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn);
3063 + bootmap_size = init_bootmem_node(NODE_DATA(0), first_usable_pfn,
3064 + PFN_UP(PHYS_OFFSET), max_low_pfn);
3067 * Register fully available low RAM pages with the bootmem allocator.
3068 @@ -371,11 +374,12 @@
3071 /* Register lowmem ranges */
3072 - free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
3073 + free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
3074 + size<<PAGE_SHIFT);
3077 /* Reserve the bootmap memory. */
3078 - reserve_bootmem(PFN_PHYS(first_usable_pfn), bootmap_size);
3079 + reserve_bootmem_node(NODE_DATA(0), PFN_PHYS(first_usable_pfn), bootmap_size);
3081 #ifdef CONFIG_BLK_DEV_INITRD
3082 /* Board specific code should have set up initrd_start and initrd_end */
3084 code_resource.end = virt_to_bus(&_etext) - 1;
3085 data_resource.start = virt_to_bus(&_fdata);
3086 data_resource.end = virt_to_bus(&_edata) - 1;
3087 + bss_resource.start = virt_to_bus(&_fbss);
3088 + bss_resource.end = virt_to_bus(&_end) - 1;
3091 * Request address space for all standard RAM.
3094 request_resource(res, &code_resource);
3095 request_resource(res, &data_resource);
3096 + request_resource(res, &bss_resource);
3101 void hp_setup(void);
3102 void au1x00_setup(void);
3103 void frame_info_init(void);
3104 + void ar7_setup(void);
3107 #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
3108 @@ -691,6 +699,11 @@
3109 pmc_yosemite_setup();
3113 + case MACH_GROUP_UNKNOWN:
3118 panic("Unsupported architecture");
3120 diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
3121 --- linux.old/arch/mips/kernel/time.c 2005-01-19 15:09:29.000000000 +0100
3122 +++ linux.dev/arch/mips/kernel/time.c 2005-11-10 01:12:43.950955750 +0100
3124 expirelo = (count / cycles_per_jiffy + 1) * cycles_per_jiffy;
3125 write_c0_count(expirelo - cycles_per_jiffy);
3126 write_c0_compare(expirelo);
3127 - write_c0_count(count);
3130 int (*mips_timer_state)(void);
3131 diff -urN linux.old/arch/mips/kernel/traps.c linux.dev/arch/mips/kernel/traps.c
3132 --- linux.old/arch/mips/kernel/traps.c 2005-10-21 16:43:16.400956750 +0200
3133 +++ linux.dev/arch/mips/kernel/traps.c 2005-11-10 01:13:28.301727500 +0100
3134 @@ -869,9 +869,24 @@
3136 exception_handlers[n] = handler;
3137 if (n == 0 && cpu_has_divec) {
3138 + printk(KERN_DEBUG "%s: using long jump via k0 to reach %08x\n",
3139 + __FUNCTION__, handler);
3140 + /* where does the 8 byte limit mentioned in head.S come from??? */
3141 + if (handler > 0x0fffffff) { /* maximum for single J instruction */
3142 + /* lui k0, 0x0000 */
3143 + *(volatile u32 *)(KSEG0+0x200) = 0x3c1a0000 | (handler >> 16);
3144 + /* ori k0, 0x0000 */
3145 + *(volatile u32 *)(KSEG0+0x204) = 0x375a0000 | (handler & 0xffff);
3147 + *(volatile u32 *)(KSEG0+0x208) = 0x03400008;
3149 + *(volatile u32 *)(KSEG0+0x20C) = 0x00000000;
3150 + flush_icache_range(KSEG0+0x200, KSEG0+0x210);
3152 *(volatile u32 *)(KSEG0+0x200) = 0x08000000 |
3153 (0x03ffffff & (handler >> 2));
3154 - flush_icache_range(KSEG0+0x200, KSEG0 + 0x204);
3155 + flush_icache_range(KSEG0+0x200, KSEG0+0x204);
3158 return (void *)old_handler;
3160 diff -urN linux.old/arch/mips/mm/init.c linux.dev/arch/mips/mm/init.c
3161 --- linux.old/arch/mips/mm/init.c 2004-02-18 14:36:30.000000000 +0100
3162 +++ linux.dev/arch/mips/mm/init.c 2005-11-10 01:14:16.376732000 +0100
3163 @@ -235,10 +235,13 @@
3167 +#define START_PFN (NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
3168 +#define MAX_LOW_PFN (NODE_DATA(0)->bdata->node_low_pfn)
3170 void __init paging_init(void)
3172 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
3173 - unsigned long max_dma, high, low;
3174 + unsigned long max_dma, high, low, start;
3181 max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
3182 - low = max_low_pfn;
3183 + start = START_PFN;
3184 + low = MAX_LOW_PFN - start;
3189 zones_size[ZONE_HIGHMEM] = high - low;
3192 - free_area_init(zones_size);
3193 + free_area_init_node(0, NODE_DATA(0), 0, zones_size,
3194 + start << PAGE_SHIFT, 0);
3197 #define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
3199 for (i = 0; i < boot_mem_map.nr_map; i++) {
3200 unsigned long addr, end;
3202 - if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
3203 + if (boot_mem_map.map[i].type == BOOT_MEM_RESERVED)
3204 /* not usable memory */
3207 @@ -313,16 +318,17 @@
3208 max_mapnr = num_physpages = highend_pfn;
3209 num_mappedpages = max_low_pfn;
3211 - max_mapnr = num_mappedpages = num_physpages = max_low_pfn;
3212 + max_mapnr = num_mappedpages = num_physpages = MAX_LOW_PFN - START_PFN;
3214 - high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
3216 - totalram_pages += free_all_bootmem();
3218 + high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE);
3220 + totalram_pages += free_all_bootmem_node(NODE_DATA(0));
3221 totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */
3223 reservedpages = ram = 0;
3224 - for (tmp = 0; tmp < max_low_pfn; tmp++)
3225 - if (page_is_ram(tmp)) {
3226 + for (tmp = 0; tmp < max_mapnr; tmp++)
3227 + if (page_is_ram(START_PFN + tmp)) {
3229 if (PageReserved(mem_map+tmp))
3231 @@ -377,13 +383,13 @@
3234 extern char __init_begin, __init_end;
3235 -extern void prom_free_prom_memory(void) __init;
3236 +extern unsigned long prom_free_prom_memory(void) __init;
3238 void free_initmem(void)
3242 - prom_free_prom_memory ();
3243 + totalram_pages += prom_free_prom_memory ();
3245 addr = (unsigned long) &__init_begin;
3246 while (addr < (unsigned long) &__init_end) {
3247 diff -urN linux.old/drivers/char/Config.in linux.dev/drivers/char/Config.in
3248 --- linux.old/drivers/char/Config.in 2005-10-21 16:43:16.440959250 +0200
3249 +++ linux.dev/drivers/char/Config.in 2005-11-10 01:10:45.843574500 +0100
3250 @@ -188,6 +188,14 @@
3251 tristate 'Total Impact briQ front panel driver' CONFIG_BRIQ_PANEL
3254 +if [ "$CONFIG_AR7" = "y" ]; then
3255 + bool 'VLYNQ support for the TI SOC' CONFIG_AR7_VLYNQ
3256 + dep_bool 'VLYNQ clock source Internal' CONFIG_VLYNQ_CLK_LOCAL $CONFIG_AR7_VLYNQ
3258 + define_int CONFIG_AR7_VLYNQ_PORTS 2
3259 + tristate 'ADAM2 environment support (read-only)' CONFIG_AR7_ADAM2
3262 source drivers/i2c/Config.in
3264 mainmenu_option next_comment
3265 diff -urN linux.old/drivers/char/Config.in.orig linux.dev/drivers/char/Config.in.orig
3266 --- linux.old/drivers/char/Config.in.orig 1970-01-01 01:00:00.000000000 +0100
3267 +++ linux.dev/drivers/char/Config.in.orig 2005-11-10 01:10:45.863575750 +0100
3270 +# Character device configuration
3272 +mainmenu_option next_comment
3273 +comment 'Character devices'
3275 +bool 'Virtual terminal' CONFIG_VT
3276 +if [ "$CONFIG_VT" = "y" ]; then
3277 + bool ' Support for console on virtual terminal' CONFIG_VT_CONSOLE
3278 + if [ "$CONFIG_GSC_LASI" = "y" ]; then
3279 + bool ' Support for Lasi/Dino PS2 port' CONFIG_GSC_PS2
3282 +tristate 'Standard/generic (8250/16550 and compatible UARTs) serial support' CONFIG_SERIAL
3283 +if [ "$CONFIG_SERIAL" = "y" ]; then
3284 + bool ' Support for console on serial port' CONFIG_SERIAL_CONSOLE
3285 + if [ "$CONFIG_GSC_LASI" = "y" ]; then
3286 + bool ' serial port on GSC support' CONFIG_SERIAL_GSC
3288 + if [ "$CONFIG_IA64" = "y" ]; then
3289 + bool ' Support for serial port described by EFI HCDP table' CONFIG_SERIAL_HCDP
3291 + if [ "$CONFIG_ARCH_ACORN" = "y" ]; then
3292 + tristate ' Atomwide serial port support' CONFIG_ATOMWIDE_SERIAL
3293 + tristate ' Dual serial port support' CONFIG_DUALSP_SERIAL
3296 +dep_mbool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL
3297 +if [ "$CONFIG_SERIAL_EXTENDED" = "y" ]; then
3298 + bool ' Support more than 4 serial ports' CONFIG_SERIAL_MANY_PORTS
3299 + bool ' Support for sharing serial interrupts' CONFIG_SERIAL_SHARE_IRQ
3300 + bool ' Autodetect IRQ on standard ports (unsafe)' CONFIG_SERIAL_DETECT_IRQ
3301 + bool ' Support special multiport boards' CONFIG_SERIAL_MULTIPORT
3302 + bool ' Support the Bell Technologies HUB6 card' CONFIG_HUB6
3304 +bool 'Non-standard serial port support' CONFIG_SERIAL_NONSTANDARD
3305 +if [ "$CONFIG_SERIAL_NONSTANDARD" = "y" ]; then
3306 + tristate ' Computone IntelliPort Plus serial support' CONFIG_COMPUTONE
3307 + tristate ' Comtrol Rocketport support' CONFIG_ROCKETPORT
3308 + tristate ' Cyclades async mux support' CONFIG_CYCLADES
3309 + if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_CYCLADES" != "n" ]; then
3310 + bool ' Cyclades-Z interrupt mode operation (EXPERIMENTAL)' CONFIG_CYZ_INTR
3312 + if [ "$CONFIG_X86_64" != "y" ]; then
3313 + tristate ' Digiboard Intelligent Async Support' CONFIG_DIGIEPCA
3314 + if [ "$CONFIG_DIGIEPCA" = "n" ]; then
3315 + tristate ' Digiboard PC/Xx Support' CONFIG_DIGI
3318 + dep_tristate ' Hayes ESP serial port support' CONFIG_ESPSERIAL $CONFIG_ISA
3319 + tristate ' Moxa Intellio support' CONFIG_MOXA_INTELLIO
3320 + tristate ' Moxa SmartIO support' CONFIG_MOXA_SMARTIO
3321 + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
3322 + dep_tristate ' Multi-Tech multiport card support (EXPERIMENTAL)' CONFIG_ISI m
3324 + tristate ' Microgate SyncLink card support' CONFIG_SYNCLINK
3325 + tristate ' SyncLink Multiport support' CONFIG_SYNCLINKMP
3326 + tristate ' HDLC line discipline support' CONFIG_N_HDLC
3327 + tristate ' SDL RISCom/8 card support' CONFIG_RISCOM8
3328 + if [ "$CONFIG_X86_64" != "y" ]; then
3329 + tristate ' Specialix IO8+ card support' CONFIG_SPECIALIX
3330 + if [ "$CONFIG_SPECIALIX" != "n" ]; then
3331 + bool ' Specialix DTR/RTS pin is RTS' CONFIG_SPECIALIX_RTSCTS
3333 + tristate ' Specialix SX (and SI) card support' CONFIG_SX
3334 + tristate ' Specialix RIO system support' CONFIG_RIO
3335 + if [ "$CONFIG_RIO" != "n" ]; then
3336 + bool ' Support really old RIO/PCI cards' CONFIG_RIO_OLDPCI
3339 + bool ' Stallion multiport serial support' CONFIG_STALDRV
3340 + if [ "$CONFIG_STALDRV" = "y" ]; then
3341 + tristate ' Stallion EasyIO or EC8/32 support' CONFIG_STALLION
3342 + tristate ' Stallion EC8/64, ONboard, Brumby support' CONFIG_ISTALLION
3344 + if [ "$CONFIG_PARISC" = "y" ]; then
3345 + if [ "$CONFIG_PDC_CONSOLE" != "y" ]; then
3346 + bool ' Serial MUX support' CONFIG_SERIAL_MUX CONFIG_SERIAL_NONSTANDARD
3348 + if [ "$CONFIG_SERIAL_MUX" != "y" ]; then
3349 + bool ' PDC software console support' CONFIG_PDC_CONSOLE CONFIG_SERIAL_NONSTANDARD
3352 + if [ "$CONFIG_MIPS" = "y" ]; then
3353 + bool ' TX3912/PR31700 serial port support' CONFIG_SERIAL_TX3912
3354 + dep_bool ' Console on TX3912/PR31700 serial port' CONFIG_SERIAL_TX3912_CONSOLE $CONFIG_SERIAL_TX3912
3355 + bool ' TMPTX39XX/49XX serial port support' CONFIG_SERIAL_TXX9
3356 + dep_bool ' Console on TMPTX39XX/49XX serial port' CONFIG_SERIAL_TXX9_CONSOLE $CONFIG_SERIAL_TXX9
3357 + if [ "$CONFIG_SOC_AU1X00" = "y" ]; then
3358 + bool ' Enable Au1x00 UART Support' CONFIG_AU1X00_UART
3359 + if [ "$CONFIG_AU1X00_UART" = "y" ]; then
3360 + bool ' Enable Au1x00 serial console' CONFIG_AU1X00_SERIAL_CONSOLE
3362 + dep_tristate ' Au1x00 USB TTY Device support' CONFIG_AU1X00_USB_TTY $CONFIG_SOC_AU1X00
3363 + if [ "$CONFIG_AU1000_USB_TTY" != "y" ]; then
3364 + dep_tristate ' Au1x00 USB Raw Device support' CONFIG_AU1X00_USB_RAW $CONFIG_SOC_AU1X00
3366 + if [ "$CONFIG_AU1X00_USB_TTY" != "n" -o \
3367 + "$CONFIG_AU1X00_USB_RAW" != "n" ]; then
3368 + define_bool CONFIG_AU1X00_USB_DEVICE y
3371 + bool ' TXx927 SIO support' CONFIG_TXX927_SERIAL
3372 + if [ "$CONFIG_TXX927_SERIAL" = "y" ]; then
3373 + bool ' TXx927 SIO Console support' CONFIG_TXX927_SERIAL_CONSOLE
3375 + if [ "$CONFIG_SIBYTE_SB1xxx_SOC" = "y" ]; then
3376 + bool ' Support for BCM1xxx onchip DUART' CONFIG_SIBYTE_SB1250_DUART
3377 + if [ "$CONFIG_SIBYTE_SB1250_DUART" = "y" ]; then
3378 + bool ' Console on BCM1xxx DUART' CONFIG_SIBYTE_SB1250_DUART_CONSOLE
3379 + if [ "$CONFIG_SIBYTE_SB1250_DUART_CONSOLE" = "y" ]; then
3380 + define_bool CONFIG_SERIAL_CONSOLE y
3385 + if [ "$CONFIG_DECSTATION" = "y" ]; then
3386 + bool ' DECstation serial support' CONFIG_SERIAL_DEC
3387 + dep_bool ' Support for console on a DECstation serial port' CONFIG_SERIAL_DEC_CONSOLE $CONFIG_SERIAL_DEC
3388 + dep_bool ' DZ11 serial support' CONFIG_DZ $CONFIG_SERIAL_DEC $CONFIG_MIPS32
3389 + dep_bool ' Z85C30 serial support' CONFIG_ZS $CONFIG_SERIAL_DEC $CONFIG_TC
3391 + if [ "$CONFIG_SGI_IP22" = "y" ]; then
3392 + bool ' SGI Zilog85C30 serial support' CONFIG_IP22_SERIAL
3394 + if [ "$CONFIG_IA64" = "y" ]; then
3395 + bool ' SGI SN2 l1 serial port support' CONFIG_SGI_L1_SERIAL
3396 + if [ "$CONFIG_SGI_L1_SERIAL" = "y" ]; then
3397 + bool ' SGI SN2 l1 Console support' CONFIG_SGI_L1_SERIAL_CONSOLE
3399 + if [ "$CONFIG_IA64_GENERIC" = "y" -o "$CONFIG_IA64_SGI_SN2" = "y" ]; then
3400 + bool ' SGI SN2 IOC4 serial port support' CONFIG_SGI_IOC4_SERIAL
3404 +if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_ZORRO" = "y" ]; then
3405 + tristate 'Commodore A2232 serial support (EXPERIMENTAL)' CONFIG_A2232
3407 +if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then
3408 + bool 'DC21285 serial port support' CONFIG_SERIAL_21285
3409 + if [ "$CONFIG_SERIAL_21285" = "y" ]; then
3410 + if [ "$CONFIG_OBSOLETE" = "y" ]; then
3411 + bool ' Use /dev/ttyS0 device (OBSOLETE)' CONFIG_SERIAL_21285_OLD
3413 + bool ' Console on DC21285 serial port' CONFIG_SERIAL_21285_CONSOLE
3415 + if [ "$CONFIG_PARISC" = "y" ]; then
3416 + bool ' PDC software console support' CONFIG_PDC_CONSOLE
3419 +if [ "$CONFIG_MIPS_ITE8172" = "y" ]; then
3420 + bool 'Enable Qtronix 990P Keyboard Support' CONFIG_QTRONIX_KEYBOARD
3421 + if [ "$CONFIG_QTRONIX_KEYBOARD" = "y" ]; then
3422 + define_bool CONFIG_IT8172_CIR y
3424 + bool ' Enable PS2 Keyboard Support' CONFIG_PC_KEYB
3426 + bool 'Enable Smart Card Reader 0 Support ' CONFIG_IT8172_SCR0
3427 + bool 'Enable Smart Card Reader 1 Support ' CONFIG_IT8172_SCR1
3429 +if [ "$CONFIG_MIPS_IVR" = "y" ]; then
3430 + bool 'Enable Qtronix 990P Keyboard Support' CONFIG_QTRONIX_KEYBOARD
3431 + if [ "$CONFIG_QTRONIX_KEYBOARD" = "y" ]; then
3432 + define_bool CONFIG_IT8172_CIR y
3434 + bool 'Enable Smart Card Reader 0 Support ' CONFIG_IT8172_SCR0
3436 +if [ "$CONFIG_CPU_VR41XX" = "y" ]; then
3437 + bool 'NEC VR4100 series Keyboard Interface Unit Support ' CONFIG_VR41XX_KIU
3439 +bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS
3440 +if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
3441 + int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
3443 +if [ "$CONFIG_PARPORT" != "n" ]; then
3444 + dep_tristate 'Parallel printer support' CONFIG_PRINTER $CONFIG_PARPORT
3445 + if [ "$CONFIG_PRINTER" != "n" ]; then
3446 + bool ' Support for console on line printer' CONFIG_LP_CONSOLE
3448 + dep_tristate 'Support for user-space parallel port device drivers' CONFIG_PPDEV $CONFIG_PARPORT
3449 + dep_tristate 'Texas Instruments parallel link cable support' CONFIG_TIPAR $CONFIG_PARPORT
3452 +if [ "$CONFIG_PPC64" = "y" ] ; then
3453 + bool 'pSeries Hypervisor Virtual Console support' CONFIG_HVC_CONSOLE
3455 +if [ "$CONFIG_ALL_PPC" = "y" ]; then
3456 + tristate 'Total Impact briQ front panel driver' CONFIG_BRIQ_PANEL
3459 +if [ "$CONFIG_AR7" = "y" ]; then
3460 + bool 'VLYNQ support for the TI SOC' CONFIG_AR7_VLYNQ
3461 + dep_bool 'VLYNQ clock source Internal' CONFIG_VLYNQ_CLK_LOCAL $CONFIG_AR7_VLYNQ
3463 + define_int CONFIG_AR7_VLYNQ_PORTS 2
3466 +source drivers/i2c/Config.in
3468 +mainmenu_option next_comment
3470 +tristate 'Bus Mouse Support' CONFIG_BUSMOUSE
3471 +if [ "$CONFIG_BUSMOUSE" != "n" ]; then
3472 + dep_tristate ' ATIXL busmouse support' CONFIG_ATIXL_BUSMOUSE $CONFIG_BUSMOUSE
3473 + dep_tristate ' Logitech busmouse support' CONFIG_LOGIBUSMOUSE $CONFIG_BUSMOUSE
3474 + dep_tristate ' Microsoft busmouse support' CONFIG_MS_BUSMOUSE $CONFIG_BUSMOUSE
3475 + if [ "$CONFIG_ADB" = "y" -a "$CONFIG_ADB_KEYBOARD" = "y" ]; then
3476 + dep_tristate ' Apple Desktop Bus mouse support (old driver)' CONFIG_ADBMOUSE $CONFIG_BUSMOUSE
3478 +# if [ "$CONFIG_DECSTATION" = "y" ]; then
3479 +# dep_bool ' MAXINE Access.Bus mouse (VSXXX-BB/GB) support' CONFIG_DTOP_MOUSE $CONFIG_ACCESSBUS
3483 +tristate 'Mouse Support (not serial and bus mice)' CONFIG_MOUSE
3484 +if [ "$CONFIG_MOUSE" != "n" ]; then
3485 + bool ' PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE
3486 + tristate ' C&T 82C710 mouse port support (as on TI Travelmate)' CONFIG_82C710_MOUSE
3487 + tristate ' PC110 digitizer pad support' CONFIG_PC110_PAD
3488 + tristate ' MK712 touch screen support' CONFIG_MK712_MOUSE
3492 +source drivers/char/joystick/Config.in
3494 +tristate 'QIC-02 tape support' CONFIG_QIC02_TAPE
3495 +if [ "$CONFIG_QIC02_TAPE" != "n" ]; then
3496 + bool ' Do you want runtime configuration for QIC-02' CONFIG_QIC02_DYNCONF
3497 + if [ "$CONFIG_QIC02_DYNCONF" != "y" ]; then
3498 + comment ' Edit configuration parameters in ./include/linux/tpqic02.h!'
3500 + comment ' Setting runtime QIC-02 configuration is done with qic02conf'
3501 + comment ' from the tpqic02-support package. It is available at'
3502 + comment ' metalab.unc.edu or ftp://titus.cfw.com/pub/Linux/util/'
3506 +tristate 'IPMI top-level message handler' CONFIG_IPMI_HANDLER
3507 +dep_mbool ' Generate a panic event to all BMCs on a panic' CONFIG_IPMI_PANIC_EVENT $CONFIG_IPMI_HANDLER
3508 +dep_tristate ' Device interface for IPMI' CONFIG_IPMI_DEVICE_INTERFACE $CONFIG_IPMI_HANDLER
3509 +dep_tristate ' IPMI KCS handler' CONFIG_IPMI_KCS $CONFIG_IPMI_HANDLER
3510 +dep_tristate ' IPMI Watchdog Timer' CONFIG_IPMI_WATCHDOG $CONFIG_IPMI_HANDLER
3512 +mainmenu_option next_comment
3513 +comment 'Watchdog Cards'
3514 +bool 'Watchdog Timer Support' CONFIG_WATCHDOG
3515 +if [ "$CONFIG_WATCHDOG" != "n" ]; then
3516 + bool ' Disable watchdog shutdown on close' CONFIG_WATCHDOG_NOWAYOUT
3517 + tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT
3518 + tristate ' Advantech SBC Watchdog Timer' CONFIG_ADVANTECH_WDT
3519 + tristate ' ALi M7101 PMU on ALi 1535D+ Watchdog Timer' CONFIG_ALIM1535_WDT
3520 + tristate ' ALi M7101 PMU Watchdog Timer' CONFIG_ALIM7101_WDT
3521 + tristate ' AMD "Elan" SC520 Watchdog Timer' CONFIG_SC520_WDT
3522 + tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG
3523 + if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then
3524 + tristate ' DC21285 watchdog' CONFIG_21285_WATCHDOG
3525 + if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then
3526 + tristate ' NetWinder WB83C977 watchdog' CONFIG_977_WATCHDOG
3529 + tristate ' Eurotech CPU-1220/1410 Watchdog Timer' CONFIG_EUROTECH_WDT
3530 + tristate ' IB700 SBC Watchdog Timer' CONFIG_IB700_WDT
3531 + tristate ' ICP ELectronics Wafer 5823 Watchdog' CONFIG_WAFER_WDT
3532 + tristate ' Intel i810 TCO timer / Watchdog' CONFIG_I810_TCO
3533 + tristate ' Mixcom Watchdog' CONFIG_MIXCOMWD
3534 + tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
3535 + dep_tristate ' SC1200 Watchdog Timer (EXPERIMENTAL)' CONFIG_SC1200_WDT $CONFIG_EXPERIMENTAL
3536 + tristate ' NatSemi SCx200 Watchdog' CONFIG_SCx200_WDT
3537 + tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
3538 + tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
3539 + tristate ' WDT Watchdog timer' CONFIG_WDT
3540 + tristate ' WDT PCI Watchdog timer' CONFIG_WDTPCI
3541 + if [ "$CONFIG_WDT" != "n" ]; then
3542 + bool ' WDT501 features' CONFIG_WDT_501
3543 + if [ "$CONFIG_WDT_501" = "y" ]; then
3544 + bool ' Fan Tachometer' CONFIG_WDT_501_FAN
3547 + tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
3548 + if [ "$CONFIG_SGI_IP22" = "y" ]; then
3549 + dep_tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG $CONFIG_SGI_IP22
3551 + if [ "$CONFIG_8xx" = "y" ]; then
3552 + tristate ' MPC8xx Watchdog Timer' CONFIG_8xx_WDT
3557 +if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then
3558 + tristate 'NetWinder thermometer support' CONFIG_DS1620
3559 + tristate 'NetWinder Button' CONFIG_NWBUTTON
3560 + if [ "$CONFIG_NWBUTTON" != "n" ]; then
3561 + bool ' Reboot Using Button' CONFIG_NWBUTTON_REBOOT
3563 + tristate 'NetWinder flash support' CONFIG_NWFLASH
3565 +tristate 'NatSemi SCx200 Support' CONFIG_SCx200
3566 +dep_tristate ' NatSemi SCx200 GPIO Support' CONFIG_SCx200_GPIO $CONFIG_SCx200
3568 +if [ "$CONFIG_IA64_GENERIC" = "y" -o "$CONFIG_IA64_SGI_SN2" = "y" ] ; then
3569 + bool 'SGI SN2 fetchop support' CONFIG_FETCHOP
3572 +if [ "$CONFIG_X86" = "y" -o "$CONFIG_X86_64" = "y" ]; then
3573 + dep_tristate 'AMD 768/8111 Random Number Generator support' CONFIG_AMD_RNG $CONFIG_PCI
3575 +if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" ]; then
3576 + dep_tristate 'Intel i8x0 Random Number Generator support' CONFIG_INTEL_RNG $CONFIG_PCI
3578 +if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" -o \
3579 + "$CONFIG_X86_64" = "y" ]; then
3580 + dep_tristate 'Intel/AMD/VIA HW Random Number Generator support' CONFIG_HW_RANDOM $CONFIG_PCI
3582 +dep_tristate 'AMD 76x native power management (Experimental)' CONFIG_AMD_PM768 $CONFIG_PCI
3583 +tristate '/dev/nvram support' CONFIG_NVRAM
3584 +tristate 'Enhanced Real Time Clock Support' CONFIG_RTC
3585 +if [ "$CONFIG_IA64" = "y" ]; then
3586 + bool 'EFI Real Time Clock Services' CONFIG_EFI_RTC
3588 +if [ "$CONFIG_OBSOLETE" = "y" -a "$CONFIG_ALPHA_BOOK1" = "y" ]; then
3589 + bool 'Tadpole ANA H8 Support (OBSOLETE)' CONFIG_H8
3591 +if [ "$CONFIG_SGI_IP22" = "y" ]; then
3592 + tristate 'Dallas DS1286 RTC support' CONFIG_DS1286
3594 +if [ "$CONFIG_SGI_IP27" = "y" ]; then
3595 + tristate 'SGI M48T35 RTC support' CONFIG_SGI_IP27_RTC
3597 +if [ "$CONFIG_TOSHIBA_RBTX4927" = "y" -o "$CONFIG_TOSHIBA_JMR3927" = "y" ]; then
3598 + tristate 'Dallas DS1742 RTC support' CONFIG_DS1742
3601 +tristate 'Double Talk PC internal speech card support' CONFIG_DTLK
3602 +tristate 'Siemens R3964 line discipline' CONFIG_R3964
3603 +tristate 'Applicom intelligent fieldbus card support' CONFIG_APPLICOM
3604 +if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_X86" = "y" -a "$CONFIG_X86_64" != "y" ]; then
3605 + dep_tristate 'Sony Vaio Programmable I/O Control Device support (EXPERIMENTAL)' CONFIG_SONYPI $CONFIG_PCI
3608 +mainmenu_option next_comment
3609 +comment 'Ftape, the floppy tape device driver'
3610 +tristate 'Ftape (QIC-80/Travan) support' CONFIG_FTAPE
3611 +if [ "$CONFIG_FTAPE" != "n" ]; then
3612 + source drivers/char/ftape/Config.in
3617 +if [ "$CONFIG_GART_IOMMU" = "y" ]; then
3618 + bool '/dev/agpgart (AGP Support)' CONFIG_AGP
3619 + define_bool CONFIG_AGP_AMD_K8 y
3621 + tristate '/dev/agpgart (AGP Support)' CONFIG_AGP
3623 +if [ "$CONFIG_AGP" != "n" ]; then
3624 + bool ' Intel 440LX/BX/GX and I815/I820/I830M/I830MP/I840/I845/I850/I860 support' CONFIG_AGP_INTEL
3625 + bool ' Intel I810/I815/I830M (on-board) support' CONFIG_AGP_I810
3626 + bool ' VIA chipset support' CONFIG_AGP_VIA
3627 + bool ' AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
3628 + if [ "$CONFIG_GART_IOMMU" != "y" ]; then
3629 + bool ' AMD Opteron/Athlon64 on-CPU GART support' CONFIG_AGP_AMD_K8
3631 + bool ' Generic SiS support' CONFIG_AGP_SIS
3632 + bool ' ALI chipset support' CONFIG_AGP_ALI
3633 + bool ' Serverworks LE/HE support' CONFIG_AGP_SWORKS
3634 + if [ "$CONFIG_X86" = "y" ]; then
3635 + bool ' NVIDIA chipset support' CONFIG_AGP_NVIDIA
3637 + if [ "$CONFIG_IA64" = "y" ]; then
3638 + bool ' Intel 460GX support' CONFIG_AGP_I460
3639 + bool ' HP ZX1 AGP support' CONFIG_AGP_HP_ZX1
3641 + bool ' ATI IGP chipset support' CONFIG_AGP_ATI
3644 +mainmenu_option next_comment
3645 +comment 'Direct Rendering Manager (XFree86 DRI support)'
3646 +bool 'Direct Rendering Manager (XFree86 DRI support)' CONFIG_DRM
3647 +if [ "$CONFIG_DRM" = "y" ]; then
3648 + bool ' Build drivers for old (XFree 4.0) DRM' CONFIG_DRM_OLD
3649 + if [ "$CONFIG_DRM_OLD" = "y" ]; then
3650 + comment 'DRM 4.0 drivers'
3651 + source drivers/char/drm-4.0/Config.in
3653 + comment 'DRM 4.1 drivers'
3654 + define_bool CONFIG_DRM_NEW y
3655 + source drivers/char/drm/Config.in
3659 +if [ "$CONFIG_X86" = "y" ]; then
3660 + tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE
3665 +if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then
3666 + source drivers/char/pcmcia/Config.in
3668 +if [ "$CONFIG_SOC_AU1X00" = "y" ]; then
3669 + tristate ' Alchemy Au1x00 GPIO device support' CONFIG_AU1X00_GPIO
3670 + tristate ' Au1000/ADS7846 touchscreen support' CONFIG_TS_AU1X00_ADS7846
3671 + #tristate ' Alchemy Au1550 PSC SPI support' CONFIG_AU1550_PSC_SPI
3673 +if [ "$CONFIG_MIPS_ITE8172" = "y" ]; then
3674 + tristate ' ITE GPIO' CONFIG_ITE_GPIO
3677 +if [ "$CONFIG_X86" = "y" ]; then
3678 + tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE
3679 + dep_tristate 'HP OB600 C/CT Pop-up mouse support' CONFIG_OBMOUSE $CONFIG_INPUT_MOUSEDEV
3683 diff -urN linux.old/drivers/char/Makefile linux.dev/drivers/char/Makefile
3684 --- linux.old/drivers/char/Makefile 2005-10-21 16:43:16.460960500 +0200
3685 +++ linux.dev/drivers/char/Makefile 2005-11-10 01:10:45.871576250 +0100
3686 @@ -240,6 +240,13 @@
3687 obj-y += joystick/js.o
3691 +# Texas Intruments VLYNQ driver
3694 +subdir-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq
3695 +obj-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq/avalanche_vlynq.o
3697 obj-$(CONFIG_FETCHOP) += fetchop.o
3698 obj-$(CONFIG_BUSMOUSE) += busmouse.o
3699 obj-$(CONFIG_DTLK) += dtlk.o
3700 @@ -340,6 +347,11 @@
3701 obj-y += ipmi/ipmi.o
3704 +subdir-$(CONFIG_AR7_ADAM2) += ticfg
3705 +ifeq ($(CONFIG_AR7_ADAM2),y)
3706 + obj-y += ticfg/ticfg.o
3709 include $(TOPDIR)/Rules.make
3712 diff -urN linux.old/drivers/char/Makefile.orig linux.dev/drivers/char/Makefile.orig
3713 --- linux.old/drivers/char/Makefile.orig 1970-01-01 01:00:00.000000000 +0100
3714 +++ linux.dev/drivers/char/Makefile.orig 2005-11-10 01:10:45.871576250 +0100
3717 +# Makefile for the kernel character device drivers.
3719 +# Note! Dependencies are done automagically by 'make dep', which also
3720 +# removes any old dependencies. DON'T put your own dependencies here
3721 +# unless it's something special (ie not a .c file).
3723 +# Note 2! The CFLAGS definitions are now inherited from the
3728 +# This file contains the font map for the default (hardware) font
3730 +FONTMAPFILE = cp437.uni
3734 +obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o raw.o pty.o misc.o random.o
3736 +# All of the (potential) objects that export symbols.
3737 +# This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
3739 +export-objs := busmouse.o console.o keyboard.o sysrq.o \
3740 + misc.o pty.o random.o selection.o serial.o \
3741 + sonypi.o tty_io.o tty_ioctl.o generic_serial.o \
3742 + au1000_gpio.o vac-serial.o hp_psaux.o nvram.o \
3743 + scx200.o fetchop.o
3745 +mod-subdirs := joystick ftape drm drm-4.0 pcmcia
3749 +KEYMAP =defkeymap.o
3754 +ifeq ($(ARCH),s390)
3761 +ifeq ($(ARCH),mips)
3762 + ifneq ($(CONFIG_PC_KEYB),y)
3765 + ifeq ($(CONFIG_VR41XX_KIU),y)
3766 + ifeq ($(CONFIG_IBM_WORKPAD),y)
3767 + KEYMAP = ibm_workpad_keymap.o
3769 + ifeq ($(CONFIG_VICTOR_MPC30X),y)
3770 + KEYMAP = victor_mpc30x_keymap.o
3772 + KEYBD = vr41xx_keyb.o
3776 +ifeq ($(ARCH),s390x)
3783 +ifeq ($(ARCH),m68k)
3784 + ifdef CONFIG_AMIGA
3794 +ifeq ($(ARCH),parisc)
3795 + ifdef CONFIG_GSC_PS2
3796 + KEYBD = hp_psaux.o hp_keyb.o
3800 + ifdef CONFIG_SERIAL_MUX
3803 + ifdef CONFIG_PDC_CONSOLE
3804 + CONSOLE += pdc_console.o
3809 + KEYBD += q40_keyb.o
3813 +ifdef CONFIG_APOLLO
3814 + KEYBD += dn_keyb.o
3817 +ifeq ($(ARCH),parisc)
3818 + ifdef CONFIG_GSC_PS2
3819 + KEYBD = hp_psaux.o hp_keyb.o
3823 + ifdef CONFIG_PDC_CONSOLE
3824 + CONSOLE += pdc_console.o
3829 + ifneq ($(CONFIG_PC_KEYMAP),y)
3832 + ifneq ($(CONFIG_PC_KEYB),y)
3841 + ifeq ($(CONFIG_SH_HP600),y)
3842 + KEYMAP = defkeymap.o
3843 + KEYBD = scan_keyb.o hp600_keyb.o
3844 + CONSOLE = console.o
3846 + ifeq ($(CONFIG_SH_DMIDA),y)
3847 + # DMIDA does not connect the HD64465 PS/2 keyboard port
3848 + # but we allow for USB keyboards to be plugged in.
3849 + KEYMAP = defkeymap.o
3850 + KEYBD = # hd64465_keyb.o pc_keyb.o
3851 + CONSOLE = console.o
3853 + ifeq ($(CONFIG_SH_EC3104),y)
3854 + KEYMAP = defkeymap.o
3855 + KEYBD = ec3104_keyb.o
3856 + CONSOLE = console.o
3858 + ifeq ($(CONFIG_SH_DREAMCAST),y)
3859 + KEYMAP = defkeymap.o
3861 + CONSOLE = console.o
3865 +ifeq ($(CONFIG_DECSTATION),y)
3870 +ifeq ($(CONFIG_BAGET_MIPS),y)
3872 + SERIAL = vac-serial.o
3875 +ifeq ($(CONFIG_NINO),y)
3879 +ifneq ($(CONFIG_SUN_SERIAL),)
3883 +ifeq ($(CONFIG_QTRONIX_KEYBOARD),y)
3885 + KEYMAP = qtronixmap.o
3888 +ifeq ($(CONFIG_DUMMY_KEYB),y)
3889 + KEYBD = dummy_keyb.o
3892 +obj-$(CONFIG_VT) += vt.o vc_screen.o consolemap.o consolemap_deftbl.o $(CONSOLE) selection.o
3893 +obj-$(CONFIG_SERIAL) += $(SERIAL)
3894 +obj-$(CONFIG_PARPORT_SERIAL) += parport_serial.o
3895 +obj-$(CONFIG_SERIAL_HCDP) += hcdp_serial.o
3896 +obj-$(CONFIG_SERIAL_21285) += serial_21285.o
3897 +obj-$(CONFIG_SERIAL_SA1100) += serial_sa1100.o
3898 +obj-$(CONFIG_SERIAL_AMBA) += serial_amba.o
3899 +obj-$(CONFIG_TS_AU1X00_ADS7846) += au1000_ts.o
3900 +obj-$(CONFIG_SERIAL_DEC) += decserial.o
3902 +ifndef CONFIG_SUN_KEYBOARD
3903 + obj-$(CONFIG_VT) += keyboard.o $(KEYMAP) $(KEYBD)
3905 + obj-$(CONFIG_PCI) += keyboard.o $(KEYMAP)
3908 +obj-$(CONFIG_HIL) += hp_keyb.o
3909 +obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
3910 +obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
3911 +obj-$(CONFIG_ROCKETPORT) += rocket.o
3912 +obj-$(CONFIG_MOXA_SMARTIO) += mxser.o
3913 +obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
3914 +obj-$(CONFIG_DIGI) += pcxx.o
3915 +obj-$(CONFIG_DIGIEPCA) += epca.o
3916 +obj-$(CONFIG_CYCLADES) += cyclades.o
3917 +obj-$(CONFIG_STALLION) += stallion.o
3918 +obj-$(CONFIG_ISTALLION) += istallion.o
3919 +obj-$(CONFIG_SIBYTE_SB1250_DUART) += sb1250_duart.o
3920 +obj-$(CONFIG_COMPUTONE) += ip2.o ip2main.o
3921 +obj-$(CONFIG_RISCOM8) += riscom8.o
3922 +obj-$(CONFIG_ISI) += isicom.o
3923 +obj-$(CONFIG_ESPSERIAL) += esp.o
3924 +obj-$(CONFIG_SYNCLINK) += synclink.o
3925 +obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o
3926 +obj-$(CONFIG_N_HDLC) += n_hdlc.o
3927 +obj-$(CONFIG_SPECIALIX) += specialix.o
3928 +obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
3929 +obj-$(CONFIG_A2232) += ser_a2232.o generic_serial.o
3930 +obj-$(CONFIG_SX) += sx.o generic_serial.o
3931 +obj-$(CONFIG_RIO) += rio/rio.o generic_serial.o
3932 +obj-$(CONFIG_SH_SCI) += sh-sci.o generic_serial.o
3933 +obj-$(CONFIG_SERIAL167) += serial167.o
3934 +obj-$(CONFIG_MVME147_SCC) += generic_serial.o vme_scc.o
3935 +obj-$(CONFIG_MVME162_SCC) += generic_serial.o vme_scc.o
3936 +obj-$(CONFIG_BVME6000_SCC) += generic_serial.o vme_scc.o
3937 +obj-$(CONFIG_HVC_CONSOLE) += hvc_console.o
3938 +obj-$(CONFIG_SERIAL_TX3912) += generic_serial.o serial_tx3912.o
3939 +obj-$(CONFIG_TXX927_SERIAL) += serial_txx927.o
3940 +obj-$(CONFIG_SERIAL_TXX9) += generic_serial.o serial_txx9.o
3941 +obj-$(CONFIG_IP22_SERIAL) += sgiserial.o
3942 +obj-$(CONFIG_AU1X00_UART) += au1x00-serial.o
3943 +obj-$(CONFIG_SGI_L1_SERIAL) += sn_serial.o
3945 +subdir-$(CONFIG_RIO) += rio
3946 +subdir-$(CONFIG_INPUT) += joystick
3948 +obj-$(CONFIG_ATIXL_BUSMOUSE) += atixlmouse.o
3949 +obj-$(CONFIG_LOGIBUSMOUSE) += logibusmouse.o
3950 +obj-$(CONFIG_PRINTER) += lp.o
3951 +obj-$(CONFIG_TIPAR) += tipar.o
3952 +obj-$(CONFIG_OBMOUSE) += obmouse.o
3954 +ifeq ($(CONFIG_INPUT),y)
3955 +obj-y += joystick/js.o
3959 +# Texas Intruments VLYNQ driver
3962 +subdir-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq
3963 +obj-$(CONFIG_AR7_VLYNQ) += avalanche_vlynq/avalanche_vlynq.o
3965 +obj-$(CONFIG_FETCHOP) += fetchop.o
3966 +obj-$(CONFIG_BUSMOUSE) += busmouse.o
3967 +obj-$(CONFIG_DTLK) += dtlk.o
3968 +obj-$(CONFIG_R3964) += n_r3964.o
3969 +obj-$(CONFIG_APPLICOM) += applicom.o
3970 +obj-$(CONFIG_SONYPI) += sonypi.o
3971 +obj-$(CONFIG_MS_BUSMOUSE) += msbusmouse.o
3972 +obj-$(CONFIG_82C710_MOUSE) += qpmouse.o
3973 +obj-$(CONFIG_AMIGAMOUSE) += amigamouse.o
3974 +obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
3975 +obj-$(CONFIG_ADBMOUSE) += adbmouse.o
3976 +obj-$(CONFIG_PC110_PAD) += pc110pad.o
3977 +obj-$(CONFIG_MK712_MOUSE) += mk712.o
3978 +obj-$(CONFIG_RTC) += rtc.o
3979 +obj-$(CONFIG_GEN_RTC) += genrtc.o
3980 +obj-$(CONFIG_EFI_RTC) += efirtc.o
3981 +obj-$(CONFIG_MIPS_RTC) += mips_rtc.o
3982 +obj-$(CONFIG_SGI_IP27_RTC) += ip27-rtc.o
3983 +ifeq ($(CONFIG_PPC),)
3984 + obj-$(CONFIG_NVRAM) += nvram.o
3986 +obj-$(CONFIG_TOSHIBA) += toshiba.o
3987 +obj-$(CONFIG_I8K) += i8k.o
3988 +obj-$(CONFIG_DS1286) += ds1286.o
3989 +obj-$(CONFIG_DS1620) += ds1620.o
3990 +obj-$(CONFIG_DS1742) += ds1742.o
3991 +obj-$(CONFIG_INTEL_RNG) += i810_rng.o
3992 +obj-$(CONFIG_AMD_RNG) += amd768_rng.o
3993 +obj-$(CONFIG_HW_RANDOM) += hw_random.o
3994 +obj-$(CONFIG_AMD_PM768) += amd76x_pm.o
3995 +obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o
3997 +obj-$(CONFIG_ITE_GPIO) += ite_gpio.o
3998 +obj-$(CONFIG_AU1X00_GPIO) += au1000_gpio.o
3999 +obj-$(CONFIG_AU1550_PSC_SPI) += au1550_psc_spi.o
4000 +obj-$(CONFIG_AU1X00_USB_TTY) += au1000_usbtty.o
4001 +obj-$(CONFIG_AU1X00_USB_RAW) += au1000_usbraw.o
4002 +obj-$(CONFIG_COBALT_LCD) += lcd.o
4004 +obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
4006 +subdir-$(CONFIG_FTAPE) += ftape
4007 +subdir-$(CONFIG_DRM_OLD) += drm-4.0
4008 +subdir-$(CONFIG_DRM_NEW) += drm
4009 +subdir-$(CONFIG_PCMCIA) += pcmcia
4010 +subdir-$(CONFIG_AGP) += agp
4012 +ifeq ($(CONFIG_FTAPE),y)
4013 +obj-y += ftape/ftape.o
4016 +obj-$(CONFIG_H8) += h8.o
4017 +obj-$(CONFIG_PPDEV) += ppdev.o
4018 +obj-$(CONFIG_DZ) += dz.o
4019 +obj-$(CONFIG_NWBUTTON) += nwbutton.o
4020 +obj-$(CONFIG_NWFLASH) += nwflash.o
4021 +obj-$(CONFIG_SCx200) += scx200.o
4022 +obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o
4024 +# Only one watchdog can succeed. We probe the hardware watchdog
4025 +# drivers first, then the softdog driver. This means if your hardware
4026 +# watchdog dies or is 'borrowed' for some reason the software watchdog
4027 +# still gives you some cover.
4029 +obj-$(CONFIG_PCWATCHDOG) += pcwd.o
4030 +obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
4031 +obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
4032 +obj-$(CONFIG_IB700_WDT) += ib700wdt.o
4033 +obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
4034 +obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
4035 +obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
4036 +obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
4037 +obj-$(CONFIG_WDT) += wdt.o
4038 +obj-$(CONFIG_WDTPCI) += wdt_pci.o
4039 +obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
4040 +obj-$(CONFIG_977_WATCHDOG) += wdt977.o
4041 +obj-$(CONFIG_I810_TCO) += i810-tco.o
4042 +obj-$(CONFIG_MACHZ_WDT) += machzwd.o
4043 +obj-$(CONFIG_SH_WDT) += shwdt.o
4044 +obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
4045 +obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
4046 +obj-$(CONFIG_ALIM1535_WDT) += alim1535d_wdt.o
4047 +obj-$(CONFIG_INDYDOG) += indydog.o
4048 +obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
4049 +obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
4050 +obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
4051 +obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
4052 +obj-$(CONFIG_INDYDOG) += indydog.o
4053 +obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
4055 +subdir-$(CONFIG_MWAVE) += mwave
4056 +ifeq ($(CONFIG_MWAVE),y)
4057 + obj-y += mwave/mwave.o
4060 +subdir-$(CONFIG_IPMI_HANDLER) += ipmi
4061 +ifeq ($(CONFIG_IPMI_HANDLER),y)
4062 + obj-y += ipmi/ipmi.o
4065 +include $(TOPDIR)/Rules.make
4069 +conmakehash: conmakehash.c
4070 + $(HOSTCC) $(HOSTCFLAGS) -o conmakehash conmakehash.c
4072 +consolemap_deftbl.c: $(FONTMAPFILE) conmakehash
4073 + ./conmakehash $(FONTMAPFILE) > consolemap_deftbl.c
4075 +consolemap_deftbl.o: consolemap_deftbl.c $(TOPDIR)/include/linux/types.h
4079 +defkeymap.c: defkeymap.map
4080 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4082 +qtronixmap.c: qtronixmap.map
4083 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4085 +ibm_workpad_keymap.c: ibm_workpad_keymap.map
4086 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4088 +victor_mpc30x_keymap.c: victor_mpc30x_keymap.map
4089 + set -e ; loadkeys --mktable $< | sed -e 's/^static *//' > $@
4090 diff -urN linux.old/drivers/char/avalanche_vlynq/Makefile linux.dev/drivers/char/avalanche_vlynq/Makefile
4091 --- linux.old/drivers/char/avalanche_vlynq/Makefile 1970-01-01 01:00:00.000000000 +0100
4092 +++ linux.dev/drivers/char/avalanche_vlynq/Makefile 2005-11-10 01:10:45.871576250 +0100
4095 +# Makefile for the linux kernel.
4097 +# Note! Dependencies are done automagically by 'make dep', which also
4098 +# removes any old dependencies. DON'T put your own dependencies here
4099 +# unless it's something special (ie not a .c file).
4101 +# Note 2! The CFLAGS definitions are now in the main makefile...
4103 +O_TARGET := avalanche_vlynq.o
4105 +export-objs := vlynq_board.o
4107 +obj-y += vlynq_drv.o vlynq_hal.o vlynq_board.o
4109 +include $(TOPDIR)/Rules.make
4110 diff -urN linux.old/drivers/char/avalanche_vlynq/vlynq_board.c linux.dev/drivers/char/avalanche_vlynq/vlynq_board.c
4111 --- linux.old/drivers/char/avalanche_vlynq/vlynq_board.c 1970-01-01 01:00:00.000000000 +0100
4112 +++ linux.dev/drivers/char/avalanche_vlynq/vlynq_board.c 2005-11-10 01:10:45.871576250 +0100
4115 + * Jeff Harrell, jharrell@ti.com
4116 + * Copyright (C) 2001 Texas Instruments, Inc. All rights reserved.
4118 + * This program is free software; you can distribute it and/or modify it
4119 + * under the terms of the GNU General Public License (Version 2) as
4120 + * published by the Free Software Foundation.
4122 + * This program is distributed in the hope it will be useful, but WITHOUT
4123 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4124 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4125 + * for more details.
4127 + * You should have received a copy of the GNU General Public License along
4128 + * with this program; if not, write to the Free Software Foundation, Inc.,
4129 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4131 + * Texas Instruments Sangam specific setup.
4133 +#include <linux/config.h>
4134 +#include <linux/module.h>
4135 +#include <asm/ar7/sangam.h>
4136 +#include <asm/ar7/avalanche_misc.h>
4137 +#include <asm/ar7/vlynq.h>
4139 +#define SYS_VLYNQ_LOCAL_INTERRUPT_VECTOR 30 /* MSB - 1 bit */
4140 +#define SYS_VLYNQ_REMOTE_INTERRUPT_VECTOR 31 /* MSB bit */
4141 +#define SYS_VLYNQ_OPTIONS 0x7F; /* all options*/
4143 +/* These defines are board specific */
4146 +#define VLYNQ0_REMOTE_WINDOW1_OFFSET (0x0C000000)
4147 +#define VLYNQ0_REMOTE_WINDOW1_SIZE (0x500)
4150 +#define VLYNQ1_REMOTE_WINDOW1_OFFSET (0x0C000000)
4151 +#define VLYNQ1_REMOTE_WINDOW1_SIZE (0x500)
4154 +extern VLYNQ_DEV vlynqDevice0, vlynqDevice1;
4155 +int vlynq_init_status[2] = {0, 0};
4156 +EXPORT_SYMBOL(vlynq_init_status);
4157 +static int reset_hack = 1;
4159 +void vlynq_ar7wrd_dev_init()
4161 + *(unsigned long*) AVALANCHE_GPIO_ENBL |= (1<<18);
4162 + vlynq_delay(20000);
4163 + *(unsigned long*) AVALANCHE_GPIO_DIR &= ~(1<<18);
4164 + vlynq_delay(20000);
4165 + *(unsigned long*) AVALANCHE_GPIO_DATA_OUT&= ~(1<<18);
4166 + vlynq_delay(50000);
4167 + *(unsigned long*) AVALANCHE_GPIO_DATA_OUT|= (1<<18);
4168 + vlynq_delay(50000);
4170 + /* Initialize the MIPS host vlynq driver for a given vlynq interface */
4171 + vlynqDevice0.dev_idx = 0; /* first vlynq module - this parameter is for reference only */
4172 + vlynqDevice0.module_base = AVALANCHE_LOW_VLYNQ_CONTROL_BASE; /* vlynq0 module base address */
4174 +#if defined(CONFIG_VLYNQ_CLK_LOCAL)
4175 + vlynqDevice0.clk_source = VLYNQ_CLK_SOURCE_LOCAL;
4177 + vlynqDevice0.clk_source = VLYNQ_CLK_SOURCE_REMOTE;
4179 + vlynqDevice0.clk_div = 0x01; /* board/hardware specific */
4180 + vlynqDevice0.state = VLYNQ_DRV_STATE_UNINIT; /* uninitialized module */
4182 + /* Populate vlynqDevice0.local_mem & Vlynq0.remote_mem based on system configuration */
4183 + /*Local memory configuration */
4185 + /* Demiurg : not good !*/
4187 + vlynqDevice0.local_mem.Txmap= AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE & ~(0xc0000000) ; /* physical address */
4188 + vlynqDevice0.remote_mem.RxOffset[0]= VLYNQ0_REMOTE_WINDOW1_OFFSET; /* This is specific to the board on the other end */
4189 + vlynqDevice0.remote_mem.RxSize[0]=VLYNQ0_REMOTE_WINDOW1_SIZE;
4192 + /* Demiurg : This is how it should be ! */
4193 + vlynqDevice0.local_mem.Txmap = PHYSADDR(AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE);
4194 +#define VLYNQ_ACX111_MEM_OFFSET 0xC0000000 /* Physical address of ACX111 memory */
4195 +#define VLYNQ_ACX111_MEM_SIZE 0x00040000 /* Total size of the ACX111 memory */
4196 +#define VLYNQ_ACX111_REG_OFFSET 0xF0000000 /* PHYS_ADDR of ACX111 control registers */
4197 +#define VLYNQ_ACX111_REG_SIZE 0x00022000 /* Size of ACX111 registers area, MAC+PHY */
4198 +#define ACX111_VL1_REMOTE_SIZE 0x1000000
4199 + vlynqDevice0.remote_mem.RxOffset[0] = VLYNQ_ACX111_MEM_OFFSET;
4200 + vlynqDevice0.remote_mem.RxSize[0] = VLYNQ_ACX111_MEM_SIZE ;
4201 + vlynqDevice0.remote_mem.RxOffset[1] = VLYNQ_ACX111_REG_OFFSET;
4202 + vlynqDevice0.remote_mem.RxSize[1] = VLYNQ_ACX111_REG_SIZE ;
4203 + vlynqDevice0.remote_mem.Txmap = 0;
4204 + vlynqDevice0.local_mem.RxOffset[0] = AVALANCHE_SDRAM_BASE;
4205 + vlynqDevice0.local_mem.RxSize[0] = ACX111_VL1_REMOTE_SIZE;
4208 + /* Local interrupt configuration */
4209 + vlynqDevice0.local_irq.intLocal = VLYNQ_INT_LOCAL; /* Host handles vlynq interrupts*/
4210 + vlynqDevice0.local_irq.intRemote = VLYNQ_INT_ROOT_ISR; /* vlynq root isr used */
4211 + vlynqDevice0.local_irq.map_vector = SYS_VLYNQ_LOCAL_INTERRUPT_VECTOR;
4212 + vlynqDevice0.local_irq.intr_ptr = 0; /* Since remote interrupts part of vlynq root isr this is unused */
4214 + /* Remote interrupt configuration */
4215 + vlynqDevice0.remote_irq.intLocal = VLYNQ_INT_REMOTE; /* MIPS handles interrupts */
4216 + vlynqDevice0.remote_irq.intRemote = VLYNQ_INT_ROOT_ISR; /* Not significant since MIPS handles interrupts */
4217 + vlynqDevice0.remote_irq.map_vector = SYS_VLYNQ_REMOTE_INTERRUPT_VECTOR;
4218 + vlynqDevice0. remote_irq.intr_ptr = AVALANCHE_INTC_BASE; /* Not significant since MIPS handles interrupts */
4220 + if(reset_hack != 1)
4221 + printk("About to re-init the VLYNQ.\n");
4223 + if(vlynq_init(&vlynqDevice0,VLYNQ_INIT_PERFORM_ALL)== 0)
4225 + /* Suraj added the following to keep the 1130 going. */
4226 + vlynq_interrupt_vector_set(&vlynqDevice0, 0 /* intr vector line running into 1130 vlynq */,
4227 + 0 /* intr mapped onto the interrupt register on remote vlynq and this vlynq */,
4228 + VLYNQ_REMOTE_DVC, 0 /* polarity active high */, 0 /* interrupt Level triggered */);
4230 + /* System wide interrupt is 80 for 1130, please note. */
4231 + vlynq_init_status[0] = 1;
4236 + if(reset_hack == 1)
4237 + printk("VLYNQ INIT FAILED: Please try cold reboot. \n");
4239 + printk("Failed to initialize the VLYNQ interface at insmod.\n");
4244 +void vlynq_dev_init(void)
4246 + volatile unsigned int *reset_base = (unsigned int *) AVALANCHE_RESET_CONTROL_BASE;
4248 + *reset_base &= ~((1 << AVALANCHE_LOW_VLYNQ_RESET_BIT)); /* | (1 << AVALANCHE_HIGH_VLYNQ_RESET_BIT)); */
4250 + vlynq_delay(20000);
4252 + /* Bring vlynq out of reset if not already done */
4253 + *reset_base |= (1 << AVALANCHE_LOW_VLYNQ_RESET_BIT); /* | (1 << AVALANCHE_HIGH_VLYNQ_RESET_BIT); */
4254 + vlynq_delay(20000); /* Allowing sufficient time to VLYNQ to settle down.*/
4256 + vlynq_ar7wrd_dev_init( );
4260 +/* This function is board specific and should be ported for each board. */
4261 +void remote_vlynq_dev_reset_ctrl(unsigned int module_reset_bit,
4262 + AVALANCHE_RESET_CTRL_T reset_ctrl)
4264 + if(module_reset_bit >= 32)
4267 + switch(module_reset_bit)
4270 + if(OUT_OF_RESET == reset_ctrl)
4272 + if(reset_hack) return;
4274 + vlynq_delay(20000);
4275 + printk("Un-resetting the remote device.\n");
4277 + printk("Re-initialized the VLYNQ.\n");
4280 + else if(IN_RESET == reset_ctrl)
4282 + *(unsigned long*) AVALANCHE_GPIO_DATA_OUT &= ~(1<<18);
4284 + vlynq_delay(20000);
4285 + printk("Resetting the remote device.\n");
4298 diff -urN linux.old/drivers/char/avalanche_vlynq/vlynq_drv.c linux.dev/drivers/char/avalanche_vlynq/vlynq_drv.c
4299 --- linux.old/drivers/char/avalanche_vlynq/vlynq_drv.c 1970-01-01 01:00:00.000000000 +0100
4300 +++ linux.dev/drivers/char/avalanche_vlynq/vlynq_drv.c 2005-11-10 01:10:45.891577500 +0100
4302 +/******************************************************************************
4303 + * FILE PURPOSE: Vlynq Linux Device Driver Source
4304 + ******************************************************************************
4305 + * FILE NAME: vlynq_drv.c
4307 + * DESCRIPTION: Vlynq Linux Device Driver Source
4309 + * REVISION HISTORY:
4311 + * Date Description Author
4312 + *-----------------------------------------------------------------------------
4313 + * 17 July 2003 Initial Creation Anant Gole
4314 + * 17 Dec 2003 Updates Sharath Kumar
4316 + * (C) Copyright 2003, Texas Instruments, Inc
4317 + *******************************************************************************/
4319 +#include <linux/config.h>
4320 +#include <linux/init.h>
4321 +#include <linux/module.h>
4322 +#include <linux/sched.h>
4323 +#include <linux/miscdevice.h>
4324 +#include <linux/smp_lock.h>
4325 +#include <linux/delay.h>
4326 +#include <linux/proc_fs.h>
4327 +#include <linux/capability.h>
4328 +#include <asm/ar7/avalanche_intc.h>
4329 +#include <asm/ar7/sangam.h>
4330 +#include <asm/ar7/vlynq.h>
4333 +#define TI_VLYNQ_VERSION "0.2"
4336 +#define VLYNQ_DEBUG
4338 +/* Macro for debug and error printf's */
4340 +#define DBGPRINT printk
4342 +#define DBGPRINT(x)
4345 +#define ERRPRINT printk
4347 +/* Define the max vlynq ports this driver will support.
4348 + Device name strings are statically added here */
4349 +#define MAX_VLYNQ_PORTS 2
4352 +/* Type define for VLYNQ private structure */
4353 +typedef struct vlynqPriv{
4355 + VLYNQ_DEV *vlynqDevice;
4358 +extern int vlynq_init_status[2];
4360 +/* Extern Global variable for vlynq devices used in initialization of the vlynq device
4361 + * These variables need to be populated/initialized by the system as part of initialization
4362 + * process. The vlynq enumerator can run at initialization and populate these globals
4365 +VLYNQ_DEV vlynqDevice0;
4366 +VLYNQ_DEV vlynqDevice1;
4368 +/* Defining dummy macro AVALANCHE_HIGH_VLYNQ_INT to take
4369 + * care of compilation in case of single vlynq device
4372 +#ifndef AVALANCHE_HIGH_VLYNQ_INT
4373 +#define AVALANCHE_HIGH_VLYNQ_INT 0
4378 +/* vlynq private object */
4379 +VLYNQ_PRIV vlynq_priv[CONFIG_AR7_VLYNQ_PORTS] = {
4380 + { LNXINTNUM(AVALANCHE_LOW_VLYNQ_INT),&vlynqDevice0},
4381 + { LNXINTNUM(AVALANCHE_HIGH_VLYNQ_INT),&vlynqDevice1},
4384 +extern void vlynq_dev_init(void);
4387 +/* =================================== all the operations */
4390 +vlynq_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
4395 +static struct file_operations vlynq_fops = {
4396 + owner: THIS_MODULE,
4397 + ioctl: vlynq_ioctl,
4400 +/* Vlynq device object */
4401 +static struct miscdevice vlynq_dev [MAX_VLYNQ_PORTS] = {
4402 + { MISC_DYNAMIC_MINOR , "vlynq0", &vlynq_fops },
4403 + { MISC_DYNAMIC_MINOR , "vlynq1", &vlynq_fops },
4407 +/* Proc read function */
4409 +vlynq_read_link_proc(char *buf, char **start, off_t offset, int count, int *eof, void *unused)
4414 + len += sprintf(buf +len,"VLYNQ Devices : %d\n",CONFIG_AR7_VLYNQ_PORTS);
4416 + for(instance =0;instance < CONFIG_AR7_VLYNQ_PORTS;instance++)
4419 + char *link_msg[] = {" DOWN "," UP "};
4421 + if(vlynq_init_status[instance] == 0)
4424 + else if (vlynq_link_check(vlynq_priv[instance].vlynqDevice))
4430 + len += sprintf(buf + len, "VLYNQ %d: Link state: %s\n",instance,link_msg[link_state]);
4433 + /* Print info about vlynq device 1 */
4439 +/* Proc function to display driver version */
4441 +vlynq_read_ver_proc(char *buf, char **start, off_t offset, int count, int *eof, void *data)
4446 + len += sprintf(buf +len,"\nTI Linux VLYNQ Driver Version %s\n",TI_VLYNQ_VERSION);
4453 +/* Wrapper for vlynq ISR */
4454 +static void lnx_vlynq_root_isr(int irq, void * arg, struct pt_regs *regs)
4456 + vlynq_root_isr(arg);
4459 +/* =================================== init and cleanup */
4461 +int vlynq_init_module(void)
4465 + int instance_count = CONFIG_AR7_VLYNQ_PORTS;
4466 + volatile int *ptr;
4470 + DBGPRINT("Vlynq CONFIG_AR7_VLYNQ_PORTS=%d\n", CONFIG_AR7_VLYNQ_PORTS);
4471 + /* If num of configured vlynq ports > supported by driver return error */
4472 + if (instance_count > MAX_VLYNQ_PORTS)
4474 + ERRPRINT("ERROR: vlynq_init_module(): Max %d supported\n", MAX_VLYNQ_PORTS);
4478 + /* register the misc device */
4479 + for (unit = 0; unit < CONFIG_AR7_VLYNQ_PORTS; unit++)
4481 + ret = misc_register(&vlynq_dev[unit]);
4485 + ERRPRINT("ERROR:Could not register vlynq device:%d\n",unit);
4489 + DBGPRINT("Vlynq Device %s registered with minor no %d as misc device. Result=%d\n",
4490 + vlynq_dev[unit].name, vlynq_dev[unit].minor, ret);
4493 + DBGPRINT("Calling vlynq init\n");
4495 + /* Read the global variable for VLYNQ device structure and initialize vlynq driver */
4496 + ret = vlynq_init(vlynq_priv[unit].vlynqDevice,VLYNQ_INIT_PERFORM_ALL );
4499 + if(vlynq_init_status[unit] == 0)
4501 + printk("VLYNQ %d : init failed\n",unit);
4505 + /* Check link before proceeding */
4506 + if (!vlynq_link_check(vlynq_priv[unit].vlynqDevice))
4508 + DBGPRINT("\nError: Vlynq link not available.trying once before Exiting");
4512 + DBGPRINT("Vlynq instance:%d Link UP\n",unit);
4514 + /* Install the vlynq local root ISR */
4515 + request_irq(vlynq_priv[unit].irq,lnx_vlynq_root_isr,0,vlynq_dev[unit].name,vlynq_priv[unit].vlynqDevice);
4519 + proc_mkdir("avalanche", NULL);
4520 + /* Creating proc entry for the devices */
4521 + create_proc_read_entry("avalanche/vlynq_link", 0, NULL, vlynq_read_link_proc, NULL);
4522 + create_proc_read_entry("avalanche/vlynq_ver", 0, NULL, vlynq_read_ver_proc, NULL);
4527 +void vlynq_cleanup_module(void)
4531 + for (unit = 0; unit < CONFIG_AR7_VLYNQ_PORTS; unit++)
4533 + DBGPRINT("vlynq_cleanup_module(): Unregistring misc device %s\n",vlynq_dev[unit].name);
4534 + misc_deregister(&vlynq_dev[unit]);
4537 + remove_proc_entry("avalanche/vlynq_link", NULL);
4538 + remove_proc_entry("avalanche/vlynq_ver", NULL);
4542 +module_init(vlynq_init_module);
4543 +module_exit(vlynq_cleanup_module);
4545 diff -urN linux.old/drivers/char/avalanche_vlynq/vlynq_hal.c linux.dev/drivers/char/avalanche_vlynq/vlynq_hal.c
4546 --- linux.old/drivers/char/avalanche_vlynq/vlynq_hal.c 1970-01-01 01:00:00.000000000 +0100
4547 +++ linux.dev/drivers/char/avalanche_vlynq/vlynq_hal.c 2005-11-10 01:10:45.975582750 +0100
4549 +/***************************************************************************
4550 +**+----------------------------------------------------------------------+**
4554 +**| ********_///_**** |**
4555 +**| ***** /_//_/ **** |**
4556 +**| ** ** (__/ **** |**
4561 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
4562 +**| ALL RIGHTS RESERVED |**
4564 +**| Permission is hereby granted to licensees of Texas Instruments |**
4565 +**| Incorporated (TI) products to use this computer program for the sole |**
4566 +**| purpose of implementing a licensee product based on TI products. |**
4567 +**| No other rights to reproduce, use, or disseminate this computer |**
4568 +**| program, whether in part or in whole, are granted. |**
4570 +**| TI makes no representation or warranties with respect to the |**
4571 +**| performance of this computer program, and specifically disclaims |**
4572 +**| any responsibility for any damages, special or consequential, |**
4573 +**| connected with the use of this program. |**
4575 +**+----------------------------------------------------------------------+**
4576 +***************************************************************************/
4578 +/***************************************************************************
4579 + * ------------------------------------------------------------------------------
4580 + * Module : vlynq_hal.c
4581 + * Description : This file implements VLYNQ HAL API.
4582 + * ------------------------------------------------------------------------------
4583 + ***************************************************************************/
4585 +#include <linux/stddef.h>
4586 +#include <linux/types.h>
4587 +#include <asm/ar7/vlynq.h>
4589 +/**** Local Function prototypes *******/
4590 +static int vlynqInterruptInit(VLYNQ_DEV *pdev);
4591 +static void vlynq_configClock(VLYNQ_DEV *pdev);
4593 +/*** Second argument must be explicitly type casted to
4594 + * (VLYNQ_DEV*) inside the following functions */
4595 +static void vlynq_local_module_isr(void *arg1, void *arg2, void *arg3);
4596 +static void vlynq_remote_module_isr(void *arg1, void *arg2, void *arg3);
4599 +volatile int vlynq_delay_value = 0;
4601 +/* Code adopted from original vlynq driver */
4602 +void vlynq_delay(unsigned int clktime)
4605 + volatile int *ptr = &vlynq_delay_value;
4608 + /* We are assuming that the each cycle takes about
4609 + * 23 assembly instructions. */
4610 + for(i = 0; i < (clktime + 23)/23; i++)
4617 +/* ----------------------------------------------------------------------------
4618 + * Function : vlynq_configClock()
4619 + * Description: Configures clock settings based on input parameters
4620 + * Adapted from original vlyna driver from Cable
4622 +static void vlynq_configClock(VLYNQ_DEV * pdev)
4626 + switch( pdev->clk_source)
4628 + case VLYNQ_CLK_SOURCE_LOCAL: /* we output the clock, clk_div in range [1..8]. */
4629 + tmp = ((pdev->clk_div - 1) << 16) | VLYNQ_CTL_CLKDIR_MASK ;
4630 + VLYNQ_CTRL_REG = tmp;
4631 + VLYNQ_R_CTRL_REG = 0ul;
4633 + case VLYNQ_CLK_SOURCE_REMOTE: /* we need to set the clock pin as input */
4634 + VLYNQ_CTRL_REG = 0ul;
4635 + tmp = ((pdev->clk_div - 1) << 16) | VLYNQ_CTL_CLKDIR_MASK ;
4636 + VLYNQ_R_CTRL_REG = tmp;
4638 + default: /* do nothing about the clock, but clear other bits. */
4639 + tmp = ~(VLYNQ_CTL_CLKDIR_MASK | VLYNQ_CTL_CLKDIV_MASK);
4640 + VLYNQ_CTRL_REG &= tmp;
4645 + /* ----------------------------------------------------------------------------
4646 + * Function : vlynq_link_check()
4647 + * Description: This function checks the current VLYNQ for a link.
4648 + * An arbitrary amount of time is allowed for the link to come up .
4649 + * Returns 0 for "no link / failure " and 1 for "link available".
4650 + * -----------------------------------------------------------------------------
4652 +unsigned int vlynq_link_check( VLYNQ_DEV * pdev)
4654 + /*sleep for 64 cycles, allow link to come up*/
4657 + /* check status register return OK if link is found. */
4658 + if (VLYNQ_STATUS_REG & VLYNQ_STS_LINK_MASK)
4660 + return 1; /* Link Available */
4664 + return 0; /* Link Failure */
4668 +/* ----------------------------------------------------------------------------
4669 + * Function : vlynq_init()
4670 + * Description: Initialization function accepting paramaters for VLYNQ module
4671 + * initialization. The Options bitmap decides what operations are performed
4672 + * as a part of initialization. The Input parameters are obtained through the
4673 + * sub fields of VLYNQ_DEV structure.
4676 +int vlynq_init(VLYNQ_DEV *pdev, VLYNQ_INIT_OPTIONS options)
4679 + unsigned int val=0,cnt,tmp;
4680 + unsigned int counter=0;
4681 + VLYNQ_INTERRUPT_CNTRL *intSetting=NULL;
4683 + /* validate arguments */
4684 + if( VLYNQ_OUTRANGE(pdev->clk_source, VLYNQ_CLK_SOURCE_REMOTE, VLYNQ_CLK_SOURCE_NONE) ||
4685 + VLYNQ_OUTRANGE(pdev->clk_div, 8, 1) )
4687 + return VLYNQ_INVALID_ARG;
4690 + /** perform all sanity checks first **/
4691 + if(pdev->state != VLYNQ_DRV_STATE_UNINIT)
4692 + return VLYNQ_INVALID_DRV_STATE;
4694 + /** Initialize local and remote register set addresses- additional
4695 + * provision to access the registers directly if need be */
4696 + pdev->local = (VLYNQ_REG_SET*)pdev->module_base;
4697 + pdev->remote = (VLYNQ_REG_SET*) (pdev->module_base + VLYNQ_REMOTE_REGS_OFFSET);
4699 + /* Detect faulty int configuration that might induce int pkt looping */
4700 + if ( (options & VLYNQ_INIT_LOCAL_INTERRUPTS) && (options & VLYNQ_INIT_REMOTE_INTERRUPTS) )
4702 + /* case when both local and remote are configured */
4703 + if((pdev->local_irq.intLocal== VLYNQ_INT_REMOTE ) /* interrupts transfered to remote from local */
4704 + && (pdev->remote_irq.intLocal== VLYNQ_INT_REMOTE) /* interrupts transfered from remote to local */
4705 + && ((pdev->local_irq.intRemote == VLYNQ_INT_ROOT_ISR) || (pdev->remote_irq.intRemote == VLYNQ_INT_ROOT_ISR)) )
4707 + return (VLYNQ_INT_CONFIG_ERR);
4711 + pdev->state = VLYNQ_DRV_STATE_ININIT;
4712 + pdev->intCount = 0;
4713 + pdev->isrCount = 0;
4715 + /*** Its assumed that the vlynq module has been brought out of reset
4716 + * before invocation of vlynq_init. Since, this operation is board specific
4717 + * it must be handled outside this generic driver */
4719 + /* Assert reset the remote device, call reset_cb,
4720 + * reset CB holds Reset according to the device needs. */
4721 + VLYNQ_RESETCB(VLYNQ_RESET_ASSERT);
4723 + /* Handle VLYNQ clock, HW default (Sense On Reset) is
4724 + * usually input for all the devices. */
4725 + if (options & VLYNQ_INIT_CONFIG_CLOCK)
4727 + vlynq_configClock(pdev);
4730 + /* Call reset_cb again. It will release the remote device
4731 + * from reset, and wait for a while. */
4732 + VLYNQ_RESETCB(VLYNQ_RESET_DEASSERT);
4734 + if(options & VLYNQ_INIT_CHECK_LINK )
4736 + /* Check for link up during initialization*/
4737 + while( counter < 25 )
4739 + /* loop around giving a chance for link status to settle down */
4741 + if(vlynq_link_check(pdev))
4743 + /* Link is up exit loop*/
4747 + vlynq_delay(4000);
4748 + }/*end of while counter loop */
4750 + if(!vlynq_link_check(pdev))
4752 + /* Handle this case as abort */
4753 + pdev->state = VLYNQ_DRV_STATE_ERROR;
4754 + VLYNQ_RESETCB( VLYNQ_RESET_INITFAIL);
4755 + return VLYNQ_LINK_DOWN;
4756 + }/* end of if not vlynq_link_check conditional block */
4758 + }/*end of if options & VLYNQ_INIT_CHECK_LINK conditional block */
4761 + if (options & VLYNQ_INIT_LOCAL_MEM_REGIONS)
4763 + /* Initialise local memory regions . This initialization lets
4764 + * the local host access remote device memory regions*/
4767 + /* configure the VLYNQ portal window to a PHYSICAL
4768 + * address of the local CPU */
4769 + VLYNQ_ALIGN4(pdev->local_mem.Txmap);
4770 + VLYNQ_TXMAP_REG = (pdev->local_mem.Txmap);
4772 + /*This code assumes input parameter is itself a physical address */
4773 + for(i=0; i < VLYNQ_MAX_MEMORY_REGIONS ; i++)
4775 + /* Physical address on the remote */
4777 + VLYNQ_R_RXMAP_SIZE_REG(map) = 0;
4778 + if( pdev->remote_mem.RxSize[i])
4780 + VLYNQ_ALIGN4(pdev->remote_mem.RxOffset[i]);
4781 + VLYNQ_ALIGN4(pdev->remote_mem.RxSize[i]);
4782 + VLYNQ_R_RXMAP_OFFSET_REG(map) = pdev->remote_mem.RxOffset[i];
4783 + VLYNQ_R_RXMAP_SIZE_REG(map) = pdev->remote_mem.RxSize[i];
4788 + if(options & VLYNQ_INIT_REMOTE_MEM_REGIONS )
4792 + /* Initialise remote memory regions. This initialization lets remote
4793 + * device access local host memory regions. It configures the VLYNQ portal
4794 + * window to a PHYSICAL address of the remote */
4795 + VLYNQ_ALIGN4(pdev->remote_mem.Txmap);
4796 + VLYNQ_R_TXMAP_REG = pdev->remote_mem.Txmap;
4798 + for( i=0; i<VLYNQ_MAX_MEMORY_REGIONS; i++)
4800 + /* Physical address on the local */
4802 + VLYNQ_RXMAP_SIZE_REG(map) = 0;
4803 + if( pdev->local_mem.RxSize[i])
4805 + VLYNQ_ALIGN4(pdev->local_mem.RxOffset[i]);
4806 + VLYNQ_ALIGN4(pdev->local_mem.RxSize[i]);
4807 + VLYNQ_RXMAP_OFFSET_REG(map) = (pdev->local_mem.RxOffset[i]);
4808 + VLYNQ_RXMAP_SIZE_REG(map) = (pdev->local_mem.RxSize[i]);
4813 + /* Adapted from original vlynq driver from cable - Calculate VLYNQ bus width */
4814 + pdev->width = 3 + VLYNQ_STATUS_FLD_WIDTH(VLYNQ_STATUS_REG)
4815 + + VLYNQ_STATUS_FLD_WIDTH(VLYNQ_R_STATUS_REG);
4817 + /* chance to initialize the device, e.g. to boost VLYNQ
4818 + * clock by modifying pdev->clk_div or and verify the width. */
4819 + VLYNQ_RESETCB(VLYNQ_RESET_LINKESTABLISH);
4821 + /* Handle VLYNQ clock, HW default (Sense On Reset) is
4822 + * usually input for all the devices. */
4823 + if(options & VLYNQ_INIT_CONFIG_CLOCK )
4825 + vlynq_configClock(pdev);
4828 + /* last check for link*/
4829 + if(options & VLYNQ_INIT_CHECK_LINK )
4831 + /* Final Check for link during initialization*/
4832 + while( counter < 25 )
4834 + /* loop around giving a chance for link status to settle down */
4836 + if(vlynq_link_check(pdev))
4838 + /* Link is up exit loop*/
4842 + vlynq_delay(4000);
4843 + }/*end of while counter loop */
4845 + if(!vlynq_link_check(pdev))
4847 + /* Handle this case as abort */
4848 + pdev->state = VLYNQ_DRV_STATE_ERROR;
4849 + VLYNQ_RESETCB( VLYNQ_RESET_INITFAIL);
4850 + return VLYNQ_LINK_DOWN;
4851 + }/* end of if not vlynq_link_check conditional block */
4853 + } /* end of if options & VLYNQ_INIT_CHECK_LINK */
4855 + if(options & VLYNQ_INIT_LOCAL_INTERRUPTS )
4857 + /* Configure local interrupt settings */
4858 + intSetting = &(pdev->local_irq);
4860 + /* Map local module status interrupts to interrupt vector*/
4861 + val = intSetting->map_vector << VLYNQ_CTL_INTVEC_SHIFT ;
4863 + /* enable local module status interrupts */
4864 + val |= 0x01 << VLYNQ_CTL_INTEN_SHIFT;
4866 + if ( intSetting->intLocal == VLYNQ_INT_LOCAL )
4868 + /*set the intLocal bit*/
4869 + val |= 0x01 << VLYNQ_CTL_INTLOCAL_SHIFT;
4872 + /* Irrespective of whether interrupts are handled locally, program
4873 + * int2Cfg. Error checking for accidental loop(when intLocal=0 and int2Cfg=1
4874 + * i.e remote packets are set intPending register->which will result in
4875 + * same packet being sent out) has been done already
4878 + if (intSetting->intRemote == VLYNQ_INT_ROOT_ISR)
4880 + /* Set the int2Cfg register, so that remote interrupt
4881 + * packets are written to intPending register */
4882 + val |= 0x01 << VLYNQ_CTL_INT2CFG_SHIFT;
4884 + /* Set intPtr register to point to intPending register */
4885 + VLYNQ_INT_PTR_REG = VLYNQ_INT_PENDING_REG_PTR ;
4889 + /*set the interrupt pointer register*/
4890 + VLYNQ_INT_PTR_REG = intSetting->intr_ptr;
4891 + /* Dont bother to modify int2Cfg as it would be zero */
4894 + /** Clear bits related to INT settings in control register **/
4895 + VLYNQ_CTRL_REG = VLYNQ_CTRL_REG & (~VLYNQ_CTL_INTFIELDS_CLEAR_MASK);
4897 + /** Or the bits to be set with Control register **/
4898 + VLYNQ_CTRL_REG = VLYNQ_CTRL_REG | val;
4900 + /* initialise local ICB */
4901 + if(vlynqInterruptInit(pdev)==VLYNQ_MEMALLOC_FAIL)
4902 + return VLYNQ_MEMALLOC_FAIL;
4904 + /* Install handler for local module status interrupts. By default when
4905 + * local interrupt setting is initialised, the local module status are
4906 + * enabled and handler hooked up */
4907 + if(vlynq_install_isr(pdev, intSetting->map_vector, vlynq_local_module_isr,
4908 + pdev, NULL, NULL) == VLYNQ_INVALID_ARG)
4909 + return VLYNQ_INVALID_ARG;
4910 + } /* end of init local interrupts */
4912 + if(options & VLYNQ_INIT_REMOTE_INTERRUPTS )
4914 + /* Configure remote interrupt settings from configuration */
4915 + intSetting = &(pdev->remote_irq);
4917 + /* Map remote module status interrupts to remote interrupt vector*/
4918 + val = intSetting->map_vector << VLYNQ_CTL_INTVEC_SHIFT ;
4919 + /* enable remote module status interrupts */
4920 + val |= 0x01 << VLYNQ_CTL_INTEN_SHIFT;
4922 + if ( intSetting->intLocal == VLYNQ_INT_LOCAL )
4924 + /*set the intLocal bit*/
4925 + val |= 0x01 << VLYNQ_CTL_INTLOCAL_SHIFT;
4928 + /* Irrespective of whether interrupts are handled locally, program
4929 + * int2Cfg. Error checking for accidental loop(when intLocal=0 and int2Cfg=1
4930 + * i.e remote packets are set intPending register->which will result in
4931 + * same packet being sent out) has been done already
4934 + if (intSetting->intRemote == VLYNQ_INT_ROOT_ISR)
4936 + /* Set the int2Cfg register, so that remote interrupt
4937 + * packets are written to intPending register */
4938 + val |= 0x01 << VLYNQ_CTL_INT2CFG_SHIFT;
4939 + /* Set intPtr register to point to intPending register */
4940 + VLYNQ_R_INT_PTR_REG = VLYNQ_R_INT_PENDING_REG_PTR ;
4944 + /*set the interrupt pointer register*/
4945 + VLYNQ_R_INT_PTR_REG = intSetting->intr_ptr;
4946 + /* Dont bother to modify int2Cfg as it would be zero */
4949 + if( (intSetting->intLocal == VLYNQ_INT_REMOTE) &&
4950 + (options & VLYNQ_INIT_LOCAL_INTERRUPTS) &&
4951 + (pdev->local_irq.intRemote == VLYNQ_INT_ROOT_ISR) )
4953 + /* Install handler for remote module status interrupts. By default when
4954 + * remote interrupts are forwarded to local root_isr then remote_module_isr is
4955 + * enabled and handler hooked up */
4956 + if(vlynq_install_isr(pdev,intSetting->map_vector,vlynq_remote_module_isr,
4957 + pdev, NULL, NULL) == VLYNQ_INVALID_ARG)
4958 + return VLYNQ_INVALID_ARG;
4962 + /** Clear bits related to INT settings in control register **/
4963 + VLYNQ_R_CTRL_REG = VLYNQ_R_CTRL_REG & (~VLYNQ_CTL_INTFIELDS_CLEAR_MASK);
4965 + /** Or the bits to be set with the remote Control register **/
4966 + VLYNQ_R_CTRL_REG = VLYNQ_R_CTRL_REG | val;
4968 + } /* init remote interrupt settings*/
4970 + if(options & VLYNQ_INIT_CLEAR_ERRORS )
4972 + /* Clear errors during initialization */
4973 + tmp = VLYNQ_STATUS_REG & (VLYNQ_STS_RERROR_MASK | VLYNQ_STS_LERROR_MASK);
4974 + VLYNQ_STATUS_REG = tmp;
4975 + tmp = VLYNQ_R_STATUS_REG & (VLYNQ_STS_RERROR_MASK | VLYNQ_STS_LERROR_MASK);
4976 + VLYNQ_R_STATUS_REG = tmp;
4979 + /* clear int status */
4980 + val = VLYNQ_INT_STAT_REG;
4981 + VLYNQ_INT_STAT_REG = val;
4983 + /* finish initialization */
4984 + pdev->state = VLYNQ_DRV_STATE_RUN;
4985 + VLYNQ_RESETCB( VLYNQ_RESET_INITOK);
4986 + return VLYNQ_SUCCESS;
4991 +/* ----------------------------------------------------------------------------
4992 + * Function : vlynqInterruptInit()
4993 + * Description: This local function is used to set up the ICB table for the
4994 + * VLYNQ_STATUS_REG vlynq module. The input parameter "pdev" points the vlynq
4995 + * device instance whose ICB is allocated.
4996 + * Return : returns VLYNQ_SUCCESS or vlynq error for failure
4997 + * -----------------------------------------------------------------------------
4999 +static int vlynqInterruptInit(VLYNQ_DEV *pdev)
5003 + /* Memory allocated statically.
5004 + * Initialise ICB,free list.Indicate primary slot empty.
5005 + * Intialise intVector <==> map_vector translation table*/
5006 + for(i=0; i < VLYNQ_NUM_INT_BITS; i++)
5008 + pdev->pIntrCB[i].isr = NULL;
5009 + pdev->pIntrCB[i].next = NULL; /*nothing chained */
5010 + pdev->vector_map[i] = -1; /* indicates unmapped */
5013 + /* In the ICB slots, [VLYNQ_NUM_INT_BITS i.e 32 to ICB array size) are expansion slots
5014 + * required only when interrupt chaining/sharing is supported. In case
5015 + * of chained interrupts the list starts from primary slot and the
5016 + * additional slots are obtained from the common free area */
5018 + /* Initialise freelist */
5020 + numslots = VLYNQ_NUM_INT_BITS + VLYNQ_IVR_CHAIN_SLOTS;
5022 + if (numslots > VLYNQ_NUM_INT_BITS)
5024 + pdev->freelist = &(pdev->pIntrCB[VLYNQ_NUM_INT_BITS]);
5026 + for(i = VLYNQ_NUM_INT_BITS; i < (numslots-1) ; i++)
5028 + pdev->pIntrCB[i].next = &(pdev->pIntrCB[i+1]);
5029 + pdev->pIntrCB[i].isr = NULL;
5031 + pdev->pIntrCB[i].next=NULL; /* Indicate end of freelist*/
5032 + pdev->pIntrCB[i].isr=NULL;
5036 + pdev->freelist = NULL;
5039 + /** Reset mapping for IV 0-7 **/
5040 + VLYNQ_IVR_03TO00_REG = 0;
5041 + VLYNQ_IVR_07TO04_REG = 0;
5043 + return VLYNQ_SUCCESS;
5046 +/** remember that hooking up of root ISR handler with the interrupt controller
5047 + * is not done as a part of this driver. Typically, it must be done after
5048 + * invoking vlynq_init*/
5051 + /* ----------------------------------------------------------------------------
5052 + * ISR with the SOC interrupt controller. This ISR typically scans
5053 + * the Int PENDING/SET register in the VLYNQ module and calls the
5054 + * appropriate ISR associated with the correponding vector number.
5055 + * -----------------------------------------------------------------------------
5057 +void vlynq_root_isr(void *arg)
5059 + int source; /* Bit position of pending interrupt, start from 0 */
5060 + unsigned int interrupts, clrInterrupts;
5062 + VLYNQ_INTR_CNTRL_ICB *entry;
5064 + pdev=(VLYNQ_DEV*)(arg); /*obtain the vlynq device pointer*/
5066 + interrupts = VLYNQ_INT_STAT_REG; /* Get the list of pending interrupts */
5067 + VLYNQ_INT_STAT_REG = interrupts; /* clear the int CR register */
5068 + clrInterrupts = interrupts; /* save them for further analysis */
5070 + debugPrint("vlynq_root_isr: dev %u. INTCR = 0x%08lx\n", pdev->dev_idx, clrInterrupts,0,0,0,0);
5072 + /* Scan interrupt bits */
5074 + while( clrInterrupts != 0)
5076 + /* test if bit is set? */
5077 + if( 0x1ul & clrInterrupts)
5079 + entry = &(pdev->pIntrCB[source]); /* Get the ISR entry */
5080 + pdev->intCount++; /* update interrupt count */
5081 + if(entry->isr != NULL)
5085 + pdev->isrCount++; /* update isr invocation count */
5086 + /* Call the user ISR and update the count for ISR */
5087 + entry->isrCount++;
5088 + entry->isr(entry->arg1, entry->arg2, entry->arg3);
5089 + if (entry->next == NULL) break;
5090 + entry = entry->next;
5092 + } while (entry->isr != NULL);
5096 + debugPrint(" ISR not installed for vlynq vector:%d\n",source,0,0,0,0,0);
5099 + clrInterrupts >>= 1; /* Next source bit */
5101 + } /* endWhile clrInterrupts != 0 */
5105 + /* ----------------------------------------------------------------------------
5106 + * Function : vlynq_local__module_isr()
5107 + * Description: This ISR is attached to the local VLYNQ interrupt vector
5108 + * by the Vlynq Driver when local interrupts are being handled. i.e.
5109 + * intLocal=1. This ISR handles local Vlynq module status interrupts only
5110 + * AS a part of this ISR, user callback in VLYNQ_DEV structure
5112 + * VLYNQ_DEV is passed as arg1. arg2 and arg3 are unused.
5113 + * -----------------------------------------------------------------------------
5115 +static void vlynq_local_module_isr(void *arg1,void *arg2, void *arg3)
5117 + VLYNQ_REPORT_CB func;
5118 + unsigned int dwStatRegVal;
5121 + pdev = (VLYNQ_DEV*) arg1;
5122 + /* Callback function is read from the device pointer that is passed as an argument */
5123 + func = pdev->report_cb;
5125 + /* read local status register */
5126 + dwStatRegVal = VLYNQ_STATUS_REG;
5128 + /* clear pending events */
5129 + VLYNQ_STATUS_REG = dwStatRegVal;
5131 + /* invoke user callback */
5133 + func( pdev, VLYNQ_LOCAL_DVC, dwStatRegVal);
5137 + /* ----------------------------------------------------------------------------
5138 + * Function : vlynq_remote_module_isr()
5139 + * Description: This ISR is attached to the remote VLYNQ interrupt vector
5140 + * by the Vlynq Driver when remote interrupts are being handled locally. i.e.
5141 + * intLocal=1. This ISR handles local Vlynq module status interrupts only
5142 + * AS a part of this ISR, user callback in VLYNQ_DEV structure
5144 + * The parameters irq,regs ar unused.
5145 + * -----------------------------------------------------------------------------
5147 +static void vlynq_remote_module_isr(void *arg1,void *arg2, void *arg3)
5149 + VLYNQ_REPORT_CB func;
5150 + unsigned int dwStatRegVal;
5154 + pdev = (VLYNQ_DEV*) arg1;
5156 + /* Callback function is read from the device pointer that is passed as an argument */
5157 + func = pdev->report_cb;
5159 + /* read local status register */
5160 + dwStatRegVal = VLYNQ_R_STATUS_REG;
5162 + /* clear pending events */
5163 + VLYNQ_R_STATUS_REG = dwStatRegVal;
5165 + /* invoke user callback */
5167 + func( pdev, VLYNQ_REMOTE_DVC, dwStatRegVal);
5171 +/* ----------------------------------------------------------------------------
5172 + * Function : vlynq_interrupt_get_count()
5173 + * Description: This function returns the number of times a particular intr
5174 + * has been invoked.
5176 + * It returns 0, if erroneous map_vector is specified or if the corres isr
5177 + * has not been registered with VLYNQ.
5179 +unsigned int vlynq_interrupt_get_count(VLYNQ_DEV *pdev,
5180 + unsigned int map_vector)
5182 + VLYNQ_INTR_CNTRL_ICB *entry;
5183 + unsigned int count = 0;
5185 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5188 + entry = &(pdev->pIntrCB[map_vector]);
5191 + count = entry->isrCount;
5197 +/* ----------------------------------------------------------------------------
5198 + * Function : vlynq_install_isr()
5199 + * Description: This function installs ISR for Vlynq interrupt vector
5200 + * bits(in IntPending register). This function should be used only when
5201 + * Vlynq interrupts are being handled locally(remote may be programmed to send
5202 + * interrupt packets).Also, the int2cfg should be 1 and the least significant
5203 + * 8 bits of the Interrupt Pointer Register must point to Interrupt
5204 + * Pending/Set Register).
5205 + * If host int2cfg=0 and the Interrupt Pointer register contains
5206 + * the address of the interrupt set register in the interrupt controller
5207 + * module of the local device , then the ISR for the remote interrupt must be
5208 + * directly registered with the Interrupt controller and must not use this API
5209 + * Note: this function simply installs the ISR in ICB It doesnt modify
5210 + * any register settings
5213 +vlynq_install_isr(VLYNQ_DEV *pdev,
5214 + unsigned int map_vector,
5215 + VLYNQ_INTR_CNTRL_ISR isr,
5216 + void *arg1, void *arg2, void *arg3)
5218 + VLYNQ_INTR_CNTRL_ICB *entry;
5220 + if ( (map_vector > (VLYNQ_NUM_INT_BITS-1)) || (isr == NULL) )
5221 + return VLYNQ_INVALID_ARG;
5223 + entry = &(pdev->pIntrCB[map_vector]);
5225 + if(entry->isr == NULL)
5228 + entry->arg1 = arg1;
5229 + entry->arg2 = arg2;
5230 + entry->arg3 = arg3;
5231 + entry->next = NULL;
5235 + /** No more empty slots,return error */
5236 + if(pdev->freelist == NULL)
5237 + return VLYNQ_MEMALLOC_FAIL;
5239 + while(entry->next != NULL)
5241 + entry = entry->next;
5244 + /* Append new node to the chain */
5245 + entry->next = pdev->freelist;
5246 + /* Remove the appended node from freelist */
5247 + pdev->freelist = pdev->freelist->next;
5248 + entry= entry->next;
5250 + /*** Set the ICB fields ***/
5252 + entry->arg1 = arg1;
5253 + entry->arg2 = arg2;
5254 + entry->arg3 = arg3;
5255 + entry->next = NULL;
5258 + return VLYNQ_SUCCESS;
5263 +/* ----------------------------------------------------------------------------
5264 + * Function : vlynq_uninstall_isr
5265 + * Description: This function is used to uninstall a previously
5266 + * registered ISR. In case of shared/chained interrupts, the
5267 + * void * arg parameter must uniquely identify the ISR to be
5269 + * Note: this function simply uninstalls the ISR in ICB
5270 + * It doesnt modify any register settings
5273 +vlynq_uninstall_isr(VLYNQ_DEV *pdev,
5274 + unsigned int map_vector,
5275 + void *arg1, void *arg2, void *arg3)
5277 + VLYNQ_INTR_CNTRL_ICB *entry,*temp;
5279 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5280 + return VLYNQ_INVALID_ARG;
5282 + entry = &(pdev->pIntrCB[map_vector]);
5284 + if(entry->isr == NULL )
5285 + return VLYNQ_ISR_NON_EXISTENT;
5287 + if ( (entry->arg1 == arg1) && (entry->arg2 == arg2) && (entry->arg3 == arg3) )
5289 + if(entry->next == NULL)
5292 + return VLYNQ_SUCCESS;
5296 + temp = entry->next;
5297 + /* Copy next node in the chain to prim.slot */
5298 + entry->isr = temp->isr;
5299 + entry->arg1 = temp->arg1;
5300 + entry->arg2 = temp->arg2;
5301 + entry->arg3 = temp->arg3;
5302 + entry->next = temp->next;
5303 + /* Free the just copied node */
5305 + temp->arg1 = NULL;
5306 + temp->arg2 = NULL;
5307 + temp->arg3 = NULL;
5308 + temp->next = pdev->freelist;
5309 + pdev->freelist = temp;
5310 + return VLYNQ_SUCCESS;
5316 + while ( (entry = temp->next) != NULL)
5318 + if ( (entry->arg1 == arg1) && (entry->arg2 == arg2) && (entry->arg3 == arg3) )
5320 + /* remove node from chain */
5321 + temp->next = entry->next;
5322 + /* Add the removed node to freelist */
5323 + entry->isr = NULL;
5324 + entry->arg1 = NULL;
5325 + entry->arg2 = NULL;
5326 + entry->arg3 = NULL;
5327 + entry->next = pdev->freelist;
5328 + entry->isrCount = 0;
5329 + pdev->freelist = entry;
5330 + return VLYNQ_SUCCESS;
5335 + return VLYNQ_ISR_NON_EXISTENT;
5342 +/* ----------------------------------------------------------------------------
5343 + * function : vlynq_interrupt_vector_set()
5344 + * description:configures interrupt vector mapping,interrupt type
5345 + * polarity -all in one go.
5348 +vlynq_interrupt_vector_set(VLYNQ_DEV *pdev, /* vlynq device */
5349 + unsigned int int_vector, /* int vector on vlynq device */
5350 + unsigned int map_vector, /* bit for this interrupt */
5351 + VLYNQ_DEV_TYPE dev_type, /* local or remote device */
5352 + VLYNQ_INTR_POLARITY pol, /* polarity of interrupt */
5353 + VLYNQ_INTR_TYPE type) /* pulsed/level interrupt */
5355 + volatile unsigned int * vecreg;
5356 + unsigned int val=0;
5357 + unsigned int bytemask=0XFF;
5359 + /* use the lower 8 bits of val to set the value , shift it to
5360 + * appropriate byte position in the ivr and write it to the
5361 + * corresponding register */
5363 + /* validate the number of interrupts supported */
5364 + if (int_vector >= VLYNQ_IVR_MAXIVR)
5365 + return VLYNQ_INVALID_ARG;
5367 + if(map_vector > (VLYNQ_NUM_INT_BITS - 1) )
5368 + return VLYNQ_INVALID_ARG;
5370 + if (dev_type == VLYNQ_LOCAL_DVC)
5372 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5376 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5379 + /* Update the intVector<==> bit position translation table */
5380 + pdev->vector_map[map_vector] = int_vector;
5382 + /* val has been initialised to zero. we only have to turn on appropriate bits*/
5383 + if(type == VLYNQ_INTR_PULSED)
5384 + val |= VLYNQ_IVR_INTTYPE_MASK;
5386 + if(pol == VLYNQ_INTR_ACTIVE_LOW)
5387 + val |= VLYNQ_IVR_INTPOL_MASK;
5389 + val |= map_vector;
5391 + /** clear the correct byte position and then or val **/
5392 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5394 + /** write to correct byte position in vecreg*/
5395 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5397 + /* Setting a interrupt vector, leaves the interrupt disabled
5398 + * which must be enabled subsequently */
5400 + return VLYNQ_SUCCESS;
5404 +/* ----------------------------------------------------------------------------
5405 + * Function : vlynq_interrupt_vector_cntl()
5406 + * Description:enables/disable interrupt
5408 +int vlynq_interrupt_vector_cntl( VLYNQ_DEV *pdev,
5409 + unsigned int int_vector,
5410 + VLYNQ_DEV_TYPE dev_type,
5411 + unsigned int enable)
5413 + volatile unsigned int *vecReg;
5414 + unsigned int val=0;
5415 + unsigned int intenMask=0x80;
5417 + /* validate the number of interrupts supported */
5418 + if (int_vector >= VLYNQ_IVR_MAXIVR)
5419 + return VLYNQ_INVALID_ARG;
5421 + if (dev_type == VLYNQ_LOCAL_DVC)
5423 + vecReg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5427 + vecReg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5430 + /** Clear the correct byte position and then or val **/
5431 + *vecReg = (*vecReg) & ( ~(intenMask << ( (int_vector %4)*8) ) );
5435 + val |= VLYNQ_IVR_INTEN_MASK;
5436 + /** Write to correct byte position in vecReg*/
5437 + *vecReg = (*vecReg) | (val << ( (int_vector % 4)*8) ) ;
5440 + return VLYNQ_SUCCESS;
5442 +}/* end of function vlynq_interrupt_vector_cntl */
5446 +/* ----------------------------------------------------------------------------
5447 + * Function : vlynq_interrupt_vector_map()
5448 + * Description:Configures interrupt vector mapping alone
5451 +vlynq_interrupt_vector_map( VLYNQ_DEV *pdev,
5452 + VLYNQ_DEV_TYPE dev_type,
5453 + unsigned int int_vector,
5454 + unsigned int map_vector)
5456 + volatile unsigned int * vecreg;
5457 + unsigned int val=0;
5458 + unsigned int bytemask=0x1f; /* mask to turn off bits corresponding to int vector */
5460 + /* use the lower 8 bits of val to set the value , shift it to
5461 + * appropriate byte position in the ivr and write it to the
5462 + * corresponding register */
5464 + /* validate the number of interrupts supported */
5465 + if (int_vector >= VLYNQ_IVR_MAXIVR)
5466 + return VLYNQ_INVALID_ARG;
5468 + if(map_vector > (VLYNQ_NUM_INT_BITS - 1) )
5469 + return VLYNQ_INVALID_ARG;
5471 + if (dev_type == VLYNQ_LOCAL_DVC)
5473 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5477 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5480 + /* Update the intVector<==> bit position translation table */
5481 + pdev->vector_map[map_vector] = int_vector;
5483 + /** val has been initialised to zero. we only have to turn on
5484 + * appropriate bits*/
5485 + val |= map_vector;
5487 + /** clear the correct byte position and then or val **/
5488 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5490 + /** write to correct byte position in vecreg*/
5491 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5493 + return VLYNQ_SUCCESS;
5497 +/* ----------------------------------------------------------------------------
5498 + * function : vlynq_interrupt_set_polarity()
5499 + * description:configures interrupt polarity .
5502 +vlynq_interrupt_set_polarity( VLYNQ_DEV *pdev ,
5503 + VLYNQ_DEV_TYPE dev_type,
5504 + unsigned int map_vector,
5505 + VLYNQ_INTR_POLARITY pol)
5507 + volatile unsigned int * vecreg;
5509 + unsigned int val=0;
5510 + unsigned int bytemask=0x20; /** mask to turn off bits corresponding to int polarity */
5512 + /* get the int_vector from map_vector */
5513 + int_vector = pdev->vector_map[map_vector];
5515 + if(int_vector == -1)
5516 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5518 + /* use the lower 8 bits of val to set the value , shift it to
5519 + * appropriate byte position in the ivr and write it to the
5520 + * corresponding register */
5522 + if (dev_type == VLYNQ_LOCAL_DVC)
5524 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5528 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5531 + /* val has been initialised to zero. we only have to turn on
5532 + * appropriate bits, if need be*/
5534 + /** clear the correct byte position and then or val **/
5535 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5537 + if( pol == VLYNQ_INTR_ACTIVE_LOW)
5539 + val |= VLYNQ_IVR_INTPOL_MASK;
5540 + /** write to correct byte position in vecreg*/
5541 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5544 + return VLYNQ_SUCCESS;
5547 +int vlynq_interrupt_get_polarity( VLYNQ_DEV *pdev ,
5548 + VLYNQ_DEV_TYPE dev_type,
5549 + unsigned int map_vector)
5551 + volatile unsigned int * vecreg;
5553 + unsigned int val=0;
5555 + /* get the int_vector from map_vector */
5556 + int_vector = pdev->vector_map[map_vector];
5558 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5561 + if(int_vector == -1)
5562 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5564 + /* use the lower 8 bits of val to set the value , shift it to
5565 + * appropriate byte position in the ivr and write it to the
5566 + * corresponding register */
5568 + if (dev_type == VLYNQ_LOCAL_DVC)
5570 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5574 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5577 + /** read the information into val **/
5578 + val = (*vecreg) & ((VLYNQ_IVR_INTPOL_MASK << ( (int_vector %4)*8) ) );
5580 + return (val ? (VLYNQ_INTR_ACTIVE_LOW) : (VLYNQ_INTR_ACTIVE_HIGH));
5584 +/* ----------------------------------------------------------------------------
5585 + * function : vlynq_interrupt_set_type()
5586 + * description:configures interrupt type .
5588 +int vlynq_interrupt_set_type( VLYNQ_DEV *pdev,
5589 + VLYNQ_DEV_TYPE dev_type,
5590 + unsigned int map_vector,
5591 + VLYNQ_INTR_TYPE type)
5593 + volatile unsigned int * vecreg;
5594 + unsigned int val=0;
5597 + /** mask to turn off bits corresponding to interrupt type */
5598 + unsigned int bytemask=0x40;
5600 + /* get the int_vector from map_vector */
5601 + int_vector = pdev->vector_map[map_vector];
5602 + if(int_vector == -1)
5603 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5605 + /* use the lower 8 bits of val to set the value , shift it to
5606 + * appropriate byte position in the ivr and write it to the
5607 + * corresponding register */
5608 + if (dev_type == VLYNQ_LOCAL_DVC)
5610 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5614 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5617 + /** val has been initialised to zero. we only have to turn on
5618 + * appropriate bits if need be*/
5620 + /** clear the correct byte position and then or val **/
5621 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5623 + if( type == VLYNQ_INTR_PULSED)
5625 + val |= VLYNQ_IVR_INTTYPE_MASK;
5626 + /** write to correct byte position in vecreg*/
5627 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5630 + return VLYNQ_SUCCESS;
5633 +/* ----------------------------------------------------------------------------
5634 + * function : vlynq_interrupt_get_type()
5635 + * description:returns interrupt type .
5637 +int vlynq_interrupt_get_type( VLYNQ_DEV *pdev, VLYNQ_DEV_TYPE dev_type,
5638 + unsigned int map_vector)
5640 + volatile unsigned int * vecreg;
5641 + unsigned int val=0;
5644 + if (map_vector > (VLYNQ_NUM_INT_BITS-1))
5647 + /* get the int_vector from map_vector */
5648 + int_vector = pdev->vector_map[map_vector];
5649 + if(int_vector == -1)
5650 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5652 + /* use the lower 8 bits of val to set the value , shift it to
5653 + * appropriate byte position in the ivr and write it to the
5654 + * corresponding register */
5655 + if (dev_type == VLYNQ_LOCAL_DVC)
5657 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5661 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5664 + /** Read the correct bit position into val **/
5665 + val = (*vecreg) & ((VLYNQ_IVR_INTTYPE_MASK << ( (int_vector %4)*8) ) );
5667 + return (val ? (VLYNQ_INTR_PULSED) : (VLYNQ_INTR_LEVEL));
5670 +/* ----------------------------------------------------------------------------
5671 + * function : vlynq_interrupt_enable()
5672 + * description:Enable interrupt by writing to IVR register.
5674 +int vlynq_interrupt_enable( VLYNQ_DEV *pdev,
5675 + VLYNQ_DEV_TYPE dev_type,
5676 + unsigned int map_vector)
5678 + volatile unsigned int * vecreg;
5679 + unsigned int val=0;
5682 + /** mask to turn off bits corresponding to interrupt enable */
5683 + unsigned int bytemask=0x80;
5685 + /* get the int_vector from map_vector */
5686 + int_vector = pdev->vector_map[map_vector];
5687 + if(int_vector == -1)
5688 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5690 + /* use the lower 8 bits of val to set the value , shift it to
5691 + * appropriate byte position in the ivr and write it to the
5692 + * corresponding register */
5694 + if (dev_type == VLYNQ_LOCAL_DVC)
5696 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5700 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5703 + /** val has been initialised to zero. we only have to turn on
5704 + * bit corresponding to interrupt enable*/
5705 + val |= VLYNQ_IVR_INTEN_MASK;
5707 + /** clear the correct byte position and then or val **/
5708 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5710 + /** write to correct byte position in vecreg*/
5711 + *vecreg = (*vecreg) | (val << ( (int_vector % 4)*8) ) ;
5713 + return VLYNQ_SUCCESS;
5717 +/* ----------------------------------------------------------------------------
5718 + * function : vlynq_interrupt_disable()
5719 + * description:Disable interrupt by writing to IVR register.
5722 +vlynq_interrupt_disable( VLYNQ_DEV *pdev,
5723 + VLYNQ_DEV_TYPE dev_type,
5724 + unsigned int map_vector)
5726 + volatile unsigned int * vecreg;
5729 + /** mask to turn off bits corresponding to interrupt enable */
5730 + unsigned int bytemask=0x80;
5732 + /* get the int_vector from map_vector */
5733 + int_vector = pdev->vector_map[map_vector];
5734 + if(int_vector == -1)
5735 + return VLYNQ_INTVEC_MAP_NOT_FOUND;
5737 + /* use the lower 8 bits of val to set the value , shift it to
5738 + * appropriate byte position in the ivr and write it to the
5739 + * corresponding register */
5740 + if (dev_type == VLYNQ_LOCAL_DVC)
5742 + vecreg = (volatile unsigned int *) (VLYNQ_IVR_OFFSET(int_vector));
5746 + vecreg = (volatile unsigned int *) (VLYNQ_R_IVR_OFFSET(int_vector));
5749 + /* We disable the interrupt by simply turning off the bit
5750 + * corresponding to Interrupt enable.
5751 + * Clear the interrupt enable bit in the correct byte position **/
5752 + *vecreg = (*vecreg) & ( ~(bytemask << ( (int_vector %4)*8) ) );
5754 + /* Dont have to set any bit positions */
5756 + return VLYNQ_SUCCESS;
5763 diff -urN linux.old/drivers/char/serial.c linux.dev/drivers/char/serial.c
5764 --- linux.old/drivers/char/serial.c 2005-10-21 16:43:20.709226000 +0200
5765 +++ linux.dev/drivers/char/serial.c 2005-11-10 01:10:46.015585250 +0100
5766 @@ -419,7 +419,40 @@
5770 -#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
5771 +#if defined(CONFIG_AR7)
5773 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
5775 + return (inb(info->port + (offset * 4)) & 0xff);
5779 +static _INLINE_ unsigned int serial_inp(struct async_struct *info, int offset)
5781 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
5782 + return (inb(info->port + (offset * 4)) & 0xff);
5784 + return (inb_p(info->port + (offset * 4)) & 0xff);
5788 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
5790 + outb(value, info->port + (offset * 4));
5794 +static _INLINE_ void serial_outp(struct async_struct *info, int offset,
5797 +#ifdef CONFIG_SERIAL_NOPAUSE_IO
5798 + outb(value, info->port + (offset * 4));
5800 + outb_p(value, info->port + (offset * 4));
5804 +#elif defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
5806 #include <asm/mips-boards/atlas.h>
5808 @@ -478,8 +511,10 @@
5809 * needed for certain old 386 machines, I've left these #define's
5813 #define serial_inp(info, offset) serial_in(info, offset)
5814 #define serial_outp(info, offset, value) serial_out(info, offset, value)
5819 @@ -1728,7 +1763,15 @@
5820 /* Special case since 134 is really 134.5 */
5821 quot = (2*baud_base / 269);
5824 + quot = (CONFIG_AR7_SYS*500000) / baud;
5830 quot = baud_base / baud;
5833 /* If the quotient is zero refuse the change */
5834 if (!quot && old_termios) {
5835 @@ -5540,8 +5583,10 @@
5836 state->irq = irq_cannonicalize(state->irq);
5838 state->io_type = SERIAL_IO_HUB6;
5840 if (state->port && check_region(state->port,8))
5844 if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
5846 @@ -5997,7 +6042,15 @@
5847 info->io_type = state->io_type;
5848 info->iomem_base = state->iomem_base;
5849 info->iomem_reg_shift = state->iomem_reg_shift;
5851 + quot = (CONFIG_AR7_SYS*500000) / baud;
5857 quot = state->baud_base / baud;
5859 cval = cflag & (CSIZE | CSTOPB);
5860 #if defined(__powerpc__) || defined(__alpha__)
5862 diff -urN linux.old/drivers/char/serial.c.orig linux.dev/drivers/char/serial.c.orig
5863 --- linux.old/drivers/char/serial.c.orig 1970-01-01 01:00:00.000000000 +0100
5864 +++ linux.dev/drivers/char/serial.c.orig 2005-11-10 01:10:46.051587500 +0100
5867 + * linux/drivers/char/serial.c
5869 + * Copyright (C) 1991, 1992 Linus Torvalds
5870 + * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997,
5871 + * 1998, 1999 Theodore Ts'o
5873 + * Extensively rewritten by Theodore Ts'o, 8/16/92 -- 9/14/92. Now
5874 + * much more extensible to support other serial cards based on the
5875 + * 16450/16550A UART's. Added support for the AST FourPort and the
5876 + * Accent Async board.
5878 + * set_serial_info fixed to set the flags, custom divisor, and uart
5879 + * type fields. Fix suggested by Michael K. Johnson 12/12/92.
5881 + * 11/95: TIOCMIWAIT, TIOCGICOUNT by Angelo Haritsis <ah@doc.ic.ac.uk>
5883 + * 03/96: Modularised by Angelo Haritsis <ah@doc.ic.ac.uk>
5885 + * rs_set_termios fixed to look also for changes of the input
5886 + * flags INPCK, BRKINT, PARMRK, IGNPAR and IGNBRK.
5887 + * Bernd Anhäupl 05/17/96.
5889 + * 1/97: Extended dumb serial ports are a config option now.
5890 + * Saves 4k. Michael A. Griffith <grif@acm.org>
5892 + * 8/97: Fix bug in rs_set_termios with RTS
5893 + * Stanislav V. Voronyi <stas@uanet.kharkov.ua>
5895 + * 3/98: Change the IRQ detection, use of probe_irq_o*(),
5896 + * suppress TIOCSERGWILD and TIOCSERSWILD
5897 + * Etienne Lorrain <etienne.lorrain@ibm.net>
5899 + * 4/98: Added changes to support the ARM architecture proposed by
5902 + * 5/99: Updated to include support for the XR16C850 and ST16C654
5903 + * uarts. Stuart MacDonald <stuartm@connecttech.com>
5905 + * 8/99: Generalized PCI support added. Theodore Ts'o
5907 + * 3/00: Rid circular buffer of redundant xmit_cnt. Fix a
5908 + * few races on freeing buffers too.
5909 + * Alan Modra <alan@linuxcare.com>
5911 + * 5/00: Support for the RSA-DV II/S card added.
5912 + * Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
5914 + * 6/00: Remove old-style timer, use timer_list
5915 + * Andrew Morton <andrewm@uow.edu.au>
5917 + * 7/00: Support Timedia/Sunix/Exsys PCI cards
5919 + * 7/00: fix some returns on failure not using MOD_DEC_USE_COUNT.
5920 + * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5922 + * 10/00: add in optional software flow control for serial console.
5923 + * Kanoj Sarcar <kanoj@sgi.com> (Modified by Theodore Ts'o)
5925 + * 02/02: Fix for AMD Elan bug in transmit irq routine, by
5926 + * Christer Weinigel <wingel@hog.ctrl-c.liu.se>,
5927 + * Robert Schwebel <robert@schwebel.de>,
5928 + * Juergen Beisert <jbeisert@eurodsn.de>,
5929 + * Theodore Ts'o <tytso@mit.edu>
5931 + * 10/00: Added suport for MIPS Atlas board.
5932 + * 11/00: Hooks for serial kernel debug port support added.
5933 + * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard,
5934 + * carstenl@mips.com
5935 + * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
5938 +static char *serial_version = "5.05c";
5939 +static char *serial_revdate = "2001-07-08";
5942 + * Serial driver configuration section. Here are the various options:
5945 + * Enables support for the venerable Bell Technologies
5948 + * CONFIG_SERIAL_MANY_PORTS
5949 + * Enables support for ports beyond the standard, stupid
5952 + * CONFIG_SERIAL_MULTIPORT
5953 + * Enables support for special multiport board support.
5955 + * CONFIG_SERIAL_SHARE_IRQ
5956 + * Enables support for multiple serial ports on one IRQ
5958 + * CONFIG_SERIAL_DETECT_IRQ
5959 + * Enable the autodetection of IRQ on standart ports
5961 + * SERIAL_PARANOIA_CHECK
5962 + * Check the magic number for the async_structure where
5965 + * CONFIG_SERIAL_ACPI
5966 + * Enable support for serial console port and serial
5967 + * debug port as defined by the SPCR and DBGP tables in
5971 +#include <linux/config.h>
5972 +#include <linux/version.h>
5974 +#undef SERIAL_PARANOIA_CHECK
5975 +#define CONFIG_SERIAL_NOPAUSE_IO
5976 +#define SERIAL_DO_RESTART
5979 +/* These defines are normally controlled by the autoconf.h */
5980 +#define CONFIG_SERIAL_MANY_PORTS
5981 +#define CONFIG_SERIAL_SHARE_IRQ
5982 +#define CONFIG_SERIAL_DETECT_IRQ
5983 +#define CONFIG_SERIAL_MULTIPORT
5984 +#define CONFIG_HUB6
5988 +#define ENABLE_SERIAL_PCI
5989 +#ifndef CONFIG_SERIAL_SHARE_IRQ
5990 +#define CONFIG_SERIAL_SHARE_IRQ
5992 +#ifndef CONFIG_SERIAL_MANY_PORTS
5993 +#define CONFIG_SERIAL_MANY_PORTS
5997 +#ifdef CONFIG_SERIAL_ACPI
5998 +#define ENABLE_SERIAL_ACPI
6001 +#if defined(CONFIG_ISAPNP)|| (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
6002 +#ifndef ENABLE_SERIAL_PNP
6003 +#define ENABLE_SERIAL_PNP
6007 +/* Set of debugging defines */
6009 +#undef SERIAL_DEBUG_INTR
6010 +#undef SERIAL_DEBUG_OPEN
6011 +#undef SERIAL_DEBUG_FLOW
6012 +#undef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
6013 +#undef SERIAL_DEBUG_PCI
6014 +#undef SERIAL_DEBUG_AUTOCONF
6016 +/* Sanity checks */
6018 +#ifdef CONFIG_SERIAL_MULTIPORT
6019 +#ifndef CONFIG_SERIAL_SHARE_IRQ
6020 +#define CONFIG_SERIAL_SHARE_IRQ
6025 +#ifndef CONFIG_SERIAL_MANY_PORTS
6026 +#define CONFIG_SERIAL_MANY_PORTS
6028 +#ifndef CONFIG_SERIAL_SHARE_IRQ
6029 +#define CONFIG_SERIAL_SHARE_IRQ
6034 +#undef CONFIG_SERIAL_CONSOLE
6037 +#define CONFIG_SERIAL_RSA
6039 +#define RS_STROBE_TIME (10*HZ)
6040 +#define RS_ISR_PASS_LIMIT 256
6042 +#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
6043 +#define SERIAL_INLINE
6047 + * End of serial driver configuration section.
6050 +#include <linux/module.h>
6052 +#include <linux/types.h>
6053 +#ifdef LOCAL_HEADERS
6054 +#include "serial_local.h"
6056 +#include <linux/serial.h>
6057 +#include <linux/serialP.h>
6058 +#include <linux/serial_reg.h>
6059 +#include <asm/serial.h>
6060 +#define LOCAL_VERSTRING ""
6063 +#include <linux/errno.h>
6064 +#include <linux/signal.h>
6065 +#include <linux/sched.h>
6066 +#include <linux/timer.h>
6067 +#include <linux/interrupt.h>
6068 +#include <linux/tty.h>
6069 +#include <linux/tty_flip.h>
6070 +#include <linux/major.h>
6071 +#include <linux/string.h>
6072 +#include <linux/fcntl.h>
6073 +#include <linux/ptrace.h>
6074 +#include <linux/ioport.h>
6075 +#include <linux/mm.h>
6076 +#include <linux/slab.h>
6077 +#if (LINUX_VERSION_CODE >= 131343)
6078 +#include <linux/init.h>
6080 +#if (LINUX_VERSION_CODE >= 131336)
6081 +#include <asm/uaccess.h>
6083 +#include <linux/delay.h>
6084 +#ifdef CONFIG_SERIAL_CONSOLE
6085 +#include <linux/console.h>
6087 +#ifdef ENABLE_SERIAL_PCI
6088 +#include <linux/pci.h>
6090 +#ifdef ENABLE_SERIAL_PNP
6091 +#include <linux/isapnp.h>
6093 +#ifdef CONFIG_MAGIC_SYSRQ
6094 +#include <linux/sysrq.h>
6098 + * All of the compatibilty code so we can compile serial.c against
6099 + * older kernels is hidden in serial_compat.h
6101 +#if defined(LOCAL_HEADERS) || (LINUX_VERSION_CODE < 0x020317) /* 2.3.23 */
6102 +#include "serial_compat.h"
6105 +#include <asm/system.h>
6106 +#include <asm/io.h>
6107 +#include <asm/irq.h>
6108 +#include <asm/bitops.h>
6110 +#if defined(CONFIG_MAC_SERIAL)
6111 +#define SERIAL_DEV_OFFSET ((_machine == _MACH_prep || _machine == _MACH_chrp) ? 0 : 2)
6113 +#define SERIAL_DEV_OFFSET 0
6116 +#ifdef SERIAL_INLINE
6117 +#define _INLINE_ inline
6122 +static char *serial_name = "Serial driver";
6124 +static DECLARE_TASK_QUEUE(tq_serial);
6126 +static struct tty_driver serial_driver, callout_driver;
6127 +static int serial_refcount;
6129 +static struct timer_list serial_timer;
6131 +/* serial subtype definitions */
6132 +#ifndef SERIAL_TYPE_NORMAL
6133 +#define SERIAL_TYPE_NORMAL 1
6134 +#define SERIAL_TYPE_CALLOUT 2
6137 +/* number of characters left in xmit buffer before we ask for more */
6138 +#define WAKEUP_CHARS 256
6141 + * IRQ_timeout - How long the timeout should be for each IRQ
6142 + * should be after the IRQ has been active.
6145 +static struct async_struct *IRQ_ports[NR_IRQS];
6146 +#ifdef CONFIG_SERIAL_MULTIPORT
6147 +static struct rs_multiport_struct rs_multiport[NR_IRQS];
6149 +static int IRQ_timeout[NR_IRQS];
6150 +#ifdef CONFIG_SERIAL_CONSOLE
6151 +static struct console sercons;
6152 +static int lsr_break_flag;
6154 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
6155 +static unsigned long break_pressed; /* break, really ... */
6158 +static unsigned detect_uart_irq (struct serial_state * state);
6159 +static void autoconfig(struct serial_state * state);
6160 +static void change_speed(struct async_struct *info, struct termios *old);
6161 +static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
6164 + * Here we define the default xmit fifo size used for each type of
6167 +static struct serial_uart_config uart_config[] = {
6168 + { "unknown", 1, 0 },
6170 + { "16450", 1, 0 },
6171 + { "16550", 1, 0 },
6172 + { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO },
6173 + { "cirrus", 1, 0 }, /* usurped by cyclades.c */
6174 + { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH },
6175 + { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO |
6177 + { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO},
6178 + { "Startech", 1, 0}, /* usurped by cyclades.c */
6179 + { "16C950/954", 128, UART_CLEAR_FIFO | UART_USE_FIFO},
6180 + { "ST16654", 64, UART_CLEAR_FIFO | UART_USE_FIFO |
6182 + { "XR16850", 128, UART_CLEAR_FIFO | UART_USE_FIFO |
6184 + { "RSA", 2048, UART_CLEAR_FIFO | UART_USE_FIFO },
6188 +#if defined(CONFIG_SERIAL_RSA) && defined(MODULE)
6190 +#define PORT_RSA_MAX 4
6191 +static int probe_rsa[PORT_RSA_MAX];
6192 +static int force_rsa[PORT_RSA_MAX];
6194 +MODULE_PARM(probe_rsa, "1-" __MODULE_STRING(PORT_RSA_MAX) "i");
6195 +MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
6196 +MODULE_PARM(force_rsa, "1-" __MODULE_STRING(PORT_RSA_MAX) "i");
6197 +MODULE_PARM_DESC(force_rsa, "Force I/O ports for RSA");
6198 +#endif /* CONFIG_SERIAL_RSA */
6200 +struct serial_state rs_table[RS_TABLE_SIZE] = {
6201 + SERIAL_PORT_DFNS /* Defined in serial.h */
6204 +#define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state))
6205 +int serial_nr_ports = NR_PORTS;
6207 +#if (defined(ENABLE_SERIAL_PCI) || defined(ENABLE_SERIAL_PNP))
6208 +#define NR_PCI_BOARDS 8
6210 +static struct pci_board_inst serial_pci_board[NR_PCI_BOARDS];
6212 +#ifndef IS_PCI_REGION_IOPORT
6213 +#define IS_PCI_REGION_IOPORT(dev, r) (pci_resource_flags((dev), (r)) & \
6216 +#ifndef IS_PCI_REGION_IOMEM
6217 +#define IS_PCI_REGION_IOMEM(dev, r) (pci_resource_flags((dev), (r)) & \
6220 +#ifndef PCI_IRQ_RESOURCE
6221 +#define PCI_IRQ_RESOURCE(dev, r) ((dev)->irq_resource[r].start)
6223 +#ifndef pci_get_subvendor
6224 +#define pci_get_subvendor(dev) ((dev)->subsystem_vendor)
6225 +#define pci_get_subdevice(dev) ((dev)->subsystem_device)
6227 +#endif /* ENABLE_SERIAL_PCI || ENABLE_SERIAL_PNP */
6229 +#ifndef PREPARE_FUNC
6230 +#define PREPARE_FUNC(dev) (dev->prepare)
6231 +#define ACTIVATE_FUNC(dev) (dev->activate)
6232 +#define DEACTIVATE_FUNC(dev) (dev->deactivate)
6235 +#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
6237 +static struct tty_struct *serial_table[NR_PORTS];
6238 +static struct termios *serial_termios[NR_PORTS];
6239 +static struct termios *serial_termios_locked[NR_PORTS];
6242 +#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
6243 +#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
6244 + kdevname(tty->device), (info->flags), serial_refcount,info->count,tty->count,s)
6250 + * tmp_buf is used as a temporary buffer by serial_write. We need to
6251 + * lock it in case the copy_from_user blocks while swapping in a page,
6252 + * and some other program tries to do a serial write at the same time.
6253 + * Since the lock will only come under contention when the system is
6254 + * swapping and available memory is low, it makes sense to share one
6255 + * buffer across all the serial ports, since it significantly saves
6256 + * memory if large numbers of serial ports are open.
6258 +static unsigned char *tmp_buf;
6259 +#ifdef DECLARE_MUTEX
6260 +static DECLARE_MUTEX(tmp_buf_sem);
6262 +static struct semaphore tmp_buf_sem = MUTEX;
6266 +static inline int serial_paranoia_check(struct async_struct *info,
6267 + kdev_t device, const char *routine)
6269 +#ifdef SERIAL_PARANOIA_CHECK
6270 + static const char *badmagic =
6271 + "Warning: bad magic number for serial struct (%s) in %s\n";
6272 + static const char *badinfo =
6273 + "Warning: null async_struct for (%s) in %s\n";
6276 + printk(badinfo, kdevname(device), routine);
6279 + if (info->magic != SERIAL_MAGIC) {
6280 + printk(badmagic, kdevname(device), routine);
6287 +#if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_SEAD)
6289 +#include <asm/mips-boards/atlas.h>
6291 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
6293 + return (*(volatile unsigned int *)(mips_io_port_base + ATLAS_UART_REGS_BASE + offset*8) & 0xff);
6296 +static _INLINE_ void serial_out(struct async_struct *info, int offset, int value)
6298 + *(volatile unsigned int *)(mips_io_port_base + ATLAS_UART_REGS_BASE + offset*8) = value;
6303 +static _INLINE_ unsigned int serial_in(struct async_struct *info, int offset)
6305 + switch (info->io_type) {
6307 + case SERIAL_IO_HUB6:
6308 + outb(info->hub6 - 1 + offset, info->port);
6309 + return inb(info->port+1);
6311 + case SERIAL_IO_MEM:
6312 + return readb((unsigned long) info->iomem_base +
6313 + (offset<<info->iomem_reg_shift));
6315 + return inb(info->port + offset);
6319 +static _INLINE_ void serial_out(struct async_struct *info, int offset,
6322 + switch (info->io_type) {
6324 + case SERIAL_IO_HUB6:
6325 + outb(info->hub6 - 1 + offset, info->port);
6326 + outb(value, info->port+1);
6329 + case SERIAL_IO_MEM:
6330 + writeb(value, (unsigned long) info->iomem_base +
6331 + (offset<<info->iomem_reg_shift));
6334 + outb(value, info->port+offset);
6341 + * We used to support using pause I/O for certain machines. We
6342 + * haven't supported this for a while, but just in case it's badly
6343 + * needed for certain old 386 machines, I've left these #define's
6346 +#define serial_inp(info, offset) serial_in(info, offset)
6347 +#define serial_outp(info, offset, value) serial_out(info, offset, value)
6353 +void serial_icr_write(struct async_struct *info, int offset, int value)
6355 + serial_out(info, UART_SCR, offset);
6356 + serial_out(info, UART_ICR, value);
6359 +unsigned int serial_icr_read(struct async_struct *info, int offset)
6363 + serial_icr_write(info, UART_ACR, info->ACR | UART_ACR_ICRRD);
6364 + serial_out(info, UART_SCR, offset);
6365 + value = serial_in(info, UART_ICR);
6366 + serial_icr_write(info, UART_ACR, info->ACR);
6371 + * ------------------------------------------------------------
6372 + * rs_stop() and rs_start()
6374 + * This routines are called before setting or resetting tty->stopped.
6375 + * They enable or disable transmitter interrupts, as necessary.
6376 + * ------------------------------------------------------------
6378 +static void rs_stop(struct tty_struct *tty)
6380 + struct async_struct *info = (struct async_struct *)tty->driver_data;
6381 + unsigned long flags;
6383 + if (serial_paranoia_check(info, tty->device, "rs_stop"))
6386 + save_flags(flags); cli();
6387 + if (info->IER & UART_IER_THRI) {
6388 + info->IER &= ~UART_IER_THRI;
6389 + serial_out(info, UART_IER, info->IER);
6391 + if (info->state->type == PORT_16C950) {
6392 + info->ACR |= UART_ACR_TXDIS;
6393 + serial_icr_write(info, UART_ACR, info->ACR);
6395 + restore_flags(flags);
6398 +static void rs_start(struct tty_struct *tty)
6400 + struct async_struct *info = (struct async_struct *)tty->driver_data;
6401 + unsigned long flags;
6403 + if (serial_paranoia_check(info, tty->device, "rs_start"))
6406 + save_flags(flags); cli();
6407 + if (info->xmit.head != info->xmit.tail
6409 + && !(info->IER & UART_IER_THRI)) {
6410 + info->IER |= UART_IER_THRI;
6411 + serial_out(info, UART_IER, info->IER);
6413 + if (info->state->type == PORT_16C950) {
6414 + info->ACR &= ~UART_ACR_TXDIS;
6415 + serial_icr_write(info, UART_ACR, info->ACR);
6417 + restore_flags(flags);
6421 + * ----------------------------------------------------------------------
6423 + * Here starts the interrupt handling routines. All of the following
6424 + * subroutines are declared as inline and are folded into
6425 + * rs_interrupt(). They were separated out for readability's sake.
6427 + * Note: rs_interrupt() is a "fast" interrupt, which means that it
6428 + * runs with interrupts turned off. People who may want to modify
6429 + * rs_interrupt() should try to keep the interrupt handler as fast as
6430 + * possible. After you are done making modifications, it is not a bad
6433 + * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c
6435 + * and look at the resulting assemble code in serial.s.
6437 + * - Ted Ts'o (tytso@mit.edu), 7-Mar-93
6438 + * -----------------------------------------------------------------------
6442 + * This routine is used by the interrupt handler to schedule
6443 + * processing in the software interrupt portion of the driver.
6445 +static _INLINE_ void rs_sched_event(struct async_struct *info,
6448 + info->event |= 1 << event;
6449 + queue_task(&info->tqueue, &tq_serial);
6450 + mark_bh(SERIAL_BH);
6453 +static _INLINE_ void receive_chars(struct async_struct *info,
6454 + int *status, struct pt_regs * regs)
6456 + struct tty_struct *tty = info->tty;
6458 + struct async_icount *icount;
6459 + int max_count = 256;
6461 + icount = &info->state->icount;
6463 + if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
6464 + tty->flip.tqueue.routine((void *) tty);
6465 + if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
6466 + /* no room in flip buffer, discard rx FIFO contents to clear IRQ
6467 + * *FIXME* Hardware with auto flow control
6468 + * would benefit from leaving the data in the FIFO and
6469 + * disabling the rx IRQ until space becomes available.
6472 + serial_inp(info, UART_RX);
6473 + icount->overrun++;
6474 + *status = serial_inp(info, UART_LSR);
6475 + } while ((*status & UART_LSR_DR) && (max_count-- > 0));
6476 + return; // if TTY_DONT_FLIP is set
6479 + ch = serial_inp(info, UART_RX);
6480 + *tty->flip.char_buf_ptr = ch;
6483 +#ifdef SERIAL_DEBUG_INTR
6484 + printk("DR%02x:%02x...", ch, *status);
6486 + *tty->flip.flag_buf_ptr = 0;
6487 + if (*status & (UART_LSR_BI | UART_LSR_PE |
6488 + UART_LSR_FE | UART_LSR_OE)) {
6490 + * For statistics only
6492 + if (*status & UART_LSR_BI) {
6493 + *status &= ~(UART_LSR_FE | UART_LSR_PE);
6496 + * We do the SysRQ and SAK checking
6497 + * here because otherwise the break
6498 + * may get masked by ignore_status_mask
6499 + * or read_status_mask.
6501 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
6502 + if (info->line == sercons.index) {
6503 + if (!break_pressed) {
6504 + break_pressed = jiffies;
6507 + break_pressed = 0;
6510 + if (info->flags & ASYNC_SAK)
6512 + } else if (*status & UART_LSR_PE)
6514 + else if (*status & UART_LSR_FE)
6516 + if (*status & UART_LSR_OE)
6517 + icount->overrun++;
6520 + * Mask off conditions which should be ignored.
6522 + *status &= info->read_status_mask;
6524 +#ifdef CONFIG_SERIAL_CONSOLE
6525 + if (info->line == sercons.index) {
6526 + /* Recover the break flag from console xmit */
6527 + *status |= lsr_break_flag;
6528 + lsr_break_flag = 0;
6531 + if (*status & (UART_LSR_BI)) {
6532 +#ifdef SERIAL_DEBUG_INTR
6533 + printk("handling break....");
6535 + *tty->flip.flag_buf_ptr = TTY_BREAK;
6536 + } else if (*status & UART_LSR_PE)
6537 + *tty->flip.flag_buf_ptr = TTY_PARITY;
6538 + else if (*status & UART_LSR_FE)
6539 + *tty->flip.flag_buf_ptr = TTY_FRAME;
6541 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
6542 + if (break_pressed && info->line == sercons.index) {
6544 + time_before(jiffies, break_pressed + HZ*5)) {
6545 + handle_sysrq(ch, regs, NULL, NULL);
6546 + break_pressed = 0;
6549 + break_pressed = 0;
6552 + if ((*status & info->ignore_status_mask) == 0) {
6553 + tty->flip.flag_buf_ptr++;
6554 + tty->flip.char_buf_ptr++;
6555 + tty->flip.count++;
6557 + if ((*status & UART_LSR_OE) &&
6558 + (tty->flip.count < TTY_FLIPBUF_SIZE)) {
6560 + * Overrun is special, since it's reported
6561 + * immediately, and doesn't affect the current
6564 + *tty->flip.flag_buf_ptr = TTY_OVERRUN;
6565 + tty->flip.count++;
6566 + tty->flip.flag_buf_ptr++;
6567 + tty->flip.char_buf_ptr++;
6569 +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
6572 + *status = serial_inp(info, UART_LSR);
6573 + } while ((*status & UART_LSR_DR) && (max_count-- > 0));
6574 +#if (LINUX_VERSION_CODE > 131394) /* 2.1.66 */
6575 + tty_flip_buffer_push(tty);
6577 + queue_task_irq_off(&tty->flip.tqueue, &tq_timer);
6581 +static _INLINE_ void transmit_chars(struct async_struct *info, int *intr_done)
6585 + if (info->x_char) {
6586 + serial_outp(info, UART_TX, info->x_char);
6587 + info->state->icount.tx++;
6593 + if (info->xmit.head == info->xmit.tail
6594 + || info->tty->stopped
6595 + || info->tty->hw_stopped) {
6596 + info->IER &= ~UART_IER_THRI;
6597 + serial_out(info, UART_IER, info->IER);
6601 + count = info->xmit_fifo_size;
6603 + serial_out(info, UART_TX, info->xmit.buf[info->xmit.tail]);
6604 + info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
6605 + info->state->icount.tx++;
6606 + if (info->xmit.head == info->xmit.tail)
6608 + } while (--count > 0);
6610 + if (CIRC_CNT(info->xmit.head,
6612 + SERIAL_XMIT_SIZE) < WAKEUP_CHARS)
6613 + rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
6615 +#ifdef SERIAL_DEBUG_INTR
6616 + printk("THRE...");
6621 + if (info->xmit.head == info->xmit.tail) {
6622 + info->IER &= ~UART_IER_THRI;
6623 + serial_out(info, UART_IER, info->IER);
6627 +static _INLINE_ void check_modem_status(struct async_struct *info)
6630 + struct async_icount *icount;
6632 + status = serial_in(info, UART_MSR);
6634 + if (status & UART_MSR_ANY_DELTA) {
6635 + icount = &info->state->icount;
6636 + /* update input line counters */
6637 + if (status & UART_MSR_TERI)
6639 + if (status & UART_MSR_DDSR)
6641 + if (status & UART_MSR_DDCD) {
6643 +#ifdef CONFIG_HARD_PPS
6644 + if ((info->flags & ASYNC_HARDPPS_CD) &&
6645 + (status & UART_MSR_DCD))
6649 + if (status & UART_MSR_DCTS)
6651 + wake_up_interruptible(&info->delta_msr_wait);
6654 + if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
6655 +#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
6656 + printk("ttys%d CD now %s...", info->line,
6657 + (status & UART_MSR_DCD) ? "on" : "off");
6659 + if (status & UART_MSR_DCD)
6660 + wake_up_interruptible(&info->open_wait);
6661 + else if (!((info->flags & ASYNC_CALLOUT_ACTIVE) &&
6662 + (info->flags & ASYNC_CALLOUT_NOHUP))) {
6663 +#ifdef SERIAL_DEBUG_OPEN
6664 + printk("doing serial hangup...");
6667 + tty_hangup(info->tty);
6670 + if (info->flags & ASYNC_CTS_FLOW) {
6671 + if (info->tty->hw_stopped) {
6672 + if (status & UART_MSR_CTS) {
6673 +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
6674 + printk("CTS tx start...");
6676 + info->tty->hw_stopped = 0;
6677 + info->IER |= UART_IER_THRI;
6678 + serial_out(info, UART_IER, info->IER);
6679 + rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
6683 + if (!(status & UART_MSR_CTS)) {
6684 +#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
6685 + printk("CTS tx stop...");
6687 + info->tty->hw_stopped = 1;
6688 + info->IER &= ~UART_IER_THRI;
6689 + serial_out(info, UART_IER, info->IER);
6695 +#ifdef CONFIG_SERIAL_SHARE_IRQ
6697 + * This is the serial driver's generic interrupt routine
6699 +static void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs)
6702 + struct async_struct * info;
6703 + int pass_counter = 0;
6704 + struct async_struct *end_mark = 0;
6705 +#ifdef CONFIG_SERIAL_MULTIPORT
6706 + int first_multi = 0;
6707 + struct rs_multiport_struct *multi;
6710 +#ifdef SERIAL_DEBUG_INTR
6711 + printk("rs_interrupt(%d)...", irq);
6714 + info = IRQ_ports[irq];
6718 +#ifdef CONFIG_SERIAL_MULTIPORT
6719 + multi = &rs_multiport[irq];
6720 + if (multi->port_monitor)
6721 + first_multi = inb(multi->port_monitor);
6726 + ((iir=serial_in(info, UART_IIR)) & UART_IIR_NO_INT)) {
6731 +#ifdef SERIAL_DEBUG_INTR
6732 + printk("IIR = %x...", serial_in(info, UART_IIR));
6736 + info->last_active = jiffies;
6738 + status = serial_inp(info, UART_LSR);
6739 +#ifdef SERIAL_DEBUG_INTR
6740 + printk("status = %x...", status);
6742 + if (status & UART_LSR_DR)
6743 + receive_chars(info, &status, regs);
6744 + check_modem_status(info);
6745 +#ifdef CONFIG_MELAN
6746 + if ((status & UART_LSR_THRE) ||
6747 + /* for buggy ELAN processors */
6748 + ((iir & UART_IIR_ID) == UART_IIR_THRI))
6749 + transmit_chars(info, 0);
6751 + if (status & UART_LSR_THRE)
6752 + transmit_chars(info, 0);
6756 + info = info->next_port;
6758 + info = IRQ_ports[irq];
6759 + if (pass_counter++ > RS_ISR_PASS_LIMIT) {
6761 + printk("rs loop break\n");
6763 + break; /* Prevent infinite loops */
6767 + } while (end_mark != info);
6768 +#ifdef CONFIG_SERIAL_MULTIPORT
6769 + if (multi->port_monitor)
6770 + printk("rs port monitor (normal) irq %d: 0x%x, 0x%x\n",
6771 + info->state->irq, first_multi,
6772 + inb(multi->port_monitor));
6774 +#ifdef SERIAL_DEBUG_INTR
6778 +#endif /* #ifdef CONFIG_SERIAL_SHARE_IRQ */
6782 + * This is the serial driver's interrupt routine for a single port
6784 +static void rs_interrupt_single(int irq, void *dev_id, struct pt_regs * regs)
6787 + int pass_counter = 0;
6788 + struct async_struct * info;
6789 +#ifdef CONFIG_SERIAL_MULTIPORT
6790 + int first_multi = 0;
6791 + struct rs_multiport_struct *multi;
6794 +#ifdef SERIAL_DEBUG_INTR
6795 + printk("rs_interrupt_single(%d)...", irq);
6798 + info = IRQ_ports[irq];
6799 + if (!info || !info->tty)
6802 +#ifdef CONFIG_SERIAL_MULTIPORT
6803 + multi = &rs_multiport[irq];
6804 + if (multi->port_monitor)
6805 + first_multi = inb(multi->port_monitor);
6808 + iir = serial_in(info, UART_IIR);
6810 + status = serial_inp(info, UART_LSR);
6811 +#ifdef SERIAL_DEBUG_INTR
6812 + printk("status = %x...", status);
6814 + if (status & UART_LSR_DR)
6815 + receive_chars(info, &status, regs);
6816 + check_modem_status(info);
6817 +#ifdef CONFIG_MELAN
6818 + if ((status & UART_LSR_THRE) ||
6819 + /* For buggy ELAN processors */
6820 + ((iir & UART_IIR_ID) == UART_IIR_THRI))
6821 + transmit_chars(info, 0);
6823 + if (status & UART_LSR_THRE)
6824 + transmit_chars(info, 0);
6826 + if (pass_counter++ > RS_ISR_PASS_LIMIT) {
6827 +#if SERIAL_DEBUG_INTR
6828 + printk("rs_single loop break.\n");
6832 + iir = serial_in(info, UART_IIR);
6833 +#ifdef SERIAL_DEBUG_INTR
6834 + printk("IIR = %x...", iir);
6836 + } while ((iir & UART_IIR_NO_INT) == 0);
6837 + info->last_active = jiffies;
6838 +#ifdef CONFIG_SERIAL_MULTIPORT
6839 + if (multi->port_monitor)
6840 + printk("rs port monitor (single) irq %d: 0x%x, 0x%x\n",
6841 + info->state->irq, first_multi,
6842 + inb(multi->port_monitor));
6844 +#ifdef SERIAL_DEBUG_INTR
6849 +#ifdef CONFIG_SERIAL_MULTIPORT
6851 + * This is the serial driver's for multiport boards
6853 +static void rs_interrupt_multi(int irq, void *dev_id, struct pt_regs * regs)
6856 + struct async_struct * info;
6857 + int pass_counter = 0;
6858 + int first_multi= 0;
6859 + struct rs_multiport_struct *multi;
6861 +#ifdef SERIAL_DEBUG_INTR
6862 + printk("rs_interrupt_multi(%d)...", irq);
6865 + info = IRQ_ports[irq];
6868 + multi = &rs_multiport[irq];
6869 + if (!multi->port1) {
6870 + /* Should never happen */
6871 + printk("rs_interrupt_multi: NULL port1!\n");
6874 + if (multi->port_monitor)
6875 + first_multi = inb(multi->port_monitor);
6879 + (serial_in(info, UART_IIR) & UART_IIR_NO_INT))
6882 + info->last_active = jiffies;
6884 + status = serial_inp(info, UART_LSR);
6885 +#ifdef SERIAL_DEBUG_INTR
6886 + printk("status = %x...", status);
6888 + if (status & UART_LSR_DR)
6889 + receive_chars(info, &status, regs);
6890 + check_modem_status(info);
6891 + if (status & UART_LSR_THRE)
6892 + transmit_chars(info, 0);
6895 + info = info->next_port;
6899 + info = IRQ_ports[irq];
6901 + * The user was a bonehead, and misconfigured their
6902 + * multiport info. Rather than lock up the kernel
6903 + * in an infinite loop, if we loop too many times,
6904 + * print a message and break out of the loop.
6906 + if (pass_counter++ > RS_ISR_PASS_LIMIT) {
6907 + printk("Misconfigured multiport serial info "
6908 + "for irq %d. Breaking out irq loop\n", irq);
6911 + if (multi->port_monitor)
6912 + printk("rs port monitor irq %d: 0x%x, 0x%x\n",
6913 + info->state->irq, first_multi,
6914 + inb(multi->port_monitor));
6915 + if ((inb(multi->port1) & multi->mask1) != multi->match1)
6917 + if (!multi->port2)
6919 + if ((inb(multi->port2) & multi->mask2) != multi->match2)
6921 + if (!multi->port3)
6923 + if ((inb(multi->port3) & multi->mask3) != multi->match3)
6925 + if (!multi->port4)
6927 + if ((inb(multi->port4) & multi->mask4) != multi->match4)
6931 +#ifdef SERIAL_DEBUG_INTR
6938 + * -------------------------------------------------------------------
6939 + * Here ends the serial interrupt routines.
6940 + * -------------------------------------------------------------------
6944 + * This routine is used to handle the "bottom half" processing for the
6945 + * serial driver, known also the "software interrupt" processing.
6946 + * This processing is done at the kernel interrupt level, after the
6947 + * rs_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON. This
6948 + * is where time-consuming activities which can not be done in the
6949 + * interrupt driver proper are done; the interrupt driver schedules
6950 + * them using rs_sched_event(), and they get done here.
6952 +static void do_serial_bh(void)
6954 + run_task_queue(&tq_serial);
6957 +static void do_softint(void *private_)
6959 + struct async_struct *info = (struct async_struct *) private_;
6960 + struct tty_struct *tty;
6966 + if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
6969 +#ifdef SERIAL_HAVE_POLL_WAIT
6970 + wake_up_interruptible(&tty->poll_wait);
6976 + * This subroutine is called when the RS_TIMER goes off. It is used
6977 + * by the serial driver to handle ports that do not have an interrupt
6978 + * (irq=0). This doesn't work very well for 16450's, but gives barely
6979 + * passable results for a 16550A. (Although at the expense of much
6982 +static void rs_timer(unsigned long dummy)
6984 + static unsigned long last_strobe;
6985 + struct async_struct *info;
6987 + unsigned long flags;
6989 + if ((jiffies - last_strobe) >= RS_STROBE_TIME) {
6990 + for (i=0; i < NR_IRQS; i++) {
6991 + info = IRQ_ports[i];
6994 + save_flags(flags); cli();
6995 +#ifdef CONFIG_SERIAL_SHARE_IRQ
6996 + if (info->next_port) {
6998 + serial_out(info, UART_IER, 0);
6999 + info->IER |= UART_IER_THRI;
7000 + serial_out(info, UART_IER, info->IER);
7001 + info = info->next_port;
7003 +#ifdef CONFIG_SERIAL_MULTIPORT
7004 + if (rs_multiport[i].port1)
7005 + rs_interrupt_multi(i, NULL, NULL);
7008 + rs_interrupt(i, NULL, NULL);
7010 +#endif /* CONFIG_SERIAL_SHARE_IRQ */
7011 + rs_interrupt_single(i, NULL, NULL);
7012 + restore_flags(flags);
7015 + last_strobe = jiffies;
7016 + mod_timer(&serial_timer, jiffies + RS_STROBE_TIME);
7018 + if (IRQ_ports[0]) {
7019 + save_flags(flags); cli();
7020 +#ifdef CONFIG_SERIAL_SHARE_IRQ
7021 + rs_interrupt(0, NULL, NULL);
7023 + rs_interrupt_single(0, NULL, NULL);
7025 + restore_flags(flags);
7027 + mod_timer(&serial_timer, jiffies + IRQ_timeout[0]);
7032 + * ---------------------------------------------------------------
7033 + * Low level utility subroutines for the serial driver: routines to
7034 + * figure out the appropriate timeout for an interrupt chain, routines
7035 + * to initialize and startup a serial port, and routines to shutdown a
7036 + * serial port. Useful stuff like that.
7037 + * ---------------------------------------------------------------
7041 + * This routine figures out the correct timeout for a particular IRQ.
7042 + * It uses the smallest timeout of all of the serial ports in a
7043 + * particular interrupt chain. Now only used for IRQ 0....
7045 +static void figure_IRQ_timeout(int irq)
7047 + struct async_struct *info;
7048 + int timeout = 60*HZ; /* 60 seconds === a long time :-) */
7050 + info = IRQ_ports[irq];
7052 + IRQ_timeout[irq] = 60*HZ;
7056 + if (info->timeout < timeout)
7057 + timeout = info->timeout;
7058 + info = info->next_port;
7061 + timeout = timeout / 2;
7062 + IRQ_timeout[irq] = (timeout > 3) ? timeout-2 : 1;
7065 +#ifdef CONFIG_SERIAL_RSA
7066 +/* Attempts to turn on the RSA FIFO. Returns zero on failure */
7067 +static int enable_rsa(struct async_struct *info)
7069 + unsigned char mode;
7071 + unsigned long flags;
7073 + save_flags(flags); cli();
7074 + mode = serial_inp(info, UART_RSA_MSR);
7075 + result = mode & UART_RSA_MSR_FIFO;
7078 + serial_outp(info, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO);
7079 + mode = serial_inp(info, UART_RSA_MSR);
7080 + result = mode & UART_RSA_MSR_FIFO;
7083 + restore_flags(flags);
7087 +/* Attempts to turn off the RSA FIFO. Returns zero on failure */
7088 +static int disable_rsa(struct async_struct *info)
7090 + unsigned char mode;
7092 + unsigned long flags;
7094 + save_flags(flags); cli();
7095 + mode = serial_inp(info, UART_RSA_MSR);
7096 + result = !(mode & UART_RSA_MSR_FIFO);
7099 + serial_outp(info, UART_RSA_MSR, mode & ~UART_RSA_MSR_FIFO);
7100 + mode = serial_inp(info, UART_RSA_MSR);
7101 + result = !(mode & UART_RSA_MSR_FIFO);
7104 + restore_flags(flags);
7107 +#endif /* CONFIG_SERIAL_RSA */
7109 +static int startup(struct async_struct * info)
7111 + unsigned long flags;
7113 + void (*handler)(int, void *, struct pt_regs *);
7114 + struct serial_state *state= info->state;
7115 + unsigned long page;
7116 +#ifdef CONFIG_SERIAL_MANY_PORTS
7117 + unsigned short ICP;
7120 + page = get_zeroed_page(GFP_KERNEL);
7124 + save_flags(flags); cli();
7126 + if (info->flags & ASYNC_INITIALIZED) {
7131 + if (!CONFIGURED_SERIAL_PORT(state) || !state->type) {
7133 + set_bit(TTY_IO_ERROR, &info->tty->flags);
7137 + if (info->xmit.buf)
7140 + info->xmit.buf = (unsigned char *) page;
7142 +#ifdef SERIAL_DEBUG_OPEN
7143 + printk("starting up ttys%d (irq %d)...", info->line, state->irq);
7146 + if (uart_config[state->type].flags & UART_STARTECH) {
7147 + /* Wake up UART */
7148 + serial_outp(info, UART_LCR, 0xBF);
7149 + serial_outp(info, UART_EFR, UART_EFR_ECB);
7151 + * Turn off LCR == 0xBF so we actually set the IER
7152 + * register on the XR16C850
7154 + serial_outp(info, UART_LCR, 0);
7155 + serial_outp(info, UART_IER, 0);
7157 + * Now reset LCR so we can turn off the ECB bit
7159 + serial_outp(info, UART_LCR, 0xBF);
7160 + serial_outp(info, UART_EFR, 0);
7162 + * For a XR16C850, we need to set the trigger levels
7164 + if (state->type == PORT_16850) {
7165 + serial_outp(info, UART_FCTR, UART_FCTR_TRGD |
7167 + serial_outp(info, UART_TRG, UART_TRG_96);
7168 + serial_outp(info, UART_FCTR, UART_FCTR_TRGD |
7170 + serial_outp(info, UART_TRG, UART_TRG_96);
7172 + serial_outp(info, UART_LCR, 0);
7175 + if (state->type == PORT_16750) {
7176 + /* Wake up UART */
7177 + serial_outp(info, UART_IER, 0);
7180 + if (state->type == PORT_16C950) {
7181 + /* Wake up and initialize UART */
7183 + serial_outp(info, UART_LCR, 0xBF);
7184 + serial_outp(info, UART_EFR, UART_EFR_ECB);
7185 + serial_outp(info, UART_IER, 0);
7186 + serial_outp(info, UART_LCR, 0);
7187 + serial_icr_write(info, UART_CSR, 0); /* Reset the UART */
7188 + serial_outp(info, UART_LCR, 0xBF);
7189 + serial_outp(info, UART_EFR, UART_EFR_ECB);
7190 + serial_outp(info, UART_LCR, 0);
7193 +#ifdef CONFIG_SERIAL_RSA
7195 + * If this is an RSA port, see if we can kick it up to the
7196 + * higher speed clock.
7198 + if (state->type == PORT_RSA) {
7199 + if (state->baud_base != SERIAL_RSA_BAUD_BASE &&
7201 + state->baud_base = SERIAL_RSA_BAUD_BASE;
7202 + if (state->baud_base == SERIAL_RSA_BAUD_BASE)
7203 + serial_outp(info, UART_RSA_FRR, 0);
7208 + * Clear the FIFO buffers and disable them
7209 + * (they will be reenabled in change_speed())
7211 + if (uart_config[state->type].flags & UART_CLEAR_FIFO) {
7212 + serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO);
7213 + serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO |
7214 + UART_FCR_CLEAR_RCVR |
7215 + UART_FCR_CLEAR_XMIT));
7216 + serial_outp(info, UART_FCR, 0);
7220 + * Clear the interrupt registers.
7222 + (void) serial_inp(info, UART_LSR);
7223 + (void) serial_inp(info, UART_RX);
7224 + (void) serial_inp(info, UART_IIR);
7225 + (void) serial_inp(info, UART_MSR);
7228 + * At this point there's no way the LSR could still be 0xFF;
7229 + * if it is, then bail out, because there's likely no UART
7232 + if (!(info->flags & ASYNC_BUGGY_UART) &&
7233 + (serial_inp(info, UART_LSR) == 0xff)) {
7234 + printk("ttyS%d: LSR safety check engaged!\n", state->line);
7235 + if (capable(CAP_SYS_ADMIN)) {
7237 + set_bit(TTY_IO_ERROR, &info->tty->flags);
7244 + * Allocate the IRQ if necessary
7246 + if (state->irq && (!IRQ_ports[state->irq] ||
7247 + !IRQ_ports[state->irq]->next_port)) {
7248 + if (IRQ_ports[state->irq]) {
7249 +#ifdef CONFIG_SERIAL_SHARE_IRQ
7250 + free_irq(state->irq, &IRQ_ports[state->irq]);
7251 +#ifdef CONFIG_SERIAL_MULTIPORT
7252 + if (rs_multiport[state->irq].port1)
7253 + handler = rs_interrupt_multi;
7256 + handler = rs_interrupt;
7260 +#endif /* CONFIG_SERIAL_SHARE_IRQ */
7262 + handler = rs_interrupt_single;
7264 + retval = request_irq(state->irq, handler, SA_SHIRQ,
7265 + "serial", &IRQ_ports[state->irq]);
7267 + if (capable(CAP_SYS_ADMIN)) {
7269 + set_bit(TTY_IO_ERROR,
7270 + &info->tty->flags);
7278 + * Insert serial port into IRQ chain.
7280 + info->prev_port = 0;
7281 + info->next_port = IRQ_ports[state->irq];
7282 + if (info->next_port)
7283 + info->next_port->prev_port = info;
7284 + IRQ_ports[state->irq] = info;
7285 + figure_IRQ_timeout(state->irq);
7288 + * Now, initialize the UART
7290 + serial_outp(info, UART_LCR, UART_LCR_WLEN8); /* reset DLAB */
7293 + if (info->tty->termios->c_cflag & CBAUD)
7294 + info->MCR = UART_MCR_DTR | UART_MCR_RTS;
7295 +#ifdef CONFIG_SERIAL_MANY_PORTS
7296 + if (info->flags & ASYNC_FOURPORT) {
7297 + if (state->irq == 0)
7298 + info->MCR |= UART_MCR_OUT1;
7302 + if (state->irq != 0)
7303 + info->MCR |= UART_MCR_OUT2;
7305 + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */
7306 + serial_outp(info, UART_MCR, info->MCR);
7309 + * Finally, enable interrupts
7311 + info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI;
7312 + serial_outp(info, UART_IER, info->IER); /* enable interrupts */
7314 +#ifdef CONFIG_SERIAL_MANY_PORTS
7315 + if (info->flags & ASYNC_FOURPORT) {
7316 + /* Enable interrupts on the AST Fourport board */
7317 + ICP = (info->port & 0xFE0) | 0x01F;
7318 + outb_p(0x80, ICP);
7319 + (void) inb_p(ICP);
7324 + * And clear the interrupt registers again for luck.
7326 + (void)serial_inp(info, UART_LSR);
7327 + (void)serial_inp(info, UART_RX);
7328 + (void)serial_inp(info, UART_IIR);
7329 + (void)serial_inp(info, UART_MSR);
7332 + clear_bit(TTY_IO_ERROR, &info->tty->flags);
7333 + info->xmit.head = info->xmit.tail = 0;
7336 + * Set up serial timers...
7338 + mod_timer(&serial_timer, jiffies + 2*HZ/100);
7341 + * Set up the tty->alt_speed kludge
7343 +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */
7345 + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
7346 + info->tty->alt_speed = 57600;
7347 + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
7348 + info->tty->alt_speed = 115200;
7349 + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
7350 + info->tty->alt_speed = 230400;
7351 + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
7352 + info->tty->alt_speed = 460800;
7357 + * and set the speed of the serial port
7359 + change_speed(info, 0);
7361 + info->flags |= ASYNC_INITIALIZED;
7362 + restore_flags(flags);
7366 + restore_flags(flags);
7371 + * This routine will shutdown a serial port; interrupts are disabled, and
7372 + * DTR is dropped if the hangup on close termio flag is on.
7374 +static void shutdown(struct async_struct * info)
7376 + unsigned long flags;
7377 + struct serial_state *state;
7380 + if (!(info->flags & ASYNC_INITIALIZED))
7383 + state = info->state;
7385 +#ifdef SERIAL_DEBUG_OPEN
7386 + printk("Shutting down serial port %d (irq %d)....", info->line,
7390 + save_flags(flags); cli(); /* Disable interrupts */
7393 + * clear delta_msr_wait queue to avoid mem leaks: we may free the irq
7394 + * here so the queue might never be waken up
7396 + wake_up_interruptible(&info->delta_msr_wait);
7399 + * First unlink the serial port from the IRQ chain...
7401 + if (info->next_port)
7402 + info->next_port->prev_port = info->prev_port;
7403 + if (info->prev_port)
7404 + info->prev_port->next_port = info->next_port;
7406 + IRQ_ports[state->irq] = info->next_port;
7407 + figure_IRQ_timeout(state->irq);
7410 + * Free the IRQ, if necessary
7412 + if (state->irq && (!IRQ_ports[state->irq] ||
7413 + !IRQ_ports[state->irq]->next_port)) {
7414 + if (IRQ_ports[state->irq]) {
7415 + free_irq(state->irq, &IRQ_ports[state->irq]);
7416 + retval = request_irq(state->irq, rs_interrupt_single,
7417 + SA_SHIRQ, "serial",
7418 + &IRQ_ports[state->irq]);
7421 + printk("serial shutdown: request_irq: error %d"
7422 + " Couldn't reacquire IRQ.\n", retval);
7424 + free_irq(state->irq, &IRQ_ports[state->irq]);
7427 + if (info->xmit.buf) {
7428 + unsigned long pg = (unsigned long) info->xmit.buf;
7429 + info->xmit.buf = 0;
7434 + serial_outp(info, UART_IER, 0x00); /* disable all intrs */
7435 +#ifdef CONFIG_SERIAL_MANY_PORTS
7436 + if (info->flags & ASYNC_FOURPORT) {
7437 + /* reset interrupts on the AST Fourport board */
7438 + (void) inb((info->port & 0xFE0) | 0x01F);
7439 + info->MCR |= UART_MCR_OUT1;
7442 + info->MCR &= ~UART_MCR_OUT2;
7443 + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */
7445 + /* disable break condition */
7446 + serial_out(info, UART_LCR, serial_inp(info, UART_LCR) & ~UART_LCR_SBC);
7448 + if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
7449 + info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
7450 + serial_outp(info, UART_MCR, info->MCR);
7452 + /* disable FIFO's */
7453 + serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO |
7454 + UART_FCR_CLEAR_RCVR |
7455 + UART_FCR_CLEAR_XMIT));
7456 + serial_outp(info, UART_FCR, 0);
7458 +#ifdef CONFIG_SERIAL_RSA
7460 + * Reset the RSA board back to 115kbps compat mode.
7462 + if ((state->type == PORT_RSA) &&
7463 + (state->baud_base == SERIAL_RSA_BAUD_BASE &&
7464 + disable_rsa(info)))
7465 + state->baud_base = SERIAL_RSA_BAUD_BASE_LO;
7469 + (void)serial_in(info, UART_RX); /* read data port to reset things */
7472 + set_bit(TTY_IO_ERROR, &info->tty->flags);
7474 + if (uart_config[info->state->type].flags & UART_STARTECH) {
7475 + /* Arrange to enter sleep mode */
7476 + serial_outp(info, UART_LCR, 0xBF);
7477 + serial_outp(info, UART_EFR, UART_EFR_ECB);
7478 + serial_outp(info, UART_LCR, 0);
7479 + serial_outp(info, UART_IER, UART_IERX_SLEEP);
7480 + serial_outp(info, UART_LCR, 0xBF);
7481 + serial_outp(info, UART_EFR, 0);
7482 + serial_outp(info, UART_LCR, 0);
7484 + if (info->state->type == PORT_16750) {
7485 + /* Arrange to enter sleep mode */
7486 + serial_outp(info, UART_IER, UART_IERX_SLEEP);
7488 + info->flags &= ~ASYNC_INITIALIZED;
7489 + restore_flags(flags);
7492 +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
7493 +static int baud_table[] = {
7494 + 0, 50, 75, 110, 134, 150, 200, 300,
7495 + 600, 1200, 1800, 2400, 4800, 9600, 19200,
7496 + 38400, 57600, 115200, 230400, 460800, 0 };
7498 +static int tty_get_baud_rate(struct tty_struct *tty)
7500 + struct async_struct * info = (struct async_struct *)tty->driver_data;
7501 + unsigned int cflag, i;
7503 + cflag = tty->termios->c_cflag;
7505 + i = cflag & CBAUD;
7506 + if (i & CBAUDEX) {
7508 + if (i < 1 || i > 2)
7509 + tty->termios->c_cflag &= ~CBAUDEX;
7514 + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
7516 + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
7519 + return baud_table[i];
7524 + * This routine is called to set the UART divisor registers to match
7525 + * the specified baud rate for a serial port.
7527 +static void change_speed(struct async_struct *info,
7528 + struct termios *old_termios)
7530 + int quot = 0, baud_base, baud;
7531 + unsigned cflag, cval, fcr = 0;
7533 + unsigned long flags;
7535 + if (!info->tty || !info->tty->termios)
7537 + cflag = info->tty->termios->c_cflag;
7538 + if (!CONFIGURED_SERIAL_PORT(info))
7541 + /* byte size and parity */
7542 + switch (cflag & CSIZE) {
7543 + case CS5: cval = 0x00; bits = 7; break;
7544 + case CS6: cval = 0x01; bits = 8; break;
7545 + case CS7: cval = 0x02; bits = 9; break;
7546 + case CS8: cval = 0x03; bits = 10; break;
7547 + /* Never happens, but GCC is too dumb to figure it out */
7548 + default: cval = 0x00; bits = 7; break;
7550 + if (cflag & CSTOPB) {
7554 + if (cflag & PARENB) {
7555 + cval |= UART_LCR_PARITY;
7558 + if (!(cflag & PARODD))
7559 + cval |= UART_LCR_EPAR;
7561 + if (cflag & CMSPAR)
7562 + cval |= UART_LCR_SPAR;
7565 + /* Determine divisor based on baud rate */
7566 + baud = tty_get_baud_rate(info->tty);
7568 + baud = 9600; /* B0 transition handled in rs_set_termios */
7569 +#ifdef CONFIG_SERIAL_RSA
7570 + if ((info->state->type == PORT_RSA) &&
7571 + (info->state->baud_base != SERIAL_RSA_BAUD_BASE) &&
7573 + info->state->baud_base = SERIAL_RSA_BAUD_BASE;
7575 + baud_base = info->state->baud_base;
7576 + if (info->state->type == PORT_16C950) {
7577 + if (baud <= baud_base)
7578 + serial_icr_write(info, UART_TCR, 0);
7579 + else if (baud <= 2*baud_base) {
7580 + serial_icr_write(info, UART_TCR, 0x8);
7581 + baud_base = baud_base * 2;
7582 + } else if (baud <= 4*baud_base) {
7583 + serial_icr_write(info, UART_TCR, 0x4);
7584 + baud_base = baud_base * 4;
7586 + serial_icr_write(info, UART_TCR, 0);
7588 + if (baud == 38400 &&
7589 + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
7590 + quot = info->state->custom_divisor;
7593 + /* Special case since 134 is really 134.5 */
7594 + quot = (2*baud_base / 269);
7596 + quot = baud_base / baud;
7598 + /* If the quotient is zero refuse the change */
7599 + if (!quot && old_termios) {
7600 + info->tty->termios->c_cflag &= ~CBAUD;
7601 + info->tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD);
7602 + baud = tty_get_baud_rate(info->tty);
7605 + if (baud == 38400 &&
7606 + ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
7607 + quot = info->state->custom_divisor;
7610 + /* Special case since 134 is really 134.5 */
7611 + quot = (2*baud_base / 269);
7613 + quot = baud_base / baud;
7616 + /* As a last resort, if the quotient is zero, default to 9600 bps */
7618 + quot = baud_base / 9600;
7620 + * Work around a bug in the Oxford Semiconductor 952 rev B
7621 + * chip which causes it to seriously miscalculate baud rates
7624 + if (((quot & 0xFF) == 0) && (info->state->type == PORT_16C950) &&
7625 + (info->state->revision == 0x5201))
7628 + info->quot = quot;
7629 + info->timeout = ((info->xmit_fifo_size*HZ*bits*quot) / baud_base);
7630 + info->timeout += HZ/50; /* Add .02 seconds of slop */
7632 + /* Set up FIFO's */
7633 + if (uart_config[info->state->type].flags & UART_USE_FIFO) {
7634 + if ((info->state->baud_base / quot) < 2400)
7635 + fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
7636 +#ifdef CONFIG_SERIAL_RSA
7637 + else if (info->state->type == PORT_RSA)
7638 + fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_14;
7641 + fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_8;
7643 + if (info->state->type == PORT_16750)
7644 + fcr |= UART_FCR7_64BYTE;
7646 + /* CTS flow control flag and modem status interrupts */
7647 + info->IER &= ~UART_IER_MSI;
7648 + if (info->flags & ASYNC_HARDPPS_CD)
7649 + info->IER |= UART_IER_MSI;
7650 + if (cflag & CRTSCTS) {
7651 + info->flags |= ASYNC_CTS_FLOW;
7652 + info->IER |= UART_IER_MSI;
7654 + info->flags &= ~ASYNC_CTS_FLOW;
7655 + if (cflag & CLOCAL)
7656 + info->flags &= ~ASYNC_CHECK_CD;
7658 + info->flags |= ASYNC_CHECK_CD;
7659 + info->IER |= UART_IER_MSI;
7661 + serial_out(info, UART_IER, info->IER);
7664 + * Set up parity check flag
7666 +#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
7668 + info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
7669 + if (I_INPCK(info->tty))
7670 + info->read_status_mask |= UART_LSR_FE | UART_LSR_PE;
7671 + if (I_BRKINT(info->tty) || I_PARMRK(info->tty))
7672 + info->read_status_mask |= UART_LSR_BI;
7675 + * Characters to ignore
7677 + info->ignore_status_mask = 0;
7678 + if (I_IGNPAR(info->tty))
7679 + info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
7680 + if (I_IGNBRK(info->tty)) {
7681 + info->ignore_status_mask |= UART_LSR_BI;
7683 + * If we're ignore parity and break indicators, ignore
7684 + * overruns too. (For real raw support).
7686 + if (I_IGNPAR(info->tty))
7687 + info->ignore_status_mask |= UART_LSR_OE;
7690 + * !!! ignore all characters if CREAD is not set
7692 + if ((cflag & CREAD) == 0)
7693 + info->ignore_status_mask |= UART_LSR_DR;
7694 + save_flags(flags); cli();
7695 + if (uart_config[info->state->type].flags & UART_STARTECH) {
7696 + serial_outp(info, UART_LCR, 0xBF);
7697 + serial_outp(info, UART_EFR,
7698 + (cflag & CRTSCTS) ? UART_EFR_CTS : 0);
7700 + serial_outp(info, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */
7701 + serial_outp(info, UART_DLL, quot & 0xff); /* LS of divisor */
7702 + serial_outp(info, UART_DLM, quot >> 8); /* MS of divisor */
7703 + if (info->state->type == PORT_16750)
7704 + serial_outp(info, UART_FCR, fcr); /* set fcr */
7705 + serial_outp(info, UART_LCR, cval); /* reset DLAB */
7706 + info->LCR = cval; /* Save LCR */
7707 + if (info->state->type != PORT_16750) {
7708 + if (fcr & UART_FCR_ENABLE_FIFO) {
7709 + /* emulated UARTs (Lucent Venus 167x) need two steps */
7710 + serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO);
7712 + serial_outp(info, UART_FCR, fcr); /* set fcr */
7714 + restore_flags(flags);
7717 +static void rs_put_char(struct tty_struct *tty, unsigned char ch)
7719 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7720 + unsigned long flags;
7722 + if (serial_paranoia_check(info, tty->device, "rs_put_char"))
7725 + if (!tty || !info->xmit.buf)
7728 + save_flags(flags); cli();
7729 + if (CIRC_SPACE(info->xmit.head,
7731 + SERIAL_XMIT_SIZE) == 0) {
7732 + restore_flags(flags);
7736 + info->xmit.buf[info->xmit.head] = ch;
7737 + info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1);
7738 + restore_flags(flags);
7741 +static void rs_flush_chars(struct tty_struct *tty)
7743 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7744 + unsigned long flags;
7746 + if (serial_paranoia_check(info, tty->device, "rs_flush_chars"))
7749 + if (info->xmit.head == info->xmit.tail
7751 + || tty->hw_stopped
7752 + || !info->xmit.buf)
7755 + save_flags(flags); cli();
7756 + info->IER |= UART_IER_THRI;
7757 + serial_out(info, UART_IER, info->IER);
7758 + restore_flags(flags);
7761 +static int rs_write(struct tty_struct * tty, int from_user,
7762 + const unsigned char *buf, int count)
7765 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7766 + unsigned long flags;
7768 + if (serial_paranoia_check(info, tty->device, "rs_write"))
7771 + if (!tty || !info->xmit.buf || !tmp_buf)
7774 + save_flags(flags);
7776 + down(&tmp_buf_sem);
7779 + c = CIRC_SPACE_TO_END(info->xmit.head,
7781 + SERIAL_XMIT_SIZE);
7787 + c -= copy_from_user(tmp_buf, buf, c);
7794 + c1 = CIRC_SPACE_TO_END(info->xmit.head,
7796 + SERIAL_XMIT_SIZE);
7799 + memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c);
7800 + info->xmit.head = ((info->xmit.head + c) &
7801 + (SERIAL_XMIT_SIZE-1));
7802 + restore_flags(flags);
7811 + c = CIRC_SPACE_TO_END(info->xmit.head,
7813 + SERIAL_XMIT_SIZE);
7819 + memcpy(info->xmit.buf + info->xmit.head, buf, c);
7820 + info->xmit.head = ((info->xmit.head + c) &
7821 + (SERIAL_XMIT_SIZE-1));
7826 + restore_flags(flags);
7828 + if (info->xmit.head != info->xmit.tail
7830 + && !tty->hw_stopped
7831 + && !(info->IER & UART_IER_THRI)) {
7832 + info->IER |= UART_IER_THRI;
7833 + serial_out(info, UART_IER, info->IER);
7838 +static int rs_write_room(struct tty_struct *tty)
7840 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7842 + if (serial_paranoia_check(info, tty->device, "rs_write_room"))
7844 + return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
7847 +static int rs_chars_in_buffer(struct tty_struct *tty)
7849 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7851 + if (serial_paranoia_check(info, tty->device, "rs_chars_in_buffer"))
7853 + return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
7856 +static void rs_flush_buffer(struct tty_struct *tty)
7858 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7859 + unsigned long flags;
7861 + if (serial_paranoia_check(info, tty->device, "rs_flush_buffer"))
7863 + save_flags(flags); cli();
7864 + info->xmit.head = info->xmit.tail = 0;
7865 + restore_flags(flags);
7866 +#ifdef SERIAL_HAVE_POLL_WAIT
7867 + wake_up_interruptible(&tty->poll_wait);
7873 + * This function is used to send a high-priority XON/XOFF character to
7876 +static void rs_send_xchar(struct tty_struct *tty, char ch)
7878 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7880 + if (serial_paranoia_check(info, tty->device, "rs_send_char"))
7883 + info->x_char = ch;
7885 + /* Make sure transmit interrupts are on */
7886 + info->IER |= UART_IER_THRI;
7887 + serial_out(info, UART_IER, info->IER);
7892 + * ------------------------------------------------------------
7895 + * This routine is called by the upper-layer tty layer to signal that
7896 + * incoming characters should be throttled.
7897 + * ------------------------------------------------------------
7899 +static void rs_throttle(struct tty_struct * tty)
7901 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7902 + unsigned long flags;
7903 +#ifdef SERIAL_DEBUG_THROTTLE
7906 + printk("throttle %s: %d....\n", tty_name(tty, buf),
7907 + tty->ldisc.chars_in_buffer(tty));
7910 + if (serial_paranoia_check(info, tty->device, "rs_throttle"))
7914 + rs_send_xchar(tty, STOP_CHAR(tty));
7916 + if (tty->termios->c_cflag & CRTSCTS)
7917 + info->MCR &= ~UART_MCR_RTS;
7919 + save_flags(flags); cli();
7920 + serial_out(info, UART_MCR, info->MCR);
7921 + restore_flags(flags);
7924 +static void rs_unthrottle(struct tty_struct * tty)
7926 + struct async_struct *info = (struct async_struct *)tty->driver_data;
7927 + unsigned long flags;
7928 +#ifdef SERIAL_DEBUG_THROTTLE
7931 + printk("unthrottle %s: %d....\n", tty_name(tty, buf),
7932 + tty->ldisc.chars_in_buffer(tty));
7935 + if (serial_paranoia_check(info, tty->device, "rs_unthrottle"))
7938 + if (I_IXOFF(tty)) {
7942 + rs_send_xchar(tty, START_CHAR(tty));
7944 + if (tty->termios->c_cflag & CRTSCTS)
7945 + info->MCR |= UART_MCR_RTS;
7946 + save_flags(flags); cli();
7947 + serial_out(info, UART_MCR, info->MCR);
7948 + restore_flags(flags);
7952 + * ------------------------------------------------------------
7953 + * rs_ioctl() and friends
7954 + * ------------------------------------------------------------
7957 +static int get_serial_info(struct async_struct * info,
7958 + struct serial_struct * retinfo)
7960 + struct serial_struct tmp;
7961 + struct serial_state *state = info->state;
7965 + memset(&tmp, 0, sizeof(tmp));
7966 + tmp.type = state->type;
7967 + tmp.line = state->line;
7968 + tmp.port = state->port;
7969 + if (HIGH_BITS_OFFSET)
7970 + tmp.port_high = state->port >> HIGH_BITS_OFFSET;
7972 + tmp.port_high = 0;
7973 + tmp.irq = state->irq;
7974 + tmp.flags = state->flags;
7975 + tmp.xmit_fifo_size = state->xmit_fifo_size;
7976 + tmp.baud_base = state->baud_base;
7977 + tmp.close_delay = state->close_delay;
7978 + tmp.closing_wait = state->closing_wait;
7979 + tmp.custom_divisor = state->custom_divisor;
7980 + tmp.hub6 = state->hub6;
7981 + tmp.io_type = state->io_type;
7982 + if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
7987 +static int set_serial_info(struct async_struct * info,
7988 + struct serial_struct * new_info)
7990 + struct serial_struct new_serial;
7991 + struct serial_state old_state, *state;
7992 + unsigned int i,change_irq,change_port;
7994 + unsigned long new_port;
7996 + if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
7998 + state = info->state;
7999 + old_state = *state;
8001 + new_port = new_serial.port;
8002 + if (HIGH_BITS_OFFSET)
8003 + new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET;
8005 + change_irq = new_serial.irq != state->irq;
8006 + change_port = (new_port != ((int) state->port)) ||
8007 + (new_serial.hub6 != state->hub6);
8009 + if (!capable(CAP_SYS_ADMIN)) {
8010 + if (change_irq || change_port ||
8011 + (new_serial.baud_base != state->baud_base) ||
8012 + (new_serial.type != state->type) ||
8013 + (new_serial.close_delay != state->close_delay) ||
8014 + (new_serial.xmit_fifo_size != state->xmit_fifo_size) ||
8015 + ((new_serial.flags & ~ASYNC_USR_MASK) !=
8016 + (state->flags & ~ASYNC_USR_MASK)))
8018 + state->flags = ((state->flags & ~ASYNC_USR_MASK) |
8019 + (new_serial.flags & ASYNC_USR_MASK));
8020 + info->flags = ((info->flags & ~ASYNC_USR_MASK) |
8021 + (new_serial.flags & ASYNC_USR_MASK));
8022 + state->custom_divisor = new_serial.custom_divisor;
8023 + goto check_and_exit;
8026 + new_serial.irq = irq_cannonicalize(new_serial.irq);
8028 + if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) ||
8029 + (new_serial.baud_base < 9600)|| (new_serial.type < PORT_UNKNOWN) ||
8030 + (new_serial.type > PORT_MAX) || (new_serial.type == PORT_CIRRUS) ||
8031 + (new_serial.type == PORT_STARTECH)) {
8035 + if ((new_serial.type != state->type) ||
8036 + (new_serial.xmit_fifo_size <= 0))
8037 + new_serial.xmit_fifo_size =
8038 + uart_config[new_serial.type].dfl_xmit_fifo_size;
8040 + /* Make sure address is not already in use */
8041 + if (new_serial.type) {
8042 + for (i = 0 ; i < NR_PORTS; i++)
8043 + if ((state != &rs_table[i]) &&
8044 + (rs_table[i].io_type == SERIAL_IO_PORT) &&
8045 + (rs_table[i].port == new_port) &&
8047 + return -EADDRINUSE;
8050 + if ((change_port || change_irq) && (state->count > 1))
8054 + * OK, past this point, all the error checking has been done.
8055 + * At this point, we start making changes.....
8058 + state->baud_base = new_serial.baud_base;
8059 + state->flags = ((state->flags & ~ASYNC_FLAGS) |
8060 + (new_serial.flags & ASYNC_FLAGS));
8061 + info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) |
8062 + (info->flags & ASYNC_INTERNAL_FLAGS));
8063 + state->custom_divisor = new_serial.custom_divisor;
8064 + state->close_delay = new_serial.close_delay * HZ/100;
8065 + state->closing_wait = new_serial.closing_wait * HZ/100;
8066 +#if (LINUX_VERSION_CODE > 0x20100)
8067 + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
8069 + info->xmit_fifo_size = state->xmit_fifo_size =
8070 + new_serial.xmit_fifo_size;
8072 + if ((state->type != PORT_UNKNOWN) && state->port) {
8073 +#ifdef CONFIG_SERIAL_RSA
8074 + if (old_state.type == PORT_RSA)
8075 + release_region(state->port + UART_RSA_BASE, 16);
8078 + release_region(state->port,8);
8080 + state->type = new_serial.type;
8081 + if (change_port || change_irq) {
8083 + * We need to shutdown the serial port at the old
8084 + * port/irq combination.
8087 + state->irq = new_serial.irq;
8088 + info->port = state->port = new_port;
8089 + info->hub6 = state->hub6 = new_serial.hub6;
8091 + info->io_type = state->io_type = SERIAL_IO_HUB6;
8092 + else if (info->io_type == SERIAL_IO_HUB6)
8093 + info->io_type = state->io_type = SERIAL_IO_PORT;
8095 + if ((state->type != PORT_UNKNOWN) && state->port) {
8096 +#ifdef CONFIG_SERIAL_RSA
8097 + if (state->type == PORT_RSA)
8098 + request_region(state->port + UART_RSA_BASE,
8099 + 16, "serial_rsa(set)");
8102 + request_region(state->port,8,"serial(set)");
8107 + if ((!state->port && !state->iomem_base) || !state->type)
8109 + if (info->flags & ASYNC_INITIALIZED) {
8110 + if (((old_state.flags & ASYNC_SPD_MASK) !=
8111 + (state->flags & ASYNC_SPD_MASK)) ||
8112 + (old_state.custom_divisor != state->custom_divisor)) {
8113 +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */
8114 + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
8115 + info->tty->alt_speed = 57600;
8116 + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
8117 + info->tty->alt_speed = 115200;
8118 + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
8119 + info->tty->alt_speed = 230400;
8120 + if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
8121 + info->tty->alt_speed = 460800;
8123 + change_speed(info, 0);
8126 + retval = startup(info);
8132 + * get_lsr_info - get line status register info
8134 + * Purpose: Let user call ioctl() to get info when the UART physically
8135 + * is emptied. On bus types like RS485, the transmitter must
8136 + * release the bus after transmitting. This must be done when
8137 + * the transmit shift register is empty, not be done when the
8138 + * transmit holding register is empty. This functionality
8139 + * allows an RS485 driver to be written in user space.
8141 +static int get_lsr_info(struct async_struct * info, unsigned int *value)
8143 + unsigned char status;
8144 + unsigned int result;
8145 + unsigned long flags;
8147 + save_flags(flags); cli();
8148 + status = serial_in(info, UART_LSR);
8149 + restore_flags(flags);
8150 + result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
8153 + * If we're about to load something into the transmit
8154 + * register, we'll pretend the transmitter isn't empty to
8155 + * avoid a race condition (depending on when the transmit
8156 + * interrupt happens).
8158 + if (info->x_char ||
8159 + ((CIRC_CNT(info->xmit.head, info->xmit.tail,
8160 + SERIAL_XMIT_SIZE) > 0) &&
8161 + !info->tty->stopped && !info->tty->hw_stopped))
8162 + result &= ~TIOCSER_TEMT;
8164 + if (copy_to_user(value, &result, sizeof(int)))
8170 +static int get_modem_info(struct async_struct * info, unsigned int *value)
8172 + unsigned char control, status;
8173 + unsigned int result;
8174 + unsigned long flags;
8176 + control = info->MCR;
8177 + save_flags(flags); cli();
8178 + status = serial_in(info, UART_MSR);
8179 + restore_flags(flags);
8180 + result = ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
8181 + | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
8183 + | ((control & UART_MCR_OUT1) ? TIOCM_OUT1 : 0)
8184 + | ((control & UART_MCR_OUT2) ? TIOCM_OUT2 : 0)
8186 + | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
8187 + | ((status & UART_MSR_RI) ? TIOCM_RNG : 0)
8188 + | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0)
8189 + | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
8191 + if (copy_to_user(value, &result, sizeof(int)))
8196 +static int set_modem_info(struct async_struct * info, unsigned int cmd,
8197 + unsigned int *value)
8200 + unsigned long flags;
8202 + if (copy_from_user(&arg, value, sizeof(int)))
8207 + if (arg & TIOCM_RTS)
8208 + info->MCR |= UART_MCR_RTS;
8209 + if (arg & TIOCM_DTR)
8210 + info->MCR |= UART_MCR_DTR;
8212 + if (arg & TIOCM_OUT1)
8213 + info->MCR |= UART_MCR_OUT1;
8214 + if (arg & TIOCM_OUT2)
8215 + info->MCR |= UART_MCR_OUT2;
8217 + if (arg & TIOCM_LOOP)
8218 + info->MCR |= UART_MCR_LOOP;
8221 + if (arg & TIOCM_RTS)
8222 + info->MCR &= ~UART_MCR_RTS;
8223 + if (arg & TIOCM_DTR)
8224 + info->MCR &= ~UART_MCR_DTR;
8226 + if (arg & TIOCM_OUT1)
8227 + info->MCR &= ~UART_MCR_OUT1;
8228 + if (arg & TIOCM_OUT2)
8229 + info->MCR &= ~UART_MCR_OUT2;
8231 + if (arg & TIOCM_LOOP)
8232 + info->MCR &= ~UART_MCR_LOOP;
8235 + info->MCR = ((info->MCR & ~(UART_MCR_RTS |
8242 + | ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0)
8244 + | ((arg & TIOCM_OUT1) ? UART_MCR_OUT1 : 0)
8245 + | ((arg & TIOCM_OUT2) ? UART_MCR_OUT2 : 0)
8247 + | ((arg & TIOCM_LOOP) ? UART_MCR_LOOP : 0)
8248 + | ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0));
8253 + save_flags(flags); cli();
8254 + info->MCR |= ALPHA_KLUDGE_MCR; /* Don't ask */
8255 + serial_out(info, UART_MCR, info->MCR);
8256 + restore_flags(flags);
8260 +static int do_autoconfig(struct async_struct * info)
8264 + if (!capable(CAP_SYS_ADMIN))
8267 + if (info->state->count > 1)
8272 + autoconfig(info->state);
8273 + if ((info->state->flags & ASYNC_AUTO_IRQ) &&
8274 + (info->state->port != 0 || info->state->iomem_base != 0) &&
8275 + (info->state->type != PORT_UNKNOWN)) {
8276 + irq = detect_uart_irq(info->state);
8278 + info->state->irq = irq;
8281 + retval = startup(info);
8288 + * rs_break() --- routine which turns the break handling on or off
8290 +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
8291 +static void send_break( struct async_struct * info, int duration)
8293 + if (!CONFIGURED_SERIAL_PORT(info))
8295 + current->state = TASK_INTERRUPTIBLE;
8296 + current->timeout = jiffies + duration;
8298 + info->LCR |= UART_LCR_SBC;
8299 + serial_out(info, UART_LCR, info->LCR);
8301 + info->LCR &= ~UART_LCR_SBC;
8302 + serial_out(info, UART_LCR, info->LCR);
8306 +static void rs_break(struct tty_struct *tty, int break_state)
8308 + struct async_struct * info = (struct async_struct *)tty->driver_data;
8309 + unsigned long flags;
8311 + if (serial_paranoia_check(info, tty->device, "rs_break"))
8314 + if (!CONFIGURED_SERIAL_PORT(info))
8316 + save_flags(flags); cli();
8317 + if (break_state == -1)
8318 + info->LCR |= UART_LCR_SBC;
8320 + info->LCR &= ~UART_LCR_SBC;
8321 + serial_out(info, UART_LCR, info->LCR);
8322 + restore_flags(flags);
8326 +#ifdef CONFIG_SERIAL_MULTIPORT
8327 +static int get_multiport_struct(struct async_struct * info,
8328 + struct serial_multiport_struct *retinfo)
8330 + struct serial_multiport_struct ret;
8331 + struct rs_multiport_struct *multi;
8333 + multi = &rs_multiport[info->state->irq];
8335 + ret.port_monitor = multi->port_monitor;
8337 + ret.port1 = multi->port1;
8338 + ret.mask1 = multi->mask1;
8339 + ret.match1 = multi->match1;
8341 + ret.port2 = multi->port2;
8342 + ret.mask2 = multi->mask2;
8343 + ret.match2 = multi->match2;
8345 + ret.port3 = multi->port3;
8346 + ret.mask3 = multi->mask3;
8347 + ret.match3 = multi->match3;
8349 + ret.port4 = multi->port4;
8350 + ret.mask4 = multi->mask4;
8351 + ret.match4 = multi->match4;
8353 + ret.irq = info->state->irq;
8355 + if (copy_to_user(retinfo,&ret,sizeof(*retinfo)))
8360 +static int set_multiport_struct(struct async_struct * info,
8361 + struct serial_multiport_struct *in_multi)
8363 + struct serial_multiport_struct new_multi;
8364 + struct rs_multiport_struct *multi;
8365 + struct serial_state *state;
8366 + int was_multi, now_multi;
8368 + void (*handler)(int, void *, struct pt_regs *);
8370 + if (!capable(CAP_SYS_ADMIN))
8372 + state = info->state;
8374 + if (copy_from_user(&new_multi, in_multi,
8375 + sizeof(struct serial_multiport_struct)))
8378 + if (new_multi.irq != state->irq || state->irq == 0 ||
8379 + !IRQ_ports[state->irq])
8382 + multi = &rs_multiport[state->irq];
8383 + was_multi = (multi->port1 != 0);
8385 + multi->port_monitor = new_multi.port_monitor;
8388 + release_region(multi->port1,1);
8389 + multi->port1 = new_multi.port1;
8390 + multi->mask1 = new_multi.mask1;
8391 + multi->match1 = new_multi.match1;
8393 + request_region(multi->port1,1,"serial(multiport1)");
8396 + release_region(multi->port2,1);
8397 + multi->port2 = new_multi.port2;
8398 + multi->mask2 = new_multi.mask2;
8399 + multi->match2 = new_multi.match2;
8401 + request_region(multi->port2,1,"serial(multiport2)");
8404 + release_region(multi->port3,1);
8405 + multi->port3 = new_multi.port3;
8406 + multi->mask3 = new_multi.mask3;
8407 + multi->match3 = new_multi.match3;
8409 + request_region(multi->port3,1,"serial(multiport3)");
8412 + release_region(multi->port4,1);
8413 + multi->port4 = new_multi.port4;
8414 + multi->mask4 = new_multi.mask4;
8415 + multi->match4 = new_multi.match4;
8417 + request_region(multi->port4,1,"serial(multiport4)");
8419 + now_multi = (multi->port1 != 0);
8421 + if (IRQ_ports[state->irq]->next_port &&
8422 + (was_multi != now_multi)) {
8423 + free_irq(state->irq, &IRQ_ports[state->irq]);
8425 + handler = rs_interrupt_multi;
8427 + handler = rs_interrupt;
8429 + retval = request_irq(state->irq, handler, SA_SHIRQ,
8430 + "serial", &IRQ_ports[state->irq]);
8432 + printk("Couldn't reallocate serial interrupt "
8440 +static int rs_ioctl(struct tty_struct *tty, struct file * file,
8441 + unsigned int cmd, unsigned long arg)
8443 + struct async_struct * info = (struct async_struct *)tty->driver_data;
8444 + struct async_icount cprev, cnow; /* kernel counter temps */
8445 + struct serial_icounter_struct icount;
8446 + unsigned long flags;
8447 +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
8451 + if (serial_paranoia_check(info, tty->device, "rs_ioctl"))
8454 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
8455 + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
8456 + (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
8457 + if (tty->flags & (1 << TTY_IO_ERROR))
8462 +#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
8463 + case TCSBRK: /* SVID version: non-zero arg --> no break */
8464 + retval = tty_check_change(tty);
8467 + tty_wait_until_sent(tty, 0);
8468 + if (signal_pending(current))
8471 + send_break(info, HZ/4); /* 1/4 second */
8472 + if (signal_pending(current))
8476 + case TCSBRKP: /* support for POSIX tcsendbreak() */
8477 + retval = tty_check_change(tty);
8480 + tty_wait_until_sent(tty, 0);
8481 + if (signal_pending(current))
8483 + send_break(info, arg ? arg*(HZ/10) : HZ/4);
8484 + if (signal_pending(current))
8487 + case TIOCGSOFTCAR:
8488 + tmp = C_CLOCAL(tty) ? 1 : 0;
8489 + if (copy_to_user((void *)arg, &tmp, sizeof(int)))
8492 + case TIOCSSOFTCAR:
8493 + if (copy_from_user(&tmp, (void *)arg, sizeof(int)))
8496 + tty->termios->c_cflag =
8497 + ((tty->termios->c_cflag & ~CLOCAL) |
8498 + (tmp ? CLOCAL : 0));
8502 + return get_modem_info(info, (unsigned int *) arg);
8506 + return set_modem_info(info, cmd, (unsigned int *) arg);
8508 + return get_serial_info(info,
8509 + (struct serial_struct *) arg);
8511 + return set_serial_info(info,
8512 + (struct serial_struct *) arg);
8513 + case TIOCSERCONFIG:
8514 + return do_autoconfig(info);
8516 + case TIOCSERGETLSR: /* Get line status register */
8517 + return get_lsr_info(info, (unsigned int *) arg);
8519 + case TIOCSERGSTRUCT:
8520 + if (copy_to_user((struct async_struct *) arg,
8521 + info, sizeof(struct async_struct)))
8525 +#ifdef CONFIG_SERIAL_MULTIPORT
8526 + case TIOCSERGETMULTI:
8527 + return get_multiport_struct(info,
8528 + (struct serial_multiport_struct *) arg);
8529 + case TIOCSERSETMULTI:
8530 + return set_multiport_struct(info,
8531 + (struct serial_multiport_struct *) arg);
8535 + * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
8536 + * - mask passed in arg for lines of interest
8537 + * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
8538 + * Caller should use TIOCGICOUNT to see which one it was
8541 + save_flags(flags); cli();
8542 + /* note the counters on entry */
8543 + cprev = info->state->icount;
8544 + restore_flags(flags);
8545 + /* Force modem status interrupts on */
8546 + info->IER |= UART_IER_MSI;
8547 + serial_out(info, UART_IER, info->IER);
8549 + interruptible_sleep_on(&info->delta_msr_wait);
8550 + /* see if a signal did it */
8551 + if (signal_pending(current))
8552 + return -ERESTARTSYS;
8553 + save_flags(flags); cli();
8554 + cnow = info->state->icount; /* atomic copy */
8555 + restore_flags(flags);
8556 + if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
8557 + cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
8558 + return -EIO; /* no change => error */
8559 + if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
8560 + ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
8561 + ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
8562 + ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)) ) {
8570 + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
8571 + * Return: write counters to the user passed counter struct
8572 + * NB: both 1->0 and 0->1 transitions are counted except for
8573 + * RI where only 0->1 is counted.
8576 + save_flags(flags); cli();
8577 + cnow = info->state->icount;
8578 + restore_flags(flags);
8579 + icount.cts = cnow.cts;
8580 + icount.dsr = cnow.dsr;
8581 + icount.rng = cnow.rng;
8582 + icount.dcd = cnow.dcd;
8583 + icount.rx = cnow.rx;
8584 + icount.tx = cnow.tx;
8585 + icount.frame = cnow.frame;
8586 + icount.overrun = cnow.overrun;
8587 + icount.parity = cnow.parity;
8588 + icount.brk = cnow.brk;
8589 + icount.buf_overrun = cnow.buf_overrun;
8591 + if (copy_to_user((void *)arg, &icount, sizeof(icount)))
8594 + case TIOCSERGWILD:
8595 + case TIOCSERSWILD:
8596 + /* "setserial -W" is called in Debian boot */
8597 + printk ("TIOCSER?WILD ioctl obsolete, ignored.\n");
8601 + return -ENOIOCTLCMD;
8606 +static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
8608 + struct async_struct *info = (struct async_struct *)tty->driver_data;
8609 + unsigned long flags;
8610 + unsigned int cflag = tty->termios->c_cflag;
8612 + if ( (cflag == old_termios->c_cflag)
8613 + && ( RELEVANT_IFLAG(tty->termios->c_iflag)
8614 + == RELEVANT_IFLAG(old_termios->c_iflag)))
8617 + change_speed(info, old_termios);
8619 + /* Handle transition to B0 status */
8620 + if ((old_termios->c_cflag & CBAUD) &&
8621 + !(cflag & CBAUD)) {
8622 + info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
8623 + save_flags(flags); cli();
8624 + serial_out(info, UART_MCR, info->MCR);
8625 + restore_flags(flags);
8628 + /* Handle transition away from B0 status */
8629 + if (!(old_termios->c_cflag & CBAUD) &&
8630 + (cflag & CBAUD)) {
8631 + info->MCR |= UART_MCR_DTR;
8632 + if (!(tty->termios->c_cflag & CRTSCTS) ||
8633 + !test_bit(TTY_THROTTLED, &tty->flags)) {
8634 + info->MCR |= UART_MCR_RTS;
8636 + save_flags(flags); cli();
8637 + serial_out(info, UART_MCR, info->MCR);
8638 + restore_flags(flags);
8641 + /* Handle turning off CRTSCTS */
8642 + if ((old_termios->c_cflag & CRTSCTS) &&
8643 + !(tty->termios->c_cflag & CRTSCTS)) {
8644 + tty->hw_stopped = 0;
8650 + * No need to wake up processes in open wait, since they
8651 + * sample the CLOCAL flag once, and don't recheck it.
8652 + * XXX It's not clear whether the current behavior is correct
8653 + * or not. Hence, this may change.....
8655 + if (!(old_termios->c_cflag & CLOCAL) &&
8656 + (tty->termios->c_cflag & CLOCAL))
8657 + wake_up_interruptible(&info->open_wait);
8662 + * ------------------------------------------------------------
8665 + * This routine is called when the serial port gets closed. First, we
8666 + * wait for the last remaining data to be sent. Then, we unlink its
8667 + * async structure from the interrupt chain if necessary, and we free
8668 + * that IRQ if nothing is left in the chain.
8669 + * ------------------------------------------------------------
8671 +static void rs_close(struct tty_struct *tty, struct file * filp)
8673 + struct async_struct * info = (struct async_struct *)tty->driver_data;
8674 + struct serial_state *state;
8675 + unsigned long flags;
8677 + if (!info || serial_paranoia_check(info, tty->device, "rs_close"))
8680 + state = info->state;
8682 + save_flags(flags); cli();
8684 + if (tty_hung_up_p(filp)) {
8685 + DBG_CNT("before DEC-hung");
8686 + MOD_DEC_USE_COUNT;
8687 + restore_flags(flags);
8691 +#ifdef SERIAL_DEBUG_OPEN
8692 + printk("rs_close ttys%d, count = %d\n", info->line, state->count);
8694 + if ((tty->count == 1) && (state->count != 1)) {
8696 + * Uh, oh. tty->count is 1, which means that the tty
8697 + * structure will be freed. state->count should always
8698 + * be one in these conditions. If it's greater than
8699 + * one, we've got real problems, since it means the
8700 + * serial port won't be shutdown.
8702 + printk("rs_close: bad serial port count; tty->count is 1, "
8703 + "state->count is %d\n", state->count);
8706 + if (--state->count < 0) {
8707 + printk("rs_close: bad serial port count for ttys%d: %d\n",
8708 + info->line, state->count);
8711 + if (state->count) {
8712 + DBG_CNT("before DEC-2");
8713 + MOD_DEC_USE_COUNT;
8714 + restore_flags(flags);
8717 + info->flags |= ASYNC_CLOSING;
8718 + restore_flags(flags);
8720 + * Save the termios structure, since this port may have
8721 + * separate termios for callout and dialin.
8723 + if (info->flags & ASYNC_NORMAL_ACTIVE)
8724 + info->state->normal_termios = *tty->termios;
8725 + if (info->flags & ASYNC_CALLOUT_ACTIVE)
8726 + info->state->callout_termios = *tty->termios;
8728 + * Now we wait for the transmit buffer to clear; and we notify
8729 + * the line discipline to only process XON/XOFF characters.
8732 + if (state->closing_wait != ASYNC_CLOSING_WAIT_NONE)
8733 + tty_wait_until_sent(tty, state->closing_wait);
8735 + * At this point we stop accepting input. To do this, we
8736 + * disable the receive line status interrupts, and tell the
8737 + * interrupt driver to stop checking the data ready bit in the
8738 + * line status register.
8740 + info->IER &= ~UART_IER_RLSI;
8741 + info->read_status_mask &= ~UART_LSR_DR;
8742 + if (info->flags & ASYNC_INITIALIZED) {
8743 + serial_out(info, UART_IER, info->IER);
8745 + * Before we drop DTR, make sure the UART transmitter
8746 + * has completely drained; this is especially
8747 + * important if there is a transmit FIFO!
8749 + rs_wait_until_sent(tty, info->timeout);
8752 + if (tty->driver.flush_buffer)
8753 + tty->driver.flush_buffer(tty);
8754 + tty_ldisc_flush(tty);
8758 + if (info->blocked_open) {
8759 + if (state->close_delay) {
8760 + set_current_state(TASK_INTERRUPTIBLE);
8761 + schedule_timeout(state->close_delay);
8763 + wake_up_interruptible(&info->open_wait);
8765 + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE|
8767 + wake_up_interruptible(&info->close_wait);
8768 + MOD_DEC_USE_COUNT;
8772 + * rs_wait_until_sent() --- wait until the transmitter is empty
8774 +static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
8776 + struct async_struct * info = (struct async_struct *)tty->driver_data;
8777 + unsigned long orig_jiffies, char_time;
8780 + if (serial_paranoia_check(info, tty->device, "rs_wait_until_sent"))
8783 + if (info->state->type == PORT_UNKNOWN)
8786 + if (info->xmit_fifo_size == 0)
8787 + return; /* Just in case.... */
8789 + orig_jiffies = jiffies;
8791 + * Set the check interval to be 1/5 of the estimated time to
8792 + * send a single character, and make it at least 1. The check
8793 + * interval should also be less than the timeout.
8795 + * Note: we have to use pretty tight timings here to satisfy
8798 + char_time = (info->timeout - HZ/50) / info->xmit_fifo_size;
8799 + char_time = char_time / 5;
8800 + if (char_time == 0)
8802 + if (timeout && timeout < char_time)
8803 + char_time = timeout;
8805 + * If the transmitter hasn't cleared in twice the approximate
8806 + * amount of time to send the entire FIFO, it probably won't
8807 + * ever clear. This assumes the UART isn't doing flow
8808 + * control, which is currently the case. Hence, if it ever
8809 + * takes longer than info->timeout, this is probably due to a
8810 + * UART bug of some kind. So, we clamp the timeout parameter at
8811 + * 2*info->timeout.
8813 + if (!timeout || timeout > 2*info->timeout)
8814 + timeout = 2*info->timeout;
8815 +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
8816 + printk("In rs_wait_until_sent(%d) check=%lu...", timeout, char_time);
8817 + printk("jiff=%lu...", jiffies);
8819 + while (!((lsr = serial_inp(info, UART_LSR)) & UART_LSR_TEMT)) {
8820 +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
8821 + printk("lsr = %d (jiff=%lu)...", lsr, jiffies);
8823 + set_current_state(TASK_INTERRUPTIBLE);
8824 + schedule_timeout(char_time);
8825 + if (signal_pending(current))
8827 + if (timeout && time_after(jiffies, orig_jiffies + timeout))
8830 +#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
8831 + printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies);
8836 + * rs_hangup() --- called by tty_hangup() when a hangup is signaled.
8838 +static void rs_hangup(struct tty_struct *tty)
8840 + struct async_struct * info = (struct async_struct *)tty->driver_data;
8841 + struct serial_state *state = info->state;
8843 + if (serial_paranoia_check(info, tty->device, "rs_hangup"))
8846 + state = info->state;
8848 + rs_flush_buffer(tty);
8849 + if (info->flags & ASYNC_CLOSING)
8854 + info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE);
8856 + wake_up_interruptible(&info->open_wait);
8860 + * ------------------------------------------------------------
8861 + * rs_open() and friends
8862 + * ------------------------------------------------------------
8864 +static int block_til_ready(struct tty_struct *tty, struct file * filp,
8865 + struct async_struct *info)
8867 + DECLARE_WAITQUEUE(wait, current);
8868 + struct serial_state *state = info->state;
8870 + int do_clocal = 0, extra_count = 0;
8871 + unsigned long flags;
8874 + * If the device is in the middle of being closed, then block
8875 + * until it's done, and then try again.
8877 + if (tty_hung_up_p(filp) ||
8878 + (info->flags & ASYNC_CLOSING)) {
8879 + if (info->flags & ASYNC_CLOSING)
8880 + interruptible_sleep_on(&info->close_wait);
8881 +#ifdef SERIAL_DO_RESTART
8882 + return ((info->flags & ASYNC_HUP_NOTIFY) ?
8883 + -EAGAIN : -ERESTARTSYS);
8890 + * If this is a callout device, then just make sure the normal
8891 + * device isn't being used.
8893 + if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) {
8894 + if (info->flags & ASYNC_NORMAL_ACTIVE)
8896 + if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
8897 + (info->flags & ASYNC_SESSION_LOCKOUT) &&
8898 + (info->session != current->session))
8900 + if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
8901 + (info->flags & ASYNC_PGRP_LOCKOUT) &&
8902 + (info->pgrp != current->pgrp))
8904 + info->flags |= ASYNC_CALLOUT_ACTIVE;
8909 + * If non-blocking mode is set, or the port is not enabled,
8910 + * then make the check up front and then exit.
8912 + if ((filp->f_flags & O_NONBLOCK) ||
8913 + (tty->flags & (1 << TTY_IO_ERROR))) {
8914 + if (info->flags & ASYNC_CALLOUT_ACTIVE)
8916 + info->flags |= ASYNC_NORMAL_ACTIVE;
8920 + if (info->flags & ASYNC_CALLOUT_ACTIVE) {
8921 + if (state->normal_termios.c_cflag & CLOCAL)
8924 + if (tty->termios->c_cflag & CLOCAL)
8929 + * Block waiting for the carrier detect and the line to become
8930 + * free (i.e., not in use by the callout). While we are in
8931 + * this loop, state->count is dropped by one, so that
8932 + * rs_close() knows when to free things. We restore it upon
8933 + * exit, either normal or abnormal.
8936 + add_wait_queue(&info->open_wait, &wait);
8937 +#ifdef SERIAL_DEBUG_OPEN
8938 + printk("block_til_ready before block: ttys%d, count = %d\n",
8939 + state->line, state->count);
8941 + save_flags(flags); cli();
8942 + if (!tty_hung_up_p(filp)) {
8946 + restore_flags(flags);
8947 + info->blocked_open++;
8949 + save_flags(flags); cli();
8950 + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
8951 + (tty->termios->c_cflag & CBAUD))
8952 + serial_out(info, UART_MCR,
8953 + serial_inp(info, UART_MCR) |
8954 + (UART_MCR_DTR | UART_MCR_RTS));
8955 + restore_flags(flags);
8956 + set_current_state(TASK_INTERRUPTIBLE);
8957 + if (tty_hung_up_p(filp) ||
8958 + !(info->flags & ASYNC_INITIALIZED)) {
8959 +#ifdef SERIAL_DO_RESTART
8960 + if (info->flags & ASYNC_HUP_NOTIFY)
8963 + retval = -ERESTARTSYS;
8969 + if (!(info->flags & ASYNC_CALLOUT_ACTIVE) &&
8970 + !(info->flags & ASYNC_CLOSING) &&
8971 + (do_clocal || (serial_in(info, UART_MSR) &
8974 + if (signal_pending(current)) {
8975 + retval = -ERESTARTSYS;
8978 +#ifdef SERIAL_DEBUG_OPEN
8979 + printk("block_til_ready blocking: ttys%d, count = %d\n",
8980 + info->line, state->count);
8984 + set_current_state(TASK_RUNNING);
8985 + remove_wait_queue(&info->open_wait, &wait);
8988 + info->blocked_open--;
8989 +#ifdef SERIAL_DEBUG_OPEN
8990 + printk("block_til_ready after blocking: ttys%d, count = %d\n",
8991 + info->line, state->count);
8995 + info->flags |= ASYNC_NORMAL_ACTIVE;
8999 +static int get_async_struct(int line, struct async_struct **ret_info)
9001 + struct async_struct *info;
9002 + struct serial_state *sstate;
9004 + sstate = rs_table + line;
9006 + if (sstate->info) {
9007 + *ret_info = sstate->info;
9010 + info = kmalloc(sizeof(struct async_struct), GFP_KERNEL);
9015 + memset(info, 0, sizeof(struct async_struct));
9016 + init_waitqueue_head(&info->open_wait);
9017 + init_waitqueue_head(&info->close_wait);
9018 + init_waitqueue_head(&info->delta_msr_wait);
9019 + info->magic = SERIAL_MAGIC;
9020 + info->port = sstate->port;
9021 + info->flags = sstate->flags;
9022 + info->io_type = sstate->io_type;
9023 + info->iomem_base = sstate->iomem_base;
9024 + info->iomem_reg_shift = sstate->iomem_reg_shift;
9025 + info->xmit_fifo_size = sstate->xmit_fifo_size;
9026 + info->line = line;
9027 + info->tqueue.routine = do_softint;
9028 + info->tqueue.data = info;
9029 + info->state = sstate;
9030 + if (sstate->info) {
9032 + *ret_info = sstate->info;
9035 + *ret_info = sstate->info = info;
9040 + * This routine is called whenever a serial port is opened. It
9041 + * enables interrupts for a serial port, linking in its async structure into
9042 + * the IRQ chain. It also performs the serial-specific
9043 + * initialization for the tty structure.
9045 + * Note that on failure, we don't decrement the module use count - the tty
9046 + * later will call rs_close, which will decrement it for us as long as
9047 + * tty->driver_data is set non-NULL. --rmk
9049 +static int rs_open(struct tty_struct *tty, struct file * filp)
9051 + struct async_struct *info;
9053 + unsigned long page;
9055 + MOD_INC_USE_COUNT;
9056 + line = MINOR(tty->device) - tty->driver.minor_start;
9057 + if ((line < 0) || (line >= NR_PORTS)) {
9058 + MOD_DEC_USE_COUNT;
9061 + retval = get_async_struct(line, &info);
9063 + MOD_DEC_USE_COUNT;
9066 + tty->driver_data = info;
9068 + if (serial_paranoia_check(info, tty->device, "rs_open"))
9071 +#ifdef SERIAL_DEBUG_OPEN
9072 + printk("rs_open %s%d, count = %d\n", tty->driver.name, info->line,
9073 + info->state->count);
9075 +#if (LINUX_VERSION_CODE > 0x20100)
9076 + info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
9080 + * This relies on lock_kernel() stuff so wants tidying for 2.5
9083 + page = get_zeroed_page(GFP_KERNEL);
9089 + tmp_buf = (unsigned char *) page;
9093 + * If the port is the middle of closing, bail out now
9095 + if (tty_hung_up_p(filp) ||
9096 + (info->flags & ASYNC_CLOSING)) {
9097 + if (info->flags & ASYNC_CLOSING)
9098 + interruptible_sleep_on(&info->close_wait);
9099 +#ifdef SERIAL_DO_RESTART
9100 + return ((info->flags & ASYNC_HUP_NOTIFY) ?
9101 + -EAGAIN : -ERESTARTSYS);
9108 + * Start up serial port
9110 + retval = startup(info);
9114 + retval = block_til_ready(tty, filp, info);
9116 +#ifdef SERIAL_DEBUG_OPEN
9117 + printk("rs_open returning after block_til_ready with %d\n",
9123 + if ((info->state->count == 1) &&
9124 + (info->flags & ASYNC_SPLIT_TERMIOS)) {
9125 + if (tty->driver.subtype == SERIAL_TYPE_NORMAL)
9126 + *tty->termios = info->state->normal_termios;
9128 + *tty->termios = info->state->callout_termios;
9129 + change_speed(info, 0);
9131 +#ifdef CONFIG_SERIAL_CONSOLE
9132 + if (sercons.cflag && sercons.index == line) {
9133 + tty->termios->c_cflag = sercons.cflag;
9134 + sercons.cflag = 0;
9135 + change_speed(info, 0);
9138 + info->session = current->session;
9139 + info->pgrp = current->pgrp;
9141 +#ifdef SERIAL_DEBUG_OPEN
9142 + printk("rs_open ttys%d successful...", info->line);
9148 + * /proc fs routines....
9151 +static inline int line_info(char *buf, struct serial_state *state)
9153 + struct async_struct *info = state->info, scr_info;
9154 + char stat_buf[30], control, status;
9156 + unsigned long flags;
9159 + * Return zero characters for ports not claimed by driver.
9161 + if (state->type == PORT_UNKNOWN) {
9162 + return 0; /* ignore unused ports */
9165 + ret = sprintf(buf, "%d: uart:%s port:%lX irq:%d",
9166 + state->line, uart_config[state->type].name,
9167 + (state->port ? state->port : (long)state->iomem_base),
9171 + * Figure out the current RS-232 lines
9174 + info = &scr_info; /* This is just for serial_{in,out} */
9176 + info->magic = SERIAL_MAGIC;
9177 + info->port = state->port;
9178 + info->flags = state->flags;
9179 + info->hub6 = state->hub6;
9180 + info->io_type = state->io_type;
9181 + info->iomem_base = state->iomem_base;
9182 + info->iomem_reg_shift = state->iomem_reg_shift;
9186 + save_flags(flags); cli();
9187 + status = serial_in(info, UART_MSR);
9188 + control = info != &scr_info ? info->MCR : serial_in(info, UART_MCR);
9189 + restore_flags(flags);
9193 + if (control & UART_MCR_RTS)
9194 + strcat(stat_buf, "|RTS");
9195 + if (status & UART_MSR_CTS)
9196 + strcat(stat_buf, "|CTS");
9197 + if (control & UART_MCR_DTR)
9198 + strcat(stat_buf, "|DTR");
9199 + if (status & UART_MSR_DSR)
9200 + strcat(stat_buf, "|DSR");
9201 + if (status & UART_MSR_DCD)
9202 + strcat(stat_buf, "|CD");
9203 + if (status & UART_MSR_RI)
9204 + strcat(stat_buf, "|RI");
9207 + ret += sprintf(buf+ret, " baud:%d",
9208 + state->baud_base / info->quot);
9211 + ret += sprintf(buf+ret, " tx:%d rx:%d",
9212 + state->icount.tx, state->icount.rx);
9214 + if (state->icount.frame)
9215 + ret += sprintf(buf+ret, " fe:%d", state->icount.frame);
9217 + if (state->icount.parity)
9218 + ret += sprintf(buf+ret, " pe:%d", state->icount.parity);
9220 + if (state->icount.brk)
9221 + ret += sprintf(buf+ret, " brk:%d", state->icount.brk);
9223 + if (state->icount.overrun)
9224 + ret += sprintf(buf+ret, " oe:%d", state->icount.overrun);
9227 + * Last thing is the RS-232 status lines
9229 + ret += sprintf(buf+ret, " %s\n", stat_buf+1);
9233 +static int rs_read_proc(char *page, char **start, off_t off, int count,
9234 + int *eof, void *data)
9236 + int i, len = 0, l;
9239 + len += sprintf(page, "serinfo:1.0 driver:%s%s revision:%s\n",
9240 + serial_version, LOCAL_VERSTRING, serial_revdate);
9241 + for (i = 0; i < NR_PORTS && len < 4000; i++) {
9242 + l = line_info(page + len, &rs_table[i]);
9244 + if (len+begin > off+count)
9246 + if (len+begin < off) {
9253 + if (off >= len+begin)
9255 + *start = page + (off-begin);
9256 + return ((count < begin+len-off) ? count : begin+len-off);
9260 + * ---------------------------------------------------------------------
9261 + * rs_init() and friends
9263 + * rs_init() is called at boot-time to initialize the serial driver.
9264 + * ---------------------------------------------------------------------
9268 + * This routine prints out the appropriate serial driver version
9269 + * number, and identifies which options were configured into this
9272 +static char serial_options[] __initdata =
9277 +#ifdef CONFIG_SERIAL_MANY_PORTS
9281 +#ifdef CONFIG_SERIAL_MULTIPORT
9285 +#ifdef CONFIG_SERIAL_SHARE_IRQ
9289 +#ifdef CONFIG_SERIAL_DETECT_IRQ
9293 +#ifdef ENABLE_SERIAL_PCI
9297 +#ifdef ENABLE_SERIAL_PNP
9301 +#ifdef ENABLE_SERIAL_ACPI
9308 + " no serial options enabled\n";
9312 +static _INLINE_ void show_serial_version(void)
9314 + printk(KERN_INFO "%s version %s%s (%s) with%s", serial_name,
9315 + serial_version, LOCAL_VERSTRING, serial_revdate,
9320 + * This routine detect the IRQ of a serial port by clearing OUT2 when
9321 + * no UART interrupt are requested (IER = 0) (*GPL*). This seems to work at
9322 + * each time, as long as no other device permanently request the IRQ.
9323 + * If no IRQ is detected, or multiple IRQ appear, this function returns 0.
9324 + * The variable "state" and the field "state->port" should not be null.
9326 +static unsigned detect_uart_irq (struct serial_state * state)
9329 + unsigned long irqs;
9330 + unsigned char save_mcr, save_ier;
9331 + struct async_struct scr_info; /* serial_{in,out} because HUB6 */
9333 +#ifdef CONFIG_SERIAL_MANY_PORTS
9334 + unsigned char save_ICP=0; /* no warning */
9335 + unsigned short ICP=0;
9337 + if (state->flags & ASYNC_FOURPORT) {
9338 + ICP = (state->port & 0xFE0) | 0x01F;
9339 + save_ICP = inb_p(ICP);
9340 + outb_p(0x80, ICP);
9341 + (void) inb_p(ICP);
9344 + scr_info.magic = SERIAL_MAGIC;
9345 + scr_info.state = state;
9346 + scr_info.port = state->port;
9347 + scr_info.flags = state->flags;
9349 + scr_info.hub6 = state->hub6;
9351 + scr_info.io_type = state->io_type;
9352 + scr_info.iomem_base = state->iomem_base;
9353 + scr_info.iomem_reg_shift = state->iomem_reg_shift;
9355 + /* forget possible initially masked and pending IRQ */
9356 + probe_irq_off(probe_irq_on());
9357 + save_mcr = serial_inp(&scr_info, UART_MCR);
9358 + save_ier = serial_inp(&scr_info, UART_IER);
9359 + serial_outp(&scr_info, UART_MCR, UART_MCR_OUT1 | UART_MCR_OUT2);
9361 + irqs = probe_irq_on();
9362 + serial_outp(&scr_info, UART_MCR, 0);
9364 + if (state->flags & ASYNC_FOURPORT) {
9365 + serial_outp(&scr_info, UART_MCR,
9366 + UART_MCR_DTR | UART_MCR_RTS);
9368 + serial_outp(&scr_info, UART_MCR,
9369 + UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2);
9371 + serial_outp(&scr_info, UART_IER, 0x0f); /* enable all intrs */
9372 + (void)serial_inp(&scr_info, UART_LSR);
9373 + (void)serial_inp(&scr_info, UART_RX);
9374 + (void)serial_inp(&scr_info, UART_IIR);
9375 + (void)serial_inp(&scr_info, UART_MSR);
9376 + serial_outp(&scr_info, UART_TX, 0xFF);
9378 + irq = probe_irq_off(irqs);
9380 + serial_outp(&scr_info, UART_MCR, save_mcr);
9381 + serial_outp(&scr_info, UART_IER, save_ier);
9382 +#ifdef CONFIG_SERIAL_MANY_PORTS
9383 + if (state->flags & ASYNC_FOURPORT)
9384 + outb_p(save_ICP, ICP);
9386 + return (irq > 0)? irq : 0;
9390 + * This is a quickie test to see how big the FIFO is.
9391 + * It doesn't work at all the time, more's the pity.
9393 +static int size_fifo(struct async_struct *info)
9395 + unsigned char old_fcr, old_mcr, old_dll, old_dlm;
9398 + old_fcr = serial_inp(info, UART_FCR);
9399 + old_mcr = serial_inp(info, UART_MCR);
9400 + serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO |
9401 + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
9402 + serial_outp(info, UART_MCR, UART_MCR_LOOP);
9403 + serial_outp(info, UART_LCR, UART_LCR_DLAB);
9404 + old_dll = serial_inp(info, UART_DLL);
9405 + old_dlm = serial_inp(info, UART_DLM);
9406 + serial_outp(info, UART_DLL, 0x01);
9407 + serial_outp(info, UART_DLM, 0x00);
9408 + serial_outp(info, UART_LCR, 0x03);
9409 + for (count = 0; count < 256; count++)
9410 + serial_outp(info, UART_TX, count);
9412 + for (count = 0; (serial_inp(info, UART_LSR) & UART_LSR_DR) &&
9413 + (count < 256); count++)
9414 + serial_inp(info, UART_RX);
9415 + serial_outp(info, UART_FCR, old_fcr);
9416 + serial_outp(info, UART_MCR, old_mcr);
9417 + serial_outp(info, UART_LCR, UART_LCR_DLAB);
9418 + serial_outp(info, UART_DLL, old_dll);
9419 + serial_outp(info, UART_DLM, old_dlm);
9425 + * This is a helper routine to autodetect StarTech/Exar/Oxsemi UART's.
9426 + * When this function is called we know it is at least a StarTech
9427 + * 16650 V2, but it might be one of several StarTech UARTs, or one of
9428 + * its clones. (We treat the broken original StarTech 16650 V1 as a
9429 + * 16550, and why not? Startech doesn't seem to even acknowledge its
9432 + * What evil have men's minds wrought...
9434 +static void autoconfig_startech_uarts(struct async_struct *info,
9435 + struct serial_state *state,
9436 + unsigned long flags)
9438 + unsigned char scratch, scratch2, scratch3, scratch4;
9441 + * First we check to see if it's an Oxford Semiconductor UART.
9443 + * If we have to do this here because some non-National
9444 + * Semiconductor clone chips lock up if you try writing to the
9445 + * LSR register (which serial_icr_read does)
9447 + if (state->type == PORT_16550A) {
9449 + * EFR [4] must be set else this test fails
9451 + * This shouldn't be necessary, but Mike Hudson
9452 + * (Exoray@isys.ca) claims that it's needed for 952
9453 + * dual UART's (which are not recommended for new designs).
9456 + serial_out(info, UART_LCR, 0xBF);
9457 + serial_out(info, UART_EFR, 0x10);
9458 + serial_out(info, UART_LCR, 0x00);
9459 + /* Check for Oxford Semiconductor 16C950 */
9460 + scratch = serial_icr_read(info, UART_ID1);
9461 + scratch2 = serial_icr_read(info, UART_ID2);
9462 + scratch3 = serial_icr_read(info, UART_ID3);
9464 + if (scratch == 0x16 && scratch2 == 0xC9 &&
9465 + (scratch3 == 0x50 || scratch3 == 0x52 ||
9466 + scratch3 == 0x54)) {
9467 + state->type = PORT_16C950;
9468 + state->revision = serial_icr_read(info, UART_REV) |
9475 + * We check for a XR16C850 by setting DLL and DLM to 0, and
9476 + * then reading back DLL and DLM. If DLM reads back 0x10,
9477 + * then the UART is a XR16C850 and the DLL contains the chip
9478 + * revision. If DLM reads back 0x14, then the UART is a
9483 + /* Save the DLL and DLM */
9485 + serial_outp(info, UART_LCR, UART_LCR_DLAB);
9486 + scratch3 = serial_inp(info, UART_DLL);
9487 + scratch4 = serial_inp(info, UART_DLM);
9489 + serial_outp(info, UART_DLL, 0);
9490 + serial_outp(info, UART_DLM, 0);
9491 + scratch2 = serial_inp(info, UART_DLL);
9492 + scratch = serial_inp(info, UART_DLM);
9493 + serial_outp(info, UART_LCR, 0);
9495 + if (scratch == 0x10 || scratch == 0x14) {
9496 + if (scratch == 0x10)
9497 + state->revision = scratch2;
9498 + state->type = PORT_16850;
9502 + /* Restore the DLL and DLM */
9504 + serial_outp(info, UART_LCR, UART_LCR_DLAB);
9505 + serial_outp(info, UART_DLL, scratch3);
9506 + serial_outp(info, UART_DLM, scratch4);
9507 + serial_outp(info, UART_LCR, 0);
9509 + * We distinguish between the '654 and the '650 by counting
9510 + * how many bytes are in the FIFO. I'm using this for now,
9511 + * since that's the technique that was sent to me in the
9512 + * serial driver update, but I'm not convinced this works.
9513 + * I've had problems doing this in the past. -TYT
9515 + if (size_fifo(info) == 64)
9516 + state->type = PORT_16654;
9518 + state->type = PORT_16650V2;
9522 + * This routine is called by rs_init() to initialize a specific serial
9523 + * port. It determines what type of UART chip this serial port is
9524 + * using: 8250, 16450, 16550, 16550A. The important question is
9525 + * whether or not this UART is a 16550A or not, since this will
9526 + * determine whether or not we can use its FIFO features or not.
9528 +static void autoconfig(struct serial_state * state)
9530 + unsigned char status1, status2, scratch, scratch2, scratch3;
9531 + unsigned char save_lcr, save_mcr;
9532 + struct async_struct *info, scr_info;
9533 + unsigned long flags;
9535 + state->type = PORT_UNKNOWN;
9537 +#ifdef SERIAL_DEBUG_AUTOCONF
9538 + printk("Testing ttyS%d (0x%04lx, 0x%04x)...\n", state->line,
9539 + state->port, (unsigned) state->iomem_base);
9542 + if (!CONFIGURED_SERIAL_PORT(state))
9545 + info = &scr_info; /* This is just for serial_{in,out} */
9547 + info->magic = SERIAL_MAGIC;
9548 + info->state = state;
9549 + info->port = state->port;
9550 + info->flags = state->flags;
9552 + info->hub6 = state->hub6;
9554 + info->io_type = state->io_type;
9555 + info->iomem_base = state->iomem_base;
9556 + info->iomem_reg_shift = state->iomem_reg_shift;
9558 + save_flags(flags); cli();
9560 + if (!(state->flags & ASYNC_BUGGY_UART) &&
9561 + !state->iomem_base) {
9563 + * Do a simple existence test first; if we fail this,
9564 + * there's no point trying anything else.
9566 + * 0x80 is used as a nonsense port to prevent against
9567 + * false positives due to ISA bus float. The
9568 + * assumption is that 0x80 is a non-existent port;
9569 + * which should be safe since include/asm/io.h also
9570 + * makes this assumption.
9572 + scratch = serial_inp(info, UART_IER);
9573 + serial_outp(info, UART_IER, 0);
9575 + outb(0xff, 0x080);
9577 + scratch2 = serial_inp(info, UART_IER);
9578 + serial_outp(info, UART_IER, 0x0F);
9582 + scratch3 = serial_inp(info, UART_IER);
9583 + serial_outp(info, UART_IER, scratch);
9584 + if (scratch2 || scratch3 != 0x0F) {
9585 +#ifdef SERIAL_DEBUG_AUTOCONF
9586 + printk("serial: ttyS%d: simple autoconfig failed "
9587 + "(%02x, %02x)\n", state->line,
9588 + scratch2, scratch3);
9590 + restore_flags(flags);
9591 + return; /* We failed; there's nothing here */
9595 + save_mcr = serial_in(info, UART_MCR);
9596 + save_lcr = serial_in(info, UART_LCR);
9599 + * Check to see if a UART is really there. Certain broken
9600 + * internal modems based on the Rockwell chipset fail this
9601 + * test, because they apparently don't implement the loopback
9602 + * test mode. So this test is skipped on the COM 1 through
9603 + * COM 4 ports. This *should* be safe, since no board
9604 + * manufacturer would be stupid enough to design a board
9605 + * that conflicts with COM 1-4 --- we hope!
9607 + if (!(state->flags & ASYNC_SKIP_TEST)) {
9608 + serial_outp(info, UART_MCR, UART_MCR_LOOP | 0x0A);
9609 + status1 = serial_inp(info, UART_MSR) & 0xF0;
9610 + serial_outp(info, UART_MCR, save_mcr);
9611 + if (status1 != 0x90) {
9612 +#ifdef SERIAL_DEBUG_AUTOCONF
9613 + printk("serial: ttyS%d: no UART loopback failed\n",
9616 + restore_flags(flags);
9620 + serial_outp(info, UART_LCR, 0xBF); /* set up for StarTech test */
9621 + serial_outp(info, UART_EFR, 0); /* EFR is the same as FCR */
9622 + serial_outp(info, UART_LCR, 0);
9623 + serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO);
9624 + scratch = serial_in(info, UART_IIR) >> 6;
9625 + switch (scratch) {
9627 + state->type = PORT_16450;
9630 + state->type = PORT_UNKNOWN;
9633 + state->type = PORT_16550;
9636 + state->type = PORT_16550A;
9639 + if (state->type == PORT_16550A) {
9640 + /* Check for Startech UART's */
9641 + serial_outp(info, UART_LCR, UART_LCR_DLAB);
9642 + if (serial_in(info, UART_EFR) == 0) {
9643 + serial_outp(info, UART_EFR, 0xA8);
9644 + if (serial_in(info, UART_EFR) == 0) {
9645 + /* We are a NS16552D/Motorola
9646 + * 8xxx DUART, stop. */
9649 + state->type = PORT_16650;
9650 + serial_outp(info, UART_EFR, 0);
9652 + serial_outp(info, UART_LCR, 0xBF);
9653 + if (serial_in(info, UART_EFR) == 0)
9654 + autoconfig_startech_uarts(info, state, flags);
9657 + if (state->type == PORT_16550A) {
9658 + /* Check for TI 16750 */
9659 + serial_outp(info, UART_LCR, save_lcr | UART_LCR_DLAB);
9660 + serial_outp(info, UART_FCR,
9661 + UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE);
9662 + scratch = serial_in(info, UART_IIR) >> 5;
9663 + if (scratch == 7) {
9665 + * If this is a 16750, and not a cheap UART
9666 + * clone, then it should only go into 64 byte
9667 + * mode if the UART_FCR7_64BYTE bit was set
9668 + * while UART_LCR_DLAB was latched.
9670 + serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO);
9671 + serial_outp(info, UART_LCR, 0);
9672 + serial_outp(info, UART_FCR,
9673 + UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE);
9674 + scratch = serial_in(info, UART_IIR) >> 5;
9676 + state->type = PORT_16750;
9678 + serial_outp(info, UART_FCR, UART_FCR_ENABLE_FIFO);
9680 +#if defined(CONFIG_SERIAL_RSA) && defined(MODULE)
9681 + if (state->type == PORT_16550A) {
9684 + for (i = 0 ; i < PORT_RSA_MAX ; ++i) {
9685 + if (!probe_rsa[i] && !force_rsa[i])
9687 + if (((probe_rsa[i] != state->port) ||
9688 + check_region(state->port + UART_RSA_BASE, 16)) &&
9689 + (force_rsa[i] != state->port))
9691 + if (!enable_rsa(info))
9693 + state->type = PORT_RSA;
9694 + state->baud_base = SERIAL_RSA_BAUD_BASE;
9700 + serial_outp(info, UART_LCR, save_lcr);
9701 + if (state->type == PORT_16450) {
9702 + scratch = serial_in(info, UART_SCR);
9703 + serial_outp(info, UART_SCR, 0xa5);
9704 + status1 = serial_in(info, UART_SCR);
9705 + serial_outp(info, UART_SCR, 0x5a);
9706 + status2 = serial_in(info, UART_SCR);
9707 + serial_outp(info, UART_SCR, scratch);
9709 + if ((status1 != 0xa5) || (status2 != 0x5a))
9710 + state->type = PORT_8250;
9712 + state->xmit_fifo_size = uart_config[state->type].dfl_xmit_fifo_size;
9714 + if (state->type == PORT_UNKNOWN) {
9715 + restore_flags(flags);
9720 +#ifdef CONFIG_SERIAL_RSA
9721 + if (state->type == PORT_RSA)
9722 + request_region(info->port + UART_RSA_BASE, 16,
9723 + "serial_rsa(auto)");
9726 + request_region(info->port,8,"serial(auto)");
9732 +#ifdef CONFIG_SERIAL_RSA
9733 + if (state->type == PORT_RSA)
9734 + serial_outp(info, UART_RSA_FRR, 0);
9736 + serial_outp(info, UART_MCR, save_mcr);
9737 + serial_outp(info, UART_FCR, (UART_FCR_ENABLE_FIFO |
9738 + UART_FCR_CLEAR_RCVR |
9739 + UART_FCR_CLEAR_XMIT));
9740 + serial_outp(info, UART_FCR, 0);
9741 + (void)serial_in(info, UART_RX);
9742 + serial_outp(info, UART_IER, 0);
9744 + restore_flags(flags);
9747 +int register_serial(struct serial_struct *req);
9748 +void unregister_serial(int line);
9750 +#if (LINUX_VERSION_CODE > 0x20100)
9751 +EXPORT_SYMBOL(register_serial);
9752 +EXPORT_SYMBOL(unregister_serial);
9754 +static struct symbol_table serial_syms = {
9755 +#include <linux/symtab_begin.h>
9756 + X(register_serial),
9757 + X(unregister_serial),
9758 +#include <linux/symtab_end.h>
9763 +#if defined(ENABLE_SERIAL_PCI) || defined(ENABLE_SERIAL_PNP)
9765 +static void __devinit printk_pnp_dev_id(unsigned short vendor,
9766 + unsigned short device)
9768 + printk("%c%c%c%x%x%x%x",
9769 + 'A' + ((vendor >> 2) & 0x3f) - 1,
9770 + 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
9771 + 'A' + ((vendor >> 8) & 0x1f) - 1,
9772 + (device >> 4) & 0x0f,
9774 + (device >> 12) & 0x0f,
9775 + (device >> 8) & 0x0f);
9778 +static _INLINE_ int get_pci_port(struct pci_dev *dev,
9779 + struct pci_board *board,
9780 + struct serial_struct *req,
9783 + unsigned long port;
9788 + base_idx = SPCI_FL_GET_BASE(board->flags);
9789 + if (board->flags & SPCI_FL_BASE_TABLE)
9792 + if (board->flags & SPCI_FL_REGION_SZ_CAP) {
9793 + max_port = pci_resource_len(dev, base_idx) / 8;
9794 + if (idx >= max_port)
9798 + offset = board->first_uart_offset;
9800 + /* Timedia/SUNIX uses a mixture of BARs and offsets */
9801 + /* Ugh, this is ugly as all hell --- TYT */
9802 + if(dev->vendor == PCI_VENDOR_ID_TIMEDIA ) /* 0x1409 */
9804 + case 0: base_idx=0;
9806 + case 1: base_idx=0; offset=8;
9808 + case 2: base_idx=1;
9810 + case 3: base_idx=1; offset=8;
9812 + case 4: /* BAR 2*/
9813 + case 5: /* BAR 3 */
9814 + case 6: /* BAR 4*/
9815 + case 7: base_idx=idx-2; /* BAR 5*/
9818 + /* Some Titan cards are also a little weird */
9819 + if (dev->vendor == PCI_VENDOR_ID_TITAN &&
9820 + (dev->device == PCI_DEVICE_ID_TITAN_400L ||
9821 + dev->device == PCI_DEVICE_ID_TITAN_800L)) {
9823 + case 0: base_idx = 1;
9825 + case 1: base_idx = 2;
9829 + offset = 8 * (idx - 2);
9834 + /* HP's Diva chip puts the 4th/5th serial port further out, and
9835 + * some serial ports are supposed to be hidden on certain models.
9837 + if (dev->vendor == PCI_VENDOR_ID_HP &&
9838 + dev->device == PCI_DEVICE_ID_HP_SAS) {
9839 + switch (dev->subsystem_device) {
9840 + case 0x104B: /* Maestro */
9841 + if (idx == 3) idx++;
9843 + case 0x1282: /* Everest / Longs Peak */
9844 + if (idx > 0) idx++;
9845 + if (idx > 2) idx++;
9853 + port = pci_resource_start(dev, base_idx) + offset;
9855 + if ((board->flags & SPCI_FL_BASE_TABLE) == 0)
9856 + port += idx * (board->uart_offset ? board->uart_offset : 8);
9858 + if (IS_PCI_REGION_IOPORT(dev, base_idx)) {
9860 + if (HIGH_BITS_OFFSET)
9861 + req->port_high = port >> HIGH_BITS_OFFSET;
9863 + req->port_high = 0;
9866 + req->io_type = SERIAL_IO_MEM;
9867 + req->iomem_base = ioremap(port, board->uart_offset);
9868 + req->iomem_reg_shift = board->reg_shift;
9873 +static _INLINE_ int get_pci_irq(struct pci_dev *dev,
9874 + struct pci_board *board,
9879 + if ((board->flags & SPCI_FL_IRQRESOURCE) == 0)
9882 + base_idx = SPCI_FL_GET_IRQBASE(board->flags);
9883 + if (board->flags & SPCI_FL_IRQ_TABLE)
9886 + return PCI_IRQ_RESOURCE(dev, base_idx);
9890 + * Common enabler code shared by both PCI and ISAPNP probes
9892 +static void __devinit start_pci_pnp_board(struct pci_dev *dev,
9893 + struct pci_board *board)
9896 + struct serial_struct serial_req;
9899 + if (PREPARE_FUNC(dev) && (PREPARE_FUNC(dev))(dev) < 0) {
9900 + printk("serial: PNP device '");
9901 + printk_pnp_dev_id(dev->vendor, dev->device);
9902 + printk("' prepare failed\n");
9906 + if (ACTIVATE_FUNC(dev) && (ACTIVATE_FUNC(dev))(dev) < 0) {
9907 + printk("serial: PNP device '");
9908 + printk_pnp_dev_id(dev->vendor, dev->device);
9909 + printk("' activate failed\n");
9914 + * Run the initialization function, if any
9916 + if (board->init_fn && ((board->init_fn)(dev, board, 1) != 0))
9920 + * Register the serial board in the array if we need to
9921 + * shutdown the board on a module unload or card removal
9923 + if (DEACTIVATE_FUNC(dev) || board->init_fn) {
9924 + for (k=0; k < NR_PCI_BOARDS; k++)
9925 + if (serial_pci_board[k].dev == 0)
9927 + if (k >= NR_PCI_BOARDS)
9929 + serial_pci_board[k].board = *board;
9930 + serial_pci_board[k].dev = dev;
9933 + base_baud = board->base_baud;
9935 + base_baud = BASE_BAUD;
9936 + memset(&serial_req, 0, sizeof(serial_req));
9938 + for (k=0; k < board->num_ports; k++) {
9939 + serial_req.irq = get_pci_irq(dev, board, k);
9940 + if (get_pci_port(dev, board, &serial_req, k))
9942 + serial_req.flags = ASYNC_SKIP_TEST | ASYNC_AUTOPROBE;
9943 +#ifdef SERIAL_DEBUG_PCI
9944 + printk("Setup PCI/PNP port: port %x, irq %d, type %d\n",
9945 + serial_req.port, serial_req.irq, serial_req.io_type);
9947 + line = register_serial(&serial_req);
9950 + rs_table[line].baud_base = base_baud;
9951 + rs_table[line].dev = dev;
9954 +#endif /* ENABLE_SERIAL_PCI || ENABLE_SERIAL_PNP */
9956 +#ifdef ENABLE_SERIAL_PCI
9958 + * Some PCI serial cards using the PLX 9050 PCI interface chip require
9959 + * that the card interrupt be explicitly enabled or disabled. This
9960 + * seems to be mainly needed on card using the PLX which also use I/O
9963 +static int __devinit
9964 +pci_plx9050_fn(struct pci_dev *dev, struct pci_board *board, int enable)
9966 + u8 data, *p, irq_config;
9969 + irq_config = 0x41;
9970 + pci_config = PCI_COMMAND_MEMORY;
9971 + if (dev->vendor == PCI_VENDOR_ID_PANACOM)
9972 + irq_config = 0x43;
9973 + if ((dev->vendor == PCI_VENDOR_ID_PLX) &&
9974 + (dev->device == PCI_DEVICE_ID_PLX_ROMULUS)) {
9976 + * As the megawolf cards have the int pins active
9977 + * high, and have 2 UART chips, both ints must be
9978 + * enabled on the 9050. Also, the UARTS are set in
9979 + * 16450 mode by default, so we have to enable the
9980 + * 16C950 'enhanced' mode so that we can use the deep
9983 + irq_config = 0x5b;
9984 + pci_config = PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
9987 + pci_read_config_byte(dev, PCI_COMMAND, &data);
9990 + pci_write_config_byte(dev, PCI_COMMAND,
9991 + data | pci_config);
9993 + /* enable/disable interrupts */
9994 + p = ioremap(pci_resource_start(dev, 0), 0x80);
9995 + writel(enable ? irq_config : 0x00, (unsigned long)p + 0x4c);
9999 + pci_write_config_byte(dev, PCI_COMMAND,
10000 + data & ~pci_config);
10006 + * SIIG serial cards have an PCI interface chip which also controls
10007 + * the UART clocking frequency. Each UART can be clocked independently
10008 + * (except cards equiped with 4 UARTs) and initial clocking settings
10009 + * are stored in the EEPROM chip. It can cause problems because this
10010 + * version of serial driver doesn't support differently clocked UART's
10011 + * on single PCI card. To prevent this, initialization functions set
10012 + * high frequency clocking for all UART's on given card. It is safe (I
10013 + * hope) because it doesn't touch EEPROM settings to prevent conflicts
10014 + * with other OSes (like M$ DOS).
10016 + * SIIG support added by Andrey Panin <pazke@mail.tp.ru>, 10/1999
10018 + * There is two family of SIIG serial cards with different PCI
10019 + * interface chip and different configuration methods:
10020 + * - 10x cards have control registers in IO and/or memory space;
10021 + * - 20x cards have control registers in standard PCI configuration space.
10023 + * SIIG initialization functions exported for use by parport_serial.c module.
10026 +#define PCI_DEVICE_ID_SIIG_1S_10x (PCI_DEVICE_ID_SIIG_1S_10x_550 & 0xfffc)
10027 +#define PCI_DEVICE_ID_SIIG_2S_10x (PCI_DEVICE_ID_SIIG_2S_10x_550 & 0xfff8)
10030 +pci_siig10x_fn(struct pci_dev *dev, struct pci_board *board, int enable)
10034 + if (!enable) return 0;
10036 + p = ioremap(pci_resource_start(dev, 0), 0x80);
10038 + switch (dev->device & 0xfff8) {
10039 + case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */
10042 + case PCI_DEVICE_ID_SIIG_2S_10x: /* 2S, 2S1P */
10045 + default: /* 1S1P, 4S */
10050 + writew(readw((unsigned long) p + 0x28) & data, (unsigned long) p + 0x28);
10054 +EXPORT_SYMBOL(pci_siig10x_fn);
10056 +#define PCI_DEVICE_ID_SIIG_2S_20x (PCI_DEVICE_ID_SIIG_2S_20x_550 & 0xfffc)
10057 +#define PCI_DEVICE_ID_SIIG_2S1P_20x (PCI_DEVICE_ID_SIIG_2S1P_20x_550 & 0xfffc)
10060 +pci_siig20x_fn(struct pci_dev *dev, struct pci_board *board, int enable)
10064 + if (!enable) return 0;
10066 + /* Change clock frequency for the first UART. */
10067 + pci_read_config_byte(dev, 0x6f, &data);
10068 + pci_write_config_byte(dev, 0x6f, data & 0xef);
10070 + /* If this card has 2 UART, we have to do the same with second UART. */
10071 + if (((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S_20x) ||
10072 + ((dev->device & 0xfffc) == PCI_DEVICE_ID_SIIG_2S1P_20x)) {
10073 + pci_read_config_byte(dev, 0x73, &data);
10074 + pci_write_config_byte(dev, 0x73, data & 0xef);
10078 +EXPORT_SYMBOL(pci_siig20x_fn);
10080 +/* Added for EKF Intel i960 serial boards */
10081 +static int __devinit
10082 +pci_inteli960ni_fn(struct pci_dev *dev,
10083 + struct pci_board *board,
10086 + unsigned long oldval;
10088 + if (!(pci_get_subdevice(dev) & 0x1000))
10091 + if (!enable) /* is there something to deinit? */
10094 +#ifdef SERIAL_DEBUG_PCI
10095 + printk(KERN_DEBUG " Subsystem ID %lx (intel 960)\n",
10096 + (unsigned long) board->subdevice);
10098 + /* is firmware started? */
10099 + pci_read_config_dword(dev, 0x44, (void*) &oldval);
10100 + if (oldval == 0x00001000L) { /* RESET value */
10101 + printk(KERN_DEBUG "Local i960 firmware missing");
10108 + * Timedia has an explosion of boards, and to avoid the PCI table from
10109 + * growing *huge*, we use this function to collapse some 70 entries
10110 + * in the PCI table into one, for sanity's and compactness's sake.
10112 +static unsigned short timedia_single_port[] = {
10113 + 0x4025, 0x4027, 0x4028, 0x5025, 0x5027, 0 };
10114 +static unsigned short timedia_dual_port[] = {
10115 + 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
10116 + 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
10117 + 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
10118 + 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
10120 +static unsigned short timedia_quad_port[] = {
10121 + 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
10122 + 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
10123 + 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
10125 +static unsigned short timedia_eight_port[] = {
10126 + 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
10127 + 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 };
10128 +static struct timedia_struct {
10130 + unsigned short *ids;
10131 +} timedia_data[] = {
10132 + { 1, timedia_single_port },
10133 + { 2, timedia_dual_port },
10134 + { 4, timedia_quad_port },
10135 + { 8, timedia_eight_port },
10139 +static int __devinit
10140 +pci_timedia_fn(struct pci_dev *dev, struct pci_board *board, int enable)
10143 + unsigned short *ids;
10148 + for (i=0; timedia_data[i].num; i++) {
10149 + ids = timedia_data[i].ids;
10150 + for (j=0; ids[j]; j++) {
10151 + if (pci_get_subdevice(dev) == ids[j]) {
10152 + board->num_ports = timedia_data[i].num;
10161 + * HP's Remote Management Console. The Diva chip came in several
10162 + * different versions. N-class, L2000 and A500 have two Diva chips, each
10163 + * with 3 UARTs (the third UART on the second chip is unused). Superdome
10164 + * and Keystone have one Diva chip with 3 UARTs. Some later machines have
10165 + * one Diva chip, but it has been expanded to 5 UARTs.
10167 +static int __devinit
10168 +pci_hp_diva(struct pci_dev *dev, struct pci_board *board, int enable)
10173 + switch (dev->subsystem_device) {
10174 + case 0x1049: /* Prelude Diva 1 */
10175 + case 0x1223: /* Superdome */
10176 + case 0x1226: /* Keystone */
10177 + case 0x1282: /* Everest / Longs Peak */
10178 + board->num_ports = 3;
10180 + case 0x104A: /* Prelude Diva 2 */
10181 + board->num_ports = 2;
10183 + case 0x104B: /* Maestro */
10184 + board->num_ports = 4;
10186 + case 0x1227: /* Powerbar */
10187 + board->num_ports = 1;
10194 +static int __devinit
10195 +pci_xircom_fn(struct pci_dev *dev, struct pci_board *board, int enable)
10197 + __set_current_state(TASK_UNINTERRUPTIBLE);
10198 + schedule_timeout(HZ/10);
10203 + * This is the configuration table for all of the PCI serial boards
10204 + * which we support. It is directly indexed by the pci_board_num_t enum
10205 + * value, which is encoded in the pci_device_id PCI probe table's
10206 + * driver_data member.
10208 +enum pci_board_num_t {
10219 + pbn_b0_bt_1_115200,
10220 + pbn_b0_bt_2_115200,
10221 + pbn_b0_bt_1_460800,
10222 + pbn_b0_bt_2_460800,
10223 + pbn_b0_bt_2_921600,
10234 + pbn_b1_2_1382400,
10235 + pbn_b1_4_1382400,
10236 + pbn_b1_8_1382400,
10242 + pbn_b2_16_460800,
10246 + pbn_b2_bt_1_115200,
10247 + pbn_b2_bt_2_115200,
10248 + pbn_b2_bt_4_115200,
10249 + pbn_b2_bt_2_921600,
10260 +#ifdef CONFIG_DDB5074
10267 + pbn_xircom_combo,
10282 +static struct pci_board pci_boards[] __devinitdata = {
10284 + * PCI Flags, Number of Ports, Base (Maximum) Baud Rate,
10285 + * Offset to get to next UART's registers,
10286 + * Register shift to use for memory-mapped I/O,
10287 + * Initialization function, first UART offset
10290 + /* Generic serial board, pbn_b0_1_115200, pbn_default */
10291 + { SPCI_FL_BASE0, 1, 115200 }, /* pbn_b0_1_115200,
10294 + { SPCI_FL_BASE0, 2, 115200 }, /* pbn_b0_2_115200 */
10295 + { SPCI_FL_BASE0, 4, 115200 }, /* pbn_b0_4_115200 */
10297 + { SPCI_FL_BASE0, 1, 921600 }, /* pbn_b0_1_921600 */
10298 + { SPCI_FL_BASE0, 2, 921600 }, /* pbn_b0_2_921600 */
10299 + { SPCI_FL_BASE0, 4, 921600 }, /* pbn_b0_4_921600 */
10301 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 1, 115200 }, /* pbn_b0_bt_1_115200 */
10302 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 115200 }, /* pbn_b0_bt_2_115200 */
10303 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 1, 460800 }, /* pbn_b0_bt_1_460800 */
10304 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 460800 }, /* pbn_b0_bt_2_460800 */
10305 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600 }, /* pbn_b0_bt_2_921600 */
10307 + { SPCI_FL_BASE1, 1, 115200 }, /* pbn_b1_1_115200 */
10308 + { SPCI_FL_BASE1, 2, 115200 }, /* pbn_b1_2_115200 */
10309 + { SPCI_FL_BASE1, 4, 115200 }, /* pbn_b1_4_115200 */
10310 + { SPCI_FL_BASE1, 8, 115200 }, /* pbn_b1_8_115200 */
10312 + { SPCI_FL_BASE1, 2, 921600 }, /* pbn_b1_2_921600 */
10313 + { SPCI_FL_BASE1, 4, 921600 }, /* pbn_b1_4_921600 */
10314 + { SPCI_FL_BASE1, 8, 921600 }, /* pbn_b1_8_921600 */
10316 + { SPCI_FL_BASE1, 2, 1382400 }, /* pbn_b1_2_1382400 */
10317 + { SPCI_FL_BASE1, 4, 1382400 }, /* pbn_b1_4_1382400 */
10318 + { SPCI_FL_BASE1, 8, 1382400 }, /* pbn_b1_8_1382400 */
10320 + { SPCI_FL_BASE2, 1, 115200 }, /* pbn_b2_1_115200 */
10321 + { SPCI_FL_BASE2, 8, 115200 }, /* pbn_b2_8_115200 */
10322 + { SPCI_FL_BASE2, 4, 460800 }, /* pbn_b2_4_460800 */
10323 + { SPCI_FL_BASE2, 8, 460800 }, /* pbn_b2_8_460800 */
10324 + { SPCI_FL_BASE2, 16, 460800 }, /* pbn_b2_16_460800 */
10325 + { SPCI_FL_BASE2, 4, 921600 }, /* pbn_b2_4_921600 */
10326 + { SPCI_FL_BASE2, 8, 921600 }, /* pbn_b2_8_921600 */
10328 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 1, 115200 }, /* pbn_b2_bt_1_115200 */
10329 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 115200 }, /* pbn_b2_bt_2_115200 */
10330 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 115200 }, /* pbn_b2_bt_4_115200 */
10331 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600 }, /* pbn_b2_bt_2_921600 */
10333 + { SPCI_FL_BASE2, 2, 921600, /* IOMEM */ /* pbn_panacom */
10334 + 0x400, 7, pci_plx9050_fn },
10335 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, /* pbn_panacom2 */
10336 + 0x400, 7, pci_plx9050_fn },
10337 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 921600, /* pbn_panacom4 */
10338 + 0x400, 7, pci_plx9050_fn },
10339 + { SPCI_FL_BASE2, 4, 921600, /* pbn_plx_romulus */
10340 + 0x20, 2, pci_plx9050_fn, 0x03 },
10341 + /* This board uses the size of PCI Base region 0 to
10342 + * signal now many ports are available */
10343 + { SPCI_FL_BASE0 | SPCI_FL_REGION_SZ_CAP, 32, 115200 }, /* pbn_oxsemi */
10344 + { SPCI_FL_BASE_TABLE, 1, 921600, /* pbn_timedia */
10345 + 0, 0, pci_timedia_fn },
10346 + /* EKF addition for i960 Boards form EKF with serial port */
10347 + { SPCI_FL_BASE0, 32, 921600, /* max 256 ports */ /* pbn_intel_i960 */
10348 + 8<<2, 2, pci_inteli960ni_fn, 0x10000},
10349 + { SPCI_FL_BASE0 | SPCI_FL_IRQRESOURCE, /* pbn_sgi_ioc3 */
10350 + 1, 458333, 0, 0, 0, 0x20178 },
10351 + { SPCI_FL_BASE0, 5, 115200, 8, 0, pci_hp_diva, 0}, /* pbn_hp_diva */
10352 +#ifdef CONFIG_DDB5074
10354 + * NEC Vrc-5074 (Nile 4) builtin UART.
10355 + * Conditionally compiled in since this is a motherboard device.
10357 + { SPCI_FL_BASE0, 1, 520833, /* pbn_nec_nile4 */
10358 + 64, 3, NULL, 0x300 },
10361 + {SPCI_FL_BASE3, 4, 115200, 8}, /* pbn_dci_pccom4 */
10362 + {SPCI_FL_BASE3, 8, 115200, 8}, /* pbn_dci_pccom8 */
10364 + { SPCI_FL_BASE0, 1, 115200, /* pbn_xircom_combo */
10365 + 0, 0, pci_xircom_fn },
10367 + { SPCI_FL_BASE2, 1, 460800, /* pbn_siig10x_0 */
10368 + 0, 0, pci_siig10x_fn },
10369 + { SPCI_FL_BASE2, 1, 921600, /* pbn_siig10x_1 */
10370 + 0, 0, pci_siig10x_fn },
10371 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 2, 921600, /* pbn_siig10x_2 */
10372 + 0, 0, pci_siig10x_fn },
10373 + { SPCI_FL_BASE2 | SPCI_FL_BASE_TABLE, 4, 921600, /* pbn_siig10x_4 */
10374 + 0, 0, pci_siig10x_fn },
10375 + { SPCI_FL_BASE0, 1, 921600, /* pbn_siix20x_0 */
10376 + 0, 0, pci_siig20x_fn },
10377 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 2, 921600, /* pbn_siix20x_2 */
10378 + 0, 0, pci_siig20x_fn },
10379 + { SPCI_FL_BASE0 | SPCI_FL_BASE_TABLE, 4, 921600, /* pbn_siix20x_4 */
10380 + 0, 0, pci_siig20x_fn },
10382 + { SPCI_FL_BASE0, 4, 921600, /* IOMEM */ /* pbn_computone_4 */
10383 + 0x40, 2, NULL, 0x200 },
10384 + { SPCI_FL_BASE0, 6, 921600, /* IOMEM */ /* pbn_computone_6 */
10385 + 0x40, 2, NULL, 0x200 },
10386 + { SPCI_FL_BASE0, 8, 921600, /* IOMEM */ /* pbn_computone_8 */
10387 + 0x40, 2, NULL, 0x200 },
10391 + * Given a complete unknown PCI device, try to use some heuristics to
10392 + * guess what the configuration might be, based on the pitiful PCI
10393 + * serial specs. Returns 0 on success, 1 on failure.
10395 +static int __devinit serial_pci_guess_board(struct pci_dev *dev,
10396 + struct pci_board *board)
10398 + int num_iomem = 0, num_port = 0, first_port = -1;
10402 + * If it is not a communications device or the programming
10403 + * interface is greater than 6, give up.
10405 + * (Should we try to make guesses for multiport serial devices
10408 + if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
10409 + ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
10410 + (dev->class & 0xff) > 6)
10413 + for (i=0; i < 6; i++) {
10414 + if (IS_PCI_REGION_IOPORT(dev, i)) {
10416 + if (first_port == -1)
10419 + if (IS_PCI_REGION_IOMEM(dev, i))
10424 + * If there is 1 or 0 iomem regions, and exactly one port, use
10427 + if (num_iomem <= 1 && num_port == 1) {
10428 + board->flags = first_port;
10434 +static int __devinit serial_init_one(struct pci_dev *dev,
10435 + const struct pci_device_id *ent)
10437 + struct pci_board *board, tmp;
10440 + board = &pci_boards[ent->driver_data];
10442 + rc = pci_enable_device(dev);
10443 + if (rc) return rc;
10445 + if (ent->driver_data == pbn_default &&
10446 + serial_pci_guess_board(dev, board))
10448 + else if (serial_pci_guess_board(dev, &tmp) == 0) {
10449 + printk(KERN_INFO "Redundant entry in serial pci_table. "
10450 + "Please send the output of\n"
10451 + "lspci -vv, this message (%04x,%04x,%04x,%04x)\n"
10452 + "and the manufacturer and name of "
10453 + "serial board or modem board\n"
10454 + "to serial-pci-info@lists.sourceforge.net.\n",
10455 + dev->vendor, dev->device,
10456 + pci_get_subvendor(dev), pci_get_subdevice(dev));
10459 + start_pci_pnp_board(dev, board);
10464 +static void __devexit serial_remove_one(struct pci_dev *dev)
10469 + * Iterate through all of the ports finding those that belong
10470 + * to this PCI device.
10472 + for(i = 0; i < NR_PORTS; i++) {
10473 + if (rs_table[i].dev != dev)
10475 + unregister_serial(i);
10476 + rs_table[i].dev = 0;
10479 + * Now execute any board-specific shutdown procedure
10481 + for (i=0; i < NR_PCI_BOARDS; i++) {
10482 + struct pci_board_inst *brd = &serial_pci_board[i];
10484 + if (serial_pci_board[i].dev != dev)
10486 + if (brd->board.init_fn)
10487 + (brd->board.init_fn)(brd->dev, &brd->board, 0);
10488 + if (DEACTIVATE_FUNC(brd->dev))
10489 + (DEACTIVATE_FUNC(brd->dev))(brd->dev);
10490 + serial_pci_board[i].dev = 0;
10495 +static struct pci_device_id serial_pci_tbl[] __devinitdata = {
10496 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
10497 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10498 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
10499 + pbn_b1_8_1382400 },
10500 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
10501 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10502 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
10503 + pbn_b1_4_1382400 },
10504 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
10505 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10506 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
10507 + pbn_b1_2_1382400 },
10508 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10509 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10510 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
10511 + pbn_b1_8_1382400 },
10512 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10513 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10514 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232, 0, 0,
10515 + pbn_b1_4_1382400 },
10516 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10517 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10518 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232, 0, 0,
10519 + pbn_b1_2_1382400 },
10520 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10521 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10522 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485, 0, 0,
10523 + pbn_b1_8_921600 },
10524 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10525 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10526 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4, 0, 0,
10527 + pbn_b1_8_921600 },
10528 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10529 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10530 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485, 0, 0,
10531 + pbn_b1_4_921600 },
10532 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10533 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10534 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2, 0, 0,
10535 + pbn_b1_4_921600 },
10536 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10537 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10538 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485, 0, 0,
10539 + pbn_b1_2_921600 },
10540 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10541 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10542 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6, 0, 0,
10543 + pbn_b1_8_921600 },
10544 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10545 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10546 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1, 0, 0,
10547 + pbn_b1_8_921600 },
10548 + { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V351,
10549 + PCI_SUBVENDOR_ID_CONNECT_TECH,
10550 + PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1, 0, 0,
10551 + pbn_b1_4_921600 },
10553 + { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_U530,
10554 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10555 + pbn_b2_bt_1_115200 },
10556 + { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM2,
10557 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10558 + pbn_b2_bt_2_115200 },
10559 + { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM422,
10560 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10561 + pbn_b2_bt_4_115200 },
10562 + { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM232,
10563 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10564 + pbn_b2_bt_2_115200 },
10565 + { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM4,
10566 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10567 + pbn_b2_bt_4_115200 },
10568 + { PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
10569 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10570 + pbn_b2_8_115200 },
10572 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_GTEK_SERIAL2,
10573 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10574 + pbn_b2_bt_2_115200 },
10575 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM200,
10576 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10577 + pbn_b2_bt_2_921600 },
10578 + /* VScom SPCOM800, from sl@s.pl */
10579 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_SPCOM800,
10580 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10581 + pbn_b2_8_921600 },
10582 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077,
10583 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10584 + pbn_b2_4_921600 },
10585 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10586 + PCI_SUBVENDOR_ID_KEYSPAN,
10587 + PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
10589 + { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_QUADMODEM,
10590 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10592 + { PCI_VENDOR_ID_PANACOM, PCI_DEVICE_ID_PANACOM_DUALMODEM,
10593 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10595 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10596 + PCI_SUBVENDOR_ID_CHASE_PCIFAST,
10597 + PCI_SUBDEVICE_ID_CHASE_PCIFAST4, 0, 0,
10598 + pbn_b2_4_460800 },
10599 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10600 + PCI_SUBVENDOR_ID_CHASE_PCIFAST,
10601 + PCI_SUBDEVICE_ID_CHASE_PCIFAST8, 0, 0,
10602 + pbn_b2_8_460800 },
10603 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10604 + PCI_SUBVENDOR_ID_CHASE_PCIFAST,
10605 + PCI_SUBDEVICE_ID_CHASE_PCIFAST16, 0, 0,
10606 + pbn_b2_16_460800 },
10607 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10608 + PCI_SUBVENDOR_ID_CHASE_PCIFAST,
10609 + PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC, 0, 0,
10610 + pbn_b2_16_460800 },
10611 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10612 + PCI_SUBVENDOR_ID_CHASE_PCIRAS,
10613 + PCI_SUBDEVICE_ID_CHASE_PCIRAS4, 0, 0,
10614 + pbn_b2_4_460800 },
10615 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
10616 + PCI_SUBVENDOR_ID_CHASE_PCIRAS,
10617 + PCI_SUBDEVICE_ID_CHASE_PCIRAS8, 0, 0,
10618 + pbn_b2_8_460800 },
10619 + /* Megawolf Romulus PCI Serial Card, from Mike Hudson */
10620 + /* (Exoray@isys.ca) */
10621 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS,
10622 + 0x10b5, 0x106a, 0, 0,
10623 + pbn_plx_romulus },
10624 + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_QSC100,
10625 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10626 + pbn_b1_4_115200 },
10627 + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_DSC100,
10628 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10629 + pbn_b1_2_115200 },
10630 + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100D,
10631 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10632 + pbn_b1_8_115200 },
10633 + { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_ESC100M,
10634 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10635 + pbn_b1_8_115200 },
10636 + { PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_OXSEMI_16PCI954,
10637 + PCI_VENDOR_ID_SPECIALIX, PCI_SUBDEVICE_ID_SPECIALIX_SPEED4, 0, 0,
10638 + pbn_b0_4_921600 },
10639 + { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
10640 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10641 + pbn_b0_4_115200 },
10642 + { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
10643 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10644 + pbn_b0_bt_2_921600 },
10646 + /* Digitan DS560-558, from jimd@esoft.com */
10647 + { PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_ATT_VENUS_MODEM,
10648 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10649 + pbn_b1_1_115200 },
10651 + /* 3Com US Robotics 56k Voice Internal PCI model 5610 */
10652 + { PCI_VENDOR_ID_USR, 0x1008,
10653 + PCI_ANY_ID, PCI_ANY_ID, },
10655 + /* Titan Electronic cards */
10656 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100,
10657 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10658 + pbn_b0_1_921600 },
10659 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200,
10660 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10661 + pbn_b0_2_921600 },
10662 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400,
10663 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10664 + pbn_b0_4_921600 },
10665 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800B,
10666 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10667 + pbn_b0_4_921600 },
10668 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_100L,
10669 + PCI_ANY_ID, PCI_ANY_ID,
10670 + SPCI_FL_BASE1, 1, 921600 },
10671 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200L,
10672 + PCI_ANY_ID, PCI_ANY_ID,
10673 + SPCI_FL_BASE1 | SPCI_FL_BASE_TABLE, 2, 921600 },
10674 + /* The 400L and 800L have a custom hack in get_pci_port */
10675 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400L,
10676 + PCI_ANY_ID, PCI_ANY_ID,
10677 + SPCI_FL_BASE_TABLE, 4, 921600 },
10678 + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_800L,
10679 + PCI_ANY_ID, PCI_ANY_ID,
10680 + SPCI_FL_BASE_TABLE, 8, 921600 },
10682 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_550,
10683 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10685 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_650,
10686 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10688 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_10x_850,
10689 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10691 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_550,
10692 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10694 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_650,
10695 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10697 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_10x_850,
10698 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10700 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_550,
10701 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10703 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_650,
10704 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10706 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_10x_850,
10707 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10709 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_550,
10710 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10712 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_650,
10713 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10715 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S_20x_850,
10716 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10718 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_550,
10719 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10721 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_650,
10722 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10724 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S_20x_850,
10725 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10727 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_550,
10728 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10730 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_650,
10731 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10733 + { PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
10734 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10737 + /* Computone devices submitted by Doug McNash dmcnash@computone.com */
10738 + { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
10739 + PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG4,
10740 + 0, 0, pbn_computone_4 },
10741 + { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
10742 + PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG8,
10743 + 0, 0, pbn_computone_8 },
10744 + { PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_PG,
10745 + PCI_SUBVENDOR_ID_COMPUTONE, PCI_SUBDEVICE_ID_COMPUTONE_PG6,
10746 + 0, 0, pbn_computone_6 },
10748 + { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI95N,
10749 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_oxsemi },
10750 + { PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
10751 + PCI_VENDOR_ID_TIMEDIA, PCI_ANY_ID, 0, 0, pbn_timedia },
10753 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_DSERIAL,
10754 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10755 + pbn_b0_bt_2_115200 },
10756 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_A,
10757 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10758 + pbn_b0_bt_2_115200 },
10759 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
10760 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10761 + pbn_b0_bt_2_115200 },
10762 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS,
10763 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10764 + pbn_b0_bt_2_460800 },
10765 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_A,
10766 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10767 + pbn_b0_bt_2_460800 },
10768 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUAD_B,
10769 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10770 + pbn_b0_bt_2_460800 },
10771 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_SSERIAL,
10772 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10773 + pbn_b0_bt_1_115200 },
10774 + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_650,
10775 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10776 + pbn_b0_bt_1_460800 },
10778 + /* RAStel 2 port modem, gerg@moreton.com.au */
10779 + { PCI_VENDOR_ID_MORETON, PCI_DEVICE_ID_RASTEL_2PORT,
10780 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10781 + pbn_b2_bt_2_115200 },
10783 + /* EKF addition for i960 Boards form EKF with serial port */
10784 + { PCI_VENDOR_ID_INTEL, 0x1960,
10785 + 0xE4BF, PCI_ANY_ID, 0, 0,
10786 + pbn_intel_i960 },
10788 + /* Xircom Cardbus/Ethernet combos */
10789 + { PCI_VENDOR_ID_XIRCOM, PCI_DEVICE_ID_XIRCOM_X3201_MDM,
10790 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10791 + pbn_xircom_combo },
10794 + * Untested PCI modems, sent in from various folks...
10797 + /* Elsa Model 56K PCI Modem, from Andreas Rath <arh@01019freenet.de> */
10798 + { PCI_VENDOR_ID_ROCKWELL, 0x1004,
10799 + 0x1048, 0x1500, 0, 0,
10800 + pbn_b1_1_115200 },
10802 + { PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
10806 + /* HP Diva card */
10807 + { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_SAS,
10808 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10810 + { PCI_VENDOR_ID_HP, 0x1290,
10811 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10812 + pbn_b2_1_115200 },
10814 +#ifdef CONFIG_DDB5074
10816 + * NEC Vrc-5074 (Nile 4) builtin UART.
10817 + * Conditionally compiled in since this is a motherboard device.
10819 + { PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_NILE4,
10820 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10824 + { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM4,
10825 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10826 + pbn_dci_pccom4 },
10827 + { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM8,
10828 + PCI_ANY_ID, PCI_ANY_ID, 0, 0,
10829 + pbn_dci_pccom8 },
10831 + { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
10832 + PCI_CLASS_COMMUNICATION_SERIAL << 8, 0xffff00, },
10833 + { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
10834 + PCI_CLASS_COMMUNICATION_MODEM << 8, 0xffff00, },
10838 +MODULE_DEVICE_TABLE(pci, serial_pci_tbl);
10840 +static struct pci_driver serial_pci_driver = {
10842 + probe: serial_init_one,
10843 + remove: __devexit_p(serial_remove_one),
10844 + id_table: serial_pci_tbl,
10849 + * Query PCI space for known serial boards
10850 + * If found, add them to the PCI device space in rs_table[]
10852 + * Accept a maximum of eight boards
10855 +static void __devinit probe_serial_pci(void)
10857 +#ifdef SERIAL_DEBUG_PCI
10858 + printk(KERN_DEBUG "Entered probe_serial_pci()\n");
10861 + /* Register call PCI serial devices. Null out
10862 + * the driver name upon failure, as a signal
10863 + * not to attempt to unregister the driver later
10865 + if (pci_module_init (&serial_pci_driver) != 0)
10866 + serial_pci_driver.name = "";
10868 +#ifdef SERIAL_DEBUG_PCI
10869 + printk(KERN_DEBUG "Leaving probe_serial_pci() (probe finished)\n");
10874 +#endif /* ENABLE_SERIAL_PCI */
10876 +#ifdef ENABLE_SERIAL_PNP
10878 +struct pnp_board {
10879 + unsigned short vendor;
10880 + unsigned short device;
10883 +static struct pnp_board pnp_devices[] __devinitdata = {
10884 + /* Archtek America Corp. */
10885 + /* Archtek SmartLink Modem 3334BT Plug & Play */
10886 + { ISAPNP_VENDOR('A', 'A', 'C'), ISAPNP_DEVICE(0x000F) },
10887 + /* Anchor Datacomm BV */
10888 + /* SXPro 144 External Data Fax Modem Plug & Play */
10889 + { ISAPNP_VENDOR('A', 'D', 'C'), ISAPNP_DEVICE(0x0001) },
10890 + /* SXPro 288 External Data Fax Modem Plug & Play */
10891 + { ISAPNP_VENDOR('A', 'D', 'C'), ISAPNP_DEVICE(0x0002) },
10892 + /* Rockwell 56K ACF II Fax+Data+Voice Modem */
10893 + { ISAPNP_VENDOR('A', 'K', 'Y'), ISAPNP_DEVICE(0x1021) },
10894 + /* AZT3005 PnP SOUND DEVICE */
10895 + { ISAPNP_VENDOR('A', 'Z', 'T'), ISAPNP_DEVICE(0x4001) },
10896 + /* Best Data Products Inc. Smart One 336F PnP Modem */
10897 + { ISAPNP_VENDOR('B', 'D', 'P'), ISAPNP_DEVICE(0x3336) },
10898 + /* Boca Research */
10899 + /* Boca Complete Ofc Communicator 14.4 Data-FAX */
10900 + { ISAPNP_VENDOR('B', 'R', 'I'), ISAPNP_DEVICE(0x0A49) },
10901 + /* Boca Research 33,600 ACF Modem */
10902 + { ISAPNP_VENDOR('B', 'R', 'I'), ISAPNP_DEVICE(0x1400) },
10903 + /* Boca 33.6 Kbps Internal FD34FSVD */
10904 + { ISAPNP_VENDOR('B', 'R', 'I'), ISAPNP_DEVICE(0x3400) },
10905 + /* Boca 33.6 Kbps Internal FD34FSVD */
10906 + { ISAPNP_VENDOR('B', 'R', 'I'), ISAPNP_DEVICE(0x0A49) },
10907 + /* Best Data Products Inc. Smart One 336F PnP Modem */
10908 + { ISAPNP_VENDOR('B', 'D', 'P'), ISAPNP_DEVICE(0x3336) },
10909 + /* Computer Peripherals Inc */
10910 + /* EuroViVa CommCenter-33.6 SP PnP */
10911 + { ISAPNP_VENDOR('C', 'P', 'I'), ISAPNP_DEVICE(0x4050) },
10912 + /* Creative Labs */
10913 + /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
10914 + { ISAPNP_VENDOR('C', 'T', 'L'), ISAPNP_DEVICE(0x3001) },
10915 + /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
10916 + { ISAPNP_VENDOR('C', 'T', 'L'), ISAPNP_DEVICE(0x3011) },
10918 + /* Creative Modem Blaster Flash56 DI5601-1 */
10919 + { ISAPNP_VENDOR('D', 'M', 'B'), ISAPNP_DEVICE(0x1032) },
10920 + /* Creative Modem Blaster V.90 DI5660 */
10921 + { ISAPNP_VENDOR('D', 'M', 'B'), ISAPNP_DEVICE(0x2001) },
10923 + /* Fujitsu 33600 PnP-I2 R Plug & Play */
10924 + { ISAPNP_VENDOR('F', 'U', 'J'), ISAPNP_DEVICE(0x0202) },
10925 + /* Fujitsu FMV-FX431 Plug & Play */
10926 + { ISAPNP_VENDOR('F', 'U', 'J'), ISAPNP_DEVICE(0x0205) },
10927 + /* Fujitsu 33600 PnP-I4 R Plug & Play */
10928 + { ISAPNP_VENDOR('F', 'U', 'J'), ISAPNP_DEVICE(0x0206) },
10929 + /* Fujitsu Fax Voice 33600 PNP-I5 R Plug & Play */
10930 + { ISAPNP_VENDOR('F', 'U', 'J'), ISAPNP_DEVICE(0x0209) },
10931 + /* Archtek America Corp. */
10932 + /* Archtek SmartLink Modem 3334BT Plug & Play */
10933 + { ISAPNP_VENDOR('G', 'V', 'C'), ISAPNP_DEVICE(0x000F) },
10935 + /* Hayes Optima 288 V.34-V.FC + FAX + Voice Plug & Play */
10936 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0x0001) },
10937 + /* Hayes Optima 336 V.34 + FAX + Voice PnP */
10938 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0x000C) },
10939 + /* Hayes Optima 336B V.34 + FAX + Voice PnP */
10940 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0x000D) },
10941 + /* Hayes Accura 56K Ext Fax Modem PnP */
10942 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0x5670) },
10943 + /* Hayes Accura 56K Ext Fax Modem PnP */
10944 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0x5674) },
10945 + /* Hayes Accura 56K Fax Modem PnP */
10946 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0x5675) },
10947 + /* Hayes 288, V.34 + FAX */
10948 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0xF000) },
10949 + /* Hayes Optima 288 V.34 + FAX + Voice, Plug & Play */
10950 + { ISAPNP_VENDOR('H', 'A', 'Y'), ISAPNP_DEVICE(0xF001) },
10952 + /* IBM Thinkpad 701 Internal Modem Voice */
10953 + { ISAPNP_VENDOR('I', 'B', 'M'), ISAPNP_DEVICE(0x0033) },
10955 + /* Intertex 28k8 33k6 Voice EXT PnP */
10956 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xC801) },
10957 + /* Intertex 33k6 56k Voice EXT PnP */
10958 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xC901) },
10959 + /* Intertex 28k8 33k6 Voice SP EXT PnP */
10960 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xD801) },
10961 + /* Intertex 33k6 56k Voice SP EXT PnP */
10962 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xD901) },
10963 + /* Intertex 28k8 33k6 Voice SP INT PnP */
10964 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xF401) },
10965 + /* Intertex 28k8 33k6 Voice SP EXT PnP */
10966 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xF801) },
10967 + /* Intertex 33k6 56k Voice SP EXT PnP */
10968 + { ISAPNP_VENDOR('I', 'X', 'D'), ISAPNP_DEVICE(0xF901) },
10969 + /* Kortex International */
10970 + /* KORTEX 28800 Externe PnP */
10971 + { ISAPNP_VENDOR('K', 'O', 'R'), ISAPNP_DEVICE(0x4522) },
10972 + /* KXPro 33.6 Vocal ASVD PnP */
10973 + { ISAPNP_VENDOR('K', 'O', 'R'), ISAPNP_DEVICE(0xF661) },
10975 + /* LASAT Internet 33600 PnP */
10976 + { ISAPNP_VENDOR('L', 'A', 'S'), ISAPNP_DEVICE(0x4040) },
10977 + /* Lasat Safire 560 PnP */
10978 + { ISAPNP_VENDOR('L', 'A', 'S'), ISAPNP_DEVICE(0x4540) },
10979 + /* Lasat Safire 336 PnP */
10980 + { ISAPNP_VENDOR('L', 'A', 'S'), ISAPNP_DEVICE(0x5440) },
10981 + /* Microcom, Inc. */
10982 + /* Microcom TravelPorte FAST V.34 Plug & Play */
10983 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x281) },
10984 + /* Microcom DeskPorte V.34 FAST or FAST+ Plug & Play */
10985 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x0336) },
10986 + /* Microcom DeskPorte FAST EP 28.8 Plug & Play */
10987 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x0339) },
10988 + /* Microcom DeskPorte 28.8P Plug & Play */
10989 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x0342) },
10990 + /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
10991 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x0500) },
10992 + /* Microcom DeskPorte FAST ES 28.8 Plug & Play */
10993 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x0501) },
10994 + /* Microcom DeskPorte 28.8S Internal Plug & Play */
10995 + { ISAPNP_VENDOR('M', 'N', 'P'), ISAPNP_DEVICE(0x0502) },
10997 + /* Motorola BitSURFR Plug & Play */
10998 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1105) },
10999 + /* Motorola TA210 Plug & Play */
11000 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1111) },
11001 + /* Motorola HMTA 200 (ISDN) Plug & Play */
11002 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1114) },
11003 + /* Motorola BitSURFR Plug & Play */
11004 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1115) },
11005 + /* Motorola Lifestyle 28.8 Internal */
11006 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1190) },
11007 + /* Motorola V.3400 Plug & Play */
11008 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1501) },
11009 + /* Motorola Lifestyle 28.8 V.34 Plug & Play */
11010 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1502) },
11011 + /* Motorola Power 28.8 V.34 Plug & Play */
11012 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1505) },
11013 + /* Motorola ModemSURFR External 28.8 Plug & Play */
11014 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1509) },
11015 + /* Motorola Premier 33.6 Desktop Plug & Play */
11016 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x150A) },
11017 + /* Motorola VoiceSURFR 56K External PnP */
11018 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x150F) },
11019 + /* Motorola ModemSURFR 56K External PnP */
11020 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1510) },
11021 + /* Motorola ModemSURFR 56K Internal PnP */
11022 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1550) },
11023 + /* Motorola ModemSURFR Internal 28.8 Plug & Play */
11024 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1560) },
11025 + /* Motorola Premier 33.6 Internal Plug & Play */
11026 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x1580) },
11027 + /* Motorola OnlineSURFR 28.8 Internal Plug & Play */
11028 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x15B0) },
11029 + /* Motorola VoiceSURFR 56K Internal PnP */
11030 + { ISAPNP_VENDOR('M', 'O', 'T'), ISAPNP_DEVICE(0x15F0) },
11032 + /* Deskline K56 Phone System PnP */
11033 + { ISAPNP_VENDOR('M', 'V', 'X'), ISAPNP_DEVICE(0x00A1) },
11034 + /* PC Rider K56 Phone System PnP */
11035 + { ISAPNP_VENDOR('M', 'V', 'X'), ISAPNP_DEVICE(0x00F2) },
11036 + /* Pace 56 Voice Internal Plug & Play Modem */
11037 + { ISAPNP_VENDOR('P', 'M', 'C'), ISAPNP_DEVICE(0x2430) },
11039 + /* Generic standard PC COM port */
11040 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0x0500) },
11041 + /* Generic 16550A-compatible COM port */
11042 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0x0501) },
11043 + /* Compaq 14400 Modem */
11044 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC000) },
11045 + /* Compaq 2400/9600 Modem */
11046 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC001) },
11047 + /* Dial-Up Networking Serial Cable between 2 PCs */
11048 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC031) },
11049 + /* Dial-Up Networking Parallel Cable between 2 PCs */
11050 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC032) },
11051 + /* Standard 9600 bps Modem */
11052 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC100) },
11053 + /* Standard 14400 bps Modem */
11054 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC101) },
11055 + /* Standard 28800 bps Modem*/
11056 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC102) },
11057 + /* Standard Modem*/
11058 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC103) },
11059 + /* Standard 9600 bps Modem*/
11060 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC104) },
11061 + /* Standard 14400 bps Modem*/
11062 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC105) },
11063 + /* Standard 28800 bps Modem*/
11064 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC106) },
11065 + /* Standard Modem */
11066 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC107) },
11067 + /* Standard 9600 bps Modem */
11068 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC108) },
11069 + /* Standard 14400 bps Modem */
11070 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC109) },
11071 + /* Standard 28800 bps Modem */
11072 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC10A) },
11073 + /* Standard Modem */
11074 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC10B) },
11075 + /* Standard 9600 bps Modem */
11076 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC10C) },
11077 + /* Standard 14400 bps Modem */
11078 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC10D) },
11079 + /* Standard 28800 bps Modem */
11080 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC10E) },
11081 + /* Standard Modem */
11082 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC10F) },
11083 + /* Standard PCMCIA Card Modem */
11084 + { ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0x2000) },
11086 + /* Modular Technology */
11087 + /* Rockwell 33.6 DPF Internal PnP */
11088 + /* Modular Technology 33.6 Internal PnP */
11089 + { ISAPNP_VENDOR('R', 'O', 'K'), ISAPNP_DEVICE(0x0030) },
11090 + /* Kortex International */
11091 + /* KORTEX 14400 Externe PnP */
11092 + { ISAPNP_VENDOR('R', 'O', 'K'), ISAPNP_DEVICE(0x0100) },
11093 + /* Viking Components, Inc */
11094 + /* Viking 28.8 INTERNAL Fax+Data+Voice PnP */
11095 + { ISAPNP_VENDOR('R', 'O', 'K'), ISAPNP_DEVICE(0x4920) },
11097 + /* British Telecom */
11098 + /* Modular Technology */
11099 + /* Rockwell 33.6 DPF External PnP */
11100 + /* BT Prologue 33.6 External PnP */
11101 + /* Modular Technology 33.6 External PnP */
11102 + { ISAPNP_VENDOR('R', 'S', 'S'), ISAPNP_DEVICE(0x00A0) },
11103 + /* Viking 56K FAX INT */
11104 + { ISAPNP_VENDOR('R', 'S', 'S'), ISAPNP_DEVICE(0x0262) },
11105 + /* SupraExpress 28.8 Data/Fax PnP modem */
11106 + { ISAPNP_VENDOR('S', 'U', 'P'), ISAPNP_DEVICE(0x1310) },
11107 + /* SupraExpress 33.6 Data/Fax PnP modem */
11108 + { ISAPNP_VENDOR('S', 'U', 'P'), ISAPNP_DEVICE(0x1421) },
11109 + /* SupraExpress 33.6 Data/Fax PnP modem */
11110 + { ISAPNP_VENDOR('S', 'U', 'P'), ISAPNP_DEVICE(0x1590) },
11111 + /* SupraExpress 33.6 Data/Fax PnP modem */
11112 + { ISAPNP_VENDOR('S', 'U', 'P'), ISAPNP_DEVICE(0x1760) },
11113 + /* Phoebe Micro */
11114 + /* Phoebe Micro 33.6 Data Fax 1433VQH Plug & Play */
11115 + { ISAPNP_VENDOR('T', 'E', 'X'), ISAPNP_DEVICE(0x0011) },
11116 + /* Archtek America Corp. */
11117 + /* Archtek SmartLink Modem 3334BT Plug & Play */
11118 + { ISAPNP_VENDOR('U', 'A', 'C'), ISAPNP_DEVICE(0x000F) },
11120 + /* Gateway Telepath IIvi 33.6 */
11121 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x0000) },
11122 + /* Sportster Vi 14.4 PnP FAX Voicemail */
11123 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x0004) },
11124 + /* U.S. Robotics 33.6K Voice INT PnP */
11125 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x0006) },
11126 + /* U.S. Robotics 33.6K Voice EXT PnP */
11127 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x0007) },
11128 + /* U.S. Robotics 33.6K Voice INT PnP */
11129 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x2002) },
11130 + /* U.S. Robotics 56K Voice INT PnP */
11131 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x2070) },
11132 + /* U.S. Robotics 56K Voice EXT PnP */
11133 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x2080) },
11134 + /* U.S. Robotics 56K FAX INT */
11135 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x3031) },
11136 + /* U.S. Robotics 56K Voice INT PnP */
11137 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x3070) },
11138 + /* U.S. Robotics 56K Voice EXT PnP */
11139 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x3080) },
11140 + /* U.S. Robotics 56K Voice INT PnP */
11141 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x3090) },
11142 + /* U.S. Robotics 56K Message */
11143 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x9100) },
11144 + /* U.S. Robotics 56K FAX EXT PnP*/
11145 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x9160) },
11146 + /* U.S. Robotics 56K FAX INT PnP*/
11147 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x9170) },
11148 + /* U.S. Robotics 56K Voice EXT PnP*/
11149 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x9180) },
11150 + /* U.S. Robotics 56K Voice INT PnP*/
11151 + { ISAPNP_VENDOR('U', 'S', 'R'), ISAPNP_DEVICE(0x9190) },
11155 +static inline void avoid_irq_share(struct pci_dev *dev)
11157 + int i, map = 0x1FF8;
11158 + struct serial_state *state = rs_table;
11159 + struct isapnp_irq *irq;
11160 + struct isapnp_resources *res = dev->sysdata;
11162 + for (i = 0; i < NR_PORTS; i++) {
11163 + if (state->type != PORT_UNKNOWN)
11164 + clear_bit(state->irq, &map);
11168 + for ( ; res; res = res->alt)
11169 + for(irq = res->irq; irq; irq = irq->next)
11173 +static char *modem_names[] __devinitdata = {
11174 + "MODEM", "Modem", "modem", "FAX", "Fax", "fax",
11175 + "56K", "56k", "K56", "33.6", "28.8", "14.4",
11176 + "33,600", "28,800", "14,400", "33.600", "28.800", "14.400",
11177 + "33600", "28800", "14400", "V.90", "V.34", "V.32", 0
11180 +static int __devinit check_name(char *name)
11182 + char **tmp = modem_names;
11185 + if (strstr(name, *tmp))
11192 +static inline int check_compatible_id(struct pci_dev *dev)
11195 + for (i = 0; i < DEVICE_COUNT_COMPATIBLE; i++)
11196 + if ((dev->vendor_compatible[i] ==
11197 + ISAPNP_VENDOR('P', 'N', 'P')) &&
11198 + (swab16(dev->device_compatible[i]) >= 0xc000) &&
11199 + (swab16(dev->device_compatible[i]) <= 0xdfff))
11205 + * Given a complete unknown ISA PnP device, try to use some heuristics to
11206 + * detect modems. Currently use such heuristic set:
11207 + * - dev->name or dev->bus->name must contain "modem" substring;
11208 + * - device must have only one IO region (8 byte long) with base adress
11209 + * 0x2e8, 0x3e8, 0x2f8 or 0x3f8.
11211 + * Such detection looks very ugly, but can detect at least some of numerous
11212 + * ISA PnP modems, alternatively we must hardcode all modems in pnp_devices[]
11215 +static int _INLINE_ serial_pnp_guess_board(struct pci_dev *dev,
11216 + struct pci_board *board)
11218 + struct isapnp_resources *res = (struct isapnp_resources *)dev->sysdata;
11219 + struct isapnp_resources *resa;
11221 + if (!(check_name(dev->name) || check_name(dev->bus->name)) &&
11222 + !(check_compatible_id(dev)))
11225 + if (!res || res->next)
11228 + for (resa = res->alt; resa; resa = resa->alt) {
11229 + struct isapnp_port *port;
11230 + for (port = res->port; port; port = port->next)
11231 + if ((port->size == 8) &&
11232 + ((port->min == 0x2f8) ||
11233 + (port->min == 0x3f8) ||
11234 + (port->min == 0x2e8) ||
11235 + (port->min == 0x3e8)))
11242 +static void __devinit probe_serial_pnp(void)
11244 + struct pci_dev *dev = NULL;
11245 + struct pnp_board *pnp_board;
11246 + struct pci_board board;
11248 +#ifdef SERIAL_DEBUG_PNP
11249 + printk("Entered probe_serial_pnp()\n");
11251 + if (!isapnp_present()) {
11252 +#ifdef SERIAL_DEBUG_PNP
11253 + printk("Leaving probe_serial_pnp() (no isapnp)\n");
11258 + isapnp_for_each_dev(dev) {
11262 + memset(&board, 0, sizeof(board));
11263 + board.flags = SPCI_FL_BASE0 | SPCI_FL_PNPDEFAULT;
11264 + board.num_ports = 1;
11265 + board.base_baud = 115200;
11267 + for (pnp_board = pnp_devices; pnp_board->vendor; pnp_board++)
11268 + if ((dev->vendor == pnp_board->vendor) &&
11269 + (dev->device == pnp_board->device))
11272 + if (pnp_board->vendor) {
11273 + /* Special case that's more efficient to hardcode */
11274 + if ((pnp_board->vendor == ISAPNP_VENDOR('A', 'K', 'Y') &&
11275 + pnp_board->device == ISAPNP_DEVICE(0x1021)))
11276 + board.flags |= SPCI_FL_NO_SHIRQ;
11278 + if (serial_pnp_guess_board(dev, &board))
11282 + if (board.flags & SPCI_FL_NO_SHIRQ)
11283 + avoid_irq_share(dev);
11284 + start_pci_pnp_board(dev, &board);
11287 +#ifdef SERIAL_DEBUG_PNP
11288 + printk("Leaving probe_serial_pnp() (probe finished)\n");
11293 +#endif /* ENABLE_SERIAL_PNP */
11296 + * The serial driver boot-time initialization code!
11298 +static int __init rs_init(void)
11301 + struct serial_state * state;
11303 + init_bh(SERIAL_BH, do_serial_bh);
11304 + init_timer(&serial_timer);
11305 + serial_timer.function = rs_timer;
11306 + mod_timer(&serial_timer, jiffies + RS_STROBE_TIME);
11308 + for (i = 0; i < NR_IRQS; i++) {
11309 + IRQ_ports[i] = 0;
11310 + IRQ_timeout[i] = 0;
11311 +#ifdef CONFIG_SERIAL_MULTIPORT
11312 + memset(&rs_multiport[i], 0,
11313 + sizeof(struct rs_multiport_struct));
11316 + show_serial_version();
11318 + /* Initialize the tty_driver structure */
11320 + memset(&serial_driver, 0, sizeof(struct tty_driver));
11321 + serial_driver.magic = TTY_DRIVER_MAGIC;
11322 +#if (LINUX_VERSION_CODE > 0x20100)
11323 + serial_driver.driver_name = "serial";
11325 +#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
11326 + serial_driver.name = "tts/%d";
11328 + serial_driver.name = "ttyS";
11330 + serial_driver.major = TTY_MAJOR;
11331 + serial_driver.minor_start = 64 + SERIAL_DEV_OFFSET;
11332 + serial_driver.name_base = SERIAL_DEV_OFFSET;
11333 + serial_driver.num = NR_PORTS;
11334 + serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
11335 + serial_driver.subtype = SERIAL_TYPE_NORMAL;
11336 + serial_driver.init_termios = tty_std_termios;
11337 + serial_driver.init_termios.c_cflag =
11338 + B9600 | CS8 | CREAD | HUPCL | CLOCAL;
11339 + serial_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
11340 + serial_driver.refcount = &serial_refcount;
11341 + serial_driver.table = serial_table;
11342 + serial_driver.termios = serial_termios;
11343 + serial_driver.termios_locked = serial_termios_locked;
11345 + serial_driver.open = rs_open;
11346 + serial_driver.close = rs_close;
11347 + serial_driver.write = rs_write;
11348 + serial_driver.put_char = rs_put_char;
11349 + serial_driver.flush_chars = rs_flush_chars;
11350 + serial_driver.write_room = rs_write_room;
11351 + serial_driver.chars_in_buffer = rs_chars_in_buffer;
11352 + serial_driver.flush_buffer = rs_flush_buffer;
11353 + serial_driver.ioctl = rs_ioctl;
11354 + serial_driver.throttle = rs_throttle;
11355 + serial_driver.unthrottle = rs_unthrottle;
11356 + serial_driver.set_termios = rs_set_termios;
11357 + serial_driver.stop = rs_stop;
11358 + serial_driver.start = rs_start;
11359 + serial_driver.hangup = rs_hangup;
11360 +#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */
11361 + serial_driver.break_ctl = rs_break;
11363 +#if (LINUX_VERSION_CODE >= 131343)
11364 + serial_driver.send_xchar = rs_send_xchar;
11365 + serial_driver.wait_until_sent = rs_wait_until_sent;
11366 + serial_driver.read_proc = rs_read_proc;
11370 + * The callout device is just like normal device except for
11371 + * major number and the subtype code.
11373 + callout_driver = serial_driver;
11374 +#if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS))
11375 + callout_driver.name = "cua/%d";
11377 + callout_driver.name = "cua";
11379 + callout_driver.major = TTYAUX_MAJOR;
11380 + callout_driver.subtype = SERIAL_TYPE_CALLOUT;
11381 +#if (LINUX_VERSION_CODE >= 131343)
11382 + callout_driver.read_proc = 0;
11383 + callout_driver.proc_entry = 0;
11386 + if (tty_register_driver(&serial_driver))
11387 + panic("Couldn't register serial driver\n");
11388 + if (tty_register_driver(&callout_driver))
11389 + panic("Couldn't register callout driver\n");
11391 + for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) {
11392 + state->magic = SSTATE_MAGIC;
11394 + state->type = PORT_UNKNOWN;
11395 + state->custom_divisor = 0;
11396 + state->close_delay = 5*HZ/10;
11397 + state->closing_wait = 30*HZ;
11398 + state->callout_termios = callout_driver.init_termios;
11399 + state->normal_termios = serial_driver.init_termios;
11400 + state->icount.cts = state->icount.dsr =
11401 + state->icount.rng = state->icount.dcd = 0;
11402 + state->icount.rx = state->icount.tx = 0;
11403 + state->icount.frame = state->icount.parity = 0;
11404 + state->icount.overrun = state->icount.brk = 0;
11405 + state->irq = irq_cannonicalize(state->irq);
11407 + state->io_type = SERIAL_IO_HUB6;
11408 + if (state->port && check_region(state->port,8))
11411 + if ((state->flags & ASYNC_BOOT_ONLYMCA) && !MCA_bus)
11414 + if (state->flags & ASYNC_BOOT_AUTOCONF)
11415 + autoconfig(state);
11417 + for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) {
11418 + if (state->type == PORT_UNKNOWN)
11420 + if ( (state->flags & ASYNC_BOOT_AUTOCONF)
11421 + && (state->flags & ASYNC_AUTO_IRQ)
11422 + && (state->port != 0 || state->iomem_base != 0))
11423 + state->irq = detect_uart_irq(state);
11424 + if (state->io_type == SERIAL_IO_MEM) {
11425 + printk(KERN_INFO"ttyS%02d%s at 0x%p (irq = %d) is a %s\n",
11426 + state->line + SERIAL_DEV_OFFSET,
11427 + (state->flags & ASYNC_FOURPORT) ? " FourPort" : "",
11428 + state->iomem_base, state->irq,
11429 + uart_config[state->type].name);
11432 + printk(KERN_INFO "ttyS%02d%s at 0x%04lx (irq = %d) is a %s\n",
11433 + state->line + SERIAL_DEV_OFFSET,
11434 + (state->flags & ASYNC_FOURPORT) ? " FourPort" : "",
11435 + state->port, state->irq,
11436 + uart_config[state->type].name);
11438 + tty_register_devfs(&serial_driver, 0,
11439 + serial_driver.minor_start + state->line);
11440 + tty_register_devfs(&callout_driver, 0,
11441 + callout_driver.minor_start + state->line);
11443 +#ifdef ENABLE_SERIAL_PCI
11444 + probe_serial_pci();
11446 +#ifdef ENABLE_SERIAL_PNP
11447 + probe_serial_pnp();
11453 + * This is for use by architectures that know their serial console
11454 + * attributes only at run time. Not to be invoked after rs_init().
11456 +int __init early_serial_setup(struct serial_struct *req)
11458 + int i = req->line;
11460 + if (i >= NR_IRQS)
11462 + rs_table[i].magic = 0;
11463 + rs_table[i].baud_base = req->baud_base;
11464 + rs_table[i].port = req->port;
11465 + if (HIGH_BITS_OFFSET)
11466 + rs_table[i].port += (unsigned long) req->port_high <<
11467 + HIGH_BITS_OFFSET;
11468 + rs_table[i].irq = req->irq;
11469 + rs_table[i].flags = req->flags;
11470 + rs_table[i].close_delay = req->close_delay;
11471 + rs_table[i].io_type = req->io_type;
11472 + rs_table[i].hub6 = req->hub6;
11473 + rs_table[i].iomem_base = req->iomem_base;
11474 + rs_table[i].iomem_reg_shift = req->iomem_reg_shift;
11475 + rs_table[i].type = req->type;
11476 + rs_table[i].xmit_fifo_size = req->xmit_fifo_size;
11477 + rs_table[i].custom_divisor = req->custom_divisor;
11478 + rs_table[i].closing_wait = req->closing_wait;
11483 + * register_serial and unregister_serial allows for 16x50 serial ports to be
11484 + * configured at run-time, to support PCMCIA modems.
11488 + * register_serial - configure a 16x50 serial port at runtime
11489 + * @req: request structure
11491 + * Configure the serial port specified by the request. If the
11492 + * port exists and is in use an error is returned. If the port
11493 + * is not currently in the table it is added.
11495 + * The port is then probed and if neccessary the IRQ is autodetected
11496 + * If this fails an error is returned.
11498 + * On success the port is ready to use and the line number is returned.
11501 +int register_serial(struct serial_struct *req)
11504 + unsigned long flags;
11505 + struct serial_state *state;
11506 + struct async_struct *info;
11507 + unsigned long port;
11509 + port = req->port;
11510 + if (HIGH_BITS_OFFSET)
11511 + port += (unsigned long) req->port_high << HIGH_BITS_OFFSET;
11513 + save_flags(flags); cli();
11514 + for (i = 0; i < NR_PORTS; i++) {
11515 + if ((rs_table[i].port == port) &&
11516 + (rs_table[i].iomem_base == req->iomem_base))
11520 + if (i == NR_PORTS) {
11521 + for (i = 4; i < NR_PORTS; i++)
11522 + if ((rs_table[i].type == PORT_UNKNOWN) &&
11523 + (rs_table[i].count == 0))
11527 + if (i == NR_PORTS) {
11528 + for (i = 0; i < NR_PORTS; i++)
11529 + if ((rs_table[i].type == PORT_UNKNOWN) &&
11530 + (rs_table[i].count == 0))
11533 + if (i == NR_PORTS) {
11534 + restore_flags(flags);
11537 + state = &rs_table[i];
11538 + if (rs_table[i].count) {
11539 + restore_flags(flags);
11540 + printk("Couldn't configure serial #%d (port=%ld,irq=%d): "
11541 + "device already open\n", i, port, req->irq);
11544 + state->irq = req->irq;
11545 + state->port = port;
11546 + state->flags = req->flags;
11547 + state->io_type = req->io_type;
11548 + state->iomem_base = req->iomem_base;
11549 + state->iomem_reg_shift = req->iomem_reg_shift;
11550 + if (req->baud_base)
11551 + state->baud_base = req->baud_base;
11552 + if ((info = state->info) != NULL) {
11553 + info->port = port;
11554 + info->flags = req->flags;
11555 + info->io_type = req->io_type;
11556 + info->iomem_base = req->iomem_base;
11557 + info->iomem_reg_shift = req->iomem_reg_shift;
11559 + autoconfig(state);
11560 + if (state->type == PORT_UNKNOWN) {
11561 + restore_flags(flags);
11562 + printk("register_serial(): autoconfig failed\n");
11565 + restore_flags(flags);
11567 + if ((state->flags & ASYNC_AUTO_IRQ) && CONFIGURED_SERIAL_PORT(state))
11568 + state->irq = detect_uart_irq(state);
11570 + printk(KERN_INFO "ttyS%02d at %s 0x%04lx (irq = %d) is a %s\n",
11571 + state->line + SERIAL_DEV_OFFSET,
11572 + state->iomem_base ? "iomem" : "port",
11573 + state->iomem_base ? (unsigned long)state->iomem_base :
11574 + state->port, state->irq, uart_config[state->type].name);
11575 + tty_register_devfs(&serial_driver, 0,
11576 + serial_driver.minor_start + state->line);
11577 + tty_register_devfs(&callout_driver, 0,
11578 + callout_driver.minor_start + state->line);
11579 + return state->line + SERIAL_DEV_OFFSET;
11583 + * unregister_serial - deconfigure a 16x50 serial port
11584 + * @line: line to deconfigure
11586 + * The port specified is deconfigured and its resources are freed. Any
11587 + * user of the port is disconnected as if carrier was dropped. Line is
11588 + * the port number returned by register_serial().
11591 +void unregister_serial(int line)
11593 + unsigned long flags;
11594 + struct serial_state *state = &rs_table[line];
11596 + save_flags(flags); cli();
11597 + if (state->info && state->info->tty)
11598 + tty_hangup(state->info->tty);
11599 + state->type = PORT_UNKNOWN;
11600 + printk(KERN_INFO "ttyS%02d unloaded\n", state->line);
11601 + /* These will be hidden, because they are devices that will no longer
11602 + * be available to the system. (ie, PCMCIA modems, once ejected)
11604 + tty_unregister_devfs(&serial_driver,
11605 + serial_driver.minor_start + state->line);
11606 + tty_unregister_devfs(&callout_driver,
11607 + callout_driver.minor_start + state->line);
11608 + restore_flags(flags);
11611 +static void __exit rs_fini(void)
11613 + unsigned long flags;
11616 + struct async_struct *info;
11618 + /* printk("Unloading %s: version %s\n", serial_name, serial_version); */
11619 + del_timer_sync(&serial_timer);
11620 + save_flags(flags); cli();
11621 + remove_bh(SERIAL_BH);
11622 + if ((e1 = tty_unregister_driver(&serial_driver)))
11623 + printk("serial: failed to unregister serial driver (%d)\n",
11625 + if ((e2 = tty_unregister_driver(&callout_driver)))
11626 + printk("serial: failed to unregister callout driver (%d)\n",
11628 + restore_flags(flags);
11630 + for (i = 0; i < NR_PORTS; i++) {
11631 + if ((info = rs_table[i].info)) {
11632 + rs_table[i].info = NULL;
11635 + if ((rs_table[i].type != PORT_UNKNOWN) && rs_table[i].port) {
11636 +#ifdef CONFIG_SERIAL_RSA
11637 + if (rs_table[i].type == PORT_RSA)
11638 + release_region(rs_table[i].port +
11639 + UART_RSA_BASE, 16);
11642 + release_region(rs_table[i].port, 8);
11644 +#if defined(ENABLE_SERIAL_PCI) || defined(ENABLE_SERIAL_PNP)
11645 + if (rs_table[i].iomem_base)
11646 + iounmap(rs_table[i].iomem_base);
11649 +#if defined(ENABLE_SERIAL_PCI) || defined(ENABLE_SERIAL_PNP)
11650 + for (i=0; i < NR_PCI_BOARDS; i++) {
11651 + struct pci_board_inst *brd = &serial_pci_board[i];
11653 + if (serial_pci_board[i].dev == 0)
11655 + if (brd->board.init_fn)
11656 + (brd->board.init_fn)(brd->dev, &brd->board, 0);
11657 + if (DEACTIVATE_FUNC(brd->dev))
11658 + (DEACTIVATE_FUNC(brd->dev))(brd->dev);
11662 + unsigned long pg = (unsigned long) tmp_buf;
11667 +#ifdef ENABLE_SERIAL_PCI
11668 + if (serial_pci_driver.name[0])
11669 + pci_unregister_driver (&serial_pci_driver);
11673 +module_init(rs_init);
11674 +module_exit(rs_fini);
11675 +MODULE_DESCRIPTION("Standard/generic (dumb) serial driver");
11676 +MODULE_AUTHOR("Theodore Ts'o <tytso@mit.edu>");
11677 +MODULE_LICENSE("GPL");
11681 + * ------------------------------------------------------------
11682 + * Serial console driver
11683 + * ------------------------------------------------------------
11685 +#ifdef CONFIG_SERIAL_CONSOLE
11687 +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
11689 +static struct async_struct async_sercons;
11692 + * Wait for transmitter & holding register to empty
11694 +static inline void wait_for_xmitr(struct async_struct *info)
11696 + unsigned int status, tmout = 1000000;
11699 + status = serial_in(info, UART_LSR);
11701 + if (status & UART_LSR_BI)
11702 + lsr_break_flag = UART_LSR_BI;
11704 + if (--tmout == 0)
11706 + } while((status & BOTH_EMPTY) != BOTH_EMPTY);
11708 + /* Wait for flow control if necessary */
11709 + if (info->flags & ASYNC_CONS_FLOW) {
11711 + while (--tmout &&
11712 + ((serial_in(info, UART_MSR) & UART_MSR_CTS) == 0));
11718 + * Print a string to the serial port trying not to disturb
11719 + * any possible real use of the port...
11721 + * The console must be locked when we get here.
11723 +static void serial_console_write(struct console *co, const char *s,
11726 + static struct async_struct *info = &async_sercons;
11731 + * First save the IER then disable the interrupts
11733 + ier = serial_in(info, UART_IER);
11734 + serial_out(info, UART_IER, 0x00);
11737 + * Now, do each character
11739 + for (i = 0; i < count; i++, s++) {
11740 + wait_for_xmitr(info);
11743 + * Send the character out.
11744 + * If a LF, also do CR...
11746 + serial_out(info, UART_TX, *s);
11748 + wait_for_xmitr(info);
11749 + serial_out(info, UART_TX, 13);
11754 + * Finally, Wait for transmitter & holding register to empty
11755 + * and restore the IER
11757 + wait_for_xmitr(info);
11758 + serial_out(info, UART_IER, ier);
11761 +static kdev_t serial_console_device(struct console *c)
11763 + return MKDEV(TTY_MAJOR, 64 + c->index);
11767 + * Setup initial baud/bits/parity/flow control. We do two things here:
11768 + * - construct a cflag setting for the first rs_open()
11769 + * - initialize the serial port
11770 + * Return non-zero if we didn't find a serial port.
11772 +static int __init serial_console_setup(struct console *co, char *options)
11774 + static struct async_struct *info;
11775 + struct serial_state *state;
11779 + int parity = 'n';
11781 + int cflag = CREAD | HUPCL | CLOCAL;
11786 + baud = simple_strtoul(options, NULL, 10);
11788 + while(*s >= '0' && *s <= '9')
11790 + if (*s) parity = *s++;
11791 + if (*s) bits = *s++ - '0';
11792 + if (*s) doflow = (*s++ == 'r');
11796 + * Now construct a cflag setting.
11818 + cflag |= B115200;
11824 + * Set this to a sane value to prevent a divide error
11839 + case 'o': case 'O':
11842 + case 'e': case 'E':
11846 + co->cflag = cflag;
11849 + * Divisor, bytesize and parity
11851 + state = rs_table + co->index;
11853 + state->flags |= ASYNC_CONS_FLOW;
11854 + info = &async_sercons;
11855 + info->magic = SERIAL_MAGIC;
11856 + info->state = state;
11857 + info->port = state->port;
11858 + info->flags = state->flags;
11859 +#ifdef CONFIG_HUB6
11860 + info->hub6 = state->hub6;
11862 + info->io_type = state->io_type;
11863 + info->iomem_base = state->iomem_base;
11864 + info->iomem_reg_shift = state->iomem_reg_shift;
11865 + quot = state->baud_base / baud;
11866 + cval = cflag & (CSIZE | CSTOPB);
11867 +#if defined(__powerpc__) || defined(__alpha__)
11869 +#else /* !__powerpc__ && !__alpha__ */
11871 +#endif /* !__powerpc__ && !__alpha__ */
11872 + if (cflag & PARENB)
11873 + cval |= UART_LCR_PARITY;
11874 + if (!(cflag & PARODD))
11875 + cval |= UART_LCR_EPAR;
11878 + * Disable UART interrupts, set DTR and RTS high
11881 + serial_out(info, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */
11882 + serial_out(info, UART_DLL, quot & 0xff); /* LS of divisor */
11883 + serial_out(info, UART_DLM, quot >> 8); /* MS of divisor */
11884 + serial_out(info, UART_LCR, cval); /* reset DLAB */
11885 + serial_out(info, UART_IER, 0);
11886 + serial_out(info, UART_MCR, UART_MCR_DTR | UART_MCR_RTS);
11889 + * If we read 0xff from the LSR, there is no UART here.
11891 + if (serial_in(info, UART_LSR) == 0xff)
11897 +static struct console sercons = {
11899 + write: serial_console_write,
11900 + device: serial_console_device,
11901 + setup: serial_console_setup,
11902 + flags: CON_PRINTBUFFER,
11907 + * Register console.
11909 +void __init serial_console_init(void)
11911 + register_console(&sercons);
11917 + compile-command: "gcc -D__KERNEL__ -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -march=i586 -DMODULE -DMODVERSIONS -include ../../include/linux/modversions.h -DEXPORT_SYMTAB -c serial.c"
11920 diff -urN linux.old/drivers/char/ticfg/Makefile linux.dev/drivers/char/ticfg/Makefile
11921 --- linux.old/drivers/char/ticfg/Makefile 1970-01-01 01:00:00.000000000 +0100
11922 +++ linux.dev/drivers/char/ticfg/Makefile 2005-11-10 01:10:46.051587500 +0100
11925 +O_TARGET := ticfg.o
11927 +obj-$(CONFIG_AR7_ADAM2) := adam2_env.o
11929 +include $(TOPDIR)/Rules.make
11930 diff -urN linux.old/drivers/char/ticfg/adam2_env.c linux.dev/drivers/char/ticfg/adam2_env.c
11931 --- linux.old/drivers/char/ticfg/adam2_env.c 1970-01-01 01:00:00.000000000 +0100
11932 +++ linux.dev/drivers/char/ticfg/adam2_env.c 2005-11-10 01:10:46.051587500 +0100
11934 +#include <linux/types.h>
11935 +#include <linux/errno.h>
11936 +#include <linux/module.h>
11937 +#include <linux/kernel.h>
11938 +#include <linux/proc_fs.h>
11939 +#include <linux/fcntl.h>
11940 +#include <linux/init.h>
11942 +#include <asm/ar7/adam2_env.h>
11944 +#undef ADAM2_ENV_DEBUG
11946 +#ifdef ADAM2_ENV_DEBUG
11947 +#define DPRINTK(args...) do { printk(args); } while(0);
11949 +#define DPRINTK(args...) do { } while(0);
11952 +#define ADAM2_ENV_DIR "ticfg"
11953 +#define ADAM2_ENV_NAME "env"
11955 +static struct proc_dir_entry *adam2_env_proc_dir;
11956 +static struct proc_dir_entry *adam2_env_proc_ent;
11959 +adam2_proc_read_env(char *page, char **start, off_t pos, int count,
11960 + int *eof, void *data)
11969 + for (env = prom_iterenv(0); env; env = prom_iterenv(env)) {
11971 + /* XXX check for page len */
11972 + len += sprintf(page + len, "%s\t%s\n",
11973 + env->name, env->val);
11982 +adam2_env_init(void)
11985 + DPRINTK("%s\n", __FUNCTION__);
11987 + adam2_env_proc_dir = proc_mkdir(ADAM2_ENV_DIR, NULL);
11988 + if (!adam2_env_proc_dir) {
11989 + printk(KERN_ERR "%s: Unable to create /proc/%s entry\n",
11990 + __FUNCTION__, ADAM2_ENV_DIR);
11994 + adam2_env_proc_ent =
11995 + create_proc_entry(ADAM2_ENV_NAME, 0444, adam2_env_proc_dir);
11996 + if (!adam2_env_proc_ent) {
11997 + printk(KERN_ERR "%s: Unable to create /proc/%s/%s entry\n",
11998 + __FUNCTION__, ADAM2_ENV_DIR, ADAM2_ENV_NAME);
11999 + remove_proc_entry(ADAM2_ENV_DIR, NULL);
12002 + adam2_env_proc_ent->read_proc = adam2_proc_read_env;
12009 +adam2_env_cleanup(void)
12011 + remove_proc_entry(ADAM2_ENV_NAME, adam2_env_proc_dir);
12012 + remove_proc_entry(ADAM2_ENV_DIR, NULL);
12015 +module_init(adam2_env_init);
12016 +module_exit(adam2_env_cleanup);
12018 +MODULE_LICENSE("GPL");
12019 diff -urN linux.old/include/asm-mips/addrspace.h linux.dev/include/asm-mips/addrspace.h
12020 --- linux.old/include/asm-mips/addrspace.h 2002-11-29 00:53:15.000000000 +0100
12021 +++ linux.dev/include/asm-mips/addrspace.h 2005-11-10 01:14:16.400733500 +0100
12023 #ifndef __ASM_MIPS_ADDRSPACE_H
12024 #define __ASM_MIPS_ADDRSPACE_H
12026 +#include <linux/config.h>
12029 * Configure language
12031 @@ -102,4 +104,11 @@
12032 #define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
12033 #define PHYS_TO_XKPHYS(cm,a) (0x8000000000000000 | ((cm)<<59) | (a))
12035 +#ifdef CONFIG_AR7_MEMORY
12036 +#define PHYS_OFFSET ((unsigned long)(CONFIG_AR7_MEMORY))
12038 +#define PHYS_OFFSET (0)
12040 +#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
12042 #endif /* __ASM_MIPS_ADDRSPACE_H */
12043 diff -urN linux.old/include/asm-mips/ar7/adam2_env.h linux.dev/include/asm-mips/ar7/adam2_env.h
12044 --- linux.old/include/asm-mips/ar7/adam2_env.h 1970-01-01 01:00:00.000000000 +0100
12045 +++ linux.dev/include/asm-mips/ar7/adam2_env.h 2005-11-10 01:10:46.067588500 +0100
12047 +#ifndef _INCLUDE_ASM_AR7_ADAM2_ENV_H_
12048 +#define _INCLUDE_ASM_AR7_ADAM2_ENV_H_
12050 +/* Environment variable */
12056 +char *prom_getenv(char *);
12057 +t_env_var *prom_iterenv(t_env_var *);
12059 +#endif /* _INCLUDE_ASM_AR7_ADAM2_ENV_H_ */
12060 diff -urN linux.old/include/asm-mips/ar7/ar7.h linux.dev/include/asm-mips/ar7/ar7.h
12061 --- linux.old/include/asm-mips/ar7/ar7.h 1970-01-01 01:00:00.000000000 +0100
12062 +++ linux.dev/include/asm-mips/ar7/ar7.h 2005-11-10 01:10:46.067588500 +0100
12066 + * Copyright (C) $Date$ $Author$
12068 + * This program is free software; you can redistribute it and/or modify
12069 + * it under the terms of the GNU General Public License as published by
12070 + * the Free Software Foundation; either version 2 of the License, or
12071 + * (at your option) any later version.
12073 + * This program is distributed in the hope that it will be useful,
12074 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12075 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12076 + * GNU General Public License for more details.
12078 + * You should have received a copy of the GNU General Public License
12079 + * along with this program; if not, write to the Free Software
12080 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
12087 +#include <asm/addrspace.h>
12088 +#include <linux/config.h>
12090 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(CONFIG_AR7_MEMORY))
12092 +#define AR7_UART0_REGS_BASE (KSEG1ADDR(0x08610E00))
12093 +#define AR7_UART1_REGS_BASE (KSEG1ADDR(0x08610F00))
12094 +#define AR7_BASE_BAUD ( 3686400 / 16 )
12097 diff -urN linux.old/include/asm-mips/ar7/avalanche_intc.h linux.dev/include/asm-mips/ar7/avalanche_intc.h
12098 --- linux.old/include/asm-mips/ar7/avalanche_intc.h 1970-01-01 01:00:00.000000000 +0100
12099 +++ linux.dev/include/asm-mips/ar7/avalanche_intc.h 2005-11-10 01:10:46.067588500 +0100
12102 + * Nitin Dhingra, iamnd@ti.com
12103 + * Copyright (C) 2000 Texas Instruments Inc.
12106 + * ########################################################################
12108 + * This program is free software; you can distribute it and/or modify it
12109 + * under the terms of the GNU General Public License (Version 2) as
12110 + * published by the Free Software Foundation.
12112 + * This program is distributed in the hope it will be useful, but WITHOUT
12113 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12114 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12115 + * for more details.
12117 + * You should have received a copy of the GNU General Public License along
12118 + * with this program; if not, write to the Free Software Foundation, Inc.,
12119 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
12121 + * ########################################################################
12123 + * Defines of the Sead board specific address-MAP, registers, etc.
12126 +#ifndef _AVALANCHE_INTC_H
12127 +#define _AVALANCHE_INTC_H
12129 +#include <linux/config.h>
12133 +#define KSEG1_BASE 0xA0000000
12134 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
12135 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
12136 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
12137 +#define AVALANCHE_INTC_BASE PHYS_TO_K1(0x08612400)
12141 +#define MIPS_EXCEPTION_OFFSET 8
12143 +/******************************************************************************
12144 + Avalanche Interrupt number
12145 +******************************************************************************/
12146 +#define AVINTNUM(x) ((x) - MIPS_EXCEPTION_OFFSET)
12148 +/*******************************************************************************
12149 +*Linux Interrupt number
12150 +*******************************************************************************/
12151 +#define LNXINTNUM(x)((x) + MIPS_EXCEPTION_OFFSET)
12155 +#define AVALANCHE_INT_END_PRIMARY (40 + MIPS_EXCEPTION_OFFSET)
12156 +#define AVALANCHE_INT_END_SECONDARY (32 + MIPS_EXCEPTION_OFFSET)
12158 +#define AVALANCHE_INT_END_PRIMARY_REG1 (31 + MIPS_EXCEPTION_OFFSET)
12159 +#define AVALANCHE_INT_END_PRIMARY_REG2 (39 + MIPS_EXCEPTION_OFFSET)
12161 +#define AVALANCHE_INTC_END (AVINTNUM(AVALANCHE_INT_END_PRIMARY) + \
12162 + AVINTNUM(AVALANCHE_INT_END_SECONDARY) + \
12163 + MIPS_EXCEPTION_OFFSET)
12165 +#if defined(CONFIG_AR7_VLYNQ)
12166 +#define AVALANCHE_INT_END_LOW_VLYNQ (AVALANCHE_INTC_END + 32)
12167 +#define AVALANCHE_INT_END_VLYNQ (AVALANCHE_INTC_END + 32 * CONFIG_AR7_VLYNQ_PORTS)
12168 +#define AVALANCHE_INT_END AVALANCHE_INT_END_VLYNQ
12170 +#define AVALANCHE_INT_END AVALANCHE_INTC_END
12175 + * Avalanche interrupt controller register base (primary)
12177 +#define AVALANCHE_ICTRL_REGS_BASE AVALANCHE_INTC_BASE
12179 +/******************************************************************************
12180 + * Avalanche exception controller register base (secondary)
12181 + ******************************************************************************/
12182 +#define AVALANCHE_ECTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x80)
12185 +/******************************************************************************
12186 + * Avalanche Interrupt pacing register base (secondary)
12187 + ******************************************************************************/
12188 +#define AVALANCHE_IPACE_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0xA0)
12192 +/******************************************************************************
12193 + * Avalanche Interrupt Channel Control register base
12194 + *****************************************************************************/
12195 +#define AVALANCHE_CHCTRL_REGS_BASE (AVALANCHE_ICTRL_REGS_BASE + 0x200)
12198 +struct avalanche_ictrl_regs /* Avalanche Interrupt control registers */
12200 + volatile unsigned long intsr1; /* Interrupt Status/Set Register 1 0x00 */
12201 + volatile unsigned long intsr2; /* Interrupt Status/Set Register 2 0x04 */
12202 + volatile unsigned long unused1; /*0x08 */
12203 + volatile unsigned long unused2; /*0x0C */
12204 + volatile unsigned long intcr1; /* Interrupt Clear Register 1 0x10 */
12205 + volatile unsigned long intcr2; /* Interrupt Clear Register 2 0x14 */
12206 + volatile unsigned long unused3; /*0x18 */
12207 + volatile unsigned long unused4; /*0x1C */
12208 + volatile unsigned long intesr1; /* Interrupt Enable (Set) Register 1 0x20 */
12209 + volatile unsigned long intesr2; /* Interrupt Enable (Set) Register 2 0x24 */
12210 + volatile unsigned long unused5; /*0x28 */
12211 + volatile unsigned long unused6; /*0x2C */
12212 + volatile unsigned long intecr1; /* Interrupt Enable Clear Register 1 0x30 */
12213 + volatile unsigned long intecr2; /* Interrupt Enable Clear Register 2 0x34 */
12214 + volatile unsigned long unused7; /* 0x38 */
12215 + volatile unsigned long unused8; /* 0x3c */
12216 + volatile unsigned long pintir; /* Priority Interrupt Index Register 0x40 */
12217 + volatile unsigned long intmsr; /* Priority Interrupt Mask Index Reg 0x44 */
12218 + volatile unsigned long unused9; /* 0x48 */
12219 + volatile unsigned long unused10; /* 0x4C */
12220 + volatile unsigned long intpolr1; /* Interrupt Polarity Mask register 10x50 */
12221 + volatile unsigned long intpolr2; /* Interrupt Polarity Mask register 20x54 */
12222 + volatile unsigned long unused11; /* 0x58 */
12223 + volatile unsigned long unused12; /*0x5C */
12224 + volatile unsigned long inttypr1; /* Interrupt Type Mask register 10x60 */
12225 + volatile unsigned long inttypr2; /* Interrupt Type Mask register 20x64 */
12228 +struct avalanche_exctrl_regs /* Avalanche Exception control registers */
12230 + volatile unsigned long exsr; /* Exceptions Status/Set register 0x80 */
12231 + volatile unsigned long reserved; /*0x84 */
12232 + volatile unsigned long excr; /* Exceptions Clear Register 0x88 */
12233 + volatile unsigned long reserved1; /*0x8c */
12234 + volatile unsigned long exiesr; /* Exceptions Interrupt Enable (set) 0x90 */
12235 + volatile unsigned long reserved2; /*0x94 */
12236 + volatile unsigned long exiecr; /* Exceptions Interrupt Enable(clear)0x98 */
12238 +struct avalanche_ipace_regs
12241 + volatile unsigned long ipacep; /* Interrupt pacing register 0xa0 */
12242 + volatile unsigned long ipacemap; /*Interrupt Pacing Map Register 0xa4 */
12243 + volatile unsigned long ipacemax; /*Interrupt Pacing Max Register 0xa8 */
12245 +struct avalanche_channel_int_number
12247 + volatile unsigned long cintnr0; /* Channel Interrupt Number Register0x200 */
12248 + volatile unsigned long cintnr1; /* Channel Interrupt Number Register0x204 */
12249 + volatile unsigned long cintnr2; /* Channel Interrupt Number Register0x208 */
12250 + volatile unsigned long cintnr3; /* Channel Interrupt Number Register0x20C */
12251 + volatile unsigned long cintnr4; /* Channel Interrupt Number Register0x210 */
12252 + volatile unsigned long cintnr5; /* Channel Interrupt Number Register0x214 */
12253 + volatile unsigned long cintnr6; /* Channel Interrupt Number Register0x218 */
12254 + volatile unsigned long cintnr7; /* Channel Interrupt Number Register0x21C */
12255 + volatile unsigned long cintnr8; /* Channel Interrupt Number Register0x220 */
12256 + volatile unsigned long cintnr9; /* Channel Interrupt Number Register0x224 */
12257 + volatile unsigned long cintnr10; /* Channel Interrupt Number Register0x228 */
12258 + volatile unsigned long cintnr11; /* Channel Interrupt Number Register0x22C */
12259 + volatile unsigned long cintnr12; /* Channel Interrupt Number Register0x230 */
12260 + volatile unsigned long cintnr13; /* Channel Interrupt Number Register0x234 */
12261 + volatile unsigned long cintnr14; /* Channel Interrupt Number Register0x238 */
12262 + volatile unsigned long cintnr15; /* Channel Interrupt Number Register0x23C */
12263 + volatile unsigned long cintnr16; /* Channel Interrupt Number Register0x240 */
12264 + volatile unsigned long cintnr17; /* Channel Interrupt Number Register0x244 */
12265 + volatile unsigned long cintnr18; /* Channel Interrupt Number Register0x248 */
12266 + volatile unsigned long cintnr19; /* Channel Interrupt Number Register0x24C */
12267 + volatile unsigned long cintnr20; /* Channel Interrupt Number Register0x250 */
12268 + volatile unsigned long cintnr21; /* Channel Interrupt Number Register0x254 */
12269 + volatile unsigned long cintnr22; /* Channel Interrupt Number Register0x358 */
12270 + volatile unsigned long cintnr23; /* Channel Interrupt Number Register0x35C */
12271 + volatile unsigned long cintnr24; /* Channel Interrupt Number Register0x260 */
12272 + volatile unsigned long cintnr25; /* Channel Interrupt Number Register0x264 */
12273 + volatile unsigned long cintnr26; /* Channel Interrupt Number Register0x268 */
12274 + volatile unsigned long cintnr27; /* Channel Interrupt Number Register0x26C */
12275 + volatile unsigned long cintnr28; /* Channel Interrupt Number Register0x270 */
12276 + volatile unsigned long cintnr29; /* Channel Interrupt Number Register0x274 */
12277 + volatile unsigned long cintnr30; /* Channel Interrupt Number Register0x278 */
12278 + volatile unsigned long cintnr31; /* Channel Interrupt Number Register0x27C */
12279 + volatile unsigned long cintnr32; /* Channel Interrupt Number Register0x280 */
12280 + volatile unsigned long cintnr33; /* Channel Interrupt Number Register0x284 */
12281 + volatile unsigned long cintnr34; /* Channel Interrupt Number Register0x288 */
12282 + volatile unsigned long cintnr35; /* Channel Interrupt Number Register0x28C */
12283 + volatile unsigned long cintnr36; /* Channel Interrupt Number Register0x290 */
12284 + volatile unsigned long cintnr37; /* Channel Interrupt Number Register0x294 */
12285 + volatile unsigned long cintnr38; /* Channel Interrupt Number Register0x298 */
12286 + volatile unsigned long cintnr39; /* Channel Interrupt Number Register0x29C */
12289 +struct avalanche_interrupt_line_to_channel
12291 + unsigned long int_line0; /* Start of primary interrupts */
12292 + unsigned long int_line1;
12293 + unsigned long int_line2;
12294 + unsigned long int_line3;
12295 + unsigned long int_line4;
12296 + unsigned long int_line5;
12297 + unsigned long int_line6;
12298 + unsigned long int_line7;
12299 + unsigned long int_line8;
12300 + unsigned long int_line9;
12301 + unsigned long int_line10;
12302 + unsigned long int_line11;
12303 + unsigned long int_line12;
12304 + unsigned long int_line13;
12305 + unsigned long int_line14;
12306 + unsigned long int_line15;
12307 + unsigned long int_line16;
12308 + unsigned long int_line17;
12309 + unsigned long int_line18;
12310 + unsigned long int_line19;
12311 + unsigned long int_line20;
12312 + unsigned long int_line21;
12313 + unsigned long int_line22;
12314 + unsigned long int_line23;
12315 + unsigned long int_line24;
12316 + unsigned long int_line25;
12317 + unsigned long int_line26;
12318 + unsigned long int_line27;
12319 + unsigned long int_line28;
12320 + unsigned long int_line29;
12321 + unsigned long int_line30;
12322 + unsigned long int_line31;
12323 + unsigned long int_line32;
12324 + unsigned long int_line33;
12325 + unsigned long int_line34;
12326 + unsigned long int_line35;
12327 + unsigned long int_line36;
12328 + unsigned long int_line37;
12329 + unsigned long int_line38;
12330 + unsigned long int_line39;
12334 +/* Interrupt Line #'s (Sangam peripherals) */
12336 +/*------------------------------*/
12337 +/* Sangam primary interrupts */
12338 +/*------------------------------*/
12340 +#define UNIFIED_SECONDARY_INTERRUPT 0
12341 +#define AVALANCHE_EXT_INT_0 1
12342 +#define AVALANCHE_EXT_INT_1 2
12343 +/* Line #3 Reserved */
12344 +/* Line #4 Reserved */
12345 +#define AVALANCHE_TIMER_0_INT 5
12346 +#define AVALANCHE_TIMER_1_INT 6
12347 +#define AVALANCHE_UART0_INT 7
12348 +#define AVALANCHE_UART1_INT 8
12349 +#define AVALANCHE_PDMA_INT0 9
12350 +#define AVALANCHE_PDMA_INT1 10
12351 +/* Line #11 Reserved */
12352 +/* Line #12 Reserved */
12353 +/* Line #13 Reserved */
12354 +/* Line #14 Reserved */
12355 +#define AVALANCHE_ATM_SAR_INT 15
12356 +/* Line #16 Reserved */
12357 +/* Line #17 Reserved */
12358 +/* Line #18 Reserved */
12359 +#define AVALANCHE_MAC0_INT 19
12360 +/* Line #20 Reserved */
12361 +#define AVALANCHE_VLYNQ0_INT 21
12362 +#define AVALANCHE_CODEC_WAKE_INT 22
12363 +/* Line #23 Reserved */
12364 +#define AVALANCHE_USB_INT 24
12365 +#define AVALANCHE_VLYNQ1_INT 25
12366 +/* Line #26 Reserved */
12367 +/* Line #27 Reserved */
12368 +#define AVALANCHE_MAC1_INT 28
12369 +#define AVALANCHE_I2CM_INT 29
12370 +#define AVALANCHE_PDMA_INT2 30
12371 +#define AVALANCHE_PDMA_INT3 31
12372 +/* Line #32 Reserved */
12373 +/* Line #33 Reserved */
12374 +/* Line #34 Reserved */
12375 +/* Line #35 Reserved */
12376 +/* Line #36 Reserved */
12377 +#define AVALANCHE_VDMA_VT_RX_INT 37
12378 +#define AVALANCHE_VDMA_VT_TX_INT 38
12379 +#define AVALANCHE_ADSLSS_INT 39
12381 +/*-----------------------------------*/
12382 +/* Sangam Secondary Interrupts */
12383 +/*-----------------------------------*/
12384 +#define PRIMARY_INTS 40
12386 +#define EMIF_INT (7 + PRIMARY_INTS)
12389 +extern void avalanche_int_set(int channel, int line);
12392 +#endif /* _AVALANCHE_INTC_H */
12393 diff -urN linux.old/include/asm-mips/ar7/avalanche_misc.h linux.dev/include/asm-mips/ar7/avalanche_misc.h
12394 --- linux.old/include/asm-mips/ar7/avalanche_misc.h 1970-01-01 01:00:00.000000000 +0100
12395 +++ linux.dev/include/asm-mips/ar7/avalanche_misc.h 2005-11-10 01:10:46.067588500 +0100
12397 +#ifndef _AVALANCHE_MISC_H_
12398 +#define _AVALANCHE_MISC_H_
12400 +typedef enum AVALANCHE_ERR_t
12402 + AVALANCHE_ERR_OK = 0, /* OK or SUCCESS */
12403 + AVALANCHE_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
12405 + /* Pointers and args */
12406 + AVALANCHE_ERR_INVARG = -2, /* Invaild argument to the call */
12407 + AVALANCHE_ERR_NULLPTR = -3, /* NULL pointer */
12408 + AVALANCHE_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
12410 + /* Memory issues */
12411 + AVALANCHE_ERR_ALLOC_FAIL = -10, /* allocation failed */
12412 + AVALANCHE_ERR_FREE_FAIL = -11, /* free failed */
12413 + AVALANCHE_ERR_MEM_CORRUPT = -12, /* corrupted memory */
12414 + AVALANCHE_ERR_BUF_LINK = -13, /* buffer linking failed */
12416 + /* Device issues */
12417 + AVALANCHE_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
12418 + AVALANCHE_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
12420 + AVALANCHE_ERR_INVID = -30 /* Invalid ID */
12424 +/*****************************************************************************
12425 + * Reset Control Module
12426 + *****************************************************************************/
12428 +typedef enum AVALANCHE_RESET_MODULE_tag
12430 + RESET_MODULE_UART0 = 0,
12431 + RESET_MODULE_UART1 = 1,
12432 + RESET_MODULE_I2C = 2,
12433 + RESET_MODULE_TIMER0 = 3,
12434 + RESET_MODULE_TIMER1 = 4,
12435 + RESET_MODULE_GPIO = 6,
12436 + RESET_MODULE_ADSLSS = 7,
12437 + RESET_MODULE_USBS = 8,
12438 + RESET_MODULE_SAR = 9,
12439 + RESET_MODULE_VDMA_VT = 11,
12440 + RESET_MODULE_FSER = 12,
12441 + RESET_MODULE_VLYNQ1 = 16,
12442 + RESET_MODULE_EMAC0 = 17,
12443 + RESET_MODULE_DMA = 18,
12444 + RESET_MODULE_BIST = 19,
12445 + RESET_MODULE_VLYNQ0 = 20,
12446 + RESET_MODULE_EMAC1 = 21,
12447 + RESET_MODULE_MDIO = 22,
12448 + RESET_MODULE_ADSLSS_DSP = 23,
12449 + RESET_MODULE_EPHY = 26
12450 +} AVALANCHE_RESET_MODULE_T;
12452 +typedef enum AVALANCHE_RESET_CTRL_tag
12456 +} AVALANCHE_RESET_CTRL_T;
12458 +typedef enum AVALANCHE_SYS_RST_MODE_tag
12460 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
12461 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
12462 +} AVALANCHE_SYS_RST_MODE_T;
12464 +typedef enum AVALANCHE_SYS_RESET_STATUS_tag
12466 + HARDWARE_RESET = 0,
12467 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
12469 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
12470 +} AVALANCHE_SYS_RESET_STATUS_T;
12472 +AVALANCHE_RESET_CTRL_T avalanche_get_reset_status(AVALANCHE_RESET_MODULE_T reset_module);
12473 +void avalanche_sys_reset(AVALANCHE_SYS_RST_MODE_T mode);
12474 +AVALANCHE_SYS_RESET_STATUS_T avalanche_get_sys_last_reset_status(void);
12476 +typedef int (*REMOTE_VLYNQ_DEV_RESET_CTRL_FN)(unsigned int reset_module, AVALANCHE_RESET_CTRL_T reset_ctrl);
12478 +/*****************************************************************************
12479 + * Power Control Module
12480 + *****************************************************************************/
12482 +typedef enum AVALANCHE_POWER_CTRL_tag
12484 + POWER_CTRL_POWER_UP = 0,
12485 + POWER_CTRL_POWER_DOWN
12486 +} AVALANCHE_POWER_CTRL_T;
12488 +typedef enum AVALANCHE_SYS_POWER_MODE_tag
12490 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
12491 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
12492 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
12493 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
12494 +} AVALANCHE_SYS_POWER_MODE_T;
12496 +void avalanche_power_ctrl(unsigned int power_module, AVALANCHE_POWER_CTRL_T power_ctrl);
12497 +AVALANCHE_POWER_CTRL_T avalanche_get_power_status(unsigned int power_module);
12498 +void avalanche_set_global_power_mode(AVALANCHE_SYS_POWER_MODE_T power_mode);
12499 +AVALANCHE_SYS_POWER_MODE_T avalanche_get_global_power_mode(void);
12501 +/*****************************************************************************
12503 + *****************************************************************************/
12505 +typedef enum AVALANCHE_WAKEUP_INTERRUPT_tag
12511 +} AVALANCHE_WAKEUP_INTERRUPT_T;
12513 +typedef enum TNETV1050_WAKEUP_CTRL_tag
12515 + WAKEUP_DISABLED = 0,
12517 +} AVALANCHE_WAKEUP_CTRL_T;
12519 +typedef enum TNETV1050_WAKEUP_POLARITY_tag
12521 + WAKEUP_ACTIVE_HIGH = 0,
12522 + WAKEUP_ACTIVE_LOW
12523 +} AVALANCHE_WAKEUP_POLARITY_T;
12525 +void avalanche_wakeup_ctrl(AVALANCHE_WAKEUP_INTERRUPT_T wakeup_int,
12526 + AVALANCHE_WAKEUP_CTRL_T wakeup_ctrl,
12527 + AVALANCHE_WAKEUP_POLARITY_T wakeup_polarity);
12529 +/*****************************************************************************
12531 + *****************************************************************************/
12533 +typedef enum AVALANCHE_GPIO_PIN_MODE_tag
12535 + FUNCTIONAL_PIN = 0,
12537 +} AVALANCHE_GPIO_PIN_MODE_T;
12539 +typedef enum AVALANCHE_GPIO_PIN_DIRECTION_tag
12541 + GPIO_OUTPUT_PIN = 0,
12542 + GPIO_INPUT_PIN = 1
12543 +} AVALANCHE_GPIO_PIN_DIRECTION_T;
12545 +typedef enum { GPIO_FALSE, GPIO_TRUE } AVALANCHE_GPIO_BOOL_T;
12547 +void avalanche_gpio_init(void);
12548 +int avalanche_gpio_ctrl(unsigned int gpio_pin,
12549 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
12550 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
12551 +int avalanche_gpio_ctrl_with_link_count(unsigned int gpio_pin,
12552 + AVALANCHE_GPIO_PIN_MODE_T pin_mode,
12553 + AVALANCHE_GPIO_PIN_DIRECTION_T pin_direction);
12554 +int avalanche_gpio_out_bit(unsigned int gpio_pin, int value);
12555 +int avalanche_gpio_in_bit(unsigned int gpio_pin);
12556 +int avalanche_gpio_out_value(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
12557 +int avalanche_gpio_out_value_with_link_count(unsigned int out_val, unsigned int set_mask, unsigned int reg_index);
12558 +int avalanche_gpio_in_value(unsigned int *in_val, unsigned int reg_index);
12560 +unsigned int avalanche_get_chip_version_info(void);
12562 +unsigned int avalanche_get_vbus_freq(void);
12563 +void avalanche_set_vbus_freq(unsigned int);
12566 +typedef int (*SET_MDIX_ON_CHIP_FN_T)(unsigned int base_addr, unsigned int operation);
12567 +int avalanche_set_mdix_on_chip(unsigned int base_addr, unsigned int operation);
12568 +unsigned int avalanche_is_mdix_on_chip(void);
12571 diff -urN linux.old/include/asm-mips/ar7/avalanche_regs.h linux.dev/include/asm-mips/ar7/avalanche_regs.h
12572 --- linux.old/include/asm-mips/ar7/avalanche_regs.h 1970-01-01 01:00:00.000000000 +0100
12573 +++ linux.dev/include/asm-mips/ar7/avalanche_regs.h 2005-11-10 01:10:46.071588750 +0100
12577 + * Avalanche Register Descriptions
12579 + * Jeff Harrell, jharrell@ti.com
12580 + * 2000 (c) Texas Instruments Inc.
12583 +#ifndef __AVALANCHE_REGS_H
12584 +#define __AVALANCHE_REGS_H
12586 +#include <asm/addrspace.h>
12587 +#include <linux/config.h>
12589 +/*----------------------------------------*/
12590 +/* Base offsets within the Avalanche ASIC */
12591 +/*----------------------------------------*/
12593 +#define BBIF_SPACE0 (KSEG1ADDR(0x01000000))
12594 +#define BBIF_SPACE1 (KSEG1ADDR(0x01800000))
12595 +#define BBIF_CONTROL (KSEG1ADDR(0x02000000))
12596 +#define ATM_SAR_BASE (KSEG1ADDR(0x03000000))
12597 +#define USB_MCU_BASE (KSEG1ADDR(0x03400000))
12598 +#define DES_BASE (KSEG1ADDR(0x08600000))
12599 +#define ETH_MACA_BASE (KSEG1ADDR(0x08610000))
12600 +#define ETH_MACB_BASE (KSEG1ADDR(0x08612800))
12601 +#define MEM_CTRLR_BASE (KSEG1ADDR(0x08610800))
12602 +#define GPIO_BASE (KSEG1ADDR(0x08610900))
12603 +#define CLK_CTRL_BASE (KSEG1ADDR(0x08610A00))
12604 +#define WATCH_DOG_BASE (KSEG1ADDR(0x08610B00))
12605 +#define TMR1_BASE (KSEG1ADDR(0x08610C00))
12606 +#define TRM2_BASE (KSEG1ADDR(0x08610D00))
12607 +#define UARTA_BASE (KSEG1ADDR(0x08610E00))
12608 +#define UARTB_BASE (KSEG1ADDR(0x08610F00))
12609 +#define I2C_BASE (KSEG1ADDR(0x08611000))
12610 +#define DEV_ID_BASE (KSEG1ADDR(0x08611100))
12611 +#define USB_BASE (KSEG1ADDR(0x08611200))
12612 +#define PCI_CONFIG_BASE (KSEG1ADDR(0x08611300))
12613 +#define DMA_BASE (KSEG1ADDR(0x08611400))
12614 +#define RESET_CTRL_BASE (KSEG1ADDR(0x08611600))
12615 +#define DSL_IF_BASE (KSEG1ADDR(0x08611B00))
12616 +#define INT_CTL_BASE (KSEG1ADDR(0x08612400))
12617 +#define PHY_BASE (KSEG1ADDR(0x1E000000))
12619 +/*---------------------------------*/
12620 +/* Device ID, chip version number */
12621 +/*---------------------------------*/
12623 +#define AVALANCHE_CHVN (*(volatile unsigned int *)(DEV_ID_BASE+0x14))
12624 +#define AVALANCHE_DEVID1 (*(volatile unsigned int *)(DEV_ID_BASE+0x18))
12625 +#define AVALANCHE_DEVID2 (*(volatile unsigned int *)(DEV_ID_BASE+0x1C))
12627 +/*----------------------------------*/
12628 +/* Reset Control VW changed to ptrs */
12629 +/*----------------------------------*/
12631 +#define AVALANCHE_PRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x0)) /* Peripheral reset control */
12632 +#define AVALANCHE_SWRCR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x4)) /* Software reset control */
12633 +#define AVALANCHE_RSR (*(volatile unsigned int *)(RESET_CTRL_BASE + 0x8)) /* Reset status register */
12635 +/* reset control bits */
12637 +#define AV_RST_UART0 (1<<0) /* Brings UART0 out of reset */
12638 +#define AV_RST_UART1 (1<<1) /* Brings UART1 out of reset */
12639 +#define AV_RST_IICM (1<<2) /* Brings the I2CM out of reset */
12640 +#define AV_RST_TIMER0 (1<<3) /* Brings Timer 0 out of reset */
12641 +#define AV_RST_TIMER1 (1<<4) /* Brings Timer 1 out of reset */
12642 +#define AV_RST_DES (1<<5) /* Brings the DES module out of reset */
12643 +#define AV_RST_GPIO (1<<6) /* Brings the GPIO module out of reset (see note below) */
12645 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
12646 + If you reset the GPIO interface all of the directions (i/o) of the UART B
12647 + interface pins are inputs and must be reconfigured so as not to lose the
12648 + serial console interface
12649 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
12651 +#define AV_RST_BBIF (1<<7) /* Brings the Broadband interface out of reset */
12652 +#define AV_RST_USB (1<<8) /* Brings the USB module out of reset */
12653 +#define AV_RST_SAR (1<<9) /* Brings the SAR out of reset */
12654 +#define AV_RST_HDLC (1<<10) /* Brings the HDLC module out of reset */
12655 +#define AV_RST_PCI (1<<16) /* Brings the PCI module out of reset */
12656 +#define AV_RST_ETH_MAC0 (1<<17) /* Brings the Ethernet MAC0 out of reset */
12657 +#define AV_RST_PICO_DMA (1<<18) /* Brings the PICO DMA module out of reset */
12658 +#define AV_RST_BIST (1<<19) /* Brings the BIST module out of reset */
12659 +#define AV_RST_DSP (1<<20) /* Brings the DSP sub system out of reset */
12660 +#define AV_RST_ETH_MAC1 (1<<21) /* Brings the Ethernet MAC1 out of reset */
12662 +/*----------------------*/
12663 +/* Physical interfaces */
12664 +/*----------------------*/
12666 +/* Phy loopback */
12667 +#define PHY_LOOPBACK 1
12671 +#define PHY0BASE (PHY_BASE)
12672 +#define PHY0RST (*(volatile unsigned char *) (PHY0BASE)) /* reset */
12673 +#define PHY0CTRL (*(volatile unsigned char *) (PHY0BASE+0x5)) /* control */
12674 +#define PHY0RACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x50)) /* RACP control/status */
12675 +#define PHY0TACPCTRL (*(volatile unsigned char *) (PHY0BASE+0x60)) /* TACP idle/unassigned cell hdr */
12676 +#define PHY0RACPINT (*(volatile unsigned char *) (PHY0BASE+0x51)) /* RACP interrupt enable/Status */
12681 +#define PHY1BASE (PHY_BASE + 0x100000)
12682 +#define PHY1RST (*(volatile unsigned char *) (PHY1BASE)) /* reset */
12683 +#define PHY1CTRL (*(volatile unsigned char *) (PHY1BASE+0x5)) /* control */
12684 +#define PHY1RACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x50))
12685 +#define PHY1TACPCTRL (*(volatile unsigned char *) (PHY1BASE+0x60))
12686 +#define PHY1RACPINT (*(volatile unsigned char *) (PHY1BASE+0x51))
12690 +#define PHY2BASE (PHY_BASE + 0x200000)
12691 +#define PHY2RST (*(volatile unsigned char *) (PHY2BASE)) /* reset */
12692 +#define PHY2CTRL (*(volatile unsigned char *) (PHY2BASE+0x5)) /* control */
12693 +#define PHY2RACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x50))
12694 +#define PHY2TACPCTRL (*(volatile unsigned char *) (PHY2BASE+0x60))
12695 +#define PHY2RACPINT (*(volatile unsigned char *) (PHY2BASE+0x51))
12697 +/*-------------------*/
12698 +/* Avalanche ATM SAR */
12699 +/*-------------------*/
12701 +#define AVSAR_SYSCONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000000)) /* SAR system config register */
12702 +#define AVSAR_SYSSTATUS (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000004)) /* SAR system status register */
12703 +#define AVSAR_INT_ENABLE (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000008)) /* SAR interrupt enable register */
12704 +#define AVSAR_CONN_VPI_VCI (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000000c)) /* VPI/VCI connection config */
12705 +#define AVSAR_CONN_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000010)) /* Connection config register */
12706 +#define AVSAR_OAM_CONFIG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018)) /* OAM configuration register */
12708 +/* Transmit completion ring registers */
12710 +#define AVSAR_TCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000100))
12711 +#define AVSAR_TCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000104))
12712 +#define AVSAR_TCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000108))
12713 +#define AVSAR_TCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000010c))
12714 +#define AVSAR_TCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000110))
12715 +#define AVSAR_TCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000114))
12716 +#define AVSAR_TCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000118))
12717 +#define AVSAR_TCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000011c))
12718 +#define AVSAR_TCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000120))
12719 +#define AVSAR_TCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000124))
12720 +#define AVSAR_TCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000128))
12721 +#define AVSAR_TCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000012c))
12722 +#define AVSAR_TCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000130))
12723 +#define AVSAR_TCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000134))
12725 +/* Transmit Queue Packet registers */
12726 +#define AVSAR_TXQUEUE_PKT0 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000140))
12727 +#define AVSAR_TXQUEUE_PKT1 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000144))
12728 +#define AVSAR_TXQUEUE_PKT2 (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000148))
12729 +#define AVSAR_TX_FLUSH (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000014C))
12730 +/* Receive completion ring registers */
12732 +#define AVSAR_RCRAPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000200))
12733 +#define AVSAR_RCRASIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000204))
12734 +#define AVSAR_RCRAINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000208))
12735 +#define AVSAR_RCRATOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000020c))
12736 +#define AVSAR_RCRAFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000210))
12737 +#define AVSAR_RCRAPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000214))
12738 +#define AVSAR_RCRAENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000218))
12739 +#define AVSAR_RCRBPTR (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000021c))
12740 +#define AVSAR_RCRBSIZE (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000220))
12741 +#define AVSAR_RCRBINTTHRESH (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000224))
12742 +#define AVSAR_RCRBTOTENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000228))
12743 +#define AVSAR_RCRBFREEENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x0000022c))
12744 +#define AVSAR_RCRBPENDENT (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000230))
12745 +#define AVSAR_RCRBENTINC (*(volatile unsigned int *)(ATM_SAR_BASE+0x00000234))
12747 +#define AVSAR_RXFBL_ADD0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000240)) /* Rx Free buffer list add 0 */
12748 +#define AVSAR_RXFBL_ADD1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000244)) /* Rx Free buffer list add 1 */
12749 +#define AVSAR_RXFBL_ADD2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000248)) /* Rx Free buffer list add 2 */
12750 +#define AVSAR_RXFBLSIZE_0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000028c)) /* Rx Free buffer list size 0 */
12751 +#define AVSAR_RXFBLSIZE_1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x0000029c)) /* Rx Free buffer list size 1 */
12752 +#define AVSAR_RXFBLSIZE_2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002ac)) /* Rx Free buffer list size 2 */
12753 +#define AVSAR_RXFBLSIZE_3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000002bc)) /* Rx Free buffer list size 3 */
12756 +#if defined(CONFIG_MIPS_EVM3D) || defined(CONFIG_MIPS_AR5D01) || defined(CONFIG_MIPS_AR5W01)
12758 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010480))
12759 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010484))
12760 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010488))
12761 +#define AVSAR_OAM_CPID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E0))
12762 +#define AVSAR_OAM_LLID0 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F0))
12763 +#define AVSAR_OAM_CPID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E4))
12764 +#define AVSAR_OAM_LLID1 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F4))
12765 +#define AVSAR_OAM_CPID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104E8))
12766 +#define AVSAR_OAM_LLID2 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104F8))
12767 +#define AVSAR_OAM_CPID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104EC))
12768 +#define AVSAR_OAM_LLID3 (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104FC))
12769 +#define AVSAR_OAM_CORR_TAG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010500))
12770 +#define AVSAR_OAM_FAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010520))
12771 +#define AVSAR_OAM_NEAR_COUNT (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010540))
12772 +#define AVSAR_OAM_CONFIG_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00000018))
12773 +#define AVSAR_FAIRNESS_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x000104B8))
12774 +#define AVSAR_UBR_PCR_REG (*(volatile unsigned int*)(ATM_SAR_BASE+0x00010490))
12779 +#define OAM_CPID_ADD 0xa30104e0
12781 +#define OAM_LLID_ADD 0xa30104f0
12783 +#define OAM_LLID_VAL 0xffffffff
12785 +#define OAM_CORR_TAG 0xa3010500
12787 +#define OAM_FAR_COUNT_ADD 0xa3010520
12789 +#define OAM_NEAR_COUNT_ADD 0xa3010540
12791 +#define OAM_CONFIG_REG_ADD 0xa3000018
12795 +#else /* CONFIG_MIPS_EVM3 || CONFIG_MIPS_ACPEP */
12797 +#define AVSAR_SAR_FREQUENCY (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012000))
12798 +#define AVSAR_OAM_CC_SINK (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012004))
12799 +#define AVSAR_OAM_AIS_RDI_RX (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012008))
12800 +#define AVSAR_OAM_CPID (*(volatile unsigned int*)(ATM_SAR_BASE+0x00012300))
12802 +#endif /* CONFIG_MIPS_EVM3D || CONFIG_MIPS_AR5D01 || CONFIG_MIPS_AR5W01 */
12805 +#define AVSAR_STATE_RAM (ATM_SAR_BASE + 0x010000) /* SAR state RAM */
12806 +#define AVSAR_PDSP_BASE (ATM_SAR_BASE + 0x020000) /* SAR PDSP base address */
12807 +#define AVSAR_TXDMA_BASE (ATM_SAR_BASE + 0x030000) /* Transmit DMA state base */
12808 +#define AVSAR_TDMASTATE6 0x18 /* Transmit DMA state word 6 */
12809 +#define AVSAR_RXDMA_BASE (ATM_SAR_BASE + 0x040000) /* Receive DMA state base */
12810 +#define AVSAR_RDMASTATE0 0x0 /* Receive DMA state word 0 */
12812 +/*------------------------------------------*/
12813 +/* DSL Interface */
12814 +/*------------------------------------------*/
12816 +#define AVDSL_TX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000000))
12817 +#define AVDSL_RX_EN (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000004))
12818 +#define AVDSL_POLL (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000008))
12822 +#define AVDSL_TX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000000C))
12823 +#define AVDSL_TX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000010))
12824 +#define AVDSL_TX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000014))
12825 +#define AVDSL_TX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000018))
12826 +#define AVDSL_RX_FIFO_ADDR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000001C))
12827 +#define AVDSL_RX_FIFO_BASE0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000020))
12828 +#define AVDSL_RX_FIFO_LEN0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000024))
12829 +#define AVDSL_RX_FIFO_PR0 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000028))
12833 +#define AVDSL_TX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000002C))
12834 +#define AVDSL_TX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000030))
12835 +#define AVDSL_TX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000034))
12836 +#define AVDSL_TX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000038))
12837 +#define AVDSL_RX_FIFO_ADDR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x0000003C))
12838 +#define AVDSL_RX_FIFO_BASE1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000040))
12839 +#define AVDSL_RX_FIFO_LEN1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000044))
12840 +#define AVDSL_RX_FIFO_PR1 (*(volatile unsigned int *)(DSL_IF_BASE + 0x00000048))
12842 +/*------------------------------------------*/
12843 +/* Broadband I/F */
12844 +/*------------------------------------------*/
12846 +#define AVBBIF_BBIF_CNTRL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000000))
12847 +#define AVBBIF_ADDR_TRANS_0 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000004))
12848 +#define AVBBIF_ADDR_TRANS_1 (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000008))
12849 +#define AVBBIF_ADDR_XB_MX_BL (*(volatile unsigned int *)(BBIF_CONTROL + 0x0000000C))
12850 +#define AVBBIF_INFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000010))
12851 +#define AVBBIF_OUTFIFO_LVL (*(volatile unsigned int *)(BBIF_CONTROL + 0x00000014))
12853 +#define AVBBIF_DISABLED 0x0
12854 +#define AVBBIF_LBT4040_INT 0x1
12855 +#define AVBBIF_XBUS 0x2
12856 +#define AVBBIF_LBT4040_EXT 0x4
12858 +#define AVBBIF_ADDR_MASK0 0xff000000 /* handles upper bits of BBIF 0 address */
12859 +#define AVBBIF_ADDR_MASK1 0xff800000 /* handles upper bits of BBIF 1 address */
12860 +#define AVBBIF_TRANS_MASK 0xff000000
12861 +/*------------------------------------------*/
12863 +/*------------------------------------------*/
12865 +#define GPIO_DATA_INPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000000))
12866 +#define GPIO_DATA_OUTPUT (*(volatile unsigned int *)(GPIO_BASE + 0x00000004))
12867 +#define GPIO_DATA_DIR (*(volatile unsigned int *)(GPIO_BASE + 0x00000008)) /* 0=output 1=input */
12868 +#define GPIO_DATA_ENABLE (*(volatile unsigned int *)(GPIO_BASE + 0x0000000C)) /* 0=GPIO Mux 1=GPIO */
12870 +#define GPIO_0 (1<<21)
12871 +#define GPIO_1 (1<<22)
12872 +#define GPIO_2 (1<<23)
12873 +#define GPIO_3 (1<<24)
12874 +#define EINT_1 (1<<18)
12877 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
12878 + If you reset the GPIO interface all of the directions (i/o) of the UART B
12879 + interface pins are inputs and must be reconfigured so as not to lose the
12880 + serial console interface
12881 + JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE JAH NOTE
12884 +/*------------------------------------------*/
12886 +/*------------------------------------------*/
12887 +#define PERIPH_CLK_CTL (*(volatile unsigned int *)(CLK_CTRL_BASE + 0x00000004))
12889 +#define PCLK_0_HALF_VBUS (0<<16)
12890 +#define PCLK_EQ_INPUT (1<<16)
12891 +#define BBIF_CLK_HALF_VBUS (0<<17)
12892 +#define BBIF_CLK_EQ_VBUS (1<<17)
12893 +#define BBIF_CLK_EQ_BBCLK (3<<17)
12894 +#define DSP_MODCLK_DSPCLKI (0<<20)
12895 +#define DSP_MODCLK_REFCLKI (1<<20)
12896 +#define USB_CLK_EQ_USBCLKI (0<<21)
12897 +#define USB_CLK_EQ_REFCLKI (1<<21)
12899 +/*------------------------------------------*/
12900 +/* PCI Control Registers */
12901 +/*------------------------------------------*/
12902 +#define PCIC_CONTROL (*(volatile unsigned int *)(PCI_CONFIG_BASE))
12903 +#define PCIC_CONTROL_CFG_DONE (1<<0)
12904 +#define PCIC_CONTROL_DIS_SLAVE_TO (1<<1)
12905 +#define PCIC_CONTROL_FORCE_DELAY_READ (1<<2)
12906 +#define PCIC_CONTROL_FORCE_DELAY_READ_LINE (1<<3)
12907 +#define PCIC_CONTROL_FORCE_DELAY_READ_MULT (1<<4)
12908 +#define PCIC_CONTROL_MEM_SPACE_EN (1<<5)
12909 +#define PCIC_CONTROL_MEM_MASK (1<<6)
12910 +#define PCIC_CONTROL_IO_SPACE_EN (1<<7)
12911 +#define PCIC_CONTROL_IO_MASK (1<<8)
12912 +/* PCIC_CONTROL_RESERVED (1<<9) */
12913 +#define PCIC_CONTROL_BASE0_EN (1<<10)
12914 +#define PCIC_CONTROL_BASE1_EN (1<<11)
12915 +#define PCIC_CONTROL_BASE2_EN (1<<12)
12916 +#define PCIC_CONTROL_HOLD_MASTER_WRITE (1<<13)
12917 +#define PCIC_CONTROL_ARBITER_EN (1<<14)
12918 +#define PCIC_INT_SOURCE (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000004))
12919 +#define PCIC_INT_SOURCE_PWR_MGMT (1<<0)
12920 +#define PCIC_INT_SOURCE_PCI_TARGET (1<<1)
12921 +#define PCIC_INT_SOURCE_PCI_MASTER (1<<2)
12922 +#define PCIC_INT_SOURCE_POWER_WAKEUP (1<<3)
12923 +#define PCIC_INT_SOURCE_PMEIN (1<<4)
12924 +/* PCIC_INT_SOURCE_RESERVED (1<<5) */
12925 +/* PCIC_INT_SOURCE_RESERVED (1<<6) */
12926 +#define PCIC_INT_SOURCE_PIC_INTA (1<<7)
12927 +#define PCIC_INT_SOURCE_PIC_INTB (1<<8)
12928 +#define PCIC_INT_SOURCE_PIC_INTC (1<<9)
12929 +#define PCIC_INT_SOURCE_PIC_INTD (1<<10)
12930 +#define PCIC_INT_SOURCE_SOFT_INT0 (1<<11)
12931 +#define PCIC_INT_SOURCE_SOFT_INT1 (1<<12)
12932 +#define PCIC_INT_SOURCE_SOFT_INT2 (1<<13)
12933 +#define PCIC_INT_SOURCE_SOFT_INT3 (1<<14)
12934 +#define PCIC_INT_CLEAR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000008))
12935 +#define PCIC_INT_CLEAR_PM (1<<0)
12936 +#define PCIC_INT_CLEAR_PCI_TARGET (1<<1)
12937 +#define PCIC_INT_CLEAR_PCI_MASTER (1<<2)
12938 +/* PCIC_INT_CLEAR_RESERVED (1<<3) */
12939 +#define PCIC_INT_CLEAR_PMEIN (1<<4)
12940 +/* PCIC_INT_CLEAR_RESERVED (1<<5) */
12941 +/* PCIC_INT_CLEAR_RESERVED (1<<6) */
12942 +#define PCIC_INT_CLEAR_PCI_INTA (1<<7)
12943 +#define PCIC_INT_CLEAR_PCI_INTB (1<<8)
12944 +#define PCIC_INT_CLEAR_PCI_INTC (1<<9)
12945 +#define PCIC_INT_CLEAR_PCI_INTD (1<<10)
12946 +#define PCIC_INT_CLEAR_SOFT_INT0 (1<<11)
12947 +#define PCIC_INT_CLEAR_SOFT_INT1 (1<<12)
12948 +#define PCIC_INT_CLEAR_SOFT_INT2 (1<<13)
12949 +#define PCIC_INT_CLEAR_SOFT_INT3 (1<<14)
12950 +#define PCIC_INT_EN_AVAL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000000c))
12951 +#define PCIC_INT_EN_AVAL_PM (1<<0)
12952 +#define PCIC_INT_EN_AVAL_PCI_TARGET (1<<1)
12953 +#define PCIC_INT_EN_AVAL_PCI_MASTER (1<<2)
12954 +/* PCIC_INT_EN_AVAL_RESERVED (1<<3) */
12955 +#define PCIC_INT_EN_AVAL_PMEIN (1<<4)
12956 +/* PCIC_INT_EN_AVAL_RESERVED (1<<5) */
12957 +/* PCIC_INT_EN_AVAL_RESERVED (1<<6) */
12958 +#define PCIC_INT_EN_AVAL_PCI_INTA (1<<7)
12959 +#define PCIC_INT_EN_AVAL_PCI_INTB (1<<8)
12960 +#define PCIC_INT_EN_AVAL_PCI_INTC (1<<9)
12961 +#define PCIC_INT_EN_AVAL_PCI_INTD (1<<10)
12962 +#define PCIC_INT_EN_AVAL_SOFT_INT0 (1<<11)
12963 +#define PCIC_INT_EN_AVAL_SOFT_INT1 (1<<12)
12964 +#define PCIC_INT_EN_AVAL_SOFT_INT2 (1<<13)
12965 +#define PCIC_INT_EN_AVAL_SOFT_INT3 (1<<14)
12966 +#define PCIC_INT_EN_PCI (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000010))
12967 +#define PCIC_INT_EN_PCI_PM (1<<0)
12968 +#define PCIC_INT_EN_PCI_PCI_TARGET (1<<1)
12969 +#define PCIC_INT_EN_PCI_PCI_MASTER (1<<2)
12970 +/* PCIC_INT_EN_PCI_RESERVED (1<<3) */
12971 +#define PCIC_INT_EN_PCI_PMEIN (1<<4)
12972 +/* PCIC_INT_EN_PCI_RESERVED (1<<5) */
12973 +/* PCIC_INT_EN_PCI_RESERVED (1<<6) */
12974 +#define PCIC_INT_EN_PCI_PCI_INTA (1<<7)
12975 +#define PCIC_INT_EN_PCI_PCI_INTB (1<<8)
12976 +#define PCIC_INT_EN_PCI_PCI_INTC (1<<9)
12977 +#define PCIC_INT_EN_PCI_PCI_INTD (1<<10)
12978 +#define PCIC_INT_EN_PCI_SOFT_INT0 (1<<11)
12979 +#define PCIC_INT_EN_PCI_SOFT_INT1 (1<<12)
12980 +#define PCIC_INT_EN_PCI_SOFT_INT2 (1<<13)
12981 +#define PCIC_INT_EN_PCI_SOFT_INT3 (1<<14)
12982 +#define PCIC_INT_SWSET (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000014))
12983 +#define PCIC_INT_SWSET_SOFT_INT0 (1<<0)
12984 +#define PCIC_INT_SWSET_SOFT_INT1 (1<<1)
12985 +#define PCIC_INT_SWSET_SOFT_INT2 (1<<2)
12986 +#define PCIC_INT_SWSET_SOFT_INT3 (1<<3)
12987 +#define PCIC_PM_CTL (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000018))
12988 +#define PCIC_PM_CTL_PWR_STATE_MASK (0x02)
12989 +/* PCIC_PM_CTL_RESERVED (1<<2) */
12990 +/* PCIC_PM_CTL_RESERVED (1<<3) */
12991 +/* PCIC_PM_CTL_RESERVED (1<<4) */
12992 +/* PCIC_PM_CTL_RESERVED (1<<5) */
12993 +/* PCIC_PM_CTL_RESERVED (1<<6) */
12994 +/* PCIC_PM_CTL_RESERVED (1<<7) */
12995 +/* PCIC_PM_CTL_RESERVED (1<<8) */
12996 +/* PCIC_PM_CTL_RESERVED (1<<9) */
12997 +#define PCIC_PM_CTL_PWR_SUPPORT (1<<10)
12998 +#define PCIC_PM_CTL_PMEIN (1<<11)
12999 +#define PCIC_PM_CTL_CAP_MASK (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x0000001a))
13000 +#define PCIC_PM_CONSUME (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000001c))
13001 +#define PCIC_PM_CONSUME_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001c))
13002 +#define PCIC_PM_CONSUME_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001d))
13003 +#define PCIC_PM_CONSUME_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001e))
13004 +#define PCIC_PM_CONSUME_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x0000001f))
13005 +#define PCIC_PM_DISSAPATED (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000020))
13006 +#define PCIC_PM_DISSAPATED_D0 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000020))
13007 +#define PCIC_PM_DISSAPATED_D1 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000021))
13008 +#define PCIC_PM_DISSAPATED_D2 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000022))
13009 +#define PCIC_PM_DISSAPATED_D3 (*(volatile unsigned char *)(PCI_CONFIG_BASE + 0x00000023))
13010 +#define PCIC_PM_DATA_SCALE (*(volatile unsigned short int *)(PCI_CONFIG_BASE + 0x00000024))
13011 +#define PCIC_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000028))
13012 +#define PCIC_SUB_VEND_DEV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000002c))
13013 +#define PCIC_CLASS_REV_ID (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000030))
13014 +#define PCIC_MAX_MIN (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000034))
13015 +#define PCIC_MAST_MEM_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000003c))
13016 +#define PCIC_MAST_MEM_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000040))
13017 +#define PCIC_MAST_MEM_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000044))
13018 +#define PCIC_SLAVE_MASK0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000004c))
13019 +#define PCIC_SLAVE_MASK1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000050))
13020 +#define PCIC_SLAVE_MASK2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000054))
13021 +#define PCIC_SLAVE_BASE_AT0 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000058))
13022 +#define PCIC_SLAVE_BASE_AT1 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x0000005c))
13023 +#define PCIC_SLAVE_BASE_AT2 (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000060))
13024 +#define PCIC_CONF_COMMAND (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000090))
13025 +#define PCIC_CONF_ADDR (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000094))
13026 +#define PCIC_CONF_DATA (*(volatile unsigned int *)(PCI_CONFIG_BASE + 0x00000098))
13028 +/*------------------------------------------*/
13029 +/* IIC_INTERFACE */
13030 +/*------------------------------------------*/
13031 +#define I2C_DATA_HI (*(volatile unsigned int *)(I2C_BASE + 0x0))
13032 +#define I2C_DATA_LOW (*(volatile unsigned int *)(I2C_BASE + 0x4))
13033 +#define I2C_CONFIG (*(volatile unsigned int *)(I2C_BASE + 0x8))
13034 +#define I2C_DATA_READ (*(volatile unsigned int *)(I2C_BASE + 0xC))
13035 +#define I2C_CLOCK_DIV (*(volatile unsigned int *)(I2C_BASE + 0x10))
13037 +#define I2CWRITE 0x200
13038 +#define I2CREAD 0x300
13039 +#define I2C_END_BURST 0x400
13042 +#define I2C_READ_ERROR 0x8000
13043 +#define I2C_READ_COMPLETE 0x4000
13044 +#define I2C_READ_BUSY 0x2000
13046 +/* device types */
13047 +#define I2C_IO_EXPANDER 0x2
13048 +#define I2C_RTC 0xd
13050 +/* device Addresses on I2C bus (EVM3) */
13051 +#define SEVEN_SEGMENT_DISP 0x23 /* Device type = 0x2, Addr = 3 */
13052 +#define EVM3_RTC 0xd0 /* Device type = 0xd, Addr = 0 */
13053 +#define EVM3_RTC_I2C_ADDR 0x0
13055 +/*------------------------------------------*/
13056 +/* Ethernet MAC register offset definitions */
13057 +/*------------------------------------------*/
13058 +#define VMAC_DMACONFIG(X) (*(volatile unsigned int *)(X + 0x00000000))
13059 +#define VMAC_INTSTS(X) (*(volatile unsigned int *)(X + 0x00000004))
13060 +#define VMAC_INTMASK(X) (*(volatile unsigned int *)(X + 0x00000008))
13062 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
13063 +#define VMAC_STATSBASE(X) (*(volatile unsigned int *)(X + 0x00000400))
13065 +#define VMAC_TCRPTR(X) (*(volatile unsigned int *)(X + 0x00000100))
13066 +#define VMAC_TCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000104))
13067 +#define VMAC_TCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000108))
13068 +#define VMAC_TCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000010C))
13069 +#define VMAC_TCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000110))
13070 +#define VMAC_TCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000114))
13071 +#define VMAC_TCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000118))
13072 +#define VMAC_TXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000011c))
13075 +#define VMAC_TDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000120))
13076 +#define VMAC_TDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000124))
13077 +#define VMAC_TDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000128))
13078 +#define VMAC_TDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000012C))
13079 +#define VMAC_TDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000130))
13080 +#define VMAC_TDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000134))
13081 +#define VMAC_TDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000138))
13082 +#define VMAC_TDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000013C))
13083 +#define VMAC_TXPADDCNT(X) (*(volatile unsigned int *)(X + 0x00000140))
13084 +#define VMAC_TXPADDSTART(X) (*(volatile unsigned int *)(X + 0x00000144))
13085 +#define VMAC_TXPADDEND(X) (*(volatile unsigned int *)(X + 0x00000148))
13086 +#define VMAC_TXQFLUSH(X) (*(volatile unsigned int *)(X + 0x0000014C))
13088 +#define VMAC_RCRPTR(X) (*(volatile unsigned int *)(X + 0x00000200))
13089 +#define VMAC_RCRSIZE(X) (*(volatile unsigned int *)(X + 0x00000204))
13090 +#define VMAC_RCRINTTHRESH(X) (*(volatile unsigned int *)(X + 0x00000208))
13091 +#define VMAC_RCRTOTENT(X) (*(volatile unsigned int *)(X + 0x0000020C))
13092 +#define VMAC_RCRFREEENT(X) (*(volatile unsigned int *)(X + 0x00000210))
13093 +#define VMAC_RCRPENDENT(X) (*(volatile unsigned int *)(X + 0x00000214))
13094 +#define VMAC_RCRENTINC(X) (*(volatile unsigned int *)(X + 0x00000218))
13095 +#define VMAC_RXISRPACE(X) (*(volatile unsigned int *)(X + 0x0000021c))
13097 +#define VMAC_RDMASTATE0(X) (*(volatile unsigned int *)(X + 0x00000220))
13098 +#define VMAC_RDMASTATE1(X) (*(volatile unsigned int *)(X + 0x00000224))
13099 +#define VMAC_RDMASTATE2(X) (*(volatile unsigned int *)(X + 0x00000228))
13100 +#define VMAC_RDMASTATE3(X) (*(volatile unsigned int *)(X + 0x0000022C))
13101 +#define VMAC_RDMASTATE4(X) (*(volatile unsigned int *)(X + 0x00000230))
13102 +#define VMAC_RDMASTATE5(X) (*(volatile unsigned int *)(X + 0x00000234))
13103 +#define VMAC_RDMASTATE6(X) (*(volatile unsigned int *)(X + 0x00000238))
13104 +#define VMAC_RDMASTATE7(X) (*(volatile unsigned int *)(X + 0x0000023C))
13105 +#define VMAC_FBLADDCNT(X) (*(volatile unsigned int *)(X + 0x00000240))
13106 +#define VMAC_FBLADDSTART(X) (*(volatile unsigned int *)(X + 0x00000244))
13107 +#define VMAC_FBLADDEND(X) (*(volatile unsigned int *)(X + 0x00000248))
13108 +#define VMAC_RXONOFF(X) (*(volatile unsigned int *)(X + 0x0000024C))
13110 +#define VMAC_FBL0NEXTD(X) (*(volatile unsigned int *)(X + 0x00000280))
13111 +#define VMAC_FBL0LASTD(X) (*(volatile unsigned int *)(X + 0x00000284))
13112 +#define VMAC_FBL0COUNTD(X) (*(volatile unsigned int *)(X + 0x00000288))
13113 +#define VMAC_FBL0BUFSIZE(X) (*(volatile unsigned int *)(X + 0x0000028C))
13115 +#define VMAC_MACCONTROL(X) (*(volatile unsigned int *)(X + 0x00000300))
13116 +#define VMAC_MACSTATUS(X) (*(volatile unsigned int *)(X + 0x00000304))
13117 +#define VMAC_MACADDRHI(X) (*(volatile unsigned int *)(X + 0x00000308))
13118 +#define VMAC_MACADDRLO(X) (*(volatile unsigned int *)(X + 0x0000030C))
13119 +#define VMAC_MACHASH1(X) (*(volatile unsigned int *)(X + 0x00000310))
13120 +#define VMAC_MACHASH2(X) (*(volatile unsigned int *)(X + 0x00000314))
13122 +#define VMAC_WRAPCLK(X) (*(volatile unsigned int *)(X + 0x00000340))
13123 +#define VMAC_BOFTEST(X) (*(volatile unsigned int *)(X + 0x00000344))
13124 +#define VMAC_PACTEST(X) (*(volatile unsigned int *)(X + 0x00000348))
13125 +#define VMAC_PAUSEOP(X) (*(volatile unsigned int *)(X + 0x0000034C))
13127 +#define VMAC_MDIOCONTROL(X) (*(volatile unsigned int *)(X + 0x00000380))
13128 +#define VMAC_MDIOUSERACCESS(X) (*(volatile unsigned int *)(X +0x00000384))
13129 +#define VMAC_MDIOACK(X) (*(volatile unsigned int *)(X + 0x00000388))
13130 +#define VMAC_MDIOLINK(X) (*(volatile unsigned int *)(X + 0x0000038C))
13131 +#define VMAC_MDIOMACPHY(X) (*(volatile unsigned int *)(X + 0x00000390))
13133 +#define VMAC_STATS_BASE(X) (X + 0x00000400)
13135 +#endif __AVALANCHE_REGS_H
13142 diff -urN linux.old/include/asm-mips/ar7/avalanche_types.h linux.dev/include/asm-mips/ar7/avalanche_types.h
13143 --- linux.old/include/asm-mips/ar7/avalanche_types.h 1970-01-01 01:00:00.000000000 +0100
13144 +++ linux.dev/include/asm-mips/ar7/avalanche_types.h 2005-11-10 01:10:46.071588750 +0100
13146 +/*------------------------------------------------------------------------------------------*\
13147 +\*------------------------------------------------------------------------------------------*/
13148 +#ifndef _avalanche_types_h_
13149 +#define _avalanche_types_h_
13151 +/*--- #include <asm/avalanche/generic/hal_modules/haltypes.h> ---*/
13159 +#define NULL (void *)0
13162 +/*------------------------------------------------------------------------------------------*\
13163 + * Typen für Texas GPL Module
13164 +\*------------------------------------------------------------------------------------------*/
13165 +#ifndef __UINT8_T__
13166 +typedef unsigned char UINT8;
13167 +#define __UINT8_T__
13170 +#ifndef __UCHAR_T__
13171 +typedef unsigned char UCHAR;
13172 +#define __UCHAR_T__
13175 +#ifndef __INT8_T__
13176 +typedef signed char INT8;
13177 +#define __INT8_T__
13180 +#ifndef __UINT16_T__
13181 +typedef unsigned short UINT16;
13182 +#define __UINT16_T__
13185 +#ifndef __USHORT_T__
13186 +typedef unsigned short USHORT;
13187 +#define __USHORT_T__
13190 +#ifndef __INT16_T__
13191 +typedef signed short INT16;
13192 +#define __INT16_T__
13195 +#ifndef __UINT32_T__
13196 +typedef unsigned int UINT32;
13197 +#define __UINT32_T__
13200 +#ifndef __UINT_T__
13201 +typedef unsigned int UINT;
13202 +#define __UINT_T__
13205 +#ifndef __INT32_T__
13206 +typedef signed int INT32;
13207 +#define __INT32_T__
13210 +#ifndef __ULONG_T__
13211 +typedef unsigned long ULONG;
13212 +#define __ULONG_T__
13215 +#ifndef __BOOL_T__
13217 +#define __BOOL_T__
13220 +#ifndef __STATUS_T__
13221 +typedef int STATUS;
13222 +#define __STATUS_T__
13225 +/*------------------------------------------------------------------------------------------*\
13226 +\*------------------------------------------------------------------------------------------*/
13227 +typedef void (*p_vlynq_intr_cntrl_isr_t)(void *,void *,void *);
13228 +typedef INT32 (*p_vlynq_interrupt_vector_set_t)(void *, UINT32, UINT32, INT32, INT32, INT32);
13229 +typedef INT32 (*p_vlynq_interrupt_vector_cntl_t)(void *, UINT32, INT32, UINT32);
13230 +typedef UINT32 (*p_vlynq_interrupt_get_count_t)(void *, UINT32);
13231 +typedef INT32 (*p_vlynq_install_isr_t)(void *, UINT32, p_vlynq_intr_cntrl_isr_t, void *, void *, void *);
13232 +typedef INT32 (*p_vlynq_uninstall_isr_t)(void *, UINT32, void *, void *, void *);
13233 +typedef void (*p_vlynq_root_isr_t)(void *);
13234 +typedef void (*p_vlynq_delay_t)(UINT32);
13235 +typedef INT32 (*p_vlynq_interrupt_vector_map_t)(void *, INT32, UINT32, UINT32);
13236 +typedef INT32 (*p_vlynq_interrupt_set_polarity_t)(void *, INT32, UINT32, INT32);
13237 +typedef INT32 (*p_vlynq_interrupt_get_polarity_t)(void *, INT32, UINT32);
13238 +typedef INT32 (*p_vlynq_interrupt_set_type_t)(void *, INT32, UINT32, INT32);
13239 +typedef INT32 (*p_vlynq_interrupt_get_type_t)(void *, INT32, UINT32);
13240 +typedef INT32 (*p_vlynq_interrupt_enable_t)(void *, INT32, UINT32);
13241 +typedef INT32 (*p_vlynq_interrupt_disable_t)(void *, INT32, UINT32);
13243 +/*------------------------------------------------------------------------------------------*\
13244 +\*------------------------------------------------------------------------------------------*/
13245 +extern p_vlynq_interrupt_vector_set_t p_vlynq_interrupt_vector_set;
13246 +extern p_vlynq_interrupt_vector_cntl_t p_vlynq_interrupt_vector_cntl;
13247 +extern p_vlynq_interrupt_get_count_t p_vlynq_interrupt_get_count;
13248 +extern p_vlynq_install_isr_t p_vlynq_install_isr;
13249 +extern p_vlynq_uninstall_isr_t p_vlynq_uninstall_isr;
13250 +extern p_vlynq_root_isr_t p_vlynq_root_isr;
13251 +extern p_vlynq_delay_t p_vlynq_delay;
13252 +extern p_vlynq_interrupt_vector_map_t p_vlynq_interrupt_vector_map;
13253 +extern p_vlynq_interrupt_set_polarity_t p_vlynq_interrupt_set_polarity;
13254 +extern p_vlynq_interrupt_get_polarity_t p_vlynq_interrupt_get_polarity;
13255 +extern p_vlynq_interrupt_set_type_t p_vlynq_interrupt_set_type;
13256 +extern p_vlynq_interrupt_get_type_t p_vlynq_interrupt_get_type;
13257 +extern p_vlynq_interrupt_enable_t p_vlynq_interrupt_enable;
13258 +extern p_vlynq_interrupt_disable_t p_vlynq_interrupt_disable;
13259 +extern void *p_vlynqDevice0;
13260 +extern void *p_vlynqDevice1;
13262 +/*------------------------------------------------------------------------------------------*\
13263 +\*------------------------------------------------------------------------------------------*/
13264 +enum _avalanche_need_ {
13265 + avalanche_need_vlynq,
13266 + avalanche_need_auto_mdix
13269 +int avalanche_need(enum _avalanche_need_);
13271 +#endif /*--- #ifndef _avalanche_types_h_ ---*/
13272 diff -urN linux.old/include/asm-mips/ar7/if_port.h linux.dev/include/asm-mips/ar7/if_port.h
13273 --- linux.old/include/asm-mips/ar7/if_port.h 1970-01-01 01:00:00.000000000 +0100
13274 +++ linux.dev/include/asm-mips/ar7/if_port.h 2005-11-10 01:10:46.071588750 +0100
13276 +/*******************************************************************************
13277 + * FILE PURPOSE: Interface port id Header file
13278 + *******************************************************************************
13279 + * FILE NAME: if_port.h
13281 + * DESCRIPTION: Header file carrying information about port ids of interfaces
13284 + * (C) Copyright 2003, Texas Instruments, Inc
13285 + ******************************************************************************/
13286 +#ifndef _IF_PORT_H_
13287 +#define _IF_PORT_H_
13289 +#define AVALANCHE_CPMAC_LOW_PORT_ID 0
13290 +#define AVALANCHE_CPMAC_HIGH_PORT_ID 1
13291 +#define AVALANCHE_USB_PORT_ID 2
13292 +#define AVALANCHE_WLAN_PORT_ID 3
13295 +#define AVALANCHE_MARVELL_BASE_PORT_ID 4
13297 +/* The marvell ports occupy port ids from 4 to 8 */
13298 +/* so the next port id number should start at 9 */
13301 +#endif /* _IF_PORT_H_ */
13302 diff -urN linux.old/include/asm-mips/ar7/sangam.h linux.dev/include/asm-mips/ar7/sangam.h
13303 --- linux.old/include/asm-mips/ar7/sangam.h 1970-01-01 01:00:00.000000000 +0100
13304 +++ linux.dev/include/asm-mips/ar7/sangam.h 2005-11-10 01:10:46.071588750 +0100
13306 +#ifndef _SANGAM_H_
13307 +#define _SANGAM_H_
13309 +#include <linux/config.h>
13310 +#include <asm/addrspace.h>
13312 +/*----------------------------------------------------
13313 + * Sangam's Module Base Addresses
13314 + *--------------------------------------------------*/
13315 +#define AVALANCHE_ADSL_SUB_SYS_MEM_BASE (KSEG1ADDR(0x01000000)) /* AVALANCHE ADSL Mem Base */
13316 +#define AVALANCHE_BROADBAND_INTERFACE__BASE (KSEG1ADDR(0x02000000)) /* AVALANCHE BBIF */
13317 +#define AVALANCHE_ATM_SAR_BASE (KSEG1ADDR(0x03000000)) /* AVALANCHE ATM SAR */
13318 +#define AVALANCHE_USB_SLAVE_BASE (KSEG1ADDR(0x03400000)) /* AVALANCHE USB SLAVE */
13319 +#define AVALANCHE_LOW_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x04000000)) /* AVALANCHE VLYNQ 0 Mem map */
13320 +#define AVALANCHE_LOW_CPMAC_BASE (KSEG1ADDR(0x08610000)) /* AVALANCHE CPMAC 0 */
13321 +#define AVALANCHE_EMIF_CONTROL_BASE (KSEG1ADDR(0x08610800)) /* AVALANCHE EMIF */
13322 +#define AVALANCHE_GPIO_BASE (KSEG1ADDR(0x08610900)) /* AVALANCHE GPIO */
13323 +#define AVALANCHE_CLOCK_CONTROL_BASE (KSEG1ADDR(0x08610A00)) /* AVALANCHE Clock Control */
13324 +#define AVALANCHE_WATCHDOG_TIMER_BASE (KSEG1ADDR(0x08610B00)) /* AVALANCHE Watch Dog Timer */
13325 +#define AVALANCHE_TIMER0_BASE (KSEG1ADDR(0x08610C00)) /* AVALANCHE Timer 1 */
13326 +#define AVALANCHE_TIMER1_BASE (KSEG1ADDR(0x08610D00)) /* AVALANCHE Timer 2 */
13327 +#define AVALANCHE_UART0_REGS_BASE (KSEG1ADDR(0x08610E00)) /* AVALANCHE UART 0 */
13328 +#define AVALANCHE_UART1_REGS_BASE (KSEG1ADDR(0x08610F00)) /* AVALANCHE UART 0 */
13329 +#define AVALANCHE_I2C_BASE (KSEG1ADDR(0x08611000)) /* AVALANCHE I2C */
13330 +#define AVALANCHE_USB_SLAVE_CONTROL_BASE (KSEG1ADDR(0x08611200)) /* AVALANCHE USB DMA */
13331 +#define AVALANCHE_MCDMA0_CTRL_BASE (KSEG1ADDR(0x08611400)) /* AVALANCHE MC DMA 0 (channels 0-3) */
13332 +#define AVALANCHE_RESET_CONTROL_BASE (KSEG1ADDR(0x08611600)) /* AVALANCHE Reset Control */
13333 +#define AVALANCHE_BIST_CONTROL_BASE (KSEG1ADDR(0x08611700)) /* AVALANCHE BIST Control */
13334 +#define AVALANCHE_LOW_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611800)) /* AVALANCHE VLYNQ0 Control */
13335 +#define AVALANCHE_DEVICE_CONFIG_LATCH_BASE (KSEG1ADDR(0x08611A00)) /* AVALANCHE Device Config Latch */
13336 +#define AVALANCHE_HIGH_VLYNQ_CONTROL_BASE (KSEG1ADDR(0x08611C00)) /* AVALANCHE VLYNQ1 Control */
13337 +#define AVALANCHE_MDIO_BASE (KSEG1ADDR(0x08611E00)) /* AVALANCHE MDIO */
13338 +#define AVALANCHE_FSER_BASE (KSEG1ADDR(0x08612000)) /* AVALANCHE FSER base */
13339 +#define AVALANCHE_INTC_BASE (KSEG1ADDR(0x08612400)) /* AVALANCHE INTC */
13340 +#define AVALANCHE_HIGH_CPMAC_BASE (KSEG1ADDR(0x08612800)) /* AVALANCHE CPMAC 1 */
13341 +#define AVALANCHE_HIGH_VLYNQ_MEM_MAP_BASE (KSEG1ADDR(0x0C000000)) /* AVALANCHE VLYNQ 1 Mem map */
13343 +#define AVALANCHE_SDRAM_BASE 0x14000000UL
13346 +/*----------------------------------------------------
13347 + * Sangam Interrupt Map (Primary Interrupts)
13348 + *--------------------------------------------------*/
13350 +#define AVALANCHE_UNIFIED_SECONDARY_INT 0
13351 +#define AVALANCHE_EXT_INT_0 1
13352 +#define AVALANCHE_EXT_INT_1 2
13353 +/* Line# 3 to 4 are reserved */
13354 +#define AVALANCHE_TIMER_0_INT 5
13355 +#define AVALANCHE_TIMER_1_INT 6
13356 +#define AVALANCHE_UART0_INT 7
13357 +#define AVALANCHE_UART1_INT 8
13358 +#define AVALANCHE_DMA_INT0 9
13359 +#define AVALANCHE_DMA_INT1 10
13360 +/* Line# 11 to 14 are reserved */
13361 +#define AVALANCHE_ATM_SAR_INT 15
13362 +/* Line# 16 to 18 are reserved */
13363 +#define AVALANCHE_LOW_CPMAC_INT 19
13364 +/* Line# 20 is reserved */
13365 +#define AVALANCHE_LOW_VLYNQ_INT 21
13366 +#define AVALANCHE_CODEC_WAKEUP_INT 22
13367 +/* Line# 23 is reserved */
13368 +#define AVALANCHE_USB_SLAVE_INT 24
13369 +#define AVALANCHE_HIGH_VLYNQ_INT 25
13370 +/* Line# 26 to 27 are reserved */
13371 +#define AVALANCHE_UNIFIED_PHY_INT 28
13372 +#define AVALANCHE_I2C_INT 29
13373 +#define AVALANCHE_DMA_INT2 30
13374 +#define AVALANCHE_DMA_INT3 31
13375 +/* Line# 32 is reserved */
13376 +#define AVALANCHE_HIGH_CPMAC_INT 33
13377 +/* Line# 34 to 36 is reserved */
13378 +#define AVALANCHE_VDMA_VT_RX_INT 37
13379 +#define AVALANCHE_VDMA_VT_TX_INT 38
13380 +#define AVALANCHE_ADSL_SUB_SYSTEM_INT 39
13383 +#define AVALANCHE_EMIF_INT 47
13387 +/*-----------------------------------------------------------
13388 + * Sangam's Reset Bits
13389 + *---------------------------------------------------------*/
13391 +#define AVALANCHE_UART0_RESET_BIT 0
13392 +#define AVALANCHE_UART1_RESET_BIT 1
13393 +#define AVALANCHE_I2C_RESET_BIT 2
13394 +#define AVALANCHE_TIMER0_RESET_BIT 3
13395 +#define AVALANCHE_TIMER1_RESET_BIT 4
13396 +/* Reset bit 5 is reserved. */
13397 +#define AVALANCHE_GPIO_RESET_BIT 6
13398 +#define AVALANCHE_ADSL_SUB_SYS_RESET_BIT 7
13399 +#define AVALANCHE_USB_SLAVE_RESET_BIT 8
13400 +#define AVALANCHE_ATM_SAR_RESET_BIT 9
13401 +/* Reset bit 10 is reserved. */
13402 +#define AVALANCHE_VDMA_VT_RESET_BIT 11
13403 +#define AVALANCHE_FSER_RESET_BIT 12
13404 +/* Reset bit 13 to 15 are reserved */
13405 +#define AVALANCHE_HIGH_VLYNQ_RESET_BIT 16
13406 +#define AVALANCHE_LOW_CPMAC_RESET_BIT 17
13407 +#define AVALANCHE_MCDMA_RESET_BIT 18
13408 +#define AVALANCHE_BIST_RESET_BIT 19
13409 +#define AVALANCHE_LOW_VLYNQ_RESET_BIT 20
13410 +#define AVALANCHE_HIGH_CPMAC_RESET_BIT 21
13411 +#define AVALANCHE_MDIO_RESET_BIT 22
13412 +#define AVALANCHE_ADSL_SUB_SYS_DSP_RESET_BIT 23
13413 +/* Reset bit 24 to 25 are reserved */
13414 +#define AVALANCHE_LOW_EPHY_RESET_BIT 26
13415 +/* Reset bit 27 to 31 are reserved */
13418 +#define AVALANCHE_POWER_MODULE_USBSP 0
13419 +#define AVALANCHE_POWER_MODULE_WDTP 1
13420 +#define AVALANCHE_POWER_MODULE_UT0P 2
13421 +#define AVALANCHE_POWER_MODULE_UT1P 3
13422 +#define AVALANCHE_POWER_MODULE_IICP 4
13423 +#define AVALANCHE_POWER_MODULE_VDMAP 5
13424 +#define AVALANCHE_POWER_MODULE_GPIOP 6
13425 +#define AVALANCHE_POWER_MODULE_VLYNQ1P 7
13426 +#define AVALANCHE_POWER_MODULE_SARP 8
13427 +#define AVALANCHE_POWER_MODULE_ADSLP 9
13428 +#define AVALANCHE_POWER_MODULE_EMIFP 10
13429 +#define AVALANCHE_POWER_MODULE_ADSPP 12
13430 +#define AVALANCHE_POWER_MODULE_RAMP 13
13431 +#define AVALANCHE_POWER_MODULE_ROMP 14
13432 +#define AVALANCHE_POWER_MODULE_DMAP 15
13433 +#define AVALANCHE_POWER_MODULE_BISTP 16
13434 +#define AVALANCHE_POWER_MODULE_TIMER0P 18
13435 +#define AVALANCHE_POWER_MODULE_TIMER1P 19
13436 +#define AVALANCHE_POWER_MODULE_EMAC0P 20
13437 +#define AVALANCHE_POWER_MODULE_EMAC1P 22
13438 +#define AVALANCHE_POWER_MODULE_EPHYP 24
13439 +#define AVALANCHE_POWER_MODULE_VLYNQ0P 27
13446 + * Sangam board vectors
13449 +#define AVALANCHE_VECS (KSEG1ADDR(AVALANCHE_SDRAM_BASE))
13450 +#define AVALANCHE_VECS_KSEG0 (KSEG0ADDR(AVALANCHE_SDRAM_BASE))
13452 +/*-----------------------------------------------------------------------------
13453 + * Sangam's system register.
13455 + *---------------------------------------------------------------------------*/
13456 +#define AVALANCHE_DCL_BOOTCR (KSEG1ADDR(0x08611A00))
13457 +#define AVALANCHE_EMIF_SDRAM_CFG (AVALANCHE_EMIF_CONTROL_BASE + 0x8)
13458 +#define AVALANCHE_RST_CTRL_PRCR (KSEG1ADDR(0x08611600))
13459 +#define AVALANCHE_RST_CTRL_SWRCR (KSEG1ADDR(0x08611604))
13460 +#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611600))
13462 +#define AVALANCHE_POWER_CTRL_PDCR (KSEG1ADDR(0x08610A00))
13463 +#define AVALANCHE_WAKEUP_CTRL_WKCR (KSEG1ADDR(0x08610A0C))
13465 +#define AVALANCHE_GPIO_DATA_IN (AVALANCHE_GPIO_BASE + 0x0)
13466 +#define AVALANCHE_GPIO_DATA_OUT (AVALANCHE_GPIO_BASE + 0x4)
13467 +#define AVALANCHE_GPIO_DIR (AVALANCHE_GPIO_BASE + 0x8)
13468 +#define AVALANCHE_GPIO_ENBL (AVALANCHE_GPIO_BASE + 0xC)
13469 +#define AVALANCHE_CVR (AVALANCHE_GPIO_BASE + 0x14)
13472 + * Yamon Prom print address.
13474 +#define AVALANCHE_YAMON_FUNCTION_BASE (KSEG1ADDR(0x10000500))
13475 +#define AVALANCHE_YAMON_PROM_PRINT_COUNT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x4) /* print_count function */
13476 +#define AVALANCHE_YAMON_PROM_PRINT_ADDR (AVALANCHE_YAMON_FUNCTION_BASE + 0x34)
13478 +#define AVALANCHE_BASE_BAUD ( 3686400 / 16 )
13480 +#define AVALANCHE_GPIO_PIN_COUNT 32
13481 +#define AVALANCHE_GPIO_OFF_MAP {0xF34FFFC0}
13483 +#include "sangam_boards.h"
13485 +#endif /*_SANGAM_H_ */
13486 diff -urN linux.old/include/asm-mips/ar7/sangam_boards.h linux.dev/include/asm-mips/ar7/sangam_boards.h
13487 --- linux.old/include/asm-mips/ar7/sangam_boards.h 1970-01-01 01:00:00.000000000 +0100
13488 +++ linux.dev/include/asm-mips/ar7/sangam_boards.h 2005-11-10 01:10:46.071588750 +0100
13490 +#ifndef _SANGAM_BOARDS_H
13491 +#define _SANGAM_BOARDS_H
13493 +// Let us define board specific information here.
13496 +#if defined(CONFIG_AR7DB)
13498 +#define AFECLK_FREQ 35328000
13499 +#define REFCLK_FREQ 25000000
13500 +#define OSC3_FREQ 24000000
13501 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
13502 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
13503 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
13508 +#if defined(CONFIG_AR7RD)
13509 +#define AFECLK_FREQ 35328000
13510 +#define REFCLK_FREQ 25000000
13511 +#define OSC3_FREQ 24000000
13512 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
13513 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
13514 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
13518 +#if defined(CONFIG_AR7WI)
13519 +#define AFECLK_FREQ 35328000
13520 +#define REFCLK_FREQ 25000000
13521 +#define OSC3_FREQ 24000000
13522 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
13523 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
13524 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
13528 +#if defined(CONFIG_AR7V)
13529 +#define AFECLK_FREQ 35328000
13530 +#define REFCLK_FREQ 25000000
13531 +#define OSC3_FREQ 24000000
13532 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
13533 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x2
13534 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
13538 +#if defined(CONFIG_AR7WRD)
13539 +#define AFECLK_FREQ 35328000
13540 +#define REFCLK_FREQ 25000000
13541 +#define OSC3_FREQ 24000000
13542 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
13543 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
13544 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
13548 +#if defined(CONFIG_AR7VWI)
13549 +#define AFECLK_FREQ 35328000
13550 +#define REFCLK_FREQ 25000000
13551 +#define OSC3_FREQ 24000000
13552 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0x80000000
13553 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x00010000
13554 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0x80000000
13558 +#if defined CONFIG_SEAD2
13559 +#define AVALANCHE_LOW_CPMAC_PHY_MASK 0xAAAAAAAA
13560 +#define AVALANCHE_HIGH_CPMAC_PHY_MASK 0x55555555
13561 +#define AVALANCHE_LOW_CPMAC_MDIX_MASK 0
13562 +#include <asm/mips-boards/sead.h>
13567 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx.h linux.dev/include/asm-mips/ar7/tnetd73xx.h
13568 --- linux.old/include/asm-mips/ar7/tnetd73xx.h 1970-01-01 01:00:00.000000000 +0100
13569 +++ linux.dev/include/asm-mips/ar7/tnetd73xx.h 2005-11-10 01:10:46.075589000 +0100
13571 +/******************************************************************************
13572 + * FILE PURPOSE: TNETD73xx Common Header File
13573 + ******************************************************************************
13574 + * FILE NAME: tnetd73xx.h
13576 + * DESCRIPTION: shared typedef's, constants and API for TNETD73xx
13578 + * REVISION HISTORY:
13579 + * 27 Nov 02 - PSP TII
13581 + * (C) Copyright 2002, Texas Instruments, Inc
13582 + *******************************************************************************/
13587 + * These are const, typedef, and api definitions for tnetd73xx.
13590 + * 1. This file may be included into both C and Assembly files.
13591 + * - for .s files, please do #define _ASMLANGUAGE in your ASM file to
13592 + * avoid C data types (typedefs) below;
13593 + * - for .c files, you don't have to do anything special.
13595 + * 2. This file has a number of sections for each SOC subsystem. When adding
13596 + * a new constant, find the subsystem you are working on and follow the
13597 + * name pattern. If you are adding another typedef for your interface, please,
13598 + * place it with other typedefs and function prototypes.
13600 + * 3. Please, DO NOT add any macros or types that are local to a subsystem to avoid
13601 + * cluttering. Include such items directly into the module's .c file or have a
13602 + * local .h file to pass data between smaller modules. This file defines only
13606 +#ifndef __TNETD73XX_H__
13607 +#define __TNETD73XX_H__
13609 +#ifndef _ASMLANGUAGE /* This part not for assembly language */
13611 +extern unsigned int tnetd73xx_mips_freq;
13612 +extern unsigned int tnetd73xx_vbus_freq;
13614 +#include "tnetd73xx_err.h"
13616 +#endif /* _ASMLANGUAGE */
13619 +/*******************************************************************************************
13620 +* Emerald core specific
13621 +******************************************************************************************** */
13624 +#elif defined(LITTLE_ENDIAN)
13626 +#error Need to define endianism
13630 +#define KSEG_MSK 0xE0000000 /* Most significant 3 bits denote kseg choice */
13633 +#ifndef KSEG_INV_MASK
13634 +#define KSEG_INV_MASK 0x1FFFFFFF /* Inverted mask for kseg address */
13637 +#ifndef KSEG0_BASE
13638 +#define KSEG0_BASE 0x80000000
13641 +#ifndef KSEG1_BASE
13642 +#define KSEG1_BASE 0xA0000000
13646 +#define KSEG0(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG0_BASE)
13650 +#define KSEG1(addr) (((__u32)(addr) & ~KSEG_MSK) | KSEG1_BASE)
13654 +#define KUSEG(addr) ((__u32)(addr) & ~KSEG_MSK)
13658 +#define PHYS_ADDR(addr) ((addr) & KSEG_INV_MASK)
13661 +#ifndef PHYS_TO_K0
13662 +#define PHYS_TO_K0(addr) (PHYS_ADDR(addr)|KSEG0_BASE)
13665 +#ifndef PHYS_TO_K1
13666 +#define PHYS_TO_K1(addr) (PHYS_ADDR(addr)|KSEG1_BASE)
13670 +#define REG8_ADDR(addr) (volatile __u8 *)(PHYS_TO_K1(addr))
13671 +#define REG8_DATA(addr) (*(volatile __u8 *)(PHYS_TO_K1(addr)))
13672 +#define REG8_WRITE(addr, data) REG8_DATA(addr) = data;
13673 +#define REG8_READ(addr, data) data = (__u8) REG8_DATA(addr);
13676 +#ifndef REG16_ADDR
13677 +#define REG16_ADDR(addr) (volatile __u16 *)(PHYS_TO_K1(addr))
13678 +#define REG16_DATA(addr) (*(volatile __u16 *)(PHYS_TO_K1(addr)))
13679 +#define REG16_WRITE(addr, data) REG16_DATA(addr) = data;
13680 +#define REG16_READ(addr, data) data = (__u16) REG16_DATA(addr);
13683 +#ifndef REG32_ADDR
13684 +#define REG32_ADDR(addr) (volatile __u32 *)(PHYS_TO_K1(addr))
13685 +#define REG32_DATA(addr) (*(volatile __u32 *)(PHYS_TO_K1(addr)))
13686 +#define REG32_WRITE(addr, data) REG32_DATA(addr) = data;
13687 +#define REG32_READ(addr, data) data = (__u32) REG32_DATA(addr);
13690 +#ifdef _LINK_KSEG0_ /* Application is linked into KSEG0 space */
13691 +#define VIRT_ADDR(addr) PHYS_TO_K0(PHYS_ADDR(addr))
13694 +#ifdef _LINK_KSEG1_ /* Application is linked into KSEG1 space */
13695 +#define VIRT_ADDR(addr) PHYS_TO_K1(PHYS_ADDR(addr))
13698 +#if !defined(_LINK_KSEG0_) && !defined(_LINK_KSEG1_)
13699 +#error You must define _LINK_KSEG0_ or _LINK_KSEG1_ to compile the code.
13702 +/* TNETD73XX chip definations */
13704 +#define FREQ_1MHZ 1000000
13705 +#define TNETD73XX_MIPS_FREQ tnetd73xx_mips_freq /* CPU clock frequency */
13706 +#define TNETD73XX_VBUS_FREQ tnetd73xx_vbus_freq /* originally (TNETD73XX_MIPS_FREQ/2) */
13709 +#define TNETD73XX_MIPS_FREQ_DEFAULT 25000000 /* 25 Mhz for sead2 board crystal */
13711 +#define TNETD73XX_MIPS_FREQ_DEFAULT 125000000 /* 125 Mhz */
13713 +#define TNETD73XX_VBUS_FREQ_DEFAULT (TNETD73XX_MIPS_FREQ_DEFAULT / 2) /* Sync mode */
13717 +/* Module base addresses */
13718 +#define TNETD73XX_ADSLSS_BASE PHYS_TO_K1(0x01000000) /* ADSLSS Module */
13719 +#define TNETD73XX_BBIF_CTRL_BASE PHYS_TO_K1(0x02000000) /* BBIF Control */
13720 +#define TNETD73XX_ATMSAR_BASE PHYS_TO_K1(0x03000000) /* ATM SAR */
13721 +#define TNETD73XX_USB_BASE PHYS_TO_K1(0x03400000) /* USB Module */
13722 +#define TNETD73XX_VLYNQ0_BASE PHYS_TO_K1(0x04000000) /* VLYNQ0 Module */
13723 +#define TNETD73xx_EMAC0_BASE PHYS_TO_K1(0x08610000) /* EMAC0 Module*/
13724 +#define TNETD73XX_EMIF_BASE PHYS_TO_K1(0x08610800) /* EMIF Module */
13725 +#define TNETD73XX_GPIO_BASE PHYS_TO_K1(0x08610900) /* GPIO control */
13726 +#define TNETD73XX_CLOCK_CTRL_BASE PHYS_TO_K1(0x08610A00) /* Clock Control */
13727 +#define TNETD73XX_WDTIMER_BASE PHYS_TO_K1(0x08610B00) /* WDTIMER Module */
13728 +#define TNETD73XX_TIMER0_BASE PHYS_TO_K1(0x08610C00) /* TIMER0 Module */
13729 +#define TNETD73XX_TIMER1_BASE PHYS_TO_K1(0x08610D00) /* TIMER1 Module */
13730 +#define TNETD73XX_UARTA_BASE PHYS_TO_K1(0x08610E00) /* UART A */
13731 +#define TNETD73XX_UARTB_BASE PHYS_TO_K1(0x08610F00) /* UART B */
13732 +#define TNETD73XX_I2C_BASE PHYS_TO_K1(0x08611000) /* I2C Module */
13733 +#define TNETD73XX_USB_DMA_BASE PHYS_TO_K1(0x08611200) /* USB Module */
13734 +#define TNETD73XX_MCDMA_BASE PHYS_TO_K1(0x08611400) /* MC-DMA */
13735 +#define TNETD73xx_VDMAVT_BASE PHYS_TO_K1(0x08611500) /* VDMAVT Control */
13736 +#define TNETD73XX_RST_CTRL_BASE PHYS_TO_K1(0x08611600) /* Reset Control */
13737 +#define TNETD73xx_BIST_CTRL_BASE PHYS_TO_K1(0x08611700) /* BIST Control */
13738 +#define TNETD73xx_VLYNQ0_CTRL_BASE PHYS_TO_K1(0x08611800) /* VLYNQ0 Control */
13739 +#define TNETD73XX_DCL_BASE PHYS_TO_K1(0x08611A00) /* Device Configuration Latch */
13740 +#define TNETD73xx_VLYNQ1_CTRL_BASE PHYS_TO_K1(0x08611C00) /* VLYNQ1 Control */
13741 +#define TNETD73xx_MDIO_BASE PHYS_TO_K1(0x08611E00) /* MDIO Control */
13742 +#define TNETD73XX_FSER_BASE PHYS_TO_K1(0x08612000) /* FSER Control */
13743 +#define TNETD73XX_INTC_BASE PHYS_TO_K1(0x08612400) /* Interrupt Controller */
13744 +#define TNETD73xx_EMAC1_BASE PHYS_TO_K1(0x08612800) /* EMAC1 Module*/
13745 +#define TNETD73XX_VLYNQ1_BASE PHYS_TO_K1(0x0C000000) /* VLYNQ1 Module */
13747 +/* BBIF Registers */
13748 +#define TNETD73XX_BBIF_ADSLADR (TNETD73XX_BBIF_CTRL_BASE + 0x0)
13750 +/* Device Configuration Latch Registers */
13751 +#define TNETD73XX_DCL_BOOTCR (TNETD73XX_DCL_BASE + 0x0)
13752 +#define TNETD73XX_DCL_DPLLSELR (TNETD73XX_DCL_BASE + 0x10)
13753 +#define TNETD73XX_DCL_SPEEDCTLR (TNETD73XX_DCL_BASE + 0x14)
13754 +#define TNETD73XX_DCL_SPEEDPWDR (TNETD73XX_DCL_BASE + 0x18)
13755 +#define TNETD73XX_DCL_SPEEDCAPR (TNETD73XX_DCL_BASE + 0x1C)
13757 +/* GPIO Control */
13758 +#define TNETD73XX_GPIODINR (TNETD73XX_GPIO_BASE + 0x0)
13759 +#define TNETD73XX_GPIODOUTR (TNETD73XX_GPIO_BASE + 0x4)
13760 +#define TNETD73XX_GPIOPDIRR (TNETD73XX_GPIO_BASE + 0x8)
13761 +#define TNETD73XX_GPIOENR (TNETD73XX_GPIO_BASE + 0xC)
13762 +#define TNETD73XX_CVR (TNETD73XX_GPIO_BASE + 0x14)
13763 +#define TNETD73XX_DIDR1 (TNETD73XX_GPIO_BASE + 0x18)
13764 +#define TNETD73XX_DIDR2 (TNETD73XX_GPIO_BASE + 0x1C)
13766 +/* Reset Control */
13767 +#define TNETD73XX_RST_CTRL_PRCR (TNETD73XX_RST_CTRL_BASE + 0x0)
13768 +#define TNETD73XX_RST_CTRL_SWRCR (TNETD73XX_RST_CTRL_BASE + 0x4)
13769 +#define TNETD73XX_RST_CTRL_RSR (TNETD73XX_RST_CTRL_BASE + 0x8)
13771 +/* Power Control */
13772 +#define TNETD73XX_POWER_CTRL_PDCR (TNETD73XX_CLOCK_CTRL_BASE + 0x0)
13773 +#define TNETD73XX_POWER_CTRL_PCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x4)
13774 +#define TNETD73XX_POWER_CTRL_PDUCR (TNETD73XX_CLOCK_CTRL_BASE + 0x8)
13775 +#define TNETD73XX_POWER_CTRL_WKCR (TNETD73XX_CLOCK_CTRL_BASE + 0xC)
13777 +/* Clock Control */
13778 +#define TNETD73XX_CLK_CTRL_SCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x20)
13779 +#define TNETD73XX_CLK_CTRL_SCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x30)
13780 +#define TNETD73XX_CLK_CTRL_MCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x40)
13781 +#define TNETD73XX_CLK_CTRL_MCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x50)
13782 +#define TNETD73XX_CLK_CTRL_UCLKCR (TNETD73XX_CLOCK_CTRL_BASE + 0x60)
13783 +#define TNETD73XX_CLK_CTRL_UCLKPLLCR (TNETD73XX_CLOCK_CTRL_BASE + 0x70)
13784 +#define TNETD73XX_CLK_CTRL_ACLKCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x80)
13785 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR0 (TNETD73XX_CLOCK_CTRL_BASE + 0x90)
13786 +#define TNETD73XX_CLK_CTRL_ACLKCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xA0)
13787 +#define TNETD73XX_CLK_CTRL_ACLKPLLCR1 (TNETD73XX_CLOCK_CTRL_BASE + 0xB0)
13789 +/* EMIF control */
13790 +#define TNETD73XX_EMIF_SDRAM_CFG ( TNETD73XX_EMIF_BASE + 0x08 )
13794 +#define TNETD73XX_UART_FREQ 3686400
13796 +#define TNETD73XX_UART_FREQ TNETD73XX_VBUS_FREQ
13799 +/* Interrupt Controller */
13801 +/* Primary interrupts */
13802 +#define TNETD73XX_INTC_UNIFIED_SECONDARY 0 /* Unified secondary interrupt */
13803 +#define TNETD73XX_INTC_EXTERNAL0 1 /* External Interrupt Line 0 */
13804 +#define TNETD73XX_INTC_EXTERNAL1 2 /* External Interrupt Line 1 */
13805 +#define TNETD73XX_INTC_RESERVED3 3 /* Reserved */
13806 +#define TNETD73XX_INTC_RESERVED4 4 /* Reserved */
13807 +#define TNETD73XX_INTC_TIMER0 5 /* TIMER 0 int */
13808 +#define TNETD73XX_INTC_TIMER1 6 /* TIMER 1 int */
13809 +#define TNETD73XX_INTC_UART0 7 /* UART 0 int */
13810 +#define TNETD73XX_INTC_UART1 8 /* UART 1 int */
13811 +#define TNETD73XX_INTC_MCDMA0 9 /* MCDMA 0 int */
13812 +#define TNETD73XX_INTC_MCDMA1 10 /* MCDMA 1 int */
13813 +#define TNETD73XX_INTC_RESERVED11 11 /* Reserved */
13814 +#define TNETD73XX_INTC_RESERVED12 12 /* Reserved */
13815 +#define TNETD73XX_INTC_RESERVED13 13 /* Reserved */
13816 +#define TNETD73XX_INTC_RESERVED14 14 /* Reserved */
13817 +#define TNETD73XX_INTC_ATMSAR 15 /* ATM SAR int */
13818 +#define TNETD73XX_INTC_RESERVED16 16 /* Reserved */
13819 +#define TNETD73XX_INTC_RESERVED17 17 /* Reserved */
13820 +#define TNETD73XX_INTC_RESERVED18 18 /* Reserved */
13821 +#define TNETD73XX_INTC_EMAC0 19 /* EMAC 0 int */
13822 +#define TNETD73XX_INTC_RESERVED20 20 /* Reserved */
13823 +#define TNETD73XX_INTC_VLYNQ0 21 /* VLYNQ 0 int */
13824 +#define TNETD73XX_INTC_CODEC 22 /* CODEC int */
13825 +#define TNETD73XX_INTC_RESERVED23 23 /* Reserved */
13826 +#define TNETD73XX_INTC_USBSLAVE 24 /* USB Slave int */
13827 +#define TNETD73XX_INTC_VLYNQ1 25 /* VLYNQ 1 int */
13828 +#define TNETD73XX_INTC_RESERVED26 26 /* Reserved */
13829 +#define TNETD73XX_INTC_RESERVED27 27 /* Reserved */
13830 +#define TNETD73XX_INTC_ETH_PHY 28 /* Ethernet PHY */
13831 +#define TNETD73XX_INTC_I2C 29 /* I2C int */
13832 +#define TNETD73XX_INTC_MCDMA2 30 /* MCDMA 2 int */
13833 +#define TNETD73XX_INTC_MCDMA3 31 /* MCDMA 3 int */
13834 +#define TNETD73XX_INTC_RESERVED32 32 /* Reserved */
13835 +#define TNETD73XX_INTC_EMAC1 33 /* EMAC 1 int */
13836 +#define TNETD73XX_INTC_RESERVED34 34 /* Reserved */
13837 +#define TNETD73XX_INTC_RESERVED35 35 /* Reserved */
13838 +#define TNETD73XX_INTC_RESERVED36 36 /* Reserved */
13839 +#define TNETD73XX_INTC_VDMAVTRX 37 /* VDMAVTRX */
13840 +#define TNETD73XX_INTC_VDMAVTTX 38 /* VDMAVTTX */
13841 +#define TNETD73XX_INTC_ADSLSS 39 /* ADSLSS */
13843 +/* Secondary interrupts */
13844 +#define TNETD73XX_INTC_SEC0 40 /* Secondary */
13845 +#define TNETD73XX_INTC_SEC1 41 /* Secondary */
13846 +#define TNETD73XX_INTC_SEC2 42 /* Secondary */
13847 +#define TNETD73XX_INTC_SEC3 43 /* Secondary */
13848 +#define TNETD73XX_INTC_SEC4 44 /* Secondary */
13849 +#define TNETD73XX_INTC_SEC5 45 /* Secondary */
13850 +#define TNETD73XX_INTC_SEC6 46 /* Secondary */
13851 +#define TNETD73XX_INTC_EMIF 47 /* EMIF */
13852 +#define TNETD73XX_INTC_SEC8 48 /* Secondary */
13853 +#define TNETD73XX_INTC_SEC9 49 /* Secondary */
13854 +#define TNETD73XX_INTC_SEC10 50 /* Secondary */
13855 +#define TNETD73XX_INTC_SEC11 51 /* Secondary */
13856 +#define TNETD73XX_INTC_SEC12 52 /* Secondary */
13857 +#define TNETD73XX_INTC_SEC13 53 /* Secondary */
13858 +#define TNETD73XX_INTC_SEC14 54 /* Secondary */
13859 +#define TNETD73XX_INTC_SEC15 55 /* Secondary */
13860 +#define TNETD73XX_INTC_SEC16 56 /* Secondary */
13861 +#define TNETD73XX_INTC_SEC17 57 /* Secondary */
13862 +#define TNETD73XX_INTC_SEC18 58 /* Secondary */
13863 +#define TNETD73XX_INTC_SEC19 59 /* Secondary */
13864 +#define TNETD73XX_INTC_SEC20 60 /* Secondary */
13865 +#define TNETD73XX_INTC_SEC21 61 /* Secondary */
13866 +#define TNETD73XX_INTC_SEC22 62 /* Secondary */
13867 +#define TNETD73XX_INTC_SEC23 63 /* Secondary */
13868 +#define TNETD73XX_INTC_SEC24 64 /* Secondary */
13869 +#define TNETD73XX_INTC_SEC25 65 /* Secondary */
13870 +#define TNETD73XX_INTC_SEC26 66 /* Secondary */
13871 +#define TNETD73XX_INTC_SEC27 67 /* Secondary */
13872 +#define TNETD73XX_INTC_SEC28 68 /* Secondary */
13873 +#define TNETD73XX_INTC_SEC29 69 /* Secondary */
13874 +#define TNETD73XX_INTC_SEC30 70 /* Secondary */
13875 +#define TNETD73XX_INTC_SEC31 71 /* Secondary */
13877 +/* These ugly macros are to access the -1 registers, like config1 */
13878 +#define MFC0_SEL1_OPCODE(dst, src)\
13879 + .word (0x40000000 | ((dst)<<16) | ((src)<<11) | 1);\
13884 +#define MTC0_SEL1_OPCODE(dst, src)\
13885 + .word (0x40800000 | ((dst)<<16) | ((src)<<11) | 1);\
13891 +/* Below are Jade core specific */
13892 +#define CFG0_4K_IL_MASK 0x00380000
13893 +#define CFG0_4K_IL_SHIFT 19
13894 +#define CFG0_4K_IA_MASK 0x00070000
13895 +#define CFG0_4K_IA_SHIFT 16
13896 +#define CFG0_4K_IS_MASK 0x01c00000
13897 +#define CFG0_4K_IS_SHIFT 22
13899 +#define CFG0_4K_DL_MASK 0x00001c00
13900 +#define CFG0_4K_DL_SHIFT 10
13901 +#define CFG0_4K_DA_MASK 0x00000380
13902 +#define CFG0_4K_DA_SHIFT 7
13903 +#define CFG0_4K_DS_MASK 0x0000E000
13904 +#define CFG0_4K_DS_SHIFT 13
13908 +#endif /* __TNETD73XX_H_ */
13909 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_err.h linux.dev/include/asm-mips/ar7/tnetd73xx_err.h
13910 --- linux.old/include/asm-mips/ar7/tnetd73xx_err.h 1970-01-01 01:00:00.000000000 +0100
13911 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_err.h 2005-11-10 01:10:46.075589000 +0100
13913 +/******************************************************************************
13914 + * FILE PURPOSE: TNETD73xx Error Definations Header File
13915 + ******************************************************************************
13916 + * FILE NAME: tnetd73xx_err.h
13918 + * DESCRIPTION: Error definations for TNETD73XX
13920 + * REVISION HISTORY:
13921 + * 27 Nov 02 - PSP TII
13923 + * (C) Copyright 2002, Texas Instruments, Inc
13924 + *******************************************************************************/
13927 +#ifndef __TNETD73XX_ERR_H__
13928 +#define __TNETD73XX_ERR_H__
13930 +typedef enum TNETD73XX_ERR_t
13932 + TNETD73XX_ERR_OK = 0, /* OK or SUCCESS */
13933 + TNETD73XX_ERR_ERROR = -1, /* Unspecified/Generic ERROR */
13935 + /* Pointers and args */
13936 + TNETD73XX_ERR_INVARG = -2, /* Invaild argument to the call */
13937 + TNETD73XX_ERR_NULLPTR = -3, /* NULL pointer */
13938 + TNETD73XX_ERR_BADPTR = -4, /* Bad (out of mem) pointer */
13940 + /* Memory issues */
13941 + TNETD73XX_ERR_ALLOC_FAIL = -10, /* allocation failed */
13942 + TNETD73XX_ERR_FREE_FAIL = -11, /* free failed */
13943 + TNETD73XX_ERR_MEM_CORRUPT = -12, /* corrupted memory */
13944 + TNETD73XX_ERR_BUF_LINK = -13, /* buffer linking failed */
13946 + /* Device issues */
13947 + TNETD73XX_ERR_DEVICE_TIMEOUT = -20, /* device timeout on read/write */
13948 + TNETD73XX_ERR_DEVICE_MALFUNC = -21, /* device malfunction */
13950 + TNETD73XX_ERR_INVID = -30 /* Invalid ID */
13954 +#endif /* __TNETD73XX_ERR_H__ */
13955 diff -urN linux.old/include/asm-mips/ar7/tnetd73xx_misc.h linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h
13956 --- linux.old/include/asm-mips/ar7/tnetd73xx_misc.h 1970-01-01 01:00:00.000000000 +0100
13957 +++ linux.dev/include/asm-mips/ar7/tnetd73xx_misc.h 2005-11-10 01:10:46.075589000 +0100
13959 +/******************************************************************************
13960 + * FILE PURPOSE: TNETD73xx Misc modules API Header
13961 + ******************************************************************************
13962 + * FILE NAME: tnetd73xx_misc.h
13964 + * DESCRIPTION: Clock Control, Reset Control, Power Management, GPIO
13965 + * FSER Modules API
13966 + * As per TNETD73xx specifications
13968 + * REVISION HISTORY:
13969 + * 27 Nov 02 - Sharath Kumar PSP TII
13970 + * 14 Feb 03 - Anant Gole PSP TII
13972 + * (C) Copyright 2002, Texas Instruments, Inc
13973 + *******************************************************************************/
13975 +#ifndef __TNETD73XX_MISC_H__
13976 +#define __TNETD73XX_MISC_H__
13978 +/*****************************************************************************
13979 + * Reset Control Module
13980 + *****************************************************************************/
13982 +typedef enum TNETD73XX_RESET_MODULE_tag
13984 + RESET_MODULE_UART0 = 0,
13985 + RESET_MODULE_UART1 = 1,
13986 + RESET_MODULE_I2C = 2,
13987 + RESET_MODULE_TIMER0 = 3,
13988 + RESET_MODULE_TIMER1 = 4,
13989 + RESET_MODULE_GPIO = 6,
13990 + RESET_MODULE_ADSLSS = 7,
13991 + RESET_MODULE_USBS = 8,
13992 + RESET_MODULE_SAR = 9,
13993 + RESET_MODULE_VDMA_VT = 11,
13994 + RESET_MODULE_FSER = 12,
13995 + RESET_MODULE_VLYNQ1 = 16,
13996 + RESET_MODULE_EMAC0 = 17,
13997 + RESET_MODULE_DMA = 18,
13998 + RESET_MODULE_BIST = 19,
13999 + RESET_MODULE_VLYNQ0 = 20,
14000 + RESET_MODULE_EMAC1 = 21,
14001 + RESET_MODULE_MDIO = 22,
14002 + RESET_MODULE_ADSLSS_DSP = 23,
14003 + RESET_MODULE_EPHY = 26
14004 +} TNETD73XX_RESET_MODULE_T;
14006 +typedef enum TNETD73XX_RESET_CTRL_tag
14010 +} TNETD73XX_RESET_CTRL_T;
14012 +typedef enum TNETD73XX_SYS_RST_MODE_tag
14014 + RESET_SOC_WITH_MEMCTRL = 1, /* SW0 bit in SWRCR register */
14015 + RESET_SOC_WITHOUT_MEMCTRL = 2 /* SW1 bit in SWRCR register */
14016 +} TNETD73XX_SYS_RST_MODE_T;
14018 +typedef enum TNETD73XX_SYS_RESET_STATUS_tag
14020 + HARDWARE_RESET = 0,
14021 + SOFTWARE_RESET0, /* Caused by writing 1 to SW0 bit in SWRCR register */
14023 + SOFTWARE_RESET1 /* Caused by writing 1 to SW1 bit in SWRCR register */
14024 +} TNETD73XX_SYS_RESET_STATUS_T;
14026 +void tnetd73xx_reset_ctrl(TNETD73XX_RESET_MODULE_T reset_module,
14027 + TNETD73XX_RESET_CTRL_T reset_ctrl);
14028 +TNETD73XX_RESET_CTRL_T tnetd73xx_get_reset_status(TNETD73XX_RESET_MODULE_T reset_module);
14029 +void tnetd73xx_sys_reset(TNETD73XX_SYS_RST_MODE_T mode);
14030 +TNETD73XX_SYS_RESET_STATUS_T tnetd73xx_get_sys_last_reset_status(void);
14032 +/*****************************************************************************
14033 + * Power Control Module
14034 + *****************************************************************************/
14036 +typedef enum TNETD73XX_POWER_MODULE_tag
14038 + POWER_MODULE_USBSP = 0,
14039 + POWER_MODULE_WDTP = 1,
14040 + POWER_MODULE_UT0P = 2,
14041 + POWER_MODULE_UT1P = 3,
14042 + POWER_MODULE_IICP = 4,
14043 + POWER_MODULE_VDMAP = 5,
14044 + POWER_MODULE_GPIOP = 6,
14045 + POWER_MODULE_VLYNQ1P = 7,
14046 + POWER_MODULE_SARP = 8,
14047 + POWER_MODULE_ADSLP = 9,
14048 + POWER_MODULE_EMIFP = 10,
14049 + POWER_MODULE_ADSPP = 12,
14050 + POWER_MODULE_RAMP = 13,
14051 + POWER_MODULE_ROMP = 14,
14052 + POWER_MODULE_DMAP = 15,
14053 + POWER_MODULE_BISTP = 16,
14054 + POWER_MODULE_TIMER0P = 18,
14055 + POWER_MODULE_TIMER1P = 19,
14056 + POWER_MODULE_EMAC0P = 20,
14057 + POWER_MODULE_EMAC1P = 22,
14058 + POWER_MODULE_EPHYP = 24,
14059 + POWER_MODULE_VLYNQ0P = 27,
14060 +} TNETD73XX_POWER_MODULE_T;
14062 +typedef enum TNETD73XX_POWER_CTRL_tag
14064 + POWER_CTRL_POWER_UP = 0,
14065 + POWER_CTRL_POWER_DOWN
14066 +} TNETD73XX_POWER_CTRL_T;
14068 +typedef enum TNETD73XX_SYS_POWER_MODE_tag
14070 + GLOBAL_POWER_MODE_RUN = 0, /* All system is up */
14071 + GLOBAL_POWER_MODE_IDLE, /* MIPS is power down, all peripherals working */
14072 + GLOBAL_POWER_MODE_STANDBY, /* Chip in power down, but clock to ADSKL subsystem is running */
14073 + GLOBAL_POWER_MODE_POWER_DOWN /* Total chip is powered down */
14074 +} TNETD73XX_SYS_POWER_MODE_T;
14076 +void tnetd73xx_power_ctrl(TNETD73XX_POWER_MODULE_T power_module, TNETD73XX_POWER_CTRL_T power_ctrl);
14077 +TNETD73XX_POWER_CTRL_T tnetd73xx_get_pwr_status(TNETD73XX_POWER_MODULE_T power_module);
14078 +void tnetd73xx_set_global_pwr_mode(TNETD73XX_SYS_POWER_MODE_T power_mode);
14079 +TNETD73XX_SYS_POWER_MODE_T tnetd73xx_get_global_pwr_mode(void);
14081 +/*****************************************************************************
14083 + *****************************************************************************/
14085 +typedef enum TNETD73XX_WAKEUP_INTERRUPT_tag
14091 +} TNETD73XX_WAKEUP_INTERRUPT_T;
14093 +typedef enum TNETD73XX_WAKEUP_CTRL_tag
14095 + WAKEUP_DISABLED = 0,
14097 +} TNETD73XX_WAKEUP_CTRL_T;
14099 +typedef enum TNETD73XX_WAKEUP_POLARITY_tag
14101 + WAKEUP_ACTIVE_HIGH = 0,
14102 + WAKEUP_ACTIVE_LOW
14103 +} TNETD73XX_WAKEUP_POLARITY_T;
14105 +void tnetd73xx_wakeup_ctrl(TNETD73XX_WAKEUP_INTERRUPT_T wakeup_int,
14106 + TNETD73XX_WAKEUP_CTRL_T wakeup_ctrl,
14107 + TNETD73XX_WAKEUP_POLARITY_T wakeup_polarity);
14109 +/*****************************************************************************
14111 + *****************************************************************************/
14113 +typedef enum TNETD73XX_FSER_MODE_tag
14117 +} TNETD73XX_FSER_MODE_T;
14119 +void tnetd73xx_fser_ctrl(TNETD73XX_FSER_MODE_T fser_mode);
14121 +/*****************************************************************************
14123 + *****************************************************************************/
14125 +#define CLK_MHZ(x) ( (x) * 1000000 )
14127 +typedef enum TNETD73XX_CLKC_ID_tag
14133 +} TNETD73XX_CLKC_ID_T;
14135 +void tnetd73xx_clkc_init(__u32 afeclk, __u32 refclk, __u32 xtal3in);
14136 +TNETD73XX_ERR tnetd73xx_clkc_set_freq(TNETD73XX_CLKC_ID_T clk_id, __u32 output_freq);
14137 +__u32 tnetd73xx_clkc_get_freq(TNETD73XX_CLKC_ID_T clk_id);
14139 +/*****************************************************************************
14141 + *****************************************************************************/
14143 +typedef enum TNETD73XX_GPIO_PIN_tag
14145 + GPIO_UART0_RD = 0,
14146 + GPIO_UART0_TD = 1,
14147 + GPIO_UART0_RTS = 2,
14148 + GPIO_UART0_CTS = 3,
14149 + GPIO_FSER_CLK = 4,
14151 + GPIO_EXT_AFE_SCLK = 6,
14152 + GPIO_EXT_AFE_TX_FS = 7,
14153 + GPIO_EXT_AFE_TXD = 8,
14154 + GPIO_EXT_AFE_RS_FS = 9,
14155 + GPIO_EXT_AFE_RXD1 = 10,
14156 + GPIO_EXT_AFE_RXD0 = 11,
14157 + GPIO_EXT_AFE_CDIN = 12,
14158 + GPIO_EXT_AFE_CDOUT = 13,
14159 + GPIO_EPHY_SPEED100 = 14,
14160 + GPIO_EPHY_LINKON = 15,
14161 + GPIO_EPHY_ACTIVITY = 16,
14162 + GPIO_EPHY_FDUPLEX = 17,
14165 + GPIO_MBSP0_TCLK = 20,
14166 + GPIO_MBSP0_RCLK = 21,
14167 + GPIO_MBSP0_RD = 22,
14168 + GPIO_MBSP0_TD = 23,
14169 + GPIO_MBSP0_RFS = 24,
14170 + GPIO_MBSP0_TFS = 25,
14171 + GPIO_MII_DIO = 26,
14172 + GPIO_MII_DCLK = 27,
14173 +} TNETD73XX_GPIO_PIN_T;
14175 +typedef enum TNETD73XX_GPIO_PIN_MODE_tag
14177 + FUNCTIONAL_PIN = 0,
14179 +} TNETD73XX_GPIO_PIN_MODE_T;
14181 +typedef enum TNETD73XX_GPIO_PIN_DIRECTION_tag
14183 + GPIO_OUTPUT_PIN = 0,
14184 + GPIO_INPUT_PIN = 1
14185 +} TNETD73XX_GPIO_PIN_DIRECTION_T;
14187 +void tnetd73xx_gpio_init(void);
14188 +void tnetd73xx_gpio_ctrl(TNETD73XX_GPIO_PIN_T gpio_pin,
14189 + TNETD73XX_GPIO_PIN_MODE_T pin_mode,
14190 + TNETD73XX_GPIO_PIN_DIRECTION_T pin_direction);
14191 +void tnetd73xx_gpio_out(TNETD73XX_GPIO_PIN_T gpio_pin, int value);
14192 +int tnetd73xx_gpio_in(TNETD73XX_GPIO_PIN_T gpio_pin);
14194 +/* TNETD73XX Revision */
14195 +__u32 tnetd73xx_get_revision(void);
14197 +#endif /* __TNETD73XX_MISC_H__ */
14198 diff -urN linux.old/include/asm-mips/ar7/vlynq.h linux.dev/include/asm-mips/ar7/vlynq.h
14199 --- linux.old/include/asm-mips/ar7/vlynq.h 1970-01-01 01:00:00.000000000 +0100
14200 +++ linux.dev/include/asm-mips/ar7/vlynq.h 2005-11-10 01:10:46.095590250 +0100
14202 +/***************************************************************************
14203 +**+----------------------------------------------------------------------+**
14206 +**| ******o*** |**
14207 +**| ********_///_**** |**
14208 +**| ***** /_//_/ **** |**
14209 +**| ** ** (__/ **** |**
14214 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
14215 +**| ALL RIGHTS RESERVED |**
14217 +**| Permission is hereby granted to licensees of Texas Instruments |**
14218 +**| Incorporated (TI) products to use this computer program for the sole |**
14219 +**| purpose of implementing a licensee product based on TI products. |**
14220 +**| No other rights to reproduce, use, or disseminate this computer |**
14221 +**| program, whether in part or in whole, are granted. |**
14223 +**| TI makes no representation or warranties with respect to the |**
14224 +**| performance of this computer program, and specifically disclaims |**
14225 +**| any responsibility for any damages, special or consequential, |**
14226 +**| connected with the use of this program. |**
14228 +**+----------------------------------------------------------------------+**
14229 +***************************************************************************/
14231 +/*********************************************************************************
14232 + * ------------------------------------------------------------------------------
14233 + * Module : vlynq_hal.h
14235 + * This header file provides the set of functions exported by the
14236 + * VLYNQ HAL. This file is included from the SOC specific VLYNQ driver wrapper.
14237 + * ------------------------------------------------------------------------------
14238 + *********************************************************************************/
14240 +#ifndef _VLYNQ_HAL_H_
14241 +#define _VLYNQ_HAL_H_
14243 +/* Enable/Disable debug feature */
14244 +#undef VLYNQ_DEBUG
14246 +#ifdef VLYNQ_DEBUG /* This needs to be OS abstracted - for testing use vxworks/linux calls */
14247 +#define debugPrint(format,args...)
14249 +#define debugPrint(format,args...)
14252 + /* number of VLYNQ memory regions supported */
14253 +#define VLYNQ_MAX_MEMORY_REGIONS 0x04
14255 + /* Max.number of external interrupt inputs supported by VLYNQ module */
14256 +#define VLYNQ_IVR_MAXIVR 0x08
14258 +#define VLYNQ_CLK_DIV_MAX 0x08
14259 +#define VLYNQ_CLK_DIV_MIN 0x01
14262 +/*** the total number of entries allocated for ICB would be
14263 + * 32(for 32 bits in IntPending register) + VLYNQ_IVR_CHAIN_SLOTS*/
14264 +#define VLYNQ_IVR_CHAIN_SLOTS 10
14267 +/* Error defines */
14268 +#define VLYNQ_SUCCESS 0
14270 +#define VLYNQ_ERRCODE_BASE 0 /* Chosen by system */
14271 +#define VLYNQ_INVALID_ARG -(VLYNQ_ERRCODE_BASE+1)
14272 +#define VLYNQ_INVALID_DRV_STATE -(VLYNQ_ERRCODE_BASE+2)
14273 +#define VLYNQ_INT_CONFIG_ERR -(VLYNQ_ERRCODE_BASE+3)
14274 +#define VLYNQ_LINK_DOWN -(VLYNQ_ERRCODE_BASE+4)
14275 +#define VLYNQ_MEMALLOC_FAIL -(VLYNQ_ERRCODE_BASE+5)
14276 +#define VLYNQ_ISR_NON_EXISTENT -(VLYNQ_ERRCODE_BASE+6)
14277 +#define VLYNQ_INTVEC_MAP_NOT_FOUND -(VLYNQ_ERRCODE_BASE+7)
14279 +/* Vlynq Defines and Macros */
14281 +#define VLYNQ_NUM_INT_BITS 32 /* 32 bit interrupt staus register */
14283 +/* Base address of module */
14284 +#define VLYNQ_BASE (pdev->module_base)
14286 +#define VLYNQ_REMOTE_REGS_OFFSET 0x0080
14288 +#define VLYNQ_REV_OFFSET 0x0000
14289 +#define VLYNQ_CTRL_OFFSET 0x0004
14290 +#define VLYNQ_STATUS_OFFSET 0x0008
14291 +#define VLYNQ_INT_STAT_OFFSET 0x0010
14292 +#define VLYNQ_INT_PEND_OFFSET 0x0014
14293 +#define VLYNQ_INT_PTR_OFFSET 0x0018
14294 +#define VLYNQ_TXMAP_OFFSET 0x001c
14296 +#define VLYNQ_RX0MAP_SIZE_REG_OFFSET 0x0020
14297 +#define VLYNQ_RX0MAP_OFFSET_REG_OFFSET 0x0024
14299 +#define VLYNQ_CHIP_VER_OFFSET 0x0040
14300 +#define VLYNQ_IVR_REGS_OFFSET 0x0060
14302 +#define VLYNQ_INT_PENDING_REG_PTR 0x14
14303 +#define VLYNQ_R_INT_PENDING_REG_PTR VLYNQ_REMOTE_REGS_OFFSET + 0x14
14305 +#define VLYNQ_REV_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_REV_OFFSET))
14306 +#define VLYNQ_CTRL_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_CTRL_OFFSET))
14307 +#define VLYNQ_STATUS_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_STATUS_OFFSET))
14308 +#define VLYNQ_INT_STAT_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_INT_STAT_OFFSET))
14309 +#define VLYNQ_INT_PEND_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_INT_PEND_OFFSET))
14310 +#define VLYNQ_INT_PTR_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_INT_PTR_OFFSET))
14311 +#define VLYNQ_TXMAP_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_TXMAP_OFFSET))
14313 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14314 +#define VLYNQ_RXMAP_SIZE_REG(map) \
14315 + *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_RX0MAP_SIZE_REG_OFFSET+( (map-1)<<3)))
14317 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14318 +#define VLYNQ_RXMAP_OFFSET_REG(map) \
14319 + *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_RX0MAP_OFFSET_REG_OFFSET+( (map-1)<<3)))
14321 +#define VLYNQ_CHIP_VER_REG *((volatile unsigned int *)(VLYNQ_BASE+VLYNQ_CHIP_VER_OFFSET))
14323 +/* 0 =< ivr <= 31; currently ivr < VLYNQ_IVR_MAXIVR=8) */
14324 +#define VLYNQ_IVR_OFFSET(ivr) \
14325 + (VLYNQ_BASE + VLYNQ_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3) )
14327 +#define VLYNQ_IVR_03TO00_REG *((volatile unsigned int*) (VLYNQ_IVR_OFFSET(0)) )
14328 +#define VLYNQ_IVR_07TO04_REG *((volatile unsigned int*) (VLYNQ_IVR_OFFSET(4)) )
14329 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
14331 +#define VLYNQ_IVR_INTEN(ivr) (((unsigned int)(0x80)) << ((((unsigned)(ivr)) % 4) * 8))
14332 +#define VLYNQ_IVR_INTTYPE(ivr) (((unsigned int)(0x40)) << ((((unsigned)(ivr)) % 4) * 8))
14333 +#define VLYNQ_IVR_INTPOL(ivr) (((unsigned int)(0x20)) << ((((unsigned)(ivr)) % 4) * 8))
14334 +#define VLYNQ_IVR_INTVEC(ivr) (((unsigned int)(0x1F)) << ((((unsigned)(ivr)) % 4) * 8))
14335 +#define VLYNQ_IVR_INTALL(ivr) (((unsigned int)(0xFF)) << ((((unsigned)(ivr)) % 4) * 8))
14339 +/*********************************
14340 + * Remote VLYNQ register set *
14341 + *********************************/
14343 +#define VLYNQ_R_REV_OFFSET 0x0080
14344 +#define VLYNQ_R_CTRL_OFFSET 0x0084
14345 +#define VLYNQ_R_STATUS_OFFSET 0x0088
14346 +#define VLYNQ_R_INT_STAT_OFFSET 0x0090
14347 +#define VLYNQ_R_INT_PEND_OFFSET 0x0094
14348 +#define VLYNQ_R_INT_PTR_OFFSET 0x0098
14349 +#define VLYNQ_R_TXMAP_OFFSET 0x009c
14351 +#define VLYNQ_R_RX0MAP_SIZE_REG_OFFSET 0x00A0
14352 +#define VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET 0x00A4
14354 +#define VLYNQ_R_CHIP_VER_OFFSET 0x00C0
14355 +#define VLYNQ_R_IVR_REGS_OFFSET 0x00E0
14357 +#define VLYNQ_R_REV_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_REV_OFFSET))
14358 +#define VLYNQ_R_CTRL_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_CTRL_OFFSET))
14359 +#define VLYNQ_R_STATUS_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_STATUS_OFFSET))
14360 +#define VLYNQ_R_INT_STAT_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_INT_STAT_OFFSET))
14361 +#define VLYNQ_R_INT_PEND_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_INT_PEND_OFFSET))
14362 +#define VLYNQ_R_INT_PTR_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_INT_PTR_OFFSET))
14363 +#define VLYNQ_R_TXMAP_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_TXMAP_OFFSET))
14365 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14366 +#define VLYNQ_R_RXMAP_SIZE_REG(map) \
14367 + *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_SIZE_REG_OFFSET + ((map-1)<<3)))
14369 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14370 +#define VLYNQ_R_RXMAP_OFFSET_REG(map) \
14371 + *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET + ((map-1)<<3)))
14373 +#define VLYNQ_R_CHIP_VER_REG *((volatile unsigned int *)(VLYNQ_BASE + VLYNQ_R_CHIP_VER_OFFSET)
14375 +#define VLYNQ_R_IVR_OFFSET(ivr) \
14376 + (VLYNQ_BASE + VLYNQ_R_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3))
14379 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
14380 +#define VLYNQ_R_IVR_03TO00_REG *((volatile unsigned int*) (VLYNQ_R_IVR_OFFSET(0)) )
14381 +#define VLYNQ_R_IVR_07TO04_REG *((volatile unsigned int*) (VLYNQ_R_IVR_OFFSET(4)) )
14384 +/****End of remote register set definition******/
14387 +/*** Masks for individual register fields ***/
14389 +#define VLYNQ_MODULE_ID_MASK 0xffff0000
14390 +#define VLYNQ_MAJOR_REV_MASK 0x0000ff00
14391 +#define VLYNQ_MINOR_REV_MASK 0x000000ff
14394 +#define VLYNQ_CTL_ILOOP_MASK 0x00000002
14395 +#define VLYNQ_CTL_INT2CFG_MASK 0x00000080
14396 +#define VLYNQ_CTL_INTVEC_MASK 0x00001f00
14397 +#define VLYNQ_CTL_INTEN_MASK 0x00002000
14398 +#define VLYNQ_CTL_INTLOCAL_MASK 0x00004000
14399 +#define VLYNQ_CTL_CLKDIR_MASK 0x00008000
14400 +#define VLYNQ_CTL_CLKDIV_MASK 0x00070000
14401 +#define VLYNQ_CTL_MODE_MASK 0x00e00000
14404 +#define VLYNQ_STS_LINK_MASK 0x00000001 /* Link is active */
14405 +#define VLYNQ_STS_MPEND_MASK 0x00000002 /* Pending master requests */
14406 +#define VLYNQ_STS_SPEND_MASK 0x00000004 /* Pending slave requests */
14407 +#define VLYNQ_STS_NFEMPTY0_MASK 0x00000008 /* Master data FIFO not empty */
14408 +#define VLYNQ_STS_NFEMPTY1_MASK 0x00000010 /* Master command FIFO not empty */
14409 +#define VLYNQ_STS_NFEMPTY2_MASK 0x00000020 /* Slave data FIFO not empty */
14410 +#define VLYNQ_STS_NFEMPTY3_MASK 0x00000040 /* Slave command FIFO not empty */
14411 +#define VLYNQ_STS_LERROR_MASK 0x00000080 /* Local error, w/c */
14412 +#define VLYNQ_STS_RERROR_MASK 0x00000100 /* remote error w/c */
14413 +#define VLYNQ_STS_OFLOW_MASK 0x00000200
14414 +#define VLYNQ_STS_IFLOW_MASK 0x00000400
14415 +#define VLYNQ_STS_MODESUP_MASK 0x00E00000 /* Highest mode supported */
14416 +#define VLYNQ_STS_SWIDTH_MASK 0x07000000 /* Used for reading the width of VLYNQ bus */
14417 +#define VLYNQ_STS_DEBUG_MASK 0xE0000000
14419 +#define VLYNQ_CTL_INTVEC_SHIFT 0x08
14420 +#define VLYNQ_CTL_INTEN_SHIFT 0x0D
14421 +#define VLYNQ_CTL_INT2CFG_SHIFT 0x07
14422 +#define VLYNQ_CTL_INTLOCAL_SHIFT 0x0E
14424 +#define VLYNQ_CTL_INTFIELDS_CLEAR_MASK 0x7F80
14426 +#define VLYNQ_CHIPVER_DEVREV_MASK 0xffff0000
14427 +#define VLYNQ_CHIPVER_DEVID_MASK 0x0000ffff
14429 +#define VLYNQ_IVR_INTEN_MASK 0x80
14430 +#define VLYNQ_IVR_INTTYPE_MASK 0x40
14431 +#define VLYNQ_IVR_INTPOL_MASK 0x20
14434 +/**** Helper macros ****/
14436 +#define VLYNQ_RESETCB(arg) \
14437 + if( pdev->reset_cb != NULL) \
14439 + (pdev->reset_cb)(pdev, (arg)); \
14442 +#define VLYNQ_STATUS_FLD_WIDTH(sts) (((sts) & VLYNQ_STS_SWIDTH_MASK) >> 24 )
14443 +#define VLYNQ_CTL_INTVEC(x) (((x) & 31) << 8 )
14445 +#define VLYNQ_INRANGE(x,hi,lo) (((x) <= (hi)) && ((x) >= (lo)))
14446 +#define VLYNQ_OUTRANGE(x,hi,lo) (((x) > (hi)) || ((x) < (lo)))
14448 +#define VLYNQ_ALIGN4(x) (x)=(x)&(~3)
14451 +/*************************************
14453 + *************************************/
14455 +/* Initialization options define what operations are
14456 + * undertaken during vlynq module initialization */
14459 + /* Init host local memory regions.This allows
14460 + * local host access remote memory regions */
14461 + VLYNQ_INIT_LOCAL_MEM_REGIONS = 0x01,
14462 + /* Init host remote memory regions.This allows
14463 + * remote device access local memory regions */
14464 + VLYNQ_INIT_REMOTE_MEM_REGIONS =0x02,
14465 + /* Init local interrupt config*/
14466 + VLYNQ_INIT_LOCAL_INTERRUPTS =0x04,
14467 + /* Init remote interrupt config*/
14468 + VLYNQ_INIT_REMOTE_INTERRUPTS =0x08,
14469 + /* Check link during initialization*/
14470 + VLYNQ_INIT_CHECK_LINK =0x10,
14471 + /* configure clock during init */
14472 + VLYNQ_INIT_CONFIG_CLOCK =0x20,
14473 + /* Clear errors during init */
14474 + VLYNQ_INIT_CLEAR_ERRORS =0x40,
14475 + /* All options */
14476 + VLYNQ_INIT_PERFORM_ALL =0x7F
14477 +}VLYNQ_INIT_OPTIONS;
14480 +/* VLYNQ_DEV_TYPE identifies local or remote device */
14483 + VLYNQ_LOCAL_DVC = 0, /* vlynq local device (SOC's vlynq module) */
14484 + VLYNQ_REMOTE_DVC = 1 /* vlynq remote device (remote vlynq module) */
14488 +/* VLYNQ_CLK_SOURCE identifies the vlynq module clock source */
14491 + VLYNQ_CLK_SOURCE_NONE = 0, /* do not initialize clock generator*/
14492 + VLYNQ_CLK_SOURCE_LOCAL = 1, /* clock is generated by local machine */
14493 + VLYNQ_CLK_SOURCE_REMOTE = 2 /* clock is generated by remote machine */
14494 +}VLYNQ_CLK_SOURCE;
14497 +/* VLYNQ_DRV_STATE indicates the current driver state */
14500 + VLYNQ_DRV_STATE_UNINIT = 0, /* driver is uninitialized */
14501 + VLYNQ_DRV_STATE_ININIT = 1, /* VLYNQ is being initialized */
14502 + VLYNQ_DRV_STATE_RUN = 2, /* VLYNQ is running properly */
14503 + VLYNQ_DRV_STATE_HOLD = 3, /* driver stopped temporarily */
14504 + VLYNQ_DRV_STATE_ERROR = 4 /* driver stopped on unrecoverable error */
14508 +/* VLYNQ_BUS_WIDTH identifies the vlynq module bus width */
14511 + VLYNQ_BUS_WIDTH_3 = 3,
14512 + VLYNQ_BUS_WIDTH_5 = 5,
14513 + VLYNQ_BUS_WIDTH_7 = 7,
14514 + VLYNQ_BUS_WIDTH_9 = 9
14518 +/* VLYNQ_LOCAL_INT_CONFIG indicates whether the local vlynq
14519 + * interrupts are processed by the host or passed on to the
14524 + VLYNQ_INT_REMOTE = 0, /* Interrupt packets sent to remote, intlocal=0 */
14525 + VLYNQ_INT_LOCAL = 1 /* Interrupts are handled locally, intlocal=1 */
14526 +}VLYNQ_LOCAL_INT_CONFIG;
14529 +/* VLYNQ_REMOTE_INT_CONFIG indicates whether the remote
14530 + * interrupts are to be handled by the SOC system ISR
14531 + * or via the vlynq root ISR
14535 + VLYNQ_INT_ROOT_ISR = 0, /* remote ints handled via vlynq root ISR */
14536 + VLYNQ_INT_SYSTEM_ISR = 1 /* remote ints handled via system ISR */
14537 +}VLYNQ_REMOTE_INT_CONFIG;
14540 +/* VLYNQ_INTR_POLARITY - vlynq interrupt polarity setting */
14543 + VLYNQ_INTR_ACTIVE_HIGH = 0,
14544 + VLYNQ_INTR_ACTIVE_LOW = 1
14545 +}VLYNQ_INTR_POLARITY;
14548 +/* VLYNQ_INTR_TYPE - vlynq interrupt type */
14551 + VLYNQ_INTR_LEVEL = 0,
14552 + VLYNQ_INTR_PULSED = 1
14556 +/* VLYNQ_RESET_MODE - vlynq reset mode */
14559 + VLYNQ_RESET_ASSERT, /* hold device in reset state */
14560 + VLYNQ_RESET_DEASSERT, /* release device from reset state */
14561 + VLYNQ_RESET_INITFAIL, /* handle the device in case driver initialization fails */
14562 + VLYNQ_RESET_LINKESTABLISH, /* handle the device in case driver established link */
14563 + VLYNQ_RESET_INITFAIL2, /* Driver initialization failed but VLYNQ link exist. */
14564 + VLYNQ_RESET_INITOK /* Driver initialization finished OK. */
14565 +}VLYNQ_RESET_MODE;
14569 +/*************************************
14571 + *************************************/
14573 +struct VLYNQ_DEV_t; /*forward declaration*/
14575 +/*--------Function Pointers defintions -----------*/
14577 +/* prototype for interrupt handler definition */
14578 +typedef void (*VLYNQ_INTR_CNTRL_ISR)(void *arg1,void *arg2,void *arg3);
14581 +(*VLYNQ_RESET_REMOTE)(struct VLYNQ_DEV_t *pDev, VLYNQ_RESET_MODE mode);
14584 +(*VLYNQ_REPORT_CB)( struct VLYNQ_DEV_t *pDev, /* This VLYNQ */
14585 + VLYNQ_DEV_TYPE aSrcDvc, /* Event Cause -local/remote? */
14586 + unsigned int dwStatRegVal); /* Value of the relevant status register */
14589 +/*-------Structure Definitions------------*/
14591 +typedef struct VLYNQ_MEMORY_MAP_t
14593 + unsigned int Txmap;
14594 + unsigned int RxOffset[VLYNQ_MAX_MEMORY_REGIONS];
14595 + unsigned int RxSize[VLYNQ_MAX_MEMORY_REGIONS];
14596 +}VLYNQ_MEMORY_MAP;
14599 +/**VLYNQ_INTERRUPT_CNTRL - defines the vlynq module interrupt
14600 + * settings in vlynq Control register */
14601 +typedef struct VLYNQ_INTERRUPT_CNTRL_t
14603 + /* vlynq interrupts handled by host or remote - maps to
14604 + * intLocal bit in vlynq control register */
14605 + VLYNQ_LOCAL_INT_CONFIG intLocal;
14607 + /* remote interrupts handled by vlynq isr or host system
14608 + * interrupt controller - maps to the int2Cfg in vlynq
14609 + * control register */
14610 + VLYNQ_REMOTE_INT_CONFIG intRemote;
14612 + /* bit in pending/set register used for module interrupts*/
14613 + unsigned int map_vector;
14615 + /* used only if remote interrupts are to be handled by system ISR*/
14616 + unsigned int intr_ptr;
14618 +}VLYNQ_INTERRUPT_CNTRL;
14621 +/* VLYNQ_INTR_CNTRL_ICB - defines the Interrupt control block which hold
14622 + * the interrupt dispatch table. The vlynq_root_isr() indexes into this
14623 + * table to identify the ISR to be invoked
14625 +typedef struct VLYNQ_INTR_CNTRL_ICB_t
14627 + VLYNQ_INTR_CNTRL_ISR isr; /* Clear errors during initialization */
14628 + void *arg1 ; /* Arg 1 for the ISR */
14629 + void *arg2 ; /* Arg 2 for the ISR */
14630 + void *arg3 ; /* Arg 3 for the ISR */
14631 + unsigned int isrCount; /* number of ISR invocations so far */
14632 + struct VLYNQ_INTR_CNTRL_ICB_t *next;
14633 +}VLYNQ_INTR_CNTRL_ICB;
14635 +/* overlay of vlynq register set */
14636 +typedef struct VLYNQ_REG_SET_t
14638 + unsigned int revision; /*offset : 0x00 */
14639 + unsigned int control; /* 0x04*/
14640 + unsigned int status; /* 0x08*/
14641 + unsigned int pad1; /* 0x0c*/
14642 + unsigned int intStatus; /*0x10*/
14643 + unsigned int intPending; /*0x14*/
14644 + unsigned int intPtr; /*0x18*/
14645 + unsigned int txMap; /*0x1C*/
14646 + unsigned int rxSize1; /*0x20*/
14647 + unsigned int rxOffset1; /*0x24*/
14648 + unsigned int rxSize2; /*0x28*/
14649 + unsigned int rxOffset2; /*0x2C*/
14650 + unsigned int rxSize3; /*0x30*/
14651 + unsigned int rxOffset3; /*0x34*/
14652 + unsigned int rxSize4; /*0x38*/
14653 + unsigned int rxOffset4; /*0x3C*/
14654 + unsigned int chipVersion; /*0x40*/
14655 + unsigned int pad2[8];
14656 + unsigned int ivr30; /*0x60*/
14657 + unsigned int ivr74; /*0x64*/
14658 + unsigned int pad3[7];
14662 +typedef struct VLYNQ_DEV_t
14664 + /** module index:1,2,3... used for debugging purposes */
14665 + unsigned int dev_idx;
14667 + /*VLYNQ module base address */
14668 + unsigned int module_base;
14670 + /* clock source selection */
14671 + VLYNQ_CLK_SOURCE clk_source;
14673 + /* Clock Divider.Val=1 to 8. VLYNQ_clk = VBUSCLK/clk_div */
14674 + unsigned int clk_div;
14676 + /* State of the VLYNQ driver, set to VLYNQ_DRV_STATE_UNINIT, when initializing */
14677 + VLYNQ_DRV_STATE state;
14679 + /* Valid VLYNQ bus width, filled by driver */
14680 + VLYNQ_BUS_WIDTH width;
14682 + /* local memory mapping */
14683 + VLYNQ_MEMORY_MAP local_mem;
14685 + /* remote memory mapping */
14686 + VLYNQ_MEMORY_MAP remote_mem;
14688 + /* Local module interrupt params */
14689 + VLYNQ_INTERRUPT_CNTRL local_irq;
14691 + /* remote module interrupt params */
14692 + VLYNQ_INTERRUPT_CNTRL remote_irq;
14694 + /*** ICB related fields **/
14696 + /* Sizeof of ICB = VLYNQ_NUM_INT_BITS(for 32 bits in IntPending) +
14697 + * expansion slots for shared interrupts*/
14698 + VLYNQ_INTR_CNTRL_ICB pIntrCB[VLYNQ_NUM_INT_BITS + VLYNQ_IVR_CHAIN_SLOTS];
14699 + VLYNQ_INTR_CNTRL_ICB *freelist;
14701 + /* table holding mapping between intVector and the bit position the interrupt
14702 + * is mapped to(mapVector)*/
14703 + char vector_map[32];
14705 + /* user callback for vlynq events, NULL if unused */
14706 + VLYNQ_REPORT_CB report_cb;
14708 + /* user callback for resetting/realeasing remote device */
14709 + VLYNQ_RESET_REMOTE reset_cb;
14711 + /*** Handles provided for direct access to register set if need be
14712 + * Must be intialized to point to appropriate address during
14714 + volatile VLYNQ_REG_SET * local;
14715 + volatile VLYNQ_REG_SET * remote;
14717 + unsigned int intCount; /* number of interrupts generated so far */
14718 + unsigned int isrCount; /* number of ISR invocations so far */
14722 +typedef struct VLYNQ_ISR_ARGS_t
14730 +/****************************************
14731 + * Function Prototypes *
14732 + * API exported by generic vlynq driver *
14733 + ****************************************/
14734 +/* Initialization function */
14735 +int vlynq_init( VLYNQ_DEV *pdev, VLYNQ_INIT_OPTIONS options);
14737 +/* Check vlynq link */
14738 +unsigned int vlynq_link_check( VLYNQ_DEV * pdev);
14740 +/* Set interrupt vector in local or remote device */
14741 +int vlynq_interrupt_vector_set( VLYNQ_DEV *pdev,
14742 + unsigned int int_vector,
14743 + unsigned int map_vector,
14744 + VLYNQ_DEV_TYPE dev,
14745 + VLYNQ_INTR_POLARITY pol,
14746 + VLYNQ_INTR_TYPE type);
14749 +int vlynq_interrupt_vector_cntl( VLYNQ_DEV *pdev,
14750 + unsigned int int_vector,
14751 + VLYNQ_DEV_TYPE dev,
14752 + unsigned int enable);
14754 +unsigned int vlynq_interrupt_get_count( VLYNQ_DEV *pdev,
14755 + unsigned int map_vector);
14757 +int vlynq_install_isr( VLYNQ_DEV *pdev,
14758 + unsigned int map_vector,
14759 + VLYNQ_INTR_CNTRL_ISR isr,
14760 + void *arg1, void *arg2, void *arg3);
14762 +int vlynq_uninstall_isr( VLYNQ_DEV *pdev,
14763 + unsigned int map_vector,
14764 + void *arg1, void *arg2, void *arg3);
14767 +void vlynq_root_isr(void *arg);
14769 +void vlynq_delay(unsigned int clktime);
14771 +/* The following functions, provide better granularity in setting
14772 + * interrupt parameters. (for better support of linux INT Controller)
14773 + * Note: The interrupt source is identified by "map_vector"- the bit
14774 + * position in interrupt status register*/
14776 +int vlynq_interrupt_vector_map(VLYNQ_DEV * pdev,
14777 + VLYNQ_DEV_TYPE dev,
14778 + unsigned int int_vector,
14779 + unsigned int map_vector);
14781 +int vlynq_interrupt_set_polarity(VLYNQ_DEV * pdev,
14782 + VLYNQ_DEV_TYPE dev,
14783 + unsigned int map_vector,
14784 + VLYNQ_INTR_POLARITY pol);
14786 +int vlynq_interrupt_get_polarity( VLYNQ_DEV *pdev ,
14787 + VLYNQ_DEV_TYPE dev_type,
14788 + unsigned int map_vector);
14790 +int vlynq_interrupt_set_type(VLYNQ_DEV * pdev,
14791 + VLYNQ_DEV_TYPE dev,
14792 + unsigned int map_vector,
14793 + VLYNQ_INTR_TYPE type);
14795 +int vlynq_interrupt_get_type( VLYNQ_DEV *pdev,
14796 + VLYNQ_DEV_TYPE dev_type,
14797 + unsigned int map_vector);
14799 +int vlynq_interrupt_enable(VLYNQ_DEV* pdev,
14800 + VLYNQ_DEV_TYPE dev,
14801 + unsigned int map_vector);
14803 +int vlynq_interrupt_disable(VLYNQ_DEV * pdev,
14804 + VLYNQ_DEV_TYPE dev,
14805 + unsigned int map_vector);
14811 +#endif /* _VLYNQ_HAL_H_ */
14812 diff -urN linux.old/include/asm-mips/ar7/vlynq_hal.h linux.dev/include/asm-mips/ar7/vlynq_hal.h
14813 --- linux.old/include/asm-mips/ar7/vlynq_hal.h 1970-01-01 01:00:00.000000000 +0100
14814 +++ linux.dev/include/asm-mips/ar7/vlynq_hal.h 2005-11-10 01:10:46.095590250 +0100
14816 +/***************************************************************************
14817 +**+----------------------------------------------------------------------+**
14820 +**| ******o*** |**
14821 +**| ********_///_**** |**
14822 +**| ***** /_//_/ **** |**
14823 +**| ** ** (__/ **** |**
14828 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
14829 +**| ALL RIGHTS RESERVED |**
14831 +**| Permission is hereby granted to licensees of Texas Instruments |**
14832 +**| Incorporated (TI) products to use this computer program for the sole |**
14833 +**| purpose of implementing a licensee product based on TI products. |**
14834 +**| No other rights to reproduce, use, or disseminate this computer |**
14835 +**| program, whether in part or in whole, are granted. |**
14837 +**| TI makes no representation or warranties with respect to the |**
14838 +**| performance of this computer program, and specifically disclaims |**
14839 +**| any responsibility for any damages, special or consequential, |**
14840 +**| connected with the use of this program. |**
14842 +**+----------------------------------------------------------------------+**
14843 +***************************************************************************/
14845 +/*********************************************************************************
14846 + * ------------------------------------------------------------------------------
14847 + * Module : vlynq_hal.h
14849 + * This header file provides the set of functions exported by the
14850 + * VLYNQ HAL. This file is included from the SOC specific VLYNQ driver wrapper.
14851 + * ------------------------------------------------------------------------------
14852 + *********************************************************************************/
14854 +#ifndef _VLYNQ_HAL_H_
14855 +#define _VLYNQ_HAL_H_
14857 +#include <asm/ar7/avalanche_types.h>
14858 +#include <asm/ar7/vlynq_hal_params.h>
14861 +#define PRIVATE static
14868 +/* Enable/Disable debug feature */
14869 +#undef VLYNQ_DEBUG
14871 +#ifdef VLYNQ_DEBUG /* This needs to be OS abstracted - for testing use vxworks/linux calls */
14872 +#define debugPrint(format,args...)
14874 +#define debugPrint(format,args...)
14877 +/* Error defines */
14878 +#define VLYNQ_SUCCESS 0
14880 +#define VLYNQ_ERRCODE_BASE 0 /* Chosen by system */
14881 +#define VLYNQ_INVALID_ARG -(VLYNQ_ERRCODE_BASE+1)
14882 +#define VLYNQ_INVALID_DRV_STATE -(VLYNQ_ERRCODE_BASE+2)
14883 +#define VLYNQ_INT_CONFIG_ERR -(VLYNQ_ERRCODE_BASE+3)
14884 +#define VLYNQ_LINK_DOWN -(VLYNQ_ERRCODE_BASE+4)
14885 +#define VLYNQ_MEMALLOC_FAIL -(VLYNQ_ERRCODE_BASE+5)
14886 +#define VLYNQ_ISR_NON_EXISTENT -(VLYNQ_ERRCODE_BASE+6)
14887 +#define VLYNQ_INTVEC_MAP_NOT_FOUND -(VLYNQ_ERRCODE_BASE+7)
14889 +/* Vlynq Defines and Macros */
14891 +#define VLYNQ_NUM_INT_BITS 32 /* 32 bit interrupt staus register */
14893 +/* Base address of module */
14894 +#define VLYNQ_BASE (pdev->module_base)
14896 +#define VLYNQ_REMOTE_REGS_OFFSET 0x0080
14898 +#define VLYNQ_REV_OFFSET 0x0000
14899 +#define VLYNQ_CTRL_OFFSET 0x0004
14900 +#define VLYNQ_STATUS_OFFSET 0x0008
14901 +#define VLYNQ_INT_STAT_OFFSET 0x0010
14902 +#define VLYNQ_INT_PEND_OFFSET 0x0014
14903 +#define VLYNQ_INT_PTR_OFFSET 0x0018
14904 +#define VLYNQ_TXMAP_OFFSET 0x001c
14906 +#define VLYNQ_RX0MAP_SIZE_REG_OFFSET 0x0020
14907 +#define VLYNQ_RX0MAP_OFFSET_REG_OFFSET 0x0024
14909 +#define VLYNQ_CHIP_VER_OFFSET 0x0040
14910 +#define VLYNQ_IVR_REGS_OFFSET 0x0060
14912 +#define VLYNQ_INT_PENDING_REG_PTR 0x14
14913 +#define VLYNQ_R_INT_PENDING_REG_PTR VLYNQ_REMOTE_REGS_OFFSET + 0x14
14915 +#define VLYNQ_REV_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_REV_OFFSET))
14916 +#define VLYNQ_CTRL_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_CTRL_OFFSET))
14917 +#define VLYNQ_STATUS_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_STATUS_OFFSET))
14918 +#define VLYNQ_INT_STAT_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_INT_STAT_OFFSET))
14919 +#define VLYNQ_INT_PEND_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_INT_PEND_OFFSET))
14920 +#define VLYNQ_INT_PTR_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_INT_PTR_OFFSET))
14921 +#define VLYNQ_TXMAP_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_TXMAP_OFFSET))
14923 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14924 +#define VLYNQ_RXMAP_SIZE_REG(map) \
14925 + *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_RX0MAP_SIZE_REG_OFFSET+( (map-1)<<3)))
14927 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14928 +#define VLYNQ_RXMAP_OFFSET_REG(map) \
14929 + *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_RX0MAP_OFFSET_REG_OFFSET+( (map-1)<<3)))
14931 +#define VLYNQ_CHIP_VER_REG *((volatile UINT32 *)(VLYNQ_BASE+VLYNQ_CHIP_VER_OFFSET))
14933 +/* 0 =< ivr <= 31; currently ivr < VLYNQ_IVR_MAXIVR=8) */
14934 +#define VLYNQ_IVR_OFFSET(ivr) \
14935 + (VLYNQ_BASE + VLYNQ_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3) )
14937 +#define VLYNQ_IVR_03TO00_REG *((volatile UINT32*) (VLYNQ_IVR_OFFSET(0)) )
14938 +#define VLYNQ_IVR_07TO04_REG *((volatile UINT32*) (VLYNQ_IVR_OFFSET(4)) )
14939 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
14941 +#define VLYNQ_IVR_INTEN(ivr) (((UINT32)(0x80)) << ((((unsigned)(ivr)) % 4) * 8))
14942 +#define VLYNQ_IVR_INTTYPE(ivr) (((UINT32)(0x40)) << ((((unsigned)(ivr)) % 4) * 8))
14943 +#define VLYNQ_IVR_INTPOL(ivr) (((UINT32)(0x20)) << ((((unsigned)(ivr)) % 4) * 8))
14944 +#define VLYNQ_IVR_INTVEC(ivr) (((UINT32)(0x1F)) << ((((unsigned)(ivr)) % 4) * 8))
14945 +#define VLYNQ_IVR_INTALL(ivr) (((UINT32)(0xFF)) << ((((unsigned)(ivr)) % 4) * 8))
14949 +/*********************************
14950 + * Remote VLYNQ register set *
14951 + *********************************/
14953 +#define VLYNQ_R_REV_OFFSET 0x0080
14954 +#define VLYNQ_R_CTRL_OFFSET 0x0084
14955 +#define VLYNQ_R_STATUS_OFFSET 0x0088
14956 +#define VLYNQ_R_INT_STAT_OFFSET 0x0090
14957 +#define VLYNQ_R_INT_PEND_OFFSET 0x0094
14958 +#define VLYNQ_R_INT_PTR_OFFSET 0x0098
14959 +#define VLYNQ_R_TXMAP_OFFSET 0x009c
14961 +#define VLYNQ_R_RX0MAP_SIZE_REG_OFFSET 0x00A0
14962 +#define VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET 0x00A4
14964 +#define VLYNQ_R_CHIP_VER_OFFSET 0x00C0
14965 +#define VLYNQ_R_IVR_REGS_OFFSET 0x00E0
14967 +#define VLYNQ_R_REV_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_REV_OFFSET))
14968 +#define VLYNQ_R_CTRL_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_CTRL_OFFSET))
14969 +#define VLYNQ_R_STATUS_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_STATUS_OFFSET))
14970 +#define VLYNQ_R_INT_STAT_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_INT_STAT_OFFSET))
14971 +#define VLYNQ_R_INT_PEND_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_INT_PEND_OFFSET))
14972 +#define VLYNQ_R_INT_PTR_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_INT_PTR_OFFSET))
14973 +#define VLYNQ_R_TXMAP_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_TXMAP_OFFSET))
14975 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14976 +#define VLYNQ_R_RXMAP_SIZE_REG(map) \
14977 + *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_SIZE_REG_OFFSET + ((map-1)<<3)))
14979 +/** map takes on values between 1 to VLYNQ_MAX_MEMORY_REGIONS **/
14980 +#define VLYNQ_R_RXMAP_OFFSET_REG(map) \
14981 + *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_RX0MAP_OFFSET_REG_OFFSET + ((map-1)<<3)))
14983 +#define VLYNQ_R_CHIP_VER_REG *((volatile UINT32 *)(VLYNQ_BASE + VLYNQ_R_CHIP_VER_OFFSET)
14985 +#define VLYNQ_R_IVR_OFFSET(ivr) \
14986 + (VLYNQ_BASE + VLYNQ_R_IVR_REGS_OFFSET +((((unsigned)(ivr)) & 31) & ~3))
14989 +/*** Can be extended for 11TO08...31TO28 when all 31 are supported**/
14990 +#define VLYNQ_R_IVR_03TO00_REG *((volatile UINT32*) (VLYNQ_R_IVR_OFFSET(0)) )
14991 +#define VLYNQ_R_IVR_07TO04_REG *((volatile UINT32*) (VLYNQ_R_IVR_OFFSET(4)) )
14994 +/****End of remote register set definition******/
14997 +/*** Masks for individual register fields ***/
14999 +#define VLYNQ_MODULE_ID_MASK 0xffff0000
15000 +#define VLYNQ_MAJOR_REV_MASK 0x0000ff00
15001 +#define VLYNQ_MINOR_REV_MASK 0x000000ff
15004 +#define VLYNQ_CTL_ILOOP_MASK 0x00000002
15005 +#define VLYNQ_CTL_INT2CFG_MASK 0x00000080
15006 +#define VLYNQ_CTL_INTVEC_MASK 0x00001f00
15007 +#define VLYNQ_CTL_INTEN_MASK 0x00002000
15008 +#define VLYNQ_CTL_INTLOCAL_MASK 0x00004000
15009 +#define VLYNQ_CTL_CLKDIR_MASK 0x00008000
15010 +#define VLYNQ_CTL_CLKDIV_MASK 0x00070000
15011 +#define VLYNQ_CTL_MODE_MASK 0x00e00000
15014 +#define VLYNQ_STS_LINK_MASK 0x00000001 /* Link is active */
15015 +#define VLYNQ_STS_MPEND_MASK 0x00000002 /* Pending master requests */
15016 +#define VLYNQ_STS_SPEND_MASK 0x00000004 /* Pending slave requests */
15017 +#define VLYNQ_STS_NFEMPTY0_MASK 0x00000008 /* Master data FIFO not empty */
15018 +#define VLYNQ_STS_NFEMPTY1_MASK 0x00000010 /* Master command FIFO not empty */
15019 +#define VLYNQ_STS_NFEMPTY2_MASK 0x00000020 /* Slave data FIFO not empty */
15020 +#define VLYNQ_STS_NFEMPTY3_MASK 0x00000040 /* Slave command FIFO not empty */
15021 +#define VLYNQ_STS_LERROR_MASK 0x00000080 /* Local error, w/c */
15022 +#define VLYNQ_STS_RERROR_MASK 0x00000100 /* remote error w/c */
15023 +#define VLYNQ_STS_OFLOW_MASK 0x00000200
15024 +#define VLYNQ_STS_IFLOW_MASK 0x00000400
15025 +#define VLYNQ_STS_MODESUP_MASK 0x00E00000 /* Highest mode supported */
15026 +#define VLYNQ_STS_SWIDTH_MASK 0x07000000 /* Used for reading the width of VLYNQ bus */
15027 +#define VLYNQ_STS_DEBUG_MASK 0xE0000000
15029 +#define VLYNQ_CTL_INTVEC_SHIFT 0x08
15030 +#define VLYNQ_CTL_INTEN_SHIFT 0x0D
15031 +#define VLYNQ_CTL_INT2CFG_SHIFT 0x07
15032 +#define VLYNQ_CTL_INTLOCAL_SHIFT 0x0E
15034 +#define VLYNQ_CTL_INTFIELDS_CLEAR_MASK 0x7F80
15036 +#define VLYNQ_CHIPVER_DEVREV_MASK 0xffff0000
15037 +#define VLYNQ_CHIPVER_DEVID_MASK 0x0000ffff
15039 +#define VLYNQ_IVR_INTEN_MASK 0x80
15040 +#define VLYNQ_IVR_INTTYPE_MASK 0x40
15041 +#define VLYNQ_IVR_INTPOL_MASK 0x20
15044 +/**** Helper macros ****/
15046 +#define VLYNQ_RESETCB(arg) \
15047 + if( pdev->reset_cb != NULL) \
15049 + (pdev->reset_cb)(pdev, (arg)); \
15052 +#define VLYNQ_STATUS_FLD_WIDTH(sts) (((sts) & VLYNQ_STS_SWIDTH_MASK) >> 24 )
15053 +#define VLYNQ_CTL_INTVEC(x) (((x) & 31) << 8 )
15055 +#define VLYNQ_INRANGE(x,hi,lo) (((x) <= (hi)) && ((x) >= (lo)))
15056 +#define VLYNQ_OUTRANGE(x,hi,lo) (((x) > (hi)) || ((x) < (lo)))
15058 +#define VLYNQ_ALIGN4(x) (x)=(x)&(~3)
15061 +/*************************************
15063 + *************************************/
15065 +/* Initialization options define what operations are
15066 + * undertaken during vlynq module initialization */
15069 + /* Init host local memory regions.This allows
15070 + * local host access remote memory regions */
15071 + VLYNQ_INIT_LOCAL_MEM_REGIONS = 0x01,
15072 + /* Init host remote memory regions.This allows
15073 + * remote device access local memory regions */
15074 + VLYNQ_INIT_REMOTE_MEM_REGIONS =0x02,
15075 + /* Init local interrupt config*/
15076 + VLYNQ_INIT_LOCAL_INTERRUPTS =0x04,
15077 + /* Init remote interrupt config*/
15078 + VLYNQ_INIT_REMOTE_INTERRUPTS =0x08,
15079 + /* Check link during initialization*/
15080 + VLYNQ_INIT_CHECK_LINK =0x10,
15081 + /* configure clock during init */
15082 + VLYNQ_INIT_CONFIG_CLOCK =0x20,
15083 + /* Clear errors during init */
15084 + VLYNQ_INIT_CLEAR_ERRORS =0x40,
15085 + /* All options */
15086 + VLYNQ_INIT_PERFORM_ALL =0x7F
15087 +}VLYNQ_INIT_OPTIONS;
15090 +/* VLYNQ_DEV_TYPE identifies local or remote device */
15093 + VLYNQ_LOCAL_DVC = 0, /* vlynq local device (SOC's vlynq module) */
15094 + VLYNQ_REMOTE_DVC = 1 /* vlynq remote device (remote vlynq module) */
15098 +/* VLYNQ_CLK_SOURCE identifies the vlynq module clock source */
15101 + VLYNQ_CLK_SOURCE_NONE = 0, /* do not initialize clock generator*/
15102 + VLYNQ_CLK_SOURCE_LOCAL = 1, /* clock is generated by local machine */
15103 + VLYNQ_CLK_SOURCE_REMOTE = 2 /* clock is generated by remote machine */
15104 +}VLYNQ_CLK_SOURCE;
15107 +/* VLYNQ_DRV_STATE indicates the current driver state */
15110 + VLYNQ_DRV_STATE_UNINIT = 0, /* driver is uninitialized */
15111 + VLYNQ_DRV_STATE_ININIT = 1, /* VLYNQ is being initialized */
15112 + VLYNQ_DRV_STATE_RUN = 2, /* VLYNQ is running properly */
15113 + VLYNQ_DRV_STATE_HOLD = 3, /* driver stopped temporarily */
15114 + VLYNQ_DRV_STATE_ERROR = 4 /* driver stopped on unrecoverable error */
15118 +/* VLYNQ_BUS_WIDTH identifies the vlynq module bus width */
15121 + VLYNQ_BUS_WIDTH_3 = 3,
15122 + VLYNQ_BUS_WIDTH_5 = 5,
15123 + VLYNQ_BUS_WIDTH_7 = 7,
15124 + VLYNQ_BUS_WIDTH_9 = 9
15128 +/* VLYNQ_LOCAL_INT_CONFIG indicates whether the local vlynq
15129 + * interrupts are processed by the host or passed on to the
15134 + VLYNQ_INT_REMOTE = 0, /* Interrupt packets sent to remote, intlocal=0 */
15135 + VLYNQ_INT_LOCAL = 1 /* Interrupts are handled locally, intlocal=1 */
15136 +}VLYNQ_LOCAL_INT_CONFIG;
15139 +/* VLYNQ_REMOTE_INT_CONFIG indicates whether the remote
15140 + * interrupts are to be handled by the SOC system ISR
15141 + * or via the vlynq root ISR
15145 + VLYNQ_INT_ROOT_ISR = 0, /* remote ints handled via vlynq root ISR */
15146 + VLYNQ_INT_SYSTEM_ISR = 1 /* remote ints handled via system ISR */
15147 +}VLYNQ_REMOTE_INT_CONFIG;
15150 +/* VLYNQ_INTR_POLARITY - vlynq interrupt polarity setting */
15153 + VLYNQ_INTR_ACTIVE_HIGH = 0,
15154 + VLYNQ_INTR_ACTIVE_LOW = 1
15155 +}VLYNQ_INTR_POLARITY;
15158 +/* VLYNQ_INTR_TYPE - vlynq interrupt type */
15161 + VLYNQ_INTR_LEVEL = 0,
15162 + VLYNQ_INTR_PULSED = 1
15166 +/* VLYNQ_RESET_MODE - vlynq reset mode */
15169 + VLYNQ_RESET_ASSERT, /* hold device in reset state */
15170 + VLYNQ_RESET_DEASSERT, /* release device from reset state */
15171 + VLYNQ_RESET_INITFAIL, /* handle the device in case driver initialization fails */
15172 + VLYNQ_RESET_LINKESTABLISH, /* handle the device in case driver established link */
15173 + VLYNQ_RESET_INITFAIL2, /* Driver initialization failed but VLYNQ link exist. */
15174 + VLYNQ_RESET_INITOK /* Driver initialization finished OK. */
15175 +}VLYNQ_RESET_MODE;
15179 +/*************************************
15181 + *************************************/
15183 +struct VLYNQ_DEV_t; /*forward declaration*/
15185 +/*--------Function Pointers defintions -----------*/
15187 +/* prototype for interrupt handler definition */
15188 +typedef void (*VLYNQ_INTR_CNTRL_ISR)(void *arg1,void *arg2,void *arg3);
15191 +(*VLYNQ_RESET_REMOTE)(struct VLYNQ_DEV_t *pDev, VLYNQ_RESET_MODE mode);
15194 +(*VLYNQ_REPORT_CB)( struct VLYNQ_DEV_t *pDev, /* This VLYNQ */
15195 + VLYNQ_DEV_TYPE aSrcDvc, /* Event Cause -local/remote? */
15196 + UINT32 dwStatRegVal); /* Value of the relevant status register */
15199 +/*-------Structure Definitions------------*/
15201 +typedef struct VLYNQ_MEMORY_MAP_t
15204 + UINT32 RxOffset[VLYNQ_MAX_MEMORY_REGIONS];
15205 + UINT32 RxSize[VLYNQ_MAX_MEMORY_REGIONS];
15206 +}VLYNQ_MEMORY_MAP;
15209 +/**VLYNQ_INTERRUPT_CNTRL - defines the vlynq module interrupt
15210 + * settings in vlynq Control register */
15211 +typedef struct VLYNQ_INTERRUPT_CNTRL_t
15213 + /* vlynq interrupts handled by host or remote - maps to
15214 + * intLocal bit in vlynq control register */
15215 + VLYNQ_LOCAL_INT_CONFIG intLocal;
15217 + /* remote interrupts handled by vlynq isr or host system
15218 + * interrupt controller - maps to the int2Cfg in vlynq
15219 + * control register */
15220 + VLYNQ_REMOTE_INT_CONFIG intRemote;
15222 + /* bit in pending/set register used for module interrupts*/
15223 + UINT32 map_vector;
15225 + /* used only if remote interrupts are to be handled by system ISR*/
15228 +}VLYNQ_INTERRUPT_CNTRL;
15231 +/* VLYNQ_INTR_CNTRL_ICB - defines the Interrupt control block which hold
15232 + * the interrupt dispatch table. The vlynq_root_isr() indexes into this
15233 + * table to identify the ISR to be invoked
15235 +typedef struct VLYNQ_INTR_CNTRL_ICB_t
15237 + VLYNQ_INTR_CNTRL_ISR isr; /* Clear errors during initialization */
15238 + void *arg1 ; /* Arg 1 for the ISR */
15239 + void *arg2 ; /* Arg 2 for the ISR */
15240 + void *arg3 ; /* Arg 3 for the ISR */
15241 + UINT32 isrCount; /* number of ISR invocations so far */
15242 + struct VLYNQ_INTR_CNTRL_ICB_t *next;
15243 +}VLYNQ_INTR_CNTRL_ICB;
15245 +/* overlay of vlynq register set */
15246 +typedef struct VLYNQ_REG_SET_t
15248 + UINT32 revision; /*offset : 0x00 */
15249 + UINT32 control; /* 0x04*/
15250 + UINT32 status; /* 0x08*/
15251 + UINT32 pad1; /* 0x0c*/
15252 + UINT32 intStatus; /*0x10*/
15253 + UINT32 intPending; /*0x14*/
15254 + UINT32 intPtr; /*0x18*/
15255 + UINT32 txMap; /*0x1C*/
15256 + UINT32 rxSize1; /*0x20*/
15257 + UINT32 rxOffset1; /*0x24*/
15258 + UINT32 rxSize2; /*0x28*/
15259 + UINT32 rxOffset2; /*0x2C*/
15260 + UINT32 rxSize3; /*0x30*/
15261 + UINT32 rxOffset3; /*0x34*/
15262 + UINT32 rxSize4; /*0x38*/
15263 + UINT32 rxOffset4; /*0x3C*/
15264 + UINT32 chipVersion; /*0x40*/
15266 + UINT32 ivr30; /*0x60*/
15267 + UINT32 ivr74; /*0x64*/
15272 +typedef struct VLYNQ_DEV_t
15274 + /** module index:1,2,3... used for debugging purposes */
15277 + /*VLYNQ module base address */
15278 + UINT32 module_base;
15280 + /* clock source selection */
15281 + VLYNQ_CLK_SOURCE clk_source;
15283 + /* Clock Divider.Val=1 to 8. VLYNQ_clk = VBUSCLK/clk_div */
15286 + /* State of the VLYNQ driver, set to VLYNQ_DRV_STATE_UNINIT, when initializing */
15287 + VLYNQ_DRV_STATE state;
15289 + /* Valid VLYNQ bus width, filled by driver */
15290 + VLYNQ_BUS_WIDTH width;
15292 + /* local memory mapping */
15293 + VLYNQ_MEMORY_MAP local_mem;
15295 + /* remote memory mapping */
15296 + VLYNQ_MEMORY_MAP remote_mem;
15298 + /* Local module interrupt params */
15299 + VLYNQ_INTERRUPT_CNTRL local_irq;
15301 + /* remote module interrupt params */
15302 + VLYNQ_INTERRUPT_CNTRL remote_irq;
15304 + /*** ICB related fields **/
15306 + /* Sizeof of ICB = VLYNQ_NUM_INT_BITS(for 32 bits in IntPending) +
15307 + * expansion slots for shared interrupts*/
15308 + VLYNQ_INTR_CNTRL_ICB pIntrCB[VLYNQ_NUM_INT_BITS + VLYNQ_IVR_CHAIN_SLOTS];
15309 + VLYNQ_INTR_CNTRL_ICB *freelist;
15311 + /* table holding mapping between intVector and the bit position the interrupt
15312 + * is mapped to(mapVector)*/
15313 + INT8 vector_map[32];
15315 + /* user callback for vlynq events, NULL if unused */
15316 + VLYNQ_REPORT_CB report_cb;
15318 + /* user callback for resetting/realeasing remote device */
15319 + VLYNQ_RESET_REMOTE reset_cb;
15321 + /*** Handles provided for direct access to register set if need be
15322 + * Must be intialized to point to appropriate address during
15324 + volatile VLYNQ_REG_SET * local;
15325 + volatile VLYNQ_REG_SET * remote;
15327 + UINT32 intCount; /* number of interrupts generated so far */
15328 + UINT32 isrCount; /* number of ISR invocations so far */
15332 +typedef struct VLYNQ_ISR_ARGS_t
15340 +/****************************************
15341 + * Function Prototypes *
15342 + * API exported by generic vlynq driver *
15343 + ****************************************/
15344 +/* Initialization function */
15345 +GLOBAL INT32 vlynq_init( VLYNQ_DEV *pdev, VLYNQ_INIT_OPTIONS options);
15347 +/* Check vlynq link */
15348 +GLOBAL UINT32 vlynq_link_check( VLYNQ_DEV * pdev);
15350 +/* Set interrupt vector in local or remote device */
15351 +GLOBAL INT32 vlynq_interrupt_vector_set( VLYNQ_DEV *pdev,
15352 + UINT32 int_vector,
15353 + UINT32 map_vector,
15354 + VLYNQ_DEV_TYPE dev,
15355 + VLYNQ_INTR_POLARITY pol,
15356 + VLYNQ_INTR_TYPE type);
15359 +GLOBAL INT32 vlynq_interrupt_vector_cntl( VLYNQ_DEV *pdev,
15360 + UINT32 int_vector,
15361 + VLYNQ_DEV_TYPE dev,
15364 +GLOBAL UINT32 vlynq_interrupt_get_count( VLYNQ_DEV *pdev,
15365 + UINT32 map_vector);
15367 +GLOBAL INT32 vlynq_install_isr( VLYNQ_DEV *pdev,
15368 + UINT32 map_vector,
15369 + VLYNQ_INTR_CNTRL_ISR isr,
15370 + void *arg1, void *arg2, void *arg3);
15372 +GLOBAL INT32 vlynq_uninstall_isr( VLYNQ_DEV *pdev,
15373 + UINT32 map_vector,
15374 + void *arg1, void *arg2, void *arg3);
15377 +GLOBAL void vlynq_root_isr(void *arg);
15379 +GLOBAL void vlynq_delay(UINT32 clktime);
15381 +/* The following functions, provide better granularity in setting
15382 + * interrupt parameters. (for better support of linux INT Controller)
15383 + * Note: The interrupt source is identified by "map_vector"- the bit
15384 + * position in interrupt status register*/
15386 +GLOBAL INT32 vlynq_interrupt_vector_map(VLYNQ_DEV * pdev,
15387 + VLYNQ_DEV_TYPE dev,
15388 + UINT32 int_vector,
15389 + UINT32 map_vector);
15391 +GLOBAL INT32 vlynq_interrupt_set_polarity(VLYNQ_DEV * pdev,
15392 + VLYNQ_DEV_TYPE dev,
15393 + UINT32 map_vector,
15394 + VLYNQ_INTR_POLARITY pol);
15396 +GLOBAL INT32 vlynq_interrupt_get_polarity( VLYNQ_DEV *pdev ,
15397 + VLYNQ_DEV_TYPE dev_type,
15398 + UINT32 map_vector);
15400 +GLOBAL INT32 vlynq_interrupt_set_type(VLYNQ_DEV * pdev,
15401 + VLYNQ_DEV_TYPE dev,
15402 + UINT32 map_vector,
15403 + VLYNQ_INTR_TYPE type);
15405 +GLOBAL INT32 vlynq_interrupt_get_type( VLYNQ_DEV *pdev,
15406 + VLYNQ_DEV_TYPE dev_type,
15407 + UINT32 map_vector);
15409 +GLOBAL INT32 vlynq_interrupt_enable(VLYNQ_DEV* pdev,
15410 + VLYNQ_DEV_TYPE dev,
15411 + UINT32 map_vector);
15413 +GLOBAL INT32 vlynq_interrupt_disable(VLYNQ_DEV * pdev,
15414 + VLYNQ_DEV_TYPE dev,
15415 + UINT32 map_vector);
15421 +#endif /* _VLYNQ_HAL_H_ */
15422 diff -urN linux.old/include/asm-mips/ar7/vlynq_hal_params.h linux.dev/include/asm-mips/ar7/vlynq_hal_params.h
15423 --- linux.old/include/asm-mips/ar7/vlynq_hal_params.h 1970-01-01 01:00:00.000000000 +0100
15424 +++ linux.dev/include/asm-mips/ar7/vlynq_hal_params.h 2005-11-10 01:10:46.095590250 +0100
15426 +/***************************************************************************
15427 +**+----------------------------------------------------------------------+**
15430 +**| ******o*** |**
15431 +**| ********_///_**** |**
15432 +**| ***** /_//_/ **** |**
15433 +**| ** ** (__/ **** |**
15438 +**| Copyright (c) 2003 Texas Instruments Incorporated |**
15439 +**| ALL RIGHTS RESERVED |**
15441 +**| Permission is hereby granted to licensees of Texas Instruments |**
15442 +**| Incorporated (TI) products to use this computer program for the sole |**
15443 +**| purpose of implementing a licensee product based on TI products. |**
15444 +**| No other rights to reproduce, use, or disseminate this computer |**
15445 +**| program, whether in part or in whole, are granted. |**
15447 +**| TI makes no representation or warranties with respect to the |**
15448 +**| performance of this computer program, and specifically disclaims |**
15449 +**| any responsibility for any damages, special or consequential, |**
15450 +**| connected with the use of this program. |**
15452 +**+----------------------------------------------------------------------+**
15453 +***************************************************************************/
15455 +/* This file defines Vlynq module parameters*/
15457 +#ifndef _VLYNQ_HAL_PARAMS_H
15458 +#define _VLYNQ_HAL_PARAMS_H
15460 + /* number of VLYNQ memory regions supported */
15461 +#define VLYNQ_MAX_MEMORY_REGIONS 0x04
15463 + /* Max.number of external interrupt inputs supported by VLYNQ module */
15464 +#define VLYNQ_IVR_MAXIVR 0x08
15466 +#define VLYNQ_CLK_DIV_MAX 0x08
15467 +#define VLYNQ_CLK_DIV_MIN 0x01
15470 +/*** the total number of entries allocated for ICB would be
15471 + * 32(for 32 bits in IntPending register) + VLYNQ_IVR_CHAIN_SLOTS*/
15472 +#define VLYNQ_IVR_CHAIN_SLOTS 10
15475 +#endif /* _VLYNQ_HAL_PARAMS_H */
15476 diff -urN linux.old/include/asm-mips/io.h linux.dev/include/asm-mips/io.h
15477 --- linux.old/include/asm-mips/io.h 2003-08-25 13:44:43.000000000 +0200
15478 +++ linux.dev/include/asm-mips/io.h 2005-11-10 01:14:16.400733500 +0100
15480 * Change "struct page" to physical address.
15482 #ifdef CONFIG_64BIT_PHYS_ADDR
15483 -#define page_to_phys(page) ((u64)(page - mem_map) << PAGE_SHIFT)
15484 +#define page_to_phys(page) (((u64)(page - mem_map) << PAGE_SHIFT) + PHYS_OFFSET)
15486 -#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
15487 +#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + PHYS_OFFSET)
15490 #define IO_SPACE_LIMIT 0xffff
15491 diff -urN linux.old/include/asm-mips/irq.h linux.dev/include/asm-mips/irq.h
15492 --- linux.old/include/asm-mips/irq.h 2003-08-25 13:44:43.000000000 +0200
15493 +++ linux.dev/include/asm-mips/irq.h 2005-11-10 01:12:43.950955750 +0100
15495 #include <linux/config.h>
15496 #include <linux/linkage.h>
15499 +/* MIPS has 8 irqs
15500 + * AR7 has 40 primary and 32 secondary irqs
15501 + * vlynq0 has 32 irqs
15502 + * vlynq1 has 32 irqs
15504 +#ifdef CONFIG_AR7_VLYNQ
15505 +#define NR_IRQS (80 + 32 * CONFIG_AR7_VLYNQ_PORTS)
15507 +#define NR_IRQS 80
15510 #define NR_IRQS 128 /* Largest number of ints of all machines. */
15513 #ifdef CONFIG_I8259
15514 static inline int irq_cannonicalize(int irq)
15515 diff -urN linux.old/include/asm-mips/mips-boards/prom.h linux.dev/include/asm-mips/mips-boards/prom.h
15516 --- linux.old/include/asm-mips/mips-boards/prom.h 2001-09-09 19:43:02.000000000 +0200
15517 +++ linux.dev/include/asm-mips/mips-boards/prom.h 2005-11-10 01:14:16.436735750 +0100
15519 extern void prom_init_cmdline(void);
15520 extern void prom_meminit(void);
15521 extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
15522 -extern void prom_free_prom_memory (void);
15523 +extern unsigned long prom_free_prom_memory (void);
15524 extern void mips_display_message(const char *str);
15525 extern void mips_display_word(unsigned int num);
15526 extern int get_ethernet_addr(char *ethernet_addr);
15527 diff -urN linux.old/include/asm-mips/page.h linux.dev/include/asm-mips/page.h
15528 --- linux.old/include/asm-mips/page.h 2004-02-18 14:36:32.000000000 +0100
15529 +++ linux.dev/include/asm-mips/page.h 2005-11-10 01:14:16.436735750 +0100
15532 #include <linux/config.h>
15533 #include <asm/break.h>
15534 +#include <asm/addrspace.h>
15538 @@ -129,7 +130,7 @@
15540 #define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
15541 #define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
15542 -#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
15543 +#define virt_to_page(kaddr) (mem_map + ((__pa(kaddr)-PHYS_OFFSET) >> PAGE_SHIFT))
15544 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
15546 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
15547 diff -urN linux.old/include/asm-mips/pgtable-32.h linux.dev/include/asm-mips/pgtable-32.h
15548 --- linux.old/include/asm-mips/pgtable-32.h 2004-02-18 14:36:32.000000000 +0100
15549 +++ linux.dev/include/asm-mips/pgtable-32.h 2005-11-10 01:14:16.436735750 +0100
15550 @@ -108,7 +108,7 @@
15551 * and a page entry and page directory to the page they refer to.
15554 -#ifdef CONFIG_CPU_VR41XX
15555 +#if defined(CONFIG_CPU_VR41XX)
15556 #define mk_pte(page, pgprot) \
15559 @@ -123,13 +123,14 @@
15563 - pte_val(__pte) = ((phys_t)(page - mem_map) << PAGE_SHIFT) | \
15564 - pgprot_val(pgprot); \
15565 + pte_val(__pte) = (((phys_t)(page - mem_map) << PAGE_SHIFT) + \
15566 + PHYS_OFFSET) | pgprot_val(pgprot); \
15573 static inline pte_t mk_pte_phys(phys_t physpage, pgprot_t pgprot)
15575 #ifdef CONFIG_CPU_VR41XX
15576 @@ -175,12 +176,12 @@
15577 set_pte(ptep, __pte(0));
15580 -#ifdef CONFIG_CPU_VR41XX
15581 +#if defined(CONFIG_CPU_VR41XX)
15582 #define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> (PAGE_SHIFT+2)))))
15583 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << (PAGE_SHIFT+2)) | pgprot_val(pgprot))
15585 -#define pte_page(x) (mem_map+((unsigned long)(((x).pte_low >> PAGE_SHIFT))))
15586 -#define __mk_pte(page_nr,pgprot) __pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
15587 +#define pte_page(x) (mem_map+((unsigned long)((((x).pte_low-PHYS_OFFSET) >> PAGE_SHIFT))))
15588 +#define __mk_pte(page_nr,pgprot) __pte((((page_nr) << PAGE_SHIFT)+PHYS_OFFSET)|pgprot_val(pgprot))
15592 diff -urN linux.old/include/asm-mips/serial.h linux.dev/include/asm-mips/serial.h
15593 --- linux.old/include/asm-mips/serial.h 2005-01-19 15:10:12.000000000 +0100
15594 +++ linux.dev/include/asm-mips/serial.h 2005-11-10 01:14:16.436735750 +0100
15597 #define C_P(card,port) (((card)<<6|(port)<<3) + 1)
15600 +#include <asm/ar7/ar7.h>
15601 +#include <asm/ar7/avalanche_intc.h>
15602 +#define AR7_SERIAL_PORT_DEFNS \
15603 + { 0, AR7_BASE_BAUD, AR7_UART0_REGS_BASE, LNXINTNUM(AVALANCHE_UART0_INT), STD_COM_FLAGS }, \
15604 + { 0, AR7_BASE_BAUD, AR7_UART1_REGS_BASE, LNXINTNUM(AVALANCHE_UART1_INT), STD_COM_FLAGS },
15606 +#define AR7_SERIAL_PORT_DEFNS
15609 #ifdef CONFIG_MIPS_JAZZ
15610 #define _JAZZ_SERIAL_INIT(int, base) \
15611 { .baud_base = JAZZ_BASE_BAUD, .irq = int, .flags = STD_COM_FLAGS, \
15612 @@ -468,6 +478,7 @@
15615 #define SERIAL_PORT_DFNS \
15616 + AR7_SERIAL_PORT_DEFNS \
15617 ATLAS_SERIAL_PORT_DEFNS \
15618 AU1000_SERIAL_PORT_DEFNS \
15619 COBALT_SERIAL_PORT_DEFNS \