aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm-2.4/patches
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-06-26 20:41:59 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-06-26 20:41:59 +0000
commitcfbefb4b872d3983799f7fbc18d9621372113e53 (patch)
treecf8f3244e976824905b90f87dacee3a5984bccef /target/linux/brcm-2.4/patches
parent812f02632308229c2ed9ee56bc11adba2e3c365a (diff)
downloadupstream-cfbefb4b872d3983799f7fbc18d9621372113e53.tar.gz
upstream-cfbefb4b872d3983799f7fbc18d9621372113e53.tar.bz2
upstream-cfbefb4b872d3983799f7fbc18d9621372113e53.zip
remove the brcm-2.4 target, it will no longer be supported in future releases. please use brcm47xx with broadcom-wl instead
SVN-Revision: 21946
Diffstat (limited to 'target/linux/brcm-2.4/patches')
-rw-r--r--target/linux/brcm-2.4/patches/001-bcm47xx.patch596
-rw-r--r--target/linux/brcm-2.4/patches/003-bcm47xx_cache_fixes.patch491
-rw-r--r--target/linux/brcm-2.4/patches/004-flash.patch68
-rw-r--r--target/linux/brcm-2.4/patches/005-bluetooth_sco_buffer_align.patch12
-rw-r--r--target/linux/brcm-2.4/patches/006-ide_workaround.patch17
-rw-r--r--target/linux/brcm-2.4/patches/008-b44_bcm47xx_support.patch580
-rw-r--r--target/linux/brcm-2.4/patches/009-wrt54g3g_pcmcia.patch84
-rw-r--r--target/linux/brcm-2.4/patches/010-bcm47xx-cam_absent.patch42
-rw-r--r--target/linux/brcm-2.4/patches/011-wl_qdisc_war.patch14
-rw-r--r--target/linux/brcm-2.4/patches/012-aec62xx.patch100
-rw-r--r--target/linux/brcm-2.4/patches/013-wl_hdd_pdc202xx.patch40
-rw-r--r--target/linux/brcm-2.4/patches/014-sierra_support.patch1484
-rw-r--r--target/linux/brcm-2.4/patches/015-sierra_kconfig.patch20
-rw-r--r--target/linux/brcm-2.4/patches/016-fuse-ntfs-3g-mips.patch30
-rw-r--r--target/linux/brcm-2.4/patches/100-wl_config.patch66
-rw-r--r--target/linux/brcm-2.4/patches/110-b44_alignment.patch103
-rw-r--r--target/linux/brcm-2.4/patches/200-fix_ipv6_receiving_with_ipv4_socket.patch18
17 files changed, 0 insertions, 3765 deletions
diff --git a/target/linux/brcm-2.4/patches/001-bcm47xx.patch b/target/linux/brcm-2.4/patches/001-bcm47xx.patch
deleted file mode 100644
index ba1e41ee9b..0000000000
--- a/target/linux/brcm-2.4/patches/001-bcm47xx.patch
+++ /dev/null
@@ -1,596 +0,0 @@
---- a/arch/mips/config-shared.in
-+++ b/arch/mips/config-shared.in
-@@ -208,6 +208,14 @@ if [ "$CONFIG_SIBYTE_SB1xxx_SOC" = "y" ]
- fi
- define_bool CONFIG_MIPS_RTC y
- fi
-+dep_bool 'Support for Broadcom MIPS-based boards' CONFIG_MIPS_BRCM $CONFIG_EXPERIMENTAL
-+dep_bool 'Support for Broadcom BCM947XX' CONFIG_BCM947XX $CONFIG_MIPS_BRCM
-+if [ "$CONFIG_BCM947XX" = "y" ] ; then
-+ bool ' Support for Broadcom BCM4710' CONFIG_BCM4710
-+ bool ' Support for Broadcom BCM4310' CONFIG_BCM4310
-+ bool ' Support for Broadcom BCM4704' CONFIG_BCM4704
-+ bool ' Support for Broadcom BCM5365' CONFIG_BCM5365
-+fi
- bool 'Support for SNI RM200 PCI' CONFIG_SNI_RM200_PCI
- bool 'Support for TANBAC TB0226 (Mbase)' CONFIG_TANBAC_TB0226
- bool 'Support for TANBAC TB0229 (VR4131DIMM)' CONFIG_TANBAC_TB0229
-@@ -229,6 +237,11 @@ define_bool CONFIG_RWSEM_GENERIC_SPINLOC
- define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n
-
- #
-+# Provide an option for a default kernel command line
-+#
-+string 'Default kernel command string' CONFIG_CMDLINE ""
-+
-+#
- # Select some configuration options automatically based on user selections.
- #
- if [ "$CONFIG_ACER_PICA_61" = "y" ]; then
-@@ -554,6 +567,12 @@ if [ "$CONFIG_SIBYTE_SB1xxx_SOC" = "y" ]
- define_bool CONFIG_SWAP_IO_SPACE_L y
- define_bool CONFIG_BOOT_ELF32 y
- fi
-+if [ "$CONFIG_BCM947XX" = "y" ] ; then
-+ define_bool CONFIG_PCI y
-+ define_bool CONFIG_NONCOHERENT_IO y
-+ define_bool CONFIG_NEW_TIME_C y
-+ define_bool CONFIG_NEW_IRQ y
-+fi
- if [ "$CONFIG_SNI_RM200_PCI" = "y" ]; then
- define_bool CONFIG_ARC32 y
- define_bool CONFIG_ARC_MEMORY y
-@@ -1042,7 +1061,11 @@ comment 'Kernel hacking'
-
- bool 'Are you using a crosscompiler' CONFIG_CROSSCOMPILE
- bool 'Enable run-time debugging' CONFIG_RUNTIME_DEBUG
--bool 'Remote GDB kernel debugging' CONFIG_KGDB
-+if [ "$CONFIG_BCM947XX" = "y" ] ; then
-+ bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG
-+else
-+ bool 'Remote GDB kernel debugging' CONFIG_KGDB
-+fi
- dep_bool ' Console output to GDB' CONFIG_GDB_CONSOLE $CONFIG_KGDB
- if [ "$CONFIG_KGDB" = "y" ]; then
- define_bool CONFIG_DEBUG_INFO y
---- a/arch/mips/kernel/cpu-probe.c
-+++ b/arch/mips/kernel/cpu-probe.c
-@@ -162,7 +162,7 @@ static inline int __cpu_has_fpu(void)
-
- static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
- {
-- switch (c->processor_id & 0xff00) {
-+ switch (c->processor_id & PRID_IMP_MASK) {
- case PRID_IMP_R2000:
- c->cputype = CPU_R2000;
- c->isa_level = MIPS_CPU_ISA_I;
-@@ -172,7 +172,7 @@ static inline void cpu_probe_legacy(stru
- c->tlbsize = 64;
- break;
- case PRID_IMP_R3000:
-- if ((c->processor_id & 0xff) == PRID_REV_R3000A)
-+ if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A)
- if (cpu_has_confreg())
- c->cputype = CPU_R3081E;
- else
-@@ -187,12 +187,12 @@ static inline void cpu_probe_legacy(stru
- break;
- case PRID_IMP_R4000:
- if (read_c0_config() & CONF_SC) {
-- if ((c->processor_id & 0xff) >= PRID_REV_R4400)
-+ if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400)
- c->cputype = CPU_R4400PC;
- else
- c->cputype = CPU_R4000PC;
- } else {
-- if ((c->processor_id & 0xff) >= PRID_REV_R4400)
-+ if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400)
- c->cputype = CPU_R4400SC;
- else
- c->cputype = CPU_R4000SC;
-@@ -438,7 +438,7 @@ static inline void decode_config1(struct
- static inline void cpu_probe_mips(struct cpuinfo_mips *c)
- {
- decode_config1(c);
-- switch (c->processor_id & 0xff00) {
-+ switch (c->processor_id & PRID_IMP_MASK) {
- case PRID_IMP_4KC:
- c->cputype = CPU_4KC;
- c->isa_level = MIPS_CPU_ISA_M32;
-@@ -479,10 +479,10 @@ static inline void cpu_probe_alchemy(str
- {
- decode_config1(c);
- c->options |= MIPS_CPU_PREFETCH;
-- switch (c->processor_id & 0xff00) {
-+ switch (c->processor_id & PRID_IMP_MASK) {
- case PRID_IMP_AU1_REV1:
- case PRID_IMP_AU1_REV2:
-- switch ((c->processor_id >> 24) & 0xff) {
-+ switch ((c->processor_id >> 24) & PRID_REV_MASK) {
- case 0:
- c->cputype = CPU_AU1000;
- break;
-@@ -510,10 +510,34 @@ static inline void cpu_probe_alchemy(str
- }
- }
-
-+static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
-+{
-+ decode_config1(c);
-+ c->options |= MIPS_CPU_PREFETCH;
-+ switch (c->processor_id & PRID_IMP_MASK) {
-+ case PRID_IMP_BCM4710:
-+ c->cputype = CPU_BCM4710;
-+ c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
-+ MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
-+ c->scache.flags = MIPS_CACHE_NOT_PRESENT;
-+ break;
-+ case PRID_IMP_4KC:
-+ case PRID_IMP_BCM3302:
-+ c->cputype = CPU_BCM3302;
-+ c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
-+ MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
-+ c->scache.flags = MIPS_CACHE_NOT_PRESENT;
-+ break;
-+ default:
-+ c->cputype = CPU_UNKNOWN;
-+ break;
-+ }
-+}
-+
- static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
- {
- decode_config1(c);
-- switch (c->processor_id & 0xff00) {
-+ switch (c->processor_id & PRID_IMP_MASK) {
- case PRID_IMP_SB1:
- c->cputype = CPU_SB1;
- c->isa_level = MIPS_CPU_ISA_M64;
-@@ -535,7 +559,7 @@ static inline void cpu_probe_sibyte(stru
- static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
- {
- decode_config1(c);
-- switch (c->processor_id & 0xff00) {
-+ switch (c->processor_id & PRID_IMP_MASK) {
- case PRID_IMP_SR71000:
- c->cputype = CPU_SR71000;
- c->isa_level = MIPS_CPU_ISA_M64;
-@@ -560,7 +584,7 @@ __init void cpu_probe(void)
- c->cputype = CPU_UNKNOWN;
-
- c->processor_id = read_c0_prid();
-- switch (c->processor_id & 0xff0000) {
-+ switch (c->processor_id & PRID_COMP_MASK) {
-
- case PRID_COMP_LEGACY:
- cpu_probe_legacy(c);
-@@ -571,6 +595,9 @@ __init void cpu_probe(void)
- case PRID_COMP_ALCHEMY:
- cpu_probe_alchemy(c);
- break;
-+ case PRID_COMP_BROADCOM:
-+ cpu_probe_broadcom(c);
-+ break;
- case PRID_COMP_SIBYTE:
- cpu_probe_sibyte(c);
- break;
---- a/arch/mips/kernel/head.S
-+++ b/arch/mips/kernel/head.S
-@@ -28,12 +28,20 @@
- #include <asm/mipsregs.h>
- #include <asm/stackframe.h>
-
-+#ifdef CONFIG_BCM4710
-+#undef eret
-+#define eret nop; nop; eret
-+#endif
-+
- .text
-+ j kernel_entry
-+ nop
-+
- /*
- * Reserved space for exception handlers.
- * Necessary for machines which link their kernels at KSEG0.
- */
-- .fill 0x400
-+ .fill 0x3f4
-
- /* The following two symbols are used for kernel profiling. */
- EXPORT(stext)
---- a/arch/mips/kernel/proc.c
-+++ b/arch/mips/kernel/proc.c
-@@ -78,9 +78,10 @@ static const char *cpu_name[] = {
- [CPU_AU1550] "Au1550",
- [CPU_24K] "MIPS 24K",
- [CPU_AU1200] "Au1200",
-+ [CPU_BCM4710] "BCM4710",
-+ [CPU_BCM3302] "BCM3302",
- };
-
--
- static int show_cpuinfo(struct seq_file *m, void *v)
- {
- unsigned int version = current_cpu_data.processor_id;
---- a/arch/mips/kernel/setup.c
-+++ b/arch/mips/kernel/setup.c
-@@ -493,6 +493,7 @@ void __init setup_arch(char **cmdline_p)
- void swarm_setup(void);
- void hp_setup(void);
- void au1x00_setup(void);
-+ void brcm_setup(void);
- void frame_info_init(void);
-
- frame_info_init();
-@@ -691,6 +692,11 @@ void __init setup_arch(char **cmdline_p)
- pmc_yosemite_setup();
- break;
- #endif
-+#if defined(CONFIG_BCM4710) || defined(CONFIG_BCM4310)
-+ case MACH_GROUP_BRCM:
-+ brcm_setup();
-+ break;
-+#endif
- default:
- panic("Unsupported architecture");
- }
---- a/arch/mips/kernel/traps.c
-+++ b/arch/mips/kernel/traps.c
-@@ -920,6 +920,7 @@ void __init per_cpu_trap_init(void)
- void __init trap_init(void)
- {
- extern char except_vec1_generic;
-+ extern char except_vec2_generic;
- extern char except_vec3_generic, except_vec3_r4000;
- extern char except_vec_ejtag_debug;
- extern char except_vec4;
-@@ -927,6 +928,7 @@ void __init trap_init(void)
-
- /* Copy the generic exception handler code to it's final destination. */
- memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
-+ memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
-
- /*
- * Setup default vectors
-@@ -985,6 +987,12 @@ void __init trap_init(void)
- set_except_vector(13, handle_tr);
- set_except_vector(22, handle_mdmx);
-
-+ if (current_cpu_data.cputype == CPU_SB1) {
-+ /* Enable timer interrupt and scd mapped interrupt */
-+ clear_c0_status(0xf000);
-+ set_c0_status(0xc00);
-+ }
-+
- if (cpu_has_fpu && !cpu_has_nofpuex)
- set_except_vector(15, handle_fpe);
-
---- a/arch/mips/Makefile
-+++ b/arch/mips/Makefile
-@@ -726,6 +726,19 @@ LOADADDR += 0x80020000
- endif
-
- #
-+# Broadcom BCM947XX variants
-+#
-+ifdef CONFIG_BCM947XX
-+LIBS += arch/mips/bcm947xx/generic/brcm.o arch/mips/bcm947xx/bcm947xx.o
-+SUBDIRS += arch/mips/bcm947xx/generic arch/mips/bcm947xx
-+LOADADDR := 0x80001000
-+
-+zImage: vmlinux
-+ $(MAKE) -C arch/$(ARCH)/bcm947xx/compressed
-+export LOADADDR
-+endif
-+
-+#
- # Choosing incompatible machines durings configuration will result in
- # error messages during linking. Select a default linkscript if
- # none has been choosen above.
-@@ -779,6 +792,7 @@ archclean:
- $(MAKE) -C arch/$(ARCH)/tools clean
- $(MAKE) -C arch/mips/baget clean
- $(MAKE) -C arch/mips/lasat clean
-+ $(MAKE) -C arch/mips/bcm947xx/compressed clean
-
- archmrproper:
- @$(MAKEBOOT) mrproper
---- a/arch/mips/mm/c-r4k.c
-+++ b/arch/mips/mm/c-r4k.c
-@@ -1118,3 +1118,47 @@ void __init ld_mmu_r4xx0(void)
- build_clear_page();
- build_copy_page();
- }
-+
-+#ifdef CONFIG_BCM4704
-+static void __init mips32_icache_fill(unsigned long addr, uint nbytes)
-+{
-+ unsigned long ic_lsize = current_cpu_data.icache.linesz;
-+ int i;
-+ for (i = 0; i < nbytes; i += ic_lsize)
-+ fill_icache_line((addr + i));
-+}
-+
-+/*
-+ * This must be run from the cache on 4704A0
-+ * so there are no mips core BIU ops in progress
-+ * when the PFC is enabled.
-+ */
-+#define PFC_CR0 0xff400000 /* control reg 0 */
-+#define PFC_CR1 0xff400004 /* control reg 1 */
-+static void __init enable_pfc(u32 mode)
-+{
-+ /* write range */
-+ *(volatile u32 *)PFC_CR1 = 0xffff0000;
-+
-+ /* enable */
-+ *(volatile u32 *)PFC_CR0 = mode;
-+}
-+#endif
-+
-+
-+void check_enable_mips_pfc(int val)
-+{
-+
-+#ifdef CONFIG_BCM4704
-+ struct cpuinfo_mips *c = &current_cpu_data;
-+
-+ /* enable prefetch cache */
-+ if (((c->processor_id & (PRID_COMP_MASK | PRID_IMP_MASK)) == PRID_IMP_BCM3302)
-+ && (read_c0_diag() & (1 << 29))) {
-+ mips32_icache_fill((unsigned long) &enable_pfc, 64);
-+ enable_pfc(val);
-+ }
-+#endif
-+}
-+
-+
---- a/arch/mips/pci/Makefile
-+++ b/arch/mips/pci/Makefile
-@@ -13,7 +13,9 @@ obj-$(CONFIG_MIPS_GT64120) += ops-gt6412
- obj-$(CONFIG_MIPS_MSC) += ops-msc.o
- obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o
- obj-$(CONFIG_SNI_RM200_PCI) += ops-sni.o
-+ifndef CONFIG_BCM947XX
- obj-y += pci.o
-+endif
- obj-$(CONFIG_PCI_AUTO) += pci_auto.o
-
- include $(TOPDIR)/Rules.make
---- a/drivers/char/serial.c
-+++ b/drivers/char/serial.c
-@@ -444,6 +444,10 @@ static _INLINE_ unsigned int serial_in(s
- return inb(info->port+1);
- #endif
- case SERIAL_IO_MEM:
-+#ifdef CONFIG_BCM4310
-+ readb((unsigned long) info->iomem_base +
-+ (UART_SCR<<info->iomem_reg_shift));
-+#endif
- return readb((unsigned long) info->iomem_base +
- (offset<<info->iomem_reg_shift));
- default:
-@@ -464,6 +468,9 @@ static _INLINE_ void serial_out(struct a
- case SERIAL_IO_MEM:
- writeb(value, (unsigned long) info->iomem_base +
- (offset<<info->iomem_reg_shift));
-+#ifdef CONFIG_BCM4704
-+ *((volatile unsigned int *) KSEG1ADDR(0x18000000));
-+#endif
- break;
- default:
- outb(value, info->port+offset);
-@@ -1728,7 +1735,7 @@ static void change_speed(struct async_st
- /* Special case since 134 is really 134.5 */
- quot = (2*baud_base / 269);
- else if (baud)
-- quot = baud_base / baud;
-+ quot = (baud_base + (baud / 2)) / baud;
- }
- /* If the quotient is zero refuse the change */
- if (!quot && old_termios) {
-@@ -1745,12 +1752,12 @@ static void change_speed(struct async_st
- /* Special case since 134 is really 134.5 */
- quot = (2*baud_base / 269);
- else if (baud)
-- quot = baud_base / baud;
-+ quot = (baud_base + (baud / 2)) / baud;
- }
- }
- /* As a last resort, if the quotient is zero, default to 9600 bps */
- if (!quot)
-- quot = baud_base / 9600;
-+ quot = (baud_base + 4800) / 9600;
- /*
- * Work around a bug in the Oxford Semiconductor 952 rev B
- * chip which causes it to seriously miscalculate baud rates
-@@ -5994,6 +6001,13 @@ static int __init serial_console_setup(s
- * Divisor, bytesize and parity
- */
- state = rs_table + co->index;
-+ /*
-+ * Safe guard: state structure must have been initialized
-+ */
-+ if (state->iomem_base == NULL) {
-+ printk("!unable to setup serial console!\n");
-+ return -1;
-+ }
- if (doflow)
- state->flags |= ASYNC_CONS_FLOW;
- info = &async_sercons;
-@@ -6007,7 +6021,7 @@ static int __init serial_console_setup(s
- info->io_type = state->io_type;
- info->iomem_base = state->iomem_base;
- info->iomem_reg_shift = state->iomem_reg_shift;
-- quot = state->baud_base / baud;
-+ quot = (state->baud_base + (baud / 2)) / baud;
- cval = cflag & (CSIZE | CSTOPB);
- #if defined(__powerpc__) || defined(__alpha__)
- cval >>= 8;
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -3,6 +3,8 @@
- # Makefile for the Linux network (ethercard) device drivers.
- #
-
-+EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include
-+
- obj-y :=
- obj-m :=
- obj-n :=
---- a/drivers/parport/Config.in
-+++ b/drivers/parport/Config.in
-@@ -11,6 +11,7 @@ comment 'Parallel port support'
- tristate 'Parallel port support' CONFIG_PARPORT
- if [ "$CONFIG_PARPORT" != "n" ]; then
- dep_tristate ' PC-style hardware' CONFIG_PARPORT_PC $CONFIG_PARPORT
-+ dep_tristate ' Asus WL500g parallel port' CONFIG_PARPORT_SPLINK $CONFIG_PARPORT
- if [ "$CONFIG_PARPORT_PC" != "n" -a "$CONFIG_SERIAL" != "n" ]; then
- if [ "$CONFIG_SERIAL" = "m" ]; then
- define_tristate CONFIG_PARPORT_PC_CML1 m
---- a/drivers/parport/Makefile
-+++ b/drivers/parport/Makefile
-@@ -22,6 +22,7 @@ endif
-
- obj-$(CONFIG_PARPORT) += parport.o
- obj-$(CONFIG_PARPORT_PC) += parport_pc.o
-+obj-$(CONFIG_PARPORT_SPLINK) += parport_splink.o
- obj-$(CONFIG_PARPORT_PC_PCMCIA) += parport_cs.o
- obj-$(CONFIG_PARPORT_AMIGA) += parport_amiga.o
- obj-$(CONFIG_PARPORT_MFC3) += parport_mfc3.o
---- a/include/asm-mips/bootinfo.h
-+++ b/include/asm-mips/bootinfo.h
-@@ -37,6 +37,7 @@
- #define MACH_GROUP_HP_LJ 20 /* Hewlett Packard LaserJet */
- #define MACH_GROUP_LASAT 21
- #define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
-+#define MACH_GROUP_BRCM 23 /* Broadcom */
-
- /*
- * Valid machtype values for group unknown (low order halfword of mips_machtype)
-@@ -197,6 +198,15 @@
- #define MACH_TANBAC_TB0229 7 /* TANBAC TB0229 (VR4131DIMM) */
-
- /*
-+ * Valid machtypes for group Broadcom
-+ */
-+#define MACH_BCM93725 0
-+#define MACH_BCM93725_VJ 1
-+#define MACH_BCM93730 2
-+#define MACH_BCM947XX 3
-+#define MACH_BCM933XX 4
-+
-+/*
- * Valid machtype for group TITAN
- */
- #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
---- a/include/asm-mips/cpu.h
-+++ b/include/asm-mips/cpu.h
-@@ -22,6 +22,11 @@
- spec.
- */
-
-+#define PRID_COPT_MASK 0xff000000
-+#define PRID_COMP_MASK 0x00ff0000
-+#define PRID_IMP_MASK 0x0000ff00
-+#define PRID_REV_MASK 0x000000ff
-+
- #define PRID_COMP_LEGACY 0x000000
- #define PRID_COMP_MIPS 0x010000
- #define PRID_COMP_BROADCOM 0x020000
-@@ -58,6 +63,7 @@
- #define PRID_IMP_RM7000 0x2700
- #define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */
- #define PRID_IMP_RM9000 0x3400
-+#define PRID_IMP_BCM4710 0x4000
- #define PRID_IMP_R5432 0x5400
- #define PRID_IMP_R5500 0x5500
- #define PRID_IMP_4KC 0x8000
-@@ -66,10 +72,16 @@
- #define PRID_IMP_4KEC 0x8400
- #define PRID_IMP_4KSC 0x8600
- #define PRID_IMP_25KF 0x8800
-+#define PRID_IMP_BCM3302 0x9000
-+#define PRID_IMP_BCM3303 0x9100
- #define PRID_IMP_24K 0x9300
-
- #define PRID_IMP_UNKNOWN 0xff00
-
-+#define BCM330X(id) \
-+ (((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) \
-+ || ((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3303)))
-+
- /*
- * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
- */
-@@ -174,7 +186,9 @@
- #define CPU_AU1550 57
- #define CPU_24K 58
- #define CPU_AU1200 59
--#define CPU_LAST 59
-+#define CPU_BCM4710 60
-+#define CPU_BCM3302 61
-+#define CPU_LAST 61
-
- /*
- * ISA Level encodings
---- a/include/asm-mips/r4kcache.h
-+++ b/include/asm-mips/r4kcache.h
-@@ -567,4 +567,17 @@ static inline void blast_scache128_page_
- cache128_unroll32(addr|ws,Index_Writeback_Inv_SD);
- }
-
-+extern inline void fill_icache_line(unsigned long addr)
-+{
-+ __asm__ __volatile__(
-+ ".set noreorder\n\t"
-+ ".set mips3\n\t"
-+ "cache %1, (%0)\n\t"
-+ ".set mips0\n\t"
-+ ".set reorder"
-+ :
-+ : "r" (addr),
-+ "i" (Fill));
-+}
-+
- #endif /* __ASM_R4KCACHE_H */
---- a/include/asm-mips/serial.h
-+++ b/include/asm-mips/serial.h
-@@ -223,6 +223,13 @@
- #define TXX927_SERIAL_PORT_DEFNS
- #endif
-
-+#ifdef CONFIG_BCM947XX
-+/* reserve 4 ports to be configured at runtime */
-+#define BCM947XX_SERIAL_PORT_DEFNS { 0, }, { 0, }, { 0, }, { 0, },
-+#else
-+#define BCM947XX_SERIAL_PORT_DEFNS
-+#endif
-+
- #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
- #define STD_SERIAL_PORT_DEFNS \
- /* UART CLK PORT IRQ FLAGS */ \
-@@ -470,6 +477,7 @@
- #define SERIAL_PORT_DFNS \
- ATLAS_SERIAL_PORT_DEFNS \
- AU1000_SERIAL_PORT_DEFNS \
-+ BCM947XX_SERIAL_PORT_DEFNS \
- COBALT_SERIAL_PORT_DEFNS \
- DDB5477_SERIAL_PORT_DEFNS \
- EV96100_SERIAL_PORT_DEFNS \
---- a/init/do_mounts.c
-+++ b/init/do_mounts.c
-@@ -255,7 +255,13 @@ static struct dev_name_struct {
- { "ftlb", 0x2c08 },
- { "ftlc", 0x2c10 },
- { "ftld", 0x2c18 },
-+#if defined(CONFIG_MTD_BLOCK) || defined(CONFIG_MTD_BLOCK_RO)
- { "mtdblock", 0x1f00 },
-+ { "mtdblock0",0x1f00 },
-+ { "mtdblock1",0x1f01 },
-+ { "mtdblock2",0x1f02 },
-+ { "mtdblock3",0x1f03 },
-+#endif
- { "nb", 0x2b00 },
- { NULL, 0 }
- };
diff --git a/target/linux/brcm-2.4/patches/003-bcm47xx_cache_fixes.patch b/target/linux/brcm-2.4/patches/003-bcm47xx_cache_fixes.patch
deleted file mode 100644
index 28f8ac48b6..0000000000
--- a/target/linux/brcm-2.4/patches/003-bcm47xx_cache_fixes.patch
+++ /dev/null
@@ -1,491 +0,0 @@
---- a/arch/mips/kernel/entry.S
-+++ b/arch/mips/kernel/entry.S
-@@ -100,6 +100,10 @@ END(except_vec1_generic)
- * and R4400 SC and MC versions.
- */
- NESTED(except_vec3_generic, 0, sp)
-+#ifdef CONFIG_BCM4710
-+ nop
-+ nop
-+#endif
- #if R5432_CP0_INTERRUPT_WAR
- mfc0 k0, CP0_INDEX
- #endif
---- a/arch/mips/mm/c-r4k.c
-+++ b/arch/mips/mm/c-r4k.c
-@@ -14,6 +14,12 @@
- #include <linux/mm.h>
- #include <linux/bitops.h>
-
-+#ifdef CONFIG_BCM4710
-+#include "../bcm947xx/include/typedefs.h"
-+#include "../bcm947xx/include/sbconfig.h"
-+#include <asm/paccess.h>
-+#endif
-+
- #include <asm/bcache.h>
- #include <asm/bootinfo.h>
- #include <asm/cacheops.h>
-@@ -40,6 +46,7 @@ static struct bcache_ops no_sc_ops = {
- .bc_inv = (void *)no_sc_noop
- };
-
-+int bcm4710 = 0;
- struct bcache_ops *bcops = &no_sc_ops;
-
- #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x2010)
-@@ -64,8 +71,10 @@ static inline void r4k_blast_dcache_page
- static inline void r4k_blast_dcache_page_setup(void)
- {
- unsigned long dc_lsize = current_cpu_data.dcache.linesz;
--
-- if (dc_lsize == 16)
-+
-+ if (bcm4710)
-+ r4k_blast_dcache_page = blast_dcache_page;
-+ else if (dc_lsize == 16)
- r4k_blast_dcache_page = blast_dcache16_page;
- else if (dc_lsize == 32)
- r4k_blast_dcache_page = r4k_blast_dcache_page_dc32;
-@@ -77,7 +86,9 @@ static void r4k_blast_dcache_page_indexe
- {
- unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-
-- if (dc_lsize == 16)
-+ if (bcm4710)
-+ r4k_blast_dcache_page_indexed = blast_dcache_page_indexed;
-+ else if (dc_lsize == 16)
- r4k_blast_dcache_page_indexed = blast_dcache16_page_indexed;
- else if (dc_lsize == 32)
- r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed;
-@@ -89,7 +100,9 @@ static inline void r4k_blast_dcache_setu
- {
- unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-
-- if (dc_lsize == 16)
-+ if (bcm4710)
-+ r4k_blast_dcache = blast_dcache;
-+ else if (dc_lsize == 16)
- r4k_blast_dcache = blast_dcache16;
- else if (dc_lsize == 32)
- r4k_blast_dcache = blast_dcache32;
-@@ -266,6 +279,7 @@ static void r4k___flush_cache_all(void)
- r4k_blast_dcache();
- r4k_blast_icache();
-
-+ if (!bcm4710)
- switch (current_cpu_data.cputype) {
- case CPU_R4000SC:
- case CPU_R4000MC:
-@@ -304,10 +318,10 @@ static void r4k_flush_cache_mm(struct mm
- * Kludge alert. For obscure reasons R4000SC and R4400SC go nuts if we
- * only flush the primary caches but R10000 and R12000 behave sane ...
- */
-- if (current_cpu_data.cputype == CPU_R4000SC ||
-+ if (!bcm4710 && (current_cpu_data.cputype == CPU_R4000SC ||
- current_cpu_data.cputype == CPU_R4000MC ||
- current_cpu_data.cputype == CPU_R4400SC ||
-- current_cpu_data.cputype == CPU_R4400MC)
-+ current_cpu_data.cputype == CPU_R4400MC))
- r4k_blast_scache();
- }
-
-@@ -383,12 +397,15 @@ static void r4k_flush_icache_range(unsig
- unsigned long ic_lsize = current_cpu_data.icache.linesz;
- unsigned long addr, aend;
-
-+ addr = start & ~(dc_lsize - 1);
-+ aend = (end - 1) & ~(dc_lsize - 1);
-+
- if (!cpu_has_ic_fills_f_dc) {
- if (end - start > dcache_size)
- r4k_blast_dcache();
- else {
-- addr = start & ~(dc_lsize - 1);
-- aend = (end - 1) & ~(dc_lsize - 1);
-+ BCM4710_PROTECTED_FILL_TLB(addr);
-+ BCM4710_PROTECTED_FILL_TLB(aend);
-
- while (1) {
- /* Hit_Writeback_Inv_D */
-@@ -403,8 +420,6 @@ static void r4k_flush_icache_range(unsig
- if (end - start > icache_size)
- r4k_blast_icache();
- else {
-- addr = start & ~(ic_lsize - 1);
-- aend = (end - 1) & ~(ic_lsize - 1);
- while (1) {
- /* Hit_Invalidate_I */
- protected_flush_icache_line(addr);
-@@ -413,6 +428,9 @@ static void r4k_flush_icache_range(unsig
- addr += ic_lsize;
- }
- }
-+
-+ if (bcm4710)
-+ flush_cache_all();
- }
-
- /*
-@@ -443,7 +461,8 @@ static void r4k_flush_icache_page(struct
- if (cpu_has_subset_pcaches) {
- unsigned long addr = (unsigned long) page_address(page);
-
-- r4k_blast_scache_page(addr);
-+ if (!bcm4710)
-+ r4k_blast_scache_page(addr);
- ClearPageDcacheDirty(page);
-
- return;
-@@ -451,6 +470,7 @@ static void r4k_flush_icache_page(struct
-
- if (!cpu_has_ic_fills_f_dc) {
- unsigned long addr = (unsigned long) page_address(page);
-+
- r4k_blast_dcache_page(addr);
- ClearPageDcacheDirty(page);
- }
-@@ -477,7 +497,7 @@ static void r4k_dma_cache_wback_inv(unsi
- /* Catch bad driver code */
- BUG_ON(size == 0);
-
-- if (cpu_has_subset_pcaches) {
-+ if (!bcm4710 && cpu_has_subset_pcaches) {
- unsigned long sc_lsize = current_cpu_data.scache.linesz;
-
- if (size >= scache_size) {
-@@ -509,6 +529,8 @@ static void r4k_dma_cache_wback_inv(unsi
- R4600_HIT_CACHEOP_WAR_IMPL;
- a = addr & ~(dc_lsize - 1);
- end = (addr + size - 1) & ~(dc_lsize - 1);
-+ BCM4710_FILL_TLB(a);
-+ BCM4710_FILL_TLB(end);
- while (1) {
- flush_dcache_line(a); /* Hit_Writeback_Inv_D */
- if (a == end)
-@@ -527,7 +549,7 @@ static void r4k_dma_cache_inv(unsigned l
- /* Catch bad driver code */
- BUG_ON(size == 0);
-
-- if (cpu_has_subset_pcaches) {
-+ if (!bcm4710 && (cpu_has_subset_pcaches)) {
- unsigned long sc_lsize = current_cpu_data.scache.linesz;
-
- if (size >= scache_size) {
-@@ -554,6 +576,8 @@ static void r4k_dma_cache_inv(unsigned l
- R4600_HIT_CACHEOP_WAR_IMPL;
- a = addr & ~(dc_lsize - 1);
- end = (addr + size - 1) & ~(dc_lsize - 1);
-+ BCM4710_FILL_TLB(a);
-+ BCM4710_FILL_TLB(end);
- while (1) {
- flush_dcache_line(a); /* Hit_Writeback_Inv_D */
- if (a == end)
-@@ -577,6 +601,8 @@ static void r4k_flush_cache_sigtramp(uns
- unsigned long dc_lsize = current_cpu_data.dcache.linesz;
-
- R4600_HIT_CACHEOP_WAR_IMPL;
-+ BCM4710_PROTECTED_FILL_TLB(addr);
-+ BCM4710_PROTECTED_FILL_TLB(addr + 4);
- protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
- protected_flush_icache_line(addr & ~(ic_lsize - 1));
- if (MIPS4K_ICACHE_REFILL_WAR) {
-@@ -986,10 +1012,12 @@ static void __init setup_scache(void)
- case CPU_R4000MC:
- case CPU_R4400SC:
- case CPU_R4400MC:
-- probe_scache_kseg1 = (probe_func_t) (KSEG1ADDR(&probe_scache));
-- sc_present = probe_scache_kseg1(config);
-- if (sc_present)
-- c->options |= MIPS_CPU_CACHE_CDEX_S;
-+ if (!bcm4710) {
-+ probe_scache_kseg1 = (probe_func_t) (KSEG1ADDR(&probe_scache));
-+ sc_present = probe_scache_kseg1(config);
-+ if (sc_present)
-+ c->options |= MIPS_CPU_CACHE_CDEX_S;
-+ }
- break;
-
- case CPU_R10000:
-@@ -1041,6 +1069,19 @@ static void __init setup_scache(void)
- static inline void coherency_setup(void)
- {
- change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT);
-+
-+#if defined(CONFIG_BCM4310) || defined(CONFIG_BCM4704) || defined(CONFIG_BCM5365)
-+ if (BCM330X(current_cpu_data.processor_id)) {
-+ uint32 cm;
-+
-+ cm = read_c0_diag();
-+ /* Enable icache */
-+ cm |= (1 << 31);
-+ /* Enable dcache */
-+ cm |= (1 << 30);
-+ write_c0_diag(cm);
-+ }
-+#endif
-
- /*
- * c0_status.cu=0 specifies that updates by the sc instruction use
-@@ -1073,6 +1114,12 @@ void __init ld_mmu_r4xx0(void)
- memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
- memcpy((void *)(KSEG1 + 0x100), &except_vec2_generic, 0x80);
-
-+ if (current_cpu_data.cputype == CPU_BCM4710 && (current_cpu_data.processor_id & PRID_REV_MASK) == 0) {
-+ printk("Enabling BCM4710A0 cache workarounds.\n");
-+ bcm4710 = 1;
-+ } else
-+ bcm4710 = 0;
-+
- probe_pcache();
- setup_scache();
-
---- a/arch/mips/mm/tlbex-mips32.S
-+++ b/arch/mips/mm/tlbex-mips32.S
-@@ -90,6 +90,9 @@
- .set noat
- LEAF(except_vec0_r4000)
- .set mips3
-+#ifdef CONFIG_BCM4704
-+ nop
-+#endif
- #ifdef CONFIG_SMP
- mfc0 k1, CP0_CONTEXT
- la k0, pgd_current
---- a/include/asm-mips/r4kcache.h
-+++ b/include/asm-mips/r4kcache.h
-@@ -15,6 +15,18 @@
- #include <asm/asm.h>
- #include <asm/cacheops.h>
-
-+#ifdef CONFIG_BCM4710
-+#define BCM4710_DUMMY_RREG() (((sbconfig_t *)(KSEG1ADDR(SB_ENUM_BASE + SBCONFIGOFF)))->sbimstate)
-+
-+#define BCM4710_FILL_TLB(addr) (*(volatile unsigned long *)(addr))
-+#define BCM4710_PROTECTED_FILL_TLB(addr) ({ unsigned long x; get_dbe(x, (volatile unsigned long *)(addr)); })
-+#else
-+#define BCM4710_DUMMY_RREG()
-+
-+#define BCM4710_FILL_TLB(addr)
-+#define BCM4710_PROTECTED_FILL_TLB(addr)
-+#endif
-+
- #define cache_op(op,addr) \
- __asm__ __volatile__( \
- " .set noreorder \n" \
-@@ -27,12 +39,25 @@
-
- static inline void flush_icache_line_indexed(unsigned long addr)
- {
-- cache_op(Index_Invalidate_I, addr);
-+ unsigned int way;
-+ unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
-+
-+ for (way = 0; way < current_cpu_data.dcache.ways; way++) {
-+ cache_op(Index_Invalidate_I, addr);
-+ addr += ws_inc;
-+ }
- }
-
- static inline void flush_dcache_line_indexed(unsigned long addr)
- {
-- cache_op(Index_Writeback_Inv_D, addr);
-+ unsigned int way;
-+ unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
-+
-+ for (way = 0; way < current_cpu_data.dcache.ways; way++) {
-+ BCM4710_DUMMY_RREG();
-+ cache_op(Index_Writeback_Inv_D, addr);
-+ addr += ws_inc;
-+ }
- }
-
- static inline void flush_scache_line_indexed(unsigned long addr)
-@@ -47,6 +72,7 @@ static inline void flush_icache_line(uns
-
- static inline void flush_dcache_line(unsigned long addr)
- {
-+ BCM4710_DUMMY_RREG();
- cache_op(Hit_Writeback_Inv_D, addr);
- }
-
-@@ -91,6 +117,7 @@ static inline void protected_flush_icach
- */
- static inline void protected_writeback_dcache_line(unsigned long addr)
- {
-+ BCM4710_DUMMY_RREG();
- __asm__ __volatile__(
- ".set noreorder\n\t"
- ".set mips3\n"
-@@ -138,6 +165,62 @@ static inline void invalidate_tcache_pag
- : "r" (base), \
- "i" (op));
-
-+#define cache_unroll(base,op) \
-+ __asm__ __volatile__(" \
-+ .set noreorder; \
-+ .set mips3; \
-+ cache %1, (%0); \
-+ .set mips0; \
-+ .set reorder" \
-+ : \
-+ : "r" (base), \
-+ "i" (op));
-+
-+
-+static inline void blast_dcache(void)
-+{
-+ unsigned long start = KSEG0;
-+ unsigned long dcache_size = current_cpu_data.dcache.waysize * current_cpu_data.dcache.ways;
-+ unsigned long end = (start + dcache_size);
-+
-+ while(start < end) {
-+ BCM4710_DUMMY_RREG();
-+ cache_unroll(start,Index_Writeback_Inv_D);
-+ start += current_cpu_data.dcache.linesz;
-+ }
-+}
-+
-+static inline void blast_dcache_page(unsigned long page)
-+{
-+ unsigned long start = page;
-+ unsigned long end = start + PAGE_SIZE;
-+
-+ BCM4710_FILL_TLB(start);
-+ do {
-+ BCM4710_DUMMY_RREG();
-+ cache_unroll(start,Hit_Writeback_Inv_D);
-+ start += current_cpu_data.dcache.linesz;
-+ } while (start < end);
-+}
-+
-+static inline void blast_dcache_page_indexed(unsigned long page)
-+{
-+ unsigned long start = page;
-+ unsigned long end = start + PAGE_SIZE;
-+ unsigned long ws_inc = 1UL << current_cpu_data.dcache.waybit;
-+ unsigned long ws_end = current_cpu_data.dcache.ways <<
-+ current_cpu_data.dcache.waybit;
-+ unsigned long ws, addr;
-+
-+ for (ws = 0; ws < ws_end; ws += ws_inc) {
-+ start = page + ws;
-+ for (addr = start; addr < end; addr += current_cpu_data.dcache.linesz) {
-+ BCM4710_DUMMY_RREG();
-+ cache_unroll(addr,Index_Writeback_Inv_D);
-+ }
-+ }
-+}
-+
- static inline void blast_dcache16(void)
- {
- unsigned long start = KSEG0;
-@@ -148,8 +231,9 @@ static inline void blast_dcache16(void)
- unsigned long ws, addr;
-
- for (ws = 0; ws < ws_end; ws += ws_inc)
-- for (addr = start; addr < end; addr += 0x200)
-+ for (addr = start; addr < end; addr += 0x200) {
- cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
-+ }
- }
-
- static inline void blast_dcache16_page(unsigned long page)
-@@ -173,8 +257,9 @@ static inline void blast_dcache16_page_i
- unsigned long ws, addr;
-
- for (ws = 0; ws < ws_end; ws += ws_inc)
-- for (addr = start; addr < end; addr += 0x200)
-+ for (addr = start; addr < end; addr += 0x200) {
- cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
-+ }
- }
-
- static inline void blast_icache16(void)
-@@ -196,6 +281,7 @@ static inline void blast_icache16_page(u
- unsigned long start = page;
- unsigned long end = start + PAGE_SIZE;
-
-+ BCM4710_FILL_TLB(start);
- do {
- cache16_unroll32(start,Hit_Invalidate_I);
- start += 0x200;
-@@ -281,6 +367,7 @@ static inline void blast_scache16_page_i
- : "r" (base), \
- "i" (op));
-
-+
- static inline void blast_dcache32(void)
- {
- unsigned long start = KSEG0;
-@@ -291,8 +378,9 @@ static inline void blast_dcache32(void)
- unsigned long ws, addr;
-
- for (ws = 0; ws < ws_end; ws += ws_inc)
-- for (addr = start; addr < end; addr += 0x400)
-+ for (addr = start; addr < end; addr += 0x400) {
- cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
-+ }
- }
-
- static inline void blast_dcache32_page(unsigned long page)
-@@ -316,8 +404,9 @@ static inline void blast_dcache32_page_i
- unsigned long ws, addr;
-
- for (ws = 0; ws < ws_end; ws += ws_inc)
-- for (addr = start; addr < end; addr += 0x400)
-+ for (addr = start; addr < end; addr += 0x400) {
- cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
-+ }
- }
-
- static inline void blast_icache32(void)
-@@ -339,6 +428,7 @@ static inline void blast_icache32_page(u
- unsigned long start = page;
- unsigned long end = start + PAGE_SIZE;
-
-+ BCM4710_FILL_TLB(start);
- do {
- cache32_unroll32(start,Hit_Invalidate_I);
- start += 0x400;
-@@ -443,6 +533,7 @@ static inline void blast_icache64_page(u
- unsigned long start = page;
- unsigned long end = start + PAGE_SIZE;
-
-+ BCM4710_FILL_TLB(start);
- do {
- cache64_unroll32(start,Hit_Invalidate_I);
- start += 0x800;
---- a/include/asm-mips/stackframe.h
-+++ b/include/asm-mips/stackframe.h
-@@ -209,6 +209,20 @@
-
- #endif
-
-+#if defined(CONFIG_BCM4710) || defined(CONFIG_BCM4704)
-+
-+#undef RESTORE_SP_AND_RET
-+#define RESTORE_SP_AND_RET \
-+ lw sp, PT_R29(sp); \
-+ .set mips3; \
-+ nop; \
-+ nop; \
-+ eret; \
-+ .set mips0
-+
-+#endif
-+
-+
- #define RESTORE_SP \
- lw sp, PT_R29(sp); \
-
---- a/mm/memory.c
-+++ b/mm/memory.c
-@@ -927,6 +927,7 @@ static inline void break_cow(struct vm_a
- flush_page_to_ram(new_page);
- flush_cache_page(vma, address);
- establish_pte(vma, address, page_table, pte_mkwrite(pte_mkdirty(mk_pte(new_page, vma->vm_page_prot))));
-+ flush_icache_page(vma, new_page);
- }
-
- /*
diff --git a/target/linux/brcm-2.4/patches/004-flash.patch b/target/linux/brcm-2.4/patches/004-flash.patch
deleted file mode 100644
index cbcf0da3bb..0000000000
--- a/target/linux/brcm-2.4/patches/004-flash.patch
+++ /dev/null
@@ -1,68 +0,0 @@
---- a/arch/mips/bcm947xx/Makefile
-+++ b/arch/mips/bcm947xx/Makefile
-@@ -11,6 +11,7 @@ export-objs := export.o
- obj-y := prom.o setup.o time.o sbmips.o gpio.o
- obj-y += nvram.o cfe_env.o hndpmu.o
- obj-y += sbutils.o utils.o bcmsrom.o hndchipc.o
-+obj-y += sflash.o
- obj-$(CONFIG_PCI) += sbpci.o pcibios.o
- obj-y += export.o
-
---- a/drivers/mtd/devices/Config.in
-+++ b/drivers/mtd/devices/Config.in
-@@ -5,6 +5,7 @@
- mainmenu_option next_comment
-
- comment 'Self-contained MTD device drivers'
-+bool ' Broadcom Chipcommon Serial Flash support' CONFIG_MTD_SFLASH
- dep_tristate ' Ramix PMC551 PCI Mezzanine RAM card support' CONFIG_MTD_PMC551 $CONFIG_MTD $CONFIG_PCI
- if [ "$CONFIG_MTD_PMC551" = "y" -o "$CONFIG_MTD_PMC551" = "m" ]; then
- bool ' PMC551 256M DRAM Bugfix' CONFIG_MTD_PMC551_BUGFIX
---- a/drivers/mtd/devices/Makefile
-+++ b/drivers/mtd/devices/Makefile
-@@ -3,6 +3,8 @@
- #
- # $Id: Makefile,v 1.4 2001/06/26 21:10:05 spse Exp $
-
-+EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include
-+
- O_TARGET := devlink.o
-
- # *** BIG UGLY NOTE ***
-@@ -12,6 +14,7 @@ O_TARGET := devlink.o
- # here where previously there was none. We now have to ensure that
- # doc200[01].o are linked before docprobe.o
-
-+obj-$(CONFIG_MTD_SFLASH) += sflash.o
- obj-$(CONFIG_MTD_DOC1000) += doc1000.o
- obj-$(CONFIG_MTD_DOC2000) += doc2000.o
- obj-$(CONFIG_MTD_DOC2001) += doc2001.o
---- a/drivers/mtd/maps/Config.in
-+++ b/drivers/mtd/maps/Config.in
-@@ -48,6 +48,7 @@ if [ "$CONFIG_PPC" = "y" ]; then
- fi
-
- if [ "$CONFIG_MIPS" = "y" ]; then
-+ dep_tristate ' CFI Flash device mapped on Broadcom BCM947XX boards' CONFIG_MTD_BCM947XX $CONFIG_MTD_CFI
- dep_tristate ' Pb1000 MTD support' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000
- dep_tristate ' Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500
- dep_tristate ' Pb1100 MTD support' CONFIG_MTD_PB1100 $CONFIG_MIPS_PB1100
---- a/drivers/mtd/maps/Makefile
-+++ b/drivers/mtd/maps/Makefile
-@@ -3,6 +3,8 @@
- #
- # $Id: Makefile,v 1.37 2003/01/24 14:26:38 dwmw2 Exp $
-
-+EXTRA_CFLAGS := -I$(TOPDIR)/arch/mips/bcm947xx/include
-+
- BELOW25 := $(shell echo $(PATCHLEVEL) | sed s/[1234]/y/)
-
- ifeq ($(BELOW25),y)
-@@ -10,6 +12,7 @@ O_TARGET := mapslink.o
- endif
-
- # Chip mappings
-+obj-$(CONFIG_MTD_BCM947XX) += bcm947xx-flash.o
- obj-$(CONFIG_MTD_CDB89712) += cdb89712.o
- obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o
- obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o
diff --git a/target/linux/brcm-2.4/patches/005-bluetooth_sco_buffer_align.patch b/target/linux/brcm-2.4/patches/005-bluetooth_sco_buffer_align.patch
deleted file mode 100644
index 7fd1fb1604..0000000000
--- a/target/linux/brcm-2.4/patches/005-bluetooth_sco_buffer_align.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/bluetooth/hci_usb.c
-+++ b/drivers/bluetooth/hci_usb.c
-@@ -259,6 +259,9 @@ static int hci_usb_isoc_rx_submit(struct
- void *buf;
-
- mtu = husb->isoc_in_ep->wMaxPacketSize;
-+#ifdef CONFIG_BCM4710
-+ mtu = (mtu + 1) & ~1; /* brcm: isoc buffers must be aligned on word boundary */
-+#endif
- size = mtu * HCI_MAX_ISOC_FRAMES;
-
- buf = kmalloc(size, GFP_ATOMIC);
diff --git a/target/linux/brcm-2.4/patches/006-ide_workaround.patch b/target/linux/brcm-2.4/patches/006-ide_workaround.patch
deleted file mode 100644
index f77aa64c69..0000000000
--- a/target/linux/brcm-2.4/patches/006-ide_workaround.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/arch/mips/lib/ide-std.c
-+++ b/arch/mips/lib/ide-std.c
-@@ -31,12 +31,14 @@ static int std_ide_default_irq(ide_ioreg
- static ide_ioreg_t std_ide_default_io_base(int index)
- {
- switch (index) {
-+#if 0
- case 0: return 0x1f0;
- case 1: return 0x170;
- case 2: return 0x1e8;
- case 3: return 0x168;
- case 4: return 0x1e0;
- case 5: return 0x160;
-+#endif
- default:
- return 0;
- }
diff --git a/target/linux/brcm-2.4/patches/008-b44_bcm47xx_support.patch b/target/linux/brcm-2.4/patches/008-b44_bcm47xx_support.patch
deleted file mode 100644
index 28d54e9b96..0000000000
--- a/target/linux/brcm-2.4/patches/008-b44_bcm47xx_support.patch
+++ /dev/null
@@ -1,580 +0,0 @@
---- a/drivers/net/b44.c
-+++ b/drivers/net/b44.c
-@@ -1,7 +1,9 @@
- /* b44.c: Broadcom 4400 device driver.
- *
- * Copyright (C) 2002 David S. Miller (davem@redhat.com)
-- * Fixed by Pekka Pietikainen (pp@ee.oulu.fi)
-+ * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi)
-+ * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
-+ * Copyright (C) 2006 Felix Fietkau (nbd@openwrt.org)
- *
- * Distribute under GPL.
- */
-@@ -25,6 +27,39 @@
-
- #include "b44.h"
-
-+#include <typedefs.h>
-+#include <bcmdevs.h>
-+#include <osl.h>
-+#include <bcmnvram.h>
-+#include <sbconfig.h>
-+#include <sbchipc.h>
-+#include <sflash.h>
-+
-+#ifdef CONFIG_BCM947XX
-+#define atoi(str) simple_strtoul(((str != NULL) ? str : ""), NULL, 0)
-+
-+static inline void e_aton(char *str, char *dest)
-+{
-+ int i = 0;
-+ u16 *d = (u16 *) dest;
-+
-+ if (str == NULL) {
-+ memset(dest, 0, 6);
-+ return;
-+ }
-+
-+ for (;;) {
-+ dest[i++] = (char) simple_strtoul(str, NULL, 16);
-+ str += 2;
-+ if (!*str++ || i == 6)
-+ break;
-+ }
-+}
-+
-+static int instance = 0;
-+#endif
-+
-+
- #define DRV_MODULE_NAME "b44"
- #define PFX DRV_MODULE_NAME ": "
- #define DRV_MODULE_VERSION "0.93"
-@@ -75,7 +110,7 @@ static char version[] __devinitdata =
- DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
-
- MODULE_AUTHOR("David S. Miller (davem@redhat.com)");
--MODULE_DESCRIPTION("Broadcom 4400 10/100 PCI ethernet driver");
-+MODULE_DESCRIPTION("Broadcom 4400/47xx 10/100 PCI ethernet driver");
- MODULE_LICENSE("GPL");
- MODULE_PARM(b44_debug, "i");
- MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
-@@ -89,6 +124,8 @@ static struct pci_device_id b44_pci_tbl[
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
- { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401B1,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
-+ { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4713,
-+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
- { } /* terminate list with empty entry */
- };
-
-@@ -113,11 +150,13 @@ static int b44_wait_bit(struct b44 *bp,
- udelay(10);
- }
- if (i == timeout) {
-+#ifdef DEBUG
- printk(KERN_ERR PFX "%s: BUG! Timeout waiting for bit %08x of register "
- "%lx to %s.\n",
- bp->dev->name,
- bit, reg,
- (clear ? "clear" : "set"));
-+#endif
- return -ENODEV;
- }
- return 0;
-@@ -236,6 +275,8 @@ static void ssb_core_reset(struct b44 *b
- udelay(1);
- }
-
-+static int b44_4713_instance;
-+
- static int ssb_core_unit(struct b44 *bp)
- {
- #if 0
-@@ -258,6 +299,9 @@ static int ssb_core_unit(struct b44 *bp)
- break;
- };
- #endif
-+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
-+ return b44_4713_instance++;
-+ else
- return 0;
- }
-
-@@ -267,6 +311,28 @@ static int ssb_is_core_up(struct b44 *bp
- == SBTMSLOW_CLOCK);
- }
-
-+static inline void __b44_cam_read(struct b44 *bp, unsigned char *data, int index)
-+{
-+ u32 val;
-+
-+ bw32(B44_CAM_CTRL, (CAM_CTRL_READ |
-+ (index << CAM_CTRL_INDEX_SHIFT)));
-+
-+ b44_wait_bit(bp, B44_CAM_CTRL, CAM_CTRL_BUSY, 100, 1);
-+
-+ val = br32(B44_CAM_DATA_LO);
-+
-+ data[2] = (val >> 24) & 0xFF;
-+ data[3] = (val >> 16) & 0xFF;
-+ data[4] = (val >> 8) & 0xFF;
-+ data[5] = (val >> 0) & 0xFF;
-+
-+ val = br32(B44_CAM_DATA_HI);
-+
-+ data[0] = (val >> 8) & 0xFF;
-+ data[1] = (val >> 0) & 0xFF;
-+}
-+
- static void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
- {
- u32 val;
-@@ -287,7 +353,7 @@ static void __b44_cam_write(struct b44 *
-
- static inline void __b44_disable_ints(struct b44 *bp)
- {
-- bw32(B44_IMASK, 0);
-+ bw32(B44_IMASK, ISTAT_TO); /* leave the timeout interrupt active */
- }
-
- static void b44_disable_ints(struct b44 *bp)
-@@ -303,14 +369,14 @@ static void b44_enable_ints(struct b44 *
- bw32(B44_IMASK, bp->imask);
- }
-
--static int b44_readphy(struct b44 *bp, int reg, u32 *val)
-+static int __b44_readphy(struct b44 *bp, int phy_addr, int reg, u32 *val)
- {
- int err;
-
- bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
- bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
- (MDIO_OP_READ << MDIO_DATA_OP_SHIFT) |
-- (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
-+ (phy_addr << MDIO_DATA_PMD_SHIFT) |
- (reg << MDIO_DATA_RA_SHIFT) |
- (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT)));
- err = b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
-@@ -319,23 +385,42 @@ static int b44_readphy(struct b44 *bp, i
- return err;
- }
-
--static int b44_writephy(struct b44 *bp, int reg, u32 val)
-+static int b44_readphy(struct b44 *bp, int reg, u32 *val)
-+{
-+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
-+ return 0;
-+
-+ return __b44_readphy(bp, bp->phy_addr, reg, val);
-+}
-+
-+static int __b44_writephy(struct b44 *bp, int phy_addr, int reg, u32 val)
- {
- bw32(B44_EMAC_ISTAT, EMAC_INT_MII);
- bw32(B44_MDIO_DATA, (MDIO_DATA_SB_START |
- (MDIO_OP_WRITE << MDIO_DATA_OP_SHIFT) |
-- (bp->phy_addr << MDIO_DATA_PMD_SHIFT) |
-+ (phy_addr << MDIO_DATA_PMD_SHIFT) |
- (reg << MDIO_DATA_RA_SHIFT) |
- (MDIO_TA_VALID << MDIO_DATA_TA_SHIFT) |
- (val & MDIO_DATA_DATA)));
- return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
- }
-
-+static int b44_writephy(struct b44 *bp, int reg, u32 val)
-+{
-+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
-+ return 0;
-+
-+ return __b44_writephy(bp, bp->phy_addr, reg, val);
-+}
-+
- static int b44_phy_reset(struct b44 *bp)
- {
- u32 val;
- int err;
-
-+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
-+ return 0;
-+
- err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
- if (err)
- return err;
-@@ -406,6 +491,23 @@ static int b44_setup_phy(struct b44 *bp)
- u32 val;
- int err;
-
-+
-+ /*
-+ * workaround for bad hardware design in Linksys WAP54G v1.0
-+ * see https://dev.openwrt.org/ticket/146
-+ * check and reset bit "isolate"
-+ */
-+ if ((bp->pdev->device == PCI_DEVICE_ID_BCM4713) &&
-+ (atoi(nvram_get("boardnum")) == 2) &&
-+ (__b44_readphy(bp, 0, MII_BMCR, &val) == 0) &&
-+ (val & BMCR_ISOLATE) &&
-+ (__b44_writephy(bp, 0, MII_BMCR, val & ~BMCR_ISOLATE) != 0)) {
-+ printk(KERN_WARNING PFX "PHY: cannot reset MII transceiver isolate bit.\n");
-+ }
-+
-+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
-+ return 0;
-+
- if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
- goto out;
- if ((err = b44_writephy(bp, B44_MII_ALEDCTRL,
-@@ -498,6 +600,19 @@ static void b44_check_phy(struct b44 *bp
- {
- u32 bmsr, aux;
-
-+ if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
-+ bp->flags |= B44_FLAG_100_BASE_T;
-+ bp->flags |= B44_FLAG_FULL_DUPLEX;
-+ if (!netif_carrier_ok(bp->dev)) {
-+ u32 val = br32(B44_TX_CTRL);
-+ val |= TX_CTRL_DUPLEX;
-+ bw32(B44_TX_CTRL, val);
-+ netif_carrier_on(bp->dev);
-+ b44_link_report(bp);
-+ }
-+ return;
-+ }
-+
- if (!b44_readphy(bp, MII_BMSR, &bmsr) &&
- !b44_readphy(bp, B44_MII_AUXCTRL, &aux) &&
- (bmsr != 0xffff)) {
-@@ -765,6 +880,25 @@ static int b44_rx(struct b44 *bp, int bu
- return received;
- }
-
-+
-+static inline void __b44_reset(struct b44 *bp)
-+{
-+ spin_lock_irq(&bp->lock);
-+ b44_halt(bp);
-+ b44_init_rings(bp);
-+ b44_init_hw(bp);
-+ spin_unlock_irq(&bp->lock);
-+
-+ b44_enable_ints(bp);
-+ netif_wake_queue(bp->dev);
-+}
-+
-+static inline void __b44_set_timeout(struct b44 *bp, int timeout)
-+{
-+ /* Set timeout for Rx to two seconds after the last Tx */
-+ bw32(B44_GPTIMER, timeout ? 2 * 125000000 : 0);
-+}
-+
- static int b44_poll(struct net_device *netdev, int *budget)
- {
- struct b44 *bp = netdev->priv;
-@@ -772,13 +906,13 @@ static int b44_poll(struct net_device *n
-
- spin_lock_irq(&bp->lock);
-
-- if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
-+ if (bp->istat & ISTAT_TX) {
- /* spin_lock(&bp->tx_lock); */
- b44_tx(bp);
- /* spin_unlock(&bp->tx_lock); */
- }
- spin_unlock_irq(&bp->lock);
--
-+
- done = 1;
- if (bp->istat & ISTAT_RX) {
- int orig_budget = *budget;
-@@ -796,24 +930,18 @@ static int b44_poll(struct net_device *n
- done = 0;
- }
-
-- if (bp->istat & ISTAT_ERRORS) {
-- spin_lock_irq(&bp->lock);
-- b44_halt(bp);
-- b44_init_rings(bp);
-- b44_init_hw(bp);
-- netif_wake_queue(bp->dev);
-- spin_unlock_irq(&bp->lock);
-- done = 1;
-- }
--
- if (done) {
- netif_rx_complete(netdev);
- b44_enable_ints(bp);
- }
-
-+ if ((bp->core_unit == 1) && (bp->istat & (ISTAT_TX | ISTAT_RX)))
-+ __b44_set_timeout(bp, (bp->istat & ISTAT_TX) ? 1 : 0);
-+
- return (done ? 0 : 1);
- }
-
-+
- static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs)
- {
- struct net_device *dev = dev_id;
-@@ -832,6 +960,18 @@ static irqreturn_t b44_interrupt(int irq
- */
- istat &= imask;
- if (istat) {
-+ /* Workaround for the WL-500g WAN port hang */
-+ if (istat & (ISTAT_TO | ISTAT_ERRORS)) {
-+ /*
-+ * no rx before the watchdog timeout
-+ * reset the interface
-+ */
-+ __b44_reset(bp);
-+ }
-+
-+ if ((bp->core_unit == 1) && (bp->istat & (ISTAT_TX | ISTAT_RX)))
-+ __b44_set_timeout(bp, (bp->istat & ISTAT_TX) ? 1 : 0);
-+
- handled = 1;
- if (netif_rx_schedule_prep(dev)) {
- /* NOTE: These writes are posted by the readback of
-@@ -848,6 +988,7 @@ static irqreturn_t b44_interrupt(int irq
- bw32(B44_ISTAT, istat);
- br32(B44_ISTAT);
- }
-+
- spin_unlock_irqrestore(&bp->lock, flags);
- return IRQ_RETVAL(handled);
- }
-@@ -859,16 +1000,7 @@ static void b44_tx_timeout(struct net_de
- printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
- dev->name);
-
-- spin_lock_irq(&bp->lock);
--
-- b44_halt(bp);
-- b44_init_rings(bp);
-- b44_init_hw(bp);
--
-- spin_unlock_irq(&bp->lock);
--
-- b44_enable_ints(bp);
--
-+ __b44_reset(bp);
- netif_wake_queue(dev);
- }
-
-@@ -1092,6 +1224,8 @@ static void b44_clear_stats(struct b44 *
- /* bp->lock is held. */
- static void b44_chip_reset(struct b44 *bp)
- {
-+ unsigned int sb_clock;
-+
- if (ssb_is_core_up(bp)) {
- bw32(B44_RCV_LAZY, 0);
- bw32(B44_ENET_CTRL, ENET_CTRL_DISABLE);
-@@ -1105,9 +1239,10 @@ static void b44_chip_reset(struct b44 *b
- bw32(B44_DMARX_CTRL, 0);
- bp->rx_prod = bp->rx_cons = 0;
- } else {
-- ssb_pci_setup(bp, (bp->core_unit == 0 ?
-- SBINTVEC_ENET0 :
-- SBINTVEC_ENET1));
-+ /*if (bp->pdev->device != PCI_DEVICE_ID_BCM4713)*/
-+ ssb_pci_setup(bp, (bp->core_unit == 0 ?
-+ SBINTVEC_ENET0 :
-+ SBINTVEC_ENET1));
- }
-
- ssb_core_reset(bp);
-@@ -1115,6 +1250,11 @@ static void b44_chip_reset(struct b44 *b
- b44_clear_stats(bp);
-
- /* Make PHY accessible. */
-+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713)
-+ sb_clock = 100000000; /* 100 MHz */
-+ else
-+ sb_clock = 62500000; /* 62.5 MHz */
-+
- bw32(B44_MDIO_CTRL, (MDIO_CTRL_PREAMBLE |
- (0x0d & MDIO_CTRL_MAXF_MASK)));
- br32(B44_MDIO_CTRL);
-@@ -1216,6 +1356,8 @@ static int b44_open(struct net_device *d
- struct b44 *bp = dev->priv;
- int err;
-
-+ netif_carrier_off(dev);
-+
- err = b44_alloc_consistent(bp);
- if (err)
- return err;
-@@ -1236,9 +1378,10 @@ static int b44_open(struct net_device *d
- bp->timer.expires = jiffies + HZ;
- bp->timer.data = (unsigned long) bp;
- bp->timer.function = b44_timer;
-- add_timer(&bp->timer);
-+ b44_timer((unsigned long) bp);
-
- b44_enable_ints(bp);
-+ netif_start_queue(dev);
-
- return 0;
-
-@@ -1638,7 +1781,7 @@ static int b44_ioctl(struct net_device *
- u32 mii_regval;
-
- spin_lock_irq(&bp->lock);
-- err = b44_readphy(bp, data->reg_num & 0x1f, &mii_regval);
-+ err = __b44_readphy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, &mii_regval);
- spin_unlock_irq(&bp->lock);
-
- data->val_out = mii_regval;
-@@ -1651,7 +1794,7 @@ static int b44_ioctl(struct net_device *
- return -EPERM;
-
- spin_lock_irq(&bp->lock);
-- err = b44_writephy(bp, data->reg_num & 0x1f, data->val_in);
-+ err = __b44_writephy(bp, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
- spin_unlock_irq(&bp->lock);
-
- return err;
-@@ -1678,21 +1821,52 @@ static int b44_read_eeprom(struct b44 *b
- static int __devinit b44_get_invariants(struct b44 *bp)
- {
- u8 eeprom[128];
-+ u8 buf[32];
- int err;
-+ unsigned long flags;
-
-- err = b44_read_eeprom(bp, &eeprom[0]);
-- if (err)
-- goto out;
--
-- bp->dev->dev_addr[0] = eeprom[79];
-- bp->dev->dev_addr[1] = eeprom[78];
-- bp->dev->dev_addr[2] = eeprom[81];
-- bp->dev->dev_addr[3] = eeprom[80];
-- bp->dev->dev_addr[4] = eeprom[83];
-- bp->dev->dev_addr[5] = eeprom[82];
--
-- bp->phy_addr = eeprom[90] & 0x1f;
-- bp->mdc_port = (eeprom[90] >> 14) & 0x1;
-+ if (bp->pdev->device == PCI_DEVICE_ID_BCM4713) {
-+#ifdef CONFIG_BCM947XX
-+ sprintf(buf, "et%dmacaddr", instance - 1);
-+ e_aton(nvram_get(buf), bp->dev->dev_addr);
-+
-+ sprintf(buf, "et%dphyaddr", instance - 1);
-+ bp->phy_addr = B44_PHY_ADDR_NO_PHY;
-+#else
-+ /*
-+ * BCM47xx boards don't have a EEPROM. The MAC is stored in
-+ * a NVRAM area somewhere in the flash memory. As we don't
-+ * know the location and/or the format of the NVRAM area
-+ * here, we simply rely on the bootloader to write the
-+ * MAC into the CAM.
-+ */
-+ spin_lock_irqsave(&bp->lock, flags);
-+ __b44_cam_read(bp, bp->dev->dev_addr, 0);
-+ spin_unlock_irqrestore(&bp->lock, flags);
-+
-+ /*
-+ * BCM47xx boards don't have a PHY. Usually there is a switch
-+ * chip with multiple PHYs connected to the PHY port.
-+ */
-+ bp->phy_addr = B44_PHY_ADDR_NO_PHY;
-+#endif
-+ bp->dma_offset = 0;
-+ } else {
-+ err = b44_read_eeprom(bp, &eeprom[0]);
-+ if (err)
-+ return err;
-+
-+ bp->dev->dev_addr[0] = eeprom[79];
-+ bp->dev->dev_addr[1] = eeprom[78];
-+ bp->dev->dev_addr[2] = eeprom[81];
-+ bp->dev->dev_addr[3] = eeprom[80];
-+ bp->dev->dev_addr[4] = eeprom[83];
-+ bp->dev->dev_addr[5] = eeprom[82];
-+
-+ bp->phy_addr = eeprom[90] & 0x1f;
-+ bp->dma_offset = SB_PCI_DMA;
-+ bp->mdc_port = (eeprom[90] >> 14) & 0x1;
-+ }
-
- /* With this, plus the rx_header prepended to the data by the
- * hardware, we'll land the ethernet header on a 2-byte boundary.
-@@ -1702,13 +1876,12 @@ static int __devinit b44_get_invariants(
- bp->imask = IMASK_DEF;
-
- bp->core_unit = ssb_core_unit(bp);
-- bp->dma_offset = ssb_get_addr(bp, SBID_PCI_DMA, 0);
-
- /* XXX - really required?
- bp->flags |= B44_FLAG_BUGGY_TXPTR;
- */
--out:
-- return err;
-+
-+ return 0;
- }
-
- static int __devinit b44_init_one(struct pci_dev *pdev,
-@@ -1720,6 +1893,10 @@ static int __devinit b44_init_one(struct
- struct b44 *bp;
- int err, i;
-
-+#ifdef CONFIG_BCM947XX
-+ instance++;
-+#endif
-+
- if (b44_version_printed++ == 0)
- printk(KERN_INFO "%s", version);
-
-@@ -1834,11 +2011,17 @@ static int __devinit b44_init_one(struct
- */
- b44_chip_reset(bp);
-
-- printk(KERN_INFO "%s: Broadcom 4400 10/100BaseT Ethernet ", dev->name);
-+ printk(KERN_INFO "%s: Broadcom %s 10/100BaseT Ethernet ", dev->name,
-+ (pdev->device == PCI_DEVICE_ID_BCM4713) ? "47xx" : "4400");
- for (i = 0; i < 6; i++)
- printk("%2.2x%c", dev->dev_addr[i],
- i == 5 ? '\n' : ':');
-
-+ /* Initialize phy */
-+ spin_lock_irq(&bp->lock);
-+ b44_chip_reset(bp);
-+ spin_unlock_irq(&bp->lock);
-+
- return 0;
-
- err_out_iounmap:
---- a/drivers/net/b44.h
-+++ b/drivers/net/b44.h
-@@ -229,8 +229,6 @@
- #define SBIPSFLAG_IMASK4 0x3f000000 /* Which sbflags --> mips interrupt 4 */
- #define SBIPSFLAG_ISHIFT4 24
- #define B44_SBTPSFLAG 0x0F18UL /* SB Target Port OCP Slave Flag */
--#define SBTPS_NUM0_MASK 0x0000003f
--#define SBTPS_F0EN0 0x00000040
- #define B44_SBADMATCH3 0x0F60UL /* SB Address Match 3 */
- #define B44_SBADMATCH2 0x0F68UL /* SB Address Match 2 */
- #define B44_SBADMATCH1 0x0F70UL /* SB Address Match 1 */
-@@ -461,6 +459,8 @@ struct ring_info {
- };
-
- #define B44_MCAST_TABLE_SIZE 32
-+#define B44_PHY_ADDR_NO_PHY 30
-+#define B44_MDC_RATIO 5000000
-
- /* SW copy of device statistics, kept up to date by periodic timer
- * which probes HW values. Must have same relative layout as HW
---- a/include/linux/pci_ids.h
-+++ b/include/linux/pci_ids.h
-@@ -1765,6 +1765,7 @@
- #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e
- #define PCI_DEVICE_ID_BCM4401 0x4401
- #define PCI_DEVICE_ID_BCM4401B0 0x4402
-+#define PCI_DEVICE_ID_BCM4713 0x4713
-
- #define PCI_VENDOR_ID_ENE 0x1524
- #define PCI_DEVICE_ID_ENE_1211 0x1211
diff --git a/target/linux/brcm-2.4/patches/009-wrt54g3g_pcmcia.patch b/target/linux/brcm-2.4/patches/009-wrt54g3g_pcmcia.patch
deleted file mode 100644
index 81b5ee80c5..0000000000
--- a/target/linux/brcm-2.4/patches/009-wrt54g3g_pcmcia.patch
+++ /dev/null
@@ -1,84 +0,0 @@
---- a/drivers/pcmcia/yenta.c
-+++ b/drivers/pcmcia/yenta.c
-@@ -543,6 +543,9 @@ static unsigned int yenta_probe_irq(pci_
- * Probe for usable interrupts using the force
- * register to generate bogus card status events.
- */
-+
-+#ifndef CONFIG_BCM947XX
-+ /* WRT54G3G does not like this */
- cb_writel(socket, CB_SOCKET_EVENT, -1);
- cb_writel(socket, CB_SOCKET_MASK, CB_CSTSMASK);
- exca_writeb(socket, I365_CSCINT, 0);
-@@ -557,7 +560,8 @@ static unsigned int yenta_probe_irq(pci_
- }
- cb_writel(socket, CB_SOCKET_MASK, 0);
- exca_writeb(socket, I365_CSCINT, 0);
--
-+#endif
-+
- mask = probe_irq_mask(val) & 0xffff;
-
- bridge_ctrl &= ~CB_BRIDGE_INTR;
-@@ -578,6 +582,12 @@ static void yenta_get_socket_capabilitie
- socket->cap.cb_dev = socket->dev;
- socket->cap.bus = NULL;
-
-+#ifdef CONFIG_BCM947XX
-+ /* irq mask probing is broken for the WRT54G3G */
-+ if (socket->cap.irq_mask == 0)
-+ socket->cap.irq_mask = 0x6f8;
-+#endif
-+
- printk(KERN_INFO "Yenta ISA IRQ mask 0x%04x, PCI irq %d\n",
- socket->cap.irq_mask, socket->cb_irq);
- }
-@@ -609,6 +619,15 @@ static void yenta_open_bh(void * data)
- printk(KERN_INFO "Socket status: %08x\n",
- cb_readl(socket, CB_SOCKET_STATE));
-
-+ /* Generate an interrupt on card insert/remove */
-+ config_writew(socket, CB_SOCKET_MASK, CB_CSTSMASK | CB_CDMASK);
-+
-+ /* Set up Multifunction Routing Status Register */
-+ config_writew(socket, 0x8C, 0x1000 /* MFUNC3 to GPIO3 */ | 0x2 /* MFUNC0 to INTA */);
-+
-+ /* Switch interrupts to parallelized */
-+ config_writeb(socket, 0x92, 0x64);
-+
- /* Register it with the pcmcia layer.. */
- cardbus_register(socket);
-
-@@ -731,7 +750,7 @@ static void yenta_allocate_res(pci_socke
- {
- struct pci_bus *bus;
- struct resource *root, *res;
-- u32 start, end;
-+ u32 start = 0, end = 0;
- u32 align, size, min, max;
- unsigned offset;
- unsigned mask;
-@@ -750,6 +769,15 @@ static void yenta_allocate_res(pci_socke
- res->end = 0;
- root = pci_find_parent_resource(socket->dev, res);
-
-+#ifdef CONFIG_BCM947XX
-+ /* default mem resources are completely fscked up on the wrt54g3g */
-+ /* bypass the entire resource allocation stuff below and just set it statically */
-+ if (type & IORESOURCE_MEM) {
-+ res->start = 0x40004000;
-+ res->end = res->start + 0x3fff;
-+ }
-+
-+#else
- if (!root)
- return;
-
-@@ -794,6 +822,7 @@ static void yenta_allocate_res(pci_socke
- res->start = res->end = 0;
- return;
- }
-+#endif
-
- config_writel(socket, offset, res->start);
- config_writel(socket, offset+4, res->end);
diff --git a/target/linux/brcm-2.4/patches/010-bcm47xx-cam_absent.patch b/target/linux/brcm-2.4/patches/010-bcm47xx-cam_absent.patch
deleted file mode 100644
index 18799cbc76..0000000000
--- a/target/linux/brcm-2.4/patches/010-bcm47xx-cam_absent.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/drivers/net/b44.h
-+++ b/drivers/net/b44.h
-@@ -122,6 +122,7 @@
- #define RXCONFIG_FLOW 0x00000020 /* Flow Control Enable */
- #define RXCONFIG_FLOW_ACCEPT 0x00000040 /* Accept Unicast Flow Control Frame */
- #define RXCONFIG_RFILT 0x00000080 /* Reject Filter */
-+#define RXCONFIG_CAM_ABSENT 0x00000100 /* CAM Absent */
- #define B44_RXMAXLEN 0x0404UL /* EMAC RX Max Packet Length */
- #define B44_TXMAXLEN 0x0408UL /* EMAC TX Max Packet Length */
- #define B44_MDIO_CTRL 0x0410UL /* EMAC MDIO Control */
---- a/drivers/net/b44.c
-+++ b/drivers/net/b44.c
-@@ -1299,6 +1299,7 @@ static int b44_set_mac_addr(struct net_d
- {
- struct b44 *bp = dev->priv;
- struct sockaddr *addr = p;
-+ u32 val;
-
- if (netif_running(dev))
- return -EBUSY;
-@@ -1306,7 +1307,11 @@ static int b44_set_mac_addr(struct net_d
- memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-
- spin_lock_irq(&bp->lock);
-- __b44_set_mac_addr(bp);
-+
-+ val = br32(B44_RXCONFIG);
-+ if (!(val & RXCONFIG_CAM_ABSENT))
-+ __b44_set_mac_addr(bp);
-+
- spin_unlock_irq(&bp->lock);
-
- return 0;
-@@ -1493,7 +1498,7 @@ static void __b44_set_rx_mode(struct net
-
- val = br32(B44_RXCONFIG);
- val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
-- if (dev->flags & IFF_PROMISC) {
-+ if ((dev->flags & IFF_PROMISC) || (val & RXCONFIG_CAM_ABSENT)) {
- val |= RXCONFIG_PROMISC;
- bw32(B44_RXCONFIG, val);
- } else {
diff --git a/target/linux/brcm-2.4/patches/011-wl_qdisc_war.patch b/target/linux/brcm-2.4/patches/011-wl_qdisc_war.patch
deleted file mode 100644
index b2e746a6c0..0000000000
--- a/target/linux/brcm-2.4/patches/011-wl_qdisc_war.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/net/sched/sch_generic.c
-+++ b/net/sched/sch_generic.c
-@@ -84,6 +84,11 @@ int qdisc_restart(struct net_device *dev
- struct sk_buff *skb;
-
- /* Dequeue packet */
-+ if (!q) {
-+ if (net_ratelimit())
-+ printk(KERN_DEBUG "HELP ME! qdisc_restart called, but no Qdisc!\n");
-+ return 0;
-+ }
- if ((skb = q->dequeue(q)) != NULL) {
- if (spin_trylock(&dev->xmit_lock)) {
- /* Remember that the driver is grabbed by us. */
diff --git a/target/linux/brcm-2.4/patches/012-aec62xx.patch b/target/linux/brcm-2.4/patches/012-aec62xx.patch
deleted file mode 100644
index 7010daf23c..0000000000
--- a/target/linux/brcm-2.4/patches/012-aec62xx.patch
+++ /dev/null
@@ -1,100 +0,0 @@
---- a/drivers/ide/pci/aec62xx.c
-+++ b/drivers/ide/pci/aec62xx.c
-@@ -3,6 +3,8 @@
- *
- * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
- *
-+ * With Broadcom 4780 patches
-+ *
- */
-
- #include <linux/module.h>
-@@ -329,7 +331,11 @@ static int aec62xx_config_drive_xfer_rat
- ide_hwif_t *hwif = HWIF(drive);
- struct hd_driveid *id = drive->id;
-
-+#ifndef CONFIG_BCM947XX
- if ((id->capability & 1) && drive->autodma) {
-+#else
-+ if (1) {
-+#endif
- /* Consult the list of known "bad" drives */
- if (hwif->ide_dma_bad_drive(drive))
- goto fast_ata_pio;
-@@ -414,10 +420,60 @@ static unsigned int __init init_chipset_
- {
- int bus_speed = system_bus_clock();
-
-+#ifndef CONFIG_BCM947XX
- if (dev->resource[PCI_ROM_RESOURCE].start) {
- pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
- printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
- }
-+#else
-+ if (dev->resource[PCI_ROM_RESOURCE].start) {
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS,
-+ dev->resource[PCI_ROM_RESOURCE].
-+ start | PCI_ROM_ADDRESS_ENABLE);
-+ } else {
-+ pci_write_config_dword(dev, PCI_ROM_ADDRESS,
-+ dev->resource[PCI_ROM_RESOURCE].
-+ start);
-+ }
-+
-+ /* Set IDE controller parameters manually - FIXME: replace magic values */
-+ {
-+ byte setting;
-+
-+ pci_write_config_word(dev, PCI_COMMAND, 0x0007);
-+ //pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x5A);
-+ pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x13);
-+
-+ pci_write_config_byte(dev, 0x40, 0x31);
-+ pci_write_config_byte(dev, 0x41, 0x31);
-+ pci_write_config_byte(dev, 0x42, 0x31);
-+ pci_write_config_byte(dev, 0x43, 0x31);
-+ // Set IDE Command Speed
-+ pci_write_config_byte(dev, 0x48, 0x31);
-+
-+ // Disable WriteSubSysID & PIOROM
-+ pci_read_config_byte(dev, 0x49, &setting);
-+ setting &= 0x07;
-+ pci_write_config_byte(dev, 0x49, setting);
-+
-+ // Enable PCI burst & INTA & PCI memory read multiple, FIFO threshold=80
-+ pci_read_config_byte(dev, 0x4A, &setting);
-+ //setting = (setting & 0xFE) | 0xA8;
-+ setting = (setting & 0xFE) | 0xD8;
-+ setting = (setting & 0xF7);
-+ pci_write_config_byte(dev, 0x4A, setting);
-+
-+ //pci_write_config_byte(dev, 0x4B, 0x20);
-+ pci_write_config_byte(dev, 0x4B, 0x2C);
-+ //pci_write_config_byte(dev, 0x4B, 0x0C);
-+
-+ // Set PreRead count: 512 byte
-+ pci_write_config_byte(dev, 0x4C, 0);
-+ pci_write_config_word(dev, 0x4D, 0x0002);
-+ pci_write_config_byte(dev, 0x54, 0);
-+ pci_write_config_word(dev, 0x55, 0x0002);
-+ }
-+#endif
-
- #if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
- aec_devs[n_aec_devs++] = dev;
-@@ -500,6 +556,7 @@ static void __init init_setup_aec62xx (s
-
- static void __init init_setup_aec6x80 (struct pci_dev *dev, ide_pci_device_t *d)
- {
-+#ifndef CONFIG_BCM947XX /* Causes OOPS on BCM4780 */
- unsigned long bar4reg = pci_resource_start(dev, 4);
-
- if (inb(bar4reg+2) & 0x10) {
-@@ -512,6 +569,7 @@ static void __init init_setup_aec6x80 (s
- strcpy(d->name, "AEC6280R");
- }
-
-+#endif
- ide_setup_pci_device(dev, d);
- }
-
diff --git a/target/linux/brcm-2.4/patches/013-wl_hdd_pdc202xx.patch b/target/linux/brcm-2.4/patches/013-wl_hdd_pdc202xx.patch
deleted file mode 100644
index ffe022b588..0000000000
--- a/target/linux/brcm-2.4/patches/013-wl_hdd_pdc202xx.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/drivers/ide/pci/pdc202xx_old.c
-+++ b/drivers/ide/pci/pdc202xx_old.c
-@@ -253,23 +253,23 @@ static int pdc202xx_tune_chipset (ide_dr
- pci_read_config_byte(dev, (drive_pci)|0x03, &DP);
-
- if (speed < XFER_SW_DMA_0) {
-- if ((AP & 0x0F) || (BP & 0x07)) {
-+ if ((AP & 0x0F) || (BP & 0x17)) {
- /* clear PIO modes of lower 8421 bits of A Register */
- pci_write_config_byte(dev, (drive_pci), AP &~0x0F);
- pci_read_config_byte(dev, (drive_pci), &AP);
-
- /* clear PIO modes of lower 421 bits of B Register */
-- pci_write_config_byte(dev, (drive_pci)|0x01, BP &~0x07);
-+ pci_write_config_byte(dev, (drive_pci)|0x01, BP &~0x17);
- pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
-
- pci_read_config_byte(dev, (drive_pci), &AP);
- pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
- }
- } else {
-- if ((BP & 0xF0) && (CP & 0x0F)) {
-+ if ((BP & 0xE0) && (CP & 0x0F)) {
- /* clear DMA modes of upper 842 bits of B Register */
- /* clear PIO forced mode upper 1 bit of B Register */
-- pci_write_config_byte(dev, (drive_pci)|0x01, BP &~0xF0);
-+ pci_write_config_byte(dev, (drive_pci)|0x01, BP &~0xE0);
- pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
-
- /* clear DMA modes of lower 8421 bits of C Register */
-@@ -373,6 +373,9 @@ static int config_chipset_for_dma (ide_d
- u8 ultra_66 = ((id->dma_ultra & 0x0010) ||
- (id->dma_ultra & 0x0008)) ? 1 : 0;
-
-+ if (hwif->rqsize != 256)
-+ hwif->rqsize = 256;
-+
- switch(dev->device) {
- case PCI_DEVICE_ID_PROMISE_20267:
- case PCI_DEVICE_ID_PROMISE_20265:
diff --git a/target/linux/brcm-2.4/patches/014-sierra_support.patch b/target/linux/brcm-2.4/patches/014-sierra_support.patch
deleted file mode 100644
index f964d00354..0000000000
--- a/target/linux/brcm-2.4/patches/014-sierra_support.patch
+++ /dev/null
@@ -1,1484 +0,0 @@
---- /dev/null
-+++ b/drivers/usb/serial/sierra.c
-@@ -0,0 +1,1446 @@
-+/*
-+ * Sierra Wireless CDMA Wireless Serial USB drive
-+ *
-+ * Current Copy modified by: Kevin Lloyd <linux@sierrawireless.com>
-+ * Original Copy written by: 2005 Greg Kroah-Hartman <gregkh <at> suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License version
-+ * 2 as published by the Free Software Foundation.
-+ *
-+ * Version history:
-+ Version 1.03 (Lloyd):
-+ Included support for DTR control and enhanced buffering (should help
-+ speed).
-+ */
-+
-+#include <linux/config.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/slab.h>
-+#include <linux/tty.h>
-+#include <linux/tty_driver.h>
-+#include <linux/tty_flip.h>
-+#include <linux/module.h>
-+#include <linux/usb.h>
-+#include <linux/mm.h>
-+#include <asm/uaccess.h>
-+#include <linux/errno.h>
-+#include <linux/list.h>
-+#include <linux/spinlock.h>
-+#include <linux/smp_lock.h>
-+
-+#ifdef CONFIG_USB_SERIAL_DEBUG
-+ static int debug = 1;
-+#else
-+ static int debug;
-+#endif
-+
-+#include "usb-serial.h"
-+#include "sierra.h"
-+#if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE)
-+#include "pl2303.h" // see /* BEGIN HORRIBLE HACK FOR PL2303 */ below
-+#endif
-+
-+#define DRIVER_VERSION "v1.03"
-+
-+#if 0
-+#define USB_VENDER_REQUEST_SET_DEVICE_POWER_STATE 0
-+
-+#define USB_DEVICE_POWER_STATE_D0 0x0000
-+#define USB_DEVICE_POWER_STATE_D1 0x0001
-+#define USB_DEVICE_POWER_STATE_D2 0x0002
-+#define USB_DEVICE_POWER_STATE_D3 0x0003
-+
-+#define SET_CONTROL_LINE_STATE 0x22
-+/*
-+ * Output control lines.
-+ */
-+
-+#define ACM_CTRL_DTR 0x01
-+#define ACM_CTRL_RTS 0x02
-+#endif
-+
-+//static int sw_attach(struct usb_serial *serial);
-+static void sw_usb_serial_generic_shutdown(struct usb_serial *serial);
-+
-+static int sw_usb_serial_generic_open(struct usb_serial_port *port, struct file *filp);
-+static void sw_usb_serial_generic_close(struct usb_serial_port *port, struct file *filp);
-+
-+#if 1
-+/*-----------------------------------------------------------*/
-+static int serial_refcount;
-+static struct tty_driver serial_tty_driver;
-+static struct tty_struct * serial_tty[SERIAL_TTY_MINORS];
-+static struct termios * serial_termios[SERIAL_TTY_MINORS];
-+static struct termios * serial_termios_locked[SERIAL_TTY_MINORS];
-+static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
-+
-+static LIST_HEAD(usb_serial_driver_list);
-+static struct usb_serial *get_free_serial (int num_ports, int *minor);
-+static void generic_write_bulk_callback (struct urb *urb);
-+static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,const struct usb_device_id *id);
-+static void usb_serial_disconnect(struct usb_device *dev, void *ptr);
-+static void sw_usb_serial_generic_read_bulk_callback (struct urb *urb);
-+static void port_softint(void *private);
-+static void return_serial (struct usb_serial *serial);
-+static struct usb_serial *get_free_serial (int num_ports, int *minor);
-+static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data);
-+/*-----------------------------------------------------------*/
-+
-+#endif
-+
-+
-+static struct usb_device_id id_table [] = {
-+ { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
-+ { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
-+ { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
-+ { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
-+ { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
-+ { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
-+ { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
-+ { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
-+ { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */
-+ { USB_DEVICE(0x1199, 0x0023) }, /* Sierra Wireless C597 */
-+
-+ { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
-+ { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
-+ { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
-+ { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
-+ { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
-+ { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */
-+ { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */
-+ { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
-+ { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */
-+ { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
-+ { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
-+ { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite*/
-+ { USB_DEVICE(0x1199, 0x6850) }, /* Sierra Wireless AirCard 880 */
-+ { USB_DEVICE(0x1199, 0x6851) }, /* Sierra Wireless AirCard 881 */
-+ { USB_DEVICE(0x1199, 0x6852) }, /* Sierra Wireless AirCard 880 E */
-+ { USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881 E */
-+ { USB_DEVICE(0x1199, 0x6855) }, /* Sierra Wireless AirCard 880 U */
-+ { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
-+ { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */
-+ { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */
-+
-+ { USB_DEVICE(0x1199, 0x6468) }, /* Sierra Wireless MP3G - EVDO */
-+ { USB_DEVICE(0x1199, 0x6469) }, /* Sierra Wireless MP3G - UMTS/HSPA */
-+
-+ { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
-+ { USB_DEVICE(0x0F3D, 0x0112) }, /* AirPrime/Sierra Wireless PC 5220 */
-+ { USB_DEVICE(0x05C6, 0x6613) }, /* Onda H600/ZTE MF330 */
-+ { }
-+};
-+
-+MODULE_DEVICE_TABLE(usb, id_table);
-+
-+static struct usb_driver sierra_driver = {
-+// .owner = THIS_MODULE,
-+ .name = "Sierra wireless",
-+ .probe = usb_serial_probe,
-+ .disconnect = usb_serial_disconnect,
-+ .id_table = id_table,
-+};
-+
-+static struct usb_serial_device_type sierra_device = {
-+// .driver = {
-+ .owner = THIS_MODULE,
-+ .name = "Sierra Wireless",
-+// },
-+ .id_table = id_table,
-+ .num_interrupt_in = NUM_DONT_CARE,
-+ .num_bulk_in = NUM_DONT_CARE,
-+ .num_bulk_out = NUM_DONT_CARE,
-+ .num_ports = 3,
-+ //.startup = sw_attach,
-+ .shutdown = sw_usb_serial_generic_shutdown,
-+ .open = sw_usb_serial_generic_open,
-+ .close = sw_usb_serial_generic_close,
-+};
-+
-+#define MAX_NUM_PORTS 8
-+
-+/* local function prototypes */
-+static int serial_open (struct tty_struct *tty, struct file * filp);
-+static void serial_close (struct tty_struct *tty, struct file * filp);
-+static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count);
-+static int serial_write_room (struct tty_struct *tty);
-+static int serial_chars_in_buffer (struct tty_struct *tty);
-+static void serial_throttle (struct tty_struct * tty);
-+static void serial_unthrottle (struct tty_struct * tty);
-+static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg);
-+static void serial_set_termios (struct tty_struct *tty, struct termios * old);
-+//static void serial_shutdown (struct usb_serial *serial);
-+static void serial_break (struct tty_struct *tty, int break_state);
-+static int generic_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count);
-+static int generic_write_room (struct usb_serial_port *port);
-+static void generic_cleanup (struct usb_serial_port *port);
-+static int generic_chars_in_buffer (struct usb_serial_port *port);
-+//static void generic_shutdown (struct usb_serial *serial);
-+
-+#if 1
-+static struct tty_driver serial_tty_driver = {
-+ .magic = TTY_DRIVER_MAGIC,
-+ .driver_name = "usb-serial",
-+#ifndef CONFIG_DEVFS_FS
-+ .name = "ttyUSB",
-+#else
-+ .name = "usb/tts/%d",
-+#endif
-+ .major = SERIAL_TTY_MAJOR,
-+ .minor_start = 0,
-+ .num = SERIAL_TTY_MINORS,
-+ .type = TTY_DRIVER_TYPE_SERIAL,
-+ .subtype = SERIAL_TYPE_NORMAL,
-+ .flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
-+
-+ .refcount = &serial_refcount,
-+ .table = serial_tty,
-+ .termios = serial_termios,
-+ .termios_locked = serial_termios_locked,
-+
-+ .open = serial_open,
-+ .close = serial_close,
-+ .write = serial_write,
-+ .write_room = serial_write_room,
-+ .ioctl = serial_ioctl,
-+ .set_termios = serial_set_termios,
-+ .throttle = serial_throttle,
-+ .unthrottle = serial_unthrottle,
-+ .break_ctl = serial_break,
-+ .chars_in_buffer = serial_chars_in_buffer,
-+ .read_proc = serial_read_proc,
-+};
-+#endif
-+
-+
-+/*****************************************************************************
-+ * Driver tty interface functions
-+ *****************************************************************************/
-+static struct usb_serial *get_serial_by_minor (unsigned int minor)
-+{
-+ return serial_table[minor];
-+}
-+
-+static int serial_open (struct tty_struct *tty, struct file * filp)
-+{
-+ struct usb_serial *serial;
-+ struct usb_serial_port *port;
-+ unsigned int portNumber;
-+ int retval = 0;
-+
-+ dbg("%s", __FUNCTION__);
-+
-+ /* initialize the pointer incase something fails */
-+ tty->driver_data = NULL;
-+
-+ /* get the serial object associated with this tty pointer */
-+ serial = get_serial_by_minor (MINOR(tty->device));
-+
-+ if (serial_paranoia_check (serial, __FUNCTION__))
-+ return -ENODEV;
-+
-+ /* set up our port structure making the tty driver remember our port object, and us it */
-+ portNumber = MINOR(tty->device) - serial->minor;
-+ port = &serial->port[portNumber];
-+ tty->driver_data = port;
-+
-+ down (&port->sem);
-+ port->tty = tty;
-+
-+ /* lock this module before we call it */
-+ if (serial->type->owner)
-+ __MOD_INC_USE_COUNT(serial->type->owner);
-+
-+ ++port->open_count;
-+ if (port->open_count == 1) {
-+ /* only call the device specific open if this
-+ * is the first time the port is opened */
-+ if (serial->type->open)
-+ retval = serial->type->open(port, filp);
-+ else
-+ retval = sw_usb_serial_generic_open(port, filp);//@.@
-+ }
-+
-+ if (retval) {
-+ port->open_count = 0;
-+ if (serial->type->owner)
-+ __MOD_DEC_USE_COUNT(serial->type->owner);
-+ }
-+
-+ up (&port->sem);
-+ return retval;
-+}
-+
-+static void __serial_close(struct usb_serial_port *port, struct file *filp)
-+{
-+ if (!port->open_count) {
-+ dbg ("%s - port not opened", __FUNCTION__);
-+ return;
-+ }
-+
-+ --port->open_count;
-+ if (port->open_count <= 0) {
-+ /* only call the device specific close if this
-+ * port is being closed by the last owner */
-+ if (port->serial->type->close)
-+ port->serial->type->close(port, filp);
-+ else
-+ //generic_close(port, filp);
-+ sw_usb_serial_generic_close(port, filp);
-+ port->open_count = 0;
-+ }
-+
-+ if (port->serial->type->owner)
-+ __MOD_DEC_USE_COUNT(port->serial->type->owner);
-+}
-+
-+static void serial_close(struct tty_struct *tty, struct file * filp)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+
-+ if (!serial)
-+ return;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ /* if disconnect beat us to the punch here, there's nothing to do */
-+ if (tty->driver_data) {
-+ __serial_close(port, filp);
-+ }
-+
-+ up (&port->sem);
-+}
-+
-+static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+ int retval = -EINVAL;
-+
-+ if (!serial)
-+ return -ENODEV;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
-+
-+ if (!port->open_count) {
-+ dbg("%s - port not opened", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function if it is available */
-+ if (serial->type->write)
-+ retval = serial->type->write(port, from_user, buf, count);
-+ else
-+ retval = generic_write(port, from_user, buf, count);
-+
-+exit:
-+ up (&port->sem);
-+ return retval;
-+}
-+
-+static int serial_write_room (struct tty_struct *tty)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+ int retval = -EINVAL;
-+
-+ if (!serial)
-+ return -ENODEV;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!port->open_count) {
-+ dbg("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function if it is available */
-+ if (serial->type->write_room)
-+ retval = serial->type->write_room(port);
-+ else
-+ retval = generic_write_room(port);
-+
-+exit:
-+ up (&port->sem);
-+ return retval;
-+}
-+
-+static int serial_chars_in_buffer (struct tty_struct *tty)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+ int retval = -EINVAL;
-+
-+ if (!serial)
-+ return -ENODEV;
-+
-+ down (&port->sem);
-+
-+ dbg("%s = port %d", __FUNCTION__, port->number);
-+
-+ if (!port->open_count) {
-+ dbg("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function if it is available */
-+ if (serial->type->chars_in_buffer)
-+ retval = serial->type->chars_in_buffer(port);
-+ else
-+ retval = generic_chars_in_buffer(port);
-+
-+exit:
-+ up (&port->sem);
-+ return retval;
-+}
-+
-+static void serial_throttle (struct tty_struct * tty)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+
-+ if (!serial)
-+ return;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!port->open_count) {
-+ dbg ("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function */
-+ if (serial->type->throttle)
-+ serial->type->throttle(port);
-+
-+exit:
-+ up (&port->sem);
-+}
-+
-+static void serial_unthrottle (struct tty_struct * tty)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+
-+ if (!serial)
-+ return;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!port->open_count) {
-+ dbg("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function */
-+ if (serial->type->unthrottle)
-+ serial->type->unthrottle(port);
-+
-+exit:
-+ up (&port->sem);
-+}
-+
-+static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+ int retval = -ENODEV;
-+
-+ if (!serial)
-+ return -ENODEV;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd);
-+
-+ if (!port->open_count) {
-+ dbg ("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function if it is available */
-+ if (serial->type->ioctl)
-+ retval = serial->type->ioctl(port, file, cmd, arg);
-+ else
-+ retval = -ENOIOCTLCMD;
-+
-+exit:
-+ up (&port->sem);
-+ return retval;
-+}
-+
-+static void serial_set_termios (struct tty_struct *tty, struct termios * old)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+
-+ if (!serial)
-+ return;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!port->open_count) {
-+ dbg("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function if it is available */
-+ if (serial->type->set_termios)
-+ serial->type->set_termios(port, old);
-+
-+exit:
-+ up (&port->sem);
-+}
-+
-+static void serial_break (struct tty_struct *tty, int break_state)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+
-+ if (!serial)
-+ return;
-+
-+ down (&port->sem);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!port->open_count) {
-+ dbg("%s - port not open", __FUNCTION__);
-+ goto exit;
-+ }
-+
-+ /* pass on to the driver specific version of this function if it is available */
-+ if (serial->type->break_ctl)
-+ serial->type->break_ctl(port, break_state);
-+
-+exit:
-+ up (&port->sem);
-+}
-+#if 0
-+static void serial_shutdown (struct usb_serial *serial)
-+{
-+ dbg ("%s", __FUNCTION__);
-+
-+ if (serial->type->shutdown)
-+ serial->type->shutdown(serial);
-+ else
-+ generic_shutdown(serial);
-+}
-+#endif
-+static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data)
-+{
-+ struct usb_serial *serial;
-+ int length = 0;
-+ int i;
-+ off_t begin = 0;
-+ char tmp[40];
-+
-+ dbg("%s", __FUNCTION__);
-+ length += sprintf (page, "usbserinfo:1.0 driver:%s\n", DRIVER_VERSION);
-+ for (i = 0; i < SERIAL_TTY_MINORS && length < PAGE_SIZE; ++i) {
-+ serial = get_serial_by_minor(i);
-+ if (serial == NULL)
-+ continue;
-+
-+ length += sprintf (page+length, "%d:", i);
-+ if (serial->type->owner)
-+ length += sprintf (page+length, " module:%s", serial->type->owner->name);
-+ length += sprintf (page+length, " name:\"%s\"", serial->type->name);
-+ length += sprintf (page+length, " vendor:%04x product:%04x", serial->vendor, serial->product);
-+ length += sprintf (page+length, " num_ports:%d", serial->num_ports);
-+ length += sprintf (page+length, " port:%d", i - serial->minor + 1);
-+
-+ usb_make_path(serial->dev, tmp, sizeof(tmp));
-+ length += sprintf (page+length, " path:%s", tmp);
-+
-+ length += sprintf (page+length, "\n");
-+ if ((length + begin) > (off + count))
-+ goto done;
-+ if ((length + begin) < off) {
-+ begin += length;
-+ length = 0;
-+ }
-+ }
-+ *eof = 1;
-+done:
-+ if (off >= (length + begin))
-+ return 0;
-+ *start = page + (off-begin);
-+ return ((count < begin+length-off) ? count : begin+length-off);
-+}
-+
-+
-+/*-----------------------------------------------------------*/
-+static int generic_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
-+{
-+ struct usb_serial *serial = port->serial;
-+ int result;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (count == 0) {
-+ dbg("%s - write request of 0 bytes", __FUNCTION__);
-+ return (0);
-+ }
-+
-+ /* only do something if we have a bulk out endpoint */
-+ if (serial->num_bulk_out) {
-+ if (port->write_urb->status == -EINPROGRESS) {
-+ dbg("%s - already writing", __FUNCTION__);
-+ return (0);
-+ }
-+
-+ count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
-+
-+ if (from_user) {
-+ if (copy_from_user(port->write_urb->transfer_buffer, buf, count))
-+ return -EFAULT;
-+ }
-+ else {
-+ memcpy (port->write_urb->transfer_buffer, buf, count);
-+ }
-+
-+ usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
-+
-+ /* set up our urb */
-+ usb_fill_bulk_urb (port->write_urb, serial->dev,
-+ usb_sndbulkpipe (serial->dev,
-+ port->bulk_out_endpointAddress),
-+ port->write_urb->transfer_buffer, count,
-+ ((serial->type->write_bulk_callback) ?
-+ serial->type->write_bulk_callback :
-+ generic_write_bulk_callback), port);
-+
-+ /* send the data out the bulk port */
-+ result = usb_submit_urb(port->write_urb);
-+ if (result)
-+ err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
-+ else
-+ result = count;
-+
-+ return result;
-+ }
-+
-+ /* no bulk out, so return 0 bytes written */
-+ return (0);
-+}
-+
-+static int generic_write_room (struct usb_serial_port *port)
-+{
-+ struct usb_serial *serial = port->serial;
-+ int room = 0;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (serial->num_bulk_out) {
-+ if (port->write_urb->status != -EINPROGRESS)
-+ room = port->bulk_out_size;
-+ }
-+
-+ dbg("%s - returns %d", __FUNCTION__, room);
-+ return (room);
-+}
-+
-+static int generic_chars_in_buffer (struct usb_serial_port *port)
-+{
-+ struct usb_serial *serial = port->serial;
-+ int chars = 0;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (serial->num_bulk_out) {
-+ if (port->write_urb->status == -EINPROGRESS)
-+ chars = port->write_urb->transfer_buffer_length;
-+ }
-+
-+ dbg("%s - returns %d", __FUNCTION__, chars);
-+ return (chars);
-+}
-+#if 0
-+static void generic_shutdown (struct usb_serial *serial)
-+{
-+ int i;
-+
-+ dbg("%s", __FUNCTION__);
-+
-+ /* stop reads and writes on all ports */
-+ for (i=0; i < serial->num_ports; ++i) {
-+ generic_cleanup (&serial->port[i]);
-+ }
-+}
-+static void generic_cleanup (struct usb_serial_port *port)
-+{
-+ struct usb_serial *serial = port->serial;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (serial->dev) {
-+ /* shutdown any bulk reads that might be going on */
-+ if (serial->num_bulk_out)
-+ usb_unlink_urb (port->write_urb);
-+ if (serial->num_bulk_in)
-+ usb_unlink_urb (port->read_urb);
-+ }
-+}
-+#endif
-+/*----------------------------------------------------------*/
-+static void generic_write_bulk_callback (struct urb *urb)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!serial) {
-+ dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-+ return;
-+ }
-+
-+ if (urb->status) {
-+ dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
-+ return;
-+ }
-+
-+ queue_task(&port->tqueue, &tq_immediate);
-+ mark_bh(IMMEDIATE_BH);
-+
-+ return;
-+}
-+
-+static struct usb_serial *get_free_serial (int num_ports, int *minor)
-+{
-+ struct usb_serial *serial = NULL;
-+ int i, j;
-+ int good_spot;
-+
-+ dbg("%s %d", __FUNCTION__, num_ports);
-+
-+ *minor = 0;
-+ for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
-+ if (serial_table[i])
-+ continue;
-+
-+ good_spot = 1;
-+ for (j = 1; j <= num_ports-1; ++j)
-+ if (serial_table[i+j])
-+ good_spot = 0;
-+ if (good_spot == 0)
-+ continue;
-+
-+ if (!(serial = kmalloc(sizeof(struct usb_serial), GFP_KERNEL))) {
-+ err("%s - Out of memory", __FUNCTION__);
-+ return NULL;
-+ }
-+ memset(serial, 0, sizeof(struct usb_serial));
-+ serial->magic = USB_SERIAL_MAGIC;
-+ serial_table[i] = serial;
-+ *minor = i;
-+ dbg("%s - minor base = %d", __FUNCTION__, *minor);
-+ for (i = *minor+1; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i)
-+ serial_table[i] = serial;
-+ return serial;
-+ }
-+ return NULL;
-+}
-+
-+static void return_serial (struct usb_serial *serial)
-+{
-+ int i;
-+
-+ dbg("%s", __FUNCTION__);
-+
-+ if (serial == NULL)
-+ return;
-+
-+ for (i = 0; i < serial->num_ports; ++i) {
-+ serial_table[serial->minor + i] = NULL;
-+ }
-+
-+ return;
-+}
-+
-+static void port_softint(void *private)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *)private;
-+ struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-+ struct tty_struct *tty;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (!serial)
-+ return;
-+
-+ tty = port->tty;
-+ if (!tty)
-+ return;
-+
-+ if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) {
-+ dbg("%s - write wakeup call.", __FUNCTION__);
-+ (tty->ldisc.write_wakeup)(tty);
-+ }
-+
-+ wake_up_interruptible(&tty->write_wait);
-+}
-+
-+
-+static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
-+ const struct usb_device_id *id)
-+{
-+ struct usb_serial *serial = NULL;
-+ struct usb_serial_port *port;
-+ struct usb_interface *interface;
-+ struct usb_interface_descriptor *iface_desc;
-+ struct usb_endpoint_descriptor *endpoint;
-+ struct usb_endpoint_descriptor *interrupt_in_endpoint[MAX_NUM_PORTS];
-+ struct usb_endpoint_descriptor *bulk_in_endpoint[MAX_NUM_PORTS];
-+ struct usb_endpoint_descriptor *bulk_out_endpoint[MAX_NUM_PORTS];
-+ struct usb_serial_device_type *type = NULL;
-+ struct list_head *tmp;
-+ int found;
-+ int minor;
-+ int buffer_size;
-+ int i;
-+ int num_interrupt_in = 0;
-+ int num_bulk_in = 0;
-+ int num_bulk_out = 0;
-+ int num_ports;
-+ int max_endpoints;
-+ const struct usb_device_id *id_pattern = NULL;
-+
-+ /* loop through our list of known serial converters, and see if this
-+ device matches. */
-+ found = 0;
-+ interface = &dev->actconfig->interface[ifnum];
-+ list_for_each (tmp, &usb_serial_driver_list) {
-+ type = list_entry(tmp, struct usb_serial_device_type, driver_list);
-+ id_pattern = usb_match_id(dev, interface, type->id_table);
-+ if (id_pattern != NULL) {
-+ dbg("descriptor matches");
-+ found = 1;
-+ break;
-+ }
-+ }
-+ if (!found) {
-+ /* no match */
-+ dbg("none matched");
-+ return(NULL);
-+ }
-+ /* descriptor matches, let's find the endpoints needed */
-+ /* check out the endpoints */
-+ iface_desc = &interface->altsetting[0];
-+ for (i = 0; i < iface_desc->bNumEndpoints; ++i) {
-+ endpoint = &iface_desc->endpoint[i];
-+
-+ if ((endpoint->bEndpointAddress & 0x80) &&
-+ ((endpoint->bmAttributes & 3) == 0x02)) {
-+ /* we found a bulk in endpoint */
-+ dbg("found bulk in");
-+ bulk_in_endpoint[num_bulk_in] = endpoint;
-+ ++num_bulk_in;
-+ }
-+
-+ if (((endpoint->bEndpointAddress & 0x80) == 0x00) &&
-+ ((endpoint->bmAttributes & 3) == 0x02)) {
-+ /* we found a bulk out endpoint */
-+ dbg("found bulk out");
-+ bulk_out_endpoint[num_bulk_out] = endpoint;
-+ ++num_bulk_out;
-+ }
-+
-+ if ((endpoint->bEndpointAddress & 0x80) &&
-+ ((endpoint->bmAttributes & 3) == 0x03)) {
-+ /* we found a interrupt in endpoint */
-+ dbg("found interrupt in");
-+ interrupt_in_endpoint[num_interrupt_in] = endpoint;
-+ ++num_interrupt_in;
-+ }
-+ }
-+
-+#if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE)
-+ /* BEGIN HORRIBLE HACK FOR PL2303 */
-+ /* this is needed due to the looney way its endpoints are set up */
-+ if (((dev->descriptor.idVendor == PL2303_VENDOR_ID) &&
-+ (dev->descriptor.idProduct == PL2303_PRODUCT_ID)) ||
-+ ((dev->descriptor.idVendor == ATEN_VENDOR_ID) &&
-+ (dev->descriptor.idProduct == ATEN_PRODUCT_ID))) {
-+ if (ifnum == 1) {
-+ /* check out the endpoints of the other interface*/
-+ interface = &dev->actconfig->interface[ifnum ^ 1];
-+ iface_desc = &interface->altsetting[0];
-+ for (i = 0; i < iface_desc->bNumEndpoints; ++i) {
-+ endpoint = &iface_desc->endpoint[i];
-+ if ((endpoint->bEndpointAddress & 0x80) &&
-+ ((endpoint->bmAttributes & 3) == 0x03)) {
-+ /* we found a interrupt in endpoint */
-+ dbg("found interrupt in for Prolific device on separate interface");
-+ interrupt_in_endpoint[num_interrupt_in] = endpoint;
-+ ++num_interrupt_in;
-+ }
-+ }
-+ }
-+
-+ /* Now make sure the PL-2303 is configured correctly.
-+ * If not, give up now and hope this hack will work
-+ * properly during a later invocation of usb_serial_probe
-+ */
-+ if (num_bulk_in == 0 || num_bulk_out == 0) {
-+ info("PL-2303 hack: descriptors matched but endpoints did not");
-+ return NULL;
-+ }
-+ }
-+ /* END HORRIBLE HACK FOR PL2303 */
-+#endif
-+
-+ /* found all that we need */
-+ info("%s converter detected", type->name);
-+
-+#ifdef CONFIG_USB_SERIAL_SIERRAWIRELESS
-+ if (type == &sierra_driver) {
-+ num_ports = num_bulk_out;
-+ if (num_ports == 0) {
-+ err("Sierra 3G device with no bulk out, not allowed.");
-+ return NULL;
-+ }
-+ } else
-+#endif
-+ num_ports = type->num_ports;
-+
-+ serial = get_free_serial (num_ports, &minor);
-+ if (serial == NULL) {
-+ err("No more free serial devices");
-+ return NULL;
-+ }
-+
-+ serial->dev = dev;
-+ serial->type = type;
-+ serial->interface = interface;
-+ serial->minor = minor;
-+ serial->num_ports = num_ports;
-+ serial->num_bulk_in = num_bulk_in;
-+ serial->num_bulk_out = num_bulk_out;
-+ serial->num_interrupt_in = num_interrupt_in;
-+ serial->vendor = dev->descriptor.idVendor;
-+ serial->product = dev->descriptor.idProduct;
-+
-+ /* set up the endpoint information */
-+ for (i = 0; i < num_bulk_in; ++i) {
-+ endpoint = bulk_in_endpoint[i];
-+ port = &serial->port[i];
-+ port->read_urb = usb_alloc_urb (0);
-+ if (!port->read_urb) {
-+ err("No free urbs available");
-+ goto probe_error;
-+ }
-+//Amin marked buffer_size = endpoint->wMaxPacketSize;
-+// ===> 20060310 Amin modify for improve EVDO and HSDPA Card
-+ buffer_size = 2048;
-+ printk("KERNEL DEBUG => USBSERIAL.O buffer_size = 2048\n");
-+// <=== 20060310 Amin modify for improve EVDO and HSDPA Card
-+ port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
-+ port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
-+ if (!port->bulk_in_buffer) {
-+ err("Couldn't allocate bulk_in_buffer");
-+ goto probe_error;
-+ }
-+ usb_fill_bulk_urb (port->read_urb, dev,
-+ usb_rcvbulkpipe (dev,
-+ endpoint->bEndpointAddress),
-+ port->bulk_in_buffer, buffer_size,
-+ ((serial->type->read_bulk_callback) ?
-+ serial->type->read_bulk_callback :
-+ sw_usb_serial_generic_read_bulk_callback),
-+ port);
-+ }
-+
-+ for (i = 0; i < num_bulk_out; ++i) {
-+ endpoint = bulk_out_endpoint[i];
-+ port = &serial->port[i];
-+ port->write_urb = usb_alloc_urb(0);
-+ if (!port->write_urb) {
-+ err("No free urbs available");
-+ goto probe_error;
-+ }
-+ buffer_size = endpoint->wMaxPacketSize;
-+ port->bulk_out_size = buffer_size;
-+ port->bulk_out_endpointAddress = endpoint->bEndpointAddress;
-+ port->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL);
-+ if (!port->bulk_out_buffer) {
-+ err("Couldn't allocate bulk_out_buffer");
-+ goto probe_error;
-+ }
-+ usb_fill_bulk_urb (port->write_urb, dev,
-+ usb_sndbulkpipe (dev,
-+ endpoint->bEndpointAddress),
-+ port->bulk_out_buffer, buffer_size,
-+ ((serial->type->write_bulk_callback) ?
-+ serial->type->write_bulk_callback :
-+ generic_write_bulk_callback),
-+ port);
-+ }
-+
-+ for (i = 0; i < num_interrupt_in; ++i) {
-+ endpoint = interrupt_in_endpoint[i];
-+ port = &serial->port[i];
-+ port->interrupt_in_urb = usb_alloc_urb(0);
-+ if (!port->interrupt_in_urb) {
-+ err("No free urbs available");
-+ goto probe_error;
-+ }
-+ buffer_size = endpoint->wMaxPacketSize;
-+ port->interrupt_in_endpointAddress = endpoint->bEndpointAddress;
-+ port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
-+ if (!port->interrupt_in_buffer) {
-+ err("Couldn't allocate interrupt_in_buffer");
-+ goto probe_error;
-+ }
-+ usb_fill_int_urb (port->interrupt_in_urb, dev,
-+ usb_rcvintpipe (dev,
-+ endpoint->bEndpointAddress),
-+ port->interrupt_in_buffer, buffer_size,
-+ serial->type->read_int_callback, port,
-+ endpoint->bInterval);
-+ }
-+
-+ /* initialize some parts of the port structures */
-+ /* we don't use num_ports here cauz some devices have more endpoint pairs than ports */
-+ max_endpoints = max(num_bulk_in, num_bulk_out);
-+ max_endpoints = max(max_endpoints, num_interrupt_in);
-+ max_endpoints = max(max_endpoints, (int)serial->num_ports);
-+ dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints);
-+ for (i = 0; i < max_endpoints; ++i) {
-+ port = &serial->port[i];
-+ port->number = i + serial->minor;
-+ port->serial = serial;
-+ port->magic = USB_SERIAL_PORT_MAGIC;
-+ port->tqueue.routine = port_softint;
-+ port->tqueue.data = port;
-+ init_MUTEX (&port->sem);
-+ }
-+
-+ /* if this device type has a startup function, call it */
-+ if (type->startup) {
-+ i = type->startup (serial);
-+ if (i < 0)
-+ goto probe_error;
-+ if (i > 0)
-+ return serial;
-+ }
-+
-+ /* initialize the devfs nodes for this device and let the user know what ports we are bound to */
-+ for (i = 0; i < serial->num_ports; ++i) {
-+ tty_register_devfs (&serial_tty_driver, 0, serial->port[i].number);
-+ info("%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)",
-+ type->name, serial->port[i].number, serial->port[i].number);
-+ }
-+
-+ return serial; /* success */
-+
-+
-+probe_error:
-+ for (i = 0; i < num_bulk_in; ++i) {
-+ port = &serial->port[i];
-+ if (port->read_urb)
-+ usb_free_urb (port->read_urb);
-+ if (port->bulk_in_buffer)
-+ kfree (port->bulk_in_buffer);
-+ }
-+ for (i = 0; i < num_bulk_out; ++i) {
-+ port = &serial->port[i];
-+ if (port->write_urb)
-+ usb_free_urb (port->write_urb);
-+ if (port->bulk_out_buffer)
-+ kfree (port->bulk_out_buffer);
-+ }
-+ for (i = 0; i < num_interrupt_in; ++i) {
-+ port = &serial->port[i];
-+ if (port->interrupt_in_urb)
-+ usb_free_urb (port->interrupt_in_urb);
-+ if (port->interrupt_in_buffer)
-+ kfree (port->interrupt_in_buffer);
-+ }
-+
-+ /* return the minor range that this device had */
-+ return_serial (serial);
-+
-+ /* free up any memory that we allocated */
-+ kfree (serial);
-+ return NULL;
-+}
-+
-+static void usb_serial_disconnect(struct usb_device *dev, void *ptr)
-+{
-+ struct usb_serial *serial = (struct usb_serial *) ptr;
-+ struct usb_serial_port *port;
-+ int i;
-+
-+ dbg ("%s", __FUNCTION__);
-+ if (serial) {
-+ /* fail all future close/read/write/ioctl/etc calls */
-+ for (i = 0; i < serial->num_ports; ++i) {
-+ port = &serial->port[i];
-+ down (&port->sem);
-+ if (port->tty != NULL) {
-+ while (port->open_count > 0) {
-+ //__serial_close(port, NULL);
-+ sw_usb_serial_generic_close(port,NULL);
-+ }
-+ port->tty->driver_data = NULL;
-+ }
-+ up (&port->sem);
-+ }
-+
-+ serial->dev = NULL;
-+ //serial_shutdown (serial);
-+ sw_usb_serial_generic_shutdown(serial);
-+
-+ for (i = 0; i < serial->num_ports; ++i)
-+ serial->port[i].open_count = 0;
-+
-+ for (i = 0; i < serial->num_bulk_in; ++i) {
-+ port = &serial->port[i];
-+ if (port->read_urb) {
-+ usb_unlink_urb (port->read_urb);
-+ usb_free_urb (port->read_urb);
-+ }
-+ if (port->bulk_in_buffer)
-+ kfree (port->bulk_in_buffer);
-+ }
-+ for (i = 0; i < serial->num_bulk_out; ++i) {
-+ port = &serial->port[i];
-+ if (port->write_urb) {
-+ usb_unlink_urb (port->write_urb);
-+ usb_free_urb (port->write_urb);
-+ }
-+ if (port->bulk_out_buffer)
-+ kfree (port->bulk_out_buffer);
-+ }
-+ for (i = 0; i < serial->num_interrupt_in; ++i) {
-+ port = &serial->port[i];
-+ if (port->interrupt_in_urb) {
-+ usb_unlink_urb (port->interrupt_in_urb);
-+ usb_free_urb (port->interrupt_in_urb);
-+ }
-+ if (port->interrupt_in_buffer)
-+ kfree (port->interrupt_in_buffer);
-+ }
-+
-+ for (i = 0; i < serial->num_ports; ++i) {
-+ tty_unregister_devfs (&serial_tty_driver, serial->port[i].number);
-+ info("%s converter now disconnected from ttyUSB%d", serial->type->name, serial->port[i].number);
-+ }
-+
-+ /* return the minor range that this device had */
-+ return_serial (serial);
-+
-+ /* free up any memory that we allocated */
-+ kfree (serial);
-+
-+ } else {
-+ info("device disconnected");
-+ }
-+
-+}
-+
-+#if 0
-+static int sw_attach(struct usb_serial *serial)
-+{
-+ struct usb_device *hdev = serial->dev;
-+ int rc;
-+
-+ dbg("%s - serial(0x%p)", __FUNCTION__, serial);
-+
-+ rc = usb_control_msg(
-+ hdev,
-+ usb_sndctrlpipe(hdev, 0),
-+ USB_VENDER_REQUEST_SET_DEVICE_POWER_STATE, /* bRequest */
-+ USB_TYPE_VENDOR|USB_RECIP_DEVICE, /* bmRequestType */
-+ USB_DEVICE_POWER_STATE_D0, /* wValue */
-+ 0, /* wIndex */
-+ NULL, /* Data */
-+ 0, /* wLength */
-+ 1000); /* Timeout */
-+
-+ err("%s - rc(%d)", __FUNCTION__, rc);
-+ return rc;
-+}
-+#endif
-+//void sw_usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
-+static void sw_usb_serial_generic_read_bulk_callback (struct urb *urb)
-+{
-+ struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-+ struct usb_serial *serial = port->serial;
-+ struct tty_struct *tty;
-+ unsigned char *data = urb->transfer_buffer;
-+ int result;
-+ int i;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (urb->status) {
-+ dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
-+ return;
-+ }
-+
-+ //usb_serial_dbg_data(__FILE__, __FUNCTION__, urb->actual_length, data);
-+
-+ tty = port->tty;
-+ if (tty && urb->actual_length) {
-+ #if 0
-+ tty_buffer_request_room(tty, urb->actual_length);
-+ tty_insert_flip_string(tty, data, urb->actual_length);
-+ tty_flip_buffer_push(tty);
-+ #endif
-+ #if 1
-+ for (i = 0; i < urb->actual_length ; ++i) {
-+ /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
-+ if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
-+ tty_flip_buffer_push(tty);
-+ }
-+ /* this doesn't actually push the data through unless tty->low_latency is set */
-+ tty_insert_flip_char(tty, data[i], 0);
-+ }
-+ tty_flip_buffer_push(tty);
-+ #endif
-+
-+ }
-+ else
-+ dbg("%s: empty read urb received", __FUNCTION__);
-+
-+ /* Continue trying to always read */
-+ usb_fill_bulk_urb (port->read_urb, serial->dev,
-+ usb_rcvbulkpipe (serial->dev,
-+ port->bulk_in_endpointAddress),
-+ port->read_urb->transfer_buffer,
-+ port->read_urb->transfer_buffer_length,
-+ ((serial->type->read_bulk_callback) ?
-+ serial->type->read_bulk_callback :
-+ sw_usb_serial_generic_read_bulk_callback), port);
-+ result = usb_submit_urb(port->read_urb);
-+ //result = usb_submit_urb(port->read_urb, GFP_ATOMIC); //for kernel 2.6
-+ if (result)
-+ dbg("%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
-+}
-+#if 1
-+static int generic_open (struct usb_serial_port *port, struct file *filp)
-+{
-+ struct usb_serial *serial = port->serial;
-+ int result = 0;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ /* force low_latency on so that our tty_push actually forces the data through,
-+ otherwise it is scheduled, and with high data rates (like with OHCI) data
-+ can get lost. */
-+ if (port->tty)
-+ port->tty->low_latency = 1;
-+
-+ /* if we have a bulk interrupt, start reading from it */
-+ if (serial->num_bulk_in) {
-+ /* Start reading from the device */
-+ usb_fill_bulk_urb (port->read_urb, serial->dev,
-+ usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
-+ port->read_urb->transfer_buffer,
-+ port->read_urb->transfer_buffer_length,
-+ ((serial->type->read_bulk_callback) ?
-+ serial->type->read_bulk_callback :
-+ sw_usb_serial_generic_read_bulk_callback),
-+ port);
-+ result = usb_submit_urb(port->read_urb); //, GFP_KERNEL);
-+ if (result)
-+ //dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
-+ dbg("%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
-+
-+ }
-+
-+ return result;
-+}
-+#endif
-+int sw_usb_serial_generic_open (struct usb_serial_port *port, struct file *filp)
-+{
-+ int rc;
-+ struct usb_serial *serial = port->serial;
-+ struct usb_device *hdev = serial->dev;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ rc = generic_open(port, filp);
-+ err("%s - rc(%d)", __FUNCTION__, rc);
-+
-+ if(0 == rc)
-+ {
-+ rc = usb_control_msg(
-+ hdev,
-+ usb_sndctrlpipe(hdev, 0),
-+ SET_CONTROL_LINE_STATE, /* bRequest */
-+ USB_TYPE_CLASS|USB_RECIP_INTERFACE, /* bmRequestType */
-+ ACM_CTRL_DTR|ACM_CTRL_RTS, /* wValue */
-+ 0, /* wIndex */
-+ NULL, /* Data */
-+ 0, /* wLength */
-+ 1000); /* Timeout */
-+ err("%s - usb_control_msg: rc(%d)", __FUNCTION__, rc);
-+ }
-+
-+ return rc;
-+}
-+
-+static void generic_cleanup (struct usb_serial_port *port)
-+{
-+ struct usb_serial *serial = port->serial;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ if (serial->dev) {
-+ /* shutdown any bulk reads that might be going on */
-+ if (serial->num_bulk_out)
-+ usb_unlink_urb(port->write_urb);
-+ //usb_kill_urb(port->write_urb);
-+ if (serial->num_bulk_in)
-+ usb_unlink_urb(port->read_urb);
-+ //usb_kill_urb(port->read_urb);
-+ }
-+}
-+
-+static void sw_usb_serial_generic_close (struct usb_serial_port *port, struct file * filp)
-+{
-+ int rc;
-+ struct usb_serial *serial = port->serial;
-+ struct usb_device *hdev = serial->dev;
-+
-+ dbg("%s - port %d", __FUNCTION__, port->number);
-+
-+ rc = usb_control_msg(
-+ hdev,
-+ usb_sndctrlpipe(hdev, 0),
-+ SET_CONTROL_LINE_STATE, /* bRequest */
-+ USB_TYPE_CLASS|USB_RECIP_INTERFACE, /* bmRequestType */
-+ 0, /* wValue */
-+ 0, /* wIndex */
-+ NULL, /* Data */
-+ 0, /* wLength */
-+ 1000); /* Timeout */
-+ err("%s - rc(%d)", __FUNCTION__, rc);
-+
-+ generic_cleanup (port);
-+}
-+
-+static void sw_usb_serial_generic_shutdown(struct usb_serial *serial)
-+{
-+ int i, rc;
-+ struct usb_device *hdev = serial->dev;
-+
-+ dbg("%s serial(0x%p)", __FUNCTION__, serial);
-+
-+ if(hdev)
-+ {
-+ rc = usb_control_msg(
-+ hdev,
-+ usb_sndctrlpipe(hdev, 0),
-+ USB_VENDER_REQUEST_SET_DEVICE_POWER_STATE, /* bRequest */
-+ USB_TYPE_VENDOR|USB_RECIP_DEVICE, /* bmRequestType */
-+ USB_DEVICE_POWER_STATE_D3, /* wValue */
-+ 0, /* wIndex */
-+ NULL, /* Data */
-+ 0, /* wLength */
-+ 1000); /* Timeout */
-+ err("%s - rc(%d)", __FUNCTION__, rc);
-+ }
-+
-+ /* stop reads and writes on all ports */
-+ for (i=0; i < serial->num_ports; ++i) {
-+ generic_cleanup(&serial->port[i]);
-+ }
-+}
-+int usb_serial_register(struct usb_serial_device_type *new_device)
-+{
-+ /* Add this device to our list of devices */
-+ list_add(&new_device->driver_list, &usb_serial_driver_list);
-+
-+ info ("USB Serial support registered for %s", new_device->name);
-+
-+ usb_scan_devices();
-+
-+ return 0;
-+}
-+
-+
-+void usb_serial_deregister(struct usb_serial_device_type *device)
-+{
-+ struct usb_serial *serial;
-+ int i;
-+
-+ info("USB Serial deregistering driver %s", device->name);
-+
-+ /* clear out the serial_table if the device is attached to a port */
-+ for(i = 0; i < SERIAL_TTY_MINORS; ++i) {
-+ serial = serial_table[i];
-+ if ((serial != NULL) && (serial->type == device)) {
-+ usb_driver_release_interface (&sierra_driver, serial->interface);
-+ usb_serial_disconnect (NULL, serial);
-+ }
-+ }
-+
-+ list_del(&device->driver_list);
-+}
-+
-+static int __init sierra_init(void)
-+{
-+ int retval;
-+ int i;
-+
-+ /* Initalize our global data */
-+ for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
-+ serial_table[i] = NULL;
-+ }
-+
-+ /* register the tty driver */
-+ serial_tty_driver.init_termios = tty_std_termios;
-+ serial_tty_driver.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-+ if (tty_register_driver (&serial_tty_driver)) {
-+ err("%s - failed to register tty driver", __FUNCTION__);
-+ return -1;
-+ }
-+
-+ retval = usb_serial_register(&sierra_device);
-+ if (retval)
-+ {
-+ tty_unregister_driver(&serial_tty_driver);
-+ printk("%s return usb_serial_register. retval=[%d].\n",__FUNCTION__, retval);
-+ return retval;
-+ }
-+ retval = usb_register(&sierra_driver);
-+ if (retval){
-+ usb_serial_deregister(&sierra_device);
-+ tty_unregister_driver(&serial_tty_driver);
-+ err("usb_register failed for the Sierra 3G USB-Serial driver. Error number %d\n", retval);
-+ return -1;
-+ }
-+
-+ return retval;
-+}
-+
-+static void __exit sierra_exit(void)
-+{
-+ usb_deregister(&sierra_driver);
-+ usb_serial_deregister(&sierra_device);
-+}
-+
-+module_init(sierra_init);
-+module_exit(sierra_exit);
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/drivers/usb/serial/sierra.h
-@@ -0,0 +1,32 @@
-+/*
-+ * Sierra Wireless CDMA Wireless Serial USB drive
-+ *
-+ * Current Copy modified by: Kevin Lloyd <linux@sierrawireless.com>
-+ * Original Copy written by: 2005 Greg Kroah-Hartman <gregkh <at> suse.de>
-+ *
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License version
-+ * 2 as published by the Free Software Foundation.
-+ *
-+ * Version history:
-+ Version 1.03 (Lloyd):
-+ Included support for DTR control and enhanced buffering (should help
-+ speed).
-+ */
-+
-+#define USB_VENDER_REQUEST_SET_DEVICE_POWER_STATE 0
-+
-+#define USB_DEVICE_POWER_STATE_D0 0x0000
-+#define USB_DEVICE_POWER_STATE_D1 0x0001
-+#define USB_DEVICE_POWER_STATE_D2 0x0002
-+#define USB_DEVICE_POWER_STATE_D3 0x0003
-+
-+#define SET_CONTROL_LINE_STATE 0x22
-+/*
-+ * Output control lines.
-+ */
-+
-+#define ACM_CTRL_DTR 0x01
-+#define ACM_CTRL_RTS 0x02
-+
diff --git a/target/linux/brcm-2.4/patches/015-sierra_kconfig.patch b/target/linux/brcm-2.4/patches/015-sierra_kconfig.patch
deleted file mode 100644
index 6b6ca6a34b..0000000000
--- a/target/linux/brcm-2.4/patches/015-sierra_kconfig.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/usb/serial/Config.in
-+++ b/drivers/usb/serial/Config.in
-@@ -39,6 +39,7 @@ if [ "$CONFIG_USB_SERIAL" != "n" ]; then
- dep_tristate ' USB KOBIL chipcard reader (EXPERIMENTAL)' CONFIG_USB_SERIAL_KOBIL_SCT $CONFIG_USB_SERIAL $CONFIG_EXPERIMENTAL
- dep_tristate ' USB Prolific 2303 Single Port Serial Driver' CONFIG_USB_SERIAL_PL2303 $CONFIG_USB_SERIAL
- dep_tristate ' USB REINER SCT cyberJack pinpad/e-com chipcard reader (EXPERIMENTAL)' CONFIG_USB_SERIAL_CYBERJACK $CONFIG_USB_SERIAL $CONFIG_EXPERIMENTAL
-+ dep_tristate ' USB Sierra Wireless Driver' CONFIG_USB_SERIAL_SIERRAWIRELESS $CONFIG_USB_SERIAL
- dep_tristate ' USB Xircom / Entregra Single Port Serial Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_XIRCOM $CONFIG_USB_SERIAL $CONFIG_EXPERIMENTAL
- dep_tristate ' USB ZyXEL omni.net LCD Plus Driver (EXPERIMENTAL)' CONFIG_USB_SERIAL_OMNINET $CONFIG_USB_SERIAL $CONFIG_EXPERIMENTAL
- fi
---- a/drivers/usb/serial/Makefile
-+++ b/drivers/usb/serial/Makefile
-@@ -26,6 +26,7 @@ obj-$(CONFIG_USB_SERIAL_CYBERJACK) += c
- obj-$(CONFIG_USB_SERIAL_IR) += ir-usb.o
- obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o
- obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o
-+obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o
-
- # Objects that export symbols.
- export-objs := usbserial.o
diff --git a/target/linux/brcm-2.4/patches/016-fuse-ntfs-3g-mips.patch b/target/linux/brcm-2.4/patches/016-fuse-ntfs-3g-mips.patch
deleted file mode 100644
index c1031a3399..0000000000
--- a/target/linux/brcm-2.4/patches/016-fuse-ntfs-3g-mips.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/arch/mips/mm/c-r4k.c
-+++ b/arch/mips/mm/c-r4k.c
-@@ -325,7 +325,7 @@ static void r4k_flush_cache_mm(struct mm
- r4k_blast_scache();
- }
-
--static void r4k_flush_cache_page(struct vm_area_struct *vma,
-+void r4k_flush_cache_page(struct vm_area_struct *vma,
- unsigned long page)
- {
- int exec = vma->vm_flags & VM_EXEC;
-@@ -385,6 +385,7 @@ static void r4k_flush_cache_page(struct
- r4k_blast_icache_page_indexed(page);
- }
- }
-+EXPORT_SYMBOL(r4k_flush_cache_page);
-
- static void r4k_flush_data_cache_page(unsigned long addr)
- {
---- a/arch/mips/mm/Makefile
-+++ b/arch/mips/mm/Makefile
-@@ -11,7 +11,7 @@ USE_STANDARD_AS_RULE := true
- O_TARGET := mm.o
-
- export-objs := cache.o ioremap.o loadmmu.o remap.o \
-- tlb-r4k.o tlb-sb1.o
-+ tlb-r4k.o tlb-sb1.o c-r4k.o
- obj-y += cache.o extable.o init.o ioremap.o fault.o \
- loadmmu.o
-
diff --git a/target/linux/brcm-2.4/patches/100-wl_config.patch b/target/linux/brcm-2.4/patches/100-wl_config.patch
deleted file mode 100644
index 4870c4c1ec..0000000000
--- a/target/linux/brcm-2.4/patches/100-wl_config.patch
+++ /dev/null
@@ -1,66 +0,0 @@
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -445,16 +445,12 @@ struct net_device
- /* bridge stuff */
- struct net_bridge_port *br_port;
-
--#ifdef CONFIG_NET_FASTROUTE
- #define NETDEV_FASTROUTE_HMASK 0xF
- /* Semi-private data. Keep it at the end of device struct. */
- rwlock_t fastpath_lock;
- struct dst_entry *fastpath[NETDEV_FASTROUTE_HMASK+1];
--#endif
--#ifdef CONFIG_NET_DIVERT
- /* this will get initialized at each interface type init routine */
- struct divert_blk *divert;
--#endif /* CONFIG_NET_DIVERT */
- };
-
- /* 2.6 compatibility */
---- a/include/linux/skbuff.h
-+++ b/include/linux/skbuff.h
-@@ -83,7 +83,6 @@
- #define NET_CALLER(arg) __builtin_return_address(0)
- #endif
-
--#ifdef CONFIG_NETFILTER
- struct nf_conntrack {
- atomic_t use;
- void (*destroy)(struct nf_conntrack *);
-@@ -92,7 +91,6 @@ struct nf_conntrack {
- struct nf_ct_info {
- struct nf_conntrack *master;
- };
--#endif
- #if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
- struct nf_info;
- #endif
-@@ -201,7 +199,6 @@ struct sk_buff {
- unsigned char *end; /* End pointer */
-
- void (*destructor)(struct sk_buff *); /* Destruct function */
--#ifdef CONFIG_NETFILTER
- /* Can be used for communication between hooks. */
- unsigned long nfmark;
- /* Cache info */
-@@ -211,7 +208,6 @@ struct sk_buff {
- #ifdef CONFIG_NETFILTER_DEBUG
- unsigned int nf_debug;
- #endif
--#endif /*CONFIG_NETFILTER*/
-
- #if defined(CONFIG_HIPPI)
- union{
-@@ -219,12 +215,8 @@ struct sk_buff {
- } private;
- #endif
-
--#ifdef CONFIG_NET_SCHED
- __u32 tc_index; /* traffic control index */
--#endif
--#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
- struct nf_info *nf_info;
--#endif
- };
-
- #ifdef __KERNEL__
diff --git a/target/linux/brcm-2.4/patches/110-b44_alignment.patch b/target/linux/brcm-2.4/patches/110-b44_alignment.patch
deleted file mode 100644
index 1f6e975b8d..0000000000
--- a/target/linux/brcm-2.4/patches/110-b44_alignment.patch
+++ /dev/null
@@ -1,103 +0,0 @@
---- a/drivers/net/b44.c
-+++ b/drivers/net/b44.c
-@@ -101,7 +101,8 @@ static int instance = 0;
- (BP)->tx_cons - (BP)->tx_prod - TX_RING_GAP(BP))
- #define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1))
-
--#define RX_PKT_BUF_SZ (1536 + bp->rx_offset + 64)
-+#define RX_HEADER_OFS (RX_HEADER_LEN + 2)
-+#define RX_PKT_BUF_SZ (1536 + RX_HEADER_OFS)
-
- /* minimum number of free TX descriptors required to wake up TX process */
- #define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4)
-@@ -734,10 +735,8 @@ static int b44_alloc_rx_skb(struct b44 *
- mapping = pci_map_single(bp->pdev, skb->data,
- RX_PKT_BUF_SZ,
- PCI_DMA_FROMDEVICE);
-- skb_reserve(skb, bp->rx_offset);
-
-- rh = (struct rx_header *)
-- (skb->data - bp->rx_offset);
-+ rh = (struct rx_header *) skb->data;
- rh->len = 0;
- rh->flags = 0;
-
-@@ -747,13 +746,13 @@ static int b44_alloc_rx_skb(struct b44 *
- if (src_map != NULL)
- src_map->skb = NULL;
-
-- ctrl = (DESC_CTRL_LEN & (RX_PKT_BUF_SZ - bp->rx_offset));
-+ ctrl = (DESC_CTRL_LEN & RX_PKT_BUF_SZ);
- if (dest_idx == (B44_RX_RING_SIZE - 1))
- ctrl |= DESC_CTRL_EOT;
-
- dp = &bp->rx_ring[dest_idx];
- dp->ctrl = cpu_to_le32(ctrl);
-- dp->addr = cpu_to_le32((u32) mapping + bp->rx_offset + bp->dma_offset);
-+ dp->addr = cpu_to_le32((u32) mapping + bp->dma_offset);
-
- return RX_PKT_BUF_SZ;
- }
-@@ -812,7 +811,7 @@ static int b44_rx(struct b44 *bp, int bu
- PCI_DMA_FROMDEVICE);
- rh = (struct rx_header *) skb->data;
- len = cpu_to_le16(rh->len);
-- if ((len > (RX_PKT_BUF_SZ - bp->rx_offset)) ||
-+ if ((len > (RX_PKT_BUF_SZ - RX_HEADER_OFS)) ||
- (rh->flags & cpu_to_le16(RX_FLAG_ERRORS))) {
- drop_it:
- b44_recycle_rx(bp, cons, bp->rx_prod);
-@@ -844,8 +843,8 @@ static int b44_rx(struct b44 *bp, int bu
- pci_unmap_single(bp->pdev, map,
- skb_size, PCI_DMA_FROMDEVICE);
- /* Leave out rx_header */
-- skb_put(skb, len+bp->rx_offset);
-- skb_pull(skb,bp->rx_offset);
-+ skb_put(skb, len+RX_HEADER_OFS);
-+ skb_pull(skb,RX_HEADER_OFS);
- } else {
- struct sk_buff *copy_skb;
-
-@@ -858,7 +857,7 @@ static int b44_rx(struct b44 *bp, int bu
- skb_reserve(copy_skb, 2);
- skb_put(copy_skb, len);
- /* DMA sync done above, copy just the actual packet */
-- memcpy(copy_skb->data, skb->data+bp->rx_offset, len);
-+ memcpy(copy_skb->data, skb->data+RX_HEADER_OFS, len);
-
- skb = copy_skb;
- }
-@@ -1344,7 +1343,7 @@ static void b44_init_hw(struct b44 *bp)
- bw32(B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
- bw32(B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
- bw32(B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
-- (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
-+ (RX_HEADER_OFS << DMARX_CTRL_ROSHIFT)));
- bw32(B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
-
- bw32(B44_DMARX_PTR, bp->rx_pending);
-@@ -1873,13 +1872,7 @@ static int __devinit b44_get_invariants(
- bp->mdc_port = (eeprom[90] >> 14) & 0x1;
- }
-
-- /* With this, plus the rx_header prepended to the data by the
-- * hardware, we'll land the ethernet header on a 2-byte boundary.
-- */
-- bp->rx_offset = 30;
--
- bp->imask = IMASK_DEF;
--
- bp->core_unit = ssb_core_unit(bp);
-
- /* XXX - really required?
---- a/drivers/net/b44.h
-+++ b/drivers/net/b44.h
-@@ -518,8 +518,6 @@ struct b44 {
- #define B44_FLAG_ADV_100FULL 0x08000000
- #define B44_FLAG_INTERNAL_PHY 0x10000000
-
-- u32 rx_offset;
--
- u32 msg_enable;
-
- struct timer_list timer;
diff --git a/target/linux/brcm-2.4/patches/200-fix_ipv6_receiving_with_ipv4_socket.patch b/target/linux/brcm-2.4/patches/200-fix_ipv6_receiving_with_ipv4_socket.patch
deleted file mode 100644
index 8d836c2ec5..0000000000
--- a/target/linux/brcm-2.4/patches/200-fix_ipv6_receiving_with_ipv4_socket.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/net/ipv4/udp.c 2009-12-26 00:06:59.000000000 +0100
-+++ b/net/ipv4/udp.c 2009-12-27 00:27:05.003012266 +0100
-@@ -711,7 +711,14 @@
- skb = skb_recv_datagram(sk, flags, noblock, &err);
- if (!skb)
- goto out;
--
-+
-+ if (skb->nh.iph->version != 4) {
-+ skb_free_datagram(sk, skb);
-+ if (noblock)
-+ return -EAGAIN;
-+ goto try_again;
-+ }
-+
- copied = skb->len - sizeof(struct udphdr);
- if (copied > len) {
- copied = len;