1 diff -Nur linux-2.6.12.5/arch/mips/Kconfig linux-2.6.12.5-brcm/arch/mips/Kconfig
2 --- linux-2.6.12.5/arch/mips/Kconfig 2005-08-15 02:20:18.000000000 +0200
3 +++ linux-2.6.12.5-brcm/arch/mips/Kconfig 2005-09-16 10:29:18.135597872 +0200
5 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
6 Olivetti M700-10 workstations.
9 + bool "Support for BCM947xx based boards"
10 + select DMA_NONCOHERENT
13 + select CPU_LITTLE_ENDIAN
15 + Support for BCM947xx based boards
18 bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
19 depends on MACH_JAZZ && EXPERIMENTAL
22 config CPU_LITTLE_ENDIAN
23 bool "Generate little endian code"
24 - default y if ACER_PICA_61 || CASIO_E55 || DDB5074 || DDB5476 || DDB5477 || MACH_DECSTATION || IBM_WORKPAD || LASAT || MIPS_COBALT || MIPS_ITE8172 || MIPS_IVR || SOC_AU1X00 || NEC_OSPREY || OLIVETTI_M700 || SNI_RM200_PCI || VICTOR_MPC30X || ZAO_CAPCELLA
25 + default y if ACER_PICA_61 || CASIO_E55 || DDB5074 || DDB5476 || DDB5477 || MACH_DECSTATION || IBM_WORKPAD || LASAT || MIPS_COBALT || MIPS_ITE8172 || MIPS_IVR || SOC_AU1X00 || NEC_OSPREY || OLIVETTI_M700 || SNI_RM200_PCI || VICTOR_MPC30X || ZAO_CAPCELLA || BCM947XX
26 default n if MIPS_EV64120 || MIPS_EV96100 || MOMENCO_OCELOT || MOMENCO_OCELOT_G || SGI_IP22 || SGI_IP27 || SGI_IP32 || TOSHIBA_JMR3927
28 Some MIPS machines can be configured for either little or big endian
29 diff -Nur linux-2.6.12.5/arch/mips/Makefile linux-2.6.12.5-brcm/arch/mips/Makefile
30 --- linux-2.6.12.5/arch/mips/Makefile 2005-08-15 02:20:18.000000000 +0200
31 +++ linux-2.6.12.5-brcm/arch/mips/Makefile 2005-09-16 10:29:18.137597568 +0200
33 cflags-y += -I $(TOPDIR)/include/asm/gcc
34 cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
35 cflags-y += $(call cc-option, -finline-limit=100000)
36 -LDFLAGS_vmlinux += -G 0 -static -n
37 +LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
38 MODFLAGS += -mlong-calls
40 cflags-$(CONFIG_SB1XXX_CORELIS) += -mno-sched-prolog -fno-omit-frame-pointer
42 cflags-$(CONFIG_CPU_MIPS32) += \
43 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
45 +cflags-$(CONFIG_CPU_MIPS32) += -Wa,--trap
47 cflags-$(CONFIG_CPU_MIPS64) += \
48 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
50 load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
53 +# Broadcom BCM47XX boards
55 +core-$(CONFIG_BCM947XX) += arch/mips/bcm947xx/ arch/mips/bcm947xx/broadcom/
56 +cflags-$(CONFIG_BCM947XX) += -Iarch/mips/bcm947xx/include
57 +load-$(CONFIG_BCM947XX) := 0xffffffff80001000
63 core-$(CONFIG_SNI_RM200_PCI) += arch/mips/sni/
64 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/Makefile linux-2.6.12.5-brcm/arch/mips/bcm947xx/Makefile
65 --- linux-2.6.12.5/arch/mips/bcm947xx/Makefile 1970-01-01 01:00:00.000000000 +0100
66 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/Makefile 2005-09-16 10:29:18.149595744 +0200
69 +# Makefile for the BCM47xx specific kernel interface routines
73 +obj-y := irq.o int-handler.o prom.o setup.o time.o
74 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/Makefile linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/Makefile
75 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/Makefile 1970-01-01 01:00:00.000000000 +0100
76 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/Makefile 2005-09-16 10:29:18.149595744 +0200
79 +# Makefile for the BCM47xx specific kernel interface routines
83 +obj-y := sbutils.o linux_osl.o bcmsrom.o bcmutils.o sbmips.o sbpci.o hnddma.o
84 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmsrom.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmsrom.c
85 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmsrom.c 1970-01-01 01:00:00.000000000 +0100
86 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmsrom.c 2005-09-16 10:29:18.150595592 +0200
89 + * Misc useful routines to access NIC SROM
91 + * Copyright 2001-2003, Broadcom Corporation
92 + * All Rights Reserved.
94 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
95 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
96 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
97 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
98 + * $Id: bcmsrom.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
101 +#include <typedefs.h>
103 +#include <bcmutils.h>
104 +#include <bcmsrom.h>
105 +#include <bcmdevs.h>
106 +#include <bcmendian.h>
107 +#include <sbpcmcia.h>
110 +#include <proto/ethernet.h> /* for sprom content groking */
112 +#define VARS_MAX 4096 /* should be reduced */
114 +static int initvars_srom_pci(void *curmap, char **vars, int *count);
115 +static int initvars_cis_pcmcia(void *osh, char **vars, int *count);
116 +static int sprom_cmd_pcmcia(void *osh, uint8 cmd);
117 +static int sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data);
118 +static int sprom_write_pcmcia(void *osh, uint16 addr, uint16 data);
119 +static int sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc);
122 + * Initialize the vars from the right source for this platform.
123 + * Return 0 on success, nonzero on error.
126 +srom_var_init(uint bus, void *curmap, void *osh, char **vars, int *count)
133 + /* These two could be asserts ... */
139 + ASSERT(curmap); /* can not be NULL */
140 + return(initvars_srom_pci(curmap, vars, count));
143 + return(initvars_cis_pcmcia(osh, vars, count));
153 +/* support only 16-bit word read from srom */
155 +srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf)
160 + /* check input - 16-bit access only */
161 + if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2))
164 + if (bus == PCI_BUS) {
167 + srom = (void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET);
168 + if (sprom_read_pci(srom, byteoff, buf, nbytes, FALSE))
170 + } else if (bus == PCMCIA_BUS) {
173 + for (i = 0; i < nw; i++) {
174 + if (sprom_read_pcmcia(osh, (uint16)(off + i), (uint16*)(buf + i)))
184 +/* support only 16-bit word write into srom */
186 +srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf)
189 + uint i, off, nw, crc_range;
190 + uint16 image[SPROM_SIZE], *p;
192 + volatile uint32 val32;
194 + /* check input - 16-bit access only */
195 + if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > (SPROM_SIZE * 2))
198 + crc_range = ((bus == PCMCIA_BUS) ? SPROM_SIZE : SPROM_CRC_RANGE) * 2;
200 + /* if changes made inside crc cover range */
201 + if (byteoff < crc_range) {
202 + nw = (((byteoff + nbytes) > crc_range) ? byteoff + nbytes : crc_range) / 2;
203 + /* read data including entire first 64 words from srom */
204 + if (srom_read(bus, curmap, osh, 0, nw * 2, image))
207 + bcopy((void*)buf, (void*)&image[byteoff / 2], nbytes);
208 + /* calculate crc */
209 + htol16_buf(image, crc_range);
210 + crc = ~crc8((uint8 *)image, crc_range - 1, CRC8_INIT_VALUE);
211 + ltoh16_buf(image, crc_range);
212 + image[(crc_range / 2) - 1] = (crc << 8) | (image[(crc_range / 2) - 1] & 0xff);
221 + if (bus == PCI_BUS) {
222 + srom = (uint16*)((uint)curmap + PCI_BAR0_SPROM_OFFSET);
223 + /* enable writes to the SPROM */
224 + val32 = OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32));
225 + val32 |= SPROM_WRITEEN;
226 + OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32);
229 + for (i = 0; i < nw; i++) {
230 + W_REG(&srom[off + i], p[i]);
233 + /* disable writes to the SPROM */
234 + OSL_PCI_WRITE_CONFIG(osh, PCI_SPROM_CONTROL, sizeof(uint32), val32 & ~SPROM_WRITEEN);
235 + } else if (bus == PCMCIA_BUS) {
236 + /* enable writes to the SPROM */
237 + if (sprom_cmd_pcmcia(osh, SROM_WEN))
241 + for (i = 0; i < nw; i++) {
242 + sprom_write_pcmcia(osh, (uint16)(off + i), p[i]);
245 + /* disable writes to the SPROM */
246 + if (sprom_cmd_pcmcia(osh, SROM_WDS))
258 +srom_parsecis(uint8 *cis, char **vars, int *count)
262 + uint8 tup, tlen, sromrev = 1;
265 + bool ag_init = FALSE;
271 + base = vp = MALLOC(VARS_MAX);
280 + case CISTPL_MANFID:
281 + vp += sprintf(vp, "manfid=%d", (cis[i + 1] << 8) + cis[i]);
283 + vp += sprintf(vp, "prodid=%d", (cis[i + 3] << 8) + cis[i + 2]);
288 + if (cis[i] == LAN_NID) {
289 + ASSERT(cis[i + 1] == ETHER_ADDR_LEN);
290 + bcm_ether_ntoa((uchar*)&cis[i + 2], eabuf);
291 + vp += sprintf(vp, "il0macaddr=%s", eabuf);
296 + case CISTPL_CFTABLE:
297 + vp += sprintf(vp, "regwindowsz=%d", (cis[i + 7] << 8) | cis[i + 6]);
301 + case CISTPL_BRCM_HNBU:
304 + vp += sprintf(vp, "vendid=%d", (cis[i + 2] << 8) + cis[i + 1]);
306 + vp += sprintf(vp, "devid=%d", (cis[i + 4] << 8) + cis[i + 3]);
309 + vp += sprintf(vp, "chiprev=%d", (cis[i + 6] << 8) + cis[i + 5]);
314 + case HNBU_BOARDREV:
315 + vp += sprintf(vp, "boardrev=%d", cis[i + 1]);
320 + vp += sprintf(vp, "aa0=%d", cis[i + 1]);
325 + vp += sprintf(vp, "ag0=%d", cis[i + 1]);
331 + vp += sprintf(vp, "cc=%d", cis[i + 1]);
336 + vp += sprintf(vp, "pa0maxpwr=%d", cis[i + tlen - 1]);
340 + for (j = 0; j < 3; j++) {
341 + vp += sprintf(vp, "pa0b%d=%d", j,
342 + (cis[i + (j * 2) + 2] << 8) + cis[i + (j * 2) + 1]);
345 + vp += sprintf(vp, "pa0itssit=%d", cis[i + 7]);
351 + vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x",
352 + cis[i + 1], cis[i + 2], cis[i + 3], cis[i + 4],
353 + cis[i + 5], cis[i + 6], cis[i + 7], cis[i + 8]);
356 + case HNBU_BOARDFLAGS:
357 + w = (cis[i + 2] << 8) + cis[i + 1];
358 + if (w == 0xffff) w = 0;
359 + vp += sprintf(vp, "boardflags=%d", w);
363 + if (cis[i + 1] != 0xff) {
364 + vp += sprintf(vp, "wl0gpio0=%d", cis[i + 1]);
367 + if (cis[i + 2] != 0xff) {
368 + vp += sprintf(vp, "wl0gpio1=%d", cis[i + 2]);
371 + if (cis[i + 3] != 0xff) {
372 + vp += sprintf(vp, "wl0gpio2=%d", cis[i + 3]);
375 + if (cis[i + 4] != 0xff) {
376 + vp += sprintf(vp, "wl0gpio3=%d", cis[i + 4]);
385 + } while (tup != 0xff);
387 + /* Set the srom version */
388 + vp += sprintf(vp, "sromrev=%d", sromrev);
391 + /* For now just set boardflags2 to zero */
392 + vp += sprintf(vp, "boardflags2=0");
395 + /* if there is no antenna gain field, set default */
396 + if (ag_init == FALSE) {
397 + vp += sprintf(vp, "ag0=%d", 0xff);
401 + /* final nullbyte terminator */
403 + varsize = (uint)vp - (uint)base;
405 + ASSERT(varsize < VARS_MAX);
407 + if (varsize == VARS_MAX) {
410 + vp = MALLOC(varsize);
412 + bcopy(base, vp, varsize);
413 + MFREE(base, VARS_MAX);
422 +/* set PCMCIA sprom command register */
424 +sprom_cmd_pcmcia(void *osh, uint8 cmd)
427 + uint wait_cnt = 1000;
429 + /* write sprom command register */
430 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_CS, &cmd, 1);
433 + while (wait_cnt--) {
434 + OSL_PCMCIA_READ_ATTR(osh, SROM_CS, &status, 1);
435 + if (status & SROM_DONE)
441 +/* read a word from the PCMCIA srom */
443 +sprom_read_pcmcia(void *osh, uint16 addr, uint16 *data)
445 + uint8 addr_l, addr_h, data_l, data_h;
447 + addr_l = (uint8)((addr * 2) & 0xff);
448 + addr_h = (uint8)(((addr * 2) >> 8) & 0xff);
451 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
452 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
455 + if (sprom_cmd_pcmcia(osh, SROM_READ))
459 + OSL_PCMCIA_READ_ATTR(osh, SROM_DATAH, &data_h, 1);
460 + OSL_PCMCIA_READ_ATTR(osh, SROM_DATAL, &data_l, 1);
462 + *data = (data_h << 8) | data_l;
466 +/* write a word to the PCMCIA srom */
468 +sprom_write_pcmcia(void *osh, uint16 addr, uint16 data)
470 + uint8 addr_l, addr_h, data_l, data_h;
472 + addr_l = (uint8)((addr * 2) & 0xff);
473 + addr_h = (uint8)(((addr * 2) >> 8) & 0xff);
474 + data_l = (uint8)(data & 0xff);
475 + data_h = (uint8)((data >> 8) & 0xff);
478 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRH, &addr_h, 1);
479 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_ADDRL, &addr_l, 1);
482 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAH, &data_h, 1);
483 + OSL_PCMCIA_WRITE_ATTR(osh, SROM_DATAL, &data_l, 1);
486 + return sprom_cmd_pcmcia(osh, SROM_WRITE);
490 + * Read in and validate sprom.
491 + * Return 0 on success, nonzero on error.
494 +sprom_read_pci(uint16 *sprom, uint byteoff, uint16 *buf, uint nbytes, bool check_crc)
501 + nw = ROUNDUP(nbytes, 2) / 2;
503 + /* read the sprom */
504 + for (i = 0; i < nw; i++)
505 + buf[i] = R_REG(&sprom[off + i]);
508 + /* fixup the endianness so crc8 will pass */
509 + htol16_buf(buf, nw * 2);
510 + if ((chk8 = crc8((uchar*)buf, nbytes, CRC8_INIT_VALUE)) != CRC8_GOOD_VALUE)
512 + /* now correct the endianness of the byte array */
513 + ltoh16_buf(buf, nw * 2);
520 + * Initialize nonvolatile variable table from sprom.
521 + * Return 0 on success, nonzero on error.
525 +initvars_srom_pci(void *curmap, char **vars, int *count)
529 + struct ether_addr ea;
534 + if (sprom_read_pci((void *)((uint)curmap + PCI_BAR0_SPROM_OFFSET), 0, b, sizeof (b), TRUE))
537 + /* top word of sprom contains version and crc8 */
538 + sromrev = b[63] & 0xff;
539 + if ((sromrev != 1) && (sromrev != 2)) {
546 + base = vp = MALLOC(VARS_MAX);
549 + vp += sprintf(vp, "sromrev=%d", sromrev);
552 + if (sromrev >= 2) {
553 + /* New section takes over the 4th hardware function space */
555 + /* Word 28 is boardflags2 */
556 + vp += sprintf(vp, "boardflags2=%d", b[28]);
559 + /* Word 29 is max power 11a high/low */
561 + vp += sprintf(vp, "pa1himaxpwr=%d", w & 0xff);
563 + vp += sprintf(vp, "pa1lomaxpwr=%d", (w >> 8) & 0xff);
566 + /* Words 30-32 set the 11alow pa settings,
567 + * 33-35 are the 11ahigh ones.
569 + for (i = 0; i < 3; i++) {
570 + vp += sprintf(vp, "pa1lob%d=%d", i, b[30 + i]);
572 + vp += sprintf(vp, "pa1hib%d=%d", i, b[33 + i]);
577 + vp += sprintf(vp, "ccode=");
579 + vp += sprintf(vp, "ccode=%c%c", (w >> 8), (w & 0xff));
584 + /* parameter section of sprom starts at byte offset 72 */
587 + /* first 6 bytes are il0macaddr */
588 + ea.octet[0] = (b[woff] >> 8) & 0xff;
589 + ea.octet[1] = b[woff] & 0xff;
590 + ea.octet[2] = (b[woff+1] >> 8) & 0xff;
591 + ea.octet[3] = b[woff+1] & 0xff;
592 + ea.octet[4] = (b[woff+2] >> 8) & 0xff;
593 + ea.octet[5] = b[woff+2] & 0xff;
594 + woff += ETHER_ADDR_LEN/2 ;
595 + bcm_ether_ntoa((uchar*)&ea, eabuf);
596 + vp += sprintf(vp, "il0macaddr=%s", eabuf);
599 + /* next 6 bytes are et0macaddr */
600 + ea.octet[0] = (b[woff] >> 8) & 0xff;
601 + ea.octet[1] = b[woff] & 0xff;
602 + ea.octet[2] = (b[woff+1] >> 8) & 0xff;
603 + ea.octet[3] = b[woff+1] & 0xff;
604 + ea.octet[4] = (b[woff+2] >> 8) & 0xff;
605 + ea.octet[5] = b[woff+2] & 0xff;
606 + woff += ETHER_ADDR_LEN/2 ;
607 + bcm_ether_ntoa((uchar*)&ea, eabuf);
608 + vp += sprintf(vp, "et0macaddr=%s", eabuf);
611 + /* next 6 bytes are et1macaddr */
612 + ea.octet[0] = (b[woff] >> 8) & 0xff;
613 + ea.octet[1] = b[woff] & 0xff;
614 + ea.octet[2] = (b[woff+1] >> 8) & 0xff;
615 + ea.octet[3] = b[woff+1] & 0xff;
616 + ea.octet[4] = (b[woff+2] >> 8) & 0xff;
617 + ea.octet[5] = b[woff+2] & 0xff;
618 + woff += ETHER_ADDR_LEN/2 ;
619 + bcm_ether_ntoa((uchar*)&ea, eabuf);
620 + vp += sprintf(vp, "et1macaddr=%s", eabuf);
624 + * Enet phy settings one or two singles or a dual
625 + * Bits 4-0 : MII address for enet0 (0x1f for not there)
626 + * Bits 9-5 : MII address for enet1 (0x1f for not there)
627 + * Bit 14 : Mdio for enet0
628 + * Bit 15 : Mdio for enet1
631 + vp += sprintf(vp, "et0phyaddr=%d", (w & 0x1f));
633 + vp += sprintf(vp, "et1phyaddr=%d", ((w >> 5) & 0x1f));
635 + vp += sprintf(vp, "et0mdcport=%d", ((w >> 14) & 0x1));
637 + vp += sprintf(vp, "et1mdcport=%d", ((w >> 15) & 0x1));
640 + /* Word 46 has board rev, antennas 0/1 & Country code/control */
642 + vp += sprintf(vp, "boardrev=%d", w & 0xff);
646 + vp += sprintf(vp, "cctl=%d", (w >> 8) & 0xf);
648 + vp += sprintf(vp, "cc=%d", (w >> 8) & 0xf);
651 + vp += sprintf(vp, "aa0=%d", (w >> 12) & 0x3);
654 + vp += sprintf(vp, "aa1=%d", (w >> 14) & 0x3);
657 + /* Words 47-49 set the (wl) pa settings */
660 + for (i = 0; i < 3; i++) {
661 + vp += sprintf(vp, "pa0b%d=%d", i, b[woff+i]);
663 + vp += sprintf(vp, "pa1b%d=%d", i, b[woff+i+6]);
668 + * Words 50-51 set the customer-configured wl led behavior.
669 + * 8 bits/gpio pin. High bit: activehi=0, activelo=1;
670 + * LED behavior values defined in wlioctl.h .
673 + if ((w != 0) && (w != 0xffff)) {
675 + vp += sprintf(vp, "wl0gpio0=%d", (w & 0xff));
679 + vp += sprintf(vp, "wl0gpio1=%d", (w >> 8) & 0xff);
683 + if ((w != 0) && (w != 0xffff)) {
685 + vp += sprintf(vp, "wl0gpio2=%d", w & 0xff);
689 + vp += sprintf(vp, "wl0gpio3=%d", (w >> 8) & 0xff);
693 + /* Word 52 is max power 0/1 */
695 + vp += sprintf(vp, "pa0maxpwr=%d", w & 0xff);
697 + vp += sprintf(vp, "pa1maxpwr=%d", (w >> 8) & 0xff);
700 + /* Word 56 is idle tssi target 0/1 */
702 + vp += sprintf(vp, "pa0itssit=%d", w & 0xff);
704 + vp += sprintf(vp, "pa1itssit=%d", (w >> 8) & 0xff);
707 + /* Word 57 is boardflags, if not programmed make it zero */
709 + if (w == 0xffff) w = 0;
710 + vp += sprintf(vp, "boardflags=%d", w);
713 + /* Word 58 is antenna gain 0/1 */
715 + vp += sprintf(vp, "ag0=%d", w & 0xff);
718 + vp += sprintf(vp, "ag1=%d", (w >> 8) & 0xff);
721 + if (sromrev == 1) {
722 + /* set the oem string */
723 + vp += sprintf(vp, "oem=%02x%02x%02x%02x%02x%02x%02x%02x",
724 + ((b[59] >> 8) & 0xff), (b[59] & 0xff),
725 + ((b[60] >> 8) & 0xff), (b[60] & 0xff),
726 + ((b[61] >> 8) & 0xff), (b[61] & 0xff),
727 + ((b[62] >> 8) & 0xff), (b[62] & 0xff));
731 + /* final nullbyte terminator */
735 + ASSERT(c <= VARS_MAX);
737 + if (c == VARS_MAX) {
742 + bcopy(base, vp, c);
743 + MFREE(base, VARS_MAX);
752 + * Read the cis and call parsecis to initialize the vars.
753 + * Return 0 on success, nonzero on error.
756 +initvars_cis_pcmcia(void *osh, char **vars, int *count)
761 + if ((cis = MALLOC(CIS_SIZE)) == NULL)
764 + OSL_PCMCIA_READ_ATTR(osh, 0, cis, CIS_SIZE);
766 + rc = srom_parsecis(cis, vars, count);
768 + MFREE(cis, CIS_SIZE);
773 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmutils.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmutils.c
774 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/bcmutils.c 1970-01-01 01:00:00.000000000 +0100
775 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/bcmutils.c 2005-09-16 10:29:18.164593464 +0200
778 + * Misc useful OS-independent routines.
780 + * Copyright 2001-2003, Broadcom Corporation
781 + * All Rights Reserved.
783 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
784 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
785 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
786 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
787 + * $Id: bcmutils.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
790 +#include <typedefs.h>
792 +#include <bcmutils.h>
793 +#include <bcmendian.h>
794 +#include <bcmnvram.h>
796 +unsigned char bcm_ctype[] = {
797 + _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 0-7 */
798 + _BCM_C,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C|_BCM_S,_BCM_C,_BCM_C, /* 8-15 */
799 + _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 16-23 */
800 + _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 24-31 */
801 + _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 32-39 */
802 + _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 40-47 */
803 + _BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D, /* 48-55 */
804 + _BCM_D,_BCM_D,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 56-63 */
805 + _BCM_P,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U|_BCM_X,_BCM_U, /* 64-71 */
806 + _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 72-79 */
807 + _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 80-87 */
808 + _BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 88-95 */
809 + _BCM_P,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L|_BCM_X,_BCM_L, /* 96-103 */
810 + _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 104-111 */
811 + _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 112-119 */
812 + _BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_C, /* 120-127 */
813 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
814 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
815 + _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 160-175 */
816 + _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 176-191 */
817 + _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 192-207 */
818 + _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_L, /* 208-223 */
819 + _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 224-239 */
820 + _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L /* 240-255 */
824 +bcm_toupper(uchar c)
826 + if (bcm_islower(c))
832 +bcm_strtoul(char *cp, char **endp, uint base)
834 + ulong result, value;
839 + while (bcm_isspace(*cp))
844 + else if (cp[0] == '-') {
850 + if (cp[0] == '0') {
851 + if ((cp[1] == 'x') || (cp[1] == 'X')) {
860 + } else if (base == 16 && (cp[0] == '0') && ((cp[1] == 'x') || (cp[1] == 'X'))) {
866 + while (bcm_isxdigit(*cp) &&
867 + (value = bcm_isdigit(*cp) ? *cp-'0' : bcm_toupper(*cp)-'A'+10) < base) {
868 + result = result*base + value;
873 + result = (ulong)(result * -1);
876 + *endp = (char *)cp;
888 + while (bcm_isdigit(*s))
889 + n = (n * 10) + *s++ - '0';
894 +deadbeef(char *p, uint len)
896 + static uchar meat[] = { 0xde, 0xad, 0xbe, 0xef };
898 + while (len-- > 0) {
899 + *p = meat[((uint)p) & 3];
904 +/* pretty hex print a contiguous buffer */
906 +prhex(char *msg, uchar *buf, uint nbytes)
912 + if (msg && (msg[0] != '\0'))
913 + printf("%s: ", msg);
916 + for (i = 0; i < nbytes; i++) {
918 + p += sprintf(p, "%04d: ", i); /* line prefix */
920 + p += sprintf(p, "%02x ", buf[i]);
921 + if (i % 16 == 15) {
922 + printf("%s\n", line); /* flush line */
927 + /* flush last partial line */
929 + printf("%s\n", line);
932 +/* pretty hex print a pkt buffer chain */
934 +prpkt(char *msg, void *drv, void *p0)
938 + if (msg && (msg[0] != '\0'))
939 + printf("%s: ", msg);
941 + for (p = p0; p; p = PKTNEXT(drv, p))
942 + prhex(NULL, PKTDATA(drv, p), PKTLEN(drv, p));
945 +/* copy a pkt buffer chain into a buffer */
947 +pktcopy(void *drv, void *p, uint offset, int len, uchar *buf)
952 + len = 4096; /* "infinite" */
954 + /* skip 'offset' bytes */
955 + for (; p && offset; p = PKTNEXT(drv, p)) {
956 + if (offset < (uint)PKTLEN(drv, p))
958 + offset -= PKTLEN(drv, p);
964 + /* copy the data */
965 + for (; p && len; p = PKTNEXT(drv, p)) {
966 + n = MIN((uint)PKTLEN(drv, p) - offset, (uint)len);
967 + bcopy(PKTDATA(drv, p) + offset, buf, n);
977 +/* return total length of buffer chain */
979 +pkttotlen(void *drv, void *p)
984 + for (; p; p = PKTNEXT(drv, p))
985 + total += PKTLEN(drv, p);
991 +bcm_ether_ntoa(char *ea, char *buf)
993 + sprintf(buf,"%02x:%02x:%02x:%02x:%02x:%02x",
994 + (uchar)ea[0]&0xff, (uchar)ea[1]&0xff, (uchar)ea[2]&0xff,
995 + (uchar)ea[3]&0xff, (uchar)ea[4]&0xff, (uchar)ea[5]&0xff);
999 +/* parse a xx:xx:xx:xx:xx:xx format ethernet address */
1001 +bcm_ether_atoe(char *p, char *ea)
1006 + ea[i++] = (char) bcm_strtoul(p, &p, 16);
1007 + if (!*p++ || i == 6)
1015 + * Traverse a string of 1-byte tag/1-byte length/variable-length value
1016 + * triples, returning a pointer to the substring whose first element
1017 + * matches tag. Stop parsing when we see an element whose ID is greater
1018 + * than the target key.
1021 +bcm_parse_ordered_tlvs(void *buf, int buflen, uint key)
1026 + elt = (bcm_tlv_t*)buf;
1029 + /* find tagged parameter */
1030 + while (totlen >= 2) {
1031 + uint id = elt->id;
1032 + int len = elt->len;
1034 + /* Punt if we start seeing IDs > than target key */
1038 + /* validate remaining totlen */
1039 + if ((id == key) && (totlen >= (len + 2)))
1042 + elt = (bcm_tlv_t*)((uint8*)elt + (len + 2));
1043 + totlen -= (len + 2);
1050 + * Traverse a string of 1-byte tag/1-byte length/variable-length value
1051 + * triples, returning a pointer to the substring whose first element
1055 +bcm_parse_tlvs(void *buf, int buflen, uint key)
1060 + elt = (bcm_tlv_t*)buf;
1063 + /* find tagged parameter */
1064 + while (totlen >= 2) {
1065 + int len = elt->len;
1067 + /* validate remaining totlen */
1068 + if ((elt->id == key) && (totlen >= (len + 2)))
1071 + elt = (bcm_tlv_t*)((uint8*)elt + (len + 2));
1072 + totlen -= (len + 2);
1079 +pktqinit(struct pktq *q, int maxlen)
1081 + q->head = q->tail = NULL;
1082 + q->maxlen = maxlen;
1087 +pktenq(struct pktq *q, void *p, bool lifo)
1089 + ASSERT(PKTLINK(p) == NULL);
1091 + PKTSETLINK(p, NULL);
1093 + if (q->tail == NULL) {
1094 + ASSERT(q->head == NULL);
1095 + q->head = q->tail = p;
1099 + ASSERT(PKTLINK(q->tail) == NULL);
1101 + PKTSETLINK(p, q->head);
1104 + PKTSETLINK(q->tail, p);
1112 +pktdeq(struct pktq *q)
1116 + if ((p = q->head)) {
1118 + q->head = PKTLINK(p);
1119 + PKTSETLINK(p, NULL);
1121 + if (q->head == NULL)
1125 + ASSERT(q->tail == NULL);
1131 +/*******************************************************************************
1134 + * Computes a crc8 over the input data using the polynomial:
1136 + * x^8 + x^7 +x^6 + x^4 + x^2 + 1
1138 + * The caller provides the initial value (either CRC8_INIT_VALUE
1139 + * or the previous returned value) to allow for processing of
1140 + * discontiguous blocks of data. When generating the CRC the
1141 + * caller is responsible for complementing the final return value
1142 + * and inserting it into the byte stream. When checking, a final
1143 + * return value of CRC8_GOOD_VALUE indicates a valid CRC.
1145 + * Reference: Dallas Semiconductor Application Note 27
1146 + * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
1147 + * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
1148 + * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
1150 + ******************************************************************************/
1152 +static uint8 crc8_table[256] = {
1153 + 0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
1154 + 0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
1155 + 0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
1156 + 0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5,
1157 + 0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14,
1158 + 0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E,
1159 + 0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80,
1160 + 0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA,
1161 + 0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95,
1162 + 0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF,
1163 + 0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01,
1164 + 0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B,
1165 + 0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA,
1166 + 0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0,
1167 + 0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E,
1168 + 0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34,
1169 + 0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0,
1170 + 0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A,
1171 + 0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54,
1172 + 0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E,
1173 + 0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF,
1174 + 0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5,
1175 + 0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B,
1176 + 0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61,
1177 + 0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E,
1178 + 0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74,
1179 + 0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA,
1180 + 0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0,
1181 + 0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41,
1182 + 0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B,
1183 + 0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5,
1184 + 0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F
1188 + * Search the name=value vars for a specific one and return its value.
1189 + * Returns NULL if not found.
1192 +getvar(char *vars, char *name)
1197 + len = strlen(name);
1199 + /* first look in vars[] */
1200 + for (s = vars; s && *s; ) {
1201 + if ((bcmp(s, name, len) == 0) && (s[len] == '='))
1202 + return (&s[len+1]);
1208 + /* then query nvram */
1209 + return (nvram_get(name));
1213 + * Search the vars for a specific one and return its value as
1214 + * an integer. Returns 0 if not found.
1217 +getintvar(char *vars, char *name)
1221 + if ((val = getvar(vars, name)) == NULL)
1224 + return (bcm_strtoul(val, NULL, 0));
1228 +bcm_mdelay(uint ms)
1232 + for (i = 0; i < ms; i++) {
1237 +#define CRC_INNER_LOOP(n, c, x) \
1238 + (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
1242 + uint8 *pdata, /* pointer to array of data to process */
1243 + uint nbytes, /* number of input data bytes to process */
1244 + uint8 crc /* either CRC8_INIT_VALUE or previous return value */
1247 + /* hard code the crc loop instead of using CRC_INNER_LOOP macro
1248 + * to avoid the undefined and unnecessary (uint8 >> 8) operation. */
1249 + while (nbytes-- > 0)
1250 + crc = crc8_table[(crc ^ *pdata++) & 0xff];
1255 +/*******************************************************************************
1258 + * Computes a crc16 over the input data using the polynomial:
1260 + * x^16 + x^12 +x^5 + 1
1262 + * The caller provides the initial value (either CRC16_INIT_VALUE
1263 + * or the previous returned value) to allow for processing of
1264 + * discontiguous blocks of data. When generating the CRC the
1265 + * caller is responsible for complementing the final return value
1266 + * and inserting it into the byte stream. When checking, a final
1267 + * return value of CRC16_GOOD_VALUE indicates a valid CRC.
1269 + * Reference: Dallas Semiconductor Application Note 27
1270 + * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms",
1271 + * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd.,
1272 + * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt
1274 + ******************************************************************************/
1276 +static uint16 crc16_table[256] = {
1277 + 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
1278 + 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
1279 + 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
1280 + 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
1281 + 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
1282 + 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
1283 + 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
1284 + 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
1285 + 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
1286 + 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
1287 + 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
1288 + 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
1289 + 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
1290 + 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
1291 + 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
1292 + 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
1293 + 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
1294 + 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
1295 + 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
1296 + 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
1297 + 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
1298 + 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
1299 + 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
1300 + 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
1301 + 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
1302 + 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
1303 + 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
1304 + 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
1305 + 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
1306 + 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
1307 + 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
1308 + 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
1313 + uint8 *pdata, /* pointer to array of data to process */
1314 + uint nbytes, /* number of input data bytes to process */
1315 + uint16 crc /* either CRC16_INIT_VALUE or previous return value */
1318 + while (nbytes-- > 0)
1319 + CRC_INNER_LOOP(16, crc, *pdata++);
1323 +static uint32 crc32_table[256] = {
1324 + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
1325 + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
1326 + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
1327 + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
1328 + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
1329 + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
1330 + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
1331 + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
1332 + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
1333 + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
1334 + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
1335 + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
1336 + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
1337 + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
1338 + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
1339 + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
1340 + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
1341 + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
1342 + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
1343 + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
1344 + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
1345 + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
1346 + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
1347 + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
1348 + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
1349 + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
1350 + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
1351 + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
1352 + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
1353 + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
1354 + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
1355 + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
1356 + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
1357 + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
1358 + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
1359 + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
1360 + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
1361 + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
1362 + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
1363 + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
1364 + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
1365 + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
1366 + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
1367 + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
1368 + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
1369 + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
1370 + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
1371 + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
1372 + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
1373 + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
1374 + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
1375 + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
1376 + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
1377 + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
1378 + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
1379 + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
1380 + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
1381 + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
1382 + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
1383 + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
1384 + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
1385 + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
1386 + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
1387 + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
1392 + uint8 *pdata, /* pointer to array of data to process */
1393 + uint nbytes, /* number of input data bytes to process */
1394 + uint32 crc /* either CRC32_INIT_VALUE or previous return value */
1400 + ulong *tptr = (ulong *)tmp;
1402 + /* in case the beginning of the buffer isn't aligned */
1403 + pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc);
1404 + nbytes -= (pend - pdata);
1405 + while (pdata < pend)
1406 + CRC_INNER_LOOP(32, crc, *pdata++);
1408 + /* handle bulk of data as 32-bit words */
1409 + pend = pdata + (nbytes & 0xfffffffc);
1410 + while (pdata < pend) {
1411 + *tptr = *((ulong *)pdata)++;
1412 + CRC_INNER_LOOP(32, crc, tmp[0]);
1413 + CRC_INNER_LOOP(32, crc, tmp[1]);
1414 + CRC_INNER_LOOP(32, crc, tmp[2]);
1415 + CRC_INNER_LOOP(32, crc, tmp[3]);
1418 + /* 1-3 bytes at end of buffer */
1419 + pend = pdata + (nbytes & 0x03);
1420 + while (pdata < pend)
1421 + CRC_INNER_LOOP(32, crc, *pdata++);
1423 + pend = pdata + nbytes;
1424 + while (pdata < pend)
1425 + CRC_INNER_LOOP(32, crc, *pdata++);
1433 +#define CBUFSIZ (CLEN+4)
1436 +void testcrc32(void)
1442 + uint32 crc32tv[CNBUFS] =
1443 + {0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110};
1445 + ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL);
1447 + /* step through all possible alignments */
1448 + for (l=0;l<=4;l++) {
1449 + for (j=0; j<CNBUFS; j++) {
1451 + for (k=0; k<len[j]; k++)
1452 + *(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff;
1455 + for (j=0; j<CNBUFS; j++) {
1456 + crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE);
1457 + ASSERT(crcr == crc32tv[j]);
1461 + MFREE(buf, CBUFSIZ*CNBUFS);
1468 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/hnddma.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/hnddma.c
1469 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/hnddma.c 1970-01-01 01:00:00.000000000 +0100
1470 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/hnddma.c 2005-09-16 10:29:18.165593312 +0200
1473 + * Generic Broadcom Home Networking Division (HND) DMA module.
1474 + * This supports the following chips: BCM42xx, 44xx, 47xx .
1476 + * Copyright 2001-2003, Broadcom Corporation
1477 + * All Rights Reserved.
1479 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
1480 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
1481 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
1482 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
1484 + * $Id: hnddma.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
1487 +#include <typedefs.h>
1489 +#include <bcmendian.h>
1490 +#include <bcmutils.h>
1492 +struct dma_info; /* forward declaration */
1493 +#define di_t struct dma_info
1494 +#include <hnddma.h>
1497 +#define DMA_ERROR(args)
1498 +#define DMA_TRACE(args)
1500 +/* default dma message level(if input msg_level pointer is null in dma_attach()) */
1501 +static uint dma_msg_level = 0;
1504 +#define MAXDD (DMAMAXRINGSZ / sizeof (dmadd_t))
1506 +/* dma engine software state */
1507 +typedef struct dma_info {
1508 + hnddma_t hnddma; /* exported structure */
1509 + uint *msg_level; /* message level pointer */
1511 + char name[MAXNAMEL]; /* callers name for diag msgs */
1512 + void *drv; /* driver handle */
1513 + void *dev; /* device handle */
1514 + dmaregs_t *regs; /* dma engine registers */
1516 + dmadd_t *txd; /* pointer to chip-specific tx descriptor ring */
1517 + uint txin; /* index of next descriptor to reclaim */
1518 + uint txout; /* index of next descriptor to post */
1519 + uint txavail; /* # free tx descriptors */
1520 + void *txp[MAXDD]; /* parallel array of pointers to packets */
1521 + ulong txdpa; /* physical address of descriptor ring */
1522 + uint txdalign; /* #bytes added to alloc'd mem to align txd */
1524 + dmadd_t *rxd; /* pointer to chip-specific rx descriptor ring */
1525 + uint rxin; /* index of next descriptor to reclaim */
1526 + uint rxout; /* index of next descriptor to post */
1527 + void *rxp[MAXDD]; /* parallel array of pointers to packets */
1528 + ulong rxdpa; /* physical address of descriptor ring */
1529 + uint rxdalign; /* #bytes added to alloc'd mem to align rxd */
1532 + uint ntxd; /* # tx descriptors */
1533 + uint nrxd; /* # rx descriptors */
1534 + uint rxbufsize; /* rx buffer size in bytes */
1535 + uint nrxpost; /* # rx buffers to keep posted */
1536 + uint rxoffset; /* rxcontrol offset */
1537 + uint ddoffset; /* add to get dma address of descriptor ring */
1538 + uint dataoffset; /* add to get dma address of data buffer */
1541 +/* descriptor bumping macros */
1542 +#define NEXTTXD(i) ((i + 1) & (di->ntxd - 1))
1543 +#define PREVTXD(i) ((i - 1) & (di->ntxd - 1))
1544 +#define NEXTRXD(i) ((i + 1) & (di->nrxd - 1))
1545 +#define NTXDACTIVE(h, t) ((t - h) & (di->ntxd - 1))
1546 +#define NRXDACTIVE(h, t) ((t - h) & (di->nrxd - 1))
1548 +/* macros to convert between byte offsets and indexes */
1549 +#define B2I(bytes) ((bytes) / sizeof (dmadd_t))
1550 +#define I2B(index) ((index) * sizeof (dmadd_t))
1553 +dma_attach(void *drv, void *dev, char *name, dmaregs_t *regs, uint ntxd, uint nrxd,
1554 + uint rxbufsize, uint nrxpost, uint rxoffset, uint ddoffset, uint dataoffset, uint *msg_level)
1559 + ASSERT(ntxd <= MAXDD);
1560 + ASSERT(nrxd <= MAXDD);
1562 + /* allocate private info structure */
1563 + if ((di = MALLOC(sizeof (dma_info_t))) == NULL)
1565 + bzero((char*)di, sizeof (dma_info_t));
1567 + /* set message level */
1568 + di->msg_level = msg_level ? msg_level : &dma_msg_level;
1570 + DMA_TRACE(("%s: dma_attach: drv 0x%x dev 0x%x regs 0x%x ntxd %d nrxd %d rxbufsize %d nrxpost %d rxoffset %d ddoffset 0x%x dataoffset 0x%x\n", name, (uint)drv, (uint)dev, (uint)regs, ntxd, nrxd, rxbufsize, nrxpost, rxoffset, ddoffset, dataoffset));
1572 + /* make a private copy of our callers name */
1573 + strncpy(di->name, name, MAXNAMEL);
1574 + di->name[MAXNAMEL-1] = '\0';
1580 + /* allocate transmit descriptor ring */
1582 + if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->txdpa)) == NULL)
1584 + di->txd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN);
1585 + di->txdalign = ((uint)di->txd - (uint)va);
1586 + di->txdpa = di->txdpa + di->txdalign;
1587 + ASSERT(ISALIGNED(di->txd, DMARINGALIGN));
1590 + /* allocate receive descriptor ring */
1592 + if ((va = DMA_ALLOC_CONSISTENT(dev, (DMAMAXRINGSZ + DMARINGALIGN), &di->rxdpa)) == NULL)
1594 + di->rxd = (dmadd_t*) ROUNDUP(va, DMARINGALIGN);
1595 + di->rxdalign = ((uint)di->rxd - (uint)va);
1596 + di->rxdpa = di->rxdpa + di->rxdalign;
1597 + ASSERT(ISALIGNED(di->rxd, DMARINGALIGN));
1600 + /* save tunables */
1603 + di->rxbufsize = rxbufsize;
1604 + di->nrxpost = nrxpost;
1605 + di->rxoffset = rxoffset;
1606 + di->ddoffset = ddoffset;
1607 + di->dataoffset = dataoffset;
1609 + return ((void*)di);
1612 + dma_detach((void*)di);
1616 +/* may be called with core in reset */
1618 +dma_detach(dma_info_t *di)
1623 + DMA_TRACE(("%s: dma_detach\n", di->name));
1625 + /* shouldn't be here if descriptors are unreclaimed */
1626 + ASSERT(di->txin == di->txout);
1627 + ASSERT(di->rxin == di->rxout);
1629 + /* free dma descriptor rings */
1631 + DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->txd - di->txdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->txdpa);
1633 + DMA_FREE_CONSISTENT(di->dev, (void *)((uint)di->rxd - di->rxdalign), (DMAMAXRINGSZ + DMARINGALIGN), di->rxdpa);
1635 + /* free our private info structure */
1636 + MFREE((void*)di, sizeof (dma_info_t));
1641 +dma_txreset(dma_info_t *di)
1645 + DMA_TRACE(("%s: dma_txreset\n", di->name));
1647 + /* suspend tx DMA first */
1648 + W_REG(&di->regs->xmtcontrol, XC_SE);
1649 + SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED &&
1650 + status != XS_XS_IDLE &&
1651 + status != XS_XS_STOPPED,
1654 + W_REG(&di->regs->xmtcontrol, 0);
1655 + SPINWAIT((status = (R_REG(&di->regs->xmtstatus) & XS_XS_MASK)) != XS_XS_DISABLED,
1658 + if (status != XS_XS_DISABLED) {
1659 + DMA_ERROR(("%s: dma_txreset: dma cannot be stopped\n", di->name));
1662 + /* wait for the last transaction to complete */
1667 +dma_rxreset(dma_info_t *di)
1671 + DMA_TRACE(("%s: dma_rxreset\n", di->name));
1673 + W_REG(&di->regs->rcvcontrol, 0);
1674 + SPINWAIT((status = (R_REG(&di->regs->rcvstatus) & RS_RS_MASK)) != RS_RS_DISABLED,
1677 + if (status != RS_RS_DISABLED) {
1678 + DMA_ERROR(("%s: dma_rxreset: dma cannot be stopped\n", di->name));
1683 +dma_txinit(dma_info_t *di)
1685 + DMA_TRACE(("%s: dma_txinit\n", di->name));
1687 + di->txin = di->txout = 0;
1688 + di->txavail = di->ntxd - 1;
1690 + /* clear tx descriptor ring */
1691 + BZERO_SM((void*)di->txd, (di->ntxd * sizeof (dmadd_t)));
1693 + W_REG(&di->regs->xmtcontrol, XC_XE);
1694 + W_REG(&di->regs->xmtaddr, (di->txdpa + di->ddoffset));
1698 +dma_txenabled(dma_info_t *di)
1702 + /* If the chip is dead, it is not enabled :-) */
1703 + xc = R_REG(&di->regs->xmtcontrol);
1704 + return ((xc != 0xffffffff) && (xc & XC_XE));
1708 +dma_txsuspend(dma_info_t *di)
1710 + DMA_TRACE(("%s: dma_txsuspend\n", di->name));
1711 + OR_REG(&di->regs->xmtcontrol, XC_SE);
1715 +dma_txresume(dma_info_t *di)
1717 + DMA_TRACE(("%s: dma_txresume\n", di->name));
1718 + AND_REG(&di->regs->xmtcontrol, ~XC_SE);
1722 +dma_txsuspended(dma_info_t *di)
1727 + xc = R_REG(&di->regs->xmtcontrol);
1729 + xs = R_REG(&di->regs->xmtstatus);
1730 + return ((xs & XS_XS_MASK) == XS_XS_IDLE);
1736 +dma_txstopped(dma_info_t *di)
1738 + return ((R_REG(&di->regs->xmtstatus) & XS_XS_MASK) == XS_XS_STOPPED);
1742 +dma_rxstopped(dma_info_t *di)
1744 + return ((R_REG(&di->regs->rcvstatus) & RS_RS_MASK) == RS_RS_STOPPED);
1748 +dma_fifoloopbackenable(dma_info_t *di)
1750 + DMA_TRACE(("%s: dma_fifoloopbackenable\n", di->name));
1751 + OR_REG(&di->regs->xmtcontrol, XC_LE);
1755 +dma_rxinit(dma_info_t *di)
1757 + DMA_TRACE(("%s: dma_rxinit\n", di->name));
1759 + di->rxin = di->rxout = 0;
1761 + /* clear rx descriptor ring */
1762 + BZERO_SM((void*)di->rxd, (di->nrxd * sizeof (dmadd_t)));
1765 + W_REG(&di->regs->rcvaddr, (di->rxdpa + di->ddoffset));
1769 +dma_rxenable(dma_info_t *di)
1771 + DMA_TRACE(("%s: dma_rxenable\n", di->name));
1772 + W_REG(&di->regs->rcvcontrol, ((di->rxoffset << RC_RO_SHIFT) | RC_RE));
1776 +dma_rxenabled(dma_info_t *di)
1780 + rc = R_REG(&di->regs->rcvcontrol);
1781 + return ((rc != 0xffffffff) && (rc & RC_RE));
1785 + * The BCM47XX family supports full 32bit dma engine buffer addressing so
1786 + * dma buffers can cross 4 Kbyte page boundaries.
1789 +dma_txfast(dma_info_t *di, void *p0, uint32 coreflags)
1798 + DMA_TRACE(("%s: dma_txfast\n", di->name));
1800 + txout = di->txout;
1804 + * Walk the chain of packet buffers
1805 + * allocating and initializing transmit descriptor entries.
1807 + for (p = p0; p; p = next) {
1808 + data = PKTDATA(di->drv, p);
1809 + len = PKTLEN(di->drv, p);
1810 + next = PKTNEXT(di->drv, p);
1812 + /* return nonzero if out of tx descriptors */
1813 + if (NEXTTXD(txout) == di->txin)
1819 + /* get physical address of buffer start */
1820 + pa = (uint32) DMA_MAP(di->dev, data, len, DMA_TX, p);
1822 + /* build the descriptor control value */
1823 + ctrl = len & CTRL_BC_MASK;
1825 + ctrl |= coreflags;
1830 + ctrl |= (CTRL_IOC | CTRL_EOF);
1831 + if (txout == (di->ntxd - 1))
1834 + /* init the tx descriptor */
1835 + W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl));
1836 + W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset));
1838 + ASSERT(di->txp[txout] == NULL);
1840 + txout = NEXTTXD(txout);
1843 + /* if last txd eof not set, fix it */
1844 + if (!(ctrl & CTRL_EOF))
1845 + W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF));
1847 + /* save the packet */
1848 + di->txp[PREVTXD(txout)] = p0;
1850 + /* bump the tx descriptor index */
1851 + di->txout = txout;
1853 + /* kick the chip */
1854 + W_REG(&di->regs->xmtptr, I2B(txout));
1856 + /* tx flow control */
1857 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
1862 + DMA_ERROR(("%s: dma_txfast: out of txds\n", di->name));
1863 + PKTFREE(di->drv, p0, TRUE);
1865 + di->hnddma.txnobuf++;
1869 +#define PAGESZ 4096
1870 +#define PAGEBASE(x) ((uint)(x) & ~4095)
1873 + * Just like above except go through the extra effort of splitting
1874 + * buffers that cross 4Kbyte boundaries into multiple tx descriptors.
1877 +dma_tx(dma_info_t *di, void *p0, uint32 coreflags)
1882 + uchar *page, *start, *end;
1887 + DMA_TRACE(("%s: dma_tx\n", di->name));
1889 + txout = di->txout;
1893 + * Walk the chain of packet buffers
1894 + * splitting those that cross 4 Kbyte boundaries
1895 + * allocating and initializing transmit descriptor entries.
1897 + for (p = p0; p; p = next) {
1898 + data = PKTDATA(di->drv, p);
1899 + plen = PKTLEN(di->drv, p);
1900 + next = PKTNEXT(di->drv, p);
1905 + for (page = (uchar*)PAGEBASE(data);
1906 + page <= (uchar*)PAGEBASE(data + plen - 1);
1909 + /* return nonzero if out of tx descriptors */
1910 + if (NEXTTXD(txout) == di->txin)
1913 + start = (page == (uchar*)PAGEBASE(data))? data: page;
1914 + end = (page == (uchar*)PAGEBASE(data + plen))?
1915 + (data + plen): (page + PAGESZ);
1916 + len = end - start;
1918 + /* build the descriptor control value */
1919 + ctrl = len & CTRL_BC_MASK;
1921 + ctrl |= coreflags;
1923 + if ((p == p0) && (start == data))
1925 + if ((next == NULL) && (end == (data + plen)))
1926 + ctrl |= (CTRL_IOC | CTRL_EOF);
1927 + if (txout == (di->ntxd - 1))
1930 + /* get physical address of buffer start */
1931 + pa = (uint32) DMA_MAP(di->dev, start, len, DMA_TX, p);
1933 + /* init the tx descriptor */
1934 + W_SM(&di->txd[txout].ctrl, BUS_SWAP32(ctrl));
1935 + W_SM(&di->txd[txout].addr, BUS_SWAP32(pa + di->dataoffset));
1937 + ASSERT(di->txp[txout] == NULL);
1939 + txout = NEXTTXD(txout);
1943 + /* if last txd eof not set, fix it */
1944 + if (!(ctrl & CTRL_EOF))
1945 + W_SM(&di->txd[PREVTXD(txout)].ctrl, BUS_SWAP32(ctrl | CTRL_IOC | CTRL_EOF));
1947 + /* save the packet */
1948 + di->txp[PREVTXD(txout)] = p0;
1950 + /* bump the tx descriptor index */
1951 + di->txout = txout;
1953 + /* kick the chip */
1954 + W_REG(&di->regs->xmtptr, I2B(txout));
1956 + /* tx flow control */
1957 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
1962 + DMA_ERROR(("%s: dma_tx: out of txds\n", di->name));
1963 + PKTFREE(di->drv, p0, TRUE);
1965 + di->hnddma.txnobuf++;
1969 +/* returns a pointer to the next frame received, or NULL if there are no more */
1971 +dma_rx(dma_info_t *di)
1977 + while ((p = dma_getnextrxp(di, FALSE))) {
1978 + /* skip giant packets which span multiple rx descriptors */
1979 + if (skiplen > 0) {
1980 + skiplen -= di->rxbufsize;
1983 + PKTFREE(di->drv, p, FALSE);
1987 + len = ltoh16(*(uint16*)(PKTDATA(di->drv, p)));
1988 + DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
1990 + /* bad frame length check */
1991 + if (len > (di->rxbufsize - di->rxoffset)) {
1992 + DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n", di->name, len));
1994 + skiplen = len - (di->rxbufsize - di->rxoffset);
1995 + PKTFREE(di->drv, p, FALSE);
1996 + di->hnddma.rxgiants++;
2000 + /* set actual length */
2001 + PKTSETLEN(di->drv, p, (di->rxoffset + len));
2009 +/* post receive buffers */
2011 +dma_rxfill(dma_info_t *di)
2022 + * Determine how many receive buffers we're lacking
2023 + * from the full complement, allocate, initialize,
2024 + * and post them, then update the chip rx lastdscr.
2028 + rxout = di->rxout;
2029 + rxbufsize = di->rxbufsize;
2031 + n = di->nrxpost - NRXDACTIVE(rxin, rxout);
2033 + DMA_TRACE(("%s: dma_rxfill: post %d\n", di->name, n));
2035 + for (i = 0; i < n; i++) {
2036 + if ((p = PKTGET(di->drv, rxbufsize, FALSE)) == NULL) {
2037 + DMA_ERROR(("%s: dma_rxfill: out of rxbufs\n", di->name));
2038 + di->hnddma.rxnobuf++;
2042 + *(uint32*)(OSL_UNCACHED(PKTDATA(di->drv, p))) = 0;
2044 + pa = (uint32) DMA_MAP(di->dev, PKTDATA(di->drv, p), rxbufsize, DMA_RX, p);
2045 + ASSERT(ISALIGNED(pa, 4));
2047 + /* save the free packet pointer */
2048 + ASSERT(di->rxp[rxout] == NULL);
2049 + di->rxp[rxout] = p;
2051 + /* prep the descriptor control value */
2053 + if (rxout == (di->nrxd - 1))
2056 + /* init the rx descriptor */
2057 + W_SM(&di->rxd[rxout].ctrl, BUS_SWAP32(ctrl));
2058 + W_SM(&di->rxd[rxout].addr, BUS_SWAP32(pa + di->dataoffset));
2060 + rxout = NEXTRXD(rxout);
2063 + di->rxout = rxout;
2065 + /* update the chip lastdscr pointer */
2066 + W_REG(&di->regs->rcvptr, I2B(rxout));
2070 +dma_txreclaim(dma_info_t *di, bool forceall)
2074 + DMA_TRACE(("%s: dma_txreclaim %s\n", di->name, forceall ? "all" : ""));
2076 + while ((p = dma_getnexttxp(di, forceall)))
2077 + PKTFREE(di->drv, p, TRUE);
2081 + * Reclaim next completed txd (txds if using chained buffers) and
2082 + * return associated packet.
2083 + * If 'force' is true, reclaim txd(s) and return associated packet
2084 + * regardless of the value of the hardware "curr" pointer.
2087 +dma_getnexttxp(dma_info_t *di, bool forceall)
2089 + uint start, end, i;
2092 + DMA_TRACE(("%s: dma_getnexttxp %s\n", di->name, forceall ? "all" : ""));
2100 + end = B2I(R_REG(&di->regs->xmtstatus) & XS_CD_MASK);
2102 + if ((start == 0) && (end > di->txout))
2105 + for (i = start; i != end && !txp; i = NEXTTXD(i)) {
2106 + DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->txd[i].addr)) - di->dataoffset),
2107 + (BUS_SWAP32(R_SM(&di->txd[i].ctrl)) & CTRL_BC_MASK), DMA_TX, di->txp[i]);
2108 + W_SM(&di->txd[i].addr, 0xdeadbeef);
2110 + di->txp[i] = NULL;
2115 + /* tx flow control */
2116 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
2122 + DMA_ERROR(("dma_getnexttxp: bogus curr: start %d end %d txout %d force %d\n",
2123 + start, end, di->txout, forceall));
2129 +dma_rxreclaim(dma_info_t *di)
2133 + DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
2135 + while ((p = dma_getnextrxp(di, TRUE)))
2136 + PKTFREE(di->drv, p, FALSE);
2140 +dma_getnextrxp(dma_info_t *di, bool forceall)
2145 + /* if forcing, dma engine must be disabled */
2146 + ASSERT(!forceall || !dma_rxenabled(di));
2150 + /* return if no packets posted */
2151 + if (i == di->rxout)
2154 + /* ignore curr if forceall */
2155 + if (!forceall && (i == B2I(R_REG(&di->regs->rcvstatus) & RS_CD_MASK)))
2158 + /* get the packet pointer that corresponds to the rx descriptor */
2161 + di->rxp[i] = NULL;
2163 + /* clear this packet from the descriptor ring */
2164 + DMA_UNMAP(di->dev, (BUS_SWAP32(R_SM(&di->rxd[i].addr)) - di->dataoffset),
2165 + di->rxbufsize, DMA_RX, rxp);
2166 + W_SM(&di->rxd[i].addr, 0xdeadbeef);
2168 + di->rxin = NEXTRXD(i);
2174 +dma_dumptx(dma_info_t *di, char *buf)
2176 + buf += sprintf(buf, "txd 0x%lx txdpa 0x%lx txp 0x%lx txin %d txout %d txavail %d\n",
2177 + (ulong)di->txd, di->txdpa, (ulong)di->txp, di->txin, di->txout, di->txavail);
2178 + buf += sprintf(buf, "xmtcontrol 0x%x xmtaddr 0x%x xmtptr 0x%x xmtstatus 0x%x\n",
2179 + R_REG(&di->regs->xmtcontrol),
2180 + R_REG(&di->regs->xmtaddr),
2181 + R_REG(&di->regs->xmtptr),
2182 + R_REG(&di->regs->xmtstatus));
2187 +dma_dumprx(dma_info_t *di, char *buf)
2189 + buf += sprintf(buf, "rxd 0x%lx rxdpa 0x%lx rxp 0x%lx rxin %d rxout %d\n",
2190 + (ulong)di->rxd, di->rxdpa, (ulong)di->rxp, di->rxin, di->rxout);
2191 + buf += sprintf(buf, "rcvcontrol 0x%x rcvaddr 0x%x rcvptr 0x%x rcvstatus 0x%x\n",
2192 + R_REG(&di->regs->rcvcontrol),
2193 + R_REG(&di->regs->rcvaddr),
2194 + R_REG(&di->regs->rcvptr),
2195 + R_REG(&di->regs->rcvstatus));
2200 +dma_dump(dma_info_t *di, char *buf)
2202 + buf = dma_dumptx(di, buf);
2203 + buf = dma_dumprx(di, buf);
2208 +dma_getvar(dma_info_t *di, char *name)
2210 + if (!strcmp(name, "&txavail"))
2211 + return ((uint) &di->txavail);
2219 +dma_txblock(dma_info_t *di)
2225 +dma_txunblock(dma_info_t *di)
2227 + di->txavail = di->ntxd - NTXDACTIVE(di->txin, di->txout) - 1;
2231 +dma_txactive(dma_info_t *di)
2233 + return (NTXDACTIVE(di->txin, di->txout));
2235 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/linux_osl.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/linux_osl.c
2236 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/linux_osl.c 1970-01-01 01:00:00.000000000 +0100
2237 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/linux_osl.c 2005-09-16 10:29:18.166593160 +0200
2240 + * Linux OS Independent Layer
2242 + * Copyright 2001-2003, Broadcom Corporation
2243 + * All Rights Reserved.
2245 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
2246 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
2247 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
2248 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
2250 + * $Id: linux_osl.c,v 1.2 2005/02/28 13:34:25 jolt Exp $
2255 +#include <typedefs.h>
2256 +#include <bcmendian.h>
2257 +#include <linuxver.h>
2258 +#include <linux_osl.h>
2259 +#include <bcmutils.h>
2260 +#include <linux/delay.h>
2262 +#include <asm/paccess.h>
2264 +#include <pcicfg.h>
2266 +#define PCI_CFG_RETRY 10
2269 +osl_pktget(void *drv, uint len, bool send)
2271 + struct sk_buff *skb;
2273 + if ((skb = dev_alloc_skb(len)) == NULL)
2276 + skb_put(skb, len);
2278 + /* ensure the cookie field is cleared */
2279 + PKTSETCOOKIE(skb, NULL);
2281 + return ((void*) skb);
2285 +osl_pktfree(void *p)
2287 + struct sk_buff *skb, *nskb;
2289 + skb = (struct sk_buff*) p;
2291 + /* perversion: we use skb->next to chain multi-skb packets */
2295 + if (skb->destructor) {
2296 + /* cannot kfree_skb() on hard IRQ (net/core/skbuff.c) if destructor exists */
2297 + dev_kfree_skb_any(skb);
2299 + /* can free immediately (even in_irq()) if destructor does not exist */
2300 + dev_kfree_skb(skb);
2307 +osl_pci_read_config(void *loc, uint offset, uint size)
2309 + struct pci_dev *pdev;
2311 + uint retry=PCI_CFG_RETRY;
2313 + /* only 4byte access supported */
2314 + ASSERT(size == 4);
2316 + pdev = (struct pci_dev*)loc;
2318 + pci_read_config_dword(pdev, offset, &val);
2319 + if (val != 0xffffffff)
2321 + } while (retry--);
2328 +osl_pci_write_config(void *loc, uint offset, uint size, uint val)
2330 + struct pci_dev *pdev;
2331 + uint retry=PCI_CFG_RETRY;
2333 + /* only 4byte access supported */
2334 + ASSERT(size == 4);
2336 + pdev = (struct pci_dev*)loc;
2339 + pci_write_config_dword(pdev, offset, val);
2340 + if (offset!=PCI_BAR0_WIN)
2342 + if (osl_pci_read_config(loc,offset,size) == val)
2344 + } while (retry--);
2349 +osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size)
2355 +osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size)
2361 +osl_assert(char *exp, char *file, int line)
2363 + char tempbuf[255];
2365 + sprintf(tempbuf, "assertion \"%s\" failed: file \"%s\", line %d\n", exp, file, line);
2370 + * BINOSL selects the slightly slower function-call-based binary compatible osl.
2375 +osl_printf(const char *format, ...)
2381 + /* sprintf into a local buffer because there *is* no "vprintk()".. */
2382 + va_start(args, format);
2383 + len = vsprintf(buf, format, args);
2386 + if (len > sizeof (buf)) {
2387 + printk("osl_printf: buffer overrun\n");
2391 + return (printk(buf));
2395 +osl_sprintf(char *buf, const char *format, ...)
2400 + va_start(args, format);
2401 + rc = vsprintf(buf, format, args);
2407 +osl_strcmp(const char *s1, const char *s2)
2409 + return (strcmp(s1, s2));
2413 +osl_strncmp(const char *s1, const char *s2, uint n)
2415 + return (strncmp(s1, s2, n));
2419 +osl_strlen(char *s)
2421 + return (strlen(s));
2425 +osl_strcpy(char *d, const char *s)
2427 + return (strcpy(d, s));
2431 +osl_strncpy(char *d, const char *s, uint n)
2433 + return (strncpy(d, s, n));
2437 +bcopy(const void *src, void *dst, int len)
2439 + memcpy(dst, src, len);
2443 +bcmp(const void *b1, const void *b2, int len)
2445 + return (memcmp(b1, b2, len));
2449 +bzero(void *b, int len)
2451 + memset(b, '\0', len);
2455 +osl_malloc(uint size)
2457 + return (kmalloc(size, GFP_ATOMIC));
2461 +osl_mfree(void *addr, uint size)
2467 +osl_readl(volatile uint32 *r)
2469 + return (readl(r));
2473 +osl_readw(volatile uint16 *r)
2475 + return (readw(r));
2479 +osl_readb(volatile uint8 *r)
2481 + return (readb(r));
2485 +osl_writel(uint32 v, volatile uint32 *r)
2491 +osl_writew(uint16 v, volatile uint16 *r)
2497 +osl_writeb(uint8 v, volatile uint8 *r)
2503 +osl_uncached(void *va)
2506 + return ((void*)KSEG1ADDR(va));
2508 + return ((void*)va);
2513 +osl_getcycles(void)
2518 + cycles = read_c0_count() * 2;
2519 +#elif defined(__i386__)
2528 +osl_reg_map(uint32 pa, uint size)
2530 + return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
2534 +osl_reg_unmap(void *va)
2540 +osl_busprobe(uint32 *val, uint32 addr)
2543 + return get_dbe(*val, (uint32*)addr);
2545 + *val = readl(addr);
2551 +osl_dma_alloc_consistent(void *dev, uint size, ulong *pap)
2553 + return (pci_alloc_consistent((struct pci_dev*)dev, size, (dma_addr_t*)pap));
2557 +osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa)
2559 + pci_free_consistent((struct pci_dev*)dev, size, va, (dma_addr_t)pa);
2563 +osl_dma_map(void *dev, void *va, uint size, int direction)
2567 + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
2568 + return (pci_map_single(dev, va, size, dir));
2572 +osl_dma_unmap(void *dev, uint pa, uint size, int direction)
2576 + dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE;
2577 + pci_unmap_single(dev, (uint32)pa, size, dir);
2581 +osl_delay(uint usec)
2587 +osl_pktdata(void *drv, void *skb)
2589 + return (((struct sk_buff*)skb)->data);
2593 +osl_pktlen(void *drv, void *skb)
2595 + return (((struct sk_buff*)skb)->len);
2599 +osl_pktnext(void *drv, void *skb)
2601 + return (((struct sk_buff*)skb)->next);
2605 +osl_pktsetnext(void *skb, void *x)
2607 + ((struct sk_buff*)skb)->next = (struct sk_buff*)x;
2611 +osl_pktsetlen(void *drv, void *skb, uint len)
2613 + __skb_trim((struct sk_buff*)skb, len);
2617 +osl_pktpush(void *drv, void *skb, int bytes)
2619 + return (skb_push((struct sk_buff*)skb, bytes));
2623 +osl_pktpull(void *drv, void *skb, int bytes)
2625 + return (skb_pull((struct sk_buff*)skb, bytes));
2629 +osl_pktdup(void *drv, void *skb)
2631 + return (skb_clone((struct sk_buff*)skb, GFP_ATOMIC));
2635 +osl_pktcookie(void *skb)
2637 + return ((void*)((struct sk_buff*)skb)->csum);
2641 +osl_pktsetcookie(void *skb, void *x)
2643 + ((struct sk_buff*)skb)->csum = (uint)x;
2647 +osl_pktlink(void *skb)
2649 + return (((struct sk_buff*)skb)->prev);
2653 +osl_pktsetlink(void *skb, void *x)
2655 + ((struct sk_buff*)skb)->prev = (struct sk_buff*)x;
2659 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbmips.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbmips.c
2660 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbmips.c 1970-01-01 01:00:00.000000000 +0100
2661 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbmips.c 2005-09-16 10:29:18.168592856 +0200
2664 + * BCM47XX Sonics SiliconBackplane MIPS core routines
2666 + * Copyright 2001-2003, Broadcom Corporation
2667 + * All Rights Reserved.
2669 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
2670 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
2671 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
2672 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
2674 + * $Id: sbmips.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
2677 +#include <typedefs.h>
2679 +#include <sbutils.h>
2680 +#include <bcmdevs.h>
2681 +#include <bcmnvram.h>
2682 +#include <bcmutils.h>
2683 +#include <hndmips.h>
2684 +#include <sbconfig.h>
2685 +#include <sbextif.h>
2686 +#include <sbchipc.h>
2687 +#include <sbmemc.h>
2690 + * Memory segments (32bit kernel mode addresses)
2697 +#define KUSEG 0x00000000
2698 +#define KSEG0 0x80000000
2699 +#define KSEG1 0xa0000000
2700 +#define KSEG2 0xc0000000
2701 +#define KSEG3 0xe0000000
2704 + * Map an address to a certain kernel segment
2710 +#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
2711 +#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
2712 +#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
2713 +#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
2716 + * The following macros are especially useful for __asm__
2717 + * inline assembler.
2720 +#define __STR(x) #x
2723 +#define STR(x) __STR(x)
2726 +/* *********************************************************************
2728 + ********************************************************************* */
2730 +#define C0_INX 0 /* CP0: TLB Index */
2731 +#define C0_RAND 1 /* CP0: TLB Random */
2732 +#define C0_TLBLO0 2 /* CP0: TLB EntryLo0 */
2733 +#define C0_TLBLO C0_TLBLO0 /* CP0: TLB EntryLo0 */
2734 +#define C0_TLBLO1 3 /* CP0: TLB EntryLo1 */
2735 +#define C0_CTEXT 4 /* CP0: Context */
2736 +#define C0_PGMASK 5 /* CP0: TLB PageMask */
2737 +#define C0_WIRED 6 /* CP0: TLB Wired */
2738 +#define C0_BADVADDR 8 /* CP0: Bad Virtual Address */
2739 +#define C0_COUNT 9 /* CP0: Count */
2740 +#define C0_TLBHI 10 /* CP0: TLB EntryHi */
2741 +#define C0_COMPARE 11 /* CP0: Compare */
2742 +#define C0_SR 12 /* CP0: Processor Status */
2743 +#define C0_STATUS C0_SR /* CP0: Processor Status */
2744 +#define C0_CAUSE 13 /* CP0: Exception Cause */
2745 +#define C0_EPC 14 /* CP0: Exception PC */
2746 +#define C0_PRID 15 /* CP0: Processor Revision Indentifier */
2747 +#define C0_CONFIG 16 /* CP0: Config */
2748 +#define C0_LLADDR 17 /* CP0: LLAddr */
2749 +#define C0_WATCHLO 18 /* CP0: WatchpointLo */
2750 +#define C0_WATCHHI 19 /* CP0: WatchpointHi */
2751 +#define C0_XCTEXT 20 /* CP0: XContext */
2752 +#define C0_DIAGNOSTIC 22 /* CP0: Diagnostic */
2753 +#define C0_BROADCOM C0_DIAGNOSTIC /* CP0: Broadcom Register */
2754 +#define C0_ECC 26 /* CP0: ECC */
2755 +#define C0_CACHEERR 27 /* CP0: CacheErr */
2756 +#define C0_TAGLO 28 /* CP0: TagLo */
2757 +#define C0_TAGHI 29 /* CP0: TagHi */
2758 +#define C0_ERREPC 30 /* CP0: ErrorEPC */
2761 + * Macros to access the system control coprocessor
2764 +#define MFC0(source, sel) \
2767 + __asm__ __volatile__( \
2768 + ".set\tnoreorder\n\t" \
2769 + ".set\tnoat\n\t" \
2770 + ".word\t"STR(0x40010000 | ((source)<<11) | (sel))"\n\t" \
2771 + "move\t%0,$1\n\t" \
2780 +#define MTC0(source, sel, value) \
2782 + __asm__ __volatile__( \
2783 + ".set\tnoreorder\n\t" \
2784 + ".set\tnoat\n\t" \
2785 + "move\t$1,%z0\n\t" \
2786 + ".word\t"STR(0x40810000 | ((source)<<11) | (sel))"\n\t" \
2795 + * R4x00 interrupt enable / cause bits
2805 +#define IE_SW0 (1<< 8)
2806 +#define IE_SW1 (1<< 9)
2807 +#define IE_IRQ0 (1<<10)
2808 +#define IE_IRQ1 (1<<11)
2809 +#define IE_IRQ2 (1<<12)
2810 +#define IE_IRQ3 (1<<13)
2811 +#define IE_IRQ4 (1<<14)
2812 +#define IE_IRQ5 (1<<15)
2815 + * Bitfields in the R4xx0 cp0 status register
2817 +#define ST0_IE 0x00000001
2818 +#define ST0_EXL 0x00000002
2819 +#define ST0_ERL 0x00000004
2820 +#define ST0_KSU 0x00000018
2821 +# define KSU_USER 0x00000010
2822 +# define KSU_SUPERVISOR 0x00000008
2823 +# define KSU_KERNEL 0x00000000
2824 +#define ST0_UX 0x00000020
2825 +#define ST0_SX 0x00000040
2826 +#define ST0_KX 0x00000080
2827 +#define ST0_DE 0x00010000
2828 +#define ST0_CE 0x00020000
2831 + * Status register bits available in all MIPS CPUs.
2833 +#define ST0_IM 0x0000ff00
2834 +#define ST0_CH 0x00040000
2835 +#define ST0_SR 0x00100000
2836 +#define ST0_TS 0x00200000
2837 +#define ST0_BEV 0x00400000
2838 +#define ST0_RE 0x02000000
2839 +#define ST0_FR 0x04000000
2840 +#define ST0_CU 0xf0000000
2841 +#define ST0_CU0 0x10000000
2842 +#define ST0_CU1 0x20000000
2843 +#define ST0_CU2 0x40000000
2844 +#define ST0_CU3 0x80000000
2845 +#define ST0_XX 0x80000000 /* MIPS IV naming */
2848 + * Cache Operations
2852 +#define Fill_I 0x14
2855 +#define cache_unroll(base,op) \
2856 + __asm__ __volatile__(" \
2867 + * These are the UART port assignments, expressed as offsets from the base
2868 + * register. These assignments should hold for any serial port based on
2869 + * a 8250, 16450, or 16550(A).
2872 +#define UART_MCR 4 /* Out: Modem Control Register */
2873 +#define UART_MSR 6 /* In: Modem Status Register */
2874 +#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
2877 + * Returns TRUE if an external UART exists at the given base
2881 +serial_exists(uint8 *regs)
2883 + uint8 save_mcr, status1;
2885 + save_mcr = R_REG(®s[UART_MCR]);
2886 + W_REG(®s[UART_MCR], UART_MCR_LOOP | 0x0a);
2887 + status1 = R_REG(®s[UART_MSR]) & 0xf0;
2888 + W_REG(®s[UART_MCR], save_mcr);
2890 + return (status1 == 0x90);
2894 + * Initializes UART access. The callback function will be called once
2898 +sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift))
2905 + if ((regs = sb_setcore(sbh, SB_EXTIF, 0))) {
2906 + extifregs_t *eir = (extifregs_t *) regs;
2909 + /* Determine external UART register base */
2910 + sb = (sbconfig_t *)((ulong) eir + SBCONFIGOFF);
2911 + base = EXTIF_CFGIF_BASE(sb_base(R_REG(&sb->sbadmatch1)));
2913 + /* Determine IRQ */
2914 + irq = sb_irq(sbh);
2916 + /* Disable GPIO interrupt initially */
2917 + W_REG(&eir->gpiointpolarity, 0);
2918 + W_REG(&eir->gpiointmask, 0);
2920 + /* Search for external UARTs */
2922 + for (i = 0; i < 2; i++) {
2923 + regs = (void *) REG_MAP(base + (i * 8), 8);
2924 + if (serial_exists(regs)) {
2925 + /* Set GPIO 1 to be the external UART IRQ */
2926 + W_REG(&eir->gpiointmask, 2);
2928 + add(regs, irq, 13500000, 0);
2932 + /* Add internal UART if enabled */
2933 + if (R_REG(&eir->corecontrol) & CC_UE)
2935 + add((void *) &eir->uartdata, irq, sb_clock(sbh), 2);
2936 + } else if ((regs = sb_setcore(sbh, SB_CC, 0))) {
2937 + chipcregs_t *cc = (chipcregs_t *) regs;
2938 + uint32 rev, cap, pll, baud_base, div;
2940 + /* Determine core revision and capabilities */
2941 + rev = sb_corerev(sbh);
2942 + cap = R_REG(&cc->capabilities);
2943 + pll = cap & CAP_PLL_MASK;
2945 + /* Determine IRQ */
2946 + irq = sb_irq(sbh);
2948 + if (pll == PLL_TYPE1) {
2950 + baud_base = sb_clock_rate(pll,
2951 + R_REG(&cc->clockcontrol_n),
2952 + R_REG(&cc->clockcontrol_m2));
2954 + } else if (rev >= 3) {
2955 + /* Internal backplane clock */
2956 + baud_base = sb_clock_rate(pll,
2957 + R_REG(&cc->clockcontrol_n),
2958 + R_REG(&cc->clockcontrol_sb));
2959 + div = 2; /* Minimum divisor */
2960 + W_REG(&cc->uart_clkdiv, div);
2962 + /* Fixed internal backplane clock */
2963 + baud_base = 88000000;
2967 + /* Clock source depends on strapping if UartClkOverride is unset */
2968 + if ((rev > 0) && ((R_REG(&cc->corecontrol) & CC_UARTCLKO) == 0)) {
2969 + if ((cap & CAP_UCLKSEL) == CAP_UINTCLK) {
2970 + /* Internal divided backplane clock */
2973 + /* Assume external clock of 1.8432 MHz */
2974 + baud_base = 1843200;
2978 + /* Add internal UARTs */
2979 + n = cap & CAP_UARTS_MASK;
2980 + for (i = 0; i < n; i++) {
2981 + /* Register offset changed after revision 0 */
2983 + regs = (void *)((ulong) &cc->uart0data + (i * 256));
2985 + regs = (void *)((ulong) &cc->uart0data + (i * 8));
2988 + add(regs, irq, baud_base, 0);
2993 +/* Returns the SB interrupt flag of the current core. */
3000 + regs = sb_coreregs(sbh);
3001 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
3003 + return (R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK);
3006 +static const uint32 sbips_int_mask[] = {
3014 +static const uint32 sbips_int_shift[] = {
3023 + * Returns the MIPS IRQ assignment of the current core. If unassigned,
3032 + uint32 flag, sbipsflag;
3035 + flag = sb_flag(sbh);
3037 + idx = sb_coreidx(sbh);
3039 + if ((regs = sb_setcore(sbh, SB_MIPS, 0)) ||
3040 + (regs = sb_setcore(sbh, SB_MIPS33, 0))) {
3041 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
3043 + /* sbipsflag specifies which core is routed to interrupts 1 to 4 */
3044 + sbipsflag = R_REG(&sb->sbipsflag);
3045 + for (irq = 1; irq <= 4; irq++) {
3046 + if (((sbipsflag & sbips_int_mask[irq]) >> sbips_int_shift[irq]) == flag)
3053 + sb_setcoreidx(sbh, idx);
3058 +/* Clears the specified MIPS IRQ. */
3060 +sb_clearirq(void *sbh, uint irq)
3065 + if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) &&
3066 + !(regs = sb_setcore(sbh, SB_MIPS33, 0)))
3068 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
3071 + W_REG(&sb->sbintvec, 0);
3073 + OR_REG(&sb->sbipsflag, sbips_int_mask[irq]);
3077 + * Assigns the specified MIPS IRQ to the specified core. Shared MIPS
3078 + * IRQ 0 may be assigned more than once.
3081 +sb_setirq(void *sbh, uint irq, uint coreid, uint coreunit)
3087 + regs = sb_setcore(sbh, coreid, coreunit);
3089 + flag = sb_flag(sbh);
3091 + if (!(regs = sb_setcore(sbh, SB_MIPS, 0)) &&
3092 + !(regs = sb_setcore(sbh, SB_MIPS33, 0)))
3094 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
3097 + OR_REG(&sb->sbintvec, 1 << flag);
3099 + flag <<= sbips_int_shift[irq];
3100 + ASSERT(!(flag & ~sbips_int_mask[irq]));
3101 + flag |= R_REG(&sb->sbipsflag) & ~sbips_int_mask[irq];
3102 + W_REG(&sb->sbipsflag, flag);
3107 + * Initializes clocks and interrupts. SB and NVRAM access must be
3108 + * initialized prior to calling.
3111 +sb_mips_init(void *sbh)
3113 + ulong hz, ns, tmp;
3119 + /* Figure out current SB clock speed */
3120 + if ((hz = sb_clock(sbh)) == 0)
3122 + ns = 1000000000 / hz;
3124 + /* Setup external interface timing */
3125 + if ((eir = sb_setcore(sbh, SB_EXTIF, 0))) {
3126 + /* Initialize extif so we can get to the LEDs and external UART */
3127 + W_REG(&eir->prog_config, CF_EN);
3129 + /* Set timing for the flash */
3130 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
3131 + tmp = tmp | (CEIL(40, ns) << FW_W1_SHIFT); /* W1 = 40nS */
3132 + tmp = tmp | CEIL(120, ns); /* W0 = 120nS */
3133 + W_REG(&eir->prog_waitcount, tmp); /* 0x01020a0c for a 100Mhz clock */
3135 + /* Set programmable interface timing for external uart */
3136 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
3137 + tmp = tmp | (CEIL(20, ns) << FW_W2_SHIFT); /* W2 = 20nS */
3138 + tmp = tmp | (CEIL(100, ns) << FW_W1_SHIFT); /* W1 = 100nS */
3139 + tmp = tmp | CEIL(120, ns); /* W0 = 120nS */
3140 + W_REG(&eir->prog_waitcount, tmp); /* 0x01020a0c for a 100Mhz clock */
3141 + } else if ((cc = sb_setcore(sbh, SB_CC, 0))) {
3142 + /* Set timing for the flash */
3143 + tmp = CEIL(10, ns) << FW_W3_SHIFT; /* W3 = 10nS */
3144 + tmp |= CEIL(10, ns) << FW_W1_SHIFT; /* W1 = 10nS */
3145 + tmp |= CEIL(120, ns); /* W0 = 120nS */
3146 + W_REG(&cc->parallelflashwaitcnt, tmp);
3148 + W_REG(&cc->cs01memwaitcnt, tmp);
3151 + /* Chip specific initialization */
3152 + switch (sb_chip(sbh)) {
3153 + case BCM4710_DEVICE_ID:
3154 + /* Clear interrupt map */
3155 + for (irq = 0; irq <= 4; irq++)
3156 + sb_clearirq(sbh, irq);
3157 + sb_setirq(sbh, 0, SB_CODEC, 0);
3158 + sb_setirq(sbh, 0, SB_EXTIF, 0);
3159 + sb_setirq(sbh, 2, SB_ENET, 1);
3160 + sb_setirq(sbh, 3, SB_ILINE20, 0);
3161 + sb_setirq(sbh, 4, SB_PCI, 0);
3163 + value = nvram_get("et0phyaddr");
3164 + if (value && !strcmp(value, "31")) {
3165 + /* Enable internal UART */
3166 + W_REG(&eir->corecontrol, CC_UE);
3167 + /* Give USB its own interrupt */
3168 + sb_setirq(sbh, 1, SB_USB, 0);
3170 + /* Disable internal UART */
3171 + W_REG(&eir->corecontrol, 0);
3172 + /* Give Ethernet its own interrupt */
3173 + sb_setirq(sbh, 1, SB_ENET, 0);
3174 + sb_setirq(sbh, 0, SB_USB, 0);
3177 + case BCM4310_DEVICE_ID:
3178 + MTC0(C0_BROADCOM, 0, MFC0(C0_BROADCOM, 0) & ~(1 << 22));
3184 +sb_mips_clock(void *sbh)
3190 + uint32 pll_type, rate = 0;
3192 + /* get index of the current core */
3193 + idx = sb_coreidx(sbh);
3194 + pll_type = PLL_TYPE1;
3196 + /* switch to extif or chipc core */
3197 + if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
3198 + n = R_REG(&eir->clockcontrol_n);
3199 + m = R_REG(&eir->clockcontrol_sb);
3200 + } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
3201 + pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
3202 + n = R_REG(&cc->clockcontrol_n);
3203 + if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4))
3204 + m = R_REG(&cc->clockcontrol_mips);
3205 + else if (pll_type == PLL_TYPE3) {
3209 + m = R_REG(&cc->clockcontrol_sb);
3213 + /* calculate rate */
3214 + rate = sb_clock_rate(pll_type, n, m);
3217 + /* switch back to previous core */
3218 + sb_setcoreidx(sbh, idx);
3224 +icache_probe(int *size, int *lsize)
3229 + config1 = MFC0(C0_CONFIG, 1);
3231 + /* Instruction Cache Size = Associativity * Line Size * Sets Per Way */
3232 + if ((*lsize = ((config1 >> 19) & 7)))
3233 + *lsize = 2 << *lsize;
3234 + sets = 64 << ((config1 >> 22) & 7);
3235 + ways = 1 + ((config1 >> 16) & 7);
3236 + *size = *lsize * sets * ways;
3239 +#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
3246 + ".set\tmips32\n\t"
3249 + /* Disable interrupts */
3250 + /* MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~(ALLINTS | STO_IE)); */
3251 + "mfc0 $15, $12\n\t"
3252 + "and $15, $15, -31746\n\t"
3253 + "mtc0 $15, $12\n\t"
3261 +/* The following MUST come right after handler() */
3268 + * Set the MIPS, backplane and PCI clocks as closely as possible.
3271 +sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock)
3273 + extifregs_t *eir = NULL;
3274 + chipcregs_t *cc = NULL;
3275 + mipsregs_t *mipsr = NULL;
3276 + volatile uint32 *clockcontrol_n, *clockcontrol_sb, *clockcontrol_pci;
3277 + uint32 orig_n, orig_sb, orig_pci, orig_m2, orig_mips, orig_ratio_parm, new_ratio;
3278 + uint32 pll_type, sync_mode;
3286 + } type1_table[] = {
3287 + { 96000000, 0x0303, 0x04020011, 0x11030011, 0x11050011 }, /* 96.000 32.000 24.000 */
3288 + { 100000000, 0x0009, 0x04020011, 0x11030011, 0x11050011 }, /* 100.000 33.333 25.000 */
3289 + { 104000000, 0x0802, 0x04020011, 0x11050009, 0x11090009 }, /* 104.000 31.200 24.960 */
3290 + { 108000000, 0x0403, 0x04020011, 0x11050009, 0x02000802 }, /* 108.000 32.400 24.923 */
3291 + { 112000000, 0x0205, 0x04020011, 0x11030021, 0x02000403 }, /* 112.000 32.000 24.889 */
3292 + { 115200000, 0x0303, 0x04020009, 0x11030011, 0x11050011 }, /* 115.200 32.000 24.000 */
3293 + { 120000000, 0x0011, 0x04020011, 0x11050011, 0x11090011 }, /* 120.000 30.000 24.000 */
3294 + { 124800000, 0x0802, 0x04020009, 0x11050009, 0x11090009 }, /* 124.800 31.200 24.960 */
3295 + { 128000000, 0x0305, 0x04020011, 0x11050011, 0x02000305 }, /* 128.000 32.000 24.000 */
3296 + { 132000000, 0x0603, 0x04020011, 0x11050011, 0x02000305 }, /* 132.000 33.000 24.750 */
3297 + { 136000000, 0x0c02, 0x04020011, 0x11090009, 0x02000603 }, /* 136.000 32.640 24.727 */
3298 + { 140000000, 0x0021, 0x04020011, 0x11050021, 0x02000c02 }, /* 140.000 30.000 24.706 */
3299 + { 144000000, 0x0405, 0x04020011, 0x01020202, 0x11090021 }, /* 144.000 30.857 24.686 */
3300 + { 150857142, 0x0605, 0x04020021, 0x02000305, 0x02000605 }, /* 150.857 33.000 24.000 */
3301 + { 152000000, 0x0e02, 0x04020011, 0x11050021, 0x02000e02 }, /* 152.000 32.571 24.000 */
3302 + { 156000000, 0x0802, 0x04020005, 0x11050009, 0x11090009 }, /* 156.000 31.200 24.960 */
3303 + { 160000000, 0x0309, 0x04020011, 0x11090011, 0x02000309 }, /* 160.000 32.000 24.000 */
3304 + { 163200000, 0x0c02, 0x04020009, 0x11090009, 0x02000603 }, /* 163.200 32.640 24.727 */
3305 + { 168000000, 0x0205, 0x04020005, 0x11030021, 0x02000403 }, /* 168.000 32.000 24.889 */
3306 + { 176000000, 0x0602, 0x04020003, 0x11050005, 0x02000602 }, /* 176.000 33.000 24.000 */
3317 + uint32 ratio_parm;
3320 + n4m_table_t type2_table[] = {
3321 + { 180000000, 80000000, 0x0403, 0x01010000, 0x01020300, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
3322 + { 180000000, 90000000, 0x0403, 0x01000100, 0x01020300, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 },
3323 + { 200000000, 100000000, 0x0303, 0x01000000, 0x01000600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
3324 + { 211200000, 105600000, 0x0902, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
3325 + { 220800000, 110400000, 0x1500, 0x01000200, 0x01030400, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
3326 + { 230400000, 115200000, 0x0604, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
3327 + { 234000000, 104000000, 0x0b01, 0x01010000, 0x01010700, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
3328 + { 240000000, 120000000, 0x0803, 0x01000200, 0x01020600, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
3329 + { 252000000, 126000000, 0x0504, 0x01000100, 0x01020500, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 },
3330 + { 264000000, 132000000, 0x0903, 0x01000200, 0x01020700, 0x01000200, 0x05000200, 0x21, 0x0aaa0555 },
3331 + { 270000000, 120000000, 0x0703, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
3332 + { 276000000, 122666666, 0x1500, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
3333 + { 280000000, 140000000, 0x0503, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
3334 + { 288000000, 128000000, 0x0604, 0x01010000, 0x01030400, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
3335 + { 288000000, 144000000, 0x0404, 0x01000000, 0x01010600, 0x01000000, 0x05000000, 0x21, 0x0aaa0555 },
3336 + { 300000000, 133333333, 0x0803, 0x01010000, 0x01020600, 0x01020600, 0x05000100, 0x94, 0x012a0115 },
3337 + { 300000000, 150000000, 0x0803, 0x01000100, 0x01020600, 0x01000100, 0x05000100, 0x21, 0x0aaa0555 }
3340 + n4m_table_t type4_table[] = {
3341 + { 192000000, 96000000, 0x0702, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 },
3342 + { 200000000, 100000000, 0x0009, 0x04020011, 0x11030011, 0x04020011, 0x04020003, 0x21, 0x0aaa0555 },
3343 + { 216000000, 108000000, 0x0211, 0x11020005, 0x11030303, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 },
3344 + { 228000000, 101333333, 0x0e02, 0x11030003, 0x11210005, 0x11030305, 0x04000005, 0x94, 0x012a00a9 },
3345 + { 228000000, 114000000, 0x0e02, 0x11020005, 0x11210005, 0x11020005, 0x04000005, 0x21, 0x0aaa0555 },
3346 + { 240000000, 120000000, 0x0109, 0x11030002, 0x01050203, 0x11030002, 0x04000003, 0x21, 0x0aaa0555 },
3347 + { 252000000, 126000000, 0x0203, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 },
3348 + { 264000000, 132000000, 0x0602, 0x04000005, 0x11050005, 0x04000005, 0x04000002, 0x21, 0x0aaa0555 },
3349 + { 272000000, 116571428, 0x0c02, 0x04000021, 0x02000909, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
3350 + { 280000000, 120000000, 0x0209, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
3351 + { 288000000, 123428571, 0x0111, 0x04000021, 0x01030303, 0x02000221, 0x04000003, 0x73, 0x254a14a9 },
3352 + { 300000000, 120000000, 0x0009, 0x04000009, 0x01030203, 0x02000902, 0x04000002, 0x52, 0x02520129 }
3354 + uint icache_size, ic_lsize;
3355 + ulong start, end, dst;
3358 + /* get index of the current core */
3359 + idx = sb_coreidx(sbh);
3361 + /* switch to extif or chipc core */
3362 + if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
3363 + pll_type = PLL_TYPE1;
3364 + clockcontrol_n = &eir->clockcontrol_n;
3365 + clockcontrol_sb = &eir->clockcontrol_sb;
3366 + clockcontrol_pci = &eir->clockcontrol_pci;
3367 + } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
3368 + pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
3369 + clockcontrol_n = &cc->clockcontrol_n;
3370 + clockcontrol_sb = &cc->clockcontrol_sb;
3371 + clockcontrol_pci = &cc->clockcontrol_pci;
3375 + /* Store the current clock register values */
3376 + orig_n = R_REG(clockcontrol_n);
3377 + orig_sb = R_REG(clockcontrol_sb);
3378 + orig_pci = R_REG(clockcontrol_pci);
3380 + if (pll_type == PLL_TYPE1) {
3381 + /* Keep the current PCI clock if not specified */
3382 + if (pciclock == 0) {
3383 + pciclock = sb_clock_rate(pll_type, R_REG(clockcontrol_n), R_REG(clockcontrol_pci));
3384 + pciclock = (pciclock <= 25000000) ? 25000000 : 33000000;
3387 + /* Search for the closest MIPS clock less than or equal to a preferred value */
3388 + for (i = 0; i < ARRAYSIZE(type1_table); i++) {
3389 + ASSERT(type1_table[i].mipsclock ==
3390 + sb_clock_rate(pll_type, type1_table[i].n, type1_table[i].sb));
3391 + if (type1_table[i].mipsclock > mipsclock)
3401 + ASSERT(type1_table[i].mipsclock <= mipsclock);
3403 + /* No PLL change */
3404 + if ((orig_n == type1_table[i].n) &&
3405 + (orig_sb == type1_table[i].sb) &&
3406 + (orig_pci == type1_table[i].pci33))
3409 + /* Set the PLL controls */
3410 + W_REG(clockcontrol_n, type1_table[i].n);
3411 + W_REG(clockcontrol_sb, type1_table[i].sb);
3412 + if (pciclock == 25000000)
3413 + W_REG(clockcontrol_pci, type1_table[i].pci25);
3415 + W_REG(clockcontrol_pci, type1_table[i].pci33);
3418 + sb_watchdog(sbh, 1);
3420 + } else if ((pll_type == PLL_TYPE2) || (pll_type == PLL_TYPE4)) {
3421 + n4m_table_t *table = (pll_type == PLL_TYPE2) ? type2_table : type4_table;
3422 + uint tabsz = (pll_type == PLL_TYPE2) ? ARRAYSIZE(type2_table) : ARRAYSIZE(type4_table);
3426 + /* Store the current clock register values */
3427 + orig_m2 = R_REG(&cc->clockcontrol_m2);
3428 + orig_mips = R_REG(&cc->clockcontrol_mips);
3429 + orig_ratio_parm = 0;
3431 + /* Look up current ratio */
3432 + for (i = 0; i < tabsz; i++) {
3433 + if ((orig_n == table[i].n) &&
3434 + (orig_sb == table[i].sb) &&
3435 + (orig_pci == table[i].pci33) &&
3436 + (orig_m2 == table[i].m2) &&
3437 + (orig_mips == table[i].m3)) {
3438 + orig_ratio_parm = table[i].ratio_parm;
3443 + /* Search for the closest MIPS clock greater or equal to a preferred value */
3444 + for (i = 0; i < tabsz; i++) {
3445 + ASSERT(table[i].mipsclock ==
3446 + sb_clock_rate(pll_type, table[i].n, table[i].m3));
3447 + if ((mipsclock <= table[i].mipsclock) &&
3448 + ((sbclock == 0) || (sbclock <= table[i].sbclock)))
3458 + /* No PLL change */
3459 + if ((orig_n == table[i].n) &&
3460 + (orig_sb == table[i].sb) &&
3461 + (orig_pci == table[i].pci33) &&
3462 + (orig_m2 == table[i].m2) &&
3463 + (orig_mips == table[i].m3))
3466 + /* Set the PLL controls */
3467 + W_REG(clockcontrol_n, table[i].n);
3468 + W_REG(clockcontrol_sb, table[i].sb);
3469 + W_REG(clockcontrol_pci, table[i].pci33);
3470 + W_REG(&cc->clockcontrol_m2, table[i].m2);
3471 + W_REG(&cc->clockcontrol_mips, table[i].m3);
3473 + /* No ratio change */
3474 + if (orig_ratio_parm == table[i].ratio_parm)
3477 + new_ratio = table[i].ratio_parm;
3479 + icache_probe(&icache_size, &ic_lsize);
3481 + /* Preload the code into the cache */
3482 + start = ((ulong) &&start_fill) & ~(ic_lsize - 1);
3483 + end = ((ulong) &&end_fill + (ic_lsize - 1)) & ~(ic_lsize - 1);
3484 + while (start < end) {
3485 + cache_unroll(start, Fill_I);
3486 + start += ic_lsize;
3489 + /* Copy the handler */
3490 + start = (ulong) &handler;
3491 + end = (ulong) &afterhandler;
3492 + dst = KSEG1ADDR(0x180);
3493 + for (i = 0; i < (end - start); i += 4)
3494 + *((ulong *)(dst + i)) = *((ulong *)(start + i));
3496 + /* Preload handler into the cache one line at a time */
3497 + for (i = 0; i < (end - start); i += 4)
3498 + cache_unroll(dst + i, Fill_I);
3500 + /* Clear BEV bit */
3501 + MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) & ~ST0_BEV);
3503 + /* Enable interrupts */
3504 + MTC0(C0_STATUS, 0, MFC0(C0_STATUS, 0) | (ALLINTS | ST0_IE));
3506 + /* Enable MIPS timer interrupt */
3507 + if (!(mipsr = sb_setcore(sbh, SB_MIPS, 0)) &&
3508 + !(mipsr = sb_setcore(sbh, SB_MIPS33, 0)))
3510 + W_REG(&mipsr->intmask, 1);
3513 + /* step 1, set clock ratios */
3514 + MTC0(C0_BROADCOM, 3, new_ratio);
3515 + MTC0(C0_BROADCOM, 1, 8);
3517 + /* step 2: program timer intr */
3518 + W_REG(&mipsr->timer, 100);
3519 + (void) R_REG(&mipsr->timer);
3521 + /* step 3, switch to async */
3522 + sync_mode = MFC0(C0_BROADCOM, 4);
3523 + MTC0(C0_BROADCOM, 4, 1 << 22);
3525 + /* step 4, set cfg active */
3526 + MTC0(C0_BROADCOM, 2, 0x9);
3530 + __asm__ __volatile__ (
3536 + /* step 7, clear cfg_active */
3537 + MTC0(C0_BROADCOM, 2, 0);
3539 + /* Additional Step: set back to orig sync mode */
3540 + MTC0(C0_BROADCOM, 4, sync_mode);
3542 + /* step 8, fake soft reset */
3543 + MTC0(C0_BROADCOM, 5, MFC0(C0_BROADCOM, 5) | 4);
3546 + /* step 9 set watchdog timer */
3547 + sb_watchdog(sbh, 20);
3548 + (void) R_REG(&cc->chipid);
3551 + __asm__ __volatile__ (
3561 + /* switch back to previous core */
3562 + sb_setcoreidx(sbh, idx);
3568 +/* returns the ncdl value to be programmed into sdram_ncdl for calibration */
3570 +sb_memc_get_ncdl(void *sbh)
3572 + sbmemcregs_t *memc;
3574 + uint32 config, rd, wr, misc, dqsg, cd, sm, sd;
3577 + idx = sb_coreidx(sbh);
3579 + memc = (sbmemcregs_t *)sb_setcore(sbh, SB_MEMC, 0);
3583 + rev = sb_corerev(sbh);
3585 + config = R_REG(&memc->config);
3586 + wr = R_REG(&memc->wrncdlcor);
3587 + rd = R_REG(&memc->rdncdlcor);
3588 + misc = R_REG(&memc->miscdlyctl);
3589 + dqsg = R_REG(&memc->dqsgatencdl);
3591 + rd &= MEMC_RDNCDLCOR_RD_MASK;
3592 + wr &= MEMC_WRNCDLCOR_WR_MASK;
3593 + dqsg &= MEMC_DQSGATENCDL_G_MASK;
3595 + if (config & MEMC_CONFIG_DDR) {
3596 + ret = (wr << 16) | (rd << 8) | dqsg;
3601 + cd = (rd == MEMC_CD_THRESHOLD) ? rd : (wr + MEMC_CD_THRESHOLD);
3602 + sm = (misc & MEMC_MISC_SM_MASK) >> MEMC_MISC_SM_SHIFT;
3603 + sd = (misc & MEMC_MISC_SD_MASK) >> MEMC_MISC_SD_SHIFT;
3604 + ret = (sm << 16) | (sd << 8) | cd;
3608 + /* switch back to previous core */
3609 + sb_setcoreidx(sbh, idx);
3613 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbpci.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbpci.c
3614 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbpci.c 1970-01-01 01:00:00.000000000 +0100
3615 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbpci.c 2005-09-16 10:29:18.169592704 +0200
3618 + * Low-Level PCI and SB support for BCM47xx
3620 + * Copyright 2001-2003, Broadcom Corporation
3621 + * All Rights Reserved.
3623 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
3624 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
3625 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
3626 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
3628 + * $Id: sbpci.c,v 1.2 2005/02/28 13:34:25 jolt Exp $
3631 +#include <typedefs.h>
3632 +#include <pcicfg.h>
3633 +#include <bcmdevs.h>
3634 +#include <sbconfig.h>
3637 +#include <bcmendian.h>
3638 +#include <bcmutils.h>
3639 +#include <sbutils.h>
3640 +#include <bcmnvram.h>
3641 +#include <hndmips.h>
3643 +/* Can free sbpci_init() memory after boot */
3648 +/* Emulated configuration space */
3649 +static pci_config_regs sb_config_regs[SB_MAXCORES];
3652 +static uint16 pci_ban[32] = { 0 };
3653 +static uint pci_banned = 0;
3656 +static bool cardbus = FALSE;
3659 + * Functions for accessing external PCI configuration space
3662 +/* Assume one-hot slot wiring */
3663 +#define PCI_SLOT_MAX 16
3666 +config_cmd(void *sbh, uint bus, uint dev, uint func, uint off)
3669 + sbpciregs_t *regs;
3672 + /* CardBusMode supports only one device */
3673 + if (cardbus && dev > 1)
3676 + coreidx = sb_coreidx(sbh);
3677 + regs = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0);
3679 + /* Type 0 transaction */
3681 + /* Skip unwired slots */
3682 + if (dev < PCI_SLOT_MAX) {
3683 + /* Slide the PCI window to the appropriate slot */
3684 + W_REG(®s->sbtopci1, SBTOPCI_CFG0 | ((1 << (dev + 16)) & SBTOPCI1_MASK));
3685 + addr = SB_PCI_CFG | ((1 << (dev + 16)) & ~SBTOPCI1_MASK) |
3686 + (func << 8) | (off & ~3);
3690 + /* Type 1 transaction */
3692 + W_REG(®s->sbtopci1, SBTOPCI_CFG1);
3693 + addr = SB_PCI_CFG | (bus << 16) | (dev << 11) | (func << 8) | (off & ~3);
3696 + sb_setcoreidx(sbh, coreidx);
3702 +extpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
3704 + uint32 addr, *reg = NULL, val;
3707 + if (!(addr = config_cmd(sbh, bus, dev, func, off)) ||
3708 + !(reg = (uint32 *) REG_MAP(addr, len)) ||
3709 + BUSPROBE(val, reg))
3712 + val >>= 8 * (off & 3);
3714 + *((uint32 *) buf) = val;
3715 + else if (len == 2)
3716 + *((uint16 *) buf) = (uint16) val;
3717 + else if (len == 1)
3718 + *((uint8 *) buf) = (uint8) val;
3729 +extpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
3731 + uint32 addr, *reg = NULL, val;
3734 + if (!(addr = config_cmd(sbh, bus, dev, func, off)) ||
3735 + !(reg = (uint32 *) REG_MAP(addr, len)) ||
3736 + BUSPROBE(val, reg))
3740 + val = *((uint32 *) buf);
3741 + else if (len == 2) {
3742 + val &= ~(0xffff << (8 * (off & 3)));
3743 + val |= *((uint16 *) buf) << (8 * (off & 3));
3744 + } else if (len == 1) {
3745 + val &= ~(0xff << (8 * (off & 3)));
3746 + val |= *((uint8 *) buf) << (8 * (off & 3));
3760 + * Functions for accessing translated SB configuration space
3764 +sb_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
3766 + pci_config_regs *cfg;
3768 + if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs))
3770 + cfg = &sb_config_regs[dev];
3772 + ASSERT(ISALIGNED(off, len));
3773 + ASSERT(ISALIGNED(buf, len));
3776 + *((uint32 *) buf) = ltoh32(*((uint32 *)((ulong) cfg + off)));
3777 + else if (len == 2)
3778 + *((uint16 *) buf) = ltoh16(*((uint16 *)((ulong) cfg + off)));
3779 + else if (len == 1)
3780 + *((uint8 *) buf) = *((uint8 *)((ulong) cfg + off));
3788 +sb_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
3793 + pci_config_regs *cfg;
3795 + if (dev >= SB_MAXCORES || (off + len) > sizeof(pci_config_regs))
3797 + cfg = &sb_config_regs[dev];
3799 + ASSERT(ISALIGNED(off, len));
3800 + ASSERT(ISALIGNED(buf, len));
3802 + /* Emulate BAR sizing */
3803 + if (off >= OFFSETOF(pci_config_regs, base[0]) && off <= OFFSETOF(pci_config_regs, base[3]) &&
3804 + len == 4 && *((uint32 *) buf) == ~0) {
3805 + coreidx = sb_coreidx(sbh);
3806 + if ((regs = sb_setcoreidx(sbh, dev))) {
3807 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
3808 + /* Highest numbered address match register */
3809 + n = (R_REG(&sb->sbidlow) & SBIDL_AR_MASK) >> SBIDL_AR_SHIFT;
3810 + if (off == OFFSETOF(pci_config_regs, base[0]))
3811 + cfg->base[0] = ~(sb_size(R_REG(&sb->sbadmatch0)) - 1);
3812 + /*else if (off == OFFSETOF(pci_config_regs, base[1]) && n >= 1)
3813 + cfg->base[1] = ~(sb_size(R_REG(&sb->sbadmatch1)) - 1);
3814 + else if (off == OFFSETOF(pci_config_regs, base[2]) && n >= 2)
3815 + cfg->base[2] = ~(sb_size(R_REG(&sb->sbadmatch2)) - 1);
3816 + else if (off == OFFSETOF(pci_config_regs, base[3]) && n >= 3)
3817 + cfg->base[3] = ~(sb_size(R_REG(&sb->sbadmatch3)) - 1);*/
3819 + sb_setcoreidx(sbh, coreidx);
3824 + *((uint32 *)((ulong) cfg + off)) = htol32(*((uint32 *) buf));
3825 + else if (len == 2)
3826 + *((uint16 *)((ulong) cfg + off)) = htol16(*((uint16 *) buf));
3827 + else if (len == 1)
3828 + *((uint8 *)((ulong) cfg + off)) = *((uint8 *) buf);
3836 +sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
3839 + return sb_read_config(sbh, bus, dev, func, off, buf, len);
3841 + return extpci_read_config(sbh, bus, dev, func, off, buf, len);
3845 +sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len)
3848 + return sb_write_config(sbh, bus, dev, func, off, buf, len);
3850 + return extpci_write_config(sbh, bus, dev, func, off, buf, len);
3854 +sbpci_ban(uint16 core)
3856 + if (pci_banned < ARRAYSIZE(pci_ban))
3857 + pci_ban[pci_banned++] = core;
3861 +sbpci_init(void *sbh)
3863 + uint chip, chiprev, chippkg, coreidx, host, i;
3866 + pci_config_regs *cfg;
3870 + uint16 vendor, core;
3871 + uint8 class, subclass, progif;
3873 + uint32 sbips_int_mask[] = { 0, SBIPS_INT1_MASK, SBIPS_INT2_MASK, SBIPS_INT3_MASK, SBIPS_INT4_MASK };
3874 + uint32 sbips_int_shift[] = { 0, 0, SBIPS_INT2_SHIFT, SBIPS_INT3_SHIFT, SBIPS_INT4_SHIFT };
3876 + chip = sb_chip(sbh);
3877 + chiprev = sb_chiprev(sbh);
3878 + chippkg = sb_chippkg(sbh);
3879 + coreidx = sb_coreidx(sbh);
3881 + if (!(pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0)))
3883 + sb_core_reset(sbh, 0);
3885 + if (((chip == BCM4310_DEVICE_ID) && (chiprev == 0)) ||
3886 + ((chip == BCM4712_DEVICE_ID) && (chippkg == BCM4712SMALL_PKG_ID)))
3889 + host = !BUSPROBE(val, &pci->control);
3892 + /* Disable PCI interrupts in client mode */
3893 + sb = (sbconfig_t *)((ulong) pci + SBCONFIGOFF);
3894 + W_REG(&sb->sbintvec, 0);
3896 + /* Disable the PCI bridge in client mode */
3897 + sbpci_ban(SB_PCI);
3898 + printf("PCI: Disabled\n");
3900 + /* Reset the external PCI bus and enable the clock */
3901 + W_REG(&pci->control, 0x5); /* enable the tristate drivers */
3902 + W_REG(&pci->control, 0xd); /* enable the PCI clock */
3903 + OSL_DELAY(100); /* delay 100 us */
3904 + W_REG(&pci->control, 0xf); /* deassert PCI reset */
3905 + W_REG(&pci->arbcontrol, PCI_INT_ARB); /* use internal arbiter */
3906 + OSL_DELAY(1); /* delay 1 us */
3908 + /* Enable CardBusMode */
3909 + cardbus = nvram_match("cardbus", "1");
3911 + printf("PCI: Enabling CardBus\n");
3912 + /* GPIO 1 resets the CardBus device on bcm94710ap */
3913 + sb_gpioout(sbh, 1, 1);
3914 + sb_gpioouten(sbh, 1, 1);
3915 + W_REG(&pci->sprom[0], R_REG(&pci->sprom[0]) | 0x400);
3918 + /* 64 MB I/O access window */
3919 + W_REG(&pci->sbtopci0, SBTOPCI_IO);
3920 + /* 64 MB configuration access window */
3921 + W_REG(&pci->sbtopci1, SBTOPCI_CFG0);
3922 + /* 1 GB memory access window */
3923 + W_REG(&pci->sbtopci2, SBTOPCI_MEM | SB_PCI_DMA);
3925 + /* Enable PCI bridge BAR0 prefetch and burst */
3927 + sbpci_write_config(sbh, 1, 0, 0, PCI_CFG_CMD, &val, sizeof(val));
3929 + /* Enable PCI interrupts */
3930 + W_REG(&pci->intmask, PCI_INTA);
3933 + /* Scan the SB bus */
3934 + bzero(sb_config_regs, sizeof(sb_config_regs));
3935 + for (cfg = sb_config_regs; cfg < &sb_config_regs[SB_MAXCORES]; cfg++) {
3936 + cfg->vendor = 0xffff;
3937 + if (!(regs = sb_setcoreidx(sbh, cfg - sb_config_regs)))
3939 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
3941 + /* Read ID register and parse vendor and core */
3942 + val = R_REG(&sb->sbidhigh);
3943 + vendor = (val & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT;
3944 + core = (val & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT;
3947 + /* Check if this core is banned */
3948 + for (i = 0; i < pci_banned; i++)
3949 + if (core == pci_ban[i])
3951 + if (i < pci_banned)
3954 + /* Known vendor translations */
3957 + vendor = VENDOR_BROADCOM;
3961 + /* Determine class based on known core codes */
3964 + class = PCI_CLASS_NET;
3965 + subclass = PCI_NET_ETHER;
3966 + core = BCM47XX_ILINE_ID;
3969 + class = PCI_CLASS_NET;
3970 + subclass = PCI_NET_ETHER;
3971 + core = BCM4610_ILINE_ID;
3974 + class = PCI_CLASS_NET;
3975 + subclass = PCI_NET_ETHER;
3976 + core = BCM47XX_ENET_ID;
3980 + class = PCI_CLASS_MEMORY;
3981 + subclass = PCI_MEMORY_RAM;
3984 + class = PCI_CLASS_BRIDGE;
3985 + subclass = PCI_BRIDGE_PCI;
3989 + class = PCI_CLASS_CPU;
3990 + subclass = PCI_CPU_MIPS;
3993 + class = PCI_CLASS_COMM;
3994 + subclass = PCI_COMM_MODEM;
3995 + core = BCM47XX_V90_ID;
3998 + class = PCI_CLASS_SERIAL;
3999 + subclass = PCI_SERIAL_USB;
4000 + progif = 0x10; /* OHCI */
4001 + core = BCM47XX_USB_ID;
4004 + class = PCI_CLASS_SERIAL;
4005 + subclass = PCI_SERIAL_USB;
4006 + progif = 0x10; /* OHCI */
4007 + core = BCM47XX_USBH_ID;
4010 + class = PCI_CLASS_SERIAL;
4011 + subclass = PCI_SERIAL_USB;
4012 + core = BCM47XX_USBD_ID;
4015 + class = PCI_CLASS_CRYPT;
4016 + subclass = PCI_CRYPT_NETWORK;
4017 + core = BCM47XX_IPSEC_ID;
4021 + class = PCI_CLASS_MEMORY;
4022 + subclass = PCI_MEMORY_FLASH;
4025 + class = PCI_CLASS_NET;
4026 + subclass = PCI_NET_OTHER;
4027 + /* Let an nvram variable override this */
4028 + sprintf(varname, "wl%did", wlidx);
4030 + if ((core = getintvar(NULL, varname)) == 0) {
4031 + if (chip == BCM4712_DEVICE_ID) {
4032 + if (chippkg == BCM4712SMALL_PKG_ID)
4033 + core = BCM4306_D11G_ID;
4035 + core = BCM4306_D11DUAL_ID;
4038 + core = BCM4310_D11B_ID;
4044 + class = subclass = progif = 0xff;
4048 + /* Supported translations */
4049 + cfg->vendor = htol16(vendor);
4050 + cfg->device = htol16(core);
4051 + cfg->rev_id = chiprev;
4052 + cfg->prog_if = progif;
4053 + cfg->sub_class = subclass;
4054 + cfg->base_class = class;
4055 + cfg->base[0] = htol32(sb_base(R_REG(&sb->sbadmatch0)));
4056 + cfg->base[1] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch1)))*/;
4057 + cfg->base[2] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch2)))*/;
4058 + cfg->base[3] = 0/*htol32(sb_base(R_REG(&sb->sbadmatch3)))*/;
4061 + if (class == PCI_CLASS_BRIDGE && subclass == PCI_BRIDGE_PCI)
4062 + cfg->header_type = PCI_HEADER_BRIDGE;
4064 + cfg->header_type = PCI_HEADER_NORMAL;
4065 + /* Save core interrupt flag */
4066 + cfg->int_pin = R_REG(&sb->sbtpsflag) & SBTPS_NUM0_MASK;
4067 + /* Default to MIPS shared interrupt 0 */
4068 + cfg->int_line = 0;
4069 + /* MIPS sbipsflag maps core interrupt flags to interrupts 1 through 4 */
4070 + if ((regs = sb_setcore(sbh, SB_MIPS, 0)) ||
4071 + (regs = sb_setcore(sbh, SB_MIPS33, 0))) {
4072 + sb = (sbconfig_t *)((ulong) regs + SBCONFIGOFF);
4073 + val = R_REG(&sb->sbipsflag);
4074 + for (cfg->int_line = 1; cfg->int_line <= 4; cfg->int_line++) {
4075 + if (((val & sbips_int_mask[cfg->int_line]) >> sbips_int_shift[cfg->int_line]) == cfg->int_pin)
4078 + if (cfg->int_line > 4)
4079 + cfg->int_line = 0;
4081 + /* Emulated core */
4082 + *((uint32 *) &cfg->sprom_control) = 0xffffffff;
4085 + sb_setcoreidx(sbh, coreidx);
4090 +sbpci_check(void *sbh)
4095 + uint32 buf[64], *ptr, i;
4099 + coreidx = sb_coreidx(sbh);
4100 + pci = (sbpciregs_t *) sb_setcore(sbh, SB_PCI, 0);
4102 + /* Clear the test array */
4103 + pa = (ulong) DMA_MAP(NULL, buf, sizeof(buf), DMA_RX, NULL);
4104 + ptr = (uint32 *) OSL_UNCACHED(&buf[0]);
4105 + memset(ptr, 0, sizeof(buf));
4107 + /* Point PCI window 1 to memory */
4108 + sbtopci1 = R_REG(&pci->sbtopci1);
4109 + W_REG(&pci->sbtopci1, SBTOPCI_MEM | (pa & SBTOPCI1_MASK));
4111 + /* Fill the test array via PCI window 1 */
4112 + ptr = (uint32 *) REG_MAP(SB_PCI_CFG + (pa & ~SBTOPCI1_MASK), sizeof(buf));
4113 + for (i = 0; i < ARRAYSIZE(buf); i++) {
4114 + for (j = 0; j < 2; j++);
4115 + W_REG(&ptr[i], i);
4119 + /* Restore PCI window 1 */
4120 + W_REG(&pci->sbtopci1, sbtopci1);
4122 + /* Check the test array */
4123 + DMA_UNMAP(NULL, pa, sizeof(buf), DMA_RX, NULL);
4124 + ptr = (uint32 *) OSL_UNCACHED(&buf[0]);
4125 + for (i = 0; i < ARRAYSIZE(buf); i++) {
4130 + /* Change the clock if the test fails */
4131 + if (i < ARRAYSIZE(buf)) {
4134 + cur = sb_clock(sbh);
4135 + printf("PCI: Test failed at %d MHz\n", (cur + 500000) / 1000000);
4136 + for (req = 104000000; req < 176000000; req += 4000000) {
4137 + printf("PCI: Resetting to %d MHz\n", (req + 500000) / 1000000);
4138 + /* This will only reset if the clocks are valid and have changed */
4139 + sb_mips_setclock(sbh, req, 0, 0);
4141 + /* Should not reach here */
4145 + sb_setcoreidx(sbh, coreidx);
4147 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbutils.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbutils.c
4148 --- linux-2.6.12.5/arch/mips/bcm947xx/broadcom/sbutils.c 1970-01-01 01:00:00.000000000 +0100
4149 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/broadcom/sbutils.c 2005-09-16 10:29:18.172592248 +0200
4152 + * Misc utility routines for accessing chip-specific features
4153 + * of the SiliconBackplane-based Broadcom chips.
4155 + * Copyright 2001-2003, Broadcom Corporation
4156 + * All Rights Reserved.
4158 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
4159 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
4160 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
4161 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
4163 + * $Id: sbutils.c,v 1.1 2005/02/28 13:33:32 jolt Exp $
4166 +#include <typedefs.h>
4168 +#include <bcmutils.h>
4169 +#include <bcmdevs.h>
4170 +#include <sbconfig.h>
4171 +#include <sbchipc.h>
4173 +#include <pcicfg.h>
4174 +#include <sbpcmcia.h>
4175 +#include <sbextif.h>
4176 +#include <sbutils.h>
4177 +#include <bcmsrom.h>
4180 +#define SB_ERROR(args)
4182 +typedef uint32 (*sb_intrsoff_t)(void *intr_arg);
4183 +typedef void (*sb_intrsrestore_t)(void *intr_arg, uint32 arg);
4185 +/* misc sb info needed by some of the routines */
4186 +typedef struct sb_info {
4187 + uint chip; /* chip number */
4188 + uint chiprev; /* chip revision */
4189 + uint chippkg; /* chip package option */
4190 + uint boardtype; /* board type */
4191 + uint boardvendor; /* board vendor id */
4192 + uint bus; /* what bus type we are going through */
4194 + void *osh; /* osl os handle */
4195 + void *sdh; /* bcmsdh handle */
4197 + void *curmap; /* current regs va */
4198 + void *regs[SB_MAXCORES]; /* other regs va */
4200 + uint curidx; /* current core index */
4201 + uint dev_coreid; /* the core provides driver functions */
4202 + uint pciidx; /* pci core index */
4203 + uint pcirev; /* pci core rev */
4205 + uint pcmciaidx; /* pcmcia core index */
4206 + uint pcmciarev; /* pcmcia core rev */
4207 + bool memseg; /* flag to toggle MEM_SEG register */
4209 + uint ccrev; /* chipc core rev */
4211 + uint gpioidx; /* gpio control core index */
4212 + uint gpioid; /* gpio control coretype */
4214 + uint numcores; /* # discovered cores */
4215 + uint coreid[SB_MAXCORES]; /* id of each core */
4217 + void *intr_arg; /* interrupt callback function arg */
4218 + sb_intrsoff_t intrsoff_fn; /* function turns chip interrupts off */
4219 + sb_intrsrestore_t intrsrestore_fn; /* function restore chip interrupts */
4222 +/* local prototypes */
4223 +static void* sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz);
4224 +static void sb_scan(sb_info_t *si);
4225 +static uint sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val);
4226 +static uint _sb_coreidx(void *sbh);
4227 +static uint sb_findcoreidx(void *sbh, uint coreid, uint coreunit);
4228 +static uint sb_pcidev2chip(uint pcidev);
4229 +static uint sb_chip2numcores(uint chip);
4231 +#define SB_INFO(sbh) (sb_info_t*)sbh
4232 +#define SET_SBREG(sbh, r, mask, val) W_SBREG((sbh), (r), ((R_SBREG((sbh), (r)) & ~(mask)) | (val)))
4233 +#define GOODCOREADDR(x) (((x) >= SB_ENUM_BASE) && ((x) <= SB_ENUM_LIM) \
4234 + && ISALIGNED((x), SB_CORE_SIZE))
4235 +#define GOODREGS(regs) (regs && ISALIGNED(regs, SB_CORE_SIZE))
4236 +#define REGS2SB(va) (sbconfig_t*) ((uint)(va) + SBCONFIGOFF)
4237 +#define GOODIDX(idx) (((uint)idx) < SB_MAXCORES)
4238 +#define BADIDX (SB_MAXCORES+1)
4240 +#define R_SBREG(sbh, sbr) sb_read_sbreg((sbh), (sbr))
4241 +#define W_SBREG(sbh, sbr, v) sb_write_sbreg((sbh), (sbr), (v))
4242 +#define AND_SBREG(sbh, sbr, v) W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) & (v)))
4243 +#define OR_SBREG(sbh, sbr, v) W_SBREG((sbh), (sbr), (R_SBREG((sbh), (sbr)) | (v)))
4246 + * Macros to disable/restore function core(D11, ENET, ILINE20, etc) interrupts before/
4247 + * after core switching to avoid invalid register accesss inside ISR.
4249 +#define INTR_OFF(si, intr_val) \
4250 + if ((si)->intrsoff_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) { \
4251 + intr_val = (*(si)->intrsoff_fn)((si)->intr_arg); }
4252 +#define INTR_RESTORE(si, intr_val) \
4253 + if ((si)->intrsrestore_fn && (si)->coreid[(si)->curidx] == (si)->dev_coreid) { \
4254 + (*(si)->intrsrestore_fn)((si)->intr_arg, intr_val); }
4256 +/* power control defines */
4257 +#define PLL_DELAY 150 /* 150us pll on delay */
4258 +#define FREF_DELAY 15 /* 15us fref change delay */
4259 +#define LPOMINFREQ 25000 /* low power oscillator min */
4260 +#define LPOMAXFREQ 43000 /* low power oscillator max */
4261 +#define XTALMINFREQ 19800000 /* 20mhz - 1% */
4262 +#define XTALMAXFREQ 20200000 /* 20mhz + 1% */
4263 +#define PCIMINFREQ 25000000 /* 25mhz */
4264 +#define PCIMAXFREQ 34000000 /* 33mhz + fudge */
4266 +#define SCC_LOW2FAST_LIMIT 5000 /* turn on fast clock time, in unit of ms */
4270 +sb_read_sbreg(void *sbh, volatile uint32 *sbr)
4274 + uint32 val, intr_val = 0;
4276 + si = SB_INFO(sbh);
4279 + * compact flash only has 11 bits address, while we needs 12 bits address.
4280 + * MEM_SEG will be OR'd with other 11 bits address in hardware,
4281 + * so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
4282 + * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special
4285 + INTR_OFF(si, intr_val);
4287 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
4288 + (uint32)sbr &= ~(1 << 11); /* mask out bit 11*/
4295 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
4296 + INTR_RESTORE(si, intr_val);
4303 +sb_write_sbreg(void *sbh, volatile uint32 *sbr, uint32 v)
4307 + volatile uint32 dummy;
4308 + uint32 intr_val = 0;
4310 + si = SB_INFO(sbh);
4313 + * compact flash only has 11 bits address, while we needs 12 bits address.
4314 + * MEM_SEG will be OR'd with other 11 bits address in hardware,
4315 + * so we program MEM_SEG with 12th bit when necessary(access sb regsiters).
4316 + * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special
4319 + INTR_OFF(si, intr_val);
4321 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
4322 + (uint32)sbr &= ~(1 << 11); /* mask out bit 11 */
4325 + if ((si->bus == PCMCIA_BUS) || (si->bus == PCI_BUS)) {
4326 +#ifdef IL_BIGENDIAN
4327 + dummy = R_REG(sbr);
4328 + W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff));
4329 + dummy = R_REG(sbr);
4330 + W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff));
4332 + dummy = R_REG(sbr);
4333 + W_REG((volatile uint16 *)sbr, (uint16)(v & 0xffff));
4334 + dummy = R_REG(sbr);
4335 + W_REG((volatile uint16 *)((uint32)sbr + 2), (uint16)((v >> 16) & 0xffff));
4342 + OSL_PCMCIA_WRITE_ATTR(si->osh, MEM_SEG, &tmp, 1);
4343 + INTR_RESTORE(si, intr_val);
4348 + * Allocate a sb handle.
4349 + * devid - pci device id (used to determine chip#)
4350 + * osh - opaque OS handle
4351 + * regs - virtual address of initial core registers
4352 + * bustype - pci/pcmcia/sb/sdio/etc
4353 + * vars - pointer to a pointer area for "environment" variables
4354 + * varsz - pointer to int to return the size of the vars
4357 +sb_attach(uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz)
4361 + /* alloc sb_info_t */
4362 + if ((si = MALLOC(sizeof (sb_info_t))) == NULL) {
4363 + SB_ERROR(("sb_attach: malloc failed!\n"));
4367 + return (sb_doattach(si, devid, osh, regs, bustype, sdh, vars, varsz));
4370 +/* global kernel resource */
4371 +static sb_info_t ksi;
4373 +/* generic kernel variant of sb_attach() */
4381 + if (ksi.curmap == NULL) {
4383 + regs = (uint32 *)REG_MAP(SB_ENUM_BASE, SB_CORE_SIZE);
4384 + cid = R_REG((uint32 *)regs);
4385 + if ((cid == 0x08104712) || (cid == 0x08114712)) {
4388 + scc = (uint32 *)((uint32)regs + OFFSETOF(chipcregs_t, slow_clk_ctl));
4390 + SB_ERROR((" initial scc = 0x%x\n", val));
4391 + val |= SCC_SS_XTAL;
4395 + sb_doattach(&ksi, BCM4710_DEVICE_ID, NULL, (void*)regs,
4396 + SB_BUS, NULL, &unused, &varsz);
4403 +sb_doattach(sb_info_t *si, uint devid, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz)
4409 + ASSERT(GOODREGS(regs));
4411 + bzero((uchar*)si, sizeof (sb_info_t));
4413 + si->pciidx = si->gpioidx = BADIDX;
4416 + si->curmap = regs;
4419 + /* 4317A0 PCMCIA is no longer supported */
4420 + if ((bustype == PCMCIA_BUS) && (R_REG((uint32 *)regs) == 0x04104317))
4423 + /* check to see if we are a sb core mimic'ing a pci core */
4424 + if (bustype == PCI_BUS) {
4425 + if (OSL_PCI_READ_CONFIG(osh, PCI_SPROM_CONTROL, sizeof (uint32)) == 0xffffffff)
4428 + bustype = PCI_BUS;
4431 + si->bus = bustype;
4433 + /* kludge to enable the clock on the 4306 which lacks a slowclock */
4434 + if (si->bus == PCI_BUS)
4435 + sb_pwrctl_xtal((void*)si, XTAL|PLL, ON);
4437 + /* clear any previous epidiag-induced target abort */
4438 + sb_taclear((void*)si);
4440 + /* initialize current core index value */
4441 + si->curidx = _sb_coreidx((void*)si);
4443 + /* keep and reuse the initial register mapping */
4444 + origidx = si->curidx;
4445 + if (si->bus == SB_BUS)
4446 + si->regs[origidx] = regs;
4448 + /* initialize the vars */
4449 + if (srom_var_init(si->bus, si->curmap, osh, vars, varsz)) {
4450 + SB_ERROR(("sb_attach: srom_var_init failed\n"));
4454 + if (si->bus == PCMCIA_BUS) {
4455 + w = getintvar(*vars, "regwindowsz");
4456 + si->memseg = (w <= CFTABLE_REGWIN_2K) ? TRUE : FALSE;
4459 + /* is core-0 a chipcommon core? */
4461 + cc = (chipcregs_t*) sb_setcoreidx((void*)si, 0);
4462 + if (sb_coreid((void*)si) != SB_CC)
4465 + /* determine chip id and rev */
4467 + /* chip common core found! */
4468 + si->chip = R_REG(&cc->chipid) & CID_ID_MASK;
4469 + si->chiprev = (R_REG(&cc->chipid) & CID_REV_MASK) >> CID_REV_SHIFT;
4470 + si->chippkg = (R_REG(&cc->chipid) & CID_PKG_MASK) >> CID_PKG_SHIFT;
4472 + /* without chip common core, get devid for PCMCIA */
4473 + if (si->bus == PCMCIA_BUS)
4474 + devid = getintvar(*vars, "devid");
4476 + /* no chip common core -- must convert device id to chip id */
4477 + if ((si->chip = sb_pcidev2chip(devid)) == 0) {
4478 + SB_ERROR(("sb_attach: unrecognized device id 0x%04x\n", devid));
4483 + * The chip revision number is hardwired into all
4484 + * of the pci function config rev fields and is
4485 + * independent from the individual core revision numbers.
4486 + * For example, the "A0" silicon of each chip is chip rev 0.
4487 + * For PCMCIA we get it from the CIS instead.
4489 + if (si->bus == PCMCIA_BUS) {
4491 + si->chiprev = getintvar(*vars, "chiprev");
4492 + } else if (si->bus == PCI_BUS) {
4493 + w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_REV, sizeof (uint32));
4494 + si->chiprev = w & 0xff;
4499 + /* get chipcommon rev */
4500 + si->ccrev = cc? sb_corerev((void*)si) : 0;
4502 + /* determine numcores */
4503 + if ((si->ccrev == 4) || (si->ccrev >= 6))
4504 + si->numcores = (R_REG(&cc->chipid) & CID_CC_MASK) >> CID_CC_SHIFT;
4506 + si->numcores = sb_chip2numcores(si->chip);
4508 + /* return to original core */
4509 + sb_setcoreidx((void*)si, origidx);
4511 + /* sanity checks */
4513 + /* 4704A1 is chiprev 8 :-( */
4514 + ASSERT((si->chiprev < 8) ||
4515 + ((si->chip == BCM4704_DEVICE_ID) && ((si->chiprev == 8))));
4517 + /* scan for cores */
4520 + /* pci core is required */
4521 + if (!GOODIDX(si->pciidx)) {
4522 + SB_ERROR(("sb_attach: pci core not found\n"));
4526 + /* gpio control core is required */
4527 + if (!GOODIDX(si->gpioidx)) {
4528 + SB_ERROR(("sb_attach: gpio control core not found\n"));
4532 + /* get boardtype and boardrev */
4533 + switch (si->bus) {
4535 + /* do a pci config read to get subsystem id and subvendor id */
4536 + w = OSL_PCI_READ_CONFIG(osh, PCI_CFG_SVID, sizeof (uint32));
4537 + si->boardvendor = w & 0xffff;
4538 + si->boardtype = (w >> 16) & 0xffff;
4543 + si->boardvendor = getintvar(*vars, "manfid");
4544 + si->boardtype = getintvar(*vars, "prodid");
4548 + si->boardvendor = VENDOR_BROADCOM;
4549 + si->boardtype = 0xffff;
4553 + if (si->boardtype == 0) {
4554 + SB_ERROR(("sb_attach: unknown board type\n"));
4555 + ASSERT(si->boardtype);
4558 + return ((void*)si);
4561 + MFREE(si, sizeof (sb_info_t));
4566 +sb_coreid(void *sbh)
4571 + si = SB_INFO(sbh);
4572 + sb = REGS2SB(si->curmap);
4574 + return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT);
4578 +sb_coreidx(void *sbh)
4582 + si = SB_INFO(sbh);
4583 + return (si->curidx);
4586 +/* return current index of core */
4588 +_sb_coreidx(void *sbh)
4592 + uint32 sbaddr = 0;
4594 + si = SB_INFO(sbh);
4597 + switch (si->bus) {
4599 + sb = REGS2SB(si->curmap);
4600 + sbaddr = sb_base(R_SBREG(sbh, &sb->sbadmatch0));
4604 + sbaddr = OSL_PCI_READ_CONFIG(si->osh, PCI_BAR0_WIN, sizeof (uint32));
4607 + case PCMCIA_BUS: {
4610 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1);
4611 + sbaddr = (uint)tmp << 12;
4612 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1);
4613 + sbaddr |= (uint)tmp << 16;
4614 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1);
4615 + sbaddr |= (uint)tmp << 24;
4622 + ASSERT(GOODCOREADDR(sbaddr));
4623 + return ((sbaddr - SB_ENUM_BASE)/SB_CORE_SIZE);
4627 +sb_corevendor(void *sbh)
4632 + si = SB_INFO(sbh);
4633 + sb = REGS2SB(si->curmap);
4635 + return ((R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT);
4639 +sb_corerev(void *sbh)
4644 + si = SB_INFO(sbh);
4645 + sb = REGS2SB(si->curmap);
4647 + return (R_SBREG(sbh, &(sb)->sbidhigh) & SBIDH_RC_MASK);
4650 +#define SBTML_ALLOW (SBTML_PE | SBTML_FGC | SBTML_FL_MASK)
4652 +/* set/clear sbtmstatelow core-specific flags */
4654 +sb_coreflags(void *sbh, uint32 mask, uint32 val)
4660 + si = SB_INFO(sbh);
4661 + sb = REGS2SB(si->curmap);
4663 + ASSERT((val & ~mask) == 0);
4664 + ASSERT((mask & ~SBTML_ALLOW) == 0);
4666 + /* mask and set */
4667 + if (mask || val) {
4668 + w = (R_SBREG(sbh, &sb->sbtmstatelow) & ~mask) | val;
4669 + W_SBREG(sbh, &sb->sbtmstatelow, w);
4672 + /* return the new value */
4673 + return (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_ALLOW);
4676 +/* set/clear sbtmstatehigh core-specific flags */
4678 +sb_coreflagshi(void *sbh, uint32 mask, uint32 val)
4684 + si = SB_INFO(sbh);
4685 + sb = REGS2SB(si->curmap);
4687 + ASSERT((val & ~mask) == 0);
4688 + ASSERT((mask & ~SBTMH_FL_MASK) == 0);
4690 + /* mask and set */
4691 + if (mask || val) {
4692 + w = (R_SBREG(sbh, &sb->sbtmstatehigh) & ~mask) | val;
4693 + W_SBREG(sbh, &sb->sbtmstatehigh, w);
4696 + /* return the new value */
4697 + return (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_FL_MASK);
4701 +sb_iscoreup(void *sbh)
4706 + si = SB_INFO(sbh);
4707 + sb = REGS2SB(si->curmap);
4709 + return ((R_SBREG(sbh, &(sb)->sbtmstatelow) & (SBTML_RESET | SBTML_REJ | SBTML_CLK)) == SBTML_CLK);
4713 + * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation,
4714 + * switch back to the original core, and return the new value.
4717 +sb_corereg(void *sbh, uint coreidx, uint regoff, uint mask, uint val)
4723 + uint intr_val = 0;
4725 + ASSERT(GOODIDX(coreidx));
4726 + ASSERT(regoff < SB_CORE_SIZE);
4727 + ASSERT((val & ~mask) == 0);
4729 + si = SB_INFO(sbh);
4731 + /* save current core index */
4732 + origidx = sb_coreidx(sbh);
4735 + INTR_OFF(si, intr_val);
4736 + r = (uint32*) ((uint) sb_setcoreidx(sbh, coreidx) + regoff);
4738 + /* mask and set */
4739 + if (mask || val) {
4740 + if (regoff >= SBCONFIGOFF) {
4741 + w = (R_SBREG(sbh, r) & ~mask) | val;
4742 + W_SBREG(sbh, r, w);
4744 + w = (R_REG(r) & ~mask) | val;
4750 + w = R_SBREG(sbh, r);
4752 + /* restore core index */
4753 + if (origidx != coreidx)
4754 + sb_setcoreidx(sbh, origidx);
4756 + INTR_RESTORE(si, intr_val);
4760 +/* scan the sb enumerated space to identify all cores */
4762 +sb_scan(sb_info_t *si)
4770 + /* numcores should already be set */
4771 + ASSERT((si->numcores > 0) && (si->numcores <= SB_MAXCORES));
4773 + /* save current core index */
4774 + origidx = sb_coreidx(sbh);
4776 + si->pciidx = si->gpioidx = BADIDX;
4778 + for (i = 0; i < si->numcores; i++) {
4779 + sb_setcoreidx(sbh, i);
4780 + si->coreid[i] = sb_coreid(sbh);
4782 + if (si->coreid[i] == SB_CC)
4783 + si->ccrev = sb_corerev(sbh);
4785 + else if (si->coreid[i] == SB_PCI) {
4787 + si->pcirev = sb_corerev(sbh);
4789 + }else if (si->coreid[i] == SB_PCMCIA){
4790 + si->pcmciaidx = i;
4791 + si->pcmciarev = sb_corerev(sbh);
4796 + * Find the gpio "controlling core" type and index.
4798 + * - if there's a chip common core - use that
4799 + * - else if there's a pci core (rev >= 2) - use that
4800 + * - else there had better be an extif core (4710 only)
4802 + if (GOODIDX(sb_findcoreidx(sbh, SB_CC, 0))) {
4803 + si->gpioidx = sb_findcoreidx(sbh, SB_CC, 0);
4804 + si->gpioid = SB_CC;
4805 + } else if (GOODIDX(si->pciidx) && (si->pcirev >= 2)) {
4806 + si->gpioidx = si->pciidx;
4807 + si->gpioid = SB_PCI;
4808 + } else if (sb_findcoreidx(sbh, SB_EXTIF, 0)) {
4809 + si->gpioidx = sb_findcoreidx(sbh, SB_EXTIF, 0);
4810 + si->gpioid = SB_EXTIF;
4813 + /* return to original core index */
4814 + sb_setcoreidx(sbh, origidx);
4817 +/* may be called with core in reset */
4819 +sb_detach(void *sbh)
4824 + si = SB_INFO(sbh);
4829 + if (si->bus == SB_BUS)
4830 + for (idx = 0; idx < SB_MAXCORES; idx++)
4831 + if (si->regs[idx]) {
4832 + REG_UNMAP(si->regs[idx]);
4833 + si->regs[idx] = NULL;
4836 + MFREE(si, sizeof (sb_info_t));
4839 +/* use pci dev id to determine chip id for chips not having a chipcommon core */
4841 +sb_pcidev2chip(uint pcidev)
4843 + if ((pcidev >= BCM4710_DEVICE_ID) && (pcidev <= BCM47XX_USB_ID))
4844 + return (BCM4710_DEVICE_ID);
4845 + if ((pcidev >= BCM4610_DEVICE_ID) && (pcidev <= BCM4610_USB_ID))
4846 + return (BCM4610_DEVICE_ID);
4847 + if ((pcidev >= BCM4402_DEVICE_ID) && (pcidev <= BCM4402_V90_ID))
4848 + return (BCM4402_DEVICE_ID);
4849 + if ((pcidev >= BCM4307_V90_ID) && (pcidev <= BCM4307_D11B_ID))
4850 + return (BCM4307_DEVICE_ID);
4851 + if (pcidev == BCM4301_DEVICE_ID)
4852 + return (BCM4301_DEVICE_ID);
4857 +/* convert chip number to number of i/o cores */
4859 +sb_chip2numcores(uint chip)
4861 + if (chip == 0x4710)
4863 + if (chip == 0x4610)
4865 + if (chip == 0x4402)
4867 + if ((chip == 0x4307) || (chip == 0x4301))
4869 + if (chip == 0x4310)
4871 + if (chip == 0x4306) /* < 4306c0 */
4873 + if (chip == 0x4704)
4875 + if (chip == 0x5365)
4878 + SB_ERROR(("sb_chip2numcores: unsupported chip 0x%x\n", chip));
4883 +/* return index of coreid or BADIDX if not found */
4885 +sb_findcoreidx(void *sbh, uint coreid, uint coreunit)
4891 + si = SB_INFO(sbh);
4894 + for (i = 0; i < si->numcores; i++)
4895 + if (si->coreid[i] == coreid) {
4896 + if (found == coreunit)
4904 +/* change logical "focus" to the indiciated core */
4906 +sb_setcoreidx(void *sbh, uint coreidx)
4912 + si = SB_INFO(sbh);
4914 + if (coreidx >= si->numcores)
4918 + * If the user has provided an interrupt mask enabled function,
4919 + * then assert interrupts are disabled before switching the core.
4921 + ASSERT((si->imf == NULL) || !(*si->imf)(si->imfarg));
4923 + sbaddr = SB_ENUM_BASE + (coreidx * SB_CORE_SIZE);
4925 + switch (si->bus) {
4928 + if (!si->regs[coreidx]) {
4929 + si->regs[coreidx] = (void*)REG_MAP(sbaddr, SB_CORE_SIZE);
4930 + ASSERT(GOODREGS(si->regs[coreidx]));
4932 + si->curmap = si->regs[coreidx];
4936 + /* point bar0 window */
4937 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_BAR0_WIN, 4, sbaddr);
4941 + tmp = (sbaddr >> 12) & 0x0f;
4942 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR0, &tmp, 1);
4943 + tmp = (sbaddr >> 16) & 0xff;
4944 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR1, &tmp, 1);
4945 + tmp = (sbaddr >> 24) & 0xff;
4946 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_ADDR2, &tmp, 1);
4950 + si->curidx = coreidx;
4952 + return (si->curmap);
4955 +/* change logical "focus" to the indicated core */
4957 +sb_setcore(void *sbh, uint coreid, uint coreunit)
4962 + si = SB_INFO(sbh);
4964 + idx = sb_findcoreidx(sbh, coreid, coreunit);
4965 + if (!GOODIDX(idx))
4968 + return (sb_setcoreidx(sbh, idx));
4971 +/* return chip number */
4977 + si = SB_INFO(sbh);
4978 + return (si->chip);
4981 +/* return chip revision number */
4983 +sb_chiprev(void *sbh)
4987 + si = SB_INFO(sbh);
4988 + return (si->chiprev);
4991 +/* return chip package option */
4993 +sb_chippkg(void *sbh)
4997 + si = SB_INFO(sbh);
4998 + return (si->chippkg);
5001 +/* return board vendor id */
5003 +sb_boardvendor(void *sbh)
5007 + si = SB_INFO(sbh);
5008 + return (si->boardvendor);
5011 +/* return boardtype */
5013 +sb_boardtype(void *sbh)
5018 + si = SB_INFO(sbh);
5020 + if (si->bus == SB_BUS && si->boardtype == 0xffff) {
5021 + /* boardtype format is a hex string */
5022 + si->boardtype = getintvar(NULL, "boardtype");
5024 + /* backward compatibility for older boardtype string format */
5025 + if ((si->boardtype == 0) && (var = getvar(NULL, "boardtype"))) {
5026 + if (!strcmp(var, "bcm94710dev"))
5027 + si->boardtype = BCM94710D_BOARD;
5028 + else if (!strcmp(var, "bcm94710ap"))
5029 + si->boardtype = BCM94710AP_BOARD;
5030 + else if (!strcmp(var, "bcm94310u"))
5031 + si->boardtype = BCM94310U_BOARD;
5032 + else if (!strcmp(var, "bu4711"))
5033 + si->boardtype = BU4711_BOARD;
5034 + else if (!strcmp(var, "bu4710"))
5035 + si->boardtype = BU4710_BOARD;
5036 + else if (!strcmp(var, "bcm94702mn"))
5037 + si->boardtype = BCM94702MN_BOARD;
5038 + else if (!strcmp(var, "bcm94710r1"))
5039 + si->boardtype = BCM94710R1_BOARD;
5040 + else if (!strcmp(var, "bcm94710r4"))
5041 + si->boardtype = BCM94710R4_BOARD;
5042 + else if (!strcmp(var, "bcm94702cpci"))
5043 + si->boardtype = BCM94702CPCI_BOARD;
5044 + else if (!strcmp(var, "bcm95380_rr"))
5045 + si->boardtype = BCM95380RR_BOARD;
5049 + return (si->boardtype);
5052 +/* return board bus style */
5054 +sb_boardstyle(void *sbh)
5059 + si = SB_INFO(sbh);
5061 + if (si->bus == PCMCIA_BUS)
5062 + return (BOARDSTYLE_PCMCIA);
5064 + if (si->bus == SB_BUS)
5065 + return (BOARDSTYLE_SOC);
5069 + if (OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CIS, sizeof (uint32)) != 0)
5070 + return (BOARDSTYLE_CARDBUS);
5072 + if ((srom_read(si->bus, si->curmap, si->osh, (SPROM_SIZE - 1) * 2, 2, &w) == 0) &&
5074 + return (BOARDSTYLE_CARDBUS);
5076 + return (BOARDSTYLE_PCI);
5079 +/* return boolean if sbh device is in pci hostmode or client mode */
5085 + si = SB_INFO(sbh);
5089 +/* return list of found cores */
5091 +sb_corelist(void *sbh, uint coreid[])
5095 + si = SB_INFO(sbh);
5097 + bcopy((uchar*)si->coreid, (uchar*)coreid, (si->numcores * sizeof (uint)));
5098 + return (si->numcores);
5101 +/* return current register mapping */
5103 +sb_coreregs(void *sbh)
5107 + si = SB_INFO(sbh);
5108 + ASSERT(GOODREGS(si->curmap));
5110 + return (si->curmap);
5113 +/* Check if a target abort has happened and clear it */
5115 +sb_taclear(void *sbh)
5121 + si = SB_INFO(sbh);
5122 + sb = REGS2SB(si->curmap);
5124 + if (si->bus == PCI_BUS) {
5127 + stcmd = OSL_PCI_READ_CONFIG(si->osh, PCI_CFG_CMD, sizeof(stcmd));
5128 + rc = (stcmd & 0x08000000) != 0;
5131 + /* Target abort bit is set, clear it */
5132 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_CFG_CMD, sizeof(stcmd), stcmd);
5134 + } else if (si->bus == PCMCIA_BUS) {
5137 + else if (si->bus == SDIO_BUS) {
5138 + /* due to 4317 A0 HW bug, sdio core wedged on target abort,
5139 + just clear SBSErr bit blindly */
5140 + if (0x0 != R_SBREG(sbh, &sb->sbtmerrlog)) {
5141 + SB_ERROR(("SDIO target abort, clean it"));
5142 + W_SBREG(sbh, &sb->sbtmstatehigh, 0);
5150 +/* do buffered registers update */
5152 +sb_commit(void *sbh)
5155 + sbpciregs_t *pciregs;
5157 + uint intr_val = 0;
5159 + si = SB_INFO(sbh);
5161 + origidx = si->curidx;
5162 + ASSERT(GOODIDX(origidx));
5164 + INTR_OFF(si, intr_val);
5165 + /* switch over to pci core */
5166 + pciregs = (sbpciregs_t*) sb_setcore(sbh, SB_PCI, 0);
5168 + /* do the buffer registers update */
5169 + W_REG(&pciregs->bcastaddr, SB_COMMIT);
5170 + W_REG(&pciregs->bcastdata, 0x0);
5172 + /* restore core index */
5173 + sb_setcoreidx(sbh, origidx);
5174 + INTR_RESTORE(si, intr_val);
5177 +/* reset and re-enable a core */
5179 +sb_core_reset(void *sbh, uint32 bits)
5183 + volatile uint32 dummy;
5185 + si = SB_INFO(sbh);
5186 + ASSERT(GOODREGS(si->curmap));
5187 + sb = REGS2SB(si->curmap);
5190 + * Must do the disable sequence first to work for arbitrary current core state.
5192 + sb_core_disable(sbh, bits);
5195 + * Now do the initialization sequence.
5198 + /* set reset while enabling the clock and forcing them on throughout the core */
5199 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | SBTML_RESET | bits));
5200 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
5202 + if (sb_coreid(sbh) == SB_ILINE100) {
5208 + if (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_SERR) {
5209 + W_SBREG(sbh, &sb->sbtmstatehigh, 0);
5211 + if ((dummy = R_SBREG(sbh, &sb->sbimstate)) & (SBIM_IBE | SBIM_TO)) {
5212 + AND_SBREG(sbh, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO));
5215 + /* clear reset and allow it to propagate throughout the core */
5216 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_FGC | SBTML_CLK | bits));
5217 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
5220 + /* leave clock enabled */
5221 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | bits));
5222 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
5227 +sb_core_tofixup(void *sbh)
5232 + si = SB_INFO(sbh);
5234 + if (si->pcirev >= 5)
5237 + ASSERT(GOODREGS(si->curmap));
5238 + sb = REGS2SB(si->curmap);
5240 + if (si->bus == SB_BUS) {
5241 + SET_SBREG(sbh, &sb->sbimconfiglow,
5242 + SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
5243 + (0x5 << SBIMCL_RTO_SHIFT) | 0x3);
5245 + if (sb_coreid(sbh) == SB_PCI) {
5246 + SET_SBREG(sbh, &sb->sbimconfiglow,
5247 + SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
5248 + (0x3 << SBIMCL_RTO_SHIFT) | 0x2);
5250 + SET_SBREG(sbh, &sb->sbimconfiglow, (SBIMCL_RTO_MASK | SBIMCL_STO_MASK), 0);
5258 +sb_core_disable(void *sbh, uint32 bits)
5261 + volatile uint32 dummy;
5264 + si = SB_INFO(sbh);
5266 + ASSERT(GOODREGS(si->curmap));
5267 + sb = REGS2SB(si->curmap);
5269 + /* must return if core is already in reset */
5270 + if (R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_RESET)
5273 + /* put into reset and return if clocks are not enabled */
5274 + if ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_CLK) == 0)
5277 + /* set the reject bit */
5278 + W_SBREG(sbh, &sb->sbtmstatelow, (SBTML_CLK | SBTML_REJ));
5280 + /* spin until reject is set */
5281 + while ((R_SBREG(sbh, &sb->sbtmstatelow) & SBTML_REJ) == 0)
5284 + /* spin until sbtmstatehigh.busy is clear */
5285 + while (R_SBREG(sbh, &sb->sbtmstatehigh) & SBTMH_BUSY)
5288 + /* set reset and reject while enabling the clocks */
5289 + W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_FGC | SBTML_CLK | SBTML_REJ | SBTML_RESET));
5290 + dummy = R_SBREG(sbh, &sb->sbtmstatelow);
5294 + /* leave reset and reject asserted */
5295 + W_SBREG(sbh, &sb->sbtmstatelow, (bits | SBTML_REJ | SBTML_RESET));
5300 +sb_watchdog(void *sbh, uint ticks)
5302 + sb_info_t *si = SB_INFO(sbh);
5305 + switch (si->gpioid) {
5307 + sb_corereg(sbh, si->gpioidx, OFFSETOF(chipcregs_t, watchdog), ~0, ticks);
5310 + sb_corereg(sbh, si->gpioidx, OFFSETOF(extifregs_t, watchdog), ~0, ticks);
5315 +/* initialize the pcmcia core */
5317 +sb_pcmcia_init(void *sbh)
5322 + si = SB_INFO(sbh);
5324 + /* enable d11 mac interrupts */
5325 + if (si->chip == BCM4301_DEVICE_ID) {
5326 + /* Have to use FCR2 in 4301 */
5327 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1);
5328 + cor |= COR_IRQEN | COR_FUNEN;
5329 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR2 + PCMCIA_COR, &cor, 1);
5331 + OSL_PCMCIA_READ_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1);
5332 + cor |= COR_IRQEN | COR_FUNEN;
5333 + OSL_PCMCIA_WRITE_ATTR(si->osh, PCMCIA_FCR0 + PCMCIA_COR, &cor, 1);
5340 + * Configure the pci core for pci client (NIC) action
5341 + * and get appropriate dma offset value.
5342 + * coremask is the bitvec of cores by index to be enabled.
5345 +sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask)
5349 + sbpciregs_t *pciregs;
5354 + si = SB_INFO(sbh);
5359 + /* if not pci bus, we're done */
5360 + if (si->bus != PCI_BUS)
5363 + ASSERT(si->pciidx);
5365 + /* get current core index */
5368 + /* we interrupt on this backplane flag number */
5369 + ASSERT(GOODREGS(si->curmap));
5370 + sb = REGS2SB(si->curmap);
5371 + sbflag = R_SBREG(sbh, &sb->sbtpsflag) & SBTPS_NUM0_MASK;
5373 + /* switch over to pci core */
5374 + pciregs = (sbpciregs_t*) sb_setcoreidx(sbh, si->pciidx);
5375 + sb = REGS2SB(pciregs);
5378 + * Enable sb->pci interrupts. Assume
5379 + * PCI rev 2.3 support was added in pci core rev 6 and things changed..
5381 + if (si->pcirev < 6) {
5382 + /* set sbintvec bit for our flag number */
5383 + OR_SBREG(sbh, &sb->sbintvec, (1 << sbflag));
5385 + /* pci config write to set this core bit in PCIIntMask */
5386 + w = OSL_PCI_READ_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32));
5387 + w |= (coremask << PCI_SBIM_SHIFT);
5388 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_INT_MASK, sizeof(uint32), w);
5391 + /* enable prefetch and bursts for sonics-to-pci translation 2 */
5392 + OR_REG(&pciregs->sbtopci2, (SBTOPCI_PREF|SBTOPCI_BURST));
5394 + if (si->pcirev < 5) {
5395 + SET_SBREG(sbh, &sb->sbimconfiglow, SBIMCL_RTO_MASK | SBIMCL_STO_MASK,
5396 + (0x3 << SBIMCL_RTO_SHIFT) | 0x2);
5400 + /* switch back to previous core */
5401 + sb_setcoreidx(sbh, idx);
5403 + /* use large sb pci dma window */
5405 + *dmaoffset = SB_PCI_DMA;
5409 +sb_base(uint32 admatch)
5414 + type = admatch & SBAM_TYPE_MASK;
5420 + base = admatch & SBAM_BASE0_MASK;
5421 + } else if (type == 1) {
5422 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
5423 + base = admatch & SBAM_BASE1_MASK;
5424 + } else if (type == 2) {
5425 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
5426 + base = admatch & SBAM_BASE2_MASK;
5433 +sb_size(uint32 admatch)
5438 + type = admatch & SBAM_TYPE_MASK;
5444 + size = 1 << (((admatch & SBAM_ADINT0_MASK) >> SBAM_ADINT0_SHIFT) + 1);
5445 + } else if (type == 1) {
5446 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
5447 + size = 1 << (((admatch & SBAM_ADINT1_MASK) >> SBAM_ADINT1_SHIFT) + 1);
5448 + } else if (type == 2) {
5449 + ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */
5450 + size = 1 << (((admatch & SBAM_ADINT2_MASK) >> SBAM_ADINT2_SHIFT) + 1);
5456 +/* return the core-type instantiation # of the current core */
5458 +sb_coreunit(void *sbh)
5466 + si = SB_INFO(sbh);
5471 + ASSERT(GOODREGS(si->curmap));
5472 + coreid = sb_coreid(sbh);
5474 + /* count the cores of our type */
5475 + for (i = 0; i < idx; i++)
5476 + if (si->coreid[i] == coreid)
5479 + return (coreunit);
5482 +static INLINE uint32
5486 + case CC_F6_2: return 2;
5487 + case CC_F6_3: return 3;
5488 + case CC_F6_4: return 4;
5489 + case CC_F6_5: return 5;
5490 + case CC_F6_6: return 6;
5491 + case CC_F6_7: return 7;
5492 + default: return 0;
5496 +/* calculate the speed the SB would run at given a set of clockcontrol values */
5498 +sb_clock_rate(uint32 pll_type, uint32 n, uint32 m)
5500 + uint32 n1, n2, clock, m1, m2, m3, mc;
5502 + n1 = n & CN_N1_MASK;
5503 + n2 = (n & CN_N2_MASK) >> CN_N2_SHIFT;
5505 + if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
5508 + } else if (pll_type == PLL_TYPE2) {
5511 + ASSERT((n1 >= 2) && (n1 <= 7));
5512 + ASSERT((n2 >= 5) && (n2 <= 23));
5513 + } else if (pll_type == PLL_TYPE3) {
5514 + return (100000000);
5516 + ASSERT((pll_type >= PLL_TYPE1) && (pll_type <= PLL_TYPE4));
5518 + clock = CC_CLOCK_BASE * n1 * n2;
5523 + m1 = m & CC_M1_MASK;
5524 + m2 = (m & CC_M2_MASK) >> CC_M2_SHIFT;
5525 + m3 = (m & CC_M3_MASK) >> CC_M3_SHIFT;
5526 + mc = (m & CC_MC_MASK) >> CC_MC_SHIFT;
5528 + if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE4)) {
5530 + if (pll_type == PLL_TYPE1)
5537 + case CC_MC_BYPASS: return (clock);
5538 + case CC_MC_M1: return (clock / m1);
5539 + case CC_MC_M1M2: return (clock / (m1 * m2));
5540 + case CC_MC_M1M2M3: return (clock / (m1 * m2 * m3));
5541 + case CC_MC_M1M3: return (clock / (m1 * m3));
5542 + default: return (0);
5545 + ASSERT(pll_type == PLL_TYPE2);
5548 + m2 += CC_T2M2_BIAS;
5550 + ASSERT((m1 >= 2) && (m1 <= 7));
5551 + ASSERT((m2 >= 3) && (m2 <= 10));
5552 + ASSERT((m3 >= 2) && (m3 <= 7));
5554 + if ((mc & CC_T2MC_M1BYP) == 0)
5556 + if ((mc & CC_T2MC_M2BYP) == 0)
5558 + if ((mc & CC_T2MC_M3BYP) == 0)
5565 +/* returns the current speed the SB is running at */
5567 +sb_clock(void *sbh)
5574 + uint32 pll_type, rate;
5575 + uint intr_val = 0;
5577 + si = SB_INFO(sbh);
5579 + pll_type = PLL_TYPE1;
5581 + INTR_OFF(si, intr_val);
5583 + /* switch to extif or chipc core */
5584 + if ((eir = (extifregs_t *) sb_setcore(sbh, SB_EXTIF, 0))) {
5585 + n = R_REG(&eir->clockcontrol_n);
5586 + m = R_REG(&eir->clockcontrol_sb);
5587 + } else if ((cc = (chipcregs_t *) sb_setcore(sbh, SB_CC, 0))) {
5588 + pll_type = R_REG(&cc->capabilities) & CAP_PLL_MASK;
5589 + n = R_REG(&cc->clockcontrol_n);
5590 + m = R_REG(&cc->clockcontrol_sb);
5592 + INTR_RESTORE(si, intr_val);
5596 + /* calculate rate */
5597 + rate = sb_clock_rate(pll_type, n, m);
5599 + /* switch back to previous core */
5600 + sb_setcoreidx(sbh, idx);
5602 + INTR_RESTORE(si, intr_val);
5607 +/* change logical "focus" to the gpio core for optimized access */
5609 +sb_gpiosetcore(void *sbh)
5613 + si = SB_INFO(sbh);
5615 + return (sb_setcoreidx(sbh, si->gpioidx));
5618 +/* mask&set gpiocontrol bits */
5620 +sb_gpiocontrol(void *sbh, uint32 mask, uint32 val)
5625 + si = SB_INFO(sbh);
5628 + switch (si->gpioid) {
5630 + regoff = OFFSETOF(chipcregs_t, gpiocontrol);
5634 + regoff = OFFSETOF(sbpciregs_t, gpiocontrol);
5641 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
5644 +/* mask&set gpio output enable bits */
5646 +sb_gpioouten(void *sbh, uint32 mask, uint32 val)
5651 + si = SB_INFO(sbh);
5654 + switch (si->gpioid) {
5656 + regoff = OFFSETOF(chipcregs_t, gpioouten);
5660 + regoff = OFFSETOF(sbpciregs_t, gpioouten);
5664 + regoff = OFFSETOF(extifregs_t, gpio[0].outen);
5668 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
5671 +/* mask&set gpio output bits */
5673 +sb_gpioout(void *sbh, uint32 mask, uint32 val)
5678 + si = SB_INFO(sbh);
5681 + switch (si->gpioid) {
5683 + regoff = OFFSETOF(chipcregs_t, gpioout);
5687 + regoff = OFFSETOF(sbpciregs_t, gpioout);
5691 + regoff = OFFSETOF(extifregs_t, gpio[0].out);
5695 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
5698 +/* return the current gpioin register value */
5700 +sb_gpioin(void *sbh)
5705 + si = SB_INFO(sbh);
5708 + switch (si->gpioid) {
5710 + regoff = OFFSETOF(chipcregs_t, gpioin);
5714 + regoff = OFFSETOF(sbpciregs_t, gpioin);
5718 + regoff = OFFSETOF(extifregs_t, gpioin);
5722 + return (sb_corereg(sbh, si->gpioidx, regoff, 0, 0));
5725 +/* mask&set gpio interrupt polarity bits */
5727 +sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val)
5732 + si = SB_INFO(sbh);
5735 + switch (si->gpioid) {
5737 + regoff = OFFSETOF(chipcregs_t, gpiointpolarity);
5741 + /* pci gpio implementation does not support interrupt polarity */
5746 + regoff = OFFSETOF(extifregs_t, gpiointpolarity);
5750 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
5753 +/* mask&set gpio interrupt mask bits */
5755 +sb_gpiointmask(void *sbh, uint32 mask, uint32 val)
5760 + si = SB_INFO(sbh);
5763 + switch (si->gpioid) {
5765 + regoff = OFFSETOF(chipcregs_t, gpiointmask);
5769 + /* pci gpio implementation does not support interrupt mask */
5774 + regoff = OFFSETOF(extifregs_t, gpiointmask);
5778 + return (sb_corereg(sbh, si->gpioidx, regoff, mask, val));
5783 + * Return the slowclock min or max frequency.
5784 + * Three sources of SLOW CLOCK:
5785 + * 1. On Chip LPO - 32khz or 160khz
5786 + * 2. On Chip Xtal OSC - 20mhz/4*(divider+1)
5787 + * 3. External PCI clock - 66mhz/4*(divider+1)
5790 +slowfreq(void *sbh, bool max)
5797 + si = SB_INFO(sbh);
5799 + ASSERT(sb_coreid(sbh) == SB_CC);
5801 + cc = (chipcregs_t*) sb_setcoreidx(sbh, si->curidx);
5803 + /* shouldn't be here unless we've established the chip has dynamic power control */
5804 + ASSERT(R_REG(&cc->capabilities) & CAP_PWR_CTL);
5806 + if (si->ccrev < 6) {
5807 + v = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32));
5809 + if (v & PCI_CFG_GPIO_SCS)
5810 + return (max? (PCIMAXFREQ/64) : (PCIMINFREQ/64));
5812 + return (max? (XTALMAXFREQ/32) : (XTALMINFREQ/32));
5814 + v = R_REG(&cc->slow_clk_ctl) & SCC_SS_MASK;
5815 + div = 4 * (((R_REG(&cc->slow_clk_ctl) & SCC_CD_MASK) >> SCC_CD_SHF) + 1);
5816 + if (v == SCC_SS_LPO)
5817 + return (max? LPOMAXFREQ : LPOMINFREQ);
5818 + else if (v == SCC_SS_XTAL)
5819 + return (max? (XTALMAXFREQ/div) : (XTALMINFREQ/div));
5820 + else if (v == SCC_SS_PCI)
5821 + return (max? (PCIMAXFREQ/div) : (PCIMINFREQ/div));
5828 +/* initialize power control delay registers */
5830 +sb_pwrctl_init(void *sbh)
5836 + uint pll_on_delay, fref_sel_delay;
5838 + si = SB_INFO(sbh);
5840 + if (si->bus == SB_BUS)
5843 + origidx = si->curidx;
5845 + if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL)
5848 + if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
5851 + slowmaxfreq = slowfreq(sbh, TRUE);
5852 + pll_on_delay = ((slowmaxfreq * PLL_DELAY) + 999999) / 1000000;
5853 + fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000;
5855 + W_REG(&cc->pll_on_delay, pll_on_delay);
5856 + W_REG(&cc->fref_sel_delay, fref_sel_delay);
5858 + /* 4317pc does not work with SlowClock less than 5Mhz */
5859 + if (si->bus == PCMCIA_BUS)
5860 + SET_REG(&cc->slow_clk_ctl, SCC_CD_MASK, (0 << SCC_CD_SHF));
5863 + sb_setcoreidx(sbh, origidx);
5866 +/* return the value suitable for writing to the dot11 core FAST_PWRUP_DELAY register */
5868 +sb_pwrctl_fast_pwrup_delay(void *sbh)
5875 + uint intr_val = 0;
5877 + si = SB_INFO(sbh);
5879 + origidx = si->curidx;
5881 + if (si->bus == SB_BUS)
5884 + INTR_OFF(si, intr_val);
5886 + if ((cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0)) == NULL)
5889 + if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
5892 + slowminfreq = slowfreq(sbh, FALSE);
5893 + fpdelay = (((R_REG(&cc->pll_on_delay) + 2) * 1000000) + (slowminfreq - 1)) / slowminfreq;
5896 + sb_setcoreidx(sbh, origidx);
5897 + INTR_RESTORE(si, intr_val);
5901 +/* turn primary xtal and/or pll off/on */
5903 +sb_pwrctl_xtal(void *sbh, uint what, bool on)
5906 + uint32 in, out, outen;
5908 + si = SB_INFO(sbh);
5911 + if (si->bus == PCMCIA_BUS) {
5915 + if (si->bus != PCI_BUS)
5918 + in = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_IN, sizeof (uint32));
5919 + out = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32));
5920 + outen = OSL_PCI_READ_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32));
5923 + * We can't actually read the state of the PLLPD so we infer it
5924 + * by the value of XTAL_PU which *is* readable via gpioin.
5926 + if (on && (in & PCI_CFG_GPIO_XTAL))
5930 + outen |= PCI_CFG_GPIO_XTAL;
5932 + outen |= PCI_CFG_GPIO_PLL;
5935 + /* turn primary xtal on */
5936 + if (what & XTAL) {
5937 + out |= PCI_CFG_GPIO_XTAL;
5939 + out |= PCI_CFG_GPIO_PLL;
5940 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
5941 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen);
5947 + out &= ~PCI_CFG_GPIO_PLL;
5948 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
5953 + out &= ~PCI_CFG_GPIO_XTAL;
5955 + out |= PCI_CFG_GPIO_PLL;
5956 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUT, sizeof (uint32), out);
5957 + OSL_PCI_WRITE_CONFIG(si->osh, PCI_GPIO_OUTEN, sizeof (uint32), outen);
5963 +/* set dynamic power control mode (forceslow, forcefast, dynamic) */
5964 +/* returns true if ignore pll off is set and false if it is not */
5966 +sb_pwrctl_clk(void *sbh, uint mode)
5972 + bool forcefastclk=FALSE;
5973 + uint intr_val = 0;
5975 + si = SB_INFO(sbh);
5977 + /* chipcommon cores prior to rev6 don't support slowclkcontrol */
5978 + if (si->ccrev < 6)
5981 + INTR_OFF(si, intr_val);
5983 + origidx = si->curidx;
5985 + cc = (chipcregs_t*) sb_setcore(sbh, SB_CC, 0);
5986 + ASSERT(cc != NULL);
5988 + if (!(R_REG(&cc->capabilities) & CAP_PWR_CTL))
5992 + case CLK_FAST: /* force fast (pll) clock */
5993 + /* don't forget to force xtal back on before we clear SCC_DYN_XTAL.. */
5994 + sb_pwrctl_xtal(sbh, XTAL, ON);
5996 + SET_REG(&cc->slow_clk_ctl, (SCC_XC | SCC_FS | SCC_IP), SCC_IP);
5999 + case CLK_SLOW: /* force slow clock */
6000 + if ((si->bus == SDIO_BUS) || (si->bus == PCMCIA_BUS))
6003 + if (si->ccrev >= 6)
6004 + OR_REG(&cc->slow_clk_ctl, SCC_FS);
6007 + case CLK_DYNAMIC: /* enable dynamic power control */
6008 + scc = R_REG(&cc->slow_clk_ctl);
6009 + scc &= ~(SCC_FS | SCC_IP | SCC_XC);
6010 + if ((scc & SCC_SS_MASK) != SCC_SS_XTAL)
6012 + W_REG(&cc->slow_clk_ctl, scc);
6014 + /* for dynamic control, we have to release our xtal_pu "force on" */
6016 + sb_pwrctl_xtal(sbh, XTAL, OFF);
6020 + /* Is the h/w forcing the use of the fast clk */
6021 + forcefastclk = (bool)((R_REG(&cc->slow_clk_ctl) & SCC_IP) == SCC_IP);
6024 + sb_setcoreidx(sbh, origidx);
6025 + INTR_RESTORE(si, intr_val);
6026 + return (forcefastclk);
6029 +/* register driver interrupt disabling and restoring callback functions */
6031 +sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intr_arg)
6035 + si = SB_INFO(sbh);
6036 + si->intr_arg = intr_arg;
6037 + si->intrsoff_fn = (sb_intrsoff_t)intrsoff_fn;
6038 + si->intrsrestore_fn = (sb_intrsrestore_t)intrsrestore_fn;
6039 + /* save current core id. when this function called, the current core
6040 + * must be the core which provides driver functions(il, et, wl, etc.)
6042 + si->dev_coreid = si->coreid[si->curidx];
6046 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcm4710.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcm4710.h
6047 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcm4710.h 1970-01-01 01:00:00.000000000 +0100
6048 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcm4710.h 2005-09-16 10:29:18.172592248 +0200
6051 + * BCM4710 address space map and definitions
6052 + * Think twice before adding to this file, this is not the kitchen sink
6053 + * These definitions are not guaranteed for all 47xx chips, only the 4710
6055 + * Copyright 2001-2003, Broadcom Corporation
6056 + * All Rights Reserved.
6058 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6059 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6060 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6061 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6065 +#ifndef _bcm4710_h_
6066 +#define _bcm4710_h_
6069 +#define BCM4710_SDRAM 0x00000000 /* Physical SDRAM */
6070 +#define BCM4710_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */
6071 +#define BCM4710_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */
6072 +#define BCM4710_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */
6073 +#define BCM4710_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
6074 +#define BCM4710_ENUM 0x18000000 /* Beginning of core enumeration space */
6076 +/* Core register space */
6077 +#define BCM4710_REG_SDRAM 0x18000000 /* SDRAM core registers */
6078 +#define BCM4710_REG_ILINE20 0x18001000 /* InsideLine20 core registers */
6079 +#define BCM4710_REG_EMAC0 0x18002000 /* Ethernet MAC 0 core registers */
6080 +#define BCM4710_REG_CODEC 0x18003000 /* Codec core registers */
6081 +#define BCM4710_REG_USB 0x18004000 /* USB core registers */
6082 +#define BCM4710_REG_PCI 0x18005000 /* PCI core registers */
6083 +#define BCM4710_REG_MIPS 0x18006000 /* MIPS core registers */
6084 +#define BCM4710_REG_EXTIF 0x18007000 /* External Interface core registers */
6085 +#define BCM4710_REG_EMAC1 0x18008000 /* Ethernet MAC 1 core registers */
6087 +#define BCM4710_EXTIF 0x1f000000 /* External Interface base address */
6088 +#define BCM4710_PCMCIA_MEM 0x1f000000 /* External Interface PCMCIA memory access */
6089 +#define BCM4710_PCMCIA_IO 0x1f100000 /* PCMCIA I/O access */
6090 +#define BCM4710_PCMCIA_CONF 0x1f200000 /* PCMCIA configuration */
6091 +#define BCM4710_PROG 0x1f800000 /* Programable interface */
6092 +#define BCM4710_FLASH 0x1fc00000 /* Flash */
6094 +#define BCM4710_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
6096 +#define BCM4710_UART (BCM4710_REG_EXTIF + 0x00000300)
6098 +#define BCM4710_EUART (BCM4710_EXTIF + 0x00800000)
6099 +#define BCM4710_LED (BCM4710_EXTIF + 0x00900000)
6101 +#define SBFLAG_PCI 0
6102 +#define SBFLAG_ENET0 1
6103 +#define SBFLAG_ILINE20 2
6104 +#define SBFLAG_CODEC 3
6105 +#define SBFLAG_USB 4
6106 +#define SBFLAG_EXTIF 5
6107 +#define SBFLAG_ENET1 6
6109 +#ifdef CONFIG_HWSIM
6110 +#define BCM4710_TRACE(trval) do { *((int *)0xa0000f18) = (trval); } while (0)
6112 +#define BCM4710_TRACE(trval)
6116 +/* BCM94702 CPCI -ExtIF used for LocalBus devs */
6118 +#define BCM94702_CPCI_RESET_ADDR BCM4710_EXTIF
6119 +#define BCM94702_CPCI_BOARDID_ADDR (BCM4710_EXTIF | 0x4000)
6120 +#define BCM94702_CPCI_DOC_ADDR (BCM4710_EXTIF | 0x6000)
6121 +#define BCM94702_DOC_ADDR BCM94702_CPCI_DOC_ADDR
6122 +#define BCM94702_CPCI_LED_ADDR (BCM4710_EXTIF | 0xc000)
6123 +#define BCM94702_CPCI_NVRAM_ADDR (BCM4710_EXTIF | 0xe000)
6124 +#define BCM94702_CPCI_NVRAM_SIZE 0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/
6125 +#define BCM94702_CPCI_TOD_REG_BASE (BCM94702_CPCI_NVRAM_ADDR | 0x1ff0)
6127 +#define LED_REG(x) \
6128 + (*(volatile unsigned char *) (KSEG1ADDR(BCM94702_CPCI_LED_ADDR) + (x)))
6131 + * Reset function implemented in PLD. Read or write should trigger hard reset
6133 +#define SYS_HARD_RESET() \
6135 + *( (volatile unsigned char *)\
6136 + KSEG1ADDR(BCM94702_CPCI_RESET_ADDR) ) = 0x80; \
6139 +#endif /* _bcm4710_h_ */
6140 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmdevs.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmdevs.h
6141 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmdevs.h 1970-01-01 01:00:00.000000000 +0100
6142 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmdevs.h 2005-09-16 10:29:18.173592096 +0200
6145 + * Broadcom device-specific manifest constants.
6148 + * Copyright 2001-2003, Broadcom Corporation
6149 + * All Rights Reserved.
6151 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6152 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6153 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6154 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6161 +/* Known PCI vendor Id's */
6162 +#define VENDOR_EPIGRAM 0xfeda
6163 +#define VENDOR_BROADCOM 0x14e4
6164 +#define VENDOR_3COM 0x10b7
6165 +#define VENDOR_NETGEAR 0x1385
6166 +#define VENDOR_DIAMOND 0x1092
6167 +#define VENDOR_DELL 0x1028
6168 +#define VENDOR_HP 0x0e11
6169 +#define VENDOR_APPLE 0x106b
6171 +/* PCI Device Id's */
6172 +#define BCM4210_DEVICE_ID 0x1072 /* never used */
6173 +#define BCM4211_DEVICE_ID 0x4211
6174 +#define BCM4230_DEVICE_ID 0x1086 /* never used */
6175 +#define BCM4231_DEVICE_ID 0x4231
6177 +#define BCM4410_DEVICE_ID 0x4410 /* bcm44xx family pci iline */
6178 +#define BCM4430_DEVICE_ID 0x4430 /* bcm44xx family cardbus iline */
6179 +#define BCM4412_DEVICE_ID 0x4412 /* bcm44xx family pci enet */
6180 +#define BCM4432_DEVICE_ID 0x4432 /* bcm44xx family cardbus enet */
6182 +#define BCM3352_DEVICE_ID 0x3352 /* bcm3352 device id */
6183 +#define BCM3360_DEVICE_ID 0x3360 /* bcm3360 device id */
6185 +#define EPI41210_DEVICE_ID 0xa0fa /* bcm4210 */
6186 +#define EPI41230_DEVICE_ID 0xa10e /* bcm4230 */
6188 +#define BCM47XX_ILINE_ID 0x4711 /* 47xx iline20 */
6189 +#define BCM47XX_V90_ID 0x4712 /* 47xx v90 codec */
6190 +#define BCM47XX_ENET_ID 0x4713 /* 47xx enet */
6191 +#define BCM47XX_EXT_ID 0x4714 /* 47xx external i/f */
6192 +#define BCM47XX_USB_ID 0x4715 /* 47xx usb */
6193 +#define BCM47XX_USBH_ID 0x4716 /* 47xx usb host */
6194 +#define BCM47XX_USBD_ID 0x4717 /* 47xx usb device */
6195 +#define BCM47XX_IPSEC_ID 0x4718 /* 47xx ipsec */
6197 +#define BCM4710_DEVICE_ID 0x4710 /* 4710 primary function 0 */
6199 +#define BCM4610_DEVICE_ID 0x4610 /* 4610 primary function 0 */
6200 +#define BCM4610_ILINE_ID 0x4611 /* 4610 iline100 */
6201 +#define BCM4610_V90_ID 0x4612 /* 4610 v90 codec */
6202 +#define BCM4610_ENET_ID 0x4613 /* 4610 enet */
6203 +#define BCM4610_EXT_ID 0x4614 /* 4610 external i/f */
6204 +#define BCM4610_USB_ID 0x4615 /* 4610 usb */
6206 +#define BCM4402_DEVICE_ID 0x4402 /* 4402 primary function 0 */
6207 +#define BCM4402_ENET_ID 0x4402 /* 4402 enet */
6208 +#define BCM4402_V90_ID 0x4403 /* 4402 v90 codec */
6210 +#define BCM4301_DEVICE_ID 0x4301 /* 4301 primary function 0 */
6211 +#define BCM4301_D11B_ID 0x4301 /* 4301 802.11b */
6213 +#define BCM4307_DEVICE_ID 0x4307 /* 4307 primary function 0 */
6214 +#define BCM4307_V90_ID 0x4305 /* 4307 v90 codec */
6215 +#define BCM4307_ENET_ID 0x4306 /* 4307 enet */
6216 +#define BCM4307_D11B_ID 0x4307 /* 4307 802.11b */
6218 +#define BCM4306_DEVICE_ID 0x4306 /* 4306 chipcommon chipid */
6219 +#define BCM4306_D11G_ID 0x4320 /* 4306 802.11g */
6220 +#define BCM4306_D11G_ID2 0x4325
6221 +#define BCM4306_D11A_ID 0x4321 /* 4306 802.11a */
6222 +#define BCM4306_UART_ID 0x4322 /* 4306 uart */
6223 +#define BCM4306_V90_ID 0x4323 /* 4306 v90 codec */
6224 +#define BCM4306_D11DUAL_ID 0x4324 /* 4306 dual A+B */
6226 +#define BCM4309_PKG_ID 1 /* 4309 package id */
6228 +#define BCM4303_D11B_ID 0x4303 /* 4303 802.11b */
6229 +#define BCM4303_PKG_ID 2 /* 4303 package id */
6231 +#define BCM4310_DEVICE_ID 0x4310 /* 4310 chipcommon chipid */
6232 +#define BCM4310_D11B_ID 0x4311 /* 4310 802.11b */
6233 +#define BCM4310_UART_ID 0x4312 /* 4310 uart */
6234 +#define BCM4310_ENET_ID 0x4313 /* 4310 enet */
6235 +#define BCM4310_USB_ID 0x4315 /* 4310 usb */
6237 +#define BCM4704_DEVICE_ID 0x4704 /* 4704 chipcommon chipid */
6238 +#define BCM4704_ENET_ID 0x4706 /* 4704 enet (Use 47XX_ENET_ID instead!) */
6240 +#define BCM4317_DEVICE_ID 0x4317 /* 4317 chip common chipid */
6242 +#define BCM4712_DEVICE_ID 0x4712 /* 4712 chipcommon chipid */
6243 +#define BCM4712_MIPS_ID 0x4720 /* 4712 base devid */
6244 +#define BCM4712SMALL_PKG_ID 1 /* 200pin 4712 package id */
6246 +#define SDIOH_FPGA_ID 0x4380 /* sdio host fpga */
6248 +#define BCM5365_DEVICE_ID 0x5365 /* 5365 chipcommon chipid */
6251 +/* PCMCIA vendor Id's */
6253 +#define VENDOR_BROADCOM_PCMCIA 0x02d0
6255 +/* SDIO vendor Id's */
6256 +#define VENDOR_BROADCOM_SDIO 0x00BF
6260 +#define BFL_BTCOEXIST 0x0001 /* This board implements Bluetooth coexistance */
6261 +#define BFL_PACTRL 0x0002 /* This board has gpio 9 controlling the PA */
6262 +#define BFL_AIRLINEMODE 0x0004 /* This board implements gpio13 radio disable indication */
6263 +#define BFL_ENETSPI 0x0010 /* This board has ephy roboswitch spi */
6264 +#define BFL_CCKHIPWR 0x0040 /* Can do high-power CCK transmission */
6265 +#define BFL_ENETADM 0x0080 /* This board has ADMtek switch */
6266 +#define BFL_ENETVLAN 0x0100 /* This board can do vlan */
6268 +/* board specific GPIO assignment, gpio 0-3 are also customer-configurable led */
6269 +#define BOARD_GPIO_HWRAD_B 0x010 /* bit 4 is HWRAD input on 4301 */
6270 +#define BOARD_GPIO_BTC_IN 0x080 /* bit 7 is BT Coexistance Input */
6271 +#define BOARD_GPIO_BTC_OUT 0x100 /* bit 8 is BT Coexistance Out */
6272 +#define BOARD_GPIO_PACTRL 0x200 /* bit 9 controls the PA on new 4306 boards */
6273 +#define PCI_CFG_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
6274 +#define PCI_CFG_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
6275 +#define PCI_CFG_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
6276 +#define PCI_CFG_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
6279 +#define SB_BUS 0 /* Silicon Backplane */
6280 +#define PCI_BUS 1 /* PCI target */
6281 +#define PCMCIA_BUS 2 /* PCMCIA target */
6282 +#define SDIO_BUS 3 /* SDIO target */
6284 +/* Reference Board Types */
6286 +#define BU4710_BOARD 0x0400
6287 +#define VSIM4710_BOARD 0x0401
6288 +#define QT4710_BOARD 0x0402
6290 +#define BU4610_BOARD 0x0403
6291 +#define VSIM4610_BOARD 0x0404
6293 +#define BU4307_BOARD 0x0405
6294 +#define BCM94301CB_BOARD 0x0406
6295 +#define BCM94301PC_BOARD 0x0406 /* Pcmcia 5v card */
6296 +#define BCM94301MP_BOARD 0x0407
6297 +#define BCM94307MP_BOARD 0x0408
6298 +#define BCMAP4307_BOARD 0x0409
6300 +#define BU4309_BOARD 0x040a
6301 +#define BCM94309CB_BOARD 0x040b
6302 +#define BCM94309MP_BOARD 0x040c
6303 +#define BCM4309AP_BOARD 0x040d
6305 +#define BCM94302MP_BOARD 0x040e
6307 +#define VSIM4310_BOARD 0x040f
6308 +#define BU4711_BOARD 0x0410
6309 +#define BCM94310U_BOARD 0x0411
6310 +#define BCM94310AP_BOARD 0x0412
6311 +#define BCM94310MP_BOARD 0x0414
6313 +#define BU4306_BOARD 0x0416
6314 +#define BCM94306CB_BOARD 0x0417
6315 +#define BCM94306MP_BOARD 0x0418
6317 +#define BCM94710D_BOARD 0x041a
6318 +#define BCM94710R1_BOARD 0x041b
6319 +#define BCM94710R4_BOARD 0x041c
6320 +#define BCM94710AP_BOARD 0x041d
6323 +#define BU2050_BOARD 0x041f
6326 +#define BCM94309G_BOARD 0x0421
6328 +#define BCM94301PC3_BOARD 0x0422 /* Pcmcia 3.3v card */
6330 +#define BU4704_BOARD 0x0423
6331 +#define BU4702_BOARD 0x0424
6333 +#define BCM94306PC_BOARD 0x0425 /* pcmcia 3.3v 4306 card */
6335 +#define BU4317_BOARD 0x0426
6338 +#define BCM94702MN_BOARD 0x0428
6340 +/* BCM4702 1U CompactPCI Board */
6341 +#define BCM94702CPCI_BOARD 0x0429
6343 +/* BCM4702 with BCM95380 VLAN Router */
6344 +#define BCM95380RR_BOARD 0x042a
6346 +/* cb4306 with SiGe PA */
6347 +#define BCM94306CBSG_BOARD 0x042b
6349 +/* mp4301 with 2050 radio */
6350 +#define BCM94301MPL_BOARD 0x042c
6352 +/* cb4306 with SiGe PA */
6353 +#define PCSG94306_BOARD 0x042d
6355 +/* bu4704 with sdram */
6356 +#define BU4704SD_BOARD 0x042e
6358 +/* Dual 11a/11g Router */
6359 +#define BCM94704AGR_BOARD 0x042f
6361 +/* 11a-only minipci */
6362 +#define BCM94308MP_BOARD 0x0430
6366 +/* BCM94317 boards */
6367 +#define BCM94317CB_BOARD 0x0440
6368 +#define BCM94317MP_BOARD 0x0441
6369 +#define BCM94317PCMCIA_BOARD 0x0442
6370 +#define BCM94317SDIO_BOARD 0x0443
6372 +#define BU4712_BOARD 0x0444
6374 +/* BCM4712 boards */
6375 +#define BCM94712AGR_BOARD 0x0445
6376 +#define BCM94712AP_BOARD 0x0446
6378 +/* BCM4702 boards */
6379 +#define CT4702AP_BOARD 0x0447
6381 +#endif /* _BCMDEVS_H */
6382 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmendian.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmendian.h
6383 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmendian.h 1970-01-01 01:00:00.000000000 +0100
6384 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmendian.h 2005-09-16 10:29:18.173592096 +0200
6386 +/*******************************************************************************
6388 + * Copyright 2001-2003, Broadcom Corporation
6389 + * All Rights Reserved.
6391 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6392 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6393 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6394 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6395 + * local version of endian.h - byte order defines
6396 + ******************************************************************************/
6398 +#ifndef _BCMENDIAN_H_
6399 +#define _BCMENDIAN_H_
6401 +#include <typedefs.h>
6403 +/* Byte swap a 16 bit value */
6404 +#define BCMSWAP16(val) \
6406 + (((uint16)(val) & (uint16)0x00ffU) << 8) | \
6407 + (((uint16)(val) & (uint16)0xff00U) >> 8) ))
6409 +/* Byte swap a 32 bit value */
6410 +#define BCMSWAP32(val) \
6412 + (((uint32)(val) & (uint32)0x000000ffUL) << 24) | \
6413 + (((uint32)(val) & (uint32)0x0000ff00UL) << 8) | \
6414 + (((uint32)(val) & (uint32)0x00ff0000UL) >> 8) | \
6415 + (((uint32)(val) & (uint32)0xff000000UL) >> 24) ))
6417 +static INLINE uint16
6418 +bcmswap16(uint16 val)
6420 + return BCMSWAP16(val);
6423 +static INLINE uint32
6424 +bcmswap32(uint32 val)
6426 + return BCMSWAP32(val);
6429 +/* buf - start of buffer of shorts to swap */
6430 +/* len - byte length of buffer */
6432 +bcmswap16_buf(uint16 *buf, uint len)
6437 + *buf = bcmswap16(*buf);
6443 +#ifndef IL_BIGENDIAN
6444 +#define HTON16(i) BCMSWAP16(i)
6445 +#define hton16(i) bcmswap16(i)
6446 +#define hton32(i) bcmswap32(i)
6447 +#define ntoh16(i) bcmswap16(i)
6448 +#define ntoh32(i) bcmswap32(i)
6449 +#define ltoh16(i) (i)
6450 +#define ltoh32(i) (i)
6451 +#define htol16(i) (i)
6452 +#define htol32(i) (i)
6454 +#define HTON16(i) (i)
6455 +#define hton16(i) (i)
6456 +#define hton32(i) (i)
6457 +#define ntoh16(i) (i)
6458 +#define ntoh32(i) (i)
6459 +#define ltoh16(i) bcmswap16(i)
6460 +#define ltoh32(i) bcmswap32(i)
6461 +#define htol16(i) bcmswap16(i)
6462 +#define htol32(i) bcmswap32(i)
6466 +#ifndef IL_BIGENDIAN
6467 +#define ltoh16_buf(buf, i)
6468 +#define htol16_buf(buf, i)
6470 +#define ltoh16_buf(buf, i) bcmswap16_buf((uint16*)buf, i)
6471 +#define htol16_buf(buf, i) bcmswap16_buf((uint16*)buf, i)
6475 +* load 16-bit value from unaligned little endian byte array.
6477 +static INLINE uint16
6478 +ltoh16_ua(uint8 *bytes)
6480 + return (bytes[1]<<8)+bytes[0];
6484 +* load 32-bit value from unaligned little endian byte array.
6486 +static INLINE uint32
6487 +ltoh32_ua(uint8 *bytes)
6489 + return (bytes[3]<<24)+(bytes[2]<<16)+(bytes[1]<<8)+bytes[0];
6493 +* load 16-bit value from unaligned big(network) endian byte array.
6495 +static INLINE uint16
6496 +ntoh16_ua(uint8 *bytes)
6498 + return (bytes[0]<<8)+bytes[1];
6502 +* load 32-bit value from unaligned big(network) endian byte array.
6504 +static INLINE uint32
6505 +ntoh32_ua(uint8 *bytes)
6507 + return (bytes[0]<<24)+(bytes[1]<<16)+(bytes[2]<<8)+bytes[3];
6510 +#endif /* _BCMENDIAN_H_ */
6511 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenet47xx.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenet47xx.h
6512 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenet47xx.h 1970-01-01 01:00:00.000000000 +0100
6513 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenet47xx.h 2005-09-16 10:29:18.174591944 +0200
6516 + * Hardware-specific definitions for
6517 + * Broadcom BCM47XX 10/100 Mbps Ethernet cores.
6519 + * Copyright 2001-2003, Broadcom Corporation
6520 + * All Rights Reserved.
6522 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6523 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6524 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6525 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6529 +#ifndef _bcmenet_47xx_h_
6530 +#define _bcmenet_47xx_h_
6532 +#include <bcmdevs.h>
6533 +#include <hnddma.h>
6535 +#define BCMENET_NFILTERS 64 /* # ethernet address filter entries */
6536 +#define BCMENET_MCHASHBASE 0x200 /* multicast hash filter base address */
6537 +#define BCMENET_MCHASHSIZE 256 /* multicast hash filter size in bytes */
6538 +#define BCMENET_MAX_DMA 4096 /* chip has 12 bits of DMA addressing */
6540 +/* power management event wakeup pattern constants */
6541 +#define BCMENET_NPMP 4 /* chip supports 4 wakeup patterns */
6542 +#define BCMENET_PMPBASE 0x400 /* wakeup pattern base address */
6543 +#define BCMENET_PMPSIZE 0x80 /* 128bytes each pattern */
6544 +#define BCMENET_PMMBASE 0x600 /* wakeup mask base address */
6545 +#define BCMENET_PMMSIZE 0x10 /* 128bits each mask */
6547 +/* cpp contortions to concatenate w/arg prescan */
6549 +#define _PADLINE(line) pad ## line
6550 +#define _XSTR(line) _PADLINE(line)
6551 +#define PAD _XSTR(__LINE__)
6554 +/* sometimes you just need the enet mib definitions */
6555 +#include <bcmenetmib.h>
6558 + * Host Interface Registers
6560 +typedef volatile struct _bcmenettregs {
6561 + /* Device and Power Control */
6562 + uint32 devcontrol;
6564 + uint32 biststatus;
6565 + uint32 wakeuplength;
6568 + /* Interrupt Control */
6574 + /* Ethernet MAC Address Filtering Control */
6576 + uint32 enetftaddr;
6577 + uint32 enetftdata;
6580 + /* Ethernet MAC Control */
6581 + uint32 emactxmaxburstlen;
6582 + uint32 emacrxmaxburstlen;
6583 + uint32 emaccontrol;
6584 + uint32 emacflowcontrol;
6588 + /* DMA Lazy Interrupt Control */
6589 + uint32 intrecvlazy;
6593 + dmaregs_t dmaregs;
6594 + dmafifo_t dmafifo;
6597 + /* EMAC Registers */
6599 + uint32 rxmaxlength;
6600 + uint32 txmaxlength;
6602 + uint32 mdiocontrol;
6604 + uint32 emacintmask;
6605 + uint32 emacintstatus;
6608 + uint32 camcontrol;
6609 + uint32 enetcontrol;
6611 + uint32 txwatermark;
6612 + uint32 mibcontrol;
6615 + /* EMAC MIB counters */
6620 + /* Sonics SiliconBackplane config registers */
6621 + sbconfig_t sbconfig;
6624 +/* device control */
6625 +#define DC_PM ((uint32)1 << 7) /* pattern filtering enable */
6626 +#define DC_IP ((uint32)1 << 10) /* internal ephy present (rev >= 1) */
6627 +#define DC_ER ((uint32)1 << 15) /* ephy reset */
6628 +#define DC_MP ((uint32)1 << 16) /* mii phy mode enable */
6629 +#define DC_CO ((uint32)1 << 17) /* mii phy mode: enable clocks */
6630 +#define DC_PA_MASK 0x7c0000 /* mii phy mode: mdc/mdio phy address */
6631 +#define DC_PA_SHIFT 18
6633 +/* wakeup length */
6634 +#define WL_P0_MASK 0x7f /* pattern 0 */
6635 +#define WL_D0 ((uint32)1 << 7)
6636 +#define WL_P1_MASK 0x7f00 /* pattern 1 */
6637 +#define WL_P1_SHIFT 8
6638 +#define WL_D1 ((uint32)1 << 15)
6639 +#define WL_P2_MASK 0x7f0000 /* pattern 2 */
6640 +#define WL_P2_SHIFT 16
6641 +#define WL_D2 ((uint32)1 << 23)
6642 +#define WL_P3_MASK 0x7f000000 /* pattern 3 */
6643 +#define WL_P3_SHIFT 24
6644 +#define WL_D3 ((uint32)1 << 31)
6646 +/* intstatus and intmask */
6647 +#define I_PME ((uint32)1 << 6) /* power management event */
6648 +#define I_TO ((uint32)1 << 7) /* general purpose timeout */
6649 +#define I_PC ((uint32)1 << 10) /* descriptor error */
6650 +#define I_PD ((uint32)1 << 11) /* data error */
6651 +#define I_DE ((uint32)1 << 12) /* descriptor protocol error */
6652 +#define I_RU ((uint32)1 << 13) /* receive descriptor underflow */
6653 +#define I_RO ((uint32)1 << 14) /* receive fifo overflow */
6654 +#define I_XU ((uint32)1 << 15) /* transmit fifo underflow */
6655 +#define I_RI ((uint32)1 << 16) /* receive interrupt */
6656 +#define I_XI ((uint32)1 << 24) /* transmit interrupt */
6657 +#define I_EM ((uint32)1 << 26) /* emac interrupt */
6658 +#define I_MW ((uint32)1 << 27) /* mii write */
6659 +#define I_MR ((uint32)1 << 28) /* mii read */
6662 +#define EMC_CG ((uint32)1 << 0) /* crc32 generation enable */
6663 +#define EMC_EP ((uint32)1 << 2) /* onchip ephy: powerdown (rev >= 1) */
6664 +#define EMC_ED ((uint32)1 << 3) /* onchip ephy: energy detected (rev >= 1) */
6665 +#define EMC_LC_MASK 0xe0 /* onchip ephy: led control (rev >= 1) */
6666 +#define EMC_LC_SHIFT 5
6668 +/* emacflowcontrol */
6669 +#define EMF_RFH_MASK 0xff /* rx fifo hi water mark */
6670 +#define EMF_PG ((uint32)1 << 15) /* enable pause frame generation */
6672 +/* interrupt receive lazy */
6673 +#define IRL_TO_MASK 0x00ffffff /* timeout */
6674 +#define IRL_FC_MASK 0xff000000 /* frame count */
6675 +#define IRL_FC_SHIFT 24 /* frame count */
6677 +/* emac receive config */
6678 +#define ERC_DB ((uint32)1 << 0) /* disable broadcast */
6679 +#define ERC_AM ((uint32)1 << 1) /* accept all multicast */
6680 +#define ERC_RDT ((uint32)1 << 2) /* receive disable while transmitting */
6681 +#define ERC_PE ((uint32)1 << 3) /* promiscuous enable */
6682 +#define ERC_LE ((uint32)1 << 4) /* loopback enable */
6683 +#define ERC_FE ((uint32)1 << 5) /* enable flow control */
6684 +#define ERC_UF ((uint32)1 << 6) /* accept unicast flow control frame */
6685 +#define ERC_RF ((uint32)1 << 7) /* reject filter */
6687 +/* emac mdio control */
6688 +#define MC_MF_MASK 0x7f /* mdc frequency */
6689 +#define MC_PE ((uint32)1 << 7) /* mii preamble enable */
6691 +/* emac mdio data */
6692 +#define MD_DATA_MASK 0xffff /* r/w data */
6693 +#define MD_TA_MASK 0x30000 /* turnaround value */
6694 +#define MD_TA_SHIFT 16
6695 +#define MD_TA_VALID (2 << MD_TA_SHIFT) /* valid ta */
6696 +#define MD_RA_MASK 0x7c0000 /* register address */
6697 +#define MD_RA_SHIFT 18
6698 +#define MD_PMD_MASK 0xf800000 /* physical media device */
6699 +#define MD_PMD_SHIFT 23
6700 +#define MD_OP_MASK 0x30000000 /* opcode */
6701 +#define MD_OP_SHIFT 28
6702 +#define MD_OP_WRITE (1 << MD_OP_SHIFT) /* write op */
6703 +#define MD_OP_READ (2 << MD_OP_SHIFT) /* read op */
6704 +#define MD_SB_MASK 0xc0000000 /* start bits */
6705 +#define MD_SB_SHIFT 30
6706 +#define MD_SB_START (0x1 << MD_SB_SHIFT) /* start of frame */
6708 +/* emac intstatus and intmask */
6709 +#define EI_MII ((uint32)1 << 0) /* mii mdio interrupt */
6710 +#define EI_MIB ((uint32)1 << 1) /* mib interrupt */
6711 +#define EI_FLOW ((uint32)1 << 2) /* flow control interrupt */
6713 +/* emac cam data high */
6714 +#define CD_V ((uint32)1 << 16) /* valid bit */
6716 +/* emac cam control */
6717 +#define CC_CE ((uint32)1 << 0) /* cam enable */
6718 +#define CC_MS ((uint32)1 << 1) /* mask select */
6719 +#define CC_RD ((uint32)1 << 2) /* read */
6720 +#define CC_WR ((uint32)1 << 3) /* write */
6721 +#define CC_INDEX_MASK 0x3f0000 /* index */
6722 +#define CC_INDEX_SHIFT 16
6723 +#define CC_CB ((uint32)1 << 31) /* cam busy */
6725 +/* emac ethernet control */
6726 +#define EC_EE ((uint32)1 << 0) /* emac enable */
6727 +#define EC_ED ((uint32)1 << 1) /* emac disable */
6728 +#define EC_ES ((uint32)1 << 2) /* emac soft reset */
6729 +#define EC_EP ((uint32)1 << 3) /* external phy select */
6731 +/* emac transmit control */
6732 +#define EXC_FD ((uint32)1 << 0) /* full duplex */
6733 +#define EXC_FM ((uint32)1 << 1) /* flowmode */
6734 +#define EXC_SB ((uint32)1 << 2) /* single backoff enable */
6735 +#define EXC_SS ((uint32)1 << 3) /* small slottime */
6737 +/* emac mib control */
6738 +#define EMC_RZ ((uint32)1 << 0) /* autoclear on read */
6740 +/* sometimes you just need the enet rxheader definitions */
6741 +#include <bcmenetrxh.h>
6743 +#endif /* _bcmenet_47xx_h_ */
6744 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetmib.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetmib.h
6745 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetmib.h 1970-01-01 01:00:00.000000000 +0100
6746 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetmib.h 2005-09-16 10:29:18.174591944 +0200
6749 + * Hardware-specific MIB definition for
6750 + * Broadcom Home Networking Division
6751 + * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores.
6753 + * Copyright 2001-2003, Broadcom Corporation
6754 + * All Rights Reserved.
6756 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6757 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6758 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6759 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6763 +#ifndef _bcmenetmib_h_
6764 +#define _bcmenetmib_h_
6766 +/* cpp contortions to concatenate w/arg prescan */
6768 +#define _PADLINE(line) pad ## line
6769 +#define _XSTR(line) _PADLINE(line)
6770 +#define PAD _XSTR(__LINE__)
6774 + * EMAC MIB Registers
6776 +typedef volatile struct {
6777 + uint32 tx_good_octets;
6778 + uint32 tx_good_pkts;
6781 + uint32 tx_broadcast_pkts;
6782 + uint32 tx_multicast_pkts;
6784 + uint32 tx_len_65_to_127;
6785 + uint32 tx_len_128_to_255;
6786 + uint32 tx_len_256_to_511;
6787 + uint32 tx_len_512_to_1023;
6788 + uint32 tx_len_1024_to_max;
6789 + uint32 tx_jabber_pkts;
6790 + uint32 tx_oversize_pkts;
6791 + uint32 tx_fragment_pkts;
6792 + uint32 tx_underruns;
6793 + uint32 tx_total_cols;
6794 + uint32 tx_single_cols;
6795 + uint32 tx_multiple_cols;
6796 + uint32 tx_excessive_cols;
6797 + uint32 tx_late_cols;
6798 + uint32 tx_defered;
6799 + uint32 tx_carrier_lost;
6800 + uint32 tx_pause_pkts;
6803 + uint32 rx_good_octets;
6804 + uint32 rx_good_pkts;
6807 + uint32 rx_broadcast_pkts;
6808 + uint32 rx_multicast_pkts;
6810 + uint32 rx_len_65_to_127;
6811 + uint32 rx_len_128_to_255;
6812 + uint32 rx_len_256_to_511;
6813 + uint32 rx_len_512_to_1023;
6814 + uint32 rx_len_1024_to_max;
6815 + uint32 rx_jabber_pkts;
6816 + uint32 rx_oversize_pkts;
6817 + uint32 rx_fragment_pkts;
6818 + uint32 rx_missed_pkts;
6819 + uint32 rx_crc_align_errs;
6820 + uint32 rx_undersize;
6821 + uint32 rx_crc_errs;
6822 + uint32 rx_align_errs;
6823 + uint32 rx_symbol_errs;
6824 + uint32 rx_pause_pkts;
6825 + uint32 rx_nonpause_pkts;
6828 +#endif /* _bcmenetmib_h_ */
6829 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetrxh.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetrxh.h
6830 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmenetrxh.h 1970-01-01 01:00:00.000000000 +0100
6831 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmenetrxh.h 2005-09-16 10:29:18.183590576 +0200
6834 + * Hardware-specific Receive Data Header for the
6835 + * Broadcom Home Networking Division
6836 + * BCM44XX and BCM47XX 10/100 Mbps Ethernet cores.
6838 + * Copyright 2001-2003, Broadcom Corporation
6839 + * All Rights Reserved.
6841 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
6842 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
6843 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
6844 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
6848 +#ifndef _bcmenetrxh_h_
6849 +#define _bcmenetrxh_h_
6852 + * The Ethernet MAC core returns an 8-byte Receive Frame Data Header
6853 + * with every frame consisting of
6854 + * 16bits of frame length, followed by
6855 + * 16bits of EMAC rx descriptor info, followed by 32bits of undefined.
6857 +typedef volatile struct {
6863 +#define RXHDR_LEN 28
6865 +#define RXF_L ((uint16)1 << 11) /* last buffer in a frame */
6866 +#define RXF_MISS ((uint16)1 << 7) /* received due to promisc mode */
6867 +#define RXF_BRDCAST ((uint16)1 << 6) /* dest is broadcast address */
6868 +#define RXF_MULT ((uint16)1 << 5) /* dest is multicast address */
6869 +#define RXF_LG ((uint16)1 << 4) /* frame length > rxmaxlength */
6870 +#define RXF_NO ((uint16)1 << 3) /* odd number of nibbles */
6871 +#define RXF_RXER ((uint16)1 << 2) /* receive symbol error */
6872 +#define RXF_CRC ((uint16)1 << 1) /* crc error */
6873 +#define RXF_OV ((uint16)1 << 0) /* fifo overflow */
6875 +#endif /* _bcmenetrxh_h_ */
6876 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmnvram.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmnvram.h
6877 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmnvram.h 1970-01-01 01:00:00.000000000 +0100
6878 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmnvram.h 2005-09-16 10:29:18.184590424 +0200
6881 + * NVRAM variable manipulation
6883 + * $Copyright Open Broadcom Corporation$
6885 + * $Id: bcmnvram.h,v 1.1.1.1 2004/01/21 03:50:44 gigis Exp $
6888 +#ifndef _bcmnvram_h_
6889 +#define _bcmnvram_h_
6891 +#ifndef _LANGUAGE_ASSEMBLY
6893 +#include <typedefs.h>
6895 +struct nvram_header {
6898 + uint32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:27 init, mem. test 28, 29-31 reserved */
6899 + uint32 config_refresh; /* 0:15 config, 16:31 refresh */
6900 + uint32 config_ncdl; /* ncdl values for memc */
6903 +struct nvram_tuple {
6906 + struct nvram_tuple *next;
6910 + * Initialize NVRAM access. May be unnecessary or undefined on certain
6913 +extern int nvram_init(void *sbh);
6916 + * Disable NVRAM access. May be unnecessary or undefined on certain
6919 +extern void nvram_exit(void);
6922 + * Get the value of an NVRAM variable. The pointer returned may be
6923 + * invalid after a set.
6924 + * @param name name of variable to get
6925 + * @return value of variable or NULL if undefined
6927 +extern char * nvram_get(const char *name);
6930 + * Get the value of an NVRAM variable.
6931 + * @param name name of variable to get
6932 + * @return value of variable or NUL if undefined
6934 +#define nvram_safe_get(name) (nvram_get(name) ? : "")
6937 + * Match an NVRAM variable.
6938 + * @param name name of variable to match
6939 + * @param match value to compare against value of variable
6940 + * @return TRUE if variable is defined and its value is string equal
6941 + * to match or FALSE otherwise
6944 +nvram_match(char *name, char *match) {
6945 + const char *value = nvram_get(name);
6946 + return (value && !strcmp(value, match));
6950 + * Inversely match an NVRAM variable.
6951 + * @param name name of variable to match
6952 + * @param match value to compare against value of variable
6953 + * @return TRUE if variable is defined and its value is not string
6954 + * equal to invmatch or FALSE otherwise
6957 +nvram_invmatch(char *name, char *invmatch) {
6958 + const char *value = nvram_get(name);
6959 + return (value && strcmp(value, invmatch));
6963 + * Set the value of an NVRAM variable. The name and value strings are
6964 + * copied into private storage. Pointers to previously set values
6965 + * may become invalid. The new value may be immediately
6966 + * retrieved but will not be permanently stored until a commit.
6967 + * @param name name of variable to set
6968 + * @param value value of variable
6969 + * @return 0 on success and errno on failure
6971 +extern int nvram_set(const char *name, const char *value);
6974 + * Unset an NVRAM variable. Pointers to previously set values
6975 + * remain valid until a set.
6976 + * @param name name of variable to unset
6977 + * @return 0 on success and errno on failure
6978 + * NOTE: use nvram_commit to commit this change to flash.
6980 +extern int nvram_unset(const char *name);
6983 + * Commit NVRAM variables to permanent storage. All pointers to values
6984 + * may be invalid after a commit.
6985 + * NVRAM values are undefined after a commit.
6986 + * @return 0 on success and errno on failure
6988 +extern int nvram_commit(void);
6991 + * Get all NVRAM variables (format name=value\0 ... \0\0).
6992 + * @param buf buffer to store variables
6993 + * @param count size of buffer in bytes
6994 + * @return 0 on success and errno on failure
6996 +extern int nvram_getall(char *buf, int count);
6998 +extern int kernel_write(unsigned char *buffer, int offset, int length);
7000 +#endif /* _LANGUAGE_ASSEMBLY */
7002 +#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
7003 +#define NVRAM_VERSION 1
7004 +#define NVRAM_HEADER_SIZE 20
7005 +#define NVRAM_LOC_GAP 0x100000
7006 +#define NVRAM_SPACE 0x2000
7007 +#define NVRAM_FIRST_LOC (0xbfd00000 - NVRAM_SPACE)
7008 +#define NVRAM_LAST_LOC (0xc0000000 - NVRAM_SPACE)
7010 +#endif /* _bcmnvram_h_ */
7011 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmsrom.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmsrom.h
7012 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmsrom.h 1970-01-01 01:00:00.000000000 +0100
7013 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmsrom.h 2005-09-16 10:29:18.184590424 +0200
7016 + * Misc useful routines to access NIC srom
7018 + * Copyright 2001-2003, Broadcom Corporation
7019 + * All Rights Reserved.
7021 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7022 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7023 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7024 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7029 +#ifndef _bcmsrom_h_
7030 +#define _bcmsrom_h_
7032 +extern int srom_var_init(uint bus, void *curmap, void *osh, char **vars, int *count);
7034 +extern int srom_read(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf);
7035 +extern int srom_write(uint bus, void *curmap, void *osh, uint byteoff, uint nbytes, uint16 *buf);
7036 +extern int srom_parsecis(uint8 *cis, char **vars, int *count);
7038 +#endif /* _bcmsrom_h_ */
7039 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bcmutils.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmutils.h
7040 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bcmutils.h 1970-01-01 01:00:00.000000000 +0100
7041 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bcmutils.h 2005-09-16 10:29:18.184590424 +0200
7044 + * Misc useful os-independent macros and functions.
7046 + * Copyright 2001-2003, Broadcom Corporation
7047 + * All Rights Reserved.
7049 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7050 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7051 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7052 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7056 +#ifndef _bcmutils_h_
7057 +#define _bcmutils_h_
7060 +#define MIN(a, b) (((a)<(b))?(a):(b))
7064 +#define MAX(a, b) (((a)>(b))?(a):(b))
7067 +#define CEIL(x, y) (((x) + ((y)-1)) / (y))
7068 +#define ROUNDUP(x, y) ((((ulong)(x)+((y)-1))/(y))*(y))
7069 +#define ISALIGNED(a, x) (((uint)(a) & ((x)-1)) == 0)
7070 +#define ISPOWEROF2(x) ((((x)-1)&(x))==0)
7071 +#define OFFSETOF(type, member) ((uint) &((type *)0)->member)
7072 +#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
7074 +/* bit map related macros */
7076 +#define NBBY 8 /* 8 bits per byte */
7077 +#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
7078 +#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
7079 +#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
7080 +#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
7083 +#define NBITS(type) (sizeof (type) * 8)
7085 +#define _BCM_U 0x01 /* upper */
7086 +#define _BCM_L 0x02 /* lower */
7087 +#define _BCM_D 0x04 /* digit */
7088 +#define _BCM_C 0x08 /* cntrl */
7089 +#define _BCM_P 0x10 /* punct */
7090 +#define _BCM_S 0x20 /* white space (space/lf/tab) */
7091 +#define _BCM_X 0x40 /* hex digit */
7092 +#define _BCM_SP 0x80 /* hard space (0x20) */
7094 +extern unsigned char bcm_ctype[];
7095 +#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)])
7097 +#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0)
7098 +#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0)
7099 +#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0)
7100 +#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0)
7101 +#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0)
7102 +#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0)
7103 +#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0)
7104 +#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0)
7105 +#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0)
7106 +#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0)
7107 +#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0)
7110 + * Spin at most 'us' microseconds while 'exp' is true.
7111 + * Caller should explicitly test 'exp' when this completes
7112 + * and take appropriate error action if 'exp' is still true.
7114 +#define SPINWAIT(exp, us) { \
7115 + uint countdown = (us) + 9; \
7116 + while ((exp) && (countdown >= 10)) {\
7118 + countdown -= 10; \
7122 +/* generic osl packet queue */
7129 +#define DEFAULT_QLEN 128
7131 +#define pktq_len(q) ((q)->len)
7132 +#define pktq_avail(q) ((q)->maxlen - (q)->len)
7133 +#define pktq_head(q) ((q)->head)
7134 +#define pktq_full(q) ((q)->len >= (q)->maxlen)
7137 +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */
7138 +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */
7139 +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
7140 +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
7141 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
7142 +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
7144 +/* tag_ID/length/value_buffer tuple */
7145 +typedef struct bcm_tlv {
7152 +extern uint bcm_atoi(char *s);
7153 +extern uchar bcm_toupper(uchar c);
7154 +extern ulong bcm_strtoul(char *cp, char **endp, uint base);
7155 +extern void deadbeef(char *p, uint len);
7156 +extern void prhex(char *msg, uchar *buf, uint len);
7157 +extern void prpkt(char *msg, void *drv, void *p0);
7158 +extern uint pktcopy(void *drv, void *p, uint offset, int len, uchar *buf);
7159 +extern uint pkttotlen(void *drv, void *);
7160 +extern uchar *bcm_ether_ntoa(char *ea, char *buf);
7161 +extern int bcm_ether_atoe(char *p, char *ea);
7162 +extern void bcm_mdelay(uint ms);
7163 +extern char *getvar(char *vars, char *name);
7164 +extern int getintvar(char *vars, char *name);
7166 +extern uint8 crc8(uint8 *p, uint nbytes, uint8 crc);
7167 +extern uint16 crc16(uint8 *p, uint nbytes, uint16 crc);
7168 +extern uint32 crc32(uint8 *p, uint nbytes, uint32 crc);
7169 +extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key);
7170 +extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key);
7171 +extern void pktqinit(struct pktq *q, int maxlen);
7172 +extern void pktenq(struct pktq *q, void *p, bool lifo);
7173 +extern void *pktdeq(struct pktq *q);
7175 +#define bcmlog(fmt, a1, a2)
7176 +#define bcmdumplog(buf, size) *buf = '\0'
7178 +#endif /* _bcmutils_h_ */
7179 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/bitfuncs.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bitfuncs.h
7180 --- linux-2.6.12.5/arch/mips/bcm947xx/include/bitfuncs.h 1970-01-01 01:00:00.000000000 +0100
7181 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/bitfuncs.h 2005-09-16 10:29:18.185590272 +0200
7184 + * bit manipulation utility functions
7186 + * Copyright 2001-2003, Broadcom Corporation
7187 + * All Rights Reserved.
7189 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7190 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7191 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7192 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7196 +#ifndef _BITFUNCS_H
7197 +#define _BITFUNCS_H
7199 +#include <typedefs.h>
7201 +/* local prototypes */
7202 +static INLINE uint32 find_msbit(uint32 x);
7206 + * find_msbit: returns index of most significant set bit in x, with index
7207 + * range defined as 0-31. NOTE: returns zero if input is zero.
7210 +#if defined(USE_PENTIUM_BSR) && defined(__GNUC__)
7213 + * Implementation for Pentium processors and gcc. Note that this
7214 + * instruction is actually very slow on some processors (e.g., family 5,
7215 + * model 2, stepping 12, "Pentium 75 - 200"), so we use the generic
7216 + * implementation instead.
7218 +static INLINE uint32 find_msbit(uint32 x)
7221 + __asm__("bsrl %1,%0"
7230 + * Generic Implementation
7233 +#define DB_POW_MASK16 0xffff0000
7234 +#define DB_POW_MASK8 0x0000ff00
7235 +#define DB_POW_MASK4 0x000000f0
7236 +#define DB_POW_MASK2 0x0000000c
7237 +#define DB_POW_MASK1 0x00000002
7239 +static INLINE uint32 find_msbit(uint32 x)
7241 + uint32 temp_x = x;
7243 + if (temp_x & DB_POW_MASK16) {
7247 + if (temp_x & DB_POW_MASK8) {
7251 + if (temp_x & DB_POW_MASK4) {
7255 + if (temp_x & DB_POW_MASK2) {
7259 + if (temp_x & DB_POW_MASK1) {
7267 +#endif /* _BITFUNCS_H */
7268 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h
7269 --- linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h 1970-01-01 01:00:00.000000000 +0100
7270 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h 2005-09-16 10:29:18.185590272 +0200
7273 + * Copyright 2001-2003, Broadcom Corporation
7274 + * All Rights Reserved.
7276 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7277 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7278 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7279 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7285 +#ifndef _epivers_h_
7286 +#define _epivers_h_
7289 +#include <linux/config.h>
7292 +/* Vendor Name, ASCII, 32 chars max */
7294 +#define HPNA_VENDOR COMPANYNAME
7296 +#define HPNA_VENDOR "Broadcom Corporation"
7299 +/* Driver Date, ASCII, 32 chars max */
7300 +#define HPNA_DRV_BUILD_DATE __DATE__
7302 +/* Hardware Manufacture Date, ASCII, 32 chars max */
7303 +#define HPNA_HW_MFG_DATE "Not Specified"
7305 +/* See documentation for Device Type values, 32 values max */
7306 +#ifndef HPNA_DEV_TYPE
7308 +#if defined(CONFIG_BRCM_VJ)
7309 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY }
7311 +#elif defined(CONFIG_BCRM_93725)
7312 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
7315 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC }
7319 +#endif /* !HPNA_DEV_TYPE */
7322 +#define EPI_MAJOR_VERSION 1
7324 +#define EPI_MINOR_VERSION 1
7326 +#define EPI_RC_NUMBER 2
7328 +#define EPI_INCREMENTAL_NUMBER 0
7330 +#define EPI_BUILD_NUMBER 0
7332 +#define EPI_VERSION 1,1,2,0
7334 +#define EPI_VERSION_NUM 0x01010200
7336 +/* Driver Version String, ASCII, 32 chars max */
7337 +#define EPI_VERSION_STR "1.1.2.0"
7338 +#define EPI_ROUTER_VERSION_STR "1.1.2.0"
7340 +#endif /* _epivers_h_ */
7341 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h.in linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h.in
7342 --- linux-2.6.12.5/arch/mips/bcm947xx/include/epivers.h.in 1970-01-01 01:00:00.000000000 +0100
7343 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/epivers.h.in 2005-09-16 10:29:18.186590120 +0200
7346 + * Copyright 2001-2003, Broadcom Corporation
7347 + * All Rights Reserved.
7349 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7350 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7351 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7352 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7358 +#ifndef _epivers_h_
7359 +#define _epivers_h_
7362 +#include <linux/config.h>
7365 +/* Vendor Name, ASCII, 32 chars max */
7367 +#define HPNA_VENDOR COMPANYNAME
7369 +#define HPNA_VENDOR "Broadcom Corporation"
7372 +/* Driver Date, ASCII, 32 chars max */
7373 +#define HPNA_DRV_BUILD_DATE __DATE__
7375 +/* Hardware Manufacture Date, ASCII, 32 chars max */
7376 +#define HPNA_HW_MFG_DATE "Not Specified"
7378 +/* See documentation for Device Type values, 32 values max */
7379 +#ifndef HPNA_DEV_TYPE
7381 +#if defined(CONFIG_BRCM_VJ)
7382 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_DISPLAY }
7384 +#elif defined(CONFIG_BCRM_93725)
7385 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_CM_BRIDGE, CDCF_V0_DEVICE_DISPLAY }
7388 +#define HPNA_DEV_TYPE { CDCF_V0_DEVICE_PCINIC }
7392 +#endif /* !HPNA_DEV_TYPE */
7395 +#define EPI_MAJOR_VERSION @EPI_MAJOR_VERSION@
7397 +#define EPI_MINOR_VERSION @EPI_MINOR_VERSION@
7399 +#define EPI_RC_NUMBER @EPI_RC_NUMBER@
7401 +#define EPI_INCREMENTAL_NUMBER @EPI_INCREMENTAL_NUMBER@
7403 +#define EPI_BUILD_NUMBER @EPI_BUILD_NUMBER@
7405 +#define EPI_VERSION @EPI_VERSION@
7407 +#define EPI_VERSION_NUM @EPI_VERSION_NUM@
7409 +/* Driver Version String, ASCII, 32 chars max */
7410 +#define EPI_VERSION_STR "@EPI_VERSION_STR@"
7411 +#define EPI_ROUTER_VERSION_STR "@EPI_ROUTER_VERSION_STR@"
7413 +#endif /* _epivers_h_ */
7414 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/etsockio.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/etsockio.h
7415 --- linux-2.6.12.5/arch/mips/bcm947xx/include/etsockio.h 1970-01-01 01:00:00.000000000 +0100
7416 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/etsockio.h 2005-09-16 10:29:18.186590120 +0200
7419 + * Driver-specific socket ioctls
7420 + * used by BSD, Linux, and PSOS
7421 + * Broadcom BCM44XX 10/100Mbps Ethernet Device Driver
7423 + * Copyright 2001-2003, Broadcom Corporation
7424 + * All Rights Reserved.
7426 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7427 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7428 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7429 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7434 +#ifndef _etsockio_h_
7435 +#define _etsockio_h_
7437 +/* THESE MUST BE CONTIGUOUS AND CONSISTENT WITH VALUES IN ETC.H */
7441 +#define SIOCSETCUP (SIOCDEVPRIVATE + 0)
7442 +#define SIOCSETCDOWN (SIOCDEVPRIVATE + 1)
7443 +#define SIOCSETCLOOP (SIOCDEVPRIVATE + 2)
7444 +#define SIOCGETCDUMP (SIOCDEVPRIVATE + 3)
7445 +#define SIOCSETCSETMSGLEVEL (SIOCDEVPRIVATE + 4)
7446 +#define SIOCSETCPROMISC (SIOCDEVPRIVATE + 5)
7447 +#define SIOCSETCTXDOWN (SIOCDEVPRIVATE + 6) /* obsolete */
7448 +#define SIOCSETCSPEED (SIOCDEVPRIVATE + 7)
7449 +#define SIOCTXGEN (SIOCDEVPRIVATE + 8)
7450 +#define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9)
7451 +#define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10)
7452 +#define SIOCPERF (SIOCDEVPRIVATE + 11)
7453 +#define SIOCPERFDMA (SIOCDEVPRIVATE + 12)
7457 +#define SIOCSETCUP _IOWR('e', 130 + 0, struct ifreq)
7458 +#define SIOCSETCDOWN _IOWR('e', 130 + 1, struct ifreq)
7459 +#define SIOCSETCLOOP _IOWR('e', 130 + 2, struct ifreq)
7460 +#define SIOCGETCDUMP _IOWR('e', 130 + 3, struct ifreq)
7461 +#define SIOCSETCSETMSGLEVEL _IOWR('e', 130 + 4, struct ifreq)
7462 +#define SIOCSETCPROMISC _IOWR('e', 130 + 5, struct ifreq)
7463 +#define SIOCSETCTXDOWN _IOWR('e', 130 + 6, struct ifreq) /* obsolete */
7464 +#define SIOCSETCSPEED _IOWR('e', 130 + 7, struct ifreq)
7465 +#define SIOCTXGEN _IOWR('e', 130 + 8, struct ifreq)
7469 +/* arg to SIOCTXGEN */
7471 + uint32 num; /* number of frames to send */
7472 + uint32 delay; /* delay in microseconds between sending each */
7473 + uint32 size; /* size of ether frame to send */
7474 + uchar buf[1514]; /* starting ether frame data */
7478 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/flash.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flash.h
7479 --- linux-2.6.12.5/arch/mips/bcm947xx/include/flash.h 1970-01-01 01:00:00.000000000 +0100
7480 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flash.h 2005-09-16 10:29:18.187589968 +0200
7483 + * flash.h: Common definitions for flash access.
7485 + * Copyright 2001-2003, Broadcom Corporation
7486 + * All Rights Reserved.
7488 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7489 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7490 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7491 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7496 +/* Types of flashes we know about */
7497 +typedef enum _flash_type {OLD, BSC, SCS, AMD, SST} flash_type_t;
7499 +/* Commands to write/erase the flases */
7500 +typedef struct _flash_cmds{
7501 + flash_type_t type;
7504 + uint16 erase_block;
7505 + uint16 erase_chip;
7506 + uint16 write_word;
7512 + uint16 read_array;
7515 +#define UNLOCK_CMD_WORDS 2
7517 +typedef struct _unlock_cmd {
7518 + uint addr[UNLOCK_CMD_WORDS];
7519 + uint16 cmd[UNLOCK_CMD_WORDS];
7522 +/* Flash descriptors */
7523 +typedef struct _flash_desc {
7524 + uint16 mfgid; /* Manufacturer Id */
7525 + uint16 devid; /* Device Id */
7526 + uint size; /* Total size in bytes */
7527 + uint width; /* Device width in bytes */
7528 + flash_type_t type; /* Device type old, S, J */
7529 + uint bsize; /* Block size */
7530 + uint nb; /* Number of blocks */
7531 + uint ff; /* First full block */
7532 + uint lf; /* Last full block */
7533 + uint nsub; /* Number of subblocks */
7534 + uint *subblocks; /* Offsets for subblocks */
7535 + char *desc; /* Description */
7539 +#ifdef DECLARE_FLASHES
7541 +flash_cmds_t flash_cmds[] = {
7542 +/* type needu preera eraseb erasech write wbuf clcsr rdcsr rdid confrm read */
7543 + { BSC, 0, 0x00, 0x20, 0x00, 0x40, 0x00, 0x50, 0x70, 0x90, 0xd0, 0xff },
7544 + { SCS, 0, 0x00, 0x20, 0x00, 0x40, 0xe8, 0x50, 0x70, 0x90, 0xd0, 0xff },
7545 + { AMD, 1, 0x80, 0x30, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0xf0 },
7546 + { SST, 1, 0x80, 0x50, 0x10, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0xf0 },
7550 +unlock_cmd_t unlock_cmd_amd = {
7552 +/* addr: */ { 0x0aa8, 0x0556},
7554 +/* addr: */ { 0x0aaa, 0x0554},
7556 +/* data: */ { 0xaa, 0x55}
7559 +unlock_cmd_t unlock_cmd_sst = {
7561 +/* addr: */ { 0xaaa8, 0x5556},
7563 +/* addr: */ { 0xaaaa, 0x5554},
7565 +/* data: */ { 0xaa, 0x55}
7568 +#define AMD_CMD 0xaaa
7569 +#define SST_CMD 0xaaaa
7571 +/* intel unlock block cmds */
7572 +#define INTEL_UNLOCK1 0x60
7573 +#define INTEL_UNLOCK2 0xD0
7575 +/* Just eight blocks of 8KB byte each */
7577 +uint blk8x8k[] = { 0x00000000,
7588 +/* Funky AMD arrangement for 29xx800's */
7589 +uint amd800[] = { 0x00000000, /* 16KB */
7590 + 0x00004000, /* 32KB */
7591 + 0x0000c000, /* 8KB */
7592 + 0x0000e000, /* 8KB */
7593 + 0x00010000, /* 8KB */
7594 + 0x00012000, /* 8KB */
7595 + 0x00014000, /* 32KB */
7596 + 0x0001c000, /* 16KB */
7600 +/* AMD arrangement for 29xx160's */
7601 +uint amd4112[] = { 0x00000000, /* 32KB */
7602 + 0x00008000, /* 8KB */
7603 + 0x0000a000, /* 8KB */
7604 + 0x0000c000, /* 16KB */
7607 +uint amd2114[] = { 0x00000000, /* 16KB */
7608 + 0x00004000, /* 8KB */
7609 + 0x00006000, /* 8KB */
7610 + 0x00008000, /* 32KB */
7616 +flash_desc_t flashes[] = {
7617 + { 0x00b0, 0x00d0, 0x0200000, 2, SCS, 0x10000, 32, 0, 31, 0, NULL, "Intel 28F160S3/5 1Mx16" },
7618 + { 0x00b0, 0x00d4, 0x0400000, 2, SCS, 0x10000, 64, 0, 63, 0, NULL, "Intel 28F320S3/5 2Mx16" },
7619 + { 0x0089, 0x8890, 0x0200000, 2, BSC, 0x10000, 32, 0, 30, 8, blk8x8k, "Intel 28F160B3 1Mx16 TopB" },
7620 + { 0x0089, 0x8891, 0x0200000, 2, BSC, 0x10000, 32, 1, 31, 8, blk8x8k, "Intel 28F160B3 1Mx16 BotB" },
7621 + { 0x0089, 0x8896, 0x0400000, 2, BSC, 0x10000, 64, 0, 62, 8, blk8x8k, "Intel 28F320B3 2Mx16 TopB" },
7622 + { 0x0089, 0x8897, 0x0400000, 2, BSC, 0x10000, 64, 1, 63, 8, blk8x8k, "Intel 28F320B3 2Mx16 BotB" },
7623 + { 0x0089, 0x8898, 0x0800000, 2, BSC, 0x10000, 128, 0, 126, 8, blk8x8k, "Intel 28F640B3 4Mx16 TopB" },
7624 + { 0x0089, 0x8899, 0x0800000, 2, BSC, 0x10000, 128, 1, 127, 8, blk8x8k, "Intel 28F640B3 4Mx16 BotB" },
7625 + { 0x0089, 0x88C2, 0x0200000, 2, BSC, 0x10000, 32, 0, 30, 8, blk8x8k, "Intel 28F160C3 1Mx16 TopB" },
7626 + { 0x0089, 0x88C3, 0x0200000, 2, BSC, 0x10000, 32, 1, 31, 8, blk8x8k, "Intel 28F160C3 1Mx16 BotB" },
7627 + { 0x0089, 0x88C4, 0x0400000, 2, BSC, 0x10000, 64, 0, 62, 8, blk8x8k, "Intel 28F320C3 2Mx16 TopB" },
7628 + { 0x0089, 0x88C5, 0x0400000, 2, BSC, 0x10000, 64, 1, 63, 8, blk8x8k, "Intel 28F320C3 2Mx16 BotB" },
7629 + { 0x0089, 0x88CC, 0x0800000, 2, BSC, 0x10000, 128, 0, 126, 8, blk8x8k, "Intel 28F640C3 4Mx16 TopB" },
7630 + { 0x0089, 0x88CD, 0x0800000, 2, BSC, 0x10000, 128, 1, 127, 8, blk8x8k, "Intel 28F640C3 4Mx16 BotB" },
7631 + { 0x0089, 0x0014, 0x0400000, 2, SCS, 0x20000, 32, 0, 31, 0, NULL, "Intel 28F320J5 2Mx16" },
7632 + { 0x0089, 0x0015, 0x0800000, 2, SCS, 0x20000, 64, 0, 63, 0, NULL, "Intel 28F640J5 4Mx16" },
7633 + { 0x0089, 0x0016, 0x0400000, 2, SCS, 0x20000, 32, 0, 31, 0, NULL, "Intel 28F320J3 2Mx16" },
7634 + { 0x0089, 0x0017, 0x0800000, 2, SCS, 0x20000, 64, 0, 63, 0, NULL, "Intel 28F640J3 4Mx16" },
7635 + { 0x0089, 0x0018, 0x1000000, 2, SCS, 0x20000, 128, 0, 127, 0, NULL, "Intel 28F128J3 8Mx16" },
7636 + { 0x00b0, 0x00e3, 0x0400000, 2, BSC, 0x10000, 64, 1, 63, 8, blk8x8k, "Sharp 28F320BJE 2Mx16 BotB" },
7637 + { 0x0001, 0x224a, 0x0100000, 2, AMD, 0x10000, 16, 0, 13, 8, amd800, "AMD 29DL800BT 512Kx16 TopB" },
7638 + { 0x0001, 0x22cb, 0x0100000, 2, AMD, 0x10000, 16, 2, 15, 8, amd800, "AMD 29DL800BB 512Kx16 BotB" },
7639 + { 0x0001, 0x22c4, 0x0200000, 2, AMD, 0x10000, 32, 0, 30, 4, amd2114, "AMD 29lv160DT 1Mx16 TopB" },
7640 + { 0x0001, 0x2249, 0x0200000, 2, AMD, 0x10000, 32, 1, 31, 4, amd4112, "AMD 29lv160DB 1Mx16 BotB" },
7641 + { 0x0001, 0x22f6, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 8, blk8x8k, "AMD 29lv320DT 2Mx16 TopB" },
7642 + { 0x0001, 0x22f9, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 8, blk8x8k, "AMD 29lv320DB 2Mx16 BotB" },
7643 + { 0x0001, 0x2201, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 8, blk8x8k, "AMD 29lv320MT 2Mx16 TopB" },
7644 + { 0x0001, 0x2200, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 8, blk8x8k, "AMD 29lv320MB 2Mx16 BotB" },
7645 + { 0x0020, 0x22CA, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "ST 29w320DT 2Mx16 TopB" },
7646 + { 0x0020, 0x22CB, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "ST 29w320DB 2Mx16 BotB" },
7647 + { 0x00C2, 0x00A7, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "MX29LV320T 2Mx16 TopB" },
7648 + { 0x00C2, 0x00A8, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "MX29LV320B 2Mx16 BotB" },
7649 + { 0x0004, 0x22F6, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "MBM29LV320TE 2Mx16 TopB" },
7650 + { 0x0004, 0x22F9, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "MBM29LV320BE 2Mx16 BotB" },
7651 + { 0x0098, 0x009A, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "TC58FVT321 2Mx16 TopB" },
7652 + { 0x0098, 0x009C, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "TC58FVB321 2Mx16 BotB" },
7653 + { 0x00C2, 0x22A7, 0x0400000, 2, AMD, 0x10000, 64, 0, 62, 4, amd4112, "MX29LV320T 2Mx16 TopB" },
7654 + { 0x00C2, 0x22A8, 0x0400000, 2, AMD, 0x10000, 64, 1, 63, 4, amd2114, "MX29LV320B 2Mx16 BotB" },
7655 + { 0x00BF, 0x2783, 0x0400000, 2, SST, 0x10000, 64, 0, 63, 0, NULL, "SST39VF320 2Mx16" },
7656 + { 0, 0, 0, 0, OLD, 0, 0, 0, 0, 0, NULL, NULL },
7661 +extern flash_cmds_t flash_cmds[];
7662 +extern unlock_cmd_t unlock_cmd;
7663 +extern flash_desc_t flashes[];
7666 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/flashutl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flashutl.h
7667 --- linux-2.6.12.5/arch/mips/bcm947xx/include/flashutl.h 1970-01-01 01:00:00.000000000 +0100
7668 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/flashutl.h 2005-09-16 10:29:18.187589968 +0200
7671 + * BCM47XX FLASH driver interface
7673 + * Copyright 2001-2003, Broadcom Corporation
7674 + * All Rights Reserved.
7676 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7677 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7678 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7679 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7683 +#ifndef _flashutl_h_
7684 +#define _flashutl_h_
7686 +#define FLASH_BASE 0xbfc00000 /* BCM4710 */
7688 +int flash_init(void* base_addr, char *flash_str);
7689 +int flash_erase(void);
7690 +int flash_eraseblk(unsigned long off);
7691 +int flash_write(unsigned long off, uint16 *src, uint nbytes);
7692 +unsigned long flash_block_base(unsigned long off);
7693 +unsigned long flash_block_lim(unsigned long off);
7694 +int FlashWriteRange(unsigned short* dst, unsigned short* src, unsigned int numbytes);
7696 +void nvWrite(unsigned short *data, unsigned int len);
7699 +extern char* flashutl_base;
7700 +extern flash_desc_t* flashutl_desc;
7701 +extern flash_cmds_t* flashutl_cmd;
7703 +#endif /* _flashutl_h_ */
7704 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/hnddma.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hnddma.h
7705 --- linux-2.6.12.5/arch/mips/bcm947xx/include/hnddma.h 1970-01-01 01:00:00.000000000 +0100
7706 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hnddma.h 2005-09-16 10:29:18.188589816 +0200
7709 + * Generic Broadcom Home Networking Division (HND) DMA engine definitions.
7710 + * This supports the following chips: BCM42xx, 44xx, 47xx .
7713 + * Copyright 2001-2003, Broadcom Corporation
7714 + * All Rights Reserved.
7716 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7717 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7718 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7719 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7726 + * Each DMA processor consists of a transmit channel and a receive channel.
7728 +typedef volatile struct {
7729 + /* transmit channel */
7730 + uint32 xmtcontrol; /* enable, et al */
7731 + uint32 xmtaddr; /* descriptor ring base address (4K aligned) */
7732 + uint32 xmtptr; /* last descriptor posted to chip */
7733 + uint32 xmtstatus; /* current active descriptor, et al */
7735 + /* receive channel */
7736 + uint32 rcvcontrol; /* enable, et al */
7737 + uint32 rcvaddr; /* descriptor ring base address (4K aligned) */
7738 + uint32 rcvptr; /* last descriptor posted to chip */
7739 + uint32 rcvstatus; /* current active descriptor, et al */
7742 +typedef volatile struct {
7744 + uint32 fifoaddr; /* diag address */
7745 + uint32 fifodatalow; /* low 32bits of data */
7746 + uint32 fifodatahigh; /* high 32bits of data */
7747 + uint32 pad; /* reserved */
7750 +/* transmit channel control */
7751 +#define XC_XE ((uint32)1 << 0) /* transmit enable */
7752 +#define XC_SE ((uint32)1 << 1) /* transmit suspend request */
7753 +#define XC_LE ((uint32)1 << 2) /* loopback enable */
7754 +#define XC_FL ((uint32)1 << 4) /* flush request */
7756 +/* transmit descriptor table pointer */
7757 +#define XP_LD_MASK 0xfff /* last valid descriptor */
7759 +/* transmit channel status */
7760 +#define XS_CD_MASK 0x0fff /* current descriptor pointer */
7761 +#define XS_XS_MASK 0xf000 /* transmit state */
7762 +#define XS_XS_SHIFT 12
7763 +#define XS_XS_DISABLED 0x0000 /* disabled */
7764 +#define XS_XS_ACTIVE 0x1000 /* active */
7765 +#define XS_XS_IDLE 0x2000 /* idle wait */
7766 +#define XS_XS_STOPPED 0x3000 /* stopped */
7767 +#define XS_XS_SUSP 0x4000 /* suspend pending */
7768 +#define XS_XE_MASK 0xf0000 /* transmit errors */
7769 +#define XS_XE_SHIFT 16
7770 +#define XS_XE_NOERR 0x00000 /* no error */
7771 +#define XS_XE_DPE 0x10000 /* descriptor protocol error */
7772 +#define XS_XE_DFU 0x20000 /* data fifo underrun */
7773 +#define XS_XE_BEBR 0x30000 /* bus error on buffer read */
7774 +#define XS_XE_BEDA 0x40000 /* bus error on descriptor access */
7775 +#define XS_FL ((uint32)1 << 20) /* flushed */
7777 +/* receive channel control */
7778 +#define RC_RE ((uint32)1 << 0) /* receive enable */
7779 +#define RC_RO_MASK 0xfe /* receive frame offset */
7780 +#define RC_RO_SHIFT 1
7781 +#define RC_FM ((uint32)1 << 8) /* direct fifo receive (pio) mode */
7783 +/* receive descriptor table pointer */
7784 +#define RP_LD_MASK 0xfff /* last valid descriptor */
7786 +/* receive channel status */
7787 +#define RS_CD_MASK 0x0fff /* current descriptor pointer */
7788 +#define RS_RS_MASK 0xf000 /* receive state */
7789 +#define RS_RS_SHIFT 12
7790 +#define RS_RS_DISABLED 0x0000 /* disabled */
7791 +#define RS_RS_ACTIVE 0x1000 /* active */
7792 +#define RS_RS_IDLE 0x2000 /* idle wait */
7793 +#define RS_RS_STOPPED 0x3000 /* reserved */
7794 +#define RS_RE_MASK 0xf0000 /* receive errors */
7795 +#define RS_RE_SHIFT 16
7796 +#define RS_RE_NOERR 0x00000 /* no error */
7797 +#define RS_RE_DPE 0x10000 /* descriptor protocol error */
7798 +#define RS_RE_DFO 0x20000 /* data fifo overflow */
7799 +#define RS_RE_BEBW 0x30000 /* bus error on buffer write */
7800 +#define RS_RE_BEDA 0x40000 /* bus error on descriptor access */
7803 +#define FA_OFF_MASK 0xffff /* offset */
7804 +#define FA_SEL_MASK 0xf0000 /* select */
7805 +#define FA_SEL_SHIFT 16
7806 +#define FA_SEL_XDD 0x00000 /* transmit dma data */
7807 +#define FA_SEL_XDP 0x10000 /* transmit dma pointers */
7808 +#define FA_SEL_RDD 0x40000 /* receive dma data */
7809 +#define FA_SEL_RDP 0x50000 /* receive dma pointers */
7810 +#define FA_SEL_XFD 0x80000 /* transmit fifo data */
7811 +#define FA_SEL_XFP 0x90000 /* transmit fifo pointers */
7812 +#define FA_SEL_RFD 0xc0000 /* receive fifo data */
7813 +#define FA_SEL_RFP 0xd0000 /* receive fifo pointers */
7817 + * Descriptors are only read by the hardware, never written back.
7819 +typedef volatile struct {
7820 + uint32 ctrl; /* misc control bits & bufcount */
7821 + uint32 addr; /* data buffer address */
7825 + * Each descriptor ring must be 4096byte aligned
7826 + * and fit within a single 4096byte page.
7828 +#define DMAMAXRINGSZ 4096
7829 +#define DMARINGALIGN 4096
7831 +/* control flags */
7832 +#define CTRL_BC_MASK 0x1fff /* buffer byte count */
7833 +#define CTRL_EOT ((uint32)1 << 28) /* end of descriptor table */
7834 +#define CTRL_IOC ((uint32)1 << 29) /* interrupt on completion */
7835 +#define CTRL_EOF ((uint32)1 << 30) /* end of frame */
7836 +#define CTRL_SOF ((uint32)1 << 31) /* start of frame */
7838 +/* control flags in the range [27:20] are core-specific and not defined here */
7839 +#define CTRL_CORE_MASK 0x0ff00000
7841 +/* export structure */
7842 +typedef volatile struct {
7843 + /* rx error counters */
7844 + uint rxgiants; /* rx giant frames */
7845 + uint rxnobuf; /* rx out of dma descriptors */
7846 + /* tx error counters */
7847 + uint txnobuf; /* tx out of dma descriptors */
7855 +extern void *dma_attach(void *drv, void *dev, char *name, dmaregs_t *dmaregs,
7856 + uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset,
7857 + uint ddoffset, uint dataoffset, uint *msg_level);
7858 +extern void dma_detach(di_t *di);
7859 +extern void dma_txreset(di_t *di);
7860 +extern void dma_rxreset(di_t *di);
7861 +extern void dma_txinit(di_t *di);
7862 +extern bool dma_txenabled(di_t *di);
7863 +extern void dma_rxinit(di_t *di);
7864 +extern void dma_rxenable(di_t *di);
7865 +extern bool dma_rxenabled(di_t *di);
7866 +extern void dma_txsuspend(di_t *di);
7867 +extern void dma_txresume(di_t *di);
7868 +extern bool dma_txsuspended(di_t *di);
7869 +extern bool dma_txstopped(di_t *di);
7870 +extern bool dma_rxstopped(di_t *di);
7871 +extern int dma_txfast(di_t *di, void *p, uint32 coreflags);
7872 +extern int dma_tx(di_t *di, void *p, uint32 coreflags);
7873 +extern void dma_fifoloopbackenable(di_t *di);
7874 +extern void *dma_rx(di_t *di);
7875 +extern void dma_rxfill(di_t *di);
7876 +extern void dma_txreclaim(di_t *di, bool forceall);
7877 +extern void dma_rxreclaim(di_t *di);
7878 +extern char *dma_dump(di_t *di, char *buf);
7879 +extern char *dma_dumptx(di_t *di, char *buf);
7880 +extern char *dma_dumprx(di_t *di, char *buf);
7881 +extern uint dma_getvar(di_t *di, char *name);
7882 +extern void *dma_getnexttxp(di_t *di, bool forceall);
7883 +extern void *dma_getnextrxp(di_t *di, bool forceall);
7884 +extern void dma_txblock(di_t *di);
7885 +extern void dma_txunblock(di_t *di);
7886 +extern uint dma_txactive(di_t *di);
7888 +#endif /* _hnddma_h_ */
7889 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/hndmips.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hndmips.h
7890 --- linux-2.6.12.5/arch/mips/bcm947xx/include/hndmips.h 1970-01-01 01:00:00.000000000 +0100
7891 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/hndmips.h 2005-09-16 10:29:18.188589816 +0200
7894 + * Alternate include file for HND sbmips.h since CFE also ships with
7897 + * Copyright 2001-2003, Broadcom Corporation
7898 + * All Rights Reserved.
7900 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7901 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7902 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7903 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7908 +#include "sbmips.h"
7909 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/linux_osl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linux_osl.h
7910 --- linux-2.6.12.5/arch/mips/bcm947xx/include/linux_osl.h 1970-01-01 01:00:00.000000000 +0100
7911 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linux_osl.h 2005-09-16 10:29:18.190589512 +0200
7914 + * Linux OS Independent Layer
7916 + * Copyright 2001-2003, Broadcom Corporation
7917 + * All Rights Reserved.
7919 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
7920 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
7921 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
7922 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
7927 +#ifndef _linux_osl_h_
7928 +#define _linux_osl_h_
7930 +#include <typedefs.h>
7932 +/* use current 2.4.x calling conventions */
7933 +#include <linuxver.h>
7935 +/* assert and panic */
7936 +#define ASSERT(exp) do {} while (0)
7938 +/* PCMCIA attribute space access macros */
7939 +#define OSL_PCMCIA_READ_ATTR(osh, offset, buf, size) \
7940 + osl_pcmcia_read_attr((osh), (offset), (buf), (size))
7941 +#define OSL_PCMCIA_WRITE_ATTR(osh, offset, buf, size) \
7942 + osl_pcmcia_write_attr((osh), (offset), (buf), (size))
7943 +extern void osl_pcmcia_read_attr(void *osh, uint offset, void *buf, int size);
7944 +extern void osl_pcmcia_write_attr(void *osh, uint offset, void *buf, int size);
7946 +/* PCI configuration space access macros */
7947 +#define OSL_PCI_READ_CONFIG(loc, offset, size) \
7948 + osl_pci_read_config((loc), (offset), (size))
7949 +#define OSL_PCI_WRITE_CONFIG(loc, offset, size, val) \
7950 + osl_pci_write_config((loc), (offset), (size), (val))
7951 +extern uint32 osl_pci_read_config(void *loc, uint size, uint offset);
7952 +extern void osl_pci_write_config(void *loc, uint offset, uint size, uint val);
7954 +/* OSL initialization */
7955 +#define osl_init() do {} while (0)
7957 +/* host/bus architecture-specific byte swap */
7958 +#define BUS_SWAP32(v) (v)
7961 + * BINOSL selects the slightly slower function-call-based binary compatible osl.
7962 + * Macros expand to calls to functions defined in linux_osl.c .
7966 +/* string library, kernel mode */
7967 +#define printf(fmt, args...) printk(fmt, ## args)
7968 +#include <linux/kernel.h>
7969 +#include <linux/string.h>
7971 +/* register access macros */
7972 +#define R_REG(r) ({ \
7973 + __typeof(*(r)) __osl_v; \
7974 + switch (sizeof(*(r))) { \
7975 + case sizeof(uint8): __osl_v = readb((volatile uint8*)(r)); break; \
7976 + case sizeof(uint16): __osl_v = readw((volatile uint16*)(r)); break; \
7977 + case sizeof(uint32): __osl_v = readl((volatile uint32*)(r)); break; \
7981 +#define W_REG(r, v) do { \
7982 + switch (sizeof(*(r))) { \
7983 + case sizeof(uint8): writeb((uint8)(v), (volatile uint8*)(r)); break; \
7984 + case sizeof(uint16): writew((uint16)(v), (volatile uint16*)(r)); break; \
7985 + case sizeof(uint32): writel((uint32)(v), (volatile uint32*)(r)); break; \
7989 +#define AND_REG(r, v) W_REG((r), R_REG(r) & (v))
7990 +#define OR_REG(r, v) W_REG((r), R_REG(r) | (v))
7992 +/* bcopy, bcmp, and bzero */
7993 +#define bcopy(src, dst, len) memcpy((dst), (src), (len))
7994 +#define bcmp(b1, b2, len) memcmp((b1), (b2), (len))
7995 +#define bzero(b, len) memset((b), '\0', (len))
7997 +/* general purpose memory allocation */
7998 +#define MALLOC(size) kmalloc((size), GFP_ATOMIC)
7999 +#define MFREE(addr, size) kfree((addr))
8001 +/* uncached virtual address */
8003 +#define OSL_UNCACHED(va) KSEG1ADDR((va))
8004 +#include <asm/addrspace.h>
8006 +#define OSL_UNCACHED(va) (va)
8009 +/* get processor cycle count */
8011 +#define OSL_GETCYCLES(x) ((x) = read_c0_count() * 2)
8012 +#elif defined(__i386__)
8013 +#define OSL_GETCYCLES(x) rdtscl((x))
8015 +#define OSL_GETCYCLES(x) ((x) = 0)
8018 +/* dereference an address that may cause a bus exception */
8020 +#if defined(MODULE) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,17))
8021 +#define BUSPROBE(val, addr) panic("get_dbe() will not fixup a bus exception when compiled into a module")
8023 +#define BUSPROBE(val, addr) get_dbe((val), (addr))
8024 +#include <asm/paccess.h>
8027 +#define BUSPROBE(val, addr) ({ (val) = R_REG((addr)); 0; })
8030 +/* map/unmap physical to virtual I/O */
8031 +#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size))
8032 +#define REG_UNMAP(va) iounmap((void *)(va))
8034 +/* allocate/free shared (dma-able) consistent (uncached) memory */
8035 +#define DMA_ALLOC_CONSISTENT(dev, size, pap) \
8036 + pci_alloc_consistent((dev), (size), (dma_addr_t*)(pap))
8037 +#define DMA_FREE_CONSISTENT(dev, va, size, pa) \
8038 + pci_free_consistent((dev), (size), (va), (dma_addr_t)(pa))
8040 +/* map/unmap direction */
8041 +#define DMA_TX PCI_DMA_TODEVICE
8042 +#define DMA_RX PCI_DMA_FROMDEVICE
8044 +/* map/unmap shared (dma-able) memory */
8045 +#define DMA_MAP(dev, va, size, direction, p) \
8046 + pci_map_single((dev), (va), (size), (direction))
8047 +#define DMA_UNMAP(dev, pa, size, direction, p) \
8048 + pci_unmap_single((dev), (dma_addr_t)(pa), (size), (direction))
8050 +/* microsecond delay */
8051 +#define OSL_DELAY(usec) udelay(usec)
8052 +#include <linux/delay.h>
8053 +#define OSL_SLEEP(usec) set_current_state(TASK_INTERRUPTIBLE); \
8054 + schedule_timeout((usec*HZ)/1000000);
8055 +#define OSL_IN_INTERRUPT() in_interrupt()
8057 +/* shared (dma-able) memory access macros */
8058 +#define R_SM(r) *(r)
8059 +#define W_SM(r, v) (*(r) = (v))
8060 +#define BZERO_SM(r, len) memset((r), '\0', (len))
8062 +/* packet primitives */
8063 +#define PKTGET(drv, len, send) osl_pktget((drv), (len), (send))
8064 +#define PKTFREE(drv, skb, send) osl_pktfree((skb))
8065 +#define PKTDATA(drv, skb) (((struct sk_buff*)(skb))->data)
8066 +#define PKTLEN(drv, skb) (((struct sk_buff*)(skb))->len)
8067 +#define PKTHEADROOM(drv, skb) (PKTDATA(drv,skb)-(((struct sk_buff*)(skb))->head))
8068 +#define PKTTAILROOM(drv, skb) ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail))
8069 +#define PKTNEXT(drv, skb) (((struct sk_buff*)(skb))->next)
8070 +#define PKTSETNEXT(skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x))
8071 +#define PKTSETLEN(drv, skb, len) __skb_trim((struct sk_buff*)(skb), (len))
8072 +#define PKTPUSH(drv, skb, bytes) skb_push((struct sk_buff*)(skb), (bytes))
8073 +#define PKTPULL(drv, skb, bytes) skb_pull((struct sk_buff*)(skb), (bytes))
8074 +#define PKTDUP(drv, skb) skb_clone((struct sk_buff*)(skb), GFP_ATOMIC)
8075 +#define PKTCOOKIE(skb) ((void*)((struct sk_buff*)(skb))->csum)
8076 +#define PKTSETCOOKIE(skb, x) (((struct sk_buff*)(skb))->csum = (uint)(x))
8077 +#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev)
8078 +#define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x))
8079 +extern void *osl_pktget(void *drv, uint len, bool send);
8080 +extern void osl_pktfree(void *skb);
8084 +/* string library */
8087 +#define printf(fmt, args...) osl_printf((fmt), ## args)
8089 +#define sprintf(buf, fmt, args...) osl_sprintf((buf), (fmt), ## args)
8091 +#define strcmp(s1, s2) osl_strcmp((s1), (s2))
8093 +#define strncmp(s1, s2, n) osl_strncmp((s1), (s2), (n))
8095 +#define strlen(s) osl_strlen((s))
8097 +#define strcpy(d, s) osl_strcpy((d), (s))
8099 +#define strncpy(d, s, n) osl_strncpy((d), (s), (n))
8101 +extern int osl_printf(const char *format, ...);
8102 +extern int osl_sprintf(char *buf, const char *format, ...);
8103 +extern int osl_strcmp(const char *s1, const char *s2);
8104 +extern int osl_strncmp(const char *s1, const char *s2, uint n);
8105 +extern int osl_strlen(char *s);
8106 +extern char* osl_strcpy(char *d, const char *s);
8107 +extern char* osl_strncpy(char *d, const char *s, uint n);
8109 +/* register access macros */
8110 +#define R_REG(r) ({ \
8111 + __typeof(*(r)) __osl_v; \
8112 + switch (sizeof(*(r))) { \
8113 + case sizeof(uint8): __osl_v = osl_readb((volatile uint8*)(r)); break; \
8114 + case sizeof(uint16): __osl_v = osl_readw((volatile uint16*)(r)); break; \
8115 + case sizeof(uint32): __osl_v = osl_readl((volatile uint32*)(r)); break; \
8119 +#define W_REG(r, v) do { \
8120 + switch (sizeof(*(r))) { \
8121 + case sizeof(uint8): osl_writeb((uint8)(v), (volatile uint8*)(r)); break; \
8122 + case sizeof(uint16): osl_writew((uint16)(v), (volatile uint16*)(r)); break; \
8123 + case sizeof(uint32): osl_writel((uint32)(v), (volatile uint32*)(r)); break; \
8126 +#define AND_REG(r, v) W_REG((r), R_REG(r) & (v))
8127 +#define OR_REG(r, v) W_REG((r), R_REG(r) | (v))
8128 +extern uint8 osl_readb(volatile uint8 *r);
8129 +extern uint16 osl_readw(volatile uint16 *r);
8130 +extern uint32 osl_readl(volatile uint32 *r);
8131 +extern void osl_writeb(uint8 v, volatile uint8 *r);
8132 +extern void osl_writew(uint16 v, volatile uint16 *r);
8133 +extern void osl_writel(uint32 v, volatile uint32 *r);
8135 +/* bcopy, bcmp, and bzero */
8136 +extern void bcopy(const void *src, void *dst, int len);
8137 +extern int bcmp(const void *b1, const void *b2, int len);
8138 +extern void bzero(void *b, int len);
8140 +/* general purpose memory allocation */
8141 +#define MALLOC(size) osl_malloc((size))
8142 +#define MFREE(addr, size) osl_mfree((char*)(addr), (size))
8143 +extern void *osl_malloc(uint size);
8144 +extern void osl_mfree(void *addr, uint size);
8146 +/* uncached virtual address */
8147 +#define OSL_UNCACHED(va) osl_uncached((va))
8148 +extern void *osl_uncached(void *va);
8150 +/* get processor cycle count */
8151 +#define OSL_GETCYCLES(x) ((x) = osl_getcycles())
8152 +extern uint osl_getcycles(void);
8154 +/* dereference an address that may target abort */
8155 +#define BUSPROBE(val, addr) osl_busprobe(&(val), (addr))
8156 +extern int osl_busprobe(uint32 *val, uint32 addr);
8158 +/* map/unmap physical to virtual */
8159 +#define REG_MAP(pa, size) osl_reg_map((pa), (size))
8160 +#define REG_UNMAP(va) osl_reg_unmap((va))
8161 +extern void *osl_reg_map(uint32 pa, uint size);
8162 +extern void osl_reg_unmap(void *va);
8164 +/* allocate/free shared (dma-able) consistent (uncached) memory */
8165 +#define DMA_ALLOC_CONSISTENT(dev, size, pap) \
8166 + osl_dma_alloc_consistent((dev), (size), (pap))
8167 +#define DMA_FREE_CONSISTENT(dev, va, size, pa) \
8168 + osl_dma_free_consistent((dev), (void*)(va), (size), (pa))
8169 +extern void *osl_dma_alloc_consistent(void *dev, uint size, ulong *pap);
8170 +extern void osl_dma_free_consistent(void *dev, void *va, uint size, ulong pa);
8172 +/* map/unmap direction */
8176 +/* map/unmap shared (dma-able) memory */
8177 +#define DMA_MAP(dev, va, size, direction, p) \
8178 + osl_dma_map((dev), (va), (size), (direction))
8179 +#define DMA_UNMAP(dev, pa, size, direction, p) \
8180 + osl_dma_unmap((dev), (pa), (size), (direction))
8181 +extern uint osl_dma_map(void *dev, void *va, uint size, int direction);
8182 +extern void osl_dma_unmap(void *dev, uint pa, uint size, int direction);
8184 +/* microsecond delay */
8185 +#define OSL_DELAY(usec) osl_delay((usec))
8186 +extern void osl_delay(uint usec);
8188 +/* shared (dma-able) memory access macros */
8189 +#define R_SM(r) *(r)
8190 +#define W_SM(r, v) (*(r) = (v))
8191 +#define BZERO_SM(r, len) bzero((r), (len))
8193 +/* packet primitives */
8194 +#define PKTGET(drv, len, send) osl_pktget((drv), (len), (send))
8195 +#define PKTFREE(drv, skb, send) osl_pktfree((skb))
8196 +#define PKTDATA(drv, skb) osl_pktdata((drv), (skb))
8197 +#define PKTLEN(drv, skb) osl_pktlen((drv), (skb))
8198 +#define PKTNEXT(drv, skb) osl_pktnext((drv), (skb))
8199 +#define PKTSETNEXT(skb, x) osl_pktsetnext((skb), (x))
8200 +#define PKTSETLEN(drv, skb, len) osl_pktsetlen((drv), (skb), (len))
8201 +#define PKTPUSH(drv, skb, bytes) osl_pktpush((drv), (skb), (bytes))
8202 +#define PKTPULL(drv, skb, bytes) osl_pktpull((drv), (skb), (bytes))
8203 +#define PKTDUP(drv, skb) osl_pktdup((drv), (skb))
8204 +#define PKTCOOKIE(skb) osl_pktcookie((skb))
8205 +#define PKTSETCOOKIE(skb, x) osl_pktsetcookie((skb), (x))
8206 +#define PKTLINK(skb) osl_pktlink((skb))
8207 +#define PKTSETLINK(skb, x) osl_pktsetlink((skb), (x))
8208 +extern void *osl_pktget(void *drv, uint len, bool send);
8209 +extern void osl_pktfree(void *skb);
8210 +extern uchar *osl_pktdata(void *drv, void *skb);
8211 +extern uint osl_pktlen(void *drv, void *skb);
8212 +extern void *osl_pktnext(void *drv, void *skb);
8213 +extern void osl_pktsetnext(void *skb, void *x);
8214 +extern void osl_pktsetlen(void *drv, void *skb, uint len);
8215 +extern uchar *osl_pktpush(void *drv, void *skb, int bytes);
8216 +extern uchar *osl_pktpull(void *drv, void *skb, int bytes);
8217 +extern void *osl_pktdup(void *drv, void *skb);
8218 +extern void *osl_pktcookie(void *skb);
8219 +extern void osl_pktsetcookie(void *skb, void *x);
8220 +extern void *osl_pktlink(void *skb);
8221 +extern void osl_pktsetlink(void *skb, void *x);
8223 +#endif /* BINOSL */
8225 +#endif /* _linux_osl_h_ */
8226 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/linuxver.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linuxver.h
8227 --- linux-2.6.12.5/arch/mips/bcm947xx/include/linuxver.h 1970-01-01 01:00:00.000000000 +0100
8228 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/linuxver.h 2005-09-16 10:29:18.191589360 +0200
8231 + * Linux-specific abstractions to gain some independence from linux kernel versions.
8232 + * Pave over some 2.2 versus 2.4 kernel differences.
8234 + * Copyright 2001-2003, Broadcom Corporation
8235 + * All Rights Reserved.
8237 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8238 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8239 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8240 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8244 +#ifndef _linuxver_h_
8245 +#define _linuxver_h_
8247 +#include <linux/config.h>
8248 +#include <linux/version.h>
8250 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
8251 +/* __NO_VERSION__ must be defined for all linkables except one in 2.2 */
8252 +#ifdef __UNDEF_NO_VERSION__
8253 +#undef __NO_VERSION__
8255 +#define __NO_VERSION__
8259 +#if defined(MODULE) && defined(MODVERSIONS)
8260 +#include <linux/modversions.h>
8263 +/* linux/malloc.h is deprecated, use linux/slab.h instead. */
8264 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9))
8265 +#include <linux/malloc.h>
8267 +#include <linux/slab.h>
8270 +#include <linux/types.h>
8271 +#include <linux/init.h>
8272 +#include <linux/module.h>
8273 +#include <linux/mm.h>
8274 +#include <linux/string.h>
8275 +#include <linux/pci.h>
8276 +#include <linux/interrupt.h>
8277 +#include <linux/netdevice.h>
8278 +#include <asm/io.h>
8287 +#define __devinit __init
8289 +#ifndef __devinitdata
8290 +#define __devinitdata
8292 +#ifndef __devexit_p
8293 +#define __devexit_p(x) x
8296 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
8298 +#define pci_get_drvdata(dev) (dev)->sysdata
8299 +#define pci_set_drvdata(dev, value) (dev)->sysdata=(value)
8302 + * New-style (2.4.x) PCI/hot-pluggable PCI/CardBus registration
8305 +struct pci_device_id {
8306 + unsigned int vendor, device; /* Vendor and device ID or PCI_ANY_ID */
8307 + unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
8308 + unsigned int class, class_mask; /* (class,subclass,prog-if) triplet */
8309 + unsigned long driver_data; /* Data private to the driver */
8312 +struct pci_driver {
8313 + struct list_head node;
8315 + const struct pci_device_id *id_table; /* NULL if wants all devices */
8316 + int (*probe)(struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
8317 + void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
8318 + void (*suspend)(struct pci_dev *dev); /* Device suspended */
8319 + void (*resume)(struct pci_dev *dev); /* Device woken up */
8322 +#define MODULE_DEVICE_TABLE(type, name)
8323 +#define PCI_ANY_ID (~0)
8326 +#define pci_module_init pci_register_driver
8327 +extern int pci_register_driver(struct pci_driver *drv);
8328 +extern void pci_unregister_driver(struct pci_driver *drv);
8330 +#endif /* PCI registration */
8332 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18))
8334 +#define module_init(x) int init_module(void) { return x(); }
8335 +#define module_exit(x) void cleanup_module(void) { x(); }
8337 +#define module_init(x) __initcall(x);
8338 +#define module_exit(x) __exitcall(x);
8342 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,48))
8343 +#define list_for_each(pos, head) \
8344 + for (pos = (head)->next; pos != (head); pos = pos->next)
8347 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13))
8348 +#define pci_resource_start(dev, bar) ((dev)->base_address[(bar)])
8349 +#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,44))
8350 +#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
8353 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,23))
8354 +#define pci_enable_device(dev) do { } while (0)
8357 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14))
8358 +#define net_device device
8361 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,42))
8366 + * See linux/Documentation/DMA-mapping.txt
8369 +#ifndef PCI_DMA_TODEVICE
8370 +#define PCI_DMA_TODEVICE 1
8371 +#define PCI_DMA_FROMDEVICE 2
8374 +typedef u32 dma_addr_t;
8376 +/* Pure 2^n version of get_order */
8377 +static inline int get_order(unsigned long size)
8381 + size = (size-1) >> (PAGE_SHIFT-1);
8390 +static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
8391 + dma_addr_t *dma_handle)
8394 + int gfp = GFP_ATOMIC | GFP_DMA;
8396 + ret = (void *)__get_free_pages(gfp, get_order(size));
8398 + if (ret != NULL) {
8399 + memset(ret, 0, size);
8400 + *dma_handle = virt_to_bus(ret);
8404 +static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size,
8405 + void *vaddr, dma_addr_t dma_handle)
8407 + free_pages((unsigned long)vaddr, get_order(size));
8410 +extern uint pci_map_single(void *dev, void *va, uint size, int direction);
8411 +extern void pci_unmap_single(void *dev, uint pa, uint size, int direction);
8413 +#define pci_map_single(cookie, address, size, dir) virt_to_bus(address)
8414 +#define pci_unmap_single(cookie, address, size, dir)
8417 +#endif /* DMA mapping */
8419 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43))
8421 +#define dev_kfree_skb_any(a) dev_kfree_skb(a)
8422 +#define netif_down(dev) do { (dev)->start = 0; } while(0)
8424 +/* pcmcia-cs provides its own netdevice compatibility layer */
8425 +#ifndef _COMPAT_NETDEVICE_H
8430 + * For pre-softnet kernels we need to tell the upper layer not to
8431 + * re-enter start_xmit() while we are in there. However softnet
8432 + * guarantees not to enter while we are in there so there is no need
8433 + * to do the netif_stop_queue() dance unless the transmit queue really
8434 + * gets stuck. This should also improve performance according to tests
8435 + * done by Aman Singla.
8438 +#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
8439 +#define netif_wake_queue(dev) do { clear_bit(0, &(dev)->tbusy); mark_bh(NET_BH); } while(0)
8440 +#define netif_stop_queue(dev) set_bit(0, &(dev)->tbusy)
8442 +static inline void netif_start_queue(struct net_device *dev)
8445 + dev->interrupt = 0;
8449 +#define netif_queue_stopped(dev) (dev)->tbusy
8450 +#define netif_running(dev) (dev)->start
8452 +#endif /* _COMPAT_NETDEVICE_H */
8454 +#define netif_device_attach(dev) netif_start_queue(dev)
8455 +#define netif_device_detach(dev) netif_stop_queue(dev)
8457 +/* 2.4.x renamed bottom halves to tasklets */
8458 +#define tasklet_struct tq_struct
8459 +static inline void tasklet_schedule(struct tasklet_struct *tasklet)
8461 + queue_task(tasklet, &tq_immediate);
8462 + mark_bh(IMMEDIATE_BH);
8465 +static inline void tasklet_init(struct tasklet_struct *tasklet,
8466 + void (*func)(unsigned long),
8467 + unsigned long data)
8469 + tasklet->next = NULL;
8470 + tasklet->sync = 0;
8471 + tasklet->routine = (void (*)(void *))func;
8472 + tasklet->data = (void *)data;
8474 +#define tasklet_kill(tasklet) {do{} while(0);}
8476 +/* 2.4.x introduced del_timer_sync() */
8477 +#define del_timer_sync(timer) del_timer(timer)
8481 +#define netif_down(dev)
8483 +#endif /* SoftNet */
8485 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3))
8488 + * Emit code to initialise a tq_struct's routine and data pointers
8490 +#define PREPARE_TQUEUE(_tq, _routine, _data) \
8492 + (_tq)->routine = _routine; \
8493 + (_tq)->data = _data; \
8497 + * Emit code to initialise all of a tq_struct
8499 +#define INIT_TQUEUE(_tq, _routine, _data) \
8501 + INIT_LIST_HEAD(&(_tq)->list); \
8502 + (_tq)->sync = 0; \
8503 + PREPARE_TQUEUE((_tq), (_routine), (_data)); \
8508 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,6))
8510 +/* Power management related routines */
8513 +pci_save_state(struct pci_dev *dev, u32 *buffer)
8517 + for (i = 0; i < 16; i++)
8518 + pci_read_config_dword(dev, i * 4,&buffer[i]);
8524 +pci_restore_state(struct pci_dev *dev, u32 *buffer)
8529 + for (i = 0; i < 16; i++)
8530 + pci_write_config_dword(dev,i * 4, buffer[i]);
8533 + * otherwise, write the context information we know from bootup.
8534 + * This works around a problem where warm-booting from Windows
8535 + * combined with a D3(hot)->D0 transition causes PCI config
8536 + * header data to be forgotten.
8539 + for (i = 0; i < 6; i ++)
8540 + pci_write_config_dword(dev,
8541 + PCI_BASE_ADDRESS_0 + (i * 4),
8542 + pci_resource_start(dev, i));
8543 + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
8548 +#endif /* PCI power management */
8550 +/* Old cp0 access macros deprecated in 2.4.19 */
8551 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19))
8552 +#define read_c0_count() read_32bit_cp0_register(CP0_COUNT)
8555 +#endif /* _linuxver_h_ */
8556 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/nvports.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/nvports.h
8557 --- linux-2.6.12.5/arch/mips/bcm947xx/include/nvports.h 1970-01-01 01:00:00.000000000 +0100
8558 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/nvports.h 2005-09-16 10:29:18.191589360 +0200
8561 + * Broadcom Home Gateway Reference Design
8562 + * Ports Web Page Configuration Support Routines
8564 + * Copyright 2001-2003, Broadcom Corporation
8565 + * All Rights Reserved.
8567 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8568 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8569 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8570 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8574 +#ifndef _nvports_h_
8575 +#define _nvports_h_
8577 +#define uint32 unsigned long
8578 +#define uint16 unsigned short
8579 +#define uint unsigned int
8580 +#define uint8 unsigned char
8581 +#define uint64 unsigned long long
8593 +typedef struct _PORT_ATTRIBS
8601 +nvExistsPortAttrib(char *attrib, uint portno);
8604 +nvExistsAnyForcePortAttrib(uint portno);
8607 +nvSetPortAttrib(char *attrib, uint portno);
8610 +nvUnsetPortAttrib(char *attrib, uint portno);
8613 +nvUnsetAllForcePortAttrib(uint portno);
8615 +extern PORT_ATTRIBS
8616 +nvGetSwitchPortAttribs(uint portno);
8618 +#endif /* _nvports_h_ */
8622 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/osl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/osl.h
8623 --- linux-2.6.12.5/arch/mips/bcm947xx/include/osl.h 1970-01-01 01:00:00.000000000 +0100
8624 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/osl.h 2005-09-16 10:29:18.192589208 +0200
8627 + * OS Independent Layer
8629 + * Copyright 2001-2003, Broadcom Corporation
8630 + * All Rights Reserved.
8632 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8633 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8634 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8635 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8643 +#include <v2hal_osl.h>
8644 +#elif defined(linux)
8645 +#include <linux_osl.h>
8647 +#include <pmon_osl.h>
8648 +#elif defined(NDIS)
8649 +#include <ndis_osl.h>
8650 +#elif defined(_CFE_)
8651 +#include <cfe_osl.h>
8652 +#elif defined(MACOS9)
8653 +#include <macos9_osl.h>
8654 +#elif defined(MACOSX)
8655 +#include <macosx_osl.h>
8657 +#error "Unsupported OSL requested"
8661 +#define SET_REG(r, mask, val) W_REG((r), ((R_REG(r) & ~(mask)) | (val)))
8663 +#endif /* _osl_h_ */
8664 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/pcicfg.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/pcicfg.h
8665 --- linux-2.6.12.5/arch/mips/bcm947xx/include/pcicfg.h 1970-01-01 01:00:00.000000000 +0100
8666 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/pcicfg.h 2005-09-16 10:29:18.192589208 +0200
8669 + * pcicfg.h: PCI configuration constants and structures.
8671 + * Copyright 2001-2003, Broadcom Corporation
8672 + * All Rights Reserved.
8674 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8675 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
8676 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
8677 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
8685 +/* The following inside ifndef's so we don't collide with NTDDK.H */
8686 +#ifndef PCI_MAX_BUS
8687 +#define PCI_MAX_BUS 0x100
8689 +#ifndef PCI_MAX_DEVICES
8690 +#define PCI_MAX_DEVICES 0x20
8692 +#ifndef PCI_MAX_FUNCTION
8693 +#define PCI_MAX_FUNCTION 0x8
8696 +#ifndef PCI_INVALID_VENDORID
8697 +#define PCI_INVALID_VENDORID 0xffff
8699 +#ifndef PCI_INVALID_DEVICEID
8700 +#define PCI_INVALID_DEVICEID 0xffff
8704 +/* Convert between bus-slot-function-register and config addresses */
8706 +#define PCICFG_BUS_SHIFT 16 /* Bus shift */
8707 +#define PCICFG_SLOT_SHIFT 11 /* Slot shift */
8708 +#define PCICFG_FUN_SHIFT 8 /* Function shift */
8709 +#define PCICFG_OFF_SHIFT 0 /* Bus shift */
8711 +#define PCICFG_BUS_MASK 0xff /* Bus mask */
8712 +#define PCICFG_SLOT_MASK 0x1f /* Slot mask */
8713 +#define PCICFG_FUN_MASK 7 /* Function mask */
8714 +#define PCICFG_OFF_MASK 0xff /* Bus mask */
8716 +#define PCI_CONFIG_ADDR(b, s, f, o) \
8717 + ((((b) & PCICFG_BUS_MASK) << PCICFG_BUS_SHIFT) \
8718 + | (((s) & PCICFG_SLOT_MASK) << PCICFG_SLOT_SHIFT) \
8719 + | (((f) & PCICFG_FUN_MASK) << PCICFG_FUN_SHIFT) \
8720 + | (((o) & PCICFG_OFF_MASK) << PCICFG_OFF_SHIFT))
8722 +#define PCI_CONFIG_BUS(a) (((a) >> PCICFG_BUS_SHIFT) & PCICFG_BUS_MASK)
8723 +#define PCI_CONFIG_SLOT(a) (((a) >> PCICFG_SLOT_SHIFT) & PCICFG_SLOT_MASK)
8724 +#define PCI_CONFIG_FUN(a) (((a) >> PCICFG_FUN_SHIFT) & PCICFG_FUN_MASK)
8725 +#define PCI_CONFIG_OFF(a) (((a) >> PCICFG_OFF_SHIFT) & PCICFG_OFF_MASK)
8728 +/* The actual config space */
8730 +#define PCI_BAR_MAX 6
8732 +#define PCI_ROM_BAR 8
8734 +#define PCR_RSVDA_MAX 2
8736 +typedef struct _pci_config_regs {
8737 + unsigned short vendor;
8738 + unsigned short device;
8739 + unsigned short command;
8740 + unsigned short status;
8741 + unsigned char rev_id;
8742 + unsigned char prog_if;
8743 + unsigned char sub_class;
8744 + unsigned char base_class;
8745 + unsigned char cache_line_size;
8746 + unsigned char latency_timer;
8747 + unsigned char header_type;
8748 + unsigned char bist;
8749 + unsigned long base[PCI_BAR_MAX];
8750 + unsigned long cardbus_cis;
8751 + unsigned short subsys_vendor;
8752 + unsigned short subsys_id;
8753 + unsigned long baserom;
8754 + unsigned long rsvd_a[PCR_RSVDA_MAX];
8755 + unsigned char int_line;
8756 + unsigned char int_pin;
8757 + unsigned char min_gnt;
8758 + unsigned char max_lat;
8759 + unsigned char dev_dep[192];
8762 +#define SZPCR (sizeof (pci_config_regs))
8763 +#define MINSZPCR 64 /* offsetof (dev_dep[0] */
8765 +/* A structure for the config registers is nice, but in most
8766 + * systems the config space is not memory mapped, so we need
8767 + * filed offsetts. :-(
8769 +#define PCI_CFG_VID 0
8770 +#define PCI_CFG_DID 2
8771 +#define PCI_CFG_CMD 4
8772 +#define PCI_CFG_STAT 6
8773 +#define PCI_CFG_REV 8
8774 +#define PCI_CFG_PROGIF 9
8775 +#define PCI_CFG_SUBCL 0xa
8776 +#define PCI_CFG_BASECL 0xb
8777 +#define PCI_CFG_CLSZ 0xc
8778 +#define PCI_CFG_LATTIM 0xd
8779 +#define PCI_CFG_HDR 0xe
8780 +#define PCI_CFG_BIST 0xf
8781 +#define PCI_CFG_BAR0 0x10
8782 +#define PCI_CFG_BAR1 0x14
8783 +#define PCI_CFG_BAR2 0x18
8784 +#define PCI_CFG_BAR3 0x1c
8785 +#define PCI_CFG_BAR4 0x20
8786 +#define PCI_CFG_BAR5 0x24
8787 +#define PCI_CFG_CIS 0x28
8788 +#define PCI_CFG_SVID 0x2c
8789 +#define PCI_CFG_SSID 0x2e
8790 +#define PCI_CFG_ROMBAR 0x30
8791 +#define PCI_CFG_INT 0x3c
8792 +#define PCI_CFG_PIN 0x3d
8793 +#define PCI_CFG_MINGNT 0x3e
8794 +#define PCI_CFG_MAXLAT 0x3f
8796 +/* Classes and subclasses */
8799 + PCI_CLASS_OLD = 0,
8802 + PCI_CLASS_DISPLAY,
8812 + PCI_CLASS_INTELLIGENT = 0xe,
8813 + PCI_CLASS_SATELLITE,
8825 + PCI_DASDI_OTHER = 0x80
8826 +} pci_dasdi_subclasses;
8833 + PCI_NET_OTHER = 0x80
8834 +} pci_net_subclasses;
8840 + PCI_DISPLAY_OTHER = 0x80
8841 +} pci_display_subclasses;
8847 + PCI_MEDIA_OTHER = 0x80
8848 +} pci_mmedia_subclasses;
8853 + PCI_MEMORY_OTHER = 0x80
8854 +} pci_memory_subclasses;
8862 + PCI_BRIDGE_PCMCIA,
8864 + PCI_BRIDGE_CARDBUS,
8865 + PCI_BRIDGE_RACEWAY,
8866 + PCI_BRIDGE_OTHER = 0x80
8867 +} pci_bridge_subclasses;
8871 + PCI_COMM_PARALLEL,
8872 + PCI_COMM_MULTIUART,
8874 + PCI_COMM_OTHER = 0x80
8875 +} pci_comm_subclasses;
8882 + PCI_BASE_PCI_HOTPLUG,
8883 + PCI_BASE_OTHER = 0x80
8884 +} pci_base_subclasses;
8890 + PCI_INPUT_SCANNER,
8891 + PCI_INPUT_GAMEPORT,
8892 + PCI_INPUT_OTHER = 0x80
8893 +} pci_input_subclasses;
8897 + PCI_DOCK_OTHER = 0x80
8898 +} pci_dock_subclasses;
8904 + PCI_CPU_ALPHA = 0x10,
8905 + PCI_CPU_POWERPC = 0x20,
8906 + PCI_CPU_MIPS = 0x30,
8907 + PCI_CPU_COPROC = 0x40,
8908 + PCI_CPU_OTHER = 0x80
8909 +} pci_cpu_subclasses;
8912 + PCI_SERIAL_IEEE1394,
8913 + PCI_SERIAL_ACCESS,
8918 + PCI_SERIAL_OTHER = 0x80
8919 +} pci_serial_subclasses;
8922 + PCI_INTELLIGENT_I2O,
8923 +} pci_intelligent_subclasses;
8927 + PCI_SATELLITE_AUDIO,
8928 + PCI_SATELLITE_VOICE,
8929 + PCI_SATELLITE_DATA,
8930 + PCI_SATELLITE_OTHER = 0x80
8931 +} pci_satellite_subclasses;
8934 + PCI_CRYPT_NETWORK,
8935 + PCI_CRYPT_ENTERTAINMENT,
8936 + PCI_CRYPT_OTHER = 0x80
8937 +} pci_crypt_subclasses;
8941 + PCI_DSP_OTHER = 0x80
8942 +} pci_dsp_subclasses;
8946 + PCI_HEADER_NORMAL,
8947 + PCI_HEADER_BRIDGE,
8948 + PCI_HEADER_CARDBUS
8949 +} pci_header_types;
8952 +/* Overlay for a PCI-to-PCI bridge */
8954 +#define PPB_RSVDA_MAX 2
8955 +#define PPB_RSVDD_MAX 8
8957 +typedef struct _ppb_config_regs {
8958 + unsigned short vendor;
8959 + unsigned short device;
8960 + unsigned short command;
8961 + unsigned short status;
8962 + unsigned char rev_id;
8963 + unsigned char prog_if;
8964 + unsigned char sub_class;
8965 + unsigned char base_class;
8966 + unsigned char cache_line_size;
8967 + unsigned char latency_timer;
8968 + unsigned char header_type;
8969 + unsigned char bist;
8970 + unsigned long rsvd_a[PPB_RSVDA_MAX];
8971 + unsigned char prim_bus;
8972 + unsigned char sec_bus;
8973 + unsigned char sub_bus;
8974 + unsigned char sec_lat;
8975 + unsigned char io_base;
8976 + unsigned char io_lim;
8977 + unsigned short sec_status;
8978 + unsigned short mem_base;
8979 + unsigned short mem_lim;
8980 + unsigned short pf_mem_base;
8981 + unsigned short pf_mem_lim;
8982 + unsigned long pf_mem_base_hi;
8983 + unsigned long pf_mem_lim_hi;
8984 + unsigned short io_base_hi;
8985 + unsigned short io_lim_hi;
8986 + unsigned short subsys_vendor;
8987 + unsigned short subsys_id;
8988 + unsigned long rsvd_b;
8989 + unsigned char rsvd_c;
8990 + unsigned char int_pin;
8991 + unsigned short bridge_ctrl;
8992 + unsigned char chip_ctrl;
8993 + unsigned char diag_ctrl;
8994 + unsigned short arb_ctrl;
8995 + unsigned long rsvd_d[PPB_RSVDD_MAX];
8996 + unsigned char dev_dep[192];
8999 +/* Eveything below is BRCM HND proprietary */
9001 +#define PCI_BAR0_WIN 0x80 /* backplane addres space accessed by BAR0 */
9002 +#define PCI_BAR1_WIN 0x84 /* backplane addres space accessed by BAR1 */
9003 +#define PCI_SPROM_CONTROL 0x88 /* sprom property control */
9004 +#define PCI_BAR1_CONTROL 0x8c /* BAR1 region burst control */
9005 +#define PCI_INT_STATUS 0x90 /* PCI and other cores interrupts */
9006 +#define PCI_INT_MASK 0x94 /* mask of PCI and other cores interrupts */
9007 +#define PCI_TO_SB_MB 0x98 /* signal backplane interrupts */
9008 +#define PCI_BACKPLANE_ADDR 0xA0 /* address an arbitrary location on the system backplane */
9009 +#define PCI_BACKPLANE_DATA 0xA4 /* data at the location specified by above address register */
9010 +#define PCI_GPIO_IN 0xb0 /* pci config space gpio input (>=rev3) */
9011 +#define PCI_GPIO_OUT 0xb4 /* pci config space gpio output (>=rev3) */
9012 +#define PCI_GPIO_OUTEN 0xb8 /* pci config space gpio output enable (>=rev3) */
9014 +#define PCI_BAR0_SPROM_OFFSET (4 * 1024) /* bar0 + 4K accesses external sprom */
9015 +#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) /* bar0 + 6K accesses pci core registers */
9018 +#define PCI_SBIM_SHIFT 8 /* backplane core interrupt mask bits offset */
9019 +#define PCI_SBIM_MASK 0xff00 /* backplane core interrupt mask */
9021 +/* PCI_SPROM_CONTROL */
9022 +#define SPROM_BLANK 0x04 /* indicating a blank sprom */
9023 +#define SPROM_WRITEEN 0x10 /* sprom write enable */
9024 +#define SPROM_BOOTROM_WE 0x20 /* external bootrom write enable */
9026 +#define SPROM_SIZE 256 /* sprom size in 16-bit */
9027 +#define SPROM_CRC_RANGE 64 /* crc cover range in 16-bit */
9030 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/proto/802.11.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/802.11.h
9031 --- linux-2.6.12.5/arch/mips/bcm947xx/include/proto/802.11.h 1970-01-01 01:00:00.000000000 +0100
9032 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/802.11.h 2005-09-16 10:29:18.204587384 +0200
9035 + * Copyright 2001-2003, Broadcom Corporation
9036 + * All Rights Reserved.
9038 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9039 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9040 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9041 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9043 + * Fundamental types and constants relating to 802.11
9051 +#ifndef _TYPEDEFS_H_
9052 +#include <typedefs.h>
9055 +#ifndef _NET_ETHERNET_H_
9056 +#include <proto/ethernet.h>
9059 +/* enable structure packing */
9060 +#if !defined(__GNUC__)
9064 +/* some platforms require stronger medicine */
9065 +#if defined(__GNUC__)
9066 +#define PACKED __attribute__((packed))
9072 +#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */
9074 +/* Generic 802.11 frame constants */
9075 +#define DOT11_A3_HDR_LEN 24
9076 +#define DOT11_A4_HDR_LEN 30
9077 +#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
9078 +#define DOT11_FCS_LEN 4
9079 +#define DOT11_ICV_LEN 4
9080 +#define DOT11_ICV_AES_LEN 8
9083 +#define DOT11_KEY_INDEX_SHIFT 6
9084 +#define DOT11_IV_LEN 4
9085 +#define DOT11_IV_TKIP_LEN 8
9086 +#define DOT11_IV_AES_OCB_LEN 4
9087 +#define DOT11_IV_AES_CCM_LEN 8
9089 +#define DOT11_MAX_MPDU_BODY_LEN 2312
9090 +#define DOT11_MAX_MPDU_LEN 2346 /* body len + A4 hdr + FCS */
9091 +#define DOT11_MAX_SSID_LEN 32
9093 +/* dot11RTSThreshold */
9094 +#define DOT11_DEFAULT_RTS_LEN 2347
9095 +#define DOT11_MAX_RTS_LEN 2347
9097 +/* dot11FragmentationThreshold */
9098 +#define DOT11_MIN_FRAG_LEN 256
9099 +#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength of the attached PHY */
9100 +#define DOT11_DEFAULT_FRAG_LEN 2346
9102 +/* dot11BeaconPeriod */
9103 +#define DOT11_MIN_BEACON_PERIOD 1
9104 +#define DOT11_MAX_BEACON_PERIOD 0xFFFF
9106 +/* dot11DTIMPeriod */
9107 +#define DOT11_MIN_DTIM_PERIOD 1
9108 +#define DOT11_MAX_DTIM_PERIOD 0xFF
9110 +/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */
9111 +#define DOT11_LLC_SNAP_HDR_LEN 8
9112 +#define DOT11_OUI_LEN 3
9113 +struct dot11_llc_snap_header {
9114 + uint8 dsap; /* always 0xAA */
9115 + uint8 ssap; /* always 0xAA */
9116 + uint8 ctl; /* always 0x03 */
9117 + uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
9118 + Bridge-Tunnel: 0x00 0x00 0xF8 */
9119 + uint16 type; /* ethertype */
9122 +/* RFC1042 header used by 802.11 per 802.1H */
9123 +#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
9125 +/* Generic 802.11 MAC header */
9127 + * N.B.: This struct reflects the full 4 address 802.11 MAC header.
9128 + * The fields are defined such that the shorter 1, 2, and 3
9129 + * address headers just use the first k fields.
9131 +struct dot11_header {
9132 + uint16 fc; /* frame control */
9133 + uint16 durid; /* duration/ID */
9134 + struct ether_addr a1; /* address 1 */
9135 + struct ether_addr a2; /* address 2 */
9136 + struct ether_addr a3; /* address 3 */
9137 + uint16 seq; /* sequence control */
9138 + struct ether_addr a4; /* address 4 */
9141 +/* Control frames */
9143 +struct dot11_rts_frame {
9144 + uint16 fc; /* frame control */
9145 + uint16 durid; /* duration/ID */
9146 + struct ether_addr ra; /* receiver address */
9147 + struct ether_addr ta; /* transmitter address */
9149 +#define DOT11_RTS_LEN 16
9151 +struct dot11_cts_frame {
9152 + uint16 fc; /* frame control */
9153 + uint16 durid; /* duration/ID */
9154 + struct ether_addr ra; /* receiver address */
9156 +#define DOT11_CTS_LEN 10
9158 +struct dot11_ack_frame {
9159 + uint16 fc; /* frame control */
9160 + uint16 durid; /* duration/ID */
9161 + struct ether_addr ra; /* receiver address */
9163 +#define DOT11_ACK_LEN 10
9165 +struct dot11_ps_poll_frame {
9166 + uint16 fc; /* frame control */
9167 + uint16 durid; /* AID */
9168 + struct ether_addr bssid; /* receiver address, STA in AP */
9169 + struct ether_addr ta; /* transmitter address */
9171 +#define DOT11_PS_POLL_LEN 16
9173 +struct dot11_cf_end_frame {
9174 + uint16 fc; /* frame control */
9175 + uint16 durid; /* duration/ID */
9176 + struct ether_addr ra; /* receiver address */
9177 + struct ether_addr bssid; /* transmitter address, STA in AP */
9179 +#define DOT11_CS_END_LEN 16
9181 +/* Management frame header */
9182 +struct dot11_management_header {
9183 + uint16 fc; /* frame control */
9184 + uint16 durid; /* duration/ID */
9185 + struct ether_addr da; /* receiver address */
9186 + struct ether_addr sa; /* transmitter address */
9187 + struct ether_addr bssid; /* BSS ID */
9188 + uint16 seq; /* sequence control */
9190 +#define DOT11_MGMT_HDR_LEN 24
9192 +/* Management frame payloads */
9194 +struct dot11_bcn_prb {
9195 + uint32 timestamp[2];
9196 + uint16 beacon_interval;
9197 + uint16 capability;
9199 +#define DOT11_BCN_PRB_LEN 12
9201 +struct dot11_auth {
9202 + uint16 alg; /* algorithm */
9203 + uint16 seq; /* sequence control */
9204 + uint16 status; /* status code */
9206 +#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge info elt */
9208 +struct dot11_assoc_req {
9209 + uint16 capability; /* capability information */
9210 + uint16 listen; /* listen interval */
9213 +struct dot11_assoc_resp {
9214 + uint16 capability; /* capability information */
9215 + uint16 status; /* status code */
9216 + uint16 aid; /* association ID */
9219 +struct dot11_action_measure {
9225 +#define DOT11_ACTION_MEASURE_LEN 3
9228 + 802.11h related definitions.
9234 +} dot11_power_cnst_t;
9239 +} dot11_power_cap_t;
9247 +#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */
9252 + uint8 first_channel;
9253 + uint8 num_channels;
9254 +} dot11_supp_channels_t;
9256 +struct dot11_channel_switch {
9263 +typedef struct dot11_channel_switch dot11_channel_switch_t;
9265 +/* 802.11h Measurement Request/Report IEs */
9266 +/* Measurement Type field */
9267 +#define DOT11_MEASURE_TYPE_BASIC 0
9268 +#define DOT11_MEASURE_TYPE_CCA 1
9269 +#define DOT11_MEASURE_TYPE_RPI 2
9271 +/* Measurement Mode field */
9273 +/* Measurement Request Modes */
9274 +#define DOT11_MEASURE_MODE_ENABLE (1<<1)
9275 +#define DOT11_MEASURE_MODE_REQUEST (1<<2)
9276 +#define DOT11_MEASURE_MODE_REPORT (1<<3)
9277 +/* Measurement Report Modes */
9278 +#define DOT11_MEASURE_MODE_LATE (1<<0)
9279 +#define DOT11_MEASURE_MODE_INCAPABLE (1<<1)
9280 +#define DOT11_MEASURE_MODE_REFUSED (1<<2)
9281 +/* Basic Measurement Map bits */
9282 +#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0))
9283 +#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1))
9284 +#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
9285 +#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3))
9286 +#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
9295 + uint8 start_time[8];
9297 +} dot11_meas_req_t;
9298 +#define DOT11_MNG_IE_MREQ_LEN 14
9299 +/* length of Measure Request IE data not including variable len */
9300 +#define DOT11_MNG_IE_MREQ_FIXED_LEN 3
9302 +struct dot11_meas_rep {
9312 + uint8 start_time[8];
9319 +typedef struct dot11_meas_rep dot11_meas_rep_t;
9321 +/* length of Measure Report IE data not including variable len */
9322 +#define DOT11_MNG_IE_MREP_FIXED_LEN 3
9324 +struct dot11_meas_rep_basic {
9326 + uint8 start_time[8];
9330 +typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
9331 +#define DOT11_MEASURE_BASIC_REP_LEN 12
9333 +struct dot11_quiet {
9336 + uint8 count; /* TBTTs until beacon interval in quiet starts */
9337 + uint8 period; /* Beacon intervals between periodic quiet periods ? */
9338 + uint16 duration;/* Length of quiet period, in TU's */
9339 + uint16 offset; /* TU's offset from TBTT in Count field */
9341 +typedef struct dot11_quiet dot11_quiet_t;
9346 +} chan_map_tuple_t;
9351 + uint8 eaddr[ETHER_ADDR_LEN];
9353 + chan_map_tuple_t map[1];
9354 +} dot11_ibss_dfs_t;
9357 +/* Macro to take a pointer to a beacon or probe response
9358 + * header and return the char* pointer to the SSID info element
9360 +#define BCN_PRB_SSID(hdr) ((char*)(hdr) + DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_LEN)
9362 +/* Authentication frame payload constants */
9363 +#define DOT11_OPEN_SYSTEM 0
9364 +#define DOT11_SHARED_KEY 1
9365 +#define DOT11_CHALLENGE_LEN 128
9367 +/* Frame control macros */
9368 +#define FC_PVER_MASK 0x3
9369 +#define FC_PVER_SHIFT 0
9370 +#define FC_TYPE_MASK 0xC
9371 +#define FC_TYPE_SHIFT 2
9372 +#define FC_SUBTYPE_MASK 0xF0
9373 +#define FC_SUBTYPE_SHIFT 4
9374 +#define FC_TODS 0x100
9375 +#define FC_TODS_SHIFT 8
9376 +#define FC_FROMDS 0x200
9377 +#define FC_FROMDS_SHIFT 9
9378 +#define FC_MOREFRAG 0x400
9379 +#define FC_MOREFRAG_SHIFT 10
9380 +#define FC_RETRY 0x800
9381 +#define FC_RETRY_SHIFT 11
9382 +#define FC_PM 0x1000
9383 +#define FC_PM_SHIFT 12
9384 +#define FC_MOREDATA 0x2000
9385 +#define FC_MOREDATA_SHIFT 13
9386 +#define FC_WEP 0x4000
9387 +#define FC_WEP_SHIFT 14
9388 +#define FC_ORDER 0x8000
9389 +#define FC_ORDER_SHIFT 15
9391 +/* sequence control macros */
9392 +#define SEQNUM_SHIFT 4
9393 +#define FRAGNUM_MASK 0xF
9395 +/* Frame Control type/subtype defs */
9398 +#define FC_TYPE_MNG 0
9399 +#define FC_TYPE_CTL 1
9400 +#define FC_TYPE_DATA 2
9402 +/* Management Subtypes */
9403 +#define FC_SUBTYPE_ASSOC_REQ 0
9404 +#define FC_SUBTYPE_ASSOC_RESP 1
9405 +#define FC_SUBTYPE_REASSOC_REQ 2
9406 +#define FC_SUBTYPE_REASSOC_RESP 3
9407 +#define FC_SUBTYPE_PROBE_REQ 4
9408 +#define FC_SUBTYPE_PROBE_RESP 5
9409 +#define FC_SUBTYPE_BEACON 8
9410 +#define FC_SUBTYPE_ATIM 9
9411 +#define FC_SUBTYPE_DISASSOC 10
9412 +#define FC_SUBTYPE_AUTH 11
9413 +#define FC_SUBTYPE_DEAUTH 12
9414 +#define FC_SUBTYPE_ACTION 13
9416 +/* Control Subtypes */
9417 +#define FC_SUBTYPE_PS_POLL 10
9418 +#define FC_SUBTYPE_RTS 11
9419 +#define FC_SUBTYPE_CTS 12
9420 +#define FC_SUBTYPE_ACK 13
9421 +#define FC_SUBTYPE_CF_END 14
9422 +#define FC_SUBTYPE_CF_END_ACK 15
9424 +/* Data Subtypes */
9425 +#define FC_SUBTYPE_DATA 0
9426 +#define FC_SUBTYPE_DATA_CF_ACK 1
9427 +#define FC_SUBTYPE_DATA_CF_POLL 2
9428 +#define FC_SUBTYPE_DATA_CF_ACK_POLL 3
9429 +#define FC_SUBTYPE_NULL 4
9430 +#define FC_SUBTYPE_CF_ACK 5
9431 +#define FC_SUBTYPE_CF_POLL 6
9432 +#define FC_SUBTYPE_CF_ACK_POLL 7
9434 +/* type-subtype combos */
9435 +#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
9437 +#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
9439 +#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
9440 +#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
9441 +#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
9442 +#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
9443 +#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
9444 +#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
9445 +#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
9446 +#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
9447 +#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
9448 +#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
9449 +#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
9451 +#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
9452 +#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
9453 +#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
9454 +#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
9455 +#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
9456 +#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
9458 +#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
9459 +#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
9460 +#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
9462 +/* Management Frames */
9464 +/* Management Frame Constants */
9467 +#define DOT11_MNG_AUTH_ALGO_LEN 2
9468 +#define DOT11_MNG_AUTH_SEQ_LEN 2
9469 +#define DOT11_MNG_BEACON_INT_LEN 2
9470 +#define DOT11_MNG_CAP_LEN 2
9471 +#define DOT11_MNG_AP_ADDR_LEN 6
9472 +#define DOT11_MNG_LISTEN_INT_LEN 2
9473 +#define DOT11_MNG_REASON_LEN 2
9474 +#define DOT11_MNG_AID_LEN 2
9475 +#define DOT11_MNG_STATUS_LEN 2
9476 +#define DOT11_MNG_TIMESTAMP_LEN 8
9478 +/* DUR/ID field in assoc resp is 0xc000 | AID */
9479 +#define DOT11_AID_MASK 0x3fff
9482 +#define DOT11_RC_RESERVED 0
9483 +#define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */
9484 +#define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */
9485 +#define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station is
9486 + leaving (or has left) IBSS or ESS */
9487 +#define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */
9488 +#define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle
9489 + all currently associated stations */
9490 +#define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from
9491 + nonauthenticated station */
9492 +#define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from
9493 + nonassociated station */
9494 +#define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is
9495 + leaving (or has left) BSS */
9496 +#define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is
9497 + not authenticated with responding station */
9498 +#define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */
9501 +#define DOT11_STATUS_SUCCESS 0 /* Successful */
9502 +#define DOT11_STATUS_FAILURE 1 /* Unspecified failure */
9503 +#define DOT11_STATUS_CAP_MISMATCH 10 /* Cannot support all requested capabilities
9504 + in the Capability Information field */
9505 +#define DOT11_STATUS_REASSOC_FAIL 11 /* Reassociation denied due to inability to
9506 + confirm that association exists */
9507 +#define DOT11_STATUS_ASSOC_FAIL 12 /* Association denied due to reason outside
9508 + the scope of this standard */
9509 +#define DOT11_STATUS_AUTH_MISMATCH 13 /* Responding station does not support the
9510 + specified authentication algorithm */
9511 +#define DOT11_STATUS_AUTH_SEQ 14 /* Received an Authentication frame with
9512 + authentication transaction sequence number
9513 + out of expected sequence */
9514 +#define DOT11_STATUS_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of challenge failure */
9515 +#define DOT11_STATUS_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout waiting
9516 + for next frame in sequence */
9517 +#define DOT11_STATUS_ASSOC_BUSY_FAIL 17 /* Association denied because AP is unable to
9518 + handle additional associated stations */
9519 +#define DOT11_STATUS_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting station
9520 + not supporting all of the data rates in the
9521 + BSSBasicRateSet parameter */
9522 +#define DOT11_STATUS_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting station
9523 + not supporting the Short Preamble option */
9524 +#define DOT11_STATUS_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting station
9525 + not supporting the PBCC Modulation option */
9526 +#define DOT11_STATUS_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting station
9527 + not supporting the Channel Agility option */
9528 +#define DOT11_STATUS_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum Management
9529 + capability is required. */
9530 +#define DOT11_STATUS_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info in the
9531 + Power Cap element is unacceptable. */
9532 +#define DOT11_STATUS_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info in the
9533 + Supported Channel element is unacceptable */
9534 +#define DOT11_STATUS_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting station
9535 + not supporting the Short Slot Time option */
9536 +#define DOT11_STATUS_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting station
9537 + not supporting the ER-PBCC Modulation option */
9538 +#define DOT11_STATUS_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting station
9539 + not supporting the DSS-OFDM option */
9541 +/* Info Elts, length of INFORMATION portion of Info Elts */
9542 +#define DOT11_MNG_DS_PARAM_LEN 1
9543 +#define DOT11_MNG_IBSS_PARAM_LEN 2
9545 +/* TIM Info element has 3 bytes fixed info in INFORMATION field,
9546 + * followed by 1 to 251 bytes of Partial Virtual Bitmap */
9547 +#define DOT11_MNG_TIM_FIXED_LEN 3
9548 +#define DOT11_MNG_TIM_DTIM_COUNT 0
9549 +#define DOT11_MNG_TIM_DTIM_PERIOD 1
9550 +#define DOT11_MNG_TIM_BITMAP_CTL 2
9551 +#define DOT11_MNG_TIM_PVB 3
9554 +#define TLV_TAG_OFF 0
9555 +#define TLV_LEN_OFF 1
9556 +#define TLV_HDR_LEN 2
9557 +#define TLV_BODY_OFF 2
9559 +/* Management Frame Information Element IDs */
9560 +#define DOT11_MNG_SSID_ID 0
9561 +#define DOT11_MNG_RATES_ID 1
9562 +#define DOT11_MNG_FH_PARMS_ID 2
9563 +#define DOT11_MNG_DS_PARMS_ID 3
9564 +#define DOT11_MNG_CF_PARMS_ID 4
9565 +#define DOT11_MNG_TIM_ID 5
9566 +#define DOT11_MNG_IBSS_PARMS_ID 6
9567 +#define DOT11_MNG_COUNTRY_ID 7
9568 +#define DOT11_MNG_HOPPING_PARMS_ID 8
9569 +#define DOT11_MNG_HOPPING_TABLE_ID 9
9570 +#define DOT11_MNG_REQUEST_ID 10
9571 +#define DOT11_MNG_CHALLENGE_ID 16
9572 +#define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */
9573 +#define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */
9574 +#define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */
9575 +#define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */
9576 +#define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */
9577 +#define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement*/
9578 +#define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */
9579 +#define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */
9580 +#define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */
9581 +#define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */
9582 +#define DOT11_MNG_ERP_ID 42
9583 +#define DOT11_MNG_NONERP_ID 47
9584 +#define DOT11_MNG_EXT_RATES_ID 50
9585 +#define DOT11_MNG_WPA_ID 221
9586 +#define DOT11_MNG_PROPR_ID 221
9588 +/* ERP info element bit values */
9589 +#define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */
9590 +#define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present in the BSS */
9591 +#define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for ERP-OFDM frames */
9592 +#define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed, 1 == not allowed */
9594 +/* Capability Information Field */
9595 +#define DOT11_CAP_ESS 0x0001
9596 +#define DOT11_CAP_IBSS 0x0002
9597 +#define DOT11_CAP_POLLABLE 0x0004
9598 +#define DOT11_CAP_POLL_RQ 0x0008
9599 +#define DOT11_CAP_PRIVACY 0x0010
9600 +#define DOT11_CAP_SHORT 0x0020
9601 +#define DOT11_CAP_PBCC 0x0040
9602 +#define DOT11_CAP_AGILITY 0x0080
9603 +#define DOT11_CAP_SPECTRUM 0x0100
9604 +#define DOT11_CAP_SHORTSLOT 0x0400
9605 +#define DOT11_CAP_CCK_OFDM 0x2000
9607 +/* Action Frame Constants */
9608 +#define DOT11_ACTION_CAT_ERR_MASK 0x10
9609 +#define DOT11_ACTION_CAT_SPECT_MNG 0x00
9611 +#define DOT11_ACTION_ID_M_REQ 0
9612 +#define DOT11_ACTION_ID_M_REP 1
9613 +#define DOT11_ACTION_ID_TPC_REQ 2
9614 +#define DOT11_ACTION_ID_TPC_REP 3
9615 +#define DOT11_ACTION_ID_CHANNEL_SWITCH 4
9617 +/* MLME Enumerations */
9618 +#define DOT11_BSSTYPE_INFRASTRUCTURE 0
9619 +#define DOT11_BSSTYPE_INDEPENDENT 1
9620 +#define DOT11_BSSTYPE_ANY 2
9621 +#define DOT11_SCANTYPE_ACTIVE 0
9622 +#define DOT11_SCANTYPE_PASSIVE 1
9624 +/* 802.11 A PHY constants */
9625 +#define APHY_SLOT_TIME 9
9626 +#define APHY_SIFS_TIME 16
9627 +#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
9628 +#define APHY_PREAMBLE_TIME 16
9629 +#define APHY_SIGNAL_TIME 4
9630 +#define APHY_SYMBOL_TIME 4
9631 +#define APHY_SERVICE_NBITS 16
9632 +#define APHY_TAIL_NBITS 6
9633 +#define APHY_CWMIN 15
9635 +/* 802.11 B PHY constants */
9636 +#define BPHY_SLOT_TIME 20
9637 +#define BPHY_SIFS_TIME 10
9638 +#define BPHY_DIFS_TIME 50
9639 +#define BPHY_PLCP_TIME 192
9640 +#define BPHY_PLCP_SHORT_TIME 96
9641 +#define BPHY_CWMIN 31
9643 +/* 802.11 G constants */
9644 +#define DOT11_OFDM_SIGNAL_EXTENSION 6
9646 +#define PHY_CWMAX 1023
9648 +#define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */
9650 +/* dot11Counters Table - 802.11 spec., Annex D */
9651 +typedef struct d11cnt {
9652 + uint32 txfrag; /* dot11TransmittedFragmentCount */
9653 + uint32 txmulti; /* dot11MulticastTransmittedFrameCount */
9654 + uint32 txfail; /* dot11FailedCount */
9655 + uint32 txretry; /* dot11RetryCount */
9656 + uint32 txretrie; /* dot11MultipleRetryCount */
9657 + uint32 rxdup; /* dot11FrameduplicateCount */
9658 + uint32 txrts; /* dot11RTSSuccessCount */
9659 + uint32 txnocts; /* dot11RTSFailureCount */
9660 + uint32 txnoack; /* dot11ACKFailureCount */
9661 + uint32 rxfrag; /* dot11ReceivedFragmentCount */
9662 + uint32 rxmulti; /* dot11MulticastReceivedFrameCount */
9663 + uint32 rxcrc; /* dot11FCSErrorCount */
9664 + uint32 txfrmsnt; /* dot11TransmittedFrameCount */
9665 + uint32 rxundec; /* dot11WEPUndecryptableCount */
9669 +#define BRCM_OUI "\x00\x10\x18"
9671 +/* WPA definitions */
9672 +#define WPA_VERSION 1
9673 +#define WPA_OUI "\x00\x50\xF2"
9675 +#define WPA_OUI_LEN 3
9677 +/* WPA authentication modes */
9678 +#define WPA_AUTH_NONE 0 /* None */
9679 +#define WPA_AUTH_UNSPECIFIED 1 /* Unspecified authentication over 802.1X: default for WPA */
9680 +#define WPA_AUTH_PSK 2 /* Pre-shared Key over 802.1X */
9681 +#define WPA_AUTH_DISABLED 255 /* Legacy (i.e., non-WPA) */
9683 +#define IS_WPA_AUTH(auth) ((auth) == WPA_AUTH_NONE || \
9684 + (auth) == WPA_AUTH_UNSPECIFIED || \
9685 + (auth) == WPA_AUTH_PSK)
9688 +/* Key related defines */
9689 +#define DOT11_MAX_KEY_SIZE 32 /* max size of any key */
9690 +#define DOT11_MAX_IV_SIZE 16 /* max size of any IV */
9691 +#define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */
9693 +#define WEP1_KEY_SIZE 5 /* max size of any WEP key */
9694 +#define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */
9695 +#define WEP128_KEY_SIZE 13 /* max size of any WEP key */
9696 +#define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */
9697 +#define TKIP_MIC_SIZE 8 /* size of TKIP MIC */
9698 +#define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */
9699 +#define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */
9700 +#define TKIP_KEY_SIZE 32 /* size of any TKIP key */
9701 +#define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */
9702 +#define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */
9703 +#define TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */
9704 +#define TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */
9705 +#define AES_KEY_SIZE 16 /* size of AES key */
9708 +#if !defined(__GNUC__)
9712 +#endif /* _802_11_H_ */
9713 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/proto/ethernet.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/ethernet.h
9714 --- linux-2.6.12.5/arch/mips/bcm947xx/include/proto/ethernet.h 1970-01-01 01:00:00.000000000 +0100
9715 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/proto/ethernet.h 2005-09-16 10:29:18.205587232 +0200
9717 +/*******************************************************************************
9719 + * Copyright 2001-2003, Broadcom Corporation
9720 + * All Rights Reserved.
9722 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9723 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9724 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9725 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9726 + * From FreeBSD 2.2.7: Fundamental constants relating to ethernet.
9727 + ******************************************************************************/
9729 +#ifndef _NET_ETHERNET_H_ /* use native BSD ethernet.h when available */
9730 +#define _NET_ETHERNET_H_
9732 +#ifndef _TYPEDEFS_H_
9733 +#include "typedefs.h"
9736 +#if defined(__GNUC__)
9737 +#define PACKED __attribute__((packed))
9743 + * The number of bytes in an ethernet (MAC) address.
9745 +#define ETHER_ADDR_LEN 6
9748 + * The number of bytes in the type field.
9750 +#define ETHER_TYPE_LEN 2
9753 + * The number of bytes in the trailing CRC field.
9755 +#define ETHER_CRC_LEN 4
9758 + * The length of the combined header.
9760 +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
9763 + * The minimum packet length.
9765 +#define ETHER_MIN_LEN 64
9768 + * The minimum packet user data length.
9770 +#define ETHER_MIN_DATA 46
9773 + * The maximum packet length.
9775 +#define ETHER_MAX_LEN 1518
9778 + * The maximum packet user data length.
9780 +#define ETHER_MAX_DATA 1500
9783 + * Used to uniquely identify a 802.1q VLAN-tagged header.
9785 +#define VLAN_TAG 0x8100
9788 + * Located after dest & src address in ether header.
9790 +#define VLAN_FIELDS_OFFSET (ETHER_ADDR_LEN * 2)
9793 + * 4 bytes of vlan field info.
9795 +#define VLAN_FIELDS_SIZE 4
9797 +/* location of pri bits in 16-bit vlan fields */
9798 +#define VLAN_PRI_SHIFT 13
9800 +/* 3 bits of priority */
9801 +#define VLAN_PRI_MASK 7
9803 +/* 802.1X ethertype */
9804 +#define ETHER_TYPE_802_1X 0x888e
9807 + * A macro to validate a length with
9809 +#define ETHER_IS_VALID_LEN(foo) \
9810 + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
9813 +#ifndef __INCif_etherh /* Quick and ugly hack for VxWorks */
9815 + * Structure of a 10Mb/s Ethernet header.
9817 +struct ether_header {
9818 + uint8 ether_dhost[ETHER_ADDR_LEN];
9819 + uint8 ether_shost[ETHER_ADDR_LEN];
9820 + uint16 ether_type;
9824 + * Structure of a 48-bit Ethernet address.
9826 +struct ether_addr {
9827 + uint8 octet[ETHER_ADDR_LEN];
9832 + * Takes a pointer, returns true if a 48-bit multicast address
9833 + * (including broadcast, since it is all ones)
9835 +#define ETHER_ISMULTI(ea) (((uint8 *)(ea))[0] & 1)
9838 + * Takes a pointer, returns true if a 48-bit broadcast (all ones)
9840 +#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \
9841 + ((uint8 *)(ea))[1] & \
9842 + ((uint8 *)(ea))[2] & \
9843 + ((uint8 *)(ea))[3] & \
9844 + ((uint8 *)(ea))[4] & \
9845 + ((uint8 *)(ea))[5]) == 0xff)
9847 +static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}};
9850 + * Takes a pointer, returns true if a 48-bit null address (all zeros)
9852 +#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \
9853 + ((uint8 *)(ea))[1] | \
9854 + ((uint8 *)(ea))[2] | \
9855 + ((uint8 *)(ea))[3] | \
9856 + ((uint8 *)(ea))[4] | \
9857 + ((uint8 *)(ea))[5]) == 0)
9861 +#endif /* _NET_ETHERNET_H_ */
9862 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/rts/crc.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/rts/crc.h
9863 --- linux-2.6.12.5/arch/mips/bcm947xx/include/rts/crc.h 1970-01-01 01:00:00.000000000 +0100
9864 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/rts/crc.h 2005-09-16 10:29:18.205587232 +0200
9866 +/*******************************************************************************
9868 + * Copyright 2001-2003, Broadcom Corporation
9869 + * All Rights Reserved.
9871 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9872 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9873 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
9874 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
9875 + * crc.h - a function to compute crc for iLine10 headers
9876 + ******************************************************************************/
9878 +#ifndef _RTS_CRC_H_
9879 +#define _RTS_CRC_H_ 1
9881 +#include "typedefs.h"
9888 +#define CRC8_INIT_VALUE 0xff /* Initial CRC8 checksum value */
9889 +#define CRC8_GOOD_VALUE 0x9f /* Good final CRC8 checksum value */
9890 +#define HCS_GOOD_VALUE 0x39 /* Good final header checksum value */
9892 +#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */
9893 +#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */
9895 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
9896 +#define CRC32_GOOD_VALUE 0xdebb20e3 /* Good final CRC32 checksum value */
9898 +void hcs(uint8 *, uint);
9899 +uint8 crc8(uint8 *, uint, uint8);
9900 +uint16 crc16(uint8 *, uint, uint16);
9901 +uint32 crc32(uint8 *, uint, uint32);
9903 +/* macros for common usage */
9905 +#define APPEND_CRC8(pbytes, nbytes) \
9907 + uint8 tmp = crc8(pbytes, nbytes, CRC8_INIT_VALUE) ^ 0xff; \
9908 + (pbytes)[(nbytes)] = tmp; \
9912 +#define APPEND_CRC16(pbytes, nbytes) \
9914 + uint16 tmp = crc16(pbytes, nbytes, CRC16_INIT_VALUE) ^ 0xffff; \
9915 + (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff; \
9916 + (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff; \
9920 +#define APPEND_CRC32(pbytes, nbytes) \
9922 + uint32 tmp = crc32(pbytes, nbytes, CRC32_INIT_VALUE) ^ 0xffffffff; \
9923 + (pbytes)[(nbytes) + 0] = (tmp >> 0) & 0xff; \
9924 + (pbytes)[(nbytes) + 1] = (tmp >> 8) & 0xff; \
9925 + (pbytes)[(nbytes) + 2] = (tmp >> 16) & 0xff; \
9926 + (pbytes)[(nbytes) + 3] = (tmp >> 24) & 0xff; \
9934 +#endif /* _RTS_CRC_H_ */
9935 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/s5.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/s5.h
9936 --- linux-2.6.12.5/arch/mips/bcm947xx/include/s5.h 1970-01-01 01:00:00.000000000 +0100
9937 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/s5.h 2005-09-16 10:29:18.206587080 +0200
9942 + * Copyright 2003, Broadcom Corporation
9943 + * All Rights Reserved.
9945 + * Broadcom Sentry5 (S5) BCM5365, 53xx, BCM58xx SOC Internal Core
9946 + * and MIPS3301 (R4K) System Address Space
9948 + * This program is free software; you can redistribute it and/or
9949 + * modify it under the terms of the GNU General Public License as
9950 + * published by the Free Software Foundation, located in the file
9953 + * $Id: s5.h,v 1.3 2003/06/10 18:54:51 jfd Exp $
9957 +/* BCM5365 Address map */
9958 +#define KSEG1ADDR(x) ( (x) | 0xa0000000)
9959 +#define BCM5365_SDRAM 0x00000000 /* 0-128MB Physical SDRAM */
9960 +#define BCM5365_PCI_MEM 0x08000000 /* Host Mode PCI mem space (64MB) */
9961 +#define BCM5365_PCI_CFG 0x0c000000 /* Host Mode PCI cfg space (64MB) */
9962 +#define BCM5365_PCI_DMA 0x40000000 /* Client Mode PCI mem space (1GB)*/
9963 +#define BCM5365_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
9964 +#define BCM5365_ENUM 0x18000000 /* Beginning of core enum space */
9966 +/* BCM5365 Core register space */
9967 +#define BCM5365_REG_CHIPC 0x18000000 /* Chipcommon registers */
9968 +#define BCM5365_REG_EMAC0 0x18001000 /* Ethernet MAC0 core registers */
9969 +#define BCM5365_REG_IPSEC 0x18002000 /* BCM582x CryptoCore registers */
9970 +#define BCM5365_REG_USB 0x18003000 /* USB core registers */
9971 +#define BCM5365_REG_PCI 0x18004000 /* PCI core registers */
9972 +#define BCM5365_REG_MIPS33 0x18005000 /* MIPS core registers */
9973 +#define BCM5365_REG_MEMC 0x18006000 /* MEMC core registers */
9974 +#define BCM5365_REG_UARTS (BCM5365_REG_CHIPC + 0x300) /* UART regs */
9975 +#define BCM5365_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
9977 +/* COM Ports 1/2 */
9978 +#define BCM5365_UART (BCM5365_REG_UARTS)
9979 +#define BCM5365_UART_COM2 (BCM5365_REG_UARTS + 0x00000100)
9981 +/* Registers common to MIPS33 Core used in 5365 */
9982 +#define MIPS33_FLASH_REGION 0x1fc00000 /* Boot FLASH Region */
9983 +#define MIPS33_EXTIF_REGION 0x1a000000 /* Chipcommon EXTIF region*/
9984 +#define BCM5365_EXTIF 0x1b000000 /* MISC_CS */
9985 +#define MIPS33_FLASH_REGION_AUX 0x1c000000 /* FLASH Region 2*/
9987 +/* Internal Core Sonics Backplane Devices */
9988 +#define INTERNAL_UART_COM1 BCM5365_UART
9989 +#define INTERNAL_UART_COM2 BCM5365_UART_COM2
9990 +#define SB_REG_CHIPC BCM5365_REG_CHIPC
9991 +#define SB_REG_ENET0 BCM5365_REG_EMAC0
9992 +#define SB_REG_IPSEC BCM5365_REG_IPSEC
9993 +#define SB_REG_USB BCM5365_REG_USB
9994 +#define SB_REG_PCI BCM5365_REG_PCI
9995 +#define SB_REG_MIPS BCM5365_REG_MIPS33
9996 +#define SB_REG_MEMC BCM5365_REG_MEMC
9997 +#define SB_REG_MEMC_OFF 0x6000
9998 +#define SB_EXTIF_SPACE MIPS33_EXTIF_REGION
9999 +#define SB_FLASH_SPACE MIPS33_FLASH_REGION
10003 + * 5365-specific backplane interrupt flag numbers. This should be done
10004 + * dynamically instead.
10006 +#define SBFLAG_PCI 0
10007 +#define SBFLAG_ENET0 1
10008 +#define SBFLAG_ILINE20 2
10009 +#define SBFLAG_CODEC 3
10010 +#define SBFLAG_USB 4
10011 +#define SBFLAG_EXTIF 5
10012 +#define SBFLAG_ENET1 6
10014 +/* BCM95365 Local Bus devices */
10015 +#define BCM95365K_RESET_ADDR BCM5365_EXTIF
10016 +#define BCM95365K_BOARDID_ADDR (BCM5365_EXTIF | 0x4000)
10017 +#define BCM95365K_DOC_ADDR (BCM5365_EXTIF | 0x6000)
10018 +#define BCM95365K_LED_ADDR (BCM5365_EXTIF | 0xc000)
10019 +#define BCM95365K_TOD_REG_BASE (BCM95365K_NVRAM_ADDR | 0x1ff0)
10020 +#define BCM95365K_NVRAM_ADDR (BCM5365_EXTIF | 0xe000)
10021 +#define BCM95365K_NVRAM_SIZE 0x1ff0 /* 8K NVRAM : DS1743/STM48txx*/
10023 +/* Write to DLR2416 VFD Display character RAM */
10024 +#define LED_REG(x) \
10025 + (*(volatile unsigned char *) (KSEG1ADDR(BCM95365K_LED_ADDR) + (x)))
10027 +#ifdef CONFIG_VSIM
10028 +#define BCM5365_TRACE(trval) do { *((int *)0xa0002ff8) = (trval); \
10031 +#define BCM5365_TRACE(trval) do { *((unsigned char *)\
10032 + KSEG1ADDR(BCM5365K_LED_ADDR)) = (trval); \
10033 + *((int *)0xa0002ff8) = (trval); } while (0)
10036 +/* BCM9536R Local Bus devices */
10037 +#define BCM95365R_DOC_ADDR BCM5365_EXTIF
10041 +#endif /*!_S5_H_ */
10042 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbchipc.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbchipc.h
10043 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbchipc.h 1970-01-01 01:00:00.000000000 +0100
10044 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbchipc.h 2005-09-16 10:29:18.207586928 +0200
10047 + * SiliconBackplane Chipcommon core hardware definitions.
10049 + * The chipcommon core provides chip identification, SB control,
10050 + * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer,
10051 + * gpio interface, extbus, and support for serial and parallel flashes.
10053 + * Copyright 2001-2003, Broadcom Corporation
10054 + * All Rights Reserved.
10056 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10057 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10058 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10059 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10064 +#ifndef _SBCHIPC_H
10065 +#define _SBCHIPC_H
10068 +/* cpp contortions to concatenate w/arg prescan */
10070 +#define _PADLINE(line) pad ## line
10071 +#define _XSTR(line) _PADLINE(line)
10072 +#define PAD _XSTR(__LINE__)
10075 +typedef volatile struct {
10076 + uint32 chipid; /* 0x0 */
10077 + uint32 capabilities;
10078 + uint32 corecontrol; /* corerev >= 1 */
10081 + /* Interrupt control */
10082 + uint32 intstatus; /* 0x20 */
10086 + /* serial flash interface registers */
10087 + uint32 flashcontrol; /* 0x40 */
10088 + uint32 flashaddress;
10089 + uint32 flashdata;
10092 + /* Silicon backplane configuration broadcast control */
10093 + uint32 broadcastaddress;
10094 + uint32 broadcastdata;
10097 + /* gpio - cleared only by power-on-reset */
10098 + uint32 gpioin; /* 0x60 */
10100 + uint32 gpioouten;
10101 + uint32 gpiocontrol;
10102 + uint32 gpiointpolarity;
10103 + uint32 gpiointmask;
10106 + /* Watchdog timer */
10107 + uint32 watchdog; /* 0x80 */
10110 + /* clock control */
10111 + uint32 clockcontrol_n; /* 0x90 */
10112 + uint32 clockcontrol_sb; /* aka m0 */
10113 + uint32 clockcontrol_pci; /* aka m1 */
10114 + uint32 clockcontrol_m2; /* mii/uart/mipsref */
10115 + uint32 clockcontrol_mips; /* aka m3 */
10116 + uint32 uart_clkdiv; /* corerev >= 3 */
10119 + /* pll delay registers (corerev >= 4) */
10120 + uint32 pll_on_delay; /* 0xb0 */
10121 + uint32 fref_sel_delay;
10122 + uint32 slow_clk_ctl;
10125 + /* ExtBus control registers (corerev >= 3) */
10126 + uint32 cs01config; /* 0x100 */
10127 + uint32 cs01memwaitcnt;
10128 + uint32 cs01attrwaitcnt;
10129 + uint32 cs01iowaitcnt;
10130 + uint32 cs23config;
10131 + uint32 cs23memwaitcnt;
10132 + uint32 cs23attrwaitcnt;
10133 + uint32 cs23iowaitcnt;
10134 + uint32 cs4config;
10135 + uint32 cs4waitcnt;
10136 + uint32 parallelflashconfig;
10137 + uint32 parallelflashwaitcnt;
10141 + uint8 uart0data; /* 0x300 */
10148 + uint8 uart0scratch;
10149 + uint8 PAD[248]; /* corerev >= 1 */
10151 + uint8 uart1data; /* 0x400 */
10158 + uint8 uart1scratch;
10162 +#define CID_ID_MASK 0x0000ffff /* Chip Id mask */
10163 +#define CID_REV_MASK 0x000f0000 /* Chip Revision mask */
10164 +#define CID_REV_SHIFT 16 /* Chip Revision shift */
10165 +#define CID_PKG_MASK 0x00f00000 /* Package Option mask */
10166 +#define CID_PKG_SHIFT 20 /* Package Option shift */
10167 +#define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */
10168 +#define CID_CC_SHIFT 24
10170 +/* capabilities */
10171 +#define CAP_UARTS_MASK 0x00000003 /* Number of uarts */
10172 +#define CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */
10173 +#define CAP_UCLKSEL 0x00000018 /* UARTs clock select */
10174 +#define CAP_UINTCLK 0x00000008 /* UARTs are driven by internal divided clock */
10175 +#define CAP_UARTGPIO 0x00000020 /* UARTs own Gpio's 15:12 */
10176 +#define CAP_EXTBUS 0x00000040 /* External bus present */
10177 +#define CAP_FLASH_MASK 0x00000700 /* Type of flash */
10178 +#define CAP_PLL_MASK 0x00038000 /* Type of PLL */
10179 +#define CAP_PWR_CTL 0x00040000 /* Power control */
10182 +#define PLL_NONE 0x00000000
10183 +#define PLL_TYPE1 0x00010000 /* 48Mhz base, 3 dividers */
10184 +#define PLL_TYPE2 0x00020000 /* 48Mhz, 4 dividers */
10185 +#define PLL_TYPE3 0x00030000 /* 25Mhz, 2 dividers */
10186 +#define PLL_TYPE4 0x00008000 /* 48Mhz, 4 dividers */
10189 +#define CC_UARTCLKO 0x00000001 /* Drive UART with internal clock */
10190 +#define CC_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
10192 +/* intstatus/intmask */
10193 +#define CI_EI 0x00000002 /* ro: ext intr pin (corerev >= 3) */
10195 +/* slow_clk_ctl */
10196 +#define SCC_SS_MASK 0x00000007 /* slow clock source mask */
10197 +#define SCC_SS_LPO 0x00000000 /* source of slow clock is LPO */
10198 +#define SCC_SS_XTAL 0x00000001 /* source of slow clock is crystal */
10199 +#define SCC_SS_PCI 0x00000002 /* source of slow clock is PCI */
10200 +#define SCC_LF 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
10201 +#define SCC_LP 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
10202 +#define SCC_FS 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
10203 +#define SCC_IP 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */
10204 +#define SCC_XC 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */
10205 +#define SCC_XP 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */
10206 +#define SCC_CD_MASK 0xffff0000 /* ClockDivider mask, SlowClk = 1/(4+divisor) * crystal/PCI clock */
10207 +#define SCC_CD_SHF 16 /* CLockDivider shift */
10209 +/* clockcontrol_n */
10210 +#define CN_N1_MASK 0x3f /* n1 control */
10211 +#define CN_N2_MASK 0x3f00 /* n2 control */
10212 +#define CN_N2_SHIFT 8
10214 +/* clockcontrol_sb/pci/uart */
10215 +#define CC_M1_MASK 0x3f /* m1 control */
10216 +#define CC_M2_MASK 0x3f00 /* m2 control */
10217 +#define CC_M2_SHIFT 8
10218 +#define CC_M3_MASK 0x3f0000 /* m3 control */
10219 +#define CC_M3_SHIFT 16
10220 +#define CC_MC_MASK 0x1f000000 /* mux control */
10221 +#define CC_MC_SHIFT 24
10223 +/* N3M Clock control values for 125Mhz */
10224 +#define CC_125_N 0x0802 /* Default values for bcm4310 */
10225 +#define CC_125_M 0x04020009
10226 +#define CC_125_M25 0x11090009
10227 +#define CC_125_M33 0x11090005
10229 +/* N3M Clock control magic field values */
10230 +#define CC_F6_2 0x02 /* A factor of 2 in */
10231 +#define CC_F6_3 0x03 /* 6-bit fields like */
10232 +#define CC_F6_4 0x05 /* N1, M1 or M3 */
10233 +#define CC_F6_5 0x09
10234 +#define CC_F6_6 0x11
10235 +#define CC_F6_7 0x21
10237 +#define CC_F5_BIAS 5 /* 5-bit fields get this added */
10239 +#define CC_MC_BYPASS 0x08
10240 +#define CC_MC_M1 0x04
10241 +#define CC_MC_M1M2 0x02
10242 +#define CC_MC_M1M2M3 0x01
10243 +#define CC_MC_M1M3 0x11
10245 +/* Type 2 Clock control magic field values */
10246 +#define CC_T2_BIAS 2 /* n1, n2, m1 & m3 bias */
10247 +#define CC_T2M2_BIAS 3 /* m2 bias */
10249 +#define CC_T2MC_M1BYP 1
10250 +#define CC_T2MC_M2BYP 2
10251 +#define CC_T2MC_M3BYP 4
10253 +/* Common clock base */
10254 +#define CC_CLOCK_BASE 24000000 /* Half the clock freq */
10256 +/* Flash types in the chipcommon capabilities register */
10257 +#define FLASH_NONE 0x000 /* No flash */
10258 +#define SFLASH_ST 0x100 /* ST serial flash */
10259 +#define SFLASH_AT 0x200 /* Atmel serial flash */
10260 +#define PFLASH 0x700 /* Parallel flash */
10262 +/* Bits in the config registers */
10263 +#define CC_CFG_EN 0x0001 /* Enable */
10264 +#define CC_CFG_EM_MASK 0x000e /* Extif Mode */
10265 +#define CC_CFG_EM_ASYNC 0x0002 /* Async/Parallel flash */
10266 +#define CC_CFG_EM_SYNC 0x0004 /* Synchronous */
10267 +#define CC_CFG_EM_PCMCIA 0x0008 /* PCMCIA */
10268 +#define CC_CFG_EM_IDE 0x000a /* IDE */
10269 +#define CC_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */
10270 +#define CC_CFG_CD_MASK 0x0060 /* Sync: Clock divisor */
10271 +#define CC_CFG_CE 0x0080 /* Sync: Clock enable */
10272 +#define CC_CFG_SB 0x0100 /* Sync: Size/Bytestrobe */
10274 +/* Start/busy bit in flashcontrol */
10275 +#define SFLASH_START 0x80000000
10276 +#define SFLASH_BUSY SFLASH_START
10278 +/* flashcontrol opcodes for ST flashes */
10279 +#define SFLASH_ST_WREN 0x0006 /* Write Enable */
10280 +#define SFLASH_ST_WRDIS 0x0004 /* Write Disable */
10281 +#define SFLASH_ST_RDSR 0x0105 /* Read Status Register */
10282 +#define SFLASH_ST_WRSR 0x0101 /* Write Status Register */
10283 +#define SFLASH_ST_READ 0x0303 /* Read Data Bytes */
10284 +#define SFLASH_ST_PP 0x0302 /* Page Program */
10285 +#define SFLASH_ST_SE 0x02d8 /* Sector Erase */
10286 +#define SFLASH_ST_BE 0x00c7 /* Bulk Erase */
10287 +#define SFLASH_ST_DP 0x00b9 /* Deep Power-down */
10288 +#define SFLASH_ST_RES 0x03ab /* Read Electronic Signature */
10290 +/* Status register bits for ST flashes */
10291 +#define SFLASH_ST_WIP 0x01 /* Write In Progress */
10292 +#define SFLASH_ST_WEL 0x02 /* Write Enable Latch */
10293 +#define SFLASH_ST_BP_MASK 0x1c /* Block Protect */
10294 +#define SFLASH_ST_BP_SHIFT 2
10295 +#define SFLASH_ST_SRWD 0x80 /* Status Register Write Disable */
10297 +/* flashcontrol opcodes for Atmel flashes */
10298 +#define SFLASH_AT_READ 0x07e8
10299 +#define SFLASH_AT_PAGE_READ 0x07d2
10300 +#define SFLASH_AT_BUF1_READ
10301 +#define SFLASH_AT_BUF2_READ
10302 +#define SFLASH_AT_STATUS 0x01d7
10303 +#define SFLASH_AT_BUF1_WRITE 0x0384
10304 +#define SFLASH_AT_BUF2_WRITE 0x0387
10305 +#define SFLASH_AT_BUF1_ERASE_PROGRAM 0x0283
10306 +#define SFLASH_AT_BUF2_ERASE_PROGRAM 0x0286
10307 +#define SFLASH_AT_BUF1_PROGRAM 0x0288
10308 +#define SFLASH_AT_BUF2_PROGRAM 0x0289
10309 +#define SFLASH_AT_PAGE_ERASE 0x0281
10310 +#define SFLASH_AT_BLOCK_ERASE 0x0250
10311 +#define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
10312 +#define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
10313 +#define SFLASH_AT_BUF1_LOAD 0x0253
10314 +#define SFLASH_AT_BUF2_LOAD 0x0255
10315 +#define SFLASH_AT_BUF1_COMPARE 0x0260
10316 +#define SFLASH_AT_BUF2_COMPARE 0x0261
10317 +#define SFLASH_AT_BUF1_REPROGRAM 0x0258
10318 +#define SFLASH_AT_BUF2_REPROGRAM 0x0259
10320 +/* Status register bits for Atmel flashes */
10321 +#define SFLASH_AT_READY 0x80
10322 +#define SFLASH_AT_MISMATCH 0x40
10323 +#define SFLASH_AT_ID_MASK 0x38
10324 +#define SFLASH_AT_ID_SHIFT 3
10326 +#endif /* _SBCHIPC_H */
10327 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbconfig.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbconfig.h
10328 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbconfig.h 1970-01-01 01:00:00.000000000 +0100
10329 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbconfig.h 2005-09-16 10:29:18.207586928 +0200
10332 + * Broadcom SiliconBackplane hardware register definitions.
10334 + * Copyright 2001-2003, Broadcom Corporation
10335 + * All Rights Reserved.
10337 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10338 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10339 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10340 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10344 +#ifndef _SBCONFIG_H
10345 +#define _SBCONFIG_H
10347 +/* cpp contortions to concatenate w/arg prescan */
10349 +#define _PADLINE(line) pad ## line
10350 +#define _XSTR(line) _PADLINE(line)
10351 +#define PAD _XSTR(__LINE__)
10355 + * SiliconBackplane Address Map.
10356 + * All regions may not exist on all chips.
10358 +#define SB_SDRAM_BASE 0x00000000 /* Physical SDRAM */
10359 +#define SB_PCI_MEM 0x08000000 /* Host Mode PCI memory access space (64 MB) */
10360 +#define SB_PCI_CFG 0x0c000000 /* Host Mode PCI configuration space (64 MB) */
10361 +#define SB_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */
10362 +#define SB_ENUM_BASE 0x18000000 /* Enumeration space base */
10363 +#define SB_ENUM_LIM 0x18010000 /* Enumeration space limit */
10364 +#define SB_EXTIF_BASE 0x1f000000 /* External Interface region base address */
10365 +#define SB_PCI_DMA 0x40000000 /* Client Mode PCI memory access space (1 GB) */
10366 +#define SB_EUART (SB_EXTIF_BASE + 0x00800000)
10367 +#define SB_LED (SB_EXTIF_BASE + 0x00900000)
10369 +/* enumeration space related defs */
10370 +#define SB_CORE_SIZE 0x1000 /* each core gets 4Kbytes for registers */
10371 +#define SB_MAXCORES ((SB_ENUM_LIM - SB_ENUM_BASE)/SB_CORE_SIZE)
10372 +#define SBCONFIGOFF 0xf00 /* core sbconfig regs are top 256bytes of regs */
10373 +#define SBCONFIGSIZE 256 /* sizeof (sbconfig_t) */
10375 +/* mips address */
10376 +#define SB_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */
10379 + * Sonics Configuration Space Registers.
10381 +#ifdef _LANGUAGE_ASSEMBLY
10383 +#define SBIPSFLAG 0x08
10384 +#define SBTPSFLAG 0x18
10385 +#define SBTMERRLOGA 0x48 /* sonics >= 2.3 */
10386 +#define SBTMERRLOG 0x50 /* sonics >= 2.3 */
10387 +#define SBADMATCH3 0x60
10388 +#define SBADMATCH2 0x68
10389 +#define SBADMATCH1 0x70
10390 +#define SBIMSTATE 0x90
10391 +#define SBINTVEC 0x94
10392 +#define SBTMSTATELOW 0x98
10393 +#define SBTMSTATEHIGH 0x9c
10394 +#define SBBWA0 0xa0
10395 +#define SBIMCONFIGLOW 0xa8
10396 +#define SBIMCONFIGHIGH 0xac
10397 +#define SBADMATCH0 0xb0
10398 +#define SBTMCONFIGLOW 0xb8
10399 +#define SBTMCONFIGHIGH 0xbc
10400 +#define SBBCONFIG 0xc0
10401 +#define SBBSTATE 0xc8
10402 +#define SBACTCNFG 0xd8
10403 +#define SBFLAGST 0xe8
10404 +#define SBIDLOW 0xf8
10405 +#define SBIDHIGH 0xfc
10410 +typedef volatile struct _sbconfig {
10412 + uint32 sbipsflag; /* initiator port ocp slave flag */
10414 + uint32 sbtpsflag; /* target port ocp slave flag */
10416 + uint32 sbtmerrloga; /* (sonics >= 2.3) */
10418 + uint32 sbtmerrlog; /* (sonics >= 2.3) */
10420 + uint32 sbadmatch3; /* address match3 */
10422 + uint32 sbadmatch2; /* address match2 */
10424 + uint32 sbadmatch1; /* address match1 */
10426 + uint32 sbimstate; /* initiator agent state */
10427 + uint32 sbintvec; /* interrupt mask */
10428 + uint32 sbtmstatelow; /* target state */
10429 + uint32 sbtmstatehigh; /* target state */
10430 + uint32 sbbwa0; /* bandwidth allocation table0 */
10432 + uint32 sbimconfiglow; /* initiator configuration */
10433 + uint32 sbimconfighigh; /* initiator configuration */
10434 + uint32 sbadmatch0; /* address match0 */
10436 + uint32 sbtmconfiglow; /* target configuration */
10437 + uint32 sbtmconfighigh; /* target configuration */
10438 + uint32 sbbconfig; /* broadcast configuration */
10440 + uint32 sbbstate; /* broadcast state */
10442 + uint32 sbactcnfg; /* activate configuration */
10444 + uint32 sbflagst; /* current sbflags */
10446 + uint32 sbidlow; /* identification */
10447 + uint32 sbidhigh; /* identification */
10450 +#endif /* _LANGUAGE_ASSEMBLY */
10453 +#define SBIPS_INT1_MASK 0x3f /* which sbflags get routed to mips interrupt 1 */
10454 +#define SBIPS_INT1_SHIFT 0
10455 +#define SBIPS_INT2_MASK 0x3f00 /* which sbflags get routed to mips interrupt 2 */
10456 +#define SBIPS_INT2_SHIFT 8
10457 +#define SBIPS_INT3_MASK 0x3f0000 /* which sbflags get routed to mips interrupt 3 */
10458 +#define SBIPS_INT3_SHIFT 16
10459 +#define SBIPS_INT4_MASK 0x3f000000 /* which sbflags get routed to mips interrupt 4 */
10460 +#define SBIPS_INT4_SHIFT 24
10463 +#define SBTPS_NUM0_MASK 0x3f /* interrupt sbFlag # generated by this core */
10464 +#define SBTPS_F0EN0 0x40 /* interrupt is always sent on the backplane */
10467 +#define SBTMEL_CM 0x00000007 /* command */
10468 +#define SBTMEL_CI 0x0000ff00 /* connection id */
10469 +#define SBTMEL_EC 0x0f000000 /* error code */
10470 +#define SBTMEL_ME 0x80000000 /* multiple error */
10473 +#define SBIM_PC 0xf /* pipecount */
10474 +#define SBIM_AP_MASK 0x30 /* arbitration policy */
10475 +#define SBIM_AP_BOTH 0x00 /* use both timeslaces and token */
10476 +#define SBIM_AP_TS 0x10 /* use timesliaces only */
10477 +#define SBIM_AP_TK 0x20 /* use token only */
10478 +#define SBIM_AP_RSV 0x30 /* reserved */
10479 +#define SBIM_IBE 0x20000 /* inbanderror */
10480 +#define SBIM_TO 0x40000 /* timeout */
10481 +#define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */
10482 +#define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */
10484 +/* sbtmstatelow */
10485 +#define SBTML_RESET 0x1 /* reset */
10486 +#define SBTML_REJ 0x2 /* reject */
10487 +#define SBTML_CLK 0x10000 /* clock enable */
10488 +#define SBTML_FGC 0x20000 /* force gated clocks on */
10489 +#define SBTML_FL_MASK 0x3ffc0000 /* core-specific flags */
10490 +#define SBTML_PE 0x40000000 /* pme enable */
10491 +#define SBTML_BE 0x80000000 /* bist enable */
10493 +/* sbtmstatehigh */
10494 +#define SBTMH_SERR 0x1 /* serror */
10495 +#define SBTMH_INT 0x2 /* interrupt */
10496 +#define SBTMH_BUSY 0x4 /* busy */
10497 +#define SBTMH_TO 0x00000020 /* timeout (sonics >= 2.3) */
10498 +#define SBTMH_FL_MASK 0x1fff0000 /* core-specific flags */
10499 +#define SBTMH_GCR 0x20000000 /* gated clock request */
10500 +#define SBTMH_BISTF 0x40000000 /* bist failed */
10501 +#define SBTMH_BISTD 0x80000000 /* bist done */
10504 +#define SBBWA_TAB0_MASK 0xffff /* lookup table 0 */
10505 +#define SBBWA_TAB1_MASK 0xffff /* lookup table 1 */
10506 +#define SBBWA_TAB1_SHIFT 16
10508 +/* sbimconfiglow */
10509 +#define SBIMCL_STO_MASK 0x7 /* service timeout */
10510 +#define SBIMCL_RTO_MASK 0x70 /* request timeout */
10511 +#define SBIMCL_RTO_SHIFT 4
10512 +#define SBIMCL_CID_MASK 0xff0000 /* connection id */
10513 +#define SBIMCL_CID_SHIFT 16
10515 +/* sbimconfighigh */
10516 +#define SBIMCH_IEM_MASK 0xc /* inband error mode */
10517 +#define SBIMCH_TEM_MASK 0x30 /* timeout error mode */
10518 +#define SBIMCH_TEM_SHIFT 4
10519 +#define SBIMCH_BEM_MASK 0xc0 /* bus error mode */
10520 +#define SBIMCH_BEM_SHIFT 6
10523 +#define SBAM_TYPE_MASK 0x3 /* address type */
10524 +#define SBAM_AD64 0x4 /* reserved */
10525 +#define SBAM_ADINT0_MASK 0xf8 /* type0 size */
10526 +#define SBAM_ADINT0_SHIFT 3
10527 +#define SBAM_ADINT1_MASK 0x1f8 /* type1 size */
10528 +#define SBAM_ADINT1_SHIFT 3
10529 +#define SBAM_ADINT2_MASK 0x1f8 /* type2 size */
10530 +#define SBAM_ADINT2_SHIFT 3
10531 +#define SBAM_ADEN 0x400 /* enable */
10532 +#define SBAM_ADNEG 0x800 /* negative decode */
10533 +#define SBAM_BASE0_MASK 0xffffff00 /* type0 base address */
10534 +#define SBAM_BASE0_SHIFT 8
10535 +#define SBAM_BASE1_MASK 0xfffff000 /* type1 base address for the core */
10536 +#define SBAM_BASE1_SHIFT 12
10537 +#define SBAM_BASE2_MASK 0xffff0000 /* type2 base address for the core */
10538 +#define SBAM_BASE2_SHIFT 16
10540 +/* sbtmconfiglow */
10541 +#define SBTMCL_CD_MASK 0xff /* clock divide */
10542 +#define SBTMCL_CO_MASK 0xf800 /* clock offset */
10543 +#define SBTMCL_CO_SHIFT 11
10544 +#define SBTMCL_IF_MASK 0xfc0000 /* interrupt flags */
10545 +#define SBTMCL_IF_SHIFT 18
10546 +#define SBTMCL_IM_MASK 0x3000000 /* interrupt mode */
10547 +#define SBTMCL_IM_SHIFT 24
10549 +/* sbtmconfighigh */
10550 +#define SBTMCH_BM_MASK 0x3 /* busy mode */
10551 +#define SBTMCH_RM_MASK 0x3 /* retry mode */
10552 +#define SBTMCH_RM_SHIFT 2
10553 +#define SBTMCH_SM_MASK 0x30 /* stop mode */
10554 +#define SBTMCH_SM_SHIFT 4
10555 +#define SBTMCH_EM_MASK 0x300 /* sb error mode */
10556 +#define SBTMCH_EM_SHIFT 8
10557 +#define SBTMCH_IM_MASK 0xc00 /* int mode */
10558 +#define SBTMCH_IM_SHIFT 10
10561 +#define SBBC_LAT_MASK 0x3 /* sb latency */
10562 +#define SBBC_MAX0_MASK 0xf0000 /* maxccntr0 */
10563 +#define SBBC_MAX0_SHIFT 16
10564 +#define SBBC_MAX1_MASK 0xf00000 /* maxccntr1 */
10565 +#define SBBC_MAX1_SHIFT 20
10568 +#define SBBS_SRD 0x1 /* st reg disable */
10569 +#define SBBS_HRD 0x2 /* hold reg disable */
10572 +#define SBIDL_CS_MASK 0x3 /* config space */
10573 +#define SBIDL_AR_MASK 0x38 /* # address ranges supported */
10574 +#define SBIDL_AR_SHIFT 3
10575 +#define SBIDL_SYNCH 0x40 /* sync */
10576 +#define SBIDL_INIT 0x80 /* initiator */
10577 +#define SBIDL_MINLAT_MASK 0xf00 /* minimum backplane latency */
10578 +#define SBIDL_MINLAT_SHIFT 8
10579 +#define SBIDL_MAXLAT 0xf000 /* maximum backplane latency */
10580 +#define SBIDL_MAXLAT_SHIFT 12
10581 +#define SBIDL_FIRST 0x10000 /* this initiator is first */
10582 +#define SBIDL_CW_MASK 0xc0000 /* cycle counter width */
10583 +#define SBIDL_CW_SHIFT 18
10584 +#define SBIDL_TP_MASK 0xf00000 /* target ports */
10585 +#define SBIDL_TP_SHIFT 20
10586 +#define SBIDL_IP_MASK 0xf000000 /* initiator ports */
10587 +#define SBIDL_IP_SHIFT 24
10588 +#define SBIDL_RV_MASK 0xf0000000 /* sonics backplane revision code */
10589 +#define SBIDL_RV_SHIFT 28
10592 +#define SBIDH_RC_MASK 0xf /* revision code*/
10593 +#define SBIDH_CC_MASK 0xfff0 /* core code */
10594 +#define SBIDH_CC_SHIFT 4
10595 +#define SBIDH_VC_MASK 0xffff0000 /* vendor code */
10596 +#define SBIDH_VC_SHIFT 16
10598 +#define SB_COMMIT 0xfd8 /* update buffered registers value */
10600 +/* vendor codes */
10601 +#define SB_VEND_BCM 0x4243 /* Broadcom's SB vendor code */
10604 +#define SB_CC 0x800 /* chipcommon core */
10605 +#define SB_ILINE20 0x801 /* iline20 core */
10606 +#define SB_SDRAM 0x803 /* sdram core */
10607 +#define SB_PCI 0x804 /* pci core */
10608 +#define SB_MIPS 0x805 /* mips core */
10609 +#define SB_ENET 0x806 /* enet mac core */
10610 +#define SB_CODEC 0x807 /* v90 codec core */
10611 +#define SB_USB 0x808 /* usb 1.1 host/device core */
10612 +#define SB_ILINE100 0x80a /* iline100 core */
10613 +#define SB_IPSEC 0x80b /* ipsec core */
10614 +#define SB_PCMCIA 0x80d /* pcmcia core */
10615 +#define SB_MEMC 0x80f /* memc sdram core */
10616 +#define SB_EXTIF 0x811 /* external interface core */
10617 +#define SB_D11 0x812 /* 802.11 MAC core */
10618 +#define SB_MIPS33 0x816 /* mips3302 core */
10619 +#define SB_USB11H 0x817 /* usb 1.1 host core */
10620 +#define SB_USB11D 0x818 /* usb 1.1 device core */
10621 +#define SB_USB20H 0x819 /* usb 2.0 host core */
10622 +#define SB_USB20D 0x81A /* usb 2.0 device core */
10623 +#define SB_SDIOH 0x81B /* sdio host core */
10624 +#define SB_ROBO 0x81C /* robo switch core */
10626 +#endif /* _SBCONFIG_H */
10627 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbextif.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbextif.h
10628 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbextif.h 1970-01-01 01:00:00.000000000 +0100
10629 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbextif.h 2005-09-16 10:29:18.208586776 +0200
10632 + * Hardware-specific External Interface I/O core definitions
10633 + * for the BCM47xx family of SiliconBackplane-based chips.
10635 + * The External Interface core supports a total of three external chip selects
10636 + * supporting external interfaces. One of the external chip selects is
10637 + * used for Flash, one is used for PCMCIA, and the other may be
10638 + * programmed to support either a synchronous interface or an
10639 + * asynchronous interface. The asynchronous interface can be used to
10640 + * support external devices such as UARTs and the BCM2019 Bluetooth
10641 + * baseband processor.
10642 + * The external interface core also contains 2 on-chip 16550 UARTs, clock
10643 + * frequency control, a watchdog interrupt timer, and a GPIO interface.
10645 + * Copyright 2001-2003, Broadcom Corporation
10646 + * All Rights Reserved.
10648 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10649 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10650 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10651 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10655 +#ifndef _SBEXTIF_H
10656 +#define _SBEXTIF_H
10658 +/* external interface address space */
10659 +#define EXTIF_PCMCIA_MEMBASE(x) (x)
10660 +#define EXTIF_PCMCIA_IOBASE(x) ((x) + 0x100000)
10661 +#define EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000)
10662 +#define EXTIF_CFGIF_BASE(x) ((x) + 0x800000)
10663 +#define EXTIF_FLASH_BASE(x) ((x) + 0xc00000)
10665 +/* cpp contortions to concatenate w/arg prescan */
10667 +#define _PADLINE(line) pad ## line
10668 +#define _XSTR(line) _PADLINE(line)
10669 +#define PAD _XSTR(__LINE__)
10673 + * The multiple instances of output and output enable registers
10674 + * are present to allow driver software for multiple cores to control
10675 + * gpio outputs without needing to share a single register pair.
10681 +#define NGPIOUSER 5
10683 +typedef volatile struct {
10684 + uint32 corecontrol;
10685 + uint32 extstatus;
10688 + /* pcmcia control registers */
10689 + uint32 pcmcia_config;
10690 + uint32 pcmcia_memwait;
10691 + uint32 pcmcia_attrwait;
10692 + uint32 pcmcia_iowait;
10694 + /* programmable interface control registers */
10695 + uint32 prog_config;
10696 + uint32 prog_waitcount;
10698 + /* flash control registers */
10699 + uint32 flash_config;
10700 + uint32 flash_waitcount;
10705 + /* clock control */
10706 + uint32 clockcontrol_n;
10707 + uint32 clockcontrol_sb;
10708 + uint32 clockcontrol_pci;
10709 + uint32 clockcontrol_mii;
10714 + struct gpiouser gpio[NGPIOUSER];
10716 + uint32 ejtagouten;
10717 + uint32 gpiointpolarity;
10718 + uint32 gpiointmask;
10735 + uint8 uartscratch;
10740 +#define CC_UE (1 << 0) /* uart enable */
10743 +#define ES_EM (1 << 0) /* endian mode (ro) */
10744 +#define ES_EI (1 << 1) /* external interrupt pin (ro) */
10745 +#define ES_GI (1 << 2) /* gpio interrupt pin (ro) */
10747 +/* gpio bit mask */
10748 +#define GPIO_BIT0 (1 << 0)
10749 +#define GPIO_BIT1 (1 << 1)
10750 +#define GPIO_BIT2 (1 << 2)
10751 +#define GPIO_BIT3 (1 << 3)
10752 +#define GPIO_BIT4 (1 << 4)
10753 +#define GPIO_BIT5 (1 << 5)
10754 +#define GPIO_BIT6 (1 << 6)
10755 +#define GPIO_BIT7 (1 << 7)
10758 +/* pcmcia/prog/flash_config */
10759 +#define CF_EN (1 << 0) /* enable */
10760 +#define CF_EM_MASK 0xe /* mode */
10761 +#define CF_EM_SHIFT 1
10762 +#define CF_EM_FLASH 0x0 /* flash/asynchronous mode */
10763 +#define CF_EM_SYNC 0x2 /* synchronous mode */
10764 +#define CF_EM_PCMCIA 0x4 /* pcmcia mode */
10765 +#define CF_DS (1 << 4) /* destsize: 0=8bit, 1=16bit */
10766 +#define CF_BS (1 << 5) /* byteswap */
10767 +#define CF_CD_MASK 0xc0 /* clock divider */
10768 +#define CF_CD_SHIFT 6
10769 +#define CF_CD_DIV2 0x0 /* backplane/2 */
10770 +#define CF_CD_DIV3 0x40 /* backplane/3 */
10771 +#define CF_CD_DIV4 0x80 /* backplane/4 */
10772 +#define CF_CE (1 << 8) /* clock enable */
10773 +#define CF_SB (1 << 9) /* size/bytestrobe (synch only) */
10775 +/* pcmcia_memwait */
10776 +#define PM_W0_MASK 0x3f /* waitcount0 */
10777 +#define PM_W1_MASK 0x1f00 /* waitcount1 */
10778 +#define PM_W1_SHIFT 8
10779 +#define PM_W2_MASK 0x1f0000 /* waitcount2 */
10780 +#define PM_W2_SHIFT 16
10781 +#define PM_W3_MASK 0x1f000000 /* waitcount3 */
10782 +#define PM_W3_SHIFT 24
10784 +/* pcmcia_attrwait */
10785 +#define PA_W0_MASK 0x3f /* waitcount0 */
10786 +#define PA_W1_MASK 0x1f00 /* waitcount1 */
10787 +#define PA_W1_SHIFT 8
10788 +#define PA_W2_MASK 0x1f0000 /* waitcount2 */
10789 +#define PA_W2_SHIFT 16
10790 +#define PA_W3_MASK 0x1f000000 /* waitcount3 */
10791 +#define PA_W3_SHIFT 24
10793 +/* pcmcia_iowait */
10794 +#define PI_W0_MASK 0x3f /* waitcount0 */
10795 +#define PI_W1_MASK 0x1f00 /* waitcount1 */
10796 +#define PI_W1_SHIFT 8
10797 +#define PI_W2_MASK 0x1f0000 /* waitcount2 */
10798 +#define PI_W2_SHIFT 16
10799 +#define PI_W3_MASK 0x1f000000 /* waitcount3 */
10800 +#define PI_W3_SHIFT 24
10802 +/* prog_waitcount */
10803 +#define PW_W0_MASK 0x0000001f /* waitcount0 */
10804 +#define PW_W1_MASK 0x00001f00 /* waitcount1 */
10805 +#define PW_W1_SHIFT 8
10806 +#define PW_W2_MASK 0x001f0000 /* waitcount2 */
10807 +#define PW_W2_SHIFT 16
10808 +#define PW_W3_MASK 0x1f000000 /* waitcount3 */
10809 +#define PW_W3_SHIFT 24
10811 +#define PW_W0 0x0000000c
10812 +#define PW_W1 0x00000a00
10813 +#define PW_W2 0x00020000
10814 +#define PW_W3 0x01000000
10816 +/* flash_waitcount */
10817 +#define FW_W0_MASK 0x1f /* waitcount0 */
10818 +#define FW_W1_MASK 0x1f00 /* waitcount1 */
10819 +#define FW_W1_SHIFT 8
10820 +#define FW_W2_MASK 0x1f0000 /* waitcount2 */
10821 +#define FW_W2_SHIFT 16
10822 +#define FW_W3_MASK 0x1f000000 /* waitcount3 */
10823 +#define FW_W3_SHIFT 24
10826 +#define WATCHDOG_CLOCK 48000000 /* Hz */
10828 +/* clockcontrol_n */
10829 +#define CN_N1_MASK 0x3f /* n1 control */
10830 +#define CN_N2_MASK 0x3f00 /* n2 control */
10831 +#define CN_N2_SHIFT 8
10833 +/* clockcontrol_sb/pci/mii */
10834 +#define CC_M1_MASK 0x3f /* m1 control */
10835 +#define CC_M2_MASK 0x3f00 /* m2 control */
10836 +#define CC_M2_SHIFT 8
10837 +#define CC_M3_MASK 0x3f0000 /* m3 control */
10838 +#define CC_M3_SHIFT 16
10839 +#define CC_MC_MASK 0x1f000000 /* mux control */
10840 +#define CC_MC_SHIFT 24
10842 +/* Clock control default values */
10843 +#define CC_DEF_N 0x0009 /* Default values for bcm4710 */
10844 +#define CC_DEF_100 0x04020011
10845 +#define CC_DEF_33 0x11030011
10846 +#define CC_DEF_25 0x11050011
10848 +/* Clock control values for 125Mhz */
10849 +#define CC_125_N 0x0802
10850 +#define CC_125_M 0x04020009
10851 +#define CC_125_M25 0x11090009
10852 +#define CC_125_M33 0x11090005
10854 +/* Clock control magic field values */
10855 +#define CC_F6_2 0x02 /* A factor of 2 in */
10856 +#define CC_F6_3 0x03 /* 6-bit fields like */
10857 +#define CC_F6_4 0x05 /* N1, M1 or M3 */
10858 +#define CC_F6_5 0x09
10859 +#define CC_F6_6 0x11
10860 +#define CC_F6_7 0x21
10862 +#define CC_F5_BIAS 5 /* 5-bit fields get this added */
10864 +#define CC_MC_BYPASS 0x08
10865 +#define CC_MC_M1 0x04
10866 +#define CC_MC_M1M2 0x02
10867 +#define CC_MC_M1M2M3 0x01
10868 +#define CC_MC_M1M3 0x11
10870 +#define CC_CLOCK_BASE 24000000 /* Half the clock freq. in the 4710 */
10872 +#endif /* _SBEXTIF_H */
10873 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbmemc.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmemc.h
10874 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbmemc.h 1970-01-01 01:00:00.000000000 +0100
10875 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmemc.h 2005-09-16 10:29:18.209586624 +0200
10878 + * BCM47XX Sonics SiliconBackplane DDR/SDRAM controller core hardware definitions.
10880 + * Copyright 2001-2003, Broadcom Corporation
10881 + * All Rights Reserved.
10883 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
10884 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10885 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10886 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
10893 +#ifdef _LANGUAGE_ASSEMBLY
10895 +#define MEMC_CONTROL 0x00
10896 +#define MEMC_CONFIG 0x04
10897 +#define MEMC_REFRESH 0x08
10898 +#define MEMC_BISTSTAT 0x0c
10899 +#define MEMC_MODEBUF 0x10
10900 +#define MEMC_BKCLS 0x14
10901 +#define MEMC_PRIORINV 0x18
10902 +#define MEMC_DRAMTIM 0x1c
10903 +#define MEMC_INTSTAT 0x20
10904 +#define MEMC_INTMASK 0x24
10905 +#define MEMC_INTINFO 0x28
10906 +#define MEMC_NCDLCTL 0x30
10907 +#define MEMC_RDNCDLCOR 0x34
10908 +#define MEMC_WRNCDLCOR 0x38
10909 +#define MEMC_MISCDLYCTL 0x3c
10910 +#define MEMC_DQSGATENCDL 0x40
10911 +#define MEMC_SPARE 0x44
10912 +#define MEMC_TPADDR 0x48
10913 +#define MEMC_TPDATA 0x4c
10914 +#define MEMC_BARRIER 0x50
10915 +#define MEMC_CORE 0x54
10920 +/* Sonics side: MEMC core registers */
10921 +typedef volatile struct sbmemcregs {
10933 + uint32 reserved1;
10935 + uint32 rdncdlcor;
10936 + uint32 wrncdlcor;
10937 + uint32 miscdlyctl;
10938 + uint32 dqsgatencdl;
10948 +/* MEMC Core Init values (OCP ID 0x80f) */
10951 +#define MEMC_SD_CONFIG_INIT 0x00048000
10952 +#define MEMC_SD_DRAMTIM_INIT 0x000754da
10953 +#define MEMC_SD_RDNCDLCOR_INIT 0x00000000
10954 +#define MEMC_SD_WRNCDLCOR_INIT 0x49351200
10955 +#define MEMC_SD1_WRNCDLCOR_INIT 0x14500200 /* For corerev 1 (4712) */
10956 +#define MEMC_SD_MISCDLYCTL_INIT 0x00061c1b
10957 +#define MEMC_SD1_MISCDLYCTL_INIT 0x00021416 /* For corerev 1 (4712) */
10958 +#define MEMC_SD_CONTROL_INIT0 0x00000002
10959 +#define MEMC_SD_CONTROL_INIT1 0x00000008
10960 +#define MEMC_SD_CONTROL_INIT2 0x00000004
10961 +#define MEMC_SD_CONTROL_INIT3 0x00000010
10962 +#define MEMC_SD_CONTROL_INIT4 0x00000001
10963 +#define MEMC_SD_MODEBUF_INIT 0x00000000
10964 +#define MEMC_SD_REFRESH_INIT 0x0000840f
10967 +/* This is for SDRM8X8X4 */
10968 +#define MEMC_SDR_INIT 0x0008
10969 +#define MEMC_SDR_MODE 0x32
10970 +#define MEMC_SDR_NCDL 0x00020032
10971 +#define MEMC_SDR1_NCDL 0x0002020f /* For corerev 1 (4712) */
10974 +#define MEMC_CONFIG_INIT 0x00048000
10975 +#define MEMC_DRAMTIM_INIT 0x000754d9
10976 +#define MEMC_RDNCDLCOR_INIT 0x00000000
10977 +#define MEMC_WRNCDLCOR_INIT 0x49351200
10978 +#define MEMC_1_WRNCDLCOR_INIT 0x14500200
10979 +#define MEMC_DQSGATENCDL_INIT 0x00030000
10980 +#define MEMC_MISCDLYCTL_INIT 0x21061c1b
10981 +#define MEMC_1_MISCDLYCTL_INIT 0x21021400
10982 +#define MEMC_NCDLCTL_INIT 0x00002001
10983 +#define MEMC_CONTROL_INIT0 0x00000002
10984 +#define MEMC_CONTROL_INIT1 0x00000008
10985 +#define MEMC_MODEBUF_INIT0 0x00004000
10986 +#define MEMC_CONTROL_INIT2 0x00000010
10987 +#define MEMC_MODEBUF_INIT1 0x00000100
10988 +#define MEMC_CONTROL_INIT3 0x00000010
10989 +#define MEMC_CONTROL_INIT4 0x00000008
10990 +#define MEMC_REFRESH_INIT 0x0000840f
10991 +#define MEMC_CONTROL_INIT5 0x00000004
10992 +#define MEMC_MODEBUF_INIT2 0x00000000
10993 +#define MEMC_CONTROL_INIT6 0x00000010
10994 +#define MEMC_CONTROL_INIT7 0x00000001
10997 +/* This is for DDRM16X16X2 */
10998 +#define MEMC_DDR_INIT 0x0009
10999 +#define MEMC_DDR_MODE 0x62
11000 +#define MEMC_DDR_NCDL 0x0005050a
11001 +#define MEMC_DDR1_NCDL 0x00000a0a /* For corerev 1 (4712) */
11003 +/* mask for sdr/ddr calibration registers */
11004 +#define MEMC_RDNCDLCOR_RD_MASK 0x000000ff
11005 +#define MEMC_WRNCDLCOR_WR_MASK 0x000000ff
11006 +#define MEMC_DQSGATENCDL_G_MASK 0x000000ff
11008 +/* masks for miscdlyctl registers */
11009 +#define MEMC_MISC_SM_MASK 0x30000000
11010 +#define MEMC_MISC_SM_SHIFT 28
11011 +#define MEMC_MISC_SD_MASK 0x0f000000
11012 +#define MEMC_MISC_SD_SHIFT 24
11014 +/* hw threshhold for calculating wr/rd for sdr memc */
11015 +#define MEMC_CD_THRESHOLD 128
11017 +/* Low bit of init register says if memc is ddr or sdr */
11018 +#define MEMC_CONFIG_DDR 0x00000001
11020 +#endif /* _SBMEMC_H */
11021 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbmips.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmips.h
11022 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbmips.h 1970-01-01 01:00:00.000000000 +0100
11023 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbmips.h 2005-09-16 10:29:18.209586624 +0200
11026 + * Broadcom SiliconBackplane MIPS definitions
11028 + * SB MIPS cores are custom MIPS32 processors with SiliconBackplane
11029 + * OCP interfaces. The CP0 processor ID is 0x00024000, where bits
11030 + * 23:16 mean Broadcom and bits 15:8 mean a MIPS core with an OCP
11031 + * interface. The core revision is stored in the SB ID register in SB
11032 + * configuration space.
11034 + * Copyright 2001-2003, Broadcom Corporation
11035 + * All Rights Reserved.
11037 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11038 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11039 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11040 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11048 +#ifndef _LANGUAGE_ASSEMBLY
11050 +/* cpp contortions to concatenate w/arg prescan */
11052 +#define _PADLINE(line) pad ## line
11053 +#define _XSTR(line) _PADLINE(line)
11054 +#define PAD _XSTR(__LINE__)
11057 +typedef volatile struct {
11058 + uint32 corecontrol;
11060 + uint32 biststatus;
11062 + uint32 intstatus;
11067 +extern uint32 sb_flag(void *sbh);
11068 +extern uint sb_irq(void *sbh);
11070 +extern void sb_serial_init(void *sbh, void (*add)(void *regs, uint irq, uint baud_base, uint reg_shift));
11072 +extern void sb_mips_init(void *sbh);
11073 +extern uint32 sb_mips_clock(void *sbh);
11074 +extern bool sb_mips_setclock(void *sbh, uint32 mipsclock, uint32 sbclock, uint32 pciclock);
11076 +extern uint32 sb_memc_get_ncdl(void *sbh);
11078 +#endif /* _LANGUAGE_ASSEMBLY */
11080 +#endif /* _SBMIPS_H */
11081 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbpci.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpci.h
11082 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbpci.h 1970-01-01 01:00:00.000000000 +0100
11083 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpci.h 2005-09-16 10:29:18.209586624 +0200
11086 + * BCM47XX Sonics SiliconBackplane PCI core hardware definitions.
11089 + * Copyright 2001-2003, Broadcom Corporation
11090 + * All Rights Reserved.
11092 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11093 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11094 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11095 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11101 +/* cpp contortions to concatenate w/arg prescan */
11103 +#define _PADLINE(line) pad ## line
11104 +#define _XSTR(line) _PADLINE(line)
11105 +#define PAD _XSTR(__LINE__)
11108 +/* Sonics side: PCI core and host control registers */
11109 +typedef struct sbpciregs {
11110 + uint32 control; /* PCI control */
11112 + uint32 arbcontrol; /* PCI arbiter control */
11114 + uint32 intstatus; /* Interrupt status */
11115 + uint32 intmask; /* Interrupt mask */
11116 + uint32 sbtopcimailbox; /* Sonics to PCI mailbox */
11118 + uint32 bcastaddr; /* Sonics broadcast address */
11119 + uint32 bcastdata; /* Sonics broadcast data */
11121 + uint32 gpioin; /* ro: gpio input (>=rev2) */
11122 + uint32 gpioout; /* rw: gpio output (>=rev2) */
11123 + uint32 gpioouten; /* rw: gpio output enable (>= rev2) */
11124 + uint32 gpiocontrol; /* rw: gpio control (>= rev2) */
11126 + uint32 sbtopci0; /* Sonics to PCI translation 0 */
11127 + uint32 sbtopci1; /* Sonics to PCI translation 1 */
11128 + uint32 sbtopci2; /* Sonics to PCI translation 2 */
11130 + uint16 sprom[36]; /* SPROM shadow Area */
11135 +#define PCI_RST_OE 0x01 /* When set, drives PCI_RESET out to pin */
11136 +#define PCI_RST 0x02 /* Value driven out to pin */
11137 +#define PCI_CLK_OE 0x04 /* When set, drives clock as gated by PCI_CLK out to pin */
11138 +#define PCI_CLK 0x08 /* Gate for clock driven out to pin */
11140 +/* PCI arbiter control */
11141 +#define PCI_INT_ARB 0x01 /* When set, use an internal arbiter */
11142 +#define PCI_EXT_ARB 0x02 /* When set, use an external arbiter */
11143 +#define PCI_PARKID_MASK 0x06 /* Selects which agent is parked on an idle bus */
11144 +#define PCI_PARKID_SHIFT 1
11145 +#define PCI_PARKID_LAST 0 /* Last requestor */
11146 +#define PCI_PARKID_4710 1 /* 4710 */
11147 +#define PCI_PARKID_EXTREQ0 2 /* External requestor 0 */
11148 +#define PCI_PARKID_EXTREQ1 3 /* External requestor 1 */
11150 +/* Interrupt status/mask */
11151 +#define PCI_INTA 0x01 /* PCI INTA# is asserted */
11152 +#define PCI_INTB 0x02 /* PCI INTB# is asserted */
11153 +#define PCI_SERR 0x04 /* PCI SERR# has been asserted (write one to clear) */
11154 +#define PCI_PERR 0x08 /* PCI PERR# has been asserted (write one to clear) */
11155 +#define PCI_PME 0x10 /* PCI PME# is asserted */
11157 +/* (General) PCI/SB mailbox interrupts, two bits per pci function */
11158 +#define MAILBOX_F0_0 0x100 /* function 0, int 0 */
11159 +#define MAILBOX_F0_1 0x200 /* function 0, int 1 */
11160 +#define MAILBOX_F1_0 0x400 /* function 1, int 0 */
11161 +#define MAILBOX_F1_1 0x800 /* function 1, int 1 */
11162 +#define MAILBOX_F2_0 0x1000 /* function 2, int 0 */
11163 +#define MAILBOX_F2_1 0x2000 /* function 2, int 1 */
11164 +#define MAILBOX_F3_0 0x4000 /* function 3, int 0 */
11165 +#define MAILBOX_F3_1 0x8000 /* function 3, int 1 */
11167 +/* Sonics broadcast address */
11168 +#define BCAST_ADDR_MASK 0xff /* Broadcast register address */
11170 +/* Sonics to PCI translation types */
11171 +#define SBTOPCI0_MASK 0xfc000000
11172 +#define SBTOPCI1_MASK 0xfc000000
11173 +#define SBTOPCI2_MASK 0xc0000000
11174 +#define SBTOPCI_MEM 0
11175 +#define SBTOPCI_IO 1
11176 +#define SBTOPCI_CFG0 2
11177 +#define SBTOPCI_CFG1 3
11178 +#define SBTOPCI_PREF 0x4 /* prefetch enable */
11179 +#define SBTOPCI_BURST 0x8 /* burst enable */
11181 +/* PCI side: Reserved PCI configuration registers (see pcicfg.h) */
11182 +#define cap_list rsvd_a[0]
11183 +#define bar0_window dev_dep[0x80 - 0x40]
11184 +#define bar1_window dev_dep[0x84 - 0x40]
11185 +#define sprom_control dev_dep[0x88 - 0x40]
11187 +#ifndef _LANGUAGE_ASSEMBLY
11189 +extern int sbpci_read_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len);
11190 +extern int sbpci_write_config(void *sbh, uint bus, uint dev, uint func, uint off, void *buf, int len);
11191 +extern void sbpci_ban(uint16 core);
11192 +extern int sbpci_init(void *sbh);
11193 +extern void sbpci_check(void *sbh);
11195 +#endif /* !_LANGUAGE_ASSEMBLY */
11197 +#endif /* _SBPCI_H */
11198 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbpcmcia.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpcmcia.h
11199 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbpcmcia.h 1970-01-01 01:00:00.000000000 +0100
11200 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbpcmcia.h 2005-09-16 10:29:18.210586472 +0200
11203 + * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions.
11206 + * Copyright 2001-2003, Broadcom Corporation
11207 + * All Rights Reserved.
11209 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11210 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11211 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11212 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11215 +#ifndef _SBPCMCIA_H
11216 +#define _SBPCMCIA_H
11219 +/* All the addresses that are offsets in attribute space are divided
11220 + * by two to account for the fact that odd bytes are invalid in
11221 + * attribute space and our read/write routines make the space appear
11222 + * as if they didn't exist. Still we want to show the original numbers
11223 + * as documented in the hnd_pcmcia core manual.
11226 +/* PCMCIA Function Configuration Registers */
11227 +#define PCMCIA_FCR (0x700 / 2)
11229 +#define FCR0_OFF 0
11230 +#define FCR1_OFF (0x40 / 2)
11231 +#define FCR2_OFF (0x80 / 2)
11232 +#define FCR3_OFF (0xc0 / 2)
11234 +#define PCMCIA_FCR0 (0x700 / 2)
11235 +#define PCMCIA_FCR1 (0x740 / 2)
11236 +#define PCMCIA_FCR2 (0x780 / 2)
11237 +#define PCMCIA_FCR3 (0x7c0 / 2)
11239 +/* Standard PCMCIA FCR registers */
11241 +#define PCMCIA_COR 0
11243 +#define COR_RST 0x80
11244 +#define COR_LEV 0x40
11245 +#define COR_IRQEN 0x04
11246 +#define COR_BLREN 0x01
11247 +#define COR_FUNEN 0x01
11250 +#define PCICIA_FCSR (2 / 2)
11251 +#define PCICIA_PRR (4 / 2)
11252 +#define PCICIA_SCR (6 / 2)
11253 +#define PCICIA_ESR (8 / 2)
11256 +#define PCM_MEMOFF 0x0000
11257 +#define F0_MEMOFF 0x1000
11258 +#define F1_MEMOFF 0x2000
11259 +#define F2_MEMOFF 0x3000
11260 +#define F3_MEMOFF 0x4000
11262 +/* Memory base in the function fcr's */
11263 +#define MEM_ADDR0 (0x728 / 2)
11264 +#define MEM_ADDR1 (0x72a / 2)
11265 +#define MEM_ADDR2 (0x72c / 2)
11267 +/* PCMCIA base plus Srom access in fcr0: */
11268 +#define PCMCIA_ADDR0 (0x072e / 2)
11269 +#define PCMCIA_ADDR1 (0x0730 / 2)
11270 +#define PCMCIA_ADDR2 (0x0732 / 2)
11272 +#define MEM_SEG (0x0734 / 2)
11273 +#define SROM_CS (0x0736 / 2)
11274 +#define SROM_DATAL (0x0738 / 2)
11275 +#define SROM_DATAH (0x073a / 2)
11276 +#define SROM_ADDRL (0x073c / 2)
11277 +#define SROM_ADDRH (0x073e / 2)
11279 +/* Values for srom_cs: */
11280 +#define SROM_IDLE 0
11281 +#define SROM_WRITE 1
11282 +#define SROM_READ 2
11283 +#define SROM_WEN 4
11284 +#define SROM_WDS 7
11285 +#define SROM_DONE 8
11289 +/* The CIS stops where the FCRs start */
11290 +#define CIS_SIZE PCMCIA_FCR
11292 +/* Standard tuples we know about */
11294 +#define CISTPL_MANFID 0x20 /* Manufacturer and device id */
11295 +#define CISTPL_FUNCE 0x22 /* Function extensions */
11296 +#define CISTPL_CFTABLE 0x1b /* Config table entry */
11298 +/* Function extensions for LANs */
11300 +#define LAN_TECH 1 /* Technology type */
11301 +#define LAN_SPEED 2 /* Raw bit rate */
11302 +#define LAN_MEDIA 3 /* Transmission media */
11303 +#define LAN_NID 4 /* Node identification (aka MAC addr) */
11304 +#define LAN_CONN 5 /* Connector standard */
11308 +#define CFTABLE_REGWIN_2K 0x08 /* 2k reg windows size */
11309 +#define CFTABLE_REGWIN_4K 0x10 /* 4k reg windows size */
11310 +#define CFTABLE_REGWIN_8K 0x20 /* 8k reg windows size */
11312 +/* Vendor unique tuples are 0x80-0x8f. Within Broadcom we'll
11313 + * take one for HNBU, and use "extensions" (a la FUNCE) within it.
11316 +#define CISTPL_BRCM_HNBU 0x80
11318 +/* Subtypes of BRCM_HNBU: */
11320 +#define HNBU_CHIPID 0x01 /* Six bytes with PCI vendor &
11321 + * device id and chiprev
11323 +#define HNBU_BOARDREV 0x02 /* Two bytes board revision */
11324 +#define HNBU_PAPARMS 0x03 /* Eleven bytes PA parameters */
11325 +#define HNBU_OEM 0x04 /* Eight bytes OEM data */
11326 +#define HNBU_CC 0x05 /* Default country code */
11327 +#define HNBU_AA 0x06 /* Antennas available */
11328 +#define HNBU_AG 0x07 /* Antenna gain */
11329 +#define HNBU_BOARDFLAGS 0x08 /* board flags */
11330 +#define HNBU_LED 0x09 /* LED set */
11332 +#endif /* _SBPCMCIA_H */
11333 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbsdram.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbsdram.h
11334 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbsdram.h 1970-01-01 01:00:00.000000000 +0100
11335 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbsdram.h 2005-09-16 10:29:18.210586472 +0200
11338 + * BCM47XX Sonics SiliconBackplane SDRAM controller core hardware definitions.
11340 + * Copyright 2001-2003, Broadcom Corporation
11341 + * All Rights Reserved.
11343 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11344 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11345 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11346 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11350 +#ifndef _SBSDRAM_H
11351 +#define _SBSDRAM_H
11353 +#ifndef _LANGUAGE_ASSEMBLY
11355 +/* Sonics side: SDRAM core registers */
11356 +typedef volatile struct sbsdramregs {
11357 + uint32 initcontrol; /* Generates external SDRAM initialization sequence */
11358 + uint32 config; /* Initializes external SDRAM mode register */
11359 + uint32 refresh; /* Controls external SDRAM refresh rate */
11366 +/* SDRAM initialization control (initcontrol) register bits */
11367 +#define SDRAM_CBR 0x0001 /* Writing 1 generates refresh cycle and toggles bit */
11368 +#define SDRAM_PRE 0x0002 /* Writing 1 generates precharge cycle and toggles bit */
11369 +#define SDRAM_MRS 0x0004 /* Writing 1 generates mode register select cycle and toggles bit */
11370 +#define SDRAM_EN 0x0008 /* When set, enables access to SDRAM */
11371 +#define SDRAM_16Mb 0x0000 /* Use 16 Megabit SDRAM */
11372 +#define SDRAM_64Mb 0x0010 /* Use 64 Megabit SDRAM */
11373 +#define SDRAM_128Mb 0x0020 /* Use 128 Megabit SDRAM */
11374 +#define SDRAM_RSVMb 0x0030 /* Use special SDRAM */
11375 +#define SDRAM_RST 0x0080 /* Writing 1 causes soft reset of controller */
11376 +#define SDRAM_SELFREF 0x0100 /* Writing 1 enables self refresh mode */
11377 +#define SDRAM_PWRDOWN 0x0200 /* Writing 1 causes controller to power down */
11378 +#define SDRAM_32BIT 0x0400 /* When set, indicates 32 bit SDRAM interface */
11379 +#define SDRAM_9BITCOL 0x0800 /* When set, indicates 9 bit column */
11381 +/* SDRAM configuration (config) register bits */
11382 +#define SDRAM_BURSTFULL 0x0000 /* Use full page bursts */
11383 +#define SDRAM_BURST8 0x0001 /* Use burst of 8 */
11384 +#define SDRAM_BURST4 0x0002 /* Use burst of 4 */
11385 +#define SDRAM_BURST2 0x0003 /* Use burst of 2 */
11386 +#define SDRAM_CAS3 0x0000 /* Use CAS latency of 3 */
11387 +#define SDRAM_CAS2 0x0004 /* Use CAS latency of 2 */
11389 +/* SDRAM refresh control (refresh) register bits */
11390 +#define SDRAM_REF(p) (((p)&0xff) | SDRAM_REF_EN) /* Refresh period */
11391 +#define SDRAM_REF_EN 0x8000 /* Writing 1 enables periodic refresh */
11393 +/* SDRAM Core default Init values (OCP ID 0x803) */
11394 +#define SDRAM_INIT MEM4MX16X2
11395 +#define SDRAM_CONFIG SDRAM_BURSTFULL
11396 +#define SDRAM_REFRESH SDRAM_REF(0x40)
11398 +#define MEM1MX16 0x009 /* 2 MB */
11399 +#define MEM1MX16X2 0x409 /* 4 MB */
11400 +#define MEM2MX8X2 0x809 /* 4 MB */
11401 +#define MEM2MX8X4 0xc09 /* 8 MB */
11402 +#define MEM2MX32 0x439 /* 8 MB */
11403 +#define MEM4MX16 0x019 /* 8 MB */
11404 +#define MEM4MX16X2 0x419 /* 16 MB */
11405 +#define MEM8MX8X2 0x819 /* 16 MB */
11406 +#define MEM8MX16 0x829 /* 16 MB */
11407 +#define MEM4MX32 0x429 /* 16 MB */
11408 +#define MEM8MX8X4 0xc19 /* 32 MB */
11409 +#define MEM8MX16X2 0xc29 /* 32 MB */
11411 +#endif /* _SBSDRAM_H */
11412 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/sbutils.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbutils.h
11413 --- linux-2.6.12.5/arch/mips/bcm947xx/include/sbutils.h 1970-01-01 01:00:00.000000000 +0100
11414 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/sbutils.h 2005-09-16 10:29:18.211586320 +0200
11417 + * Misc utility routines for accessing chip-specific features
11418 + * of Broadcom HNBU SiliconBackplane-based chips.
11420 + * Copyright 2001-2003, Broadcom Corporation
11421 + * All Rights Reserved.
11423 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11424 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11425 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11426 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11431 +#ifndef _sbutils_h_
11432 +#define _sbutils_h_
11434 +/* Board styles (bustype) */
11435 +#define BOARDSTYLE_SOC 0 /* Silicon Backplane */
11436 +#define BOARDSTYLE_PCI 1 /* PCI/MiniPCI board */
11437 +#define BOARDSTYLE_PCMCIA 2 /* PCMCIA board */
11438 +#define BOARDSTYLE_CARDBUS 3 /* Cardbus board */
11441 + * Many of the routines below take an 'sbh' handle as their first arg.
11442 + * Allocate this by calling sb_attach(). Free it by calling sb_detach().
11443 + * At any one time, the sbh is logically focused on one particular sb core
11444 + * (the "current core").
11445 + * Use sb_setcore() or sb_setcoreidx() to change the association to another core.
11448 +/* exported externs */
11449 +extern void *sb_attach(uint pcidev, void *osh, void *regs, uint bustype, void *sdh, char **vars, int *varsz);
11450 +extern void *sb_kattach(void);
11451 +extern void sb_detach(void *sbh);
11452 +extern uint sb_chip(void *sbh);
11453 +extern uint sb_chiprev(void *sbh);
11454 +extern uint sb_chippkg(void *sbh);
11455 +extern uint sb_boardvendor(void *sbh);
11456 +extern uint sb_boardtype(void *sbh);
11457 +extern uint sb_boardstyle(void *sbh);
11458 +extern uint sb_bus(void *sbh);
11459 +extern uint sb_corelist(void *sbh, uint coreid[]);
11460 +extern uint sb_coreid(void *sbh);
11461 +extern uint sb_coreidx(void *sbh);
11462 +extern uint sb_coreunit(void *sbh);
11463 +extern uint sb_corevendor(void *sbh);
11464 +extern uint sb_corerev(void *sbh);
11465 +extern void *sb_coreregs(void *sbh);
11466 +extern uint32 sb_coreflags(void *sbh, uint32 mask, uint32 val);
11467 +extern uint32 sb_coreflagshi(void *sbh, uint32 mask, uint32 val);
11468 +extern bool sb_iscoreup(void *sbh);
11469 +extern void *sb_setcoreidx(void *sbh, uint coreidx);
11470 +extern void *sb_setcore(void *sbh, uint coreid, uint coreunit);
11471 +extern void sb_commit(void *sbh);
11472 +extern uint32 sb_base(uint32 admatch);
11473 +extern uint32 sb_size(uint32 admatch);
11474 +extern void sb_core_reset(void *sbh, uint32 bits);
11475 +extern void sb_core_tofixup(void *sbh);
11476 +extern void sb_core_disable(void *sbh, uint32 bits);
11477 +extern uint32 sb_clock_rate(uint32 pll_type, uint32 n, uint32 m);
11478 +extern uint32 sb_clock(void *sbh);
11479 +extern void sb_pci_setup(void *sbh, uint32 *dmaoffset, uint coremask);
11480 +extern void sb_pcmcia_init(void *sbh);
11481 +extern void sb_watchdog(void *sbh, uint ticks);
11482 +extern void *sb_gpiosetcore(void *sbh);
11483 +extern uint32 sb_gpiocontrol(void *sbh, uint32 mask, uint32 val);
11484 +extern uint32 sb_gpioouten(void *sbh, uint32 mask, uint32 val);
11485 +extern uint32 sb_gpioout(void *sbh, uint32 mask, uint32 val);
11486 +extern uint32 sb_gpioin(void *sbh);
11487 +extern uint32 sb_gpiointpolarity(void *sbh, uint32 mask, uint32 val);
11488 +extern uint32 sb_gpiointmask(void *sbh, uint32 mask, uint32 val);
11489 +extern bool sb_taclear(void *sbh);
11490 +extern void sb_pwrctl_init(void *sbh);
11491 +extern uint16 sb_pwrctl_fast_pwrup_delay(void *sbh);
11492 +extern bool sb_pwrctl_clk(void *sbh, uint mode);
11493 +extern int sb_pwrctl_xtal(void *sbh, uint what, bool on);
11494 +extern void sb_register_intr_callback(void *sbh, void *intrsoff_fn, void *intrsrestore_fn, void *intr_arg);
11496 +/* pwrctl xtal what flags */
11497 +#define XTAL 0x1 /* primary crystal oscillator (2050) */
11498 +#define PLL 0x2 /* main chip pll */
11500 +/* pwrctl clk mode */
11501 +#define CLK_FAST 0 /* force fast (pll) clock */
11502 +#define CLK_SLOW 1 /* force slow clock */
11503 +#define CLK_DYNAMIC 2 /* enable dynamic power control */
11505 +#endif /* _sbutils_h_ */
11506 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/trxhdr.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/trxhdr.h
11507 --- linux-2.6.12.5/arch/mips/bcm947xx/include/trxhdr.h 1970-01-01 01:00:00.000000000 +0100
11508 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/trxhdr.h 2005-09-16 10:29:18.211586320 +0200
11511 + * TRX image file header format.
11513 + * Copyright 2001-2003, Broadcom Corporation
11514 + * All Rights Reserved.
11516 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11517 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11518 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11519 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11524 +#include <typedefs.h>
11526 +#define TRX_MAGIC 0x30524448 /* "HDR0" */
11527 +#define TRX_VERSION 1
11528 +#define TRX_MAX_LEN 0x3A0000
11529 +#define TRX_NO_HEADER 1 /* Do not write TRX header */
11531 +struct trx_header {
11532 + uint32 magic; /* "HDR0" */
11533 + uint32 len; /* Length of file including header */
11534 + uint32 crc32; /* 32-bit CRC from flag_version to end of file */
11535 + uint32 flag_version; /* 0:15 flags, 16:31 version */
11536 + uint32 offsets[3]; /* Offsets of partitions from start of header */
11539 +/* Compatibility */
11540 +typedef struct trx_header TRXHDR, *PTRXHDR;
11541 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/typedefs.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/typedefs.h
11542 --- linux-2.6.12.5/arch/mips/bcm947xx/include/typedefs.h 1970-01-01 01:00:00.000000000 +0100
11543 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/typedefs.h 2005-09-16 10:29:18.212586168 +0200
11546 + * Copyright 2001-2003, Broadcom Corporation
11547 + * All Rights Reserved.
11549 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11550 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11551 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11552 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11556 +#ifndef _TYPEDEFS_H_
11557 +#define _TYPEDEFS_H_
11559 +/*----------------------- define TRUE, FALSE, NULL, bool ----------------*/
11560 +#ifdef __cplusplus
11563 +#define FALSE false
11569 +#else /* !__cplusplus */
11571 +#if defined(_WIN32)
11573 +typedef unsigned char bool;
11577 +#if defined(MACOSX) && defined(KERNEL)
11578 +#include <IOKit/IOTypes.h>
11597 +#endif /* __cplusplus */
11607 +/*----------------------- define uchar, ushort, uint, ulong ----------------*/
11609 +typedef unsigned char uchar;
11611 +#if defined(_WIN32) || defined(PMON) || defined(__MRC__) || defined(V2_HAL) || defined(_CFE_)
11614 +typedef unsigned short ushort;
11617 +typedef unsigned int uint;
11618 +typedef unsigned long ulong;
11622 +/* pick up ushort & uint from standard types.h */
11623 +#if defined(linux) && defined(__KERNEL__)
11624 +#include <linux/types.h> /* sys/types.h and linux/types.h are oil and water */
11626 +#include <sys/types.h>
11627 +#if !defined(TARGETENV_sun4) && !defined(linux)
11628 +typedef unsigned long ulong;
11629 +#endif /* TARGETENV_sun4 */
11632 +typedef unsigned int uint;
11633 +typedef unsigned long long uint64;
11636 +#endif /* WIN32 || PMON || .. */
11638 +/*----------------------- define [u]int8/16/32/64 --------------------------*/
11642 +#include <bcmos.h>
11644 +typedef signed char int8;
11645 +typedef signed short int16;
11646 +typedef signed int int32;
11648 +typedef unsigned char uint8;
11649 +typedef unsigned short uint16;
11650 +typedef unsigned int uint32;
11651 +#endif /* V2_HAL */
11653 +typedef float float32;
11654 +typedef double float64;
11657 + * abstracted floating point type allows for compile time selection of
11658 + * single or double precision arithmetic. Compiling with -DFLOAT32
11659 + * selects single precision; the default is double precision.
11662 +#if defined(FLOAT32)
11663 +typedef float32 float_t;
11664 +#else /* default to double precision floating point */
11665 +typedef float64 float_t;
11666 +#endif /* FLOAT32 */
11668 +#ifdef _MSC_VER /* Microsoft C */
11669 +typedef signed __int64 int64;
11670 +typedef unsigned __int64 uint64;
11672 +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
11673 +/* gcc understands signed/unsigned 64 bit types, but complains in ANSI mode */
11674 +typedef signed long long int64;
11675 +typedef unsigned long long uint64;
11677 +#elif defined(__ICL) && !defined(__STDC__)
11678 +/* ICL accepts unsigned 64 bit type only, and complains in ANSI mode */
11679 +typedef unsigned long long uint64;
11681 +#endif /* _MSC_VER */
11684 +/*----------------------- define PTRSZ, INLINE --------------------------*/
11686 +#define PTRSZ sizeof (char*)
11692 +#define INLINE __inline
11696 +#define INLINE __inline__
11702 +#endif /* _MSC_VER */
11704 +#endif /* INLINE */
11706 +#endif /* _TYPEDEFS_H_ */
11707 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/include/wlioctl.h linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/wlioctl.h
11708 --- linux-2.6.12.5/arch/mips/bcm947xx/include/wlioctl.h 1970-01-01 01:00:00.000000000 +0100
11709 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/include/wlioctl.h 2005-09-16 10:29:18.213586016 +0200
11712 + * Custom OID/ioctl definitions for
11713 + * Broadcom 802.11abg Networking Device Driver
11715 + * Definitions subject to change without notice.
11717 + * Copyright 2001-2003, Broadcom Corporation
11718 + * All Rights Reserved.
11720 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11721 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
11722 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11723 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11728 +#ifndef _wlioctl_h_
11729 +#define _wlioctl_h_
11731 +#include <typedefs.h>
11732 +#include <proto/ethernet.h>
11733 +#include <proto/802.11.h>
11735 +#if defined(__GNUC__)
11736 +#define PACKED __attribute__((packed))
11742 + * Per-bss information structure.
11745 +#define WL_NUMRATES 255 /* max # of rates in a rateset */
11747 +typedef struct wl_rateset {
11748 + uint32 count; /* # rates in this set */
11749 + uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
11752 +#define WL_LEGACY_BSS_INFO_VERSION 106 /* an older supported version of wl_bss_info struct */
11753 +#define WL_BSS_INFO_VERSION 107 /* current version of wl_bss_info struct */
11755 +typedef struct wl_bss_info106 {
11756 + uint version; /* version field */
11757 + struct ether_addr BSSID;
11760 + uint8 Privacy; /* 0=No WEP, 1=Use WEP */
11761 + int16 RSSI; /* receive signal strength (in dBm) */
11762 + uint16 beacon_period; /* units are Kusec */
11763 + uint16 atim_window; /* units are Kusec */
11764 + uint8 channel; /* Channel no. */
11765 + int8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */
11767 + uint count; /* # rates in this set */
11768 + uint8 rates[12]; /* rates in 500kbps units w/hi bit set if basic */
11769 + } rateset; /* supported rates */
11770 + uint8 dtim_period; /* DTIM period */
11771 + int8 phy_noise; /* noise right after tx (in dBm) */
11772 + uint16 capability; /* Capability information */
11773 + struct dot11_bcn_prb *prb; /* probe response frame (ioctl na) */
11774 + uint16 prb_len; /* probe response frame length (ioctl na) */
11776 + uint8 supported; /* wpa supported */
11777 + uint8 multicast; /* multicast cipher */
11778 + uint8 ucount; /* count of unicast ciphers */
11779 + uint8 unicast[4]; /* unicast ciphers */
11780 + uint8 acount; /* count of auth modes */
11781 + uint8 auth[4]; /* Authentication modes */
11783 +} wl_bss_info106_t;
11785 +typedef struct wl_bss_info {
11786 + uint32 version; /* version field */
11787 + uint32 length; /* byte length of data in this record, starting at version and including IEs */
11788 + struct ether_addr BSSID;
11789 + uint16 beacon_period; /* units are Kusec */
11790 + uint16 capability; /* Capability information */
11794 + uint count; /* # rates in this set */
11795 + uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
11796 + } rateset; /* supported rates */
11797 + uint8 channel; /* Channel no. */
11798 + uint16 atim_window; /* units are Kusec */
11799 + uint8 dtim_period; /* DTIM period */
11800 + int16 RSSI; /* receive signal strength (in dBm) */
11801 + int8 phy_noise; /* noise (in dBm) */
11802 + uint32 ie_length; /* byte length of Information Elements */
11803 + /* variable length Information Elements */
11806 +typedef struct wl_scan_results {
11810 + wl_bss_info_t bss_info[1];
11811 +} wl_scan_results_t;
11812 +/* size of wl_scan_results not including variable length array */
11813 +#define WL_SCAN_RESULTS_FIXED_SIZE 12
11816 +typedef struct wl_uint32_list {
11817 + /* in - # of elements, out - # of entries */
11819 + /* variable length uint32 list */
11820 + uint32 element[1];
11821 +} wl_uint32_list_t;
11823 +typedef struct wlc_ssid {
11828 +#define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NULL */
11830 +typedef struct wl_channels_in_country {
11833 + char country_abbrev[WLC_CNTRY_BUF_SZ];
11835 + uint32 channel[1];
11836 +} wl_channels_in_country_t;
11838 +typedef struct wl_country_list {
11843 + char country_abbrev[1];
11844 +} wl_country_list_t;
11848 +* Maximum # of keys that wl driver supports in S/W. Keys supported
11849 +* in H/W is less than or equal to WSEC_MAX_KEYS.
11851 +#define WSEC_MAX_KEYS 54 /* Max # of keys (50 + 4 default keys) */
11852 +#define WSEC_MAX_DEFAULT_KEYS 4 /* # of default keys */
11855 +* Remove these two defines if access to crypto/tkhash.h
11856 +* is unconditionally permitted.
11858 +#define TKHASH_P1_KEY_SIZE 10 /* size of TKHash Phase1 output, in bytes */
11859 +#define TKHASH_P2_KEY_SIZE 16 /* size of TKHash Phase2 output */
11861 +/* Enumerate crypto algorithms */
11862 +#define CRYPTO_ALGO_OFF 0
11863 +#define CRYPTO_ALGO_WEP1 1
11864 +#define CRYPTO_ALGO_TKIP 2
11865 +#define CRYPTO_ALGO_WEP128 3
11866 +#define CRYPTO_ALGO_AES_CCM 4
11867 +#define CRYPTO_ALGO_AES_OCB_MSDU 5
11868 +#define CRYPTO_ALGO_AES_OCB_MPDU 6
11869 +#define CRYPTO_ALGO_NALG 7
11871 +/* For use with wlc_wep_key.flags */
11872 +#define WSEC_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */
11873 +#define WSEC_TKIP_ERROR (1 << 2) /* Provoke deliberate MIC error */
11874 +#define WSEC_REPLAY_ERROR (1 << 3) /* Provoke deliberate replay */
11876 +#define WSEC_GEN_MIC_ERROR 0x0001
11877 +#define WSEC_GEN_REPLAY 0x0002
11879 +typedef struct tkip_info {
11880 + uint16 phase1[TKHASH_P1_KEY_SIZE/sizeof(uint16)]; /* tkhash phase1 result */
11881 + uint8 phase2[TKHASH_P2_KEY_SIZE]; /* tkhash phase2 result */
11886 +typedef struct wsec_iv {
11887 + uint32 hi; /* upper 32 bits of IV */
11888 + uint16 lo; /* lower 16 bits of IV */
11891 +typedef struct wsec_key {
11892 + uint32 index; /* key index */
11893 + uint32 len; /* key length */
11894 + uint8 data[DOT11_MAX_KEY_SIZE]; /* key data */
11895 + tkip_info_t tkip_tx; /* tkip transmit state */
11896 + tkip_info_t tkip_rx; /* tkip receive state */
11897 + uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
11898 + uint32 flags; /* misc flags */
11899 + uint32 algo_hw; /* cache for hw register*/
11900 + uint32 aes_mode; /* cache for hw register*/
11901 + int iv_len; /* IV length */
11902 + int iv_initialized; /* has IV been initialized already? */
11903 + int icv_len; /* ICV length */
11904 + wsec_iv_t rxiv; /* Rx IV */
11905 + wsec_iv_t txiv; /* Tx IV */
11906 + struct ether_addr ea; /* per station */
11909 +/* wireless security bitvec */
11910 +#define WEP_ENABLED 1
11911 +#define TKIP_ENABLED 2
11912 +#define AES_ENABLED 4
11913 +#define WSEC_SWFLAG 8
11915 +#define WSEC_SW(wsec) ((wsec) & WSEC_SWFLAG)
11916 +#define WSEC_HW(wsec) (!WSEC_SW(wsec))
11917 +#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED)
11918 +#define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED)
11919 +#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED)
11920 +#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
11922 +/* wireless authentication bit vector */
11923 +#define WPA_ENABLED 1
11924 +#define PSK_ENABLED 2
11926 +#define WAUTH_WPA_ENABLED(wauth) ((wauth) & WPA_ENABLED)
11927 +#define WAUTH_PSK_ENABLED(wauth) ((wauth) & PSK_ENABLED)
11928 +#define WAUTH_ENABLED(wauth) ((wauth) & (WPA_ENABLED | PSK_ENABLED))
11930 +/* group/mcast cipher */
11931 +#define WPA_MCAST_CIPHER(wsec) (((wsec) & TKIP_ENABLED) ? WPA_CIPHER_TKIP : \
11932 + ((wsec) & AES_ENABLED) ? WPA_CIPHER_AES_CCM : \
11935 +typedef struct wl_led_info {
11936 + uint32 index; /* led index */
11942 + * definitions for driver messages passed from WL to NAS.
11944 +/* Use this to recognize wpa and 802.1x driver messages. */
11945 +static const uint8 wl_wpa_snap_template[] =
11946 + { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c };
11948 +#define WL_WPA_MSG_IFNAME_MAX 16
11950 +/* WPA driver message */
11951 +typedef struct wl_wpa_header {
11952 + struct ether_header eth;
11953 + struct dot11_llc_snap_header snap;
11956 + /* version 2 additions */
11957 + char ifname[WL_WPA_MSG_IFNAME_MAX];
11958 + /* version specific data */
11959 + /* uint8 data[1]; */
11960 +} wl_wpa_header_t PACKED;
11962 +#define WL_WPA_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
11964 +/* WPA driver message ethertype - private between wlc and nas */
11965 +#define WL_WPA_ETHER_TYPE 0x9999
11967 +/* WPA driver message current version */
11968 +#define WL_WPA_MSG_VERSION 2
11970 +/* Type field values for the 802.2 driver messages for WPA. */
11971 +#define WLC_ASSOC_MSG 1
11972 +#define WLC_DISASSOC_MSG 2
11973 +#define WLC_PTK_MIC_MSG 3
11974 +#define WLC_GTK_MIC_MSG 4
11976 +/* 802.1x driver message */
11977 +typedef struct wl_eapol_header {
11978 + struct ether_header eth;
11979 + struct dot11_llc_snap_header snap;
11982 + char ifname[WL_WPA_MSG_IFNAME_MAX];
11983 + /* version specific data */
11984 + /* uint8 802_1x_msg[1]; */
11985 +} wl_eapol_header_t PACKED;
11987 +#define WL_EAPOL_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
11989 +/* 802.1x driver message ethertype - private between wlc and nas */
11990 +#define WL_EAPOL_ETHER_TYPE 0x999A
11992 +/* 802.1x driver message current version */
11993 +#define WL_EAPOL_MSG_VERSION 1
11995 +/* srom read/write struct passed through ioctl */
11997 + uint byteoff; /* byte offset */
11998 + uint nbytes; /* number of bytes */
12002 +/* R_REG and W_REG struct passed through ioctl */
12004 + uint32 byteoff; /* byte offset of the field in d11regs_t */
12005 + uint32 val; /* read/write value of the field */
12006 + uint32 size; /* sizeof the field */
12009 +/* Structure used by GET/SET_ATTEN ioctls */
12011 + uint16 auto_ctrl; /* 1: Automatic control, 0: overriden */
12012 + uint16 bb; /* Baseband attenuation */
12013 + uint16 radio; /* Radio attenuation */
12014 + uint16 txctl1; /* Radio TX_CTL1 value */
12017 +/* Used to get specific STA parameters */
12020 + struct ether_addr ea;
12023 +/* callback registration data types */
12025 +typedef struct _mac_event_params {
12027 + struct ether_addr *addr;
12031 +} mac_event_params_t;
12033 +typedef struct _mic_error_params {
12034 + struct ether_addr *ea;
12037 +} mic_error_params_t;
12039 +typedef enum _wl_callback {
12040 + WL_MAC_EVENT_CALLBACK = 0,
12041 + WL_LINK_UP_CALLBACK,
12042 + WL_LINK_DOWN_CALLBACK,
12043 + WL_MIC_ERROR_CALLBACK,
12047 +typedef struct _callback {
12048 + void (*fn)(void *, void *);
12052 +typedef struct _scan_callback {
12053 + void (*fn)(void *);
12055 +} scan_callback_t;
12057 +/* used to register an arbitrary callback via the IOCTL interface */
12058 +typedef struct _set_callback {
12060 + callback_t callback;
12064 + * Country locale determines which channels are available to us.
12066 +typedef enum _wlc_locale {
12067 + WLC_WW = 0, /* Worldwide */
12068 + WLC_THA, /* Thailand */
12069 + WLC_ISR, /* Israel */
12070 + WLC_JDN, /* Jordan */
12071 + WLC_PRC, /* China */
12072 + WLC_JPN, /* Japan */
12073 + WLC_FCC, /* USA */
12074 + WLC_EUR, /* Europe */
12075 + WLC_USL, /* US Low Band only */
12076 + WLC_JPH, /* Japan High Band only */
12077 + WLC_ALL, /* All the channels in this band */
12078 + WLC_11D, /* Represents locale recieved by 11d beacons */
12080 + WLC_UNDEFINED_LOCALE = 0xf
12083 +/* channel encoding */
12084 +typedef struct channel_info {
12086 + int target_channel;
12087 + int scan_channel;
12090 +/* For ioctls that take a list of MAC addresses */
12092 + uint count; /* number of MAC addresses */
12093 + struct ether_addr ea[1]; /* variable length array of MAC addresses */
12096 +/* get pkt count struct passed through ioctl */
12097 +typedef struct get_pktcnt {
12098 + uint rx_good_pkt;
12100 + uint tx_good_pkt;
12104 +/* Linux network driver ioctl encoding */
12105 +typedef struct wl_ioctl {
12106 + int cmd; /* common ioctl definition */
12107 + void *buf; /* pointer to user buffer */
12108 + int len; /* length of user buffer */
12112 + * Structure for passing hardware and software
12113 + * revision info up from the driver.
12115 +typedef struct wlc_rev_info {
12116 + uint vendorid; /* PCI vendor id */
12117 + uint deviceid; /* device id of chip */
12118 + uint radiorev; /* radio revision */
12119 + uint chiprev; /* chip revision */
12120 + uint corerev; /* core revision */
12121 + uint boardid; /* board identifier (usu. PCI sub-device id) */
12122 + uint boardvendor; /* board vendor (usu. PCI sub-vendor id) */
12123 + uint boardrev; /* board revision */
12124 + uint driverrev; /* driver version */
12125 + uint ucoderev; /* microcode version */
12126 + uint bus; /* bus type */
12127 + uint chipnum; /* chip number */
12130 +/* check this magic number */
12131 +#define WLC_IOCTL_MAGIC 0x14e46c77
12133 +/* bump this number if you change the ioctl interface */
12134 +#define WLC_IOCTL_VERSION 1
12136 +/* maximum length buffer required */
12137 +#define WLC_IOCTL_MAXLEN 8192
12139 +/* common ioctl definitions */
12140 +#define WLC_GET_MAGIC 0
12141 +#define WLC_GET_VERSION 1
12143 +#define WLC_DOWN 3
12144 +#define WLC_DUMP 6
12145 +#define WLC_GET_MSGLEVEL 7
12146 +#define WLC_SET_MSGLEVEL 8
12147 +#define WLC_GET_PROMISC 9
12148 +#define WLC_SET_PROMISC 10
12149 +#define WLC_GET_RATE 12
12150 +#define WLC_SET_RATE 13
12151 +#define WLC_GET_INSTANCE 14
12152 +#define WLC_GET_FRAG 15
12153 +#define WLC_SET_FRAG 16
12154 +#define WLC_GET_RTS 17
12155 +#define WLC_SET_RTS 18
12156 +#define WLC_GET_INFRA 19
12157 +#define WLC_SET_INFRA 20
12158 +#define WLC_GET_AUTH 21
12159 +#define WLC_SET_AUTH 22
12160 +#define WLC_GET_BSSID 23
12161 +#define WLC_SET_BSSID 24
12162 +#define WLC_GET_SSID 25
12163 +#define WLC_SET_SSID 26
12164 +#define WLC_RESTART 27
12165 +#define WLC_GET_CHANNEL 29
12166 +#define WLC_SET_CHANNEL 30
12167 +#define WLC_GET_SRL 31
12168 +#define WLC_SET_SRL 32
12169 +#define WLC_GET_LRL 33
12170 +#define WLC_SET_LRL 34
12171 +#define WLC_GET_PLCPHDR 35
12172 +#define WLC_SET_PLCPHDR 36
12173 +#define WLC_GET_RADIO 37
12174 +#define WLC_SET_RADIO 38
12175 +#define WLC_GET_PHYTYPE 39
12176 +#define WLC_GET_WEP 42
12177 +#define WLC_SET_WEP 43
12178 +#define WLC_GET_KEY 44
12179 +#define WLC_SET_KEY 45
12180 +#define WLC_SCAN 50
12181 +#define WLC_SCAN_RESULTS 51
12182 +#define WLC_DISASSOC 52
12183 +#define WLC_REASSOC 53
12184 +#define WLC_GET_ROAM_TRIGGER 54
12185 +#define WLC_SET_ROAM_TRIGGER 55
12186 +#define WLC_GET_TXANT 61
12187 +#define WLC_SET_TXANT 62
12188 +#define WLC_GET_ANTDIV 63
12189 +#define WLC_SET_ANTDIV 64
12190 +#define WLC_GET_TXPWR 65
12191 +#define WLC_SET_TXPWR 66
12192 +#define WLC_GET_CLOSED 67
12193 +#define WLC_SET_CLOSED 68
12194 +#define WLC_GET_MACLIST 69
12195 +#define WLC_SET_MACLIST 70
12196 +#define WLC_GET_RATESET 71
12197 +#define WLC_SET_RATESET 72
12198 +#define WLC_GET_LOCALE 73
12199 +#define WLC_SET_LOCALE 74
12200 +#define WLC_GET_BCNPRD 75
12201 +#define WLC_SET_BCNPRD 76
12202 +#define WLC_GET_DTIMPRD 77
12203 +#define WLC_SET_DTIMPRD 78
12204 +#define WLC_GET_SROM 79
12205 +#define WLC_SET_SROM 80
12206 +#define WLC_GET_WEP_RESTRICT 81
12207 +#define WLC_SET_WEP_RESTRICT 82
12208 +#define WLC_GET_COUNTRY 83
12209 +#define WLC_SET_COUNTRY 84
12210 +#define WLC_GET_REVINFO 98
12211 +#define WLC_GET_MACMODE 105
12212 +#define WLC_SET_MACMODE 106
12213 +#define WLC_GET_GMODE 109
12214 +#define WLC_SET_GMODE 110
12215 +#define WLC_GET_CURR_RATESET 114 /* current rateset */
12216 +#define WLC_GET_SCANSUPPRESS 115
12217 +#define WLC_SET_SCANSUPPRESS 116
12218 +#define WLC_GET_AP 117
12219 +#define WLC_SET_AP 118
12220 +#define WLC_GET_EAP_RESTRICT 119
12221 +#define WLC_SET_EAP_RESTRICT 120
12222 +#define WLC_GET_WDSLIST 123
12223 +#define WLC_SET_WDSLIST 124
12224 +#define WLC_GET_RSSI 127
12225 +#define WLC_GET_WSEC 133
12226 +#define WLC_SET_WSEC 134
12227 +#define WLC_GET_BSS_INFO 136
12228 +#define WLC_GET_LAZYWDS 138
12229 +#define WLC_SET_LAZYWDS 139
12230 +#define WLC_GET_BANDLIST 140
12231 +#define WLC_GET_BAND 141
12232 +#define WLC_SET_BAND 142
12233 +#define WLC_GET_SHORTSLOT 144
12234 +#define WLC_GET_SHORTSLOT_OVERRIDE 145
12235 +#define WLC_SET_SHORTSLOT_OVERRIDE 146
12236 +#define WLC_GET_SHORTSLOT_RESTRICT 147
12237 +#define WLC_SET_SHORTSLOT_RESTRICT 148
12238 +#define WLC_GET_GMODE_PROTECTION 149
12239 +#define WLC_GET_GMODE_PROTECTION_OVERRIDE 150
12240 +#define WLC_SET_GMODE_PROTECTION_OVERRIDE 151
12241 +#define WLC_UPGRADE 152
12242 +#define WLC_GET_ASSOCLIST 159
12243 +#define WLC_GET_CLK 160
12244 +#define WLC_SET_CLK 161
12245 +#define WLC_GET_UP 162
12246 +#define WLC_OUT 163
12247 +#define WLC_GET_WPA_AUTH 164
12248 +#define WLC_SET_WPA_AUTH 165
12249 +#define WLC_GET_GMODE_PROTECTION_CONTROL 178
12250 +#define WLC_SET_GMODE_PROTECTION_CONTROL 179
12251 +#define WLC_GET_PHYLIST 180
12252 +#define WLC_GET_GMODE_PROTECTION_CTS 198
12253 +#define WLC_SET_GMODE_PROTECTION_CTS 199
12254 +#define WLC_GET_PIOMODE 203
12255 +#define WLC_SET_PIOMODE 204
12256 +#define WLC_SET_LED 209
12257 +#define WLC_GET_LED 210
12258 +#define WLC_GET_CHANNEL_SEL 215
12259 +#define WLC_START_CHANNEL_SEL 216
12260 +#define WLC_GET_VALID_CHANNELS 217
12261 +#define WLC_GET_FAKEFRAG 218
12262 +#define WLC_SET_FAKEFRAG 219
12263 +#define WLC_GET_WET 230
12264 +#define WLC_SET_WET 231
12265 +#define WLC_GET_KEY_PRIMARY 235
12266 +#define WLC_SET_KEY_PRIMARY 236
12267 +#define WLC_SCAN_WITH_CALLBACK 240
12268 +#define WLC_SET_CS_SCAN_TIMER 248
12269 +#define WLC_GET_CS_SCAN_TIMER 249
12270 +#define WLC_CURRENT_PWR 256
12271 +#define WLC_GET_CHANNELS_IN_COUNTRY 260
12272 +#define WLC_GET_COUNTRY_LIST 261
12273 +#define WLC_NVRAM_GET 264
12274 +#define WLC_NVRAM_SET 265
12275 +#define WLC_LAST 271 /* bump after adding */
12278 + * Minor kludge alert:
12279 + * Duplicate a few definitions that irelay requires from epiioctl.h here
12280 + * so caller doesn't have to include this file and epiioctl.h .
12281 + * If this grows any more, it would be time to move these irelay-specific
12282 + * definitions out of the epiioctl.h and into a separate driver common file.
12284 +#ifndef EPICTRL_COOKIE
12285 +#define EPICTRL_COOKIE 0xABADCEDE
12288 +/* vx wlc ioctl's offset */
12289 +#define CMN_IOCTL_OFF 0x180
12292 + * custom OID support
12294 + * 0xFF - implementation specific OID
12295 + * 0xE4 - first byte of Broadcom PCI vendor ID
12296 + * 0x14 - second byte of Broadcom PCI vendor ID
12297 + * 0xXX - the custom OID number
12300 +/* begin 0x1f values beyond the start of the ET driver range. */
12301 +#define WL_OID_BASE 0xFFE41420
12303 +/* NDIS overrides */
12304 +#define OID_WL_GETINSTANCE (WL_OID_BASE + WLC_GET_INSTANCE)
12306 +#define WL_DECRYPT_STATUS_SUCCESS 1
12307 +#define WL_DECRYPT_STATUS_FAILURE 2
12308 +#define WL_DECRYPT_STATUS_UNKNOWN 3
12310 +/* allows user-mode app to poll the status of USB image upgrade */
12311 +#define WLC_UPGRADE_SUCCESS 0
12312 +#define WLC_UPGRADE_PENDING 1
12314 +/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
12315 +#define WL_RADIO_SW_DISABLE (1<<0)
12316 +#define WL_RADIO_HW_DISABLE (1<<1)
12318 +/* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */
12319 +#define WL_TXPWR_OVERRIDE (1<<31)
12323 +#define WL_SB_BUS 0 /* Silicon Backplane */
12324 +#define WL_PCI_BUS 1 /* PCI target */
12325 +#define WL_PCMCIA_BUS 2 /* PCMCIA target */
12328 +#define WLC_BAND_AUTO 0 /* auto-select */
12329 +#define WLC_BAND_A 1 /* "a" band (5 Ghz) */
12330 +#define WLC_BAND_B 2 /* "b" band (2.4 Ghz) */
12332 +/* MAC list modes */
12333 +#define WLC_MACMODE_DISABLED 0 /* MAC list disabled */
12334 +#define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */
12335 +#define WLC_MACMODE_ALLOW 2 /* Allow specified (i.e. deny unspecified) */
12340 +#define GMODE_LEGACY_B 0
12341 +#define GMODE_AUTO 1
12342 +#define GMODE_ONLY 2
12343 +#define GMODE_B_DEFERRED 3
12344 +#define GMODE_PERFORMANCE 4
12345 +#define GMODE_LRS 5
12346 +#define GMODE_MAX 6
12348 +/* values for PLCPHdr_override */
12349 +#define WLC_PLCP_AUTO -1
12350 +#define WLC_PLCP_SHORT 0
12351 +#define WLC_PLCP_LONG 1
12353 +/* values for g_protection_override */
12354 +#define WLC_G_PROTECTION_AUTO -1
12355 +#define WLC_G_PROTECTION_OFF 0
12356 +#define WLC_G_PROTECTION_ON 1
12358 +/* values for g_protection_control */
12359 +#define WLC_G_PROTECTION_CTL_OFF 0
12360 +#define WLC_G_PROTECTION_CTL_LOCAL 1
12361 +#define WLC_G_PROTECTION_CTL_OVERLAP 2
12368 +/* max # of leds supported by GPIO (gpio pin# == led index#) */
12369 +#define WL_LED_NUMGPIO 16 /* gpio 0-15 */
12371 +/* led per-pin behaviors */
12372 +#define WL_LED_OFF 0 /* always off */
12373 +#define WL_LED_ON 1 /* always on */
12374 +#define WL_LED_ACTIVITY 2 /* activity */
12375 +#define WL_LED_RADIO 3 /* radio enabled */
12376 +#define WL_LED_ARADIO 4 /* 5 Ghz radio enabled */
12377 +#define WL_LED_BRADIO 5 /* 2.4Ghz radio enabled */
12378 +#define WL_LED_BGMODE 6 /* on if gmode, off if bmode */
12379 +#define WL_LED_WI1 7
12380 +#define WL_LED_WI2 8
12381 +#define WL_LED_WI3 9
12382 +#define WL_LED_ASSOC 10 /* associated state indicator */
12383 +#define WL_LED_INACTIVE 11 /* null behavior (clears default behavior) */
12384 +#define WL_LED_NUMBEHAVIOR 12
12386 +/* led behavior numeric value format */
12387 +#define WL_LED_BEH_MASK 0x7f /* behavior mask */
12388 +#define WL_LED_AL_MASK 0x80 /* activelow (polarity) bit */
12392 +#define WL_RATE_OFDM(r) (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \
12393 + ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \
12394 + ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \
12395 + ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108)
12400 +#endif /* _wlioctl_h_ */
12401 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/int-handler.S linux-2.6.12.5-brcm/arch/mips/bcm947xx/int-handler.S
12402 --- linux-2.6.12.5/arch/mips/bcm947xx/int-handler.S 1970-01-01 01:00:00.000000000 +0100
12403 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/int-handler.S 2005-09-16 10:29:18.213586016 +0200
12406 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
12408 + * This program is free software; you can redistribute it and/or modify it
12409 + * under the terms of the GNU General Public License as published by the
12410 + * Free Software Foundation; either version 2 of the License, or (at your
12411 + * option) any later version.
12413 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12414 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12415 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12416 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
12417 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12418 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
12419 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
12420 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12421 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
12422 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12424 + * You should have received a copy of the GNU General Public License along
12425 + * with this program; if not, write to the Free Software Foundation, Inc.,
12426 + * 675 Mass Ave, Cambridge, MA 02139, USA.
12429 +#include <asm/asm.h>
12430 +#include <asm/mipsregs.h>
12431 +#include <asm/regdef.h>
12432 +#include <asm/stackframe.h>
12439 + NESTED(bcm47xx_irq_handler, PT_SIZE, sp)
12446 + jal bcm47xx_irq_dispatch
12452 + END(bcm47xx_irq_handler)
12453 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/irq.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/irq.c
12454 --- linux-2.6.12.5/arch/mips/bcm947xx/irq.c 1970-01-01 01:00:00.000000000 +0100
12455 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/irq.c 2005-09-16 10:29:18.214585864 +0200
12458 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
12460 + * This program is free software; you can redistribute it and/or modify it
12461 + * under the terms of the GNU General Public License as published by the
12462 + * Free Software Foundation; either version 2 of the License, or (at your
12463 + * option) any later version.
12465 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12466 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12467 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12468 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
12469 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12470 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
12471 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
12472 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12473 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
12474 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12476 + * You should have received a copy of the GNU General Public License along
12477 + * with this program; if not, write to the Free Software Foundation, Inc.,
12478 + * 675 Mass Ave, Cambridge, MA 02139, USA.
12481 +#include <linux/config.h>
12482 +#include <linux/errno.h>
12483 +#include <linux/init.h>
12484 +#include <linux/interrupt.h>
12485 +#include <linux/irq.h>
12486 +#include <linux/module.h>
12487 +#include <linux/smp.h>
12488 +#include <linux/types.h>
12490 +#include <asm/cpu.h>
12491 +#include <asm/io.h>
12492 +#include <asm/irq.h>
12493 +#include <asm/irq_cpu.h>
12494 +#include <asm/gdb-stub.h>
12496 +extern asmlinkage void bcm47xx_irq_handler(void);
12498 +void bcm47xx_irq_dispatch(struct pt_regs *regs)
12502 + cause = read_c0_cause() & read_c0_status() & CAUSEF_IP;
12504 + clear_c0_status(cause);
12506 + if (cause & CAUSEF_IP7)
12508 + if (cause & CAUSEF_IP2)
12510 + if (cause & CAUSEF_IP3)
12512 + if (cause & CAUSEF_IP4)
12514 + if (cause & CAUSEF_IP5)
12516 + if (cause & CAUSEF_IP6)
12520 +void __init arch_init_irq(void)
12522 + set_except_vector(0, bcm47xx_irq_handler);
12523 + mips_cpu_irq_init(0);
12525 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/prom.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/prom.c
12526 --- linux-2.6.12.5/arch/mips/bcm947xx/prom.c 1970-01-01 01:00:00.000000000 +0100
12527 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/prom.c 2005-09-16 10:29:18.214585864 +0200
12530 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
12532 + * This program is free software; you can redistribute it and/or modify it
12533 + * under the terms of the GNU General Public License as published by the
12534 + * Free Software Foundation; either version 2 of the License, or (at your
12535 + * option) any later version.
12537 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12538 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12539 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12540 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
12541 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12542 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
12543 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
12544 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12545 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
12546 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12548 + * You should have received a copy of the GNU General Public License along
12549 + * with this program; if not, write to the Free Software Foundation, Inc.,
12550 + * 675 Mass Ave, Cambridge, MA 02139, USA.
12553 +#include <linux/init.h>
12554 +#include <linux/mm.h>
12555 +#include <linux/sched.h>
12556 +#include <linux/bootmem.h>
12558 +#include <asm/addrspace.h>
12559 +#include <asm/bootinfo.h>
12560 +#include <asm/pmon.h>
12562 +const char *get_system_type(void)
12564 + return "Broadcom BCM47xx";
12567 +void __init prom_init(void)
12569 + unsigned long mem;
12571 + mips_machgroup = MACH_GROUP_BRCM;
12572 + mips_machtype = MACH_BCM47XX;
12574 + /* Figure out memory size by finding aliases */
12575 + for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
12576 + if (*(unsigned long *)((unsigned long)(prom_init) + mem) ==
12577 + *(unsigned long *)(prom_init))
12581 + add_memory_region(0, mem, BOOT_MEM_RAM);
12584 +unsigned long __init prom_free_prom_memory(void)
12588 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/setup.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/setup.c
12589 --- linux-2.6.12.5/arch/mips/bcm947xx/setup.c 1970-01-01 01:00:00.000000000 +0100
12590 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/setup.c 2005-09-16 10:29:18.215585712 +0200
12593 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
12595 + * This program is free software; you can redistribute it and/or modify it
12596 + * under the terms of the GNU General Public License as published by the
12597 + * Free Software Foundation; either version 2 of the License, or (at your
12598 + * option) any later version.
12600 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12601 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12602 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12603 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
12604 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12605 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
12606 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
12607 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12608 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
12609 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12611 + * You should have received a copy of the GNU General Public License along
12612 + * with this program; if not, write to the Free Software Foundation, Inc.,
12613 + * 675 Mass Ave, Cambridge, MA 02139, USA.
12616 +#include <linux/init.h>
12617 +#include <linux/types.h>
12618 +#include <linux/tty.h>
12619 +#include <linux/serial.h>
12620 +#include <linux/serial_core.h>
12621 +#include <linux/serial_reg.h>
12622 +#include <asm/time.h>
12623 +#include <asm/reboot.h>
12625 +#include <typedefs.h>
12626 +#include <sbutils.h>
12627 +#include <sbmips.h>
12628 +#include <sbpci.h>
12629 +#include <sbconfig.h>
12630 +#include <bcmdevs.h>
12634 +#define SER_PORT1(reg) (*((volatile unsigned char *)(0xb8000400+reg)))
12636 +int putDebugChar(char c)
12638 + while (!(SER_PORT1(UART_LSR) & UART_LSR_THRE));
12639 + SER_PORT1(UART_TX) = c;
12644 +char getDebugChar(void)
12646 + while (!(SER_PORT1(UART_LSR) & 1));
12647 + return SER_PORT1(UART_RX);
12651 +static int ser_line = 0;
12654 +serial_add(void *regs, uint irq, uint baud_base, uint reg_shift)
12656 + struct uart_port s;
12658 + memset(&s, 0, sizeof(s));
12660 + s.line = ser_line++;
12661 + s.membase = regs;
12663 + s.uartclk = baud_base;
12664 + s.flags = ASYNC_BOOT_AUTOCONF;
12665 + s.iotype = SERIAL_IO_MEM;
12666 + s.regshift = reg_shift;
12668 + if (early_serial_setup(&s) != 0) {
12669 + printk(KERN_ERR "Serial setup failed!\n");
12674 +extern void bcm47xx_time_init(void);
12675 +extern void bcm47xx_timer_setup(struct irqaction *irq);
12677 +void *nvram_get(char *foo)
12684 +static void bcm47xx_machine_restart(char *command)
12686 + /* Set the watchdog timer to reset immediately */
12687 + local_irq_disable();
12688 + sb_watchdog(sbh, 1);
12692 +static void bcm47xx_machine_halt(void)
12694 + /* Disable interrupts and watchdog and spin forever */
12695 + local_irq_disable();
12696 + sb_watchdog(sbh, 0);
12700 +static int __init bcm47xx_init(void)
12703 + sbh = sb_kattach();
12704 + sb_mips_init(sbh);
12706 + sb_serial_init(sbh, serial_add);
12708 + _machine_restart = bcm47xx_machine_restart;
12709 + _machine_halt = bcm47xx_machine_halt;
12710 + _machine_power_off = bcm47xx_machine_halt;
12712 + board_time_init = bcm47xx_time_init;
12713 + board_timer_setup = bcm47xx_timer_setup;
12718 +early_initcall(bcm47xx_init);
12719 diff -Nur linux-2.6.12.5/arch/mips/bcm947xx/time.c linux-2.6.12.5-brcm/arch/mips/bcm947xx/time.c
12720 --- linux-2.6.12.5/arch/mips/bcm947xx/time.c 1970-01-01 01:00:00.000000000 +0100
12721 +++ linux-2.6.12.5-brcm/arch/mips/bcm947xx/time.c 2005-09-16 10:29:18.215585712 +0200
12724 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
12726 + * This program is free software; you can redistribute it and/or modify it
12727 + * under the terms of the GNU General Public License as published by the
12728 + * Free Software Foundation; either version 2 of the License, or (at your
12729 + * option) any later version.
12731 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12732 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12733 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12734 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
12735 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12736 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
12737 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
12738 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12739 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
12740 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12742 + * You should have received a copy of the GNU General Public License along
12743 + * with this program; if not, write to the Free Software Foundation, Inc.,
12744 + * 675 Mass Ave, Cambridge, MA 02139, USA.
12747 +#include <linux/config.h>
12748 +#include <linux/init.h>
12749 +#include <linux/kernel.h>
12750 +#include <linux/sched.h>
12751 +#include <linux/serial_reg.h>
12752 +#include <linux/interrupt.h>
12753 +#include <asm/addrspace.h>
12754 +#include <asm/io.h>
12755 +#include <asm/time.h>
12758 +bcm47xx_time_init(void)
12763 + * Use deterministic values for initial counter interrupt
12764 + * so that calibrate delay avoids encountering a counter wrap.
12766 + write_c0_count(0);
12767 + write_c0_compare(0xffff);
12769 + hz = 200 * 1000 * 1000;
12771 + /* Set MIPS counter frequency for fixed_rate_gettimeoffset() */
12772 + mips_hpt_frequency = hz / 2;
12777 +bcm47xx_timer_setup(struct irqaction *irq)
12779 + /* Enable the timer interrupt */
12780 + setup_irq(7, irq);
12782 diff -Nur linux-2.6.12.5/arch/mips/kernel/cpu-probe.c linux-2.6.12.5-brcm/arch/mips/kernel/cpu-probe.c
12783 --- linux-2.6.12.5/arch/mips/kernel/cpu-probe.c 2005-08-15 02:20:18.000000000 +0200
12784 +++ linux-2.6.12.5-brcm/arch/mips/kernel/cpu-probe.c 2005-09-16 10:29:18.243581456 +0200
12785 @@ -555,6 +555,28 @@
12789 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
12791 + decode_config1(c);
12792 + switch (c->processor_id & 0xff00) {
12793 + case PRID_IMP_BCM3302:
12794 + c->cputype = CPU_BCM3302;
12795 + c->isa_level = MIPS_CPU_ISA_M32;
12796 + c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
12797 + MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
12799 + case PRID_IMP_BCM4710:
12800 + c->cputype = CPU_BCM4710;
12801 + c->isa_level = MIPS_CPU_ISA_M32;
12802 + c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
12803 + MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
12806 + c->cputype = CPU_UNKNOWN;
12811 __init void cpu_probe(void)
12813 struct cpuinfo_mips *c = ¤t_cpu_data;
12814 @@ -577,7 +599,9 @@
12815 case PRID_COMP_SIBYTE:
12816 cpu_probe_sibyte(c);
12819 + case PRID_COMP_BROADCOM:
12820 + cpu_probe_broadcom(c);
12822 case PRID_COMP_SANDCRAFT:
12823 cpu_probe_sandcraft(c);
12825 diff -Nur linux-2.6.12.5/arch/mips/kernel/head.S linux-2.6.12.5-brcm/arch/mips/kernel/head.S
12826 --- linux-2.6.12.5/arch/mips/kernel/head.S 2005-08-15 02:20:18.000000000 +0200
12827 +++ linux-2.6.12.5-brcm/arch/mips/kernel/head.S 2005-09-16 10:29:18.244581304 +0200
12828 @@ -122,6 +122,14 @@
12832 +#ifdef CONFIG_BCM4710
12834 +#define eret nop; nop; eret
12841 * Reserved space for exception handlers.
12842 * Necessary for machines which link their kernels at KSEG0.
12843 diff -Nur linux-2.6.12.5/arch/mips/kernel/proc.c linux-2.6.12.5-brcm/arch/mips/kernel/proc.c
12844 --- linux-2.6.12.5/arch/mips/kernel/proc.c 2005-08-15 02:20:18.000000000 +0200
12845 +++ linux-2.6.12.5-brcm/arch/mips/kernel/proc.c 2005-09-16 10:29:18.250580392 +0200
12847 [CPU_VR4133] "NEC VR4133",
12848 [CPU_VR4181] "NEC VR4181",
12849 [CPU_VR4181A] "NEC VR4181A",
12850 - [CPU_SR71000] "Sandcraft SR71000"
12851 + [CPU_SR71000] "Sandcraft SR71000",
12852 + [CPU_BCM3302] "Broadcom BCM3302",
12853 + [CPU_BCM4710] "Broadcom BCM4710"
12857 diff -Nur linux-2.6.12.5/arch/mips/mm/tlbex.c linux-2.6.12.5-brcm/arch/mips/mm/tlbex.c
12858 --- linux-2.6.12.5/arch/mips/mm/tlbex.c 2005-08-15 02:20:18.000000000 +0200
12859 +++ linux-2.6.12.5-brcm/arch/mips/mm/tlbex.c 2005-09-16 10:29:18.273576896 +0200
12860 @@ -851,6 +851,8 @@
12864 + case CPU_BCM3302:
12865 + case CPU_BCM4710:
12869 diff -Nur linux-2.6.12.5/arch/mips/pci/Makefile linux-2.6.12.5-brcm/arch/mips/pci/Makefile
12870 --- linux-2.6.12.5/arch/mips/pci/Makefile 2005-08-15 02:20:18.000000000 +0200
12871 +++ linux-2.6.12.5-brcm/arch/mips/pci/Makefile 2005-09-16 10:29:18.311571120 +0200
12873 obj-$(CONFIG_MIPS_TX3927) += ops-jmr3927.o
12874 obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
12875 obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
12876 +obj-$(CONFIG_BCM947XX) += ops-sb.o fixup-bcm47xx.o pci-bcm47xx.o
12879 # These are still pretty much in the old state, watch, go blind.
12880 diff -Nur linux-2.6.12.5/arch/mips/pci/fixup-bcm47xx.c linux-2.6.12.5-brcm/arch/mips/pci/fixup-bcm47xx.c
12881 --- linux-2.6.12.5/arch/mips/pci/fixup-bcm47xx.c 1970-01-01 01:00:00.000000000 +0100
12882 +++ linux-2.6.12.5-brcm/arch/mips/pci/fixup-bcm47xx.c 2005-09-16 10:29:18.312570968 +0200
12884 +#include <linux/init.h>
12885 +#include <linux/pci.h>
12887 +/* Do platform specific device initialization at pci_enable_device() time */
12888 +int pcibios_plat_dev_init(struct pci_dev *dev)
12893 +int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
12897 + if (dev->bus->number == 1)
12900 + pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
12904 +struct pci_fixup pcibios_fixups[] __initdata = {
12907 diff -Nur linux-2.6.12.5/arch/mips/pci/ops-sb.c linux-2.6.12.5-brcm/arch/mips/pci/ops-sb.c
12908 --- linux-2.6.12.5/arch/mips/pci/ops-sb.c 1970-01-01 01:00:00.000000000 +0100
12909 +++ linux-2.6.12.5-brcm/arch/mips/pci/ops-sb.c 2005-09-16 10:29:18.312570968 +0200
12911 +#include <linux/kernel.h>
12912 +#include <linux/init.h>
12913 +#include <linux/pci.h>
12914 +#include <linux/types.h>
12915 +#include <asm/pci.h>
12917 +#include <typedefs.h>
12918 +#include <sbpci.h>
12921 +//extern spinlock_t bcm47xx_sbh_lock;
12924 +sb_pci_read_config(struct pci_bus *bus, unsigned int devfn,
12925 + int reg, int size, u32 *val)
12927 + //unsigned long flags;
12931 + //spin_lock_irqsave(&sbh_lock, flags);
12932 + ret = sbpci_read_config(sbh, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), reg, val, size);
12933 + //spin_unlock_irqrestore(&sbh_lock, flags);
12935 + return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
12939 +sb_pci_write_config(struct pci_bus *bus, unsigned int devfn,
12940 + int reg, int size, u32 val)
12942 +// unsigned long flags;
12945 +// spin_lock_irqsave(&sbh_lock, flags);
12946 + ret = sbpci_write_config(sbh, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), reg, &val, size);
12947 +// spin_unlock_irqrestore(&sbh_lock, flags);
12948 + return ret ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
12951 +struct pci_ops sb_pci_ops = {
12952 + .read = sb_pci_read_config,
12953 + .write = sb_pci_write_config,
12955 diff -Nur linux-2.6.12.5/arch/mips/pci/pci-bcm47xx.c linux-2.6.12.5-brcm/arch/mips/pci/pci-bcm47xx.c
12956 --- linux-2.6.12.5/arch/mips/pci/pci-bcm47xx.c 1970-01-01 01:00:00.000000000 +0100
12957 +++ linux-2.6.12.5-brcm/arch/mips/pci/pci-bcm47xx.c 2005-09-16 10:29:18.313570816 +0200
12959 +#include <linux/init.h>
12960 +#include <linux/pci.h>
12961 +#include <linux/types.h>
12963 +#include <asm/cpu.h>
12964 +#include <asm/io.h>
12966 +#include <typedefs.h>
12967 +#include <sbconfig.h>
12969 +extern struct pci_ops sb_pci_ops;
12971 +static struct resource sb_pci_mem_resource = {
12972 + .name = "SB PCI Memory resources",
12973 + .start = SB_ENUM_BASE,
12974 + .end = SB_ENUM_LIM - 1,
12975 + .flags = IORESOURCE_MEM,
12978 +static struct resource sb_pci_io_resource = {
12979 + .name = "SB PCI I/O resources",
12982 + .flags = IORESOURCE_IO,
12985 +static struct pci_controller bcm47xx_sb_pci_controller = {
12986 + .pci_ops = &sb_pci_ops,
12987 + .mem_resource = &sb_pci_mem_resource,
12988 + .io_resource = &sb_pci_io_resource,
12991 +static struct resource ext_pci_mem_resource = {
12992 + .name = "Ext PCI Memory resources",
12993 + .start = SB_PCI_DMA,
12994 +// .end = 0x7FFFFFFF,
12995 + .end = 0x40FFFFFF,
12996 + .flags = IORESOURCE_MEM,
12999 +static struct resource ext_pci_io_resource = {
13000 + .name = "Ext PCI I/O resources",
13003 + .flags = IORESOURCE_IO,
13006 +static struct pci_controller bcm47xx_ext_pci_controller = {
13007 + .pci_ops = &sb_pci_ops,
13008 + .mem_resource = &ext_pci_mem_resource,
13009 + .io_resource = &ext_pci_io_resource,
13012 +static int __init bcm47xx_pci_init(void)
13014 + register_pci_controller(&bcm47xx_sb_pci_controller);
13015 + register_pci_controller(&bcm47xx_ext_pci_controller);
13019 +early_initcall(bcm47xx_pci_init);
13020 diff -Nur linux-2.6.12.5/arch/mips/pci/pci.c linux-2.6.12.5-brcm/arch/mips/pci/pci.c
13021 --- linux-2.6.12.5/arch/mips/pci/pci.c 2005-08-15 02:20:18.000000000 +0200
13022 +++ linux-2.6.12.5-brcm/arch/mips/pci/pci.c 2005-09-16 10:29:18.327568688 +0200
13023 @@ -238,7 +238,8 @@
13024 if (dev->resource[i].flags & IORESOURCE_IO)
13025 offset = hose->io_offset;
13026 else if (dev->resource[i].flags & IORESOURCE_MEM)
13027 - offset = hose->mem_offset;
13028 + offset = 0x26000000;
13029 + // offset = hose->mem_offset;
13031 dev->resource[i].start += offset;
13032 dev->resource[i].end += offset;
13033 diff -Nur linux-2.6.12.5/drivers/mtd/maps/Kconfig linux-2.6.12.5-brcm/drivers/mtd/maps/Kconfig
13034 --- linux-2.6.12.5/drivers/mtd/maps/Kconfig 2005-08-15 02:20:18.000000000 +0200
13035 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/Kconfig 2005-09-16 10:29:18.355564432 +0200
13036 @@ -357,6 +357,12 @@
13037 Mapping for the Flaga digital module. If you don't have one, ignore
13040 +config MTD_BCM47XX
13041 + tristate "BCM47xx flash device"
13042 + depends on MIPS && MTD_CFI && BCM947XX
13044 + Support for the flash chips on the BCM947xx board.
13047 tristate "CFI Flash device mapped on IBM 405LP Beech"
13048 depends on MTD_CFI && PPC32 && 40x && BEECH
13049 diff -Nur linux-2.6.12.5/drivers/mtd/maps/Makefile linux-2.6.12.5-brcm/drivers/mtd/maps/Makefile
13050 --- linux-2.6.12.5/drivers/mtd/maps/Makefile 2005-08-15 02:20:18.000000000 +0200
13051 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/Makefile 2005-09-16 10:29:18.360563672 +0200
13053 obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
13054 obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o
13055 obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o
13056 +obj-$(CONFIG_MTD_BCM47XX) += bcm47xx-flash.o
13057 obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o
13058 obj-$(CONFIG_MTD_IPAQ) += ipaq-flash.o
13059 obj-$(CONFIG_MTD_SBC_GXX) += sbc_gxx.o
13060 diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-brcm/drivers/mtd/maps/bcm47xx-flash.c
13061 --- linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c 1970-01-01 01:00:00.000000000 +0100
13062 +++ linux-2.6.12.5-brcm/drivers/mtd/maps/bcm47xx-flash.c 2005-09-16 10:29:18.361563520 +0200
13065 + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
13066 + * Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
13068 + * original functions for finding root filesystem from Mike Baker
13070 + * This program is free software; you can redistribute it and/or modify it
13071 + * under the terms of the GNU General Public License as published by the
13072 + * Free Software Foundation; either version 2 of the License, or (at your
13073 + * option) any later version.
13075 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13076 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13077 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13078 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
13079 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
13080 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13081 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
13082 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13083 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
13084 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13086 + * You should have received a copy of the GNU General Public License along
13087 + * with this program; if not, write to the Free Software Foundation, Inc.,
13088 + * 675 Mass Ave, Cambridge, MA 02139, USA.
13090 + * Copyright 2001-2003, Broadcom Corporation
13091 + * All Rights Reserved.
13093 + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
13094 + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
13095 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13096 + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
13098 + * $Id: bcm47xx-flash.c,v 1.1 2004/10/21 07:18:31 jolt Exp $
13100 + * Flash mapping for BCM947XX boards
13103 +#include <linux/init.h>
13104 +#include <linux/module.h>
13105 +#include <linux/types.h>
13106 +#include <linux/kernel.h>
13107 +#include <asm/io.h>
13108 +#include <linux/mtd/mtd.h>
13109 +#include <linux/mtd/map.h>
13110 +#include <linux/mtd/partitions.h>
13111 +#include <linux/config.h>
13112 +#include <typedefs.h>
13113 +#include <bcmutils.h>
13114 +#include <bcmnvram.h>
13115 +#include <trxhdr.h>
13117 +#ifdef CONFIG_MTD_PARTITIONS
13118 +extern struct mtd_partition * init_mtd_partitions(struct mtd_info *mtd, size_t size);
13121 +#define CFE_SIZE 1024*384
13122 +#define NVRAM_SIZE 1024*128
13124 +#define WINDOW_ADDR 0x1c000000
13125 +#define WINDOW_SIZE (0x400000*2)
13126 +#define BUSWIDTH 2
13128 +static struct mtd_info *bcm947xx_mtd;
13130 +static void bcm947xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
13132 +#define MIPS_MEMCPY_ALIGN 4
13134 + ssize_t transfer;
13135 + ssize_t done = 0;
13136 + if ((len >= MIPS_MEMCPY_ALIGN) && (!(from & (MIPS_MEMCPY_ALIGN - 1))) && (!(((unsigned int)to & (MIPS_MEMCPY_ALIGN - 1))))) {
13137 + done = len & ~(MIPS_MEMCPY_ALIGN - 1);
13138 + memcpy_fromio(to, map->virt + from, done);
13140 + while (done < len) {
13141 + ret = map->read(map, from + done);
13142 + transfer = len - done;
13143 + if (transfer > map->bankwidth)
13144 + transfer = map->bankwidth;
13145 + memcpy((void *)((unsigned long)to + done), &ret.x[0], transfer);
13146 + done += transfer;
13150 +static struct map_info bcm947xx_map = {
13151 + name: "Physically mapped flash",
13152 + size: WINDOW_SIZE,
13153 + bankwidth: BUSWIDTH,
13154 + phys: WINDOW_ADDR,
13157 +#ifdef CONFIG_MTD_PARTITIONS
13159 +static struct mtd_partition bcm947xx_parts[] = {
13160 + { name: "cfe", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, },
13161 + { name: "linux", offset: 0, size: 0, },
13162 + { name: "rootfs", offset: 0, size: 0, },
13163 + { name: "nvram", offset: 0, size: 0, },
13164 + { name: "OpenWrt", offset: 0, size: 0, },
13169 +find_root(struct mtd_info *mtd, size_t size, struct mtd_partition *part)
13171 + struct trx_header *trx;
13172 + unsigned char buf[512];
13176 + trx = (struct trx_header *) buf;
13178 + for (off = (512*1024); off < size; off += mtd->erasesize) {
13179 + memset(buf, 0xe5, sizeof(buf));
13182 + * Read into buffer
13184 + if (MTD_READ(mtd, off, sizeof(buf), &len, buf) ||
13185 + len != sizeof(buf))
13188 + /* found a TRX header */
13189 + if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
13190 + part->offset = le32_to_cpu(trx->offsets[2]) ? :
13191 + le32_to_cpu(trx->offsets[1]);
13192 + part->size = le32_to_cpu(trx->len);
13194 + part->size -= part->offset;
13195 + part->offset += off;
13201 + printk(KERN_NOTICE
13202 + "%s: Couldn't find root filesystem\n",
13207 + return part->size;
13210 +struct mtd_partition * __init
13211 +init_mtd_partitions(struct mtd_info *mtd, size_t size)
13214 + /* boot loader */
13215 + bcm947xx_parts[0].offset = 0;
13216 + bcm947xx_parts[0].size = CFE_SIZE;
13218 + /* nvram (old config partition) */
13219 + bcm947xx_parts[3].offset = bcm947xx_parts[0].size;
13220 + bcm947xx_parts[3].size = NVRAM_SIZE;
13222 + /* Size linux (kernel and rootfs) */
13223 + /* do not count the elf loader, which is on one sector */
13224 + bcm947xx_parts[1].offset = bcm947xx_parts[0].size + bcm947xx_parts[3].size + mtd->erasesize;
13225 + bcm947xx_parts[1].size = size - NVRAM_SIZE - bcm947xx_parts[0].size -
13226 + bcm947xx_parts[3].size - mtd->erasesize;
13228 + /* Find and size rootfs */
13229 + if (find_root(mtd,size,&bcm947xx_parts[2])==0) {
13230 + /* entirely jffs2 */
13231 + bcm947xx_parts[2].size = size - bcm947xx_parts[2].offset - NVRAM_SIZE;
13232 + bcm947xx_parts[4].name = NULL;
13234 + /* legacy setup */
13235 + /* calculate leftover flash, and assign it to the jffs2 partition */
13236 + bcm947xx_parts[4].offset = bcm947xx_parts[2].offset + bcm947xx_parts[2].size;
13237 + if ((bcm947xx_parts[4].offset % mtd->erasesize) > 0) {
13238 + bcm947xx_parts[4].offset += mtd->erasesize -
13239 + (bcm947xx_parts[4].offset % mtd->erasesize);
13241 + bcm947xx_parts[4].size = size - NVRAM_SIZE - bcm947xx_parts[4].offset;
13244 + return bcm947xx_parts;
13247 +EXPORT_SYMBOL(init_mtd_partitions);
13250 +int __init init_bcm947xx_map(void)
13254 +#ifdef CONFIG_MTD_PARTITIONS
13255 + struct mtd_partition *parts;
13259 + bcm947xx_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
13261 + if (!bcm947xx_map.virt) {
13262 + printk("Failed to ioremap\n");
13265 + simple_map_init(&bcm947xx_map);
13267 + bcm947xx_map.copy_from = bcm947xx_map_copy_from;
13269 + if (!(bcm947xx_mtd = do_map_probe("cfi_probe", &bcm947xx_map))) {
13270 + printk("Failed to do_map_probe\n");
13271 + iounmap((void *)bcm947xx_map.virt);
13275 + bcm947xx_mtd->owner = THIS_MODULE;
13277 + size = bcm947xx_mtd->size;
13279 + printk(KERN_NOTICE "Flash device: 0x%x at 0x%x\n", bcm947xx_mtd->size, WINDOW_ADDR);
13281 +#ifdef CONFIG_MTD_PARTITIONS
13282 + parts = init_mtd_partitions(bcm947xx_mtd, size);
13283 + for (i = 0; parts[i].name; i++);
13284 + ret = add_mtd_partitions(bcm947xx_mtd, parts, i);
13286 + printk(KERN_ERR "Flash: add_mtd_partitions failed\n");
13294 + if (bcm947xx_mtd)
13295 + map_destroy(bcm947xx_mtd);
13296 + if (bcm947xx_map.map_priv_1)
13297 + iounmap((void *) bcm947xx_map.map_priv_1);
13298 + bcm947xx_map.map_priv_1 = 0;
13302 +void __exit cleanup_bcm947xx_map(void)
13304 +#ifdef CONFIG_MTD_PARTITIONS
13305 + del_mtd_partitions(bcm947xx_mtd);
13307 + map_destroy(bcm947xx_mtd);
13308 + iounmap((void *)bcm947xx_map.virt);
13311 +module_init(init_bcm947xx_map);
13312 +module_exit(cleanup_bcm947xx_map);
13313 diff -Nur linux-2.6.12.5/include/asm-mips/bootinfo.h linux-2.6.12.5-brcm/include/asm-mips/bootinfo.h
13314 --- linux-2.6.12.5/include/asm-mips/bootinfo.h 2005-08-15 02:20:18.000000000 +0200
13315 +++ linux-2.6.12.5-brcm/include/asm-mips/bootinfo.h 2005-09-16 10:29:18.415555312 +0200
13316 @@ -213,6 +213,12 @@
13317 #define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
13318 #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
13321 + * Valid machtype for group Broadcom
13323 +#define MACH_GROUP_BRCM 23 /* Broadcom */
13324 +#define MACH_BCM47XX 1 /* Broadcom BCM47xx */
13326 #define CL_SIZE COMMAND_LINE_SIZE
13328 const char *get_system_type(void);
13329 diff -Nur linux-2.6.12.5/include/asm-mips/cpu.h linux-2.6.12.5-brcm/include/asm-mips/cpu.h
13330 --- linux-2.6.12.5/include/asm-mips/cpu.h 2005-08-15 02:20:18.000000000 +0200
13331 +++ linux-2.6.12.5-brcm/include/asm-mips/cpu.h 2005-09-16 10:29:18.416555160 +0200
13333 #define PRID_IMP_SR71000 0x0400
13336 + * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
13339 +#define PRID_IMP_BCM4710 0x4000
13340 +#define PRID_IMP_BCM3302 0x9000
13343 * Definitions for 7:0 on legacy processors
13346 @@ -177,7 +184,9 @@
13347 #define CPU_VR4133 56
13348 #define CPU_AU1550 57
13350 -#define CPU_LAST 58
13351 +#define CPU_BCM3302 59
13352 +#define CPU_BCM4710 60
13353 +#define CPU_LAST 60
13356 * ISA Level encodings
13357 diff -Nur linux-2.6.12.5/include/asm-mips/mipsregs.h linux-2.6.12.5-brcm/include/asm-mips/mipsregs.h
13358 --- linux-2.6.12.5/include/asm-mips/mipsregs.h 2005-08-15 02:20:18.000000000 +0200
13359 +++ linux-2.6.12.5-brcm/include/asm-mips/mipsregs.h 2005-09-16 10:29:18.426553640 +0200
13360 @@ -790,10 +790,18 @@
13361 #define read_c0_config1() __read_32bit_c0_register($16, 1)
13362 #define read_c0_config2() __read_32bit_c0_register($16, 2)
13363 #define read_c0_config3() __read_32bit_c0_register($16, 3)
13364 +#define read_c0_config4() __read_32bit_c0_register($16, 4)
13365 +#define read_c0_config5() __read_32bit_c0_register($16, 5)
13366 +#define read_c0_config6() __read_32bit_c0_register($16, 6)
13367 +#define read_c0_config7() __read_32bit_c0_register($16, 7)
13368 #define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
13369 #define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
13370 #define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
13371 #define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
13372 +#define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
13373 +#define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
13374 +#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
13375 +#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
13378 * The WatchLo register. There may be upto 8 of them.
13379 diff -Nur linux-2.6.12.5/include/linux/init.h linux-2.6.12.5-brcm/include/linux/init.h
13380 --- linux-2.6.12.5/include/linux/init.h 2005-08-15 02:20:18.000000000 +0200
13381 +++ linux-2.6.12.5-brcm/include/linux/init.h 2005-09-16 10:29:18.426553640 +0200
13383 static initcall_t __initcall_##fn __attribute_used__ \
13384 __attribute__((__section__(".initcall" level ".init"))) = fn
13386 +#define early_initcall(fn) __define_initcall(".early1",fn)
13388 #define core_initcall(fn) __define_initcall("1",fn)
13389 #define postcore_initcall(fn) __define_initcall("2",fn)
13390 #define arch_initcall(fn) __define_initcall("3",fn)
13391 diff -Nur linux-2.6.12.5/include/linux/pci_ids.h linux-2.6.12.5-brcm/include/linux/pci_ids.h
13392 --- linux-2.6.12.5/include/linux/pci_ids.h 2005-08-15 02:20:18.000000000 +0200
13393 +++ linux-2.6.12.5-brcm/include/linux/pci_ids.h 2005-09-16 10:29:18.429553184 +0200
13394 @@ -2110,6 +2110,7 @@
13395 #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
13396 #define PCI_DEVICE_ID_BCM4401 0x4401
13397 #define PCI_DEVICE_ID_BCM4401B0 0x4402
13398 +#define PCI_DEVICE_ID_BCM4713 0x4713
13400 #define PCI_VENDOR_ID_TOPIC 0x151f
13401 #define PCI_DEVICE_ID_TOPIC_TP560 0x0000