1 diff -urN linux-2.6.17/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c linux-2.6.17-brcm63xx/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c
2 --- linux-2.6.17/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c 2006-07-25 12:57:09.000000000 +0200
7 + Copyright 2002 Broadcom Corp. All Rights Reserved.
9 + This program is free software; you can distribute it and/or modify it
10 + under the terms of the GNU General Public License (Version 2) as
11 + published by the Free Software Foundation.
13 + This program is distributed in the hope it will be useful, but WITHOUT
14 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 + You should have received a copy of the GNU General Public License along
19 + with this program; if not, write to the Free Software Foundation, Inc.,
20 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 +/* Description: Serial port driver for the BCM963XX. */
26 +#define CARDNAME "bcm963xx_serial driver"
27 +#define VERSION "2.0"
28 +#define VER_STR CARDNAME " v" VERSION "\n"
31 +#include <linux/kernel.h>
32 +#include <linux/module.h>
33 +#include <linux/version.h>
34 +#include <linux/init.h>
35 +#include <linux/slab.h>
36 +#include <linux/interrupt.h>
37 +#include <linux/spinlock.h>
39 +/* for definition of struct console */
40 +#include <linux/console.h>
41 +#include <linux/tty.h>
42 +#include <linux/tty_flip.h>
43 +#include <linux/serial.h>
44 +#include <asm/uaccess.h>
46 +#include <bcmtypes.h>
48 +#include <bcm_map_part.h>
49 +#include <bcm_intr.h>
51 +static DEFINE_SPINLOCK(bcm963xx_serial_lock);
53 +extern void _putc(char);
54 +extern void _puts(const char *);
56 +typedef struct bcm_serial {
57 + volatile Uart * port;
63 + unsigned short close_delay;
64 + unsigned short closing_wait;
65 + unsigned short line; /* port/line number */
66 + unsigned short cflags; /* line configuration flag */
67 + unsigned short x_char; /* xon/xoff character */
68 + unsigned short read_status_mask; /* mask for read condition */
69 + unsigned short ignore_status_mask; /* mask for ignore condition */
70 + unsigned long event; /* mask used in BH */
71 + int xmit_head; /* Position of the head */
72 + int xmit_tail; /* Position of the tail */
73 + int xmit_cnt; /* Count of the chars in the buffer */
74 + int count; /* indicates how many times it has been opened */
77 + struct async_icount icount; /* keep track of things ... */
78 + struct tty_struct *tty; /* tty associated */
79 + struct termios normal_termios;
81 + wait_queue_head_t open_wait;
82 + wait_queue_head_t close_wait;
84 + long session; /* Session of opening process */
85 + long pgrp; /* pgrp of opening process */
87 + unsigned char is_initialized;
91 +/*---------------------------------------------------------------------*/
92 +/* Define bits in the Interrupt Enable register */
93 +/*---------------------------------------------------------------------*/
94 +/* Enable receive interrupt */
95 +#define RXINT (RXFIFONE|RXOVFERR)
97 +/* Enable transmit interrupt */
98 +#define TXINT (TXFIFOEMT|TXUNDERR|TXOVFERR)
100 +/* Enable receiver line status interrupt */
101 +#define LSINT (RXBRK|RXPARERR|RXFRAMERR)
103 +#define BCM_NUM_UARTS 1
105 +#define BD_BCM63XX_TIMER_CLOCK_INPUT (FPERIPH)
108 +static struct bcm_serial multi[BCM_NUM_UARTS];
109 +static struct bcm_serial *lines[BCM_NUM_UARTS];
110 +static struct tty_driver serial_driver;
111 +static struct tty_struct *serial_table[BCM_NUM_UARTS];
112 +static struct termios *serial_termios[BCM_NUM_UARTS];
113 +static struct termios *serial_termios_locked[BCM_NUM_UARTS];
114 +static int serial_refcount;
117 +static void bcm_stop (struct tty_struct *tty);
118 +static void bcm_start (struct tty_struct *tty);
119 +static inline void receive_chars (struct bcm_serial * info);
120 +static int startup (struct bcm_serial *info);
121 +static void shutdown (struct bcm_serial * info);
122 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag );
123 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty);
124 +static int bcm63xx_cons_write (struct tty_struct *tty, int from_user,
125 + const unsigned char *buf, int count);
126 +static int bcm63xx_cons_write_room (struct tty_struct *tty);
127 +static int bcm_chars_in_buffer (struct tty_struct *tty);
128 +static void bcm_flush_buffer (struct tty_struct *tty);
129 +static void bcm_throttle (struct tty_struct *tty);
130 +static void bcm_unthrottle (struct tty_struct *tty);
131 +static void bcm_send_xchar (struct tty_struct *tty, char ch);
132 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo);
133 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info);
134 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value);
135 +static void send_break (struct bcm_serial *info, int duration);
136 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
137 + unsigned int cmd, unsigned long arg);
138 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios);
139 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp);
140 +static void bcm_hangup (struct tty_struct *tty);
141 +static int block_til_ready (struct tty_struct *tty, struct file *filp, struct bcm_serial *info);
142 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp);
143 +static int __init bcm63xx_serialinit(void);
147 + * ------------------------------------------------------------
148 + * rs_stop () and rs_start ()
150 + * These routines are called before setting or resetting
151 + * tty->stopped. They enable or disable transmitter interrupts,
153 + * ------------------------------------------------------------
155 +static void bcm_stop (struct tty_struct *tty)
159 +static void bcm_start (struct tty_struct *tty)
161 + _puts(CARDNAME " Start\n");
165 + * ------------------------------------------------------------
168 + * This routine deals with inputs from any lines.
169 + * ------------------------------------------------------------
171 +static inline void receive_chars (struct bcm_serial * info)
173 + struct tty_struct *tty = 0;
174 + struct async_icount * icount;
176 + unsigned short status, tmp;
178 + while ((status = info->port->intStatus) & RXINT)
180 + char flag_char = 0;
182 + if (status & RXFIFONE)
183 + ch = info->port->Data; // Read the character
184 + tty = info->tty; /* now tty points to the proper dev */
185 + icount = &info->icount;
188 + if (!tty_buffer_request_room(tty, 1))
191 + if (status & RXBRK)
193 + flag_char = TTY_BREAK;
196 + // keep track of the statistics
197 + if (status & (RXFRAMERR | RXPARERR | RXOVFERR))
199 + if (status & RXPARERR) /* parity error */
202 + if (status & RXFRAMERR) /* frame error */
204 + if (status & RXOVFERR)
206 + // Overflow. Reset the RX FIFO
207 + info->port->fifoctl |= RSTRXFIFOS;
210 + // check to see if we should ignore the character
211 + // and mask off conditions that should be ignored
212 + if (status & info->ignore_status_mask)
214 + if (++ignore > 100 )
218 + // Mask off the error conditions we want to ignore
219 + tmp = status & info->read_status_mask;
220 + if (tmp & RXPARERR)
222 + flag_char = TTY_PARITY;
225 + if (tmp & RXFRAMERR)
227 + flag_char = TTY_FRAME;
229 + if (tmp & RXOVFERR)
231 + tty_insert_flip_char(tty, ch, flag_char);
233 + flag_char = TTY_OVERRUN;
234 + if (!tty_buffer_request_room(tty, 1))
238 + tty_insert_flip_char(tty, ch, flag_char);
242 + tty_flip_buffer_push(tty);
247 + * ------------------------------------------------------------
250 + * this is the main interrupt routine for the chip.
251 + * It deals with the multiple ports.
252 + * ------------------------------------------------------------
254 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
255 +static irqreturn_t bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
257 +static void bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
260 + struct bcm_serial * info = lines[0];
263 + /* get pending interrupt flags from UART */
265 + /* Mask with only the serial interrupts that are enabled */
266 + intStat = info->port->intStatus & info->port->intMask;
269 + if (intStat & RXINT)
270 + receive_chars (info);
272 + if (intStat & TXINT)
273 + info->port->intStatus = TXINT;
274 + else /* don't know what it was, so let's mask it */
275 + info->port->intMask &= ~intStat;
277 + intStat = info->port->intStatus & info->port->intMask;
280 + // Clear the interrupt
281 + BcmHalInterruptEnable (INTERRUPT_ID_UART);
282 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
283 + return IRQ_HANDLED;
288 + * -------------------------------------------------------------------
291 + * various initialization tasks
292 + * -------------------------------------------------------------------
294 +static int startup (struct bcm_serial *info)
296 + // Port is already started...
301 + * -------------------------------------------------------------------
304 + * This routine will shutdown a serial port; interrupts are disabled, and
305 + * DTR is dropped if the hangup on close termio flag is on.
306 + * -------------------------------------------------------------------
308 +static void shutdown (struct bcm_serial * info)
310 + unsigned long flags;
311 + if (!info->is_initialized)
315 + /*save_flags (flags);
317 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
319 + info->port->control &= ~(BRGEN|TXEN|RXEN);
321 + set_bit (TTY_IO_ERROR, &info->tty->flags);
322 + info->is_initialized = 0;
324 + //restore_flags (flags);
325 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
328 + * -------------------------------------------------------------------
331 + * Set the baud rate, character size, parity and stop bits.
332 + * -------------------------------------------------------------------
334 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag )
336 + unsigned long ulFlags, ulBaud, ulClockFreqHz, ulTmp;
337 + /*save_flags(ulFlags);
339 + spin_lock_irqsave(&bcm963xx_serial_lock, ulFlags);
341 + switch( cFlag & (CBAUD | CBAUDEX) )
399 + /* Calculate buad rate. */
400 + ulClockFreqHz = BD_BCM63XX_TIMER_CLOCK_INPUT;
401 + ulTmp = (ulClockFreqHz / ulBaud) / 16;
403 + ulTmp /= 2; /* Rounding up, so sub is already accounted for */
405 + ulTmp = (ulTmp / 2) - 1; /* Rounding down so we must sub 1 */
406 + pUart->baudword = ulTmp;
408 + /* Set character size, stop bits and parity. */
409 + switch( cFlag & CSIZE )
412 + ulTmp = BITS5SYM; /* select transmit 5 bit data size */
415 + ulTmp = BITS6SYM; /* select transmit 6 bit data size */
418 + ulTmp = BITS7SYM; /* select transmit 7 bit data size */
422 + ulTmp = BITS8SYM; /* select transmit 8 bit data size */
425 + if( cFlag & CSTOPB )
426 + ulTmp |= TWOSTOP; /* select 2 stop bits */
428 + ulTmp |= ONESTOP; /* select one stop bit */
430 + /* Write these values into the config reg. */
431 + pUart->config = ulTmp;
432 + pUart->control &= ~(RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN);
433 + switch( cFlag & (PARENB | PARODD) )
435 + case PARENB|PARODD:
436 + pUart->control |= RXPARITYEN | TXPARITYEN;
439 + pUart->control |= RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN;
442 + pUart->control |= 0;
446 + /* Reset and flush uart */
447 + pUart->fifoctl = RSTTXFIFOS | RSTRXFIFOS;
448 + //restore_flags( ulFlags );
449 + spin_unlock_irqrestore(&bcm963xx_serial_lock, ulFlags);
454 + * -------------------------------------------------------------------
455 + * bcm_flush_char ()
457 + * Nothing to flush. Polled I/O is used.
458 + * -------------------------------------------------------------------
460 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty)
466 + * -------------------------------------------------------------------
467 + * bcm63xx_cons_write ()
469 + * Main output routine using polled I/O.
470 + * -------------------------------------------------------------------
472 +static int bcm63xx_cons_write (struct tty_struct *tty, int from_user,
473 + const unsigned char *buf, int count)
477 + for (c = 0; c < count; c++)
483 + * -------------------------------------------------------------------
484 + * bcm63xx_cons_write_room ()
486 + * Compute the amount of space available for writing.
487 + * -------------------------------------------------------------------
489 +static int bcm63xx_cons_write_room (struct tty_struct *tty)
491 + /* Pick a number. Any number. Polled I/O is used. */
496 + * -------------------------------------------------------------------
497 + * bcm_chars_in_buffer ()
499 + * compute the amount of char left to be transmitted
500 + * -------------------------------------------------------------------
502 +static int bcm_chars_in_buffer (struct tty_struct *tty)
508 + * -------------------------------------------------------------------
509 + * bcm_flush_buffer ()
511 + * Empty the output buffer
512 + * -------------------------------------------------------------------
514 +static void bcm_flush_buffer (struct tty_struct *tty)
519 + * ------------------------------------------------------------
520 + * bcm_throttle () and bcm_unthrottle ()
522 + * This routine is called by the upper-layer tty layer to signal that
523 + * incoming characters should be throttled (or not).
524 + * ------------------------------------------------------------
526 +static void bcm_throttle (struct tty_struct *tty)
528 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
530 + info->x_char = STOP_CHAR(tty);
533 +static void bcm_unthrottle (struct tty_struct *tty)
535 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
541 + info->x_char = START_CHAR(tty);
545 +static void bcm_send_xchar (struct tty_struct *tty, char ch)
547 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
550 + bcm_start (info->tty);
554 + * ------------------------------------------------------------
555 + * rs_ioctl () and friends
556 + * ------------------------------------------------------------
558 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo)
560 + struct serial_struct tmp;
565 + memset (&tmp, 0, sizeof(tmp));
566 + tmp.type = info->type;
567 + tmp.line = info->line;
568 + tmp.port = (int) info->port;
569 + tmp.irq = info->irq;
571 + tmp.baud_base = info->baud_base;
572 + tmp.close_delay = info->close_delay;
573 + tmp.closing_wait = info->closing_wait;
575 + return copy_to_user (retinfo, &tmp, sizeof(*retinfo));
578 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info)
580 + struct serial_struct new_serial;
581 + struct bcm_serial old_info;
587 + copy_from_user (&new_serial, new_info, sizeof(new_serial));
590 + if (!capable(CAP_SYS_ADMIN))
594 + if (info->count > 1)
597 + /* OK, past this point, all the error checking has been done.
598 + * At this point, we start making changes.....
600 + info->baud_base = new_serial.baud_base;
601 + info->type = new_serial.type;
602 + info->close_delay = new_serial.close_delay;
603 + info->closing_wait = new_serial.closing_wait;
604 + retval = startup (info);
609 + * get_lsr_info - get line status register info
611 + * Purpose: Let user call ioctl() to get info when the UART physically
612 + * is emptied. On bus types like RS485, the transmitter must
613 + * release the bus after transmitting. This must be done when
614 + * the transmit shift register is empty, not be done when the
615 + * transmit holding register is empty. This functionality
616 + * allows an RS485 driver to be written in user space.
618 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value)
624 + * This routine sends a break character out the serial port.
626 +static void send_break (struct bcm_serial *info, int duration)
628 + unsigned long flags;
633 + current->state = TASK_INTERRUPTIBLE;
635 + /*save_flags (flags);
637 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
639 + info->port->control |= XMITBREAK;
640 + schedule_timeout(duration);
641 + info->port->control &= ~XMITBREAK;
643 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
644 + //restore_flags (flags);
647 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
648 + unsigned int cmd, unsigned long arg)
651 + struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
654 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
655 + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD) &&
656 + (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT))
658 + if (tty->flags & (1 << TTY_IO_ERROR))
664 + case TCSBRK: /* SVID version: non-zero arg --> no break */
665 + retval = tty_check_change (tty);
668 + tty_wait_until_sent (tty, 0);
670 + send_break (info, HZ/4); /* 1/4 second */
673 + case TCSBRKP: /* support for POSIX tcsendbreak() */
674 + retval = tty_check_change (tty);
677 + tty_wait_until_sent (tty, 0);
678 + send_break (info, arg ? arg*(HZ/10) : HZ/4);
682 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(long));
687 + put_user (C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
692 + error = get_user (arg, (unsigned long *)arg);
695 + tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
699 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(struct serial_struct));
703 + return get_serial_info (info, (struct serial_struct *)arg);
706 + return set_serial_info (info, (struct serial_struct *) arg);
708 + case TIOCSERGETLSR: /* Get line status register */
709 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(unsigned int));
713 + return get_lsr_info (info, (unsigned int *)arg);
715 + case TIOCSERGSTRUCT:
716 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(struct bcm_serial));
721 + copy_to_user((struct bcm_serial *)arg, info, sizeof(struct bcm_serial));
726 + return -ENOIOCTLCMD;
731 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios)
733 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
735 + if( tty->termios->c_cflag != old_termios->c_cflag )
736 + change_speed (info->port, tty->termios->c_cflag);
740 + * ------------------------------------------------------------
741 + * bcm63xx_cons_close()
743 + * This routine is called when the serial port gets closed. First, we
744 + * wait for the last remaining data to be sent. Then, we turn off
745 + * the transmit enable and receive enable flags.
746 + * ------------------------------------------------------------
748 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp)
750 + struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
751 + unsigned long flags;
756 + /*save_flags (flags);
758 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
760 + if (tty_hung_up_p (filp))
762 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
763 + //restore_flags (flags);
767 + if ((tty->count == 1) && (info->count != 1))
770 + /* Uh, oh. tty->count is 1, which means that the tty
771 + * structure will be freed. Info->count should always
772 + * be one in these conditions. If it's greater than
773 + * one, we've got real problems, since it means the
774 + * serial port won't be shutdown.
776 + printk("bcm63xx_cons_close: bad serial port count; tty->count is 1, "
777 + "info->count is %d\n", info->count);
781 + if (--info->count < 0)
783 + printk("ds_close: bad serial port count for ttys%d: %d\n",
784 + info->line, info->count);
790 + //restore_flags (flags);
791 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
795 + /* Now we wait for the transmit buffer to clear; and we notify
796 + * the line discipline to only process XON/XOFF characters.
800 + /* At this point we stop accepting input. To do this, we
801 + * disable the receive line status interrupts.
804 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
805 + if (tty->driver->flush_buffer)
806 + tty->driver->flush_buffer (tty);
808 + if (tty->driver.flush_buffer)
809 + tty->driver.flush_buffer (tty);
811 + if (tty->ldisc.flush_buffer)
812 + tty->ldisc.flush_buffer (tty);
817 + if (tty->ldisc.num != tty_ldisc_get(N_TTY)->num)
819 + if (tty->ldisc.close)
820 + (tty->ldisc.close)(tty);
821 + tty->ldisc = *tty_ldisc_get(N_TTY);
822 + tty->termios->c_line = N_TTY;
823 + if (tty->ldisc.open)
824 + (tty->ldisc.open)(tty);
826 + if (info->blocked_open)
828 + if (info->close_delay)
830 + current->state = TASK_INTERRUPTIBLE;
831 + schedule_timeout(info->close_delay);
833 + wake_up_interruptible (&info->open_wait);
835 + wake_up_interruptible (&info->close_wait);
837 + //restore_flags (flags);
838 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
842 + * bcm_hangup () --- called by tty_hangup() when a hangup is signaled.
844 +static void bcm_hangup (struct tty_struct *tty)
847 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
853 + wake_up_interruptible (&info->open_wait);
857 + * ------------------------------------------------------------
858 + * rs_open() and friends
859 + * ------------------------------------------------------------
861 +static int block_til_ready (struct tty_struct *tty, struct file *filp,
862 + struct bcm_serial *info)
868 + * This routine is called whenever a serial port is opened. It
869 + * enables interrupts for a serial port. It also performs the
870 + * serial-specific initialization for the tty structure.
872 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp)
874 + struct bcm_serial *info;
877 + // Make sure we're only opening on of the ports we support
878 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
879 + line = MINOR(tty->driver->cdev.dev) - tty->driver->minor_start;
881 + line = MINOR(tty->device) - tty->driver.minor_start;
884 + if ((line < 0) || (line >= BCM_NUM_UARTS))
887 + info = lines[line];
889 + info->port->intMask = 0; /* Clear any pending interrupts */
890 + info->port->intMask = RXINT; /* Enable RX */
893 + tty->driver_data = info;
895 + BcmHalInterruptEnable (INTERRUPT_ID_UART);
897 + // Start up serial port
898 + retval = startup (info);
902 + retval = block_til_ready (tty, filp, info);
907 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
908 + info->pgrp = process_group(current);
909 + info->session = current->signal->session;
911 + info->session = current->session;
912 + info->pgrp = current->pgrp;
918 +/* --------------------------------------------------------------------------
919 + Name: bcm63xx_serialinit
920 + Purpose: Initialize our BCM63xx serial driver
921 +-------------------------------------------------------------------------- */
922 +static int __init bcm63xx_serialinit(void)
925 + struct bcm_serial * info;
927 + // Print the driver version information
930 + memset(&serial_driver, 0, sizeof(struct tty_driver));
931 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
932 + serial_driver.owner = THIS_MODULE;
933 + serial_driver.devfs_name = "tts/";
935 + serial_driver.magic = TTY_DRIVER_MAGIC;
936 + serial_driver.name = "ttyS";
937 + serial_driver.major = TTY_MAJOR;
938 + serial_driver.minor_start = 64;
939 + serial_driver.num = BCM_NUM_UARTS;
940 + serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
941 + serial_driver.subtype = SERIAL_TYPE_NORMAL;
942 + serial_driver.init_termios = tty_std_termios;
943 + serial_driver.init_termios.c_cflag = B115200 | CS8 | CREAD | CLOCAL;
944 + serial_driver.flags = TTY_DRIVER_REAL_RAW;
945 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
946 + serial_driver.refcount = serial_refcount;
947 + serial_driver.ttys = serial_table;
949 + serial_driver.refcount = &serial_refcount;
950 + serial_driver.table = serial_table;
953 + serial_driver.termios = serial_termios;
954 + serial_driver.termios_locked = serial_termios_locked;
955 + serial_driver.open = bcm63xx_cons_open;
956 + serial_driver.close = bcm63xx_cons_close;
957 + serial_driver.write = bcm63xx_cons_write;
958 + serial_driver.flush_chars = bcm63xx_cons_flush_chars;
959 + serial_driver.write_room = bcm63xx_cons_write_room;
960 + serial_driver.chars_in_buffer = bcm_chars_in_buffer;
961 + serial_driver.flush_buffer = bcm_flush_buffer;
962 + serial_driver.ioctl = bcm_ioctl;
963 + serial_driver.throttle = bcm_throttle;
964 + serial_driver.unthrottle = bcm_unthrottle;
965 + serial_driver.send_xchar = bcm_send_xchar;
966 + serial_driver.set_termios = bcm_set_termios;
967 + serial_driver.stop = bcm_stop;
968 + serial_driver.start = bcm_start;
969 + serial_driver.hangup = bcm_hangup;
971 + if (tty_register_driver (&serial_driver))
972 + panic("Couldn't register serial driver\n");
974 + //save_flags(flags); cli();
975 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
977 + for (i = 0; i < BCM_NUM_UARTS; i++)
981 + info->port = (Uart *) ((char *)UART_BASE + (i * 0x20));
982 + info->irq = (2 - i) + 8;
985 + info->close_delay = 50;
986 + info->closing_wait = 3000;
990 + info->blocked_open = 0;
991 + info->normal_termios = serial_driver.init_termios;
992 + init_waitqueue_head(&info->open_wait);
993 + init_waitqueue_head(&info->close_wait);
995 + /* If we are pointing to address zero then punt - not correctly
996 + * set up in setup.c to handle this.
1000 + BcmHalMapInterrupt(bcm_interrupt, 0, INTERRUPT_ID_UART);
1003 + /* order matters here... the trick is that flags
1004 + * is updated... in request_irq - to immediatedly obliterate
1007 + //restore_flags(flags);
1008 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
1012 +module_init(bcm63xx_serialinit);
1014 +/* --------------------------------------------------------------------------
1015 + Name: bcm_console_print
1016 + Purpose: bcm_console_print is registered for printk.
1017 + The console_lock must be held when we get here.
1018 +-------------------------------------------------------------------------- */
1019 +static void bcm_console_print (struct console * cons, const char * str,
1020 + unsigned int count)
1024 + for(i=0; i<count; i++, str++)
1034 +static struct tty_driver * bcm_console_device(struct console * c, int *index)
1036 + *index = c->index;
1037 + return &serial_driver;
1040 +static int __init bcm_console_setup(struct console * co, char * options)
1045 +static struct console bcm_sercons = {
1047 + .write = bcm_console_print,
1048 + .device = bcm_console_device,
1049 + .setup = bcm_console_setup,
1050 + .flags = CON_PRINTBUFFER, // CON_CONSDEV, CONSOLE_LINE,
1054 +static int __init bcm63xx_console_init(void)
1056 + register_console(&bcm_sercons);
1060 +console_initcall(bcm63xx_console_init);
1061 diff -urN linux-2.6.17/bcmdrivers/opensource/char/serial/impl1/Makefile linux-2.6.17-brcm63xx/bcmdrivers/opensource/char/serial/impl1/Makefile
1062 --- linux-2.6.17/bcmdrivers/opensource/char/serial/impl1/Makefile 1970-01-01 01:00:00.000000000 +0100
1063 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/char/serial/impl1/Makefile 2006-07-25 10:43:50.000000000 +0200
1065 +# File: bcmdrivers/opensource/char/serial
1067 +# Makefile for the BCM63xx serial/console driver
1069 +obj-$(CONFIG_BCM_SERIAL) += bcm63xx_cons.o
1071 +EXTRA_CFLAGS += -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
1073 +-include $(TOPDIR)/Rules.make
1076 + rm -f core *.o *.a *.s
1078 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6338_intr.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_intr.h
1079 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6338_intr.h 1970-01-01 01:00:00.000000000 +0100
1080 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_intr.h 2006-07-25 10:44:46.000000000 +0200
1084 + Copyright 2003 Broadcom Corp. All Rights Reserved.
1086 + This program is free software; you can distribute it and/or modify it
1087 + under the terms of the GNU General Public License (Version 2) as
1088 + published by the Free Software Foundation.
1090 + This program is distributed in the hope it will be useful, but WITHOUT
1091 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1092 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1095 + You should have received a copy of the GNU General Public License along
1096 + with this program; if not, write to the Free Software Foundation, Inc.,
1097 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1101 +#ifndef __6338_INTR_H
1102 +#define __6338_INTR_H
1104 +/*=====================================================================*/
1105 +/* BCM6338 External Interrupt Level Assignments */
1106 +/*=====================================================================*/
1107 +#define INTERRUPT_ID_EXTERNAL_0 3
1108 +#define INTERRUPT_ID_EXTERNAL_1 4
1109 +#define INTERRUPT_ID_EXTERNAL_2 5
1110 +#define INTERRUPT_ID_EXTERNAL_3 6
1112 +/*=====================================================================*/
1113 +/* BCM6338 Timer Interrupt Level Assignments */
1114 +/*=====================================================================*/
1115 +#define MIPS_TIMER_INT 7
1117 +/*=====================================================================*/
1118 +/* Peripheral ISR Table Offset */
1119 +/*=====================================================================*/
1120 +#define INTERNAL_ISR_TABLE_OFFSET 8
1122 +/*=====================================================================*/
1123 +/* Logical Peripheral Interrupt IDs */
1124 +/*=====================================================================*/
1126 +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 0)
1127 +#define INTERRUPT_ID_SPI (INTERNAL_ISR_TABLE_OFFSET + 1)
1128 +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 2)
1129 +#define INTERRUPT_ID_DG (INTERNAL_ISR_TABLE_OFFSET + 4)
1130 +#define INTERRUPT_ID_ADSL (INTERNAL_ISR_TABLE_OFFSET + 5)
1131 +#define INTERRUPT_ID_ATM (INTERNAL_ISR_TABLE_OFFSET + 6)
1132 +#define INTERRUPT_ID_USBS (INTERNAL_ISR_TABLE_OFFSET + 7)
1133 +#define INTERRUPT_ID_EMAC1 (INTERNAL_ISR_TABLE_OFFSET + 8)
1134 +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 9)
1135 +#define INTERRUPT_ID_SDRAM (INTERNAL_ISR_TABLE_OFFSET + 10)
1136 +#define INTERRUPT_ID_USB_CNTL_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 11)
1137 +#define INTERRUPT_ID_USB_CNTL_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 12)
1138 +#define INTERRUPT_ID_USB_BULK_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 13)
1139 +#define INTERRUPT_ID_USB_BULK_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 14)
1140 +#define INTERRUPT_ID_EMAC1_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 15)
1141 +#define INTERRUPT_ID_EMAC1_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 16)
1142 +#define INTERRUPT_ID_SDIO (INTERNAL_ISR_TABLE_OFFSET + 17)
1144 +#endif /* __BCM6338_H */
1146 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h
1147 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h 1970-01-01 01:00:00.000000000 +0100
1148 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h 2006-07-25 10:44:59.000000000 +0200
1152 + Copyright 2004 Broadcom Corp. All Rights Reserved.
1154 + This program is free software; you can distribute it and/or modify it
1155 + under the terms of the GNU General Public License (Version 2) as
1156 + published by the Free Software Foundation.
1158 + This program is distributed in the hope it will be useful, but WITHOUT
1159 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1160 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1163 + You should have received a copy of the GNU General Public License along
1164 + with this program; if not, write to the Free Software Foundation, Inc.,
1165 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1169 +#ifndef __BCM6338_MAP_H
1170 +#define __BCM6338_MAP_H
1172 +#include "bcmtypes.h"
1174 +#define PERF_BASE 0xfffe0000
1175 +#define TIMR_BASE 0xfffe0200
1176 +#define UART_BASE 0xfffe0300
1177 +#define GPIO_BASE 0xfffe0400
1178 +#define SPI_BASE 0xfffe0c00
1180 +typedef struct PerfControl {
1182 + uint16 testControl;
1183 + uint16 blkEnables;
1184 +#define EMAC_CLK_EN 0x0010
1185 +#define USBS_CLK_EN 0x0010
1186 +#define SAR_CLK_EN 0x0020
1188 +#define SPI_CLK_EN 0x0200
1190 + uint32 pll_control;
1191 +#define SOFT_RESET 0x00000001
1197 +#define EI_SENSE_SHFT 0
1198 +#define EI_STATUS_SHFT 5
1199 +#define EI_CLEAR_SHFT 10
1200 +#define EI_MASK_SHFT 15
1201 +#define EI_INSENS_SHFT 20
1202 +#define EI_LEVEL_SHFT 25
1204 + uint32 unused[4]; /* (18) */
1205 + uint32 BlockSoftReset; /* (28) */
1206 +#define BSR_SPI 0x00000001
1207 +#define BSR_EMAC 0x00000004
1208 +#define BSR_USBH 0x00000008
1209 +#define BSR_USBS 0x00000010
1210 +#define BSR_ADSL 0x00000020
1211 +#define BSR_DMAMEM 0x00000040
1212 +#define BSR_SAR 0x00000080
1213 +#define BSR_ACLC 0x00000100
1214 +#define BSR_ADSL_MIPS_PLL 0x00000400
1215 +#define BSR_ALL_BLOCKS \
1216 + (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
1217 + BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL)
1220 +#define PERF ((volatile PerfControl * const) PERF_BASE)
1223 +typedef struct Timer {
1226 +#define TIMER0EN 0x01
1227 +#define TIMER1EN 0x02
1228 +#define TIMER2EN 0x04
1230 +#define TIMER0 0x01
1231 +#define TIMER1 0x02
1232 +#define TIMER2 0x04
1233 +#define WATCHDOG 0x08
1237 +#define TIMERENABLE 0x80000000
1238 +#define RSTCNTCLR 0x40000000
1242 + uint32 WatchDogDefCount;
1244 + /* Write 0xff00 0x00ff to Start timer
1245 + * Write 0xee00 0x00ee to Stop and re-load default count
1246 + * Read from this register returns current watch dog count
1248 + uint32 WatchDogCtl;
1250 + /* Number of 40-MHz ticks for WD Reset pulse to last */
1251 + uint32 WDResetCount;
1254 +#define TIMER ((volatile Timer * const) TIMR_BASE)
1255 +typedef struct UartChannel {
1258 +#define BRGEN 0x80 /* Control register bit defs */
1261 +#define LOOPBK 0x10
1262 +#define TXPARITYEN 0x08
1263 +#define TXPARITYEVEN 0x04
1264 +#define RXPARITYEN 0x02
1265 +#define RXPARITYEVEN 0x01
1268 +#define XMITBREAK 0x40
1269 +#define BITS5SYM 0x00
1270 +#define BITS6SYM 0x10
1271 +#define BITS7SYM 0x20
1272 +#define BITS8SYM 0x30
1273 +#define ONESTOP 0x07
1274 +#define TWOSTOP 0x0f
1275 + /* 4-LSBS represent STOP bits/char
1276 + * in 1/8 bit-time intervals. Zero
1277 + * represents 1/8 stop bit interval.
1278 + * Fifteen represents 2 stop bits.
1281 +#define RSTTXFIFOS 0x80
1282 +#define RSTRXFIFOS 0x40
1283 + /* 5-bit TimeoutCnt is in low bits of this register.
1284 + * This count represents the number of characters
1285 + * idle times before setting receive Irq when below threshold
1288 + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
1291 + byte txf_levl; /* Read-only fifo depth */
1292 + byte rxf_levl; /* Read-only fifo depth */
1293 + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are
1294 + * RxThreshold. Irq can be asserted
1295 + * when rx fifo> thresh, txfifo<thresh
1297 + byte prog_out; /* Set value of DTR (Bit0), RTS (Bit1)
1298 + * if these bits are also enabled to GPIO_o
1304 + byte DeltaIPEdgeNoSense; /* Low 4-bits, set corr bit to 1 to
1305 + * detect irq on rising AND falling
1306 + * edges for corresponding GPIO_i
1307 + * if enabled (edge insensitive)
1309 + byte DeltaIPConfig_Mask; /* Upper 4 bits: 1 for posedge sense
1310 + * 0 for negedge sense if
1311 + * not configured for edge
1312 + * insensitive (see above)
1313 + * Lower 4 bits: Mask to enable change
1314 + * detection IRQ for corresponding
1317 + byte DeltaIP_SyncIP; /* Upper 4 bits show which bits
1318 + * have changed (may set IRQ).
1319 + * read automatically clears bit
1320 + * Lower 4 bits are actual status
1323 + uint16 intMask; /* Same Bit defs for Mask and status */
1325 +#define DELTAIP 0x0001
1326 +#define TXUNDERR 0x0002
1327 +#define TXOVFERR 0x0004
1328 +#define TXFIFOTHOLD 0x0008
1329 +#define TXREADLATCH 0x0010
1330 +#define TXFIFOEMT 0x0020
1331 +#define RXUNDERR 0x0040
1332 +#define RXOVFERR 0x0080
1333 +#define RXTIMEOUT 0x0100
1334 +#define RXFIFOFULL 0x0200
1335 +#define RXFIFOTHOLD 0x0400
1336 +#define RXFIFONE 0x0800
1337 +#define RXFRAMERR 0x1000
1338 +#define RXPARERR 0x2000
1339 +#define RXBRK 0x4000
1342 + uint16 Data; /* Write to TX, Read from RX */
1343 + /* bits 11:8 are BRK,PAR,FRM errors */
1349 +#define UART ((volatile Uart * const) UART_BASE)
1351 +typedef struct GpioControl {
1353 + uint32 GPIODir; /* bits 7:0 */
1355 + uint32 GPIOio; /* bits 7:0 */
1357 +#define LED3_STROBE 0x08000000
1358 +#define LED2_STROBE 0x04000000
1359 +#define LED1_STROBE 0x02000000
1360 +#define LED0_STROBE 0x01000000
1361 +#define LED_TEST 0x00010000
1362 +#define LED3_DISABLE_LINK_ACT 0x00008000
1363 +#define LED2_DISABLE_LINK_ACT 0x00004000
1364 +#define LED1_DISABLE_LINK_ACT 0x00002000
1365 +#define LED0_DISABLE_LINK_ACT 0x00001000
1366 +#define LED_INTERVAL_SET_MASK 0x00000f00
1367 +#define LED_INTERVAL_SET_320MS 0x00000500
1368 +#define LED_INTERVAL_SET_160MS 0x00000400
1369 +#define LED_INTERVAL_SET_80MS 0x00000300
1370 +#define LED_INTERVAL_SET_40MS 0x00000200
1371 +#define LED_INTERVAL_SET_20MS 0x00000100
1372 +#define LED3_ON 0x00000080
1373 +#define LED2_ON 0x00000040
1374 +#define LED1_ON 0x00000020
1375 +#define LED0_ON 0x00000010
1376 +#define LED3_ENABLE 0x00000008
1377 +#define LED2_ENABLE 0x00000004
1378 +#define LED1_ENABLE 0x00000002
1379 +#define LED0_ENABLE 0x00000001
1380 + uint32 SpiSlaveCfg;
1381 +#define SPI_SLAVE_RESET 0x00010000
1382 +#define SPI_RESTRICT 0x00000400
1383 +#define SPI_DELAY_DISABLE 0x00000200
1384 +#define SPI_PROBE_MUX_SEL_MASK 0x000001e0
1385 +#define SPI_SER_ADDR_CFG_MASK 0x0000000c
1386 +#define SPI_MODE 0x00000001
1387 + uint32 vRegConfig;
1390 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
1392 +/* Number to mask conversion macro used for GPIODir and GPIOio */
1393 +#define GPIO_NUM_MAX_BITS_MASK 0x0f
1394 +#define GPIO_NUM_TO_MASK(X) (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
1400 +typedef struct SpiControl {
1401 + uint16 spiCmd; /* (0x0): SPI command */
1402 +#define SPI_CMD_START_IMMEDIATE 3
1404 +#define SPI_CMD_COMMAND_SHIFT 0
1405 +#define SPI_CMD_DEVICE_ID_SHIFT 4
1406 +#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8
1408 + byte spiIntStatus; /* (0x2): SPI interrupt status */
1409 + byte spiMaskIntStatus; /* (0x3): SPI masked interrupt status */
1411 + byte spiIntMask; /* (0x4): SPI interrupt mask */
1412 +#define SPI_INTR_CMD_DONE 0x01
1413 +#define SPI_INTR_CLEAR_ALL 0x1f
1415 + byte spiStatus; /* (0x5): SPI status */
1417 + byte spiClkCfg; /* (0x6): SPI clock configuration */
1419 + byte spiFillByte; /* (0x7): SPI fill byte */
1422 + byte spiMsgTail; /* (0x9): msgtail */
1424 + byte spiRxTail; /* (0xB): rxtail */
1426 + uint32 unused2[13]; /* (0x0c - 0x3c) reserved */
1428 + byte spiMsgCtl; /* (0x40) control byte */
1429 +#define HALF_DUPLEX_W 1
1430 +#define HALF_DUPLEX_R 2
1431 +#define SPI_MSG_TYPE_SHIFT 6
1432 +#define SPI_BYTE_CNT_SHIFT 0
1433 + byte spiMsgData[63]; /* (0x41 - 0x7f) msg data */
1434 + byte spiRxDataFifo[64]; /* (0x80 - 0xbf) rx data */
1435 + byte unused3[64]; /* (0xc0 - 0xff) reserved */
1438 +#define SPI ((volatile SpiControl * const) SPI_BASE)
1441 +** External Bus Interface
1443 +typedef struct EbiChipSelect {
1444 + uint32 base; /* base address in upper 24 bits */
1445 +#define EBI_SIZE_8K 0
1446 +#define EBI_SIZE_16K 1
1447 +#define EBI_SIZE_32K 2
1448 +#define EBI_SIZE_64K 3
1449 +#define EBI_SIZE_128K 4
1450 +#define EBI_SIZE_256K 5
1451 +#define EBI_SIZE_512K 6
1452 +#define EBI_SIZE_1M 7
1453 +#define EBI_SIZE_2M 8
1454 +#define EBI_SIZE_4M 9
1455 +#define EBI_SIZE_8M 10
1456 +#define EBI_SIZE_16M 11
1457 +#define EBI_SIZE_32M 12
1458 +#define EBI_SIZE_64M 13
1459 +#define EBI_SIZE_128M 14
1460 +#define EBI_SIZE_256M 15
1462 +#define EBI_ENABLE 0x00000001 /* .. enable this range */
1463 +#define EBI_WAIT_STATES 0x0000000e /* .. mask for wait states */
1464 +#define EBI_WTST_SHIFT 1 /* .. for shifting wait states */
1465 +#define EBI_WORD_WIDE 0x00000010 /* .. 16-bit peripheral, else 8 */
1466 +#define EBI_WREN 0x00000020 /* enable posted writes */
1467 +#define EBI_POLARITY 0x00000040 /* .. set to invert something,
1468 + ** don't know what yet */
1469 +#define EBI_TS_TA_MODE 0x00000080 /* .. use TS/TA mode */
1470 +#define EBI_TS_SEL 0x00000100 /* .. drive tsize, not bs_b */
1471 +#define EBI_FIFO 0x00000200 /* .. use fifo */
1472 +#define EBI_RE 0x00000400 /* .. Reverse Endian */
1475 +typedef struct MpiRegisters {
1476 + EbiChipSelect cs[1]; /* size chip select configuration */
1479 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
1484 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6345_intr.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_intr.h
1485 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6345_intr.h 1970-01-01 01:00:00.000000000 +0100
1486 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_intr.h 2006-07-25 10:45:09.000000000 +0200
1490 + Copyright 2002 Broadcom Corp. All Rights Reserved.
1492 + This program is free software; you can distribute it and/or modify it
1493 + under the terms of the GNU General Public License (Version 2) as
1494 + published by the Free Software Foundation.
1496 + This program is distributed in the hope it will be useful, but WITHOUT
1497 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1498 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1501 + You should have received a copy of the GNU General Public License along
1502 + with this program; if not, write to the Free Software Foundation, Inc.,
1503 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1507 +#ifndef __6345_INTR_H
1508 +#define __6345_INTR_H
1511 +/*=====================================================================*/
1512 +/* BCM6345 External Interrupt Level Assignments */
1513 +/*=====================================================================*/
1514 +#define INTERRUPT_ID_EXTERNAL_0 3
1515 +#define INTERRUPT_ID_EXTERNAL_1 4
1516 +#define INTERRUPT_ID_EXTERNAL_2 5
1517 +#define INTERRUPT_ID_EXTERNAL_3 6
1519 +/*=====================================================================*/
1520 +/* BCM6345 Timer Interrupt Level Assignments */
1521 +/*=====================================================================*/
1522 +#define MIPS_TIMER_INT 7
1524 +/*=====================================================================*/
1525 +/* Peripheral ISR Table Offset */
1526 +/*=====================================================================*/
1527 +#define INTERNAL_ISR_TABLE_OFFSET 8
1528 +#define DMA_ISR_TABLE_OFFSET (INTERNAL_ISR_TABLE_OFFSET + 13)
1530 +/*=====================================================================*/
1531 +/* Logical Peripheral Interrupt IDs */
1532 +/*=====================================================================*/
1534 +/* Internal peripheral interrupt IDs */
1535 +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 0)
1536 +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 2)
1537 +#define INTERRUPT_ID_ADSL (INTERNAL_ISR_TABLE_OFFSET + 3)
1538 +#define INTERRUPT_ID_ATM (INTERNAL_ISR_TABLE_OFFSET + 4)
1539 +#define INTERRUPT_ID_USB (INTERNAL_ISR_TABLE_OFFSET + 5)
1540 +#define INTERRUPT_ID_EMAC (INTERNAL_ISR_TABLE_OFFSET + 8)
1541 +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 12)
1543 +/* DMA channel interrupt IDs */
1544 +#define INTERRUPT_ID_EMAC_RX_CHAN (DMA_ISR_TABLE_OFFSET + EMAC_RX_CHAN)
1545 +#define INTERRUPT_ID_EMAC_TX_CHAN (DMA_ISR_TABLE_OFFSET + EMAC_TX_CHAN)
1546 +#define INTERRUPT_ID_EBI_RX_CHAN (DMA_ISR_TABLE_OFFSET + EBI_RX_CHAN)
1547 +#define INTERRUPT_ID_EBI_TX_CHAN (DMA_ISR_TABLE_OFFSET + EBI_TX_CHAN)
1548 +#define INTERRUPT_ID_RESERVED_RX_CHAN (DMA_ISR_TABLE_OFFSET + RESERVED_RX_CHAN)
1549 +#define INTERRUPT_ID_RESERVED_TX_CHAN (DMA_ISR_TABLE_OFFSET + RESERVED_TX_CHAN)
1550 +#define INTERRUPT_ID_USB_BULK_RX_CHAN (DMA_ISR_TABLE_OFFSET + USB_BULK_RX_CHAN)
1551 +#define INTERRUPT_ID_USB_BULK_TX_CHAN (DMA_ISR_TABLE_OFFSET + USB_BULK_TX_CHAN)
1552 +#define INTERRUPT_ID_USB_CNTL_RX_CHAN (DMA_ISR_TABLE_OFFSET + USB_CNTL_RX_CHAN)
1553 +#define INTERRUPT_ID_USB_CNTL_TX_CHAN (DMA_ISR_TABLE_OFFSET + USB_CNTL_TX_CHAN)
1554 +#define INTERRUPT_ID_USB_ISO_RX_CHAN (DMA_ISR_TABLE_OFFSET + USB_ISO_RX_CHAN)
1555 +#define INTERRUPT_ID_USB_ISO_TX_CHAN (DMA_ISR_TABLE_OFFSET + USB_ISO_TX_CHAN)
1558 +#endif /* __BCM6345_H */
1560 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h
1561 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h 1970-01-01 01:00:00.000000000 +0100
1562 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h 2006-07-25 10:45:19.000000000 +0200
1566 + Copyright 2002 Broadcom Corp. All Rights Reserved.
1568 + This program is free software; you can distribute it and/or modify it
1569 + under the terms of the GNU General Public License (Version 2) as
1570 + published by the Free Software Foundation.
1572 + This program is distributed in the hope it will be useful, but WITHOUT
1573 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1574 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1577 + You should have received a copy of the GNU General Public License along
1578 + with this program; if not, write to the Free Software Foundation, Inc.,
1579 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1583 +#ifndef __BCM6345_MAP_H
1584 +#define __BCM6345_MAP_H
1587 +#include "bcmtypes.h"
1588 +#include "6345_intr.h"
1590 +typedef struct IntControl {
1592 + uint16 testControl;
1593 + uint16 blkEnables;
1594 +#define USB_CLK_EN 0x0100
1595 +#define EMAC_CLK_EN 0x0080
1596 +#define UART_CLK_EN 0x0008
1597 +#define CPU_CLK_EN 0x0001
1599 + uint32 pll_control;
1600 +#define SOFT_RESET 0x00000001
1606 +#define EI_SENSE_SHFT 0
1607 +#define EI_STATUS_SHFT 4
1608 +#define EI_CLEAR_SHFT 8
1609 +#define EI_MASK_SHFT 12
1610 +#define EI_INSENS_SHFT 16
1611 +#define EI_LEVEL_SHFT 20
1614 +#define INTC_BASE 0xfffe0000
1615 +#define PERF ((volatile IntControl * const) INTC_BASE)
1617 +#define TIMR_BASE 0xfffe0200
1618 +typedef struct Timer {
1621 +#define TIMER0EN 0x01
1622 +#define TIMER1EN 0x02
1623 +#define TIMER2EN 0x04
1625 +#define TIMER0 0x01
1626 +#define TIMER1 0x02
1627 +#define TIMER2 0x04
1628 +#define WATCHDOG 0x08
1632 +#define TIMERENABLE 0x80000000
1633 +#define RSTCNTCLR 0x40000000
1637 + uint32 WatchDogDefCount;
1639 + /* Write 0xff00 0x00ff to Start timer
1640 + * Write 0xee00 0x00ee to Stop and re-load default count
1641 + * Read from this register returns current watch dog count
1643 + uint32 WatchDogCtl;
1645 + /* Number of 40-MHz ticks for WD Reset pulse to last */
1646 + uint32 WDResetCount;
1649 +#define TIMER ((volatile Timer * const) TIMR_BASE)
1651 +typedef struct UartChannel {
1654 +#define BRGEN 0x80 /* Control register bit defs */
1657 +#define TXPARITYEN 0x08
1658 +#define TXPARITYEVEN 0x04
1659 +#define RXPARITYEN 0x02
1660 +#define RXPARITYEVEN 0x01
1662 +#define BITS5SYM 0x00
1663 +#define BITS6SYM 0x10
1664 +#define BITS7SYM 0x20
1665 +#define BITS8SYM 0x30
1666 +#define XMITBREAK 0x40
1667 +#define ONESTOP 0x07
1668 +#define TWOSTOP 0x0f
1671 +#define RSTTXFIFOS 0x80
1672 +#define RSTRXFIFOS 0x40
1681 + byte DeltaIPEdgeNoSense;
1682 + byte DeltaIPConfig_Mask;
1683 + byte DeltaIP_SyncIP;
1686 +#define TXUNDERR 0x0002
1687 +#define TXOVFERR 0x0004
1688 +#define TXFIFOEMT 0x0020
1689 +#define RXOVFERR 0x0080
1690 +#define RXFIFONE 0x0800
1691 +#define RXFRAMERR 0x1000
1692 +#define RXPARERR 0x2000
1693 +#define RXBRK 0x4000
1701 +#define UART_BASE 0xfffe0300
1702 +#define UART ((volatile Uart * const) UART_BASE)
1704 +typedef struct GpioControl {
1718 +#define GPIO_BASE 0xfffe0400
1719 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
1721 +#define GPIO_NUM_MAX_BITS_MASK 0x0f
1722 +#define GPIO_NUM_TO_MASK(X) (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
1727 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6348_intr.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_intr.h
1728 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6348_intr.h 1970-01-01 01:00:00.000000000 +0100
1729 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_intr.h 2006-07-25 10:45:33.000000000 +0200
1733 + Copyright 2003 Broadcom Corp. All Rights Reserved.
1735 + This program is free software; you can distribute it and/or modify it
1736 + under the terms of the GNU General Public License (Version 2) as
1737 + published by the Free Software Foundation.
1739 + This program is distributed in the hope it will be useful, but WITHOUT
1740 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1741 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1744 + You should have received a copy of the GNU General Public License along
1745 + with this program; if not, write to the Free Software Foundation, Inc.,
1746 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1750 +#ifndef __6348_INTR_H
1751 +#define __6348_INTR_H
1754 +/*=====================================================================*/
1755 +/* BCM6348 External Interrupt Level Assignments */
1756 +/*=====================================================================*/
1757 +#define INTERRUPT_ID_EXTERNAL_0 3
1758 +#define INTERRUPT_ID_EXTERNAL_1 4
1759 +#define INTERRUPT_ID_EXTERNAL_2 5
1760 +#define INTERRUPT_ID_EXTERNAL_3 6
1762 +/*=====================================================================*/
1763 +/* BCM6348 Timer Interrupt Level Assignments */
1764 +/*=====================================================================*/
1765 +#define MIPS_TIMER_INT 7
1767 +/*=====================================================================*/
1768 +/* Peripheral ISR Table Offset */
1769 +/*=====================================================================*/
1770 +#define INTERNAL_ISR_TABLE_OFFSET 8
1772 +/*=====================================================================*/
1773 +/* Logical Peripheral Interrupt IDs */
1774 +/*=====================================================================*/
1776 +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 0)
1777 +#define INTERRUPT_ID_SPI (INTERNAL_ISR_TABLE_OFFSET + 1)
1778 +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 2)
1779 +#define INTERRUPT_ID_ADSL (INTERNAL_ISR_TABLE_OFFSET + 4)
1780 +#define INTERRUPT_ID_ATM (INTERNAL_ISR_TABLE_OFFSET + 5)
1781 +#define INTERRUPT_ID_USBS (INTERNAL_ISR_TABLE_OFFSET + 6)
1782 +#define INTERRUPT_ID_EMAC2 (INTERNAL_ISR_TABLE_OFFSET + 7)
1783 +#define INTERRUPT_ID_EMAC1 (INTERNAL_ISR_TABLE_OFFSET + 8)
1784 +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 9)
1785 +#define INTERRUPT_ID_M2M (INTERNAL_ISR_TABLE_OFFSET + 10)
1786 +#define INTERRUPT_ID_ACLC (INTERNAL_ISR_TABLE_OFFSET + 11)
1787 +#define INTERRUPT_ID_USBH (INTERNAL_ISR_TABLE_OFFSET + 12)
1788 +#define INTERRUPT_ID_SDRAM (INTERNAL_ISR_TABLE_OFFSET + 13)
1789 +#define INTERRUPT_ID_USB_CNTL_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 14)
1790 +#define INTERRUPT_ID_USB_CNTL_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 15)
1791 +#define INTERRUPT_ID_USB_BULK_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 16)
1792 +#define INTERRUPT_ID_USB_BULK_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 17)
1793 +#define INTERRUPT_ID_USB_ISO_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 18)
1794 +#define INTERRUPT_ID_USB_ISO_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 19)
1795 +#define INTERRUPT_ID_EMAC1_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 20)
1796 +#define INTERRUPT_ID_EMAC1_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 21)
1797 +#define INTERRUPT_ID_EMAC2_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 22)
1798 +#define INTERRUPT_ID_EMAC2_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 23)
1799 +#define INTERRUPT_ID_MPI (INTERNAL_ISR_TABLE_OFFSET + 24)
1800 +#define INTERRUPT_ID_DG (INTERNAL_ISR_TABLE_OFFSET + 25)
1803 +#endif /* __BCM6348_H */
1805 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h
1806 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h 1970-01-01 01:00:00.000000000 +0100
1807 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h 2006-07-25 10:44:21.000000000 +0200
1811 + Copyright 2002 Broadcom Corp. All Rights Reserved.
1813 + This program is free software; you can distribute it and/or modify it
1814 + under the terms of the GNU General Public License (Version 2) as
1815 + published by the Free Software Foundation.
1817 + This program is distributed in the hope it will be useful, but WITHOUT
1818 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1819 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1822 + You should have received a copy of the GNU General Public License along
1823 + with this program; if not, write to the Free Software Foundation, Inc.,
1824 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1828 +#ifndef __BCM6348_MAP_H
1829 +#define __BCM6348_MAP_H
1831 +#include "bcmtypes.h"
1833 +#define PERF_BASE 0xfffe0000
1834 +#define TIMR_BASE 0xfffe0200
1835 +#define UART_BASE 0xfffe0300
1836 +#define GPIO_BASE 0xfffe0400
1837 +#define MPI_BASE 0xfffe2000 /* MPI control registers */
1838 +#define USB_HOST_BASE 0xfffe1b00 /* USB host registers */
1839 +#define USB_HOST_NON_OHCI 0xfffe1c00 /* USB host non-OHCI registers */
1841 +typedef struct PerfControl {
1843 + uint16 testControl;
1844 + uint16 blkEnables;
1845 +#define EMAC_CLK_EN 0x0010
1846 +#define SAR_CLK_EN 0x0020
1847 +#define USBS_CLK_EN 0x0040
1848 +#define USBH_CLK_EN 0x0100
1850 + uint32 pll_control;
1851 +#define SOFT_RESET 0x00000001
1857 +#define EI_SENSE_SHFT 0
1858 +#define EI_STATUS_SHFT 5
1859 +#define EI_CLEAR_SHFT 10
1860 +#define EI_MASK_SHFT 15
1861 +#define EI_INSENS_SHFT 20
1862 +#define EI_LEVEL_SHFT 25
1864 + uint32 unused[4]; /* (18) */
1865 + uint32 BlockSoftReset; /* (28) */
1866 +#define BSR_SPI 0x00000001
1867 +#define BSR_EMAC 0x00000004
1868 +#define BSR_USBH 0x00000008
1869 +#define BSR_USBS 0x00000010
1870 +#define BSR_ADSL 0x00000020
1871 +#define BSR_DMAMEM 0x00000040
1872 +#define BSR_SAR 0x00000080
1873 +#define BSR_ACLC 0x00000100
1874 +#define BSR_ADSL_MIPS_PLL 0x00000400
1875 +#define BSR_ALL_BLOCKS \
1876 + (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
1877 + BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL)
1878 + uint32 unused2[2]; /* (2c) */
1879 + uint32 PllStrap; /* (34) */
1880 +#define PLL_N1_SHFT 20
1881 +#define PLL_N1_MASK (7<<PLL_N1_SHFT)
1882 +#define PLL_N2_SHFT 15
1883 +#define PLL_N2_MASK (0x1f<<PLL_N2_SHFT)
1884 +#define PLL_M1_REF_SHFT 12
1885 +#define PLL_M1_REF_MASK (7<<PLL_M1_REF_SHFT)
1886 +#define PLL_M2_REF_SHFT 9
1887 +#define PLL_M2_REF_MASK (7<<PLL_M2_REF_SHFT)
1888 +#define PLL_M1_CPU_SHFT 6
1889 +#define PLL_M1_CPU_MASK (7<<PLL_M1_CPU_SHFT)
1890 +#define PLL_M1_BUS_SHFT 3
1891 +#define PLL_M1_BUS_MASK (7<<PLL_M1_BUS_SHFT)
1892 +#define PLL_M2_BUS_SHFT 0
1893 +#define PLL_M2_BUS_MASK (7<<PLL_M2_BUS_SHFT)
1896 +#define PERF ((volatile PerfControl * const) PERF_BASE)
1898 +typedef struct Timer {
1901 +#define TIMER0EN 0x01
1902 +#define TIMER1EN 0x02
1903 +#define TIMER2EN 0x04
1905 +#define TIMER0 0x01
1906 +#define TIMER1 0x02
1907 +#define TIMER2 0x04
1908 +#define WATCHDOG 0x08
1912 +#define TIMERENABLE 0x80000000
1913 +#define RSTCNTCLR 0x40000000
1917 + uint32 WatchDogDefCount;
1919 + /* Write 0xff00 0x00ff to Start timer
1920 + * Write 0xee00 0x00ee to Stop and re-load default count
1921 + * Read from this register returns current watch dog count
1923 + uint32 WatchDogCtl;
1925 + /* Number of 40-MHz ticks for WD Reset pulse to last */
1926 + uint32 WDResetCount;
1929 +#define TIMER ((volatile Timer * const) TIMR_BASE)
1931 +typedef struct UartChannel {
1934 +#define BRGEN 0x80 /* Control register bit defs */
1937 +#define LOOPBK 0x10
1938 +#define TXPARITYEN 0x08
1939 +#define TXPARITYEVEN 0x04
1940 +#define RXPARITYEN 0x02
1941 +#define RXPARITYEVEN 0x01
1944 +#define XMITBREAK 0x40
1945 +#define BITS5SYM 0x00
1946 +#define BITS6SYM 0x10
1947 +#define BITS7SYM 0x20
1948 +#define BITS8SYM 0x30
1949 +#define ONESTOP 0x07
1950 +#define TWOSTOP 0x0f
1951 + /* 4-LSBS represent STOP bits/char
1952 + * in 1/8 bit-time intervals. Zero
1953 + * represents 1/8 stop bit interval.
1954 + * Fifteen represents 2 stop bits.
1957 +#define RSTTXFIFOS 0x80
1958 +#define RSTRXFIFOS 0x40
1959 + /* 5-bit TimeoutCnt is in low bits of this register.
1960 + * This count represents the number of characters
1961 + * idle times before setting receive Irq when below threshold
1964 + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
1967 + byte txf_levl; /* Read-only fifo depth */
1968 + byte rxf_levl; /* Read-only fifo depth */
1969 + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are
1970 + * RxThreshold. Irq can be asserted
1971 + * when rx fifo> thresh, txfifo<thresh
1973 + byte prog_out; /* Set value of DTR (Bit0), RTS (Bit1)
1974 + * if these bits are also enabled to GPIO_o
1980 + byte DeltaIPEdgeNoSense; /* Low 4-bits, set corr bit to 1 to
1981 + * detect irq on rising AND falling
1982 + * edges for corresponding GPIO_i
1983 + * if enabled (edge insensitive)
1985 + byte DeltaIPConfig_Mask; /* Upper 4 bits: 1 for posedge sense
1986 + * 0 for negedge sense if
1987 + * not configured for edge
1988 + * insensitive (see above)
1989 + * Lower 4 bits: Mask to enable change
1990 + * detection IRQ for corresponding
1993 + byte DeltaIP_SyncIP; /* Upper 4 bits show which bits
1994 + * have changed (may set IRQ).
1995 + * read automatically clears bit
1996 + * Lower 4 bits are actual status
1999 + uint16 intMask; /* Same Bit defs for Mask and status */
2001 +#define DELTAIP 0x0001
2002 +#define TXUNDERR 0x0002
2003 +#define TXOVFERR 0x0004
2004 +#define TXFIFOTHOLD 0x0008
2005 +#define TXREADLATCH 0x0010
2006 +#define TXFIFOEMT 0x0020
2007 +#define RXUNDERR 0x0040
2008 +#define RXOVFERR 0x0080
2009 +#define RXTIMEOUT 0x0100
2010 +#define RXFIFOFULL 0x0200
2011 +#define RXFIFOTHOLD 0x0400
2012 +#define RXFIFONE 0x0800
2013 +#define RXFRAMERR 0x1000
2014 +#define RXPARERR 0x2000
2015 +#define RXBRK 0x4000
2018 + uint16 Data; /* Write to TX, Read from RX */
2019 + /* bits 11:8 are BRK,PAR,FRM errors */
2025 +#define UART ((volatile Uart * const) UART_BASE)
2027 +typedef struct GpioControl {
2028 + uint32 GPIODir_high; /* bits 36:32 */
2029 + uint32 GPIODir; /* bits 31:00 */
2030 + uint32 GPIOio_high; /* bits 36:32 */
2031 + uint32 GPIOio; /* bits 31:00 */
2033 +#define LED3_STROBE 0x08000000
2034 +#define LED2_STROBE 0x04000000
2035 +#define LED1_STROBE 0x02000000
2036 +#define LED0_STROBE 0x01000000
2037 +#define LED_TEST 0x00010000
2038 +#define LED3_DISABLE_LINK_ACT 0x00008000
2039 +#define LED2_DISABLE_LINK_ACT 0x00004000
2040 +#define LED1_DISABLE_LINK_ACT 0x00002000
2041 +#define LED0_DISABLE_LINK_ACT 0x00001000
2042 +#define LED_INTERVAL_SET_MASK 0x00000f00
2043 +#define LED_INTERVAL_SET_320MS 0x00000500
2044 +#define LED_INTERVAL_SET_160MS 0x00000400
2045 +#define LED_INTERVAL_SET_80MS 0x00000300
2046 +#define LED_INTERVAL_SET_40MS 0x00000200
2047 +#define LED_INTERVAL_SET_20MS 0x00000100
2048 +#define LED3_ON 0x00000080
2049 +#define LED2_ON 0x00000040
2050 +#define LED1_ON 0x00000020
2051 +#define LED0_ON 0x00000010
2052 +#define LED3_ENABLE 0x00000008
2053 +#define LED2_ENABLE 0x00000004
2054 +#define LED1_ENABLE 0x00000002
2055 +#define LED0_ENABLE 0x00000001
2056 + uint32 SpiSlaveCfg;
2057 +#define SPI_SLAVE_RESET 0x00010000
2058 +#define SPI_RESTRICT 0x00000400
2059 +#define SPI_DELAY_DISABLE 0x00000200
2060 +#define SPI_PROBE_MUX_SEL_MASK 0x000001e0
2061 +#define SPI_SER_ADDR_CFG_MASK 0x0000000c
2062 +#define SPI_MODE 0x00000001
2064 +#define GROUP4_DIAG 0x00090000
2065 +#define GROUP4_UTOPIA 0x00080000
2066 +#define GROUP4_LEGACY_LED 0x00030000
2067 +#define GROUP4_MII_SNOOP 0x00020000
2068 +#define GROUP4_EXT_EPHY 0x00010000
2069 +#define GROUP3_DIAG 0x00009000
2070 +#define GROUP3_UTOPIA 0x00008000
2071 +#define GROUP3_EXT_MII 0x00007000
2072 +#define GROUP2_DIAG 0x00000900
2073 +#define GROUP2_PCI 0x00000500
2074 +#define GROUP1_DIAG 0x00000090
2075 +#define GROUP1_UTOPIA 0x00000080
2076 +#define GROUP1_SPI_UART 0x00000060
2077 +#define GROUP1_SPI_MASTER 0x00000060
2078 +#define GROUP1_MII_PCCARD 0x00000040
2079 +#define GROUP1_MII_SNOOP 0x00000020
2080 +#define GROUP1_EXT_EPHY 0x00000010
2081 +#define GROUP0_DIAG 0x00000009
2082 +#define GROUP0_EXT_MII 0x00000007
2086 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
2088 +/* Number to mask conversion macro used for GPIODir and GPIOio */
2089 +#define GPIO_NUM_TOTAL_BITS_MASK 0x3f
2090 +#define GPIO_NUM_MAX_BITS_MASK 0x1f
2091 +#define GPIO_NUM_TO_MASK(X) ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) < 32) ? (1 << ((X) & GPIO_NUM_MAX_BITS_MASK)) : (0) )
2093 +/* Number to mask conversion macro used for GPIODir_high and GPIOio_high */
2094 +#define GPIO_NUM_MAX_BITS_MASK_HIGH 0x07
2095 +#define GPIO_NUM_TO_MASK_HIGH(X) ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) >= 32) ? (1 << ((X-32) & GPIO_NUM_MAX_BITS_MASK_HIGH)) : (0) )
2099 +** External Bus Interface
2101 +typedef struct EbiChipSelect {
2102 + uint32 base; /* base address in upper 24 bits */
2103 +#define EBI_SIZE_8K 0
2104 +#define EBI_SIZE_16K 1
2105 +#define EBI_SIZE_32K 2
2106 +#define EBI_SIZE_64K 3
2107 +#define EBI_SIZE_128K 4
2108 +#define EBI_SIZE_256K 5
2109 +#define EBI_SIZE_512K 6
2110 +#define EBI_SIZE_1M 7
2111 +#define EBI_SIZE_2M 8
2112 +#define EBI_SIZE_4M 9
2113 +#define EBI_SIZE_8M 10
2114 +#define EBI_SIZE_16M 11
2115 +#define EBI_SIZE_32M 12
2116 +#define EBI_SIZE_64M 13
2117 +#define EBI_SIZE_128M 14
2118 +#define EBI_SIZE_256M 15
2120 +#define EBI_ENABLE 0x00000001 /* .. enable this range */
2121 +#define EBI_WAIT_STATES 0x0000000e /* .. mask for wait states */
2122 +#define EBI_WTST_SHIFT 1 /* .. for shifting wait states */
2123 +#define EBI_WORD_WIDE 0x00000010 /* .. 16-bit peripheral, else 8 */
2124 +#define EBI_WREN 0x00000020 /* enable posted writes */
2125 +#define EBI_POLARITY 0x00000040 /* .. set to invert something,
2126 + ** don't know what yet */
2127 +#define EBI_TS_TA_MODE 0x00000080 /* .. use TS/TA mode */
2128 +#define EBI_TS_SEL 0x00000100 /* .. drive tsize, not bs_b */
2129 +#define EBI_FIFO 0x00000200 /* .. use fifo */
2130 +#define EBI_RE 0x00000400 /* .. Reverse Endian */
2133 +typedef struct MpiRegisters {
2134 + EbiChipSelect cs[7]; /* size chip select configuration */
2135 +#define EBI_CS0_BASE 0
2136 +#define EBI_CS1_BASE 1
2137 +#define EBI_CS2_BASE 2
2138 +#define EBI_CS3_BASE 3
2139 +#define PCMCIA_COMMON_BASE 4
2140 +#define PCMCIA_ATTRIBUTE_BASE 5
2141 +#define PCMCIA_IO_BASE 6
2142 + uint32 unused0[2]; /* reserved */
2143 + uint32 ebi_control; /* ebi control */
2144 + uint32 unused1[4]; /* reserved */
2145 +#define EBI_ACCESS_TIMEOUT 0x000007FF
2146 + uint32 pcmcia_cntl1; /* pcmcia control 1 */
2147 +#define PCCARD_CARD_RESET 0x00040000
2148 +#define CARDBUS_ENABLE 0x00008000
2149 +#define PCMCIA_ENABLE 0x00004000
2150 +#define PCMCIA_GPIO_ENABLE 0x00002000
2151 +#define CARDBUS_IDSEL 0x00001F00
2152 +#define VS2_OEN 0x00000080
2153 +#define VS1_OEN 0x00000040
2154 +#define VS2_OUT 0x00000020
2155 +#define VS1_OUT 0x00000010
2156 +#define VS2_IN 0x00000008
2157 +#define VS1_IN 0x00000004
2158 +#define CD2_IN 0x00000002
2159 +#define CD1_IN 0x00000001
2160 +#define VS_MASK 0x0000000C
2161 +#define CD_MASK 0x00000003
2162 + uint32 unused2; /* reserved */
2163 + uint32 pcmcia_cntl2; /* pcmcia control 2 */
2164 +#define PCMCIA_BYTESWAP_DIS 0x00000002
2165 +#define PCMCIA_HALFWORD_EN 0x00000001
2166 +#define RW_ACTIVE_CNT_BIT 2
2167 +#define INACTIVE_CNT_BIT 8
2168 +#define CE_SETUP_CNT_BIT 16
2169 +#define CE_HOLD_CNT_BIT 24
2170 + uint32 unused3[40]; /* reserved */
2172 + uint32 sp0range; /* PCI to internal system bus address space */
2181 + uint32 l2pcfgctl; /* internal system bus to PCI IO/Cfg control */
2182 +#define DIR_CFG_SEL 0x80000000 /* change from PCI I/O access to PCI config access */
2183 +#define DIR_CFG_USEREG 0x40000000 /* use this register info for PCI configuration access */
2184 +#define DEVICE_NUMBER 0x00007C00 /* device number for the PCI configuration access */
2185 +#define FUNC_NUMBER 0x00000300 /* function number for the PCI configuration access */
2186 +#define REG_NUMBER 0x000000FC /* register number for the PCI configuration access */
2187 +#define CONFIG_TYPE 0x00000003 /* configuration type for the PCI configuration access */
2189 + uint32 l2pmrange1; /* internal system bus to PCI memory space */
2190 +#define PCI_SIZE_64K 0xFFFF0000
2191 +#define PCI_SIZE_128K 0xFFFE0000
2192 +#define PCI_SIZE_256K 0xFFFC0000
2193 +#define PCI_SIZE_512K 0xFFF80000
2194 +#define PCI_SIZE_1M 0xFFF00000
2195 +#define PCI_SIZE_2M 0xFFE00000
2196 +#define PCI_SIZE_4M 0xFFC00000
2197 +#define PCI_SIZE_8M 0xFF800000
2198 +#define PCI_SIZE_16M 0xFF000000
2199 +#define PCI_SIZE_32M 0xFE000000
2200 + uint32 l2pmbase1; /* kseg0 or kseg1 address & 0x1FFFFFFF */
2201 + uint32 l2pmremap1;
2202 +#define CARDBUS_MEM 0x00000004
2203 +#define MEM_WINDOW_EN 0x00000001
2204 + uint32 l2pmrange2;
2206 + uint32 l2pmremap2;
2207 + uint32 l2piorange; /* internal system bus to PCI I/O space */
2209 + uint32 l2pioremap;
2211 + uint32 pcimodesel;
2212 +#define PCI2_INT_BUS_RD_PREFECH 0x000000F0
2213 +#define PCI_BAR2_NOSWAP 0x00000002 /* BAR at offset 0x20 */
2214 +#define PCI_BAR1_NOSWAP 0x00000001 /* BAR at affset 0x1c */
2216 + uint32 pciintstat; /* PCI interrupt mask/status */
2217 +#define MAILBOX1_SENT 0x08
2218 +#define MAILBOX0_SENT 0x04
2219 +#define MAILBOX1_MSG_RCV 0x02
2220 +#define MAILBOX0_MSG_RCV 0x01
2221 + uint32 locbuscntrl; /* internal system bus control */
2222 +#define DIR_U2P_NOSWAP 0x00000002
2223 +#define EN_PCI_GPIO 0x00000001
2224 + uint32 locintstat; /* internal system bus interrupt mask/status */
2225 +#define CSERR 0x0200
2226 +#define SERR 0x0100
2227 +#define EXT_PCI_INT 0x0080
2228 +#define DIR_FAILED 0x0040
2229 +#define DIR_COMPLETE 0x0020
2230 +#define PCI_CFG 0x0010
2231 + uint32 unused5[7];
2236 + uint32 pcicfgcntrl; /* internal system bus PCI configuration control */
2237 +#define PCI_CFG_REG_WRITE_EN 0x00000080
2238 +#define PCI_CFG_ADDR 0x0000003C
2239 + uint32 pcicfgdata; /* internal system bus PCI configuration data */
2241 + uint32 locch2ctl; /* PCI to interrnal system bus DMA (downstream) local control */
2242 +#define MPI_DMA_HALT 0x00000008 /* idle after finish current memory burst */
2243 +#define MPI_DMA_PKT_HALT 0x00000004 /* idle after an EOP flag is detected */
2244 +#define MPI_DMA_STALL 0x00000002 /* idle after an EOP flag is detected */
2245 +#define MPI_DMA_ENABLE 0x00000001 /* set to enable channel */
2246 + uint32 locch2intStat;
2247 +#define MPI_DMA_NO_DESC 0x00000004 /* no valid descriptors */
2248 +#define MPI_DMA_DONE 0x00000002 /* packet xfer complete */
2249 +#define MPI_DMA_BUFF_DONE 0x00000001 /* buffer done */
2250 + uint32 locch2intMask;
2252 + uint32 locch2descaddr;
2253 + uint32 locch2status1;
2254 +#define LOCAL_DESC_STATE 0xE0000000
2255 +#define PCI_DESC_STATE 0x1C000000
2256 +#define BYTE_DONE 0x03FFC000
2257 +#define RING_ADDR 0x00003FFF
2258 + uint32 locch2status2;
2259 +#define BUFPTR_OFFSET 0x1FFF0000
2260 +#define PCI_MASTER_STATE 0x000000C0
2261 +#define LOC_MASTER_STATE 0x00000038
2262 +#define CONTROL_STATE 0x00000007
2265 + uint32 locch1Ctl; /*internal system bus to PCI DMA (upstream) local control */
2266 +#define DMA_U2P_LE 0x00000200 /* local bus is little endian */
2267 +#define DMA_U2P_NOSWAP 0x00000100 /* lccal bus is little endian but no data swapped */
2268 + uint32 locch1intstat;
2269 + uint32 locch1intmask;
2271 + uint32 locch1descaddr;
2272 + uint32 locch1status1;
2273 + uint32 locch1status2;
2276 + uint32 pcich1ctl; /* internal system bus to PCI DMA PCI control */
2277 + uint32 pcich1intstat;
2278 + uint32 pcich1intmask;
2279 + uint32 pcich1descaddr;
2280 + uint32 pcich1status1;
2281 + uint32 pcich1status2;
2283 + uint32 pcich2Ctl; /* PCI to internal system bus DMA PCI control */
2284 + uint32 pcich2intstat;
2285 + uint32 pcich2intmask;
2286 + uint32 pcich2descaddr;
2287 + uint32 pcich2status1;
2288 + uint32 pcich2status2;
2290 + uint32 perm_id; /* permanent device and vendor id */
2291 + uint32 perm_rev; /* permanent revision id */
2294 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
2296 +/* PCI configuration address space start offset 0x40 */
2297 +#define BRCM_PCI_CONFIG_TIMER 0x40
2298 +#define BRCM_PCI_CONFIG_TIMER_RETRY_MASK 0x0000FF00
2299 +#define BRCM_PCI_CONFIG_TIMER_TRDY_MASK 0x000000FF
2301 +/* USB host non-Open HCI register, USB_HOST_NON_OHCI, bit definitions. */
2302 +#define NON_OHCI_ENABLE_PORT1 0x00000001 /* Use USB port 1 for host, not dev */
2303 +#define NON_OHCI_BYTE_SWAP 0x00000008 /* Swap USB host registers */
2305 +#define USBH_NON_OHCI ((volatile unsigned long * const) USB_HOST_NON_OHCI)
2309 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h
2310 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h 1970-01-01 01:00:00.000000000 +0100
2311 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h 2006-07-25 10:43:50.000000000 +0200
2315 + Copyright 2003 Broadcom Corp. All Rights Reserved.
2317 + This program is free software; you can distribute it and/or modify it
2318 + under the terms of the GNU General Public License (Version 2) as
2319 + published by the Free Software Foundation.
2321 + This program is distributed in the hope it will be useful, but WITHOUT
2322 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2323 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2326 + You should have received a copy of the GNU General Public License along
2327 + with this program; if not, write to the Free Software Foundation, Inc.,
2328 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2332 +#ifndef __BCM_INTR_H
2333 +#define __BCM_INTR_H
2339 +#if defined(CONFIG_BCM96338)
2340 +#include <6338_intr.h>
2342 +#if defined(CONFIG_BCM96345)
2343 +#include <6345_intr.h>
2345 +#if defined(CONFIG_BCM96348)
2346 +#include <6348_intr.h>
2351 +typedef int (*FN_HANDLER) (int, void *, struct pt_regs *);
2354 +extern void enable_brcm_irq(unsigned int irq);
2355 +extern void disable_brcm_irq(unsigned int irq);
2356 +extern int request_external_irq(unsigned int irq,
2357 + FN_HANDLER handler, unsigned long irqflags,
2358 + const char * devname, void *dev_id);
2359 +extern unsigned int BcmHalMapInterrupt(FN_HANDLER isr, unsigned int param,
2360 + unsigned int interruptId);
2361 +extern void dump_intr_regs(void);
2363 +/* compatibility definitions */
2364 +#define BcmHalInterruptEnable(irq) enable_brcm_irq( irq )
2365 +#define BcmHalInterruptDisable(irq) disable_brcm_irq( irq )
2372 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h
2373 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h 1970-01-01 01:00:00.000000000 +0100
2374 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h 2006-07-25 10:43:50.000000000 +0200
2378 + Copyright 2004 Broadcom Corp. All Rights Reserved.
2380 + This program is free software; you can distribute it and/or modify it
2381 + under the terms of the GNU General Public License (Version 2) as
2382 + published by the Free Software Foundation.
2384 + This program is distributed in the hope it will be useful, but WITHOUT
2385 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2386 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2389 + You should have received a copy of the GNU General Public License along
2390 + with this program; if not, write to the Free Software Foundation, Inc.,
2391 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2395 +#ifndef __BCM_MAP_PART_H
2396 +#define __BCM_MAP_PART_H
2398 +#if defined(CONFIG_BCM96338)
2399 +#include <6338_map_part.h>
2401 +#if defined(CONFIG_BCM96345)
2402 +#include <6345_map_part.h>
2404 +#if defined(CONFIG_BCM96348)
2405 +#include <6348_map_part.h>
2410 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcmpci.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmpci.h
2411 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcmpci.h 1970-01-01 01:00:00.000000000 +0100
2412 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmpci.h 2006-07-25 10:43:50.000000000 +0200
2416 + Copyright 2004 Broadcom Corp. All Rights Reserved.
2418 + This program is free software; you can distribute it and/or modify it
2419 + under the terms of the GNU General Public License (Version 2) as
2420 + published by the Free Software Foundation.
2422 + This program is distributed in the hope it will be useful, but WITHOUT
2423 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2424 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2427 + You should have received a copy of the GNU General Public License along
2428 + with this program; if not, write to the Free Software Foundation, Inc.,
2429 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2434 +// bcmpci.h - bcm96348 PCI, Cardbus, and PCMCIA definition
2439 +/* Memory window in internal system bus address space */
2440 +#define BCM_PCI_MEM_BASE 0x08000000
2441 +/* IO window in internal system bus address space */
2442 +#define BCM_PCI_IO_BASE 0x0C000000
2444 +#define BCM_PCI_ADDR_MASK 0x1fffffff
2446 +/* Memory window size (range) */
2447 +#define BCM_PCI_MEM_SIZE_16MB 0x01000000
2448 +/* IO window size (range) */
2449 +#define BCM_PCI_IO_SIZE_64KB 0x00010000
2451 +/* PCI Configuration and I/O space acesss */
2452 +#define BCM_PCI_CFG(d, f, o) ( (d << 11) | (f << 8) | (o/4 << 2) )
2454 +/* fake USB PCI slot */
2455 +#define USB_HOST_SLOT 9
2456 +#define USB_BAR0_MEM_SIZE 0x0800
2458 +#define BCM_HOST_MEM_SPACE1 0x10000000
2459 +#define BCM_HOST_MEM_SPACE2 0x00000000
2462 + * EBI bus clock is 33MHz and share with PCI bus
2463 + * each clock cycle is 30ns.
2465 +/* attribute memory access wait cnt for 4306 */
2466 +#define PCMCIA_ATTR_CE_HOLD 3 // data hold time 70ns
2467 +#define PCMCIA_ATTR_CE_SETUP 3 // data setup time 50ns
2468 +#define PCMCIA_ATTR_INACTIVE 6 // time between read/write cycles 180ns. For the total cycle time 600ns (cnt1+cnt2+cnt3+cnt4)
2469 +#define PCMCIA_ATTR_ACTIVE 10 // OE/WE pulse width 300ns
2471 +/* common memory access wait cnt for 4306 */
2472 +#define PCMCIA_MEM_CE_HOLD 1 // data hold time 30ns
2473 +#define PCMCIA_MEM_CE_SETUP 1 // data setup time 30ns
2474 +#define PCMCIA_MEM_INACTIVE 2 // time between read/write cycles 40ns. For the total cycle time 250ns (cnt1+cnt2+cnt3+cnt4)
2475 +#define PCMCIA_MEM_ACTIVE 5 // OE/WE pulse width 150ns
2477 +#define PCCARD_VCC_MASK 0x00070000 // Mask Reset also
2478 +#define PCCARD_VCC_33V 0x00010000
2479 +#define PCCARD_VCC_50V 0x00020000
2482 + MPI_CARDTYPE_NONE, // No Card in slot
2483 + MPI_CARDTYPE_PCMCIA, // 16-bit PCMCIA card in slot
2484 + MPI_CARDTYPE_CARDBUS, // 32-bit CardBus card in slot
2487 +#define CARDBUS_SLOT 0 // Slot 0 is default for CardBus
2489 +#define pcmciaAttrOffset 0x00200000
2490 +#define pcmciaMemOffset 0x00000000
2491 +// Needs to be right above PCI I/O space. Give 0x8000 (32K) to PCMCIA.
2492 +#define pcmciaIoOffset (BCM_PCI_IO_BASE + 0x80000)
2493 +// Base Address is that mapped into the MPI ChipSelect registers.
2494 +// UBUS bridge MemoryWindow 0 outputs a 0x00 for the base.
2495 +#define pcmciaBase 0xbf000000
2496 +#define pcmciaAttr (pcmciaAttrOffset | pcmciaBase)
2497 +#define pcmciaMem (pcmciaMemOffset | pcmciaBase)
2498 +#define pcmciaIo (pcmciaIoOffset | pcmciaBase)
2501 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcmTag.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmTag.h
2502 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcmTag.h 1970-01-01 01:00:00.000000000 +0100
2503 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmTag.h 2006-07-25 10:43:50.000000000 +0200
2507 + Copyright 2002 Broadcom Corp. All Rights Reserved.
2509 + This program is free software; you can distribute it and/or modify it
2510 + under the terms of the GNU General Public License (Version 2) as
2511 + published by the Free Software Foundation.
2513 + This program is distributed in the hope it will be useful, but WITHOUT
2514 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2515 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2518 + You should have received a copy of the GNU General Public License along
2519 + with this program; if not, write to the Free Software Foundation, Inc.,
2520 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2523 +//**************************************************************************************
2524 +// File Name : bcmTag.h
2526 +// Description: add tag with validation system to the firmware image file to be uploaded
2529 +// Created : 02/28/2002 seanl
2530 +//**************************************************************************************
2536 +#define BCM_SIG_1 "Broadcom Corporation"
2537 +#define BCM_SIG_2 "ver. 2.0" // was "firmware version 2.0" now it is split 6 char out for chip id.
2539 +#define BCM_TAG_VER "6"
2540 +#define BCM_TAG_VER_LAST "26"
2542 +// file tag (head) structure all is in clear text except validationTokens (crc, md5, sha1, etc). Total: 128 unsigned chars
2543 +#define TAG_LEN 256
2544 +#define TAG_VER_LEN 4
2546 +#define SIG_LEN_2 14 // Original second SIG = 20 is now devided into 14 for SIG_LEN_2 and 6 for CHIP_ID
2547 +#define CHIP_ID_LEN 6
2548 +#define IMAGE_LEN 10
2549 +#define ADDRESS_LEN 12
2551 +#define TOKEN_LEN 20
2552 +#define BOARD_ID_LEN 16
2553 +#define RESERVED_LEN (TAG_LEN - TAG_VER_LEN - SIG_LEN - SIG_LEN_2 - CHIP_ID_LEN - BOARD_ID_LEN - \
2554 + (4*IMAGE_LEN) - (3*ADDRESS_LEN) - (3*FLAG_LEN) - (2*TOKEN_LEN))
2557 +// TAG for downloadable image (kernel plus file system)
2558 +typedef struct _FILE_TAG
2560 + unsigned char tagVersion[TAG_VER_LEN]; // tag version. Will be 2 here.
2561 + unsigned char signiture_1[SIG_LEN]; // text line for company info
2562 + unsigned char signiture_2[SIG_LEN_2]; // additional info (can be version number)
2563 + unsigned char chipId[CHIP_ID_LEN]; // chip id
2564 + unsigned char boardId[BOARD_ID_LEN]; // board id
2565 + unsigned char bigEndian[FLAG_LEN]; // if = 1 - big, = 0 - little endia of the host
2566 + unsigned char totalImageLen[IMAGE_LEN]; // the sum of all the following length
2567 + unsigned char cfeAddress[ADDRESS_LEN]; // if non zero, cfe starting address
2568 + unsigned char cfeLen[IMAGE_LEN]; // if non zero, cfe size in clear ASCII text.
2569 + unsigned char rootfsAddress[ADDRESS_LEN]; // if non zero, filesystem starting address
2570 + unsigned char rootfsLen[IMAGE_LEN]; // if non zero, filesystem size in clear ASCII text.
2571 + unsigned char kernelAddress[ADDRESS_LEN]; // if non zero, kernel starting address
2572 + unsigned char kernelLen[IMAGE_LEN]; // if non zero, kernel size in clear ASCII text.
2573 + unsigned char dualImage[FLAG_LEN]; // if 1, dual image
2574 + unsigned char inactiveLen[FLAG_LEN]; // if 1, the image is INACTIVE; if 0, active
2575 + unsigned char reserved[RESERVED_LEN]; // reserved for later use
2576 + unsigned char imageValidationToken[TOKEN_LEN];// image validation token - can be crc, md5, sha; for
2577 + // now will be 4 unsigned char crc
2578 + unsigned char tagValidationToken[TOKEN_LEN]; // validation token for tag(from signiture_1 to end of // mageValidationToken)
2579 +} FILE_TAG, *PFILE_TAG;
2581 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
2584 +// only included if for bcmTag.exe program
2585 +#ifdef BCMTAG_EXE_USE
2587 +static unsigned long Crc32_table[256] = {
2588 + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
2589 + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
2590 + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
2591 + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
2592 + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
2593 + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
2594 + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
2595 + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
2596 + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
2597 + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
2598 + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
2599 + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
2600 + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
2601 + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
2602 + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
2603 + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
2604 + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
2605 + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
2606 + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
2607 + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
2608 + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
2609 + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
2610 + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
2611 + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
2612 + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
2613 + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
2614 + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
2615 + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
2616 + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
2617 + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
2618 + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
2619 + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
2620 + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
2621 + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
2622 + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
2623 + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
2624 + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
2625 + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
2626 + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
2627 + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
2628 + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
2629 + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
2630 + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
2631 + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
2632 + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
2633 + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
2634 + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
2635 + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
2636 + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
2637 + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
2638 + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
2639 + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
2640 + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
2641 + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
2642 + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
2643 + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
2644 + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
2645 + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
2646 + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
2647 + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
2648 + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
2649 + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
2650 + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
2651 + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
2653 +#endif // BCMTAG_USE
2656 +#endif // _BCMTAG_H_
2658 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h
2659 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h 1970-01-01 01:00:00.000000000 +0100
2660 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h 2006-07-25 10:43:50.000000000 +0200
2664 + Copyright 2002 Broadcom Corp. All Rights Reserved.
2666 + This program is free software; you can distribute it and/or modify it
2667 + under the terms of the GNU General Public License (Version 2) as
2668 + published by the Free Software Foundation.
2670 + This program is distributed in the hope it will be useful, but WITHOUT
2671 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2672 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2675 + You should have received a copy of the GNU General Public License along
2676 + with this program; if not, write to the Free Software Foundation, Inc.,
2677 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2682 +// bcmtypes.h - misc useful typedefs
2687 +// These are also defined in typedefs.h in the application area, so I need to
2688 +// protect against re-definition.
2690 +#ifndef _TYPEDEFS_H_
2691 +typedef unsigned char uint8;
2692 +typedef unsigned short uint16;
2693 +typedef unsigned long uint32;
2694 +typedef signed char int8;
2695 +typedef signed short int16;
2696 +typedef signed long int32;
2697 +#if !defined(__cplusplus)
2702 +typedef unsigned char byte;
2703 +// typedef unsigned long sem_t;
2705 +typedef unsigned long HANDLE,*PULONG,DWORD,*PDWORD;
2706 +typedef signed long LONG,*PLONG;
2708 +typedef unsigned int *PUINT;
2709 +typedef signed int INT;
2711 +typedef unsigned short *PUSHORT;
2712 +typedef signed short SHORT,*PSHORT;
2713 +typedef unsigned short WORD,*PWORD;
2715 +typedef unsigned char *PUCHAR;
2716 +typedef signed char *PCHAR;
2718 +typedef void *PVOID;
2720 +typedef unsigned char BOOLEAN, *PBOOL, *PBOOLEAN;
2722 +typedef unsigned char BYTE,*PBYTE;
2725 +//The following has been defined in Vxworks internally: vxTypesOld.h
2726 +//redefine under vxworks will cause error
2727 +typedef signed int *PINT;
2729 +typedef signed char INT8;
2730 +typedef signed short INT16;
2731 +typedef signed long INT32;
2733 +typedef unsigned char UINT8;
2734 +typedef unsigned short UINT16;
2735 +typedef unsigned long UINT32;
2737 +typedef unsigned char UCHAR;
2738 +typedef unsigned short USHORT;
2739 +typedef unsigned int UINT;
2740 +typedef unsigned long ULONG;
2743 +typedef unsigned char BOOL;
2745 +//#endif /* __GNUC__ */
2748 +// These are also defined in typedefs.h in the application area, so I need to
2749 +// protect against re-definition.
2752 +// Maximum and minimum values for a signed 16 bit integer.
2753 +#define MAX_INT16 32767
2754 +#define MIN_INT16 -32768
2756 +// Useful for true/false return values. This uses the
2757 +// Taligent notation (k for constant).
2766 +/* macros to protect against unaligned accesses */
2769 +/* first arg is an address, second is a value */
2770 +#define PUT16( a, d ) { \
2771 + *((byte *)a) = (byte)((d)>>8); \
2772 + *(((byte *)a)+1) = (byte)(d); \
2775 +#define PUT32( a, d ) { \
2776 + *((byte *)a) = (byte)((d)>>24); \
2777 + *(((byte *)a)+1) = (byte)((d)>>16); \
2778 + *(((byte *)a)+2) = (byte)((d)>>8); \
2779 + *(((byte *)a)+3) = (byte)(d); \
2782 +/* first arg is an address, returns a value */
2783 +#define GET16( a ) ( \
2784 + (*((byte *)a) << 8) | \
2785 + (*(((byte *)a)+1)) \
2788 +#define GET32( a ) ( \
2789 + (*((byte *)a) << 24) | \
2790 + (*(((byte *)a)+1) << 16) | \
2791 + (*(((byte *)a)+2) << 8) | \
2792 + (*(((byte *)a)+3)) \
2820 +#define READ32(addr) (*(volatile UINT32 *)((ULONG)&addr))
2821 +#define READ16(addr) (*(volatile UINT16 *)((ULONG)&addr))
2822 +#define READ8(addr) (*(volatile UINT8 *)((ULONG)&addr))
2825 diff -urN linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/board.h linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/board.h
2826 --- linux-2.6.17/bcmdrivers/opensource/include/bcm963xx/board.h 1970-01-01 01:00:00.000000000 +0100
2827 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/include/bcm963xx/board.h 2006-07-25 11:00:10.000000000 +0200
2831 + Copyright 2002 Broadcom Corp. All Rights Reserved.
2833 + This program is free software; you can distribute it and/or modify it
2834 + under the terms of the GNU General Public License (Version 2) as
2835 + published by the Free Software Foundation.
2837 + This program is distributed in the hope it will be useful, but WITHOUT
2838 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2839 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2842 + You should have received a copy of the GNU General Public License along
2843 + with this program; if not, write to the Free Software Foundation, Inc.,
2844 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
2847 +/***********************************************************************/
2849 +/* MODULE: board.h */
2850 +/* DATE: 97/02/18 */
2851 +/* PURPOSE: Board specific information. This module should include */
2852 +/* all base device addresses and board specific macros. */
2854 +/***********************************************************************/
2858 +/*****************************************************************************/
2859 +/* Misc board definitions */
2860 +/*****************************************************************************/
2862 +#define DYING_GASP_API
2864 +/*****************************************************************************/
2865 +/* Physical Memory Map */
2866 +/*****************************************************************************/
2868 +#define PHYS_DRAM_BASE 0x00000000 /* Dynamic RAM Base */
2869 +#define PHYS_FLASH_BASE 0x1FC00000 /* Flash Memory */
2871 +/*****************************************************************************/
2872 +/* Note that the addresses above are physical addresses and that programs */
2873 +/* have to use converted addresses defined below: */
2874 +/*****************************************************************************/
2875 +#define DRAM_BASE (0x80000000 | PHYS_DRAM_BASE) /* cached DRAM */
2876 +#define DRAM_BASE_NOCACHE (0xA0000000 | PHYS_DRAM_BASE) /* uncached DRAM */
2877 +#define FLASH_BASE (0xA0000000 | PHYS_FLASH_BASE) /* uncached Flash */
2879 +/*****************************************************************************/
2880 +/* Select the PLL value to get the desired CPU clock frequency. */
2883 +/*****************************************************************************/
2884 +#define FPERIPH 50000000
2887 +#define BLK64K (64*ONEK)
2888 +#define FLASH45_BLKS_BOOT_ROM 1
2889 +#define FLASH45_LENGTH_BOOT_ROM (FLASH45_BLKS_BOOT_ROM * BLK64K)
2890 +#define FLASH_RESERVED_AT_END (64*ONEK) /*reserved for PSI, scratch pad*/
2892 +/*****************************************************************************/
2893 +/* Note that the addresses above are physical addresses and that programs */
2894 +/* have to use converted addresses defined below: */
2895 +/*****************************************************************************/
2896 +#define DRAM_BASE (0x80000000 | PHYS_DRAM_BASE) /* cached DRAM */
2897 +#define DRAM_BASE_NOCACHE (0xA0000000 | PHYS_DRAM_BASE) /* uncached DRAM */
2898 +#define FLASH_BASE (0xA0000000 | PHYS_FLASH_BASE) /* uncached Flash */
2900 +/*****************************************************************************/
2901 +/* Select the PLL value to get the desired CPU clock frequency. */
2904 +/*****************************************************************************/
2905 +#define FPERIPH 50000000
2907 +#define SDRAM_TYPE_ADDRESS_OFFSET 16
2908 +#define NVRAM_DATA_OFFSET 0x0580
2909 +#define NVRAM_DATA_ID 0x0f1e2d3c
2910 +#define BOARD_SDRAM_TYPE *(unsigned long *) \
2911 + (FLASH_BASE + SDRAM_TYPE_ADDRESS_OFFSET)
2914 +#define BLK64K (64*ONEK)
2916 +// nvram and psi flash definitions for 45
2917 +#define FLASH45_LENGTH_NVRAM ONEK // 1k nvram
2918 +#define NVRAM_PSI_DEFAULT 24 // default psi in K byes
2920 +/*****************************************************************************/
2921 +/* NVRAM Offset and definition */
2922 +/*****************************************************************************/
2924 +#define NVRAM_VERSION_NUMBER 2
2925 +#define NVRAM_VERSION_NUMBER_ADDRESS 0
2927 +#define NVRAM_BOOTLINE_LEN 256
2928 +#define NVRAM_BOARD_ID_STRING_LEN 16
2929 +#define NVRAM_MAC_ADDRESS_LEN 6
2930 +#define NVRAM_MAC_COUNT_MAX 32
2932 +/*****************************************************************************/
2934 +/*****************************************************************************/
2936 +#define CFE_VERSION_OFFSET 0x0570
2937 +#define CFE_VERSION_MARK_SIZE 5
2938 +#define CFE_VERSION_SIZE 5
2942 + unsigned long ulVersion;
2943 + char szBootline[NVRAM_BOOTLINE_LEN];
2944 + char szBoardId[NVRAM_BOARD_ID_STRING_LEN];
2945 + unsigned long ulReserved1[2];
2946 + unsigned long ulNumMacAddrs;
2947 + unsigned char ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN];
2948 + char chReserved[2];
2949 + unsigned long ulCheckSum;
2950 +} NVRAM_DATA, *PNVRAM_DATA;
2953 +/*****************************************************************************/
2954 +/* board ioctl calls for flash, led and some other utilities */
2955 +/*****************************************************************************/
2958 +/* Defines. for board driver */
2959 +#define BOARD_IOCTL_MAGIC 'B'
2960 +#define BOARD_DRV_MAJOR 206
2962 +#define MAC_ADDRESS_ANY (unsigned long) -1
2964 +#define BOARD_IOCTL_FLASH_INIT \
2965 + _IOWR(BOARD_IOCTL_MAGIC, 0, BOARD_IOCTL_PARMS)
2967 +#define BOARD_IOCTL_FLASH_WRITE \
2968 + _IOWR(BOARD_IOCTL_MAGIC, 1, BOARD_IOCTL_PARMS)
2970 +#define BOARD_IOCTL_FLASH_READ \
2971 + _IOWR(BOARD_IOCTL_MAGIC, 2, BOARD_IOCTL_PARMS)
2973 +#define BOARD_IOCTL_GET_NR_PAGES \
2974 + _IOWR(BOARD_IOCTL_MAGIC, 3, BOARD_IOCTL_PARMS)
2976 +#define BOARD_IOCTL_DUMP_ADDR \
2977 + _IOWR(BOARD_IOCTL_MAGIC, 4, BOARD_IOCTL_PARMS)
2979 +#define BOARD_IOCTL_SET_MEMORY \
2980 + _IOWR(BOARD_IOCTL_MAGIC, 5, BOARD_IOCTL_PARMS)
2982 +#define BOARD_IOCTL_MIPS_SOFT_RESET \
2983 + _IOWR(BOARD_IOCTL_MAGIC, 6, BOARD_IOCTL_PARMS)
2985 +#define BOARD_IOCTL_LED_CTRL \
2986 + _IOWR(BOARD_IOCTL_MAGIC, 7, BOARD_IOCTL_PARMS)
2988 +#define BOARD_IOCTL_GET_ID \
2989 + _IOWR(BOARD_IOCTL_MAGIC, 8, BOARD_IOCTL_PARMS)
2991 +#define BOARD_IOCTL_GET_MAC_ADDRESS \
2992 + _IOWR(BOARD_IOCTL_MAGIC, 9, BOARD_IOCTL_PARMS)
2994 +#define BOARD_IOCTL_RELEASE_MAC_ADDRESS \
2995 + _IOWR(BOARD_IOCTL_MAGIC, 10, BOARD_IOCTL_PARMS)
2997 +#define BOARD_IOCTL_GET_PSI_SIZE \
2998 + _IOWR(BOARD_IOCTL_MAGIC, 11, BOARD_IOCTL_PARMS)
3000 +#define BOARD_IOCTL_GET_SDRAM_SIZE \
3001 + _IOWR(BOARD_IOCTL_MAGIC, 12, BOARD_IOCTL_PARMS)
3003 +#define BOARD_IOCTL_SET_MONITOR_FD \
3004 + _IOWR(BOARD_IOCTL_MAGIC, 13, BOARD_IOCTL_PARMS)
3006 +#define BOARD_IOCTL_WAKEUP_MONITOR_TASK \
3007 + _IOWR(BOARD_IOCTL_MAGIC, 14, BOARD_IOCTL_PARMS)
3009 +#define BOARD_IOCTL_GET_BOOTLINE \
3010 + _IOWR(BOARD_IOCTL_MAGIC, 15, BOARD_IOCTL_PARMS)
3012 +#define BOARD_IOCTL_SET_BOOTLINE \
3013 + _IOWR(BOARD_IOCTL_MAGIC, 16, BOARD_IOCTL_PARMS)
3015 +#define BOARD_IOCTL_GET_BASE_MAC_ADDRESS \
3016 + _IOWR(BOARD_IOCTL_MAGIC, 17, BOARD_IOCTL_PARMS)
3018 +#define BOARD_IOCTL_GET_CHIP_ID \
3019 + _IOWR(BOARD_IOCTL_MAGIC, 18, BOARD_IOCTL_PARMS)
3021 +#define BOARD_IOCTL_GET_NUM_ENET \
3022 + _IOWR(BOARD_IOCTL_MAGIC, 19, BOARD_IOCTL_PARMS)
3024 +#define BOARD_IOCTL_GET_CFE_VER \
3025 + _IOWR(BOARD_IOCTL_MAGIC, 20, BOARD_IOCTL_PARMS)
3027 +#define BOARD_IOCTL_GET_ENET_CFG \
3028 + _IOWR(BOARD_IOCTL_MAGIC, 21, BOARD_IOCTL_PARMS)
3030 +#define BOARD_IOCTL_GET_WLAN_ANT_INUSE \
3031 + _IOWR(BOARD_IOCTL_MAGIC, 22, BOARD_IOCTL_PARMS)
3033 +#define BOARD_IOCTL_SET_TRIGGER_EVENT \
3034 + _IOWR(BOARD_IOCTL_MAGIC, 23, BOARD_IOCTL_PARMS)
3036 +#define BOARD_IOCTL_GET_TRIGGER_EVENT \
3037 + _IOWR(BOARD_IOCTL_MAGIC, 24, BOARD_IOCTL_PARMS)
3039 +#define BOARD_IOCTL_UNSET_TRIGGER_EVENT \
3040 + _IOWR(BOARD_IOCTL_MAGIC, 25, BOARD_IOCTL_PARMS)
3042 +#define BOARD_IOCTL_SET_SES_LED \
3043 + _IOWR(BOARD_IOCTL_MAGIC, 26, BOARD_IOCTL_PARMS)
3045 +//<<JUNHON, 2004/09/15, get reset button status , tim hou , 05/04/12
3046 +#define RESET_BUTTON_UP 1
3047 +#define RESET_BUTTON_PRESSDOWN 0
3048 +#define BOARD_IOCTL_GET_RESETHOLD \
3049 + _IOWR(BOARD_IOCTL_MAGIC, 27, BOARD_IOCTL_PARMS)
3050 +//>>JUNHON, 2004/09/15
3052 +// for the action in BOARD_IOCTL_PARMS for flash operation
3063 +} BOARD_IOCTL_ACTION;
3066 +typedef struct boardIoctParms
3072 + BOARD_IOCTL_ACTION action; /* flash read/write: nvram, persistent, bcm image */
3074 +} BOARD_IOCTL_PARMS;
3088 + kLedEnd, // NOTE: Insert the new led name before this one. Alway stay at the end.
3093 + kLedStateOff, /* turn led off */
3094 + kLedStateOn, /* turn led on */
3095 + kLedStateFail, /* turn led on red */
3096 + kLedStateBlinkOnce, /* blink once, ~100ms and ignore the same call during the 100ms period */
3097 + kLedStateSlowBlinkContinues, /* slow blink continues at ~600ms interval */
3098 + kLedStateFastBlinkContinues, /* fast blink continues at ~200ms interval */
3102 +// virtual and physical map pair defined in board.c
3103 +typedef struct ledmappair
3105 + BOARD_LED_NAME ledName; // virtual led name
3106 + BOARD_LED_STATE ledInitState; // initial led state when the board boots.
3107 + unsigned short ledMask; // physical GPIO pin mask
3108 + unsigned short ledActiveLow; // reset bit to turn on LED
3109 + unsigned short ledMaskFail; // physical GPIO pin mask for state failure
3110 + unsigned short ledActiveLowFail;// reset bit to turn on LED
3111 +} LED_MAP_PAIR, *PLED_MAP_PAIR;
3113 +typedef void (*HANDLE_LED_FUNC)(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState);
3115 +/* Flash storage address information that is determined by the flash driver. */
3116 +typedef struct flashaddrinfo
3118 + int flash_persistent_start_blk;
3119 + int flash_persistent_number_blk;
3120 + int flash_persistent_length;
3121 + unsigned long flash_persistent_blk_offset;
3122 + int flash_scratch_pad_start_blk; // start before psi (SP_BUF_LEN)
3123 + int flash_scratch_pad_number_blk;
3124 + int flash_scratch_pad_length;
3125 + unsigned long flash_scratch_pad_blk_offset;
3126 + int flash_nvram_start_blk;
3127 + int flash_nvram_number_blk;
3128 + int flash_nvram_length;
3129 + unsigned long flash_nvram_blk_offset;
3130 +} FLASH_ADDR_INFO, *PFLASH_ADDR_INFO;
3132 +// scratch pad defines
3133 +/* SP - Persisten Scratch Pad format:
3134 + sp header : 32 bytes
3135 + tokenId-1 : 8 bytes
3136 + tokenId-1 len : 4 bytes
3139 + tokenId-n : 8 bytes
3140 + tokenId-n len : 4 bytes
3144 +#define MAGIC_NUM_LEN 8
3145 +#define MAGIC_NUMBER "gOGoBrCm"
3146 +#define TOKEN_NAME_LEN 16
3147 +#define SP_VERSION 1
3148 +#define SP_MAX_LEN 8 * 1024 // 8k buf before psi
3149 +#define SP_RESERVERD 16
3151 +typedef struct _SP_HEADER
3153 + char SPMagicNum[MAGIC_NUM_LEN]; // 8 bytes of magic number
3154 + int SPVersion; // version number
3155 + int SPUsedLen; // used sp len
3156 + char SPReserved[SP_RESERVERD]; // reservied, total 32 bytes
3157 +} SP_HEADER, *PSP_HEADER;
3159 +typedef struct _TOKEN_DEF
3161 + char tokenName[TOKEN_NAME_LEN];
3163 +} SP_TOKEN, *PSP_TOKEN;
3166 +/*****************************************************************************/
3167 +/* Function Prototypes */
3168 +/*****************************************************************************/
3169 +#if !defined(__ASM_ASM_H)
3170 +void dumpaddr( unsigned char *pAddr, int nLen );
3172 +void kerSysFlashAddrInfoGet(PFLASH_ADDR_INFO pflash_addr_info);
3173 +int kerSysNvRamGet(char *string, int strLen, int offset);
3174 +int kerSysNvRamSet(char *string, int strLen, int offset);
3175 +int kerSysPersistentGet(char *string, int strLen, int offset);
3176 +int kerSysPersistentSet(char *string, int strLen, int offset);
3177 +int kerSysScratchPadGet(char *tokName, char *tokBuf, int tokLen);
3178 +int kerSysScratchPadSet(char *tokName, char *tokBuf, int tokLen);
3179 +int kerSysBcmImageSet( int flash_start_addr, char *string, int size);
3180 +int kerSysGetMacAddress( unsigned char *pucaAddr, unsigned long ulId );
3181 +int kerSysReleaseMacAddress( unsigned char *pucaAddr );
3182 +int kerSysGetSdramSize( void );
3183 +void kerSysGetBootline(char *string, int strLen);
3184 +void kerSysSetBootline(char *string, int strLen);
3185 +void kerSysMipsSoftReset(void);
3186 +void kerSysLedCtrl(BOARD_LED_NAME, BOARD_LED_STATE);
3187 +void kerSysLedRegisterHwHandler( BOARD_LED_NAME, HANDLE_LED_FUNC, int );
3188 +int kerSysFlashSizeGet(void);
3189 +void kerSysRegisterDyingGaspHandler(char *devname, void *cbfn, void *context);
3190 +void kerSysDeregisterDyingGaspHandler(char *devname);
3191 +void kerSysWakeupMonitorTask( void );
3195 +#endif /* _BOARD_H */
3197 diff -urN linux-2.6.17/bcmdrivers/opensource/Makefile linux-2.6.17-brcm63xx/bcmdrivers/opensource/Makefile
3198 --- linux-2.6.17/bcmdrivers/opensource/Makefile 1970-01-01 01:00:00.000000000 +0100
3199 +++ linux-2.6.17-brcm63xx/bcmdrivers/opensource/Makefile 2006-07-25 10:43:50.000000000 +0200
3201 +# File: modules/drivers/Makefile
3203 +# Makefile for the GPLed Linux kernel modules.
3206 +LN_NAME=bcm9$(BRCM_CHIP)
3209 +-include $(KERNEL_DIR)/.config
3211 +ifneq ($(CONFIG_BCM_SERIAL),)
3212 + LN_DRIVER_DIRS +=ln -sn impl$(CONFIG_BCM_SERIAL_IMPL) char/serial/$(LN_NAME);
3215 +obj-$(CONFIG_BCM_SERIAL) += char/serial/impl$(CONFIG_BCM_SERIAL_IMPL)/
3219 + find . -lname "*" -name "$(LN_NAME)" -print -exec rm -f "{}" ";"
3220 + $(CONFIG_SHELL) -c "$(LN_DRIVER_DIRS)"