From e30aa8bf8d5ffe17cbcdfa963e2436e7c332fdcb Mon Sep 17 00:00:00 2001
From: kaloz <kaloz@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Mon, 24 Jan 2011 12:11:25 +0000
Subject: [PATCH] platform specific patches don't belong here - take #2

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25085 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 .../976-ssb_increase_pci_delay.patch          |   0
 .../977-ssb_export_fallback_sprom.patch       |   0
 .../976-ssb_increase_pci_delay.patch          |   0
 .../977-ssb_export_fallback_sprom.patch       |   0
 .../976-ssb_increase_pci_delay.patch          |   0
 .../977-ssb_export_fallback_sprom.patch       |   0
 .../patches-2.6.32}/985-cris-headers.patch    |   0
 .../patches-2.6.30/924-cs5535_gpio.patch      | 102 ------------------
 .../976-ssb_increase_pci_delay.patch          |  11 --
 .../976-ssb_increase_pci_delay.patch          |  11 --
 .../977-ssb_export_fallback_sprom.patch       |  20 ----
 .../patches-2.6.31/985-cris-headers.patch     |  27 -----
 .../patches-2.6.32/905-i386_build.patch       |  10 --
 .../patches-2.6.32/924-cs5535_gpio.patch      | 102 ------------------
 .../patches-2.6.32/985-cris-headers.patch     |  27 -----
 .../patches-2.6.34/905-i386_build.patch       |  10 --
 .../patches-2.6.34/985-cris-headers.patch     |  27 -----
 .../patches-2.6.35/905-i386_build.patch       |  10 --
 .../patches-2.6.35/924-cs5535_gpio.patch      | 102 ------------------
 .../977-ssb_export_fallback_sprom.patch       |  20 ----
 .../patches-2.6.35/985-cris-headers.patch     |  27 -----
 .../patches-2.6.36/905-i386_build.patch       |  10 --
 .../patches-2.6.36/924-cs5535_gpio.patch      | 102 ------------------
 .../976-ssb_increase_pci_delay.patch          |  11 --
 .../977-ssb_export_fallback_sprom.patch       |  20 ----
 .../patches-2.6.36/985-cris-headers.patch     |  26 -----
 .../patches-2.6.37/905-i386_build.patch       |  10 --
 .../patches-2.6.37/924-cs5535_gpio.patch      | 102 ------------------
 .../976-ssb_increase_pci_delay.patch          |  11 --
 .../977-ssb_export_fallback_sprom.patch       |  20 ----
 .../patches-2.6.37/985-cris-headers.patch     |  26 -----
 .../patches-2.6.38/905-i386_build.patch       |  10 --
 .../patches-2.6.38/924-cs5535_gpio.patch      | 102 ------------------
 .../976-ssb_increase_pci_delay.patch          |  11 --
 .../977-ssb_export_fallback_sprom.patch       |  20 ----
 .../patches-2.6.38/985-cris-headers.patch     |  26 -----
 .../patches-2.6.32}/905-i386_build.patch      |   0
 .../patches-2.6.32}/924-cs5535_gpio.patch     |   0
 .../patches-2.6.35}/905-i386_build.patch      |   0
 .../patches-2.6.35}/924-cs5535_gpio.patch     |   0
 40 files changed, 1013 deletions(-)
 rename target/linux/{generic/patches-2.6.32 => brcm47xx/patches-2.6.34}/976-ssb_increase_pci_delay.patch (100%)
 rename target/linux/{generic/patches-2.6.30 => brcm47xx/patches-2.6.34}/977-ssb_export_fallback_sprom.patch (100%)
 rename target/linux/{generic/patches-2.6.34 => brcm47xx/patches-2.6.36}/976-ssb_increase_pci_delay.patch (100%)
 rename target/linux/{generic/patches-2.6.32 => brcm47xx/patches-2.6.36}/977-ssb_export_fallback_sprom.patch (100%)
 rename target/linux/{generic/patches-2.6.35 => brcm47xx/patches-2.6.37}/976-ssb_increase_pci_delay.patch (100%)
 rename target/linux/{generic/patches-2.6.34 => brcm47xx/patches-2.6.37}/977-ssb_export_fallback_sprom.patch (100%)
 rename target/linux/{generic/patches-2.6.30 => etrax/patches-2.6.32}/985-cris-headers.patch (100%)
 delete mode 100644 target/linux/generic/patches-2.6.30/924-cs5535_gpio.patch
 delete mode 100644 target/linux/generic/patches-2.6.30/976-ssb_increase_pci_delay.patch
 delete mode 100644 target/linux/generic/patches-2.6.31/976-ssb_increase_pci_delay.patch
 delete mode 100644 target/linux/generic/patches-2.6.31/977-ssb_export_fallback_sprom.patch
 delete mode 100644 target/linux/generic/patches-2.6.31/985-cris-headers.patch
 delete mode 100644 target/linux/generic/patches-2.6.32/905-i386_build.patch
 delete mode 100644 target/linux/generic/patches-2.6.32/924-cs5535_gpio.patch
 delete mode 100644 target/linux/generic/patches-2.6.32/985-cris-headers.patch
 delete mode 100644 target/linux/generic/patches-2.6.34/905-i386_build.patch
 delete mode 100644 target/linux/generic/patches-2.6.34/985-cris-headers.patch
 delete mode 100644 target/linux/generic/patches-2.6.35/905-i386_build.patch
 delete mode 100644 target/linux/generic/patches-2.6.35/924-cs5535_gpio.patch
 delete mode 100644 target/linux/generic/patches-2.6.35/977-ssb_export_fallback_sprom.patch
 delete mode 100644 target/linux/generic/patches-2.6.35/985-cris-headers.patch
 delete mode 100644 target/linux/generic/patches-2.6.36/905-i386_build.patch
 delete mode 100644 target/linux/generic/patches-2.6.36/924-cs5535_gpio.patch
 delete mode 100644 target/linux/generic/patches-2.6.36/976-ssb_increase_pci_delay.patch
 delete mode 100644 target/linux/generic/patches-2.6.36/977-ssb_export_fallback_sprom.patch
 delete mode 100644 target/linux/generic/patches-2.6.36/985-cris-headers.patch
 delete mode 100644 target/linux/generic/patches-2.6.37/905-i386_build.patch
 delete mode 100644 target/linux/generic/patches-2.6.37/924-cs5535_gpio.patch
 delete mode 100644 target/linux/generic/patches-2.6.37/976-ssb_increase_pci_delay.patch
 delete mode 100644 target/linux/generic/patches-2.6.37/977-ssb_export_fallback_sprom.patch
 delete mode 100644 target/linux/generic/patches-2.6.37/985-cris-headers.patch
 delete mode 100644 target/linux/generic/patches-2.6.38/905-i386_build.patch
 delete mode 100644 target/linux/generic/patches-2.6.38/924-cs5535_gpio.patch
 delete mode 100644 target/linux/generic/patches-2.6.38/976-ssb_increase_pci_delay.patch
 delete mode 100644 target/linux/generic/patches-2.6.38/977-ssb_export_fallback_sprom.patch
 delete mode 100644 target/linux/generic/patches-2.6.38/985-cris-headers.patch
 rename target/linux/{generic/patches-2.6.30 => x86/patches-2.6.32}/905-i386_build.patch (100%)
 rename target/linux/{generic/patches-2.6.31 => x86/patches-2.6.32}/924-cs5535_gpio.patch (100%)
 rename target/linux/{generic/patches-2.6.31 => x86/patches-2.6.35}/905-i386_build.patch (100%)
 rename target/linux/{generic/patches-2.6.34 => x86/patches-2.6.35}/924-cs5535_gpio.patch (100%)

diff --git a/target/linux/generic/patches-2.6.32/976-ssb_increase_pci_delay.patch b/target/linux/brcm47xx/patches-2.6.34/976-ssb_increase_pci_delay.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.32/976-ssb_increase_pci_delay.patch
rename to target/linux/brcm47xx/patches-2.6.34/976-ssb_increase_pci_delay.patch
diff --git a/target/linux/generic/patches-2.6.30/977-ssb_export_fallback_sprom.patch b/target/linux/brcm47xx/patches-2.6.34/977-ssb_export_fallback_sprom.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.30/977-ssb_export_fallback_sprom.patch
rename to target/linux/brcm47xx/patches-2.6.34/977-ssb_export_fallback_sprom.patch
diff --git a/target/linux/generic/patches-2.6.34/976-ssb_increase_pci_delay.patch b/target/linux/brcm47xx/patches-2.6.36/976-ssb_increase_pci_delay.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.34/976-ssb_increase_pci_delay.patch
rename to target/linux/brcm47xx/patches-2.6.36/976-ssb_increase_pci_delay.patch
diff --git a/target/linux/generic/patches-2.6.32/977-ssb_export_fallback_sprom.patch b/target/linux/brcm47xx/patches-2.6.36/977-ssb_export_fallback_sprom.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.32/977-ssb_export_fallback_sprom.patch
rename to target/linux/brcm47xx/patches-2.6.36/977-ssb_export_fallback_sprom.patch
diff --git a/target/linux/generic/patches-2.6.35/976-ssb_increase_pci_delay.patch b/target/linux/brcm47xx/patches-2.6.37/976-ssb_increase_pci_delay.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.35/976-ssb_increase_pci_delay.patch
rename to target/linux/brcm47xx/patches-2.6.37/976-ssb_increase_pci_delay.patch
diff --git a/target/linux/generic/patches-2.6.34/977-ssb_export_fallback_sprom.patch b/target/linux/brcm47xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.34/977-ssb_export_fallback_sprom.patch
rename to target/linux/brcm47xx/patches-2.6.37/977-ssb_export_fallback_sprom.patch
diff --git a/target/linux/generic/patches-2.6.30/985-cris-headers.patch b/target/linux/etrax/patches-2.6.32/985-cris-headers.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.30/985-cris-headers.patch
rename to target/linux/etrax/patches-2.6.32/985-cris-headers.patch
diff --git a/target/linux/generic/patches-2.6.30/924-cs5535_gpio.patch b/target/linux/generic/patches-2.6.30/924-cs5535_gpio.patch
deleted file mode 100644
index 453affe58..000000000
--- a/target/linux/generic/patches-2.6.30/924-cs5535_gpio.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/char/cs5535_gpio.c
-+++ b/drivers/char/cs5535_gpio.c
-@@ -15,6 +15,7 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/cdev.h>
-+#include <linux/device.h>
- #include <linux/ioport.h>
- #include <linux/pci.h>
- #include <linux/smp_lock.h>
-@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[] 
- MODULE_DEVICE_TABLE(pci, divil_pci);
- 
- static struct cdev cs5535_gpio_cdev;
-+static struct class *cs5535_gpio_class;
- 
- /* reserve 32 entries even though some aren't usable */
- #define CS5535_GPIO_COUNT	32
-@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] =
- 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
- 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
- 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
-+	{ 0x10, 0x10, 'A', 'a' },	/* GPIOx_OUT_AUX1_SEL */
-+	{ 0x14, 0x14, 'B', 'b' },	/* GPIOx_OUT_AUX2_SEL */
- 	{ 0x08, 0x08, 't', 'T' },	/* GPIOx_OUT_OD_EN */
- 	{ 0x18, 0x18, 'P', 'p' },	/* GPIOx_OUT_PU_EN */
- 	{ 0x1c, 0x1c, 'D', 'd' },	/* GPIOx_OUT_PD_EN */
-+	{ 0x24, 0x24, 'N', 'n' },	/* GPIOx_IN_INV_EN */
-+	{ 0x0c, 0x0c, 'X', 'x' },	/* GPIOx_OUT_INV_EN */
-+	{ 0x00, 0x00, 'H', 'L' },	/* GPIOx_OUT_VAL */
- };
- 
- 
-@@ -177,7 +184,7 @@ static int __init cs5535_gpio_init(void)
- {
- 	dev_t	dev_id;
- 	u32	low, hi;
--	int	retval;
-+	int	retval, i;
- 
- 	if (pci_dev_present(divil_pci) == 0) {
- 		printk(KERN_WARNING NAME ": DIVIL not found\n");
-@@ -232,23 +239,54 @@ static int __init cs5535_gpio_init(void)
- 		major = MAJOR(dev_id);
- 	}
- 
--	if (retval) {
--		release_region(gpio_base, CS5535_GPIO_SIZE);
--		return -1;
--	}
-+	if (retval)
-+		goto error;
- 
- 	printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n",
- 	       gpio_base, mask, major);
- 
- 	cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops);
--	cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	if (retval) {
-+		kobject_put(&cs5535_gpio_cdev.kobj);
-+		goto error_region;
-+	}
-+
-+	cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio");
-+	if (IS_ERR(cs5535_gpio_class)) {
-+		printk(KERN_ERR "Error creating cs5535_gpio class\n");
-+		cdev_del(&cs5535_gpio_cdev);
-+		retval = PTR_ERR(cs5535_gpio_class);
-+		goto error_region;
-+	}
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_create(cs5535_gpio_class, NULL, MKDEV(major, i), NULL, "cs5535_gpio%d", i);
-+		}
-+	}
- 
- 	return 0;
-+
-+error_region:
-+	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-+error:
-+	release_region(gpio_base, CS5535_GPIO_SIZE);
-+	return retval;
- }
- 
- static void __exit cs5535_gpio_cleanup(void)
- {
- 	dev_t dev_id = MKDEV(major, 0);
-+	int i;
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_destroy(cs5535_gpio_class, MKDEV(major, i));
-+		}
-+	}
-+
-+	class_destroy(cs5535_gpio_class);
- 
- 	cdev_del(&cs5535_gpio_cdev);
- 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
diff --git a/target/linux/generic/patches-2.6.30/976-ssb_increase_pci_delay.patch b/target/linux/generic/patches-2.6.30/976-ssb_increase_pci_delay.patch
deleted file mode 100644
index f51e3bc9a..000000000
--- a/target/linux/generic/patches-2.6.30/976-ssb_increase_pci_delay.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/ssb/driver_pcicore.c
-+++ b/drivers/ssb/driver_pcicore.c
-@@ -399,7 +399,7 @@ static void ssb_pcicore_init_hostmode(st
- 	set_io_port_base(ssb_pcicore_controller.io_map_base);
- 	/* Give some time to the PCI controller to configure itself with the new
- 	 * values. Not waiting at this point causes crashes of the machine. */
--	mdelay(10);
-+	mdelay(300);
- 	register_pci_controller(&ssb_pcicore_controller);
- }
- 
diff --git a/target/linux/generic/patches-2.6.31/976-ssb_increase_pci_delay.patch b/target/linux/generic/patches-2.6.31/976-ssb_increase_pci_delay.patch
deleted file mode 100644
index f51e3bc9a..000000000
--- a/target/linux/generic/patches-2.6.31/976-ssb_increase_pci_delay.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/ssb/driver_pcicore.c
-+++ b/drivers/ssb/driver_pcicore.c
-@@ -399,7 +399,7 @@ static void ssb_pcicore_init_hostmode(st
- 	set_io_port_base(ssb_pcicore_controller.io_map_base);
- 	/* Give some time to the PCI controller to configure itself with the new
- 	 * values. Not waiting at this point causes crashes of the machine. */
--	mdelay(10);
-+	mdelay(300);
- 	register_pci_controller(&ssb_pcicore_controller);
- }
- 
diff --git a/target/linux/generic/patches-2.6.31/977-ssb_export_fallback_sprom.patch b/target/linux/generic/patches-2.6.31/977-ssb_export_fallback_sprom.patch
deleted file mode 100644
index 5ca1d231c..000000000
--- a/target/linux/generic/patches-2.6.31/977-ssb_export_fallback_sprom.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/ssb/sprom.c
-+++ b/drivers/ssb/sprom.c
-@@ -174,6 +174,7 @@ int ssb_arch_set_fallback_sprom(const st
- 
- 	return 0;
- }
-+EXPORT_SYMBOL(ssb_get_fallback_sprom);
- 
- const struct ssb_sprom *ssb_get_fallback_sprom(void)
- {
---- a/include/linux/ssb/ssb.h
-+++ b/include/linux/ssb/ssb.h
-@@ -387,6 +387,7 @@ extern void ssb_bus_unregister(struct ss
- /* Set a fallback SPROM.
-  * See kdoc at the function definition for complete documentation. */
- extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
-+extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
- 
- /* Suspend a SSB bus.
-  * Call this from the parent bus suspend routine. */
diff --git a/target/linux/generic/patches-2.6.31/985-cris-headers.patch b/target/linux/generic/patches-2.6.31/985-cris-headers.patch
deleted file mode 100644
index 73ede933b..000000000
--- a/target/linux/generic/patches-2.6.31/985-cris-headers.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,11 +1,14 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
-+header-y += page.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
- 
- unifdef-y += etraxgpio.h
- unifdef-y += rs485.h
diff --git a/target/linux/generic/patches-2.6.32/905-i386_build.patch b/target/linux/generic/patches-2.6.32/905-i386_build.patch
deleted file mode 100644
index c701fdaa9..000000000
--- a/target/linux/generic/patches-2.6.32/905-i386_build.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -29,7 +29,6 @@
- #include <stdarg.h>
- #include <sys/types.h>
- #include <sys/stat.h>
--#include <sys/sysmacros.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/target/linux/generic/patches-2.6.32/924-cs5535_gpio.patch b/target/linux/generic/patches-2.6.32/924-cs5535_gpio.patch
deleted file mode 100644
index a36ea4993..000000000
--- a/target/linux/generic/patches-2.6.32/924-cs5535_gpio.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/char/cs5535_gpio.c
-+++ b/drivers/char/cs5535_gpio.c
-@@ -15,6 +15,7 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/cdev.h>
-+#include <linux/device.h>
- #include <linux/ioport.h>
- #include <linux/pci.h>
- #include <linux/smp_lock.h>
-@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[]
- MODULE_DEVICE_TABLE(pci, divil_pci);
- 
- static struct cdev cs5535_gpio_cdev;
-+static struct class *cs5535_gpio_class;
- 
- /* reserve 32 entries even though some aren't usable */
- #define CS5535_GPIO_COUNT	32
-@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] =
- 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
- 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
- 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
-+	{ 0x10, 0x10, 'A', 'a' },	/* GPIOx_OUT_AUX1_SEL */
-+	{ 0x14, 0x14, 'B', 'b' },	/* GPIOx_OUT_AUX2_SEL */
- 	{ 0x08, 0x08, 't', 'T' },	/* GPIOx_OUT_OD_EN */
- 	{ 0x18, 0x18, 'P', 'p' },	/* GPIOx_OUT_PU_EN */
- 	{ 0x1c, 0x1c, 'D', 'd' },	/* GPIOx_OUT_PD_EN */
-+	{ 0x24, 0x24, 'N', 'n' },	/* GPIOx_IN_INV_EN */
-+	{ 0x0c, 0x0c, 'X', 'x' },	/* GPIOx_OUT_INV_EN */
-+	{ 0x00, 0x00, 'H', 'L' },	/* GPIOx_OUT_VAL */
- };
- 
- 
-@@ -177,7 +184,7 @@ static int __init cs5535_gpio_init(void)
- {
- 	dev_t	dev_id;
- 	u32	low, hi;
--	int	retval;
-+	int	retval, i;
- 
- 	if (pci_dev_present(divil_pci) == 0) {
- 		printk(KERN_WARNING NAME ": DIVIL not found\n");
-@@ -232,23 +239,54 @@ static int __init cs5535_gpio_init(void)
- 		major = MAJOR(dev_id);
- 	}
- 
--	if (retval) {
--		release_region(gpio_base, CS5535_GPIO_SIZE);
--		return -1;
--	}
-+	if (retval)
-+		goto error;
- 
- 	printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n",
- 	       gpio_base, mask, major);
- 
- 	cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops);
--	cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	if (retval) {
-+		kobject_put(&cs5535_gpio_cdev.kobj);
-+		goto error_region;
-+	}
-+
-+	cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio");
-+	if (IS_ERR(cs5535_gpio_class)) {
-+		printk(KERN_ERR "Error creating cs5535_gpio class\n");
-+		cdev_del(&cs5535_gpio_cdev);
-+		retval = PTR_ERR(cs5535_gpio_class);
-+		goto error_region;
-+	}
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_create(cs5535_gpio_class, NULL, MKDEV(major, i), NULL, "cs5535_gpio%d", i);
-+		}
-+	}
- 
- 	return 0;
-+
-+error_region:
-+	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-+error:
-+	release_region(gpio_base, CS5535_GPIO_SIZE);
-+	return retval;
- }
- 
- static void __exit cs5535_gpio_cleanup(void)
- {
- 	dev_t dev_id = MKDEV(major, 0);
-+	int i;
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_destroy(cs5535_gpio_class, MKDEV(major, i));
-+		}
-+	}
-+
-+	class_destroy(cs5535_gpio_class);
- 
- 	cdev_del(&cs5535_gpio_cdev);
- 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
diff --git a/target/linux/generic/patches-2.6.32/985-cris-headers.patch b/target/linux/generic/patches-2.6.32/985-cris-headers.patch
deleted file mode 100644
index 73ede933b..000000000
--- a/target/linux/generic/patches-2.6.32/985-cris-headers.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,11 +1,14 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
-+header-y += page.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
- 
- unifdef-y += etraxgpio.h
- unifdef-y += rs485.h
diff --git a/target/linux/generic/patches-2.6.34/905-i386_build.patch b/target/linux/generic/patches-2.6.34/905-i386_build.patch
deleted file mode 100644
index c701fdaa9..000000000
--- a/target/linux/generic/patches-2.6.34/905-i386_build.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -29,7 +29,6 @@
- #include <stdarg.h>
- #include <sys/types.h>
- #include <sys/stat.h>
--#include <sys/sysmacros.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/target/linux/generic/patches-2.6.34/985-cris-headers.patch b/target/linux/generic/patches-2.6.34/985-cris-headers.patch
deleted file mode 100644
index 73ede933b..000000000
--- a/target/linux/generic/patches-2.6.34/985-cris-headers.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,11 +1,14 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
-+header-y += page.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
- 
- unifdef-y += etraxgpio.h
- unifdef-y += rs485.h
diff --git a/target/linux/generic/patches-2.6.35/905-i386_build.patch b/target/linux/generic/patches-2.6.35/905-i386_build.patch
deleted file mode 100644
index c701fdaa9..000000000
--- a/target/linux/generic/patches-2.6.35/905-i386_build.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -29,7 +29,6 @@
- #include <stdarg.h>
- #include <sys/types.h>
- #include <sys/stat.h>
--#include <sys/sysmacros.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/target/linux/generic/patches-2.6.35/924-cs5535_gpio.patch b/target/linux/generic/patches-2.6.35/924-cs5535_gpio.patch
deleted file mode 100644
index 9081be84a..000000000
--- a/target/linux/generic/patches-2.6.35/924-cs5535_gpio.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/char/cs5535_gpio.c
-+++ b/drivers/char/cs5535_gpio.c
-@@ -15,6 +15,7 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/cdev.h>
-+#include <linux/device.h>
- #include <linux/ioport.h>
- #include <linux/pci.h>
- 
-@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[]
- MODULE_DEVICE_TABLE(pci, divil_pci);
- 
- static struct cdev cs5535_gpio_cdev;
-+static struct class *cs5535_gpio_class;
- 
- /* reserve 32 entries even though some aren't usable */
- #define CS5535_GPIO_COUNT	32
-@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] =
- 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
- 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
- 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
-+	{ 0x10, 0x10, 'A', 'a' },	/* GPIOx_OUT_AUX1_SEL */
-+	{ 0x14, 0x14, 'B', 'b' },	/* GPIOx_OUT_AUX2_SEL */
- 	{ 0x08, 0x08, 't', 'T' },	/* GPIOx_OUT_OD_EN */
- 	{ 0x18, 0x18, 'P', 'p' },	/* GPIOx_OUT_PU_EN */
- 	{ 0x1c, 0x1c, 'D', 'd' },	/* GPIOx_OUT_PD_EN */
-+	{ 0x24, 0x24, 'N', 'n' },	/* GPIOx_IN_INV_EN */
-+	{ 0x0c, 0x0c, 'X', 'x' },	/* GPIOx_OUT_INV_EN */
-+	{ 0x00, 0x00, 'H', 'L' },	/* GPIOx_OUT_VAL */
- };
- 
- 
-@@ -176,7 +183,7 @@ static int __init cs5535_gpio_init(void)
- {
- 	dev_t	dev_id;
- 	u32	low, hi;
--	int	retval;
-+	int	retval, i;
- 
- 	if (pci_dev_present(divil_pci) == 0) {
- 		printk(KERN_WARNING NAME ": DIVIL not found\n");
-@@ -231,23 +238,54 @@ static int __init cs5535_gpio_init(void)
- 		major = MAJOR(dev_id);
- 	}
- 
--	if (retval) {
--		release_region(gpio_base, CS5535_GPIO_SIZE);
--		return -1;
--	}
-+	if (retval)
-+		goto error;
- 
- 	printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n",
- 	       gpio_base, mask, major);
- 
- 	cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops);
--	cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	if (retval) {
-+		kobject_put(&cs5535_gpio_cdev.kobj);
-+		goto error_region;
-+	}
-+
-+	cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio");
-+	if (IS_ERR(cs5535_gpio_class)) {
-+		printk(KERN_ERR "Error creating cs5535_gpio class\n");
-+		cdev_del(&cs5535_gpio_cdev);
-+		retval = PTR_ERR(cs5535_gpio_class);
-+		goto error_region;
-+	}
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_create(cs5535_gpio_class, NULL, MKDEV(major, i), NULL, "cs5535_gpio%d", i);
-+		}
-+	}
- 
- 	return 0;
-+
-+error_region:
-+	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-+error:
-+	release_region(gpio_base, CS5535_GPIO_SIZE);
-+	return retval;
- }
- 
- static void __exit cs5535_gpio_cleanup(void)
- {
- 	dev_t dev_id = MKDEV(major, 0);
-+	int i;
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_destroy(cs5535_gpio_class, MKDEV(major, i));
-+		}
-+	}
-+
-+	class_destroy(cs5535_gpio_class);
- 
- 	cdev_del(&cs5535_gpio_cdev);
- 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
diff --git a/target/linux/generic/patches-2.6.35/977-ssb_export_fallback_sprom.patch b/target/linux/generic/patches-2.6.35/977-ssb_export_fallback_sprom.patch
deleted file mode 100644
index 2a22a3a38..000000000
--- a/target/linux/generic/patches-2.6.35/977-ssb_export_fallback_sprom.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/ssb/sprom.c
-+++ b/drivers/ssb/sprom.c
-@@ -176,6 +176,7 @@ const struct ssb_sprom *ssb_get_fallback
- {
- 	return fallback_sprom;
- }
-+EXPORT_SYMBOL(ssb_get_fallback_sprom);
- 
- /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
- bool ssb_is_sprom_available(struct ssb_bus *bus)
---- a/include/linux/ssb/ssb.h
-+++ b/include/linux/ssb/ssb.h
-@@ -401,6 +401,7 @@ extern bool ssb_is_sprom_available(struc
- /* Set a fallback SPROM.
-  * See kdoc at the function definition for complete documentation. */
- extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
-+extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
- 
- /* Suspend a SSB bus.
-  * Call this from the parent bus suspend routine. */
diff --git a/target/linux/generic/patches-2.6.35/985-cris-headers.patch b/target/linux/generic/patches-2.6.35/985-cris-headers.patch
deleted file mode 100644
index 73ede933b..000000000
--- a/target/linux/generic/patches-2.6.35/985-cris-headers.patch
+++ /dev/null
@@ -1,27 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,11 +1,14 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
-+header-y += page.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
- 
- unifdef-y += etraxgpio.h
- unifdef-y += rs485.h
diff --git a/target/linux/generic/patches-2.6.36/905-i386_build.patch b/target/linux/generic/patches-2.6.36/905-i386_build.patch
deleted file mode 100644
index c701fdaa9..000000000
--- a/target/linux/generic/patches-2.6.36/905-i386_build.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -29,7 +29,6 @@
- #include <stdarg.h>
- #include <sys/types.h>
- #include <sys/stat.h>
--#include <sys/sysmacros.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/target/linux/generic/patches-2.6.36/924-cs5535_gpio.patch b/target/linux/generic/patches-2.6.36/924-cs5535_gpio.patch
deleted file mode 100644
index 9081be84a..000000000
--- a/target/linux/generic/patches-2.6.36/924-cs5535_gpio.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/char/cs5535_gpio.c
-+++ b/drivers/char/cs5535_gpio.c
-@@ -15,6 +15,7 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/cdev.h>
-+#include <linux/device.h>
- #include <linux/ioport.h>
- #include <linux/pci.h>
- 
-@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[]
- MODULE_DEVICE_TABLE(pci, divil_pci);
- 
- static struct cdev cs5535_gpio_cdev;
-+static struct class *cs5535_gpio_class;
- 
- /* reserve 32 entries even though some aren't usable */
- #define CS5535_GPIO_COUNT	32
-@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] =
- 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
- 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
- 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
-+	{ 0x10, 0x10, 'A', 'a' },	/* GPIOx_OUT_AUX1_SEL */
-+	{ 0x14, 0x14, 'B', 'b' },	/* GPIOx_OUT_AUX2_SEL */
- 	{ 0x08, 0x08, 't', 'T' },	/* GPIOx_OUT_OD_EN */
- 	{ 0x18, 0x18, 'P', 'p' },	/* GPIOx_OUT_PU_EN */
- 	{ 0x1c, 0x1c, 'D', 'd' },	/* GPIOx_OUT_PD_EN */
-+	{ 0x24, 0x24, 'N', 'n' },	/* GPIOx_IN_INV_EN */
-+	{ 0x0c, 0x0c, 'X', 'x' },	/* GPIOx_OUT_INV_EN */
-+	{ 0x00, 0x00, 'H', 'L' },	/* GPIOx_OUT_VAL */
- };
- 
- 
-@@ -176,7 +183,7 @@ static int __init cs5535_gpio_init(void)
- {
- 	dev_t	dev_id;
- 	u32	low, hi;
--	int	retval;
-+	int	retval, i;
- 
- 	if (pci_dev_present(divil_pci) == 0) {
- 		printk(KERN_WARNING NAME ": DIVIL not found\n");
-@@ -231,23 +238,54 @@ static int __init cs5535_gpio_init(void)
- 		major = MAJOR(dev_id);
- 	}
- 
--	if (retval) {
--		release_region(gpio_base, CS5535_GPIO_SIZE);
--		return -1;
--	}
-+	if (retval)
-+		goto error;
- 
- 	printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n",
- 	       gpio_base, mask, major);
- 
- 	cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops);
--	cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	if (retval) {
-+		kobject_put(&cs5535_gpio_cdev.kobj);
-+		goto error_region;
-+	}
-+
-+	cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio");
-+	if (IS_ERR(cs5535_gpio_class)) {
-+		printk(KERN_ERR "Error creating cs5535_gpio class\n");
-+		cdev_del(&cs5535_gpio_cdev);
-+		retval = PTR_ERR(cs5535_gpio_class);
-+		goto error_region;
-+	}
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_create(cs5535_gpio_class, NULL, MKDEV(major, i), NULL, "cs5535_gpio%d", i);
-+		}
-+	}
- 
- 	return 0;
-+
-+error_region:
-+	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-+error:
-+	release_region(gpio_base, CS5535_GPIO_SIZE);
-+	return retval;
- }
- 
- static void __exit cs5535_gpio_cleanup(void)
- {
- 	dev_t dev_id = MKDEV(major, 0);
-+	int i;
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_destroy(cs5535_gpio_class, MKDEV(major, i));
-+		}
-+	}
-+
-+	class_destroy(cs5535_gpio_class);
- 
- 	cdev_del(&cs5535_gpio_cdev);
- 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
diff --git a/target/linux/generic/patches-2.6.36/976-ssb_increase_pci_delay.patch b/target/linux/generic/patches-2.6.36/976-ssb_increase_pci_delay.patch
deleted file mode 100644
index af67367b1..000000000
--- a/target/linux/generic/patches-2.6.36/976-ssb_increase_pci_delay.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/ssb/driver_pcicore.c
-+++ b/drivers/ssb/driver_pcicore.c
-@@ -370,7 +370,7 @@ static void ssb_pcicore_init_hostmode(st
- 	set_io_port_base(ssb_pcicore_controller.io_map_base);
- 	/* Give some time to the PCI controller to configure itself with the new
- 	 * values. Not waiting at this point causes crashes of the machine. */
--	mdelay(10);
-+	mdelay(300);
- 	register_pci_controller(&ssb_pcicore_controller);
- }
- 
diff --git a/target/linux/generic/patches-2.6.36/977-ssb_export_fallback_sprom.patch b/target/linux/generic/patches-2.6.36/977-ssb_export_fallback_sprom.patch
deleted file mode 100644
index 2a22a3a38..000000000
--- a/target/linux/generic/patches-2.6.36/977-ssb_export_fallback_sprom.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/ssb/sprom.c
-+++ b/drivers/ssb/sprom.c
-@@ -176,6 +176,7 @@ const struct ssb_sprom *ssb_get_fallback
- {
- 	return fallback_sprom;
- }
-+EXPORT_SYMBOL(ssb_get_fallback_sprom);
- 
- /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
- bool ssb_is_sprom_available(struct ssb_bus *bus)
---- a/include/linux/ssb/ssb.h
-+++ b/include/linux/ssb/ssb.h
-@@ -401,6 +401,7 @@ extern bool ssb_is_sprom_available(struc
- /* Set a fallback SPROM.
-  * See kdoc at the function definition for complete documentation. */
- extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
-+extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
- 
- /* Suspend a SSB bus.
-  * Call this from the parent bus suspend routine. */
diff --git a/target/linux/generic/patches-2.6.36/985-cris-headers.patch b/target/linux/generic/patches-2.6.36/985-cris-headers.patch
deleted file mode 100644
index 88cfec5db..000000000
--- a/target/linux/generic/patches-2.6.36/985-cris-headers.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,10 +1,13 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
- header-y += etraxgpio.h
-+header-y += page.h
- header-y += rs485.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
diff --git a/target/linux/generic/patches-2.6.37/905-i386_build.patch b/target/linux/generic/patches-2.6.37/905-i386_build.patch
deleted file mode 100644
index c701fdaa9..000000000
--- a/target/linux/generic/patches-2.6.37/905-i386_build.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -29,7 +29,6 @@
- #include <stdarg.h>
- #include <sys/types.h>
- #include <sys/stat.h>
--#include <sys/sysmacros.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/target/linux/generic/patches-2.6.37/924-cs5535_gpio.patch b/target/linux/generic/patches-2.6.37/924-cs5535_gpio.patch
deleted file mode 100644
index 8d8b9b2aa..000000000
--- a/target/linux/generic/patches-2.6.37/924-cs5535_gpio.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/char/cs5535_gpio.c
-+++ b/drivers/char/cs5535_gpio.c
-@@ -15,6 +15,7 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/cdev.h>
-+#include <linux/device.h>
- #include <linux/ioport.h>
- #include <linux/pci.h>
- 
-@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[] 
- MODULE_DEVICE_TABLE(pci, divil_pci);
- 
- static struct cdev cs5535_gpio_cdev;
-+static struct class *cs5535_gpio_class;
- 
- /* reserve 32 entries even though some aren't usable */
- #define CS5535_GPIO_COUNT	32
-@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] =
- 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
- 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
- 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
-+	{ 0x10, 0x10, 'A', 'a' },	/* GPIOx_OUT_AUX1_SEL */
-+	{ 0x14, 0x14, 'B', 'b' },	/* GPIOx_OUT_AUX2_SEL */
- 	{ 0x08, 0x08, 't', 'T' },	/* GPIOx_OUT_OD_EN */
- 	{ 0x18, 0x18, 'P', 'p' },	/* GPIOx_OUT_PU_EN */
- 	{ 0x1c, 0x1c, 'D', 'd' },	/* GPIOx_OUT_PD_EN */
-+	{ 0x24, 0x24, 'N', 'n' },	/* GPIOx_IN_INV_EN */
-+	{ 0x0c, 0x0c, 'X', 'x' },	/* GPIOx_OUT_INV_EN */
-+	{ 0x00, 0x00, 'H', 'L' },	/* GPIOx_OUT_VAL */
- };
- 
- 
-@@ -177,7 +184,7 @@ static int __init cs5535_gpio_init(void)
- {
- 	dev_t	dev_id;
- 	u32	low, hi;
--	int	retval;
-+	int	retval, i;
- 
- 	if (pci_dev_present(divil_pci) == 0) {
- 		printk(KERN_WARNING NAME ": DIVIL not found\n");
-@@ -232,23 +239,54 @@ static int __init cs5535_gpio_init(void)
- 		major = MAJOR(dev_id);
- 	}
- 
--	if (retval) {
--		release_region(gpio_base, CS5535_GPIO_SIZE);
--		return -1;
--	}
-+	if (retval)
-+		goto error;
- 
- 	printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n",
- 	       gpio_base, mask, major);
- 
- 	cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops);
--	cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	if (retval) {
-+		kobject_put(&cs5535_gpio_cdev.kobj);
-+		goto error_region;
-+	}
-+
-+	cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio");
-+	if (IS_ERR(cs5535_gpio_class)) {
-+		printk(KERN_ERR "Error creating cs5535_gpio class\n");
-+		cdev_del(&cs5535_gpio_cdev);
-+		retval = PTR_ERR(cs5535_gpio_class);
-+		goto error_region;
-+	}
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_create(cs5535_gpio_class, NULL, MKDEV(major, i), NULL, "cs5535_gpio%d", i);
-+		}
-+	}
- 
- 	return 0;
-+
-+error_region:
-+	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-+error:
-+	release_region(gpio_base, CS5535_GPIO_SIZE);
-+	return retval;
- }
- 
- static void __exit cs5535_gpio_cleanup(void)
- {
- 	dev_t dev_id = MKDEV(major, 0);
-+	int i;
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_destroy(cs5535_gpio_class, MKDEV(major, i));
-+		}
-+	}
-+
-+	class_destroy(cs5535_gpio_class);
- 
- 	cdev_del(&cs5535_gpio_cdev);
- 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
diff --git a/target/linux/generic/patches-2.6.37/976-ssb_increase_pci_delay.patch b/target/linux/generic/patches-2.6.37/976-ssb_increase_pci_delay.patch
deleted file mode 100644
index af67367b1..000000000
--- a/target/linux/generic/patches-2.6.37/976-ssb_increase_pci_delay.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/ssb/driver_pcicore.c
-+++ b/drivers/ssb/driver_pcicore.c
-@@ -370,7 +370,7 @@ static void ssb_pcicore_init_hostmode(st
- 	set_io_port_base(ssb_pcicore_controller.io_map_base);
- 	/* Give some time to the PCI controller to configure itself with the new
- 	 * values. Not waiting at this point causes crashes of the machine. */
--	mdelay(10);
-+	mdelay(300);
- 	register_pci_controller(&ssb_pcicore_controller);
- }
- 
diff --git a/target/linux/generic/patches-2.6.37/977-ssb_export_fallback_sprom.patch b/target/linux/generic/patches-2.6.37/977-ssb_export_fallback_sprom.patch
deleted file mode 100644
index 2a22a3a38..000000000
--- a/target/linux/generic/patches-2.6.37/977-ssb_export_fallback_sprom.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/ssb/sprom.c
-+++ b/drivers/ssb/sprom.c
-@@ -176,6 +176,7 @@ const struct ssb_sprom *ssb_get_fallback
- {
- 	return fallback_sprom;
- }
-+EXPORT_SYMBOL(ssb_get_fallback_sprom);
- 
- /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
- bool ssb_is_sprom_available(struct ssb_bus *bus)
---- a/include/linux/ssb/ssb.h
-+++ b/include/linux/ssb/ssb.h
-@@ -401,6 +401,7 @@ extern bool ssb_is_sprom_available(struc
- /* Set a fallback SPROM.
-  * See kdoc at the function definition for complete documentation. */
- extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
-+extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
- 
- /* Suspend a SSB bus.
-  * Call this from the parent bus suspend routine. */
diff --git a/target/linux/generic/patches-2.6.37/985-cris-headers.patch b/target/linux/generic/patches-2.6.37/985-cris-headers.patch
deleted file mode 100644
index 88cfec5db..000000000
--- a/target/linux/generic/patches-2.6.37/985-cris-headers.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,10 +1,13 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
- header-y += etraxgpio.h
-+header-y += page.h
- header-y += rs485.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
diff --git a/target/linux/generic/patches-2.6.38/905-i386_build.patch b/target/linux/generic/patches-2.6.38/905-i386_build.patch
deleted file mode 100644
index c701fdaa9..000000000
--- a/target/linux/generic/patches-2.6.38/905-i386_build.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -29,7 +29,6 @@
- #include <stdarg.h>
- #include <sys/types.h>
- #include <sys/stat.h>
--#include <sys/sysmacros.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/mman.h>
diff --git a/target/linux/generic/patches-2.6.38/924-cs5535_gpio.patch b/target/linux/generic/patches-2.6.38/924-cs5535_gpio.patch
deleted file mode 100644
index 69b4053a1..000000000
--- a/target/linux/generic/patches-2.6.38/924-cs5535_gpio.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- a/drivers/staging/cs5535_gpio/cs5535_gpio.c
-+++ b/drivers/staging/cs5535_gpio/cs5535_gpio.c
-@@ -15,6 +15,7 @@
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/cdev.h>
-+#include <linux/device.h>
- #include <linux/ioport.h>
- #include <linux/pci.h>
- 
-@@ -48,6 +49,7 @@ static struct pci_device_id divil_pci[]
- MODULE_DEVICE_TABLE(pci, divil_pci);
- 
- static struct cdev cs5535_gpio_cdev;
-+static struct class *cs5535_gpio_class;
- 
- /* reserve 32 entries even though some aren't usable */
- #define CS5535_GPIO_COUNT	32
-@@ -66,9 +68,14 @@ static struct gpio_regmap rm[] =
- 	{ 0x30, 0x00, '1', '0' },	/* GPIOx_READ_BACK / GPIOx_OUT_VAL */
- 	{ 0x20, 0x20, 'I', 'i' },	/* GPIOx_IN_EN */
- 	{ 0x04, 0x04, 'O', 'o' },	/* GPIOx_OUT_EN */
-+	{ 0x10, 0x10, 'A', 'a' },	/* GPIOx_OUT_AUX1_SEL */
-+	{ 0x14, 0x14, 'B', 'b' },	/* GPIOx_OUT_AUX2_SEL */
- 	{ 0x08, 0x08, 't', 'T' },	/* GPIOx_OUT_OD_EN */
- 	{ 0x18, 0x18, 'P', 'p' },	/* GPIOx_OUT_PU_EN */
- 	{ 0x1c, 0x1c, 'D', 'd' },	/* GPIOx_OUT_PD_EN */
-+	{ 0x24, 0x24, 'N', 'n' },	/* GPIOx_IN_INV_EN */
-+	{ 0x0c, 0x0c, 'X', 'x' },	/* GPIOx_OUT_INV_EN */
-+	{ 0x00, 0x00, 'H', 'L' },	/* GPIOx_OUT_VAL */
- };
- 
- 
-@@ -177,7 +184,7 @@ static int __init cs5535_gpio_init(void)
- {
- 	dev_t	dev_id;
- 	u32	low, hi;
--	int	retval;
-+	int	retval, i;
- 
- 	if (pci_dev_present(divil_pci) == 0) {
- 		printk(KERN_WARNING NAME ": DIVIL not found\n");
-@@ -232,23 +239,54 @@ static int __init cs5535_gpio_init(void)
- 		major = MAJOR(dev_id);
- 	}
- 
--	if (retval) {
--		release_region(gpio_base, CS5535_GPIO_SIZE);
--		return -1;
--	}
-+	if (retval)
-+		goto error;
- 
- 	printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n",
- 	       gpio_base, mask, major);
- 
- 	cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops);
--	cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	retval = cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT);
-+	if (retval) {
-+		kobject_put(&cs5535_gpio_cdev.kobj);
-+		goto error_region;
-+	}
-+
-+	cs5535_gpio_class = class_create(THIS_MODULE, "cs5535_gpio");
-+	if (IS_ERR(cs5535_gpio_class)) {
-+		printk(KERN_ERR "Error creating cs5535_gpio class\n");
-+		cdev_del(&cs5535_gpio_cdev);
-+		retval = PTR_ERR(cs5535_gpio_class);
-+		goto error_region;
-+	}
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_create(cs5535_gpio_class, NULL, MKDEV(major, i), NULL, "cs5535_gpio%d", i);
-+		}
-+	}
- 
- 	return 0;
-+
-+error_region:
-+	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
-+error:
-+	release_region(gpio_base, CS5535_GPIO_SIZE);
-+	return retval;
- }
- 
- static void __exit cs5535_gpio_cleanup(void)
- {
- 	dev_t dev_id = MKDEV(major, 0);
-+	int i;
-+
-+	for (i = 0; i < CS5535_GPIO_COUNT; i++) {
-+		if (mask & (1<<i)) {
-+			device_destroy(cs5535_gpio_class, MKDEV(major, i));
-+		}
-+	}
-+
-+	class_destroy(cs5535_gpio_class);
- 
- 	cdev_del(&cs5535_gpio_cdev);
- 	unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT);
diff --git a/target/linux/generic/patches-2.6.38/976-ssb_increase_pci_delay.patch b/target/linux/generic/patches-2.6.38/976-ssb_increase_pci_delay.patch
deleted file mode 100644
index af67367b1..000000000
--- a/target/linux/generic/patches-2.6.38/976-ssb_increase_pci_delay.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/ssb/driver_pcicore.c
-+++ b/drivers/ssb/driver_pcicore.c
-@@ -370,7 +370,7 @@ static void ssb_pcicore_init_hostmode(st
- 	set_io_port_base(ssb_pcicore_controller.io_map_base);
- 	/* Give some time to the PCI controller to configure itself with the new
- 	 * values. Not waiting at this point causes crashes of the machine. */
--	mdelay(10);
-+	mdelay(300);
- 	register_pci_controller(&ssb_pcicore_controller);
- }
- 
diff --git a/target/linux/generic/patches-2.6.38/977-ssb_export_fallback_sprom.patch b/target/linux/generic/patches-2.6.38/977-ssb_export_fallback_sprom.patch
deleted file mode 100644
index 67f12c8fb..000000000
--- a/target/linux/generic/patches-2.6.38/977-ssb_export_fallback_sprom.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/drivers/ssb/sprom.c
-+++ b/drivers/ssb/sprom.c
-@@ -176,6 +176,7 @@ const struct ssb_sprom *ssb_get_fallback
- {
- 	return fallback_sprom;
- }
-+EXPORT_SYMBOL(ssb_get_fallback_sprom);
- 
- /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
- bool ssb_is_sprom_available(struct ssb_bus *bus)
---- a/include/linux/ssb/ssb.h
-+++ b/include/linux/ssb/ssb.h
-@@ -405,6 +405,7 @@ extern bool ssb_is_sprom_available(struc
- /* Set a fallback SPROM.
-  * See kdoc at the function definition for complete documentation. */
- extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
-+extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
- 
- /* Suspend a SSB bus.
-  * Call this from the parent bus suspend routine. */
diff --git a/target/linux/generic/patches-2.6.38/985-cris-headers.patch b/target/linux/generic/patches-2.6.38/985-cris-headers.patch
deleted file mode 100644
index 88cfec5db..000000000
--- a/target/linux/generic/patches-2.6.38/985-cris-headers.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/arch/cris/include/arch-v10/arch/Kbuild
-+++ b/arch/cris/include/arch-v10/arch/Kbuild
-@@ -1,3 +1,5 @@
-+header-y += elf.h
-+header-y += ptrace.h
- header-y += user.h
- header-y += svinto.h
- header-y += sv_addr_ag.h
---- a/arch/cris/include/asm/Kbuild
-+++ b/arch/cris/include/asm/Kbuild
-@@ -1,10 +1,13 @@
- include include/asm-generic/Kbuild.asm
- 
--header-y += arch-v10/
--header-y += arch-v32/
-+header-y += ../arch-v10/arch/
-+header-y += ../arch-v32/arch/
- 
-+header-y += elf.h
- header-y += ethernet.h
- header-y += etraxgpio.h
-+header-y += page.h
- header-y += rs485.h
- header-y += rtc.h
- header-y += sync_serial.h
-+header-y += user.h
diff --git a/target/linux/generic/patches-2.6.30/905-i386_build.patch b/target/linux/x86/patches-2.6.32/905-i386_build.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.30/905-i386_build.patch
rename to target/linux/x86/patches-2.6.32/905-i386_build.patch
diff --git a/target/linux/generic/patches-2.6.31/924-cs5535_gpio.patch b/target/linux/x86/patches-2.6.32/924-cs5535_gpio.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.31/924-cs5535_gpio.patch
rename to target/linux/x86/patches-2.6.32/924-cs5535_gpio.patch
diff --git a/target/linux/generic/patches-2.6.31/905-i386_build.patch b/target/linux/x86/patches-2.6.35/905-i386_build.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.31/905-i386_build.patch
rename to target/linux/x86/patches-2.6.35/905-i386_build.patch
diff --git a/target/linux/generic/patches-2.6.34/924-cs5535_gpio.patch b/target/linux/x86/patches-2.6.35/924-cs5535_gpio.patch
similarity index 100%
rename from target/linux/generic/patches-2.6.34/924-cs5535_gpio.patch
rename to target/linux/x86/patches-2.6.35/924-cs5535_gpio.patch
-- 
2.20.1