From e2ea72515ff9d28169f2e1bba053de5108cf2d94 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 19 Feb 2012 17:52:15 +0000
Subject: [PATCH] ramips: rt305x: nuke built-in MTD partition maps

SVN-Revision: 30650
---
 .../arch/mips/ralink/rt305x/mach-all0256n.c   | 34 --------------
 .../mips/ralink/rt305x/mach-argus-atp52b.c    | 32 --------------
 .../files/arch/mips/ralink/rt305x/mach-bc2.c  | 36 ---------------
 .../mips/ralink/rt305x/mach-dir-300-revb.c    | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-esr-9753.c   | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-f5d8235-v2.c | 30 -------------
 .../arch/mips/ralink/rt305x/mach-fonera20n.c  | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-hw550-3g.c   | 36 ---------------
 .../mips/ralink/rt305x/mach-mofi3500-3gn.c    | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-nbg-419n.c   | 28 ------------
 .../arch/mips/ralink/rt305x/mach-nw718.c      | 41 -----------------
 .../arch/mips/ralink/rt305x/mach-omni-emb.c   | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-pwh2004.c    | 32 --------------
 .../mips/ralink/rt305x/mach-rt-g32-revb.c     | 35 ---------------
 .../arch/mips/ralink/rt305x/mach-sl-r7205.c   | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-v22rw-2x2.c  | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-w502u.c      | 41 -----------------
 .../arch/mips/ralink/rt305x/mach-wcr150gn.c   | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-whr-g300n.c  | 40 -----------------
 .../arch/mips/ralink/rt305x/mach-wl341v3.c    | 44 -------------------
 .../arch/mips/ralink/rt305x/mach-wl351.c      | 37 ----------------
 .../arch/mips/ralink/rt305x/mach-wr512-3gn.c  | 36 ---------------
 .../arch/mips/ralink/rt305x/mach-wr6202.c     | 31 -------------
 23 files changed, 821 deletions(-)

diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c
index cd25c4345b..d30300e2da 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-all0256n.c
@@ -12,9 +12,6 @@
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -31,39 +28,8 @@
 #define ALL0256N_KEYS_POLL_INTERVAL 20
 #define ALL0256N_KEYS_DEBOUNCE_INTERVAL	(3 * ALL0256N_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition all0256n_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0D0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x2E0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3B0000,
-	}
-};
-
 const struct flash_platform_data all0256n_flash = {
 	.type		= "mx25l3205d",
-	.parts		= all0256n_partitions,
-	.nr_parts	= ARRAY_SIZE(all0256n_partitions),
 };
 
 struct spi_board_info all0256n_spi_slave_info[] __initdata = {
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c
index 14e4e98fb9..b683485d71 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-argus-atp52b.c
@@ -11,9 +11,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -62,39 +59,10 @@ static struct gpio_keys_button argus_atp52b_gpio_buttons[] __initdata = {
 	}
 };
 
-static struct mtd_partition argus_atp52b_partitions[] = {
-	{
-		.name	= "bootloader",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x120000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x170000,
-		.size   = 0x690000,
-	}
-};
-
 static void __init argus_atp52b_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(argus_atp52b_partitions);
-	rt305x_flash0_data.parts = argus_atp52b_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(argus_atp52b_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c
index 25a8714b5d..7a21488511 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -28,37 +25,6 @@
 #define BC2_KEYS_POLL_INTERVAL		20
 #define BC2_KEYS_DEBOUNCE_INTERVAL	(3 * BC2_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition bc2_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0a0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x6b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7b0000,
-	}
-};
-
 static struct gpio_led bc2_leds_gpio[] __initdata = {
 	{
 		.name		= "bc2:blue:usb",
@@ -84,8 +50,6 @@ static void __init bc2_init(void)
 			  RT305X_GPIO_MODE_UART0_SHIFT) |
 			  RT305X_GPIO_MODE_JTAG);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(bc2_partitions);
-	rt305x_flash0_data.parts = bc2_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(bc2_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c
index f660272bc5..4db89b3cba 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -32,37 +29,6 @@
 #define DIR_300B_KEYS_POLL_INTERVAL	20
 #define DIR_300B_KEYS_DEBOUNCE_INTERVAL	(3 * DIR_300B_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition dir_300b_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "devdata",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "devconf",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x2e0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 static struct gpio_led dir_300b_leds_gpio[] __initdata = {
 	{
 		.name		= "d-link:amber:status",
@@ -101,8 +67,6 @@ static void __init dir_300b_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(dir_300b_partitions);
-	rt305x_flash0_data.parts = dir_300b_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c
index 6e0799b994..d5f65df5ec 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -31,37 +28,6 @@
 #define ESR_9753_KEYS_POLL_INTERVAL	20
 #define ESR_9753_KEYS_DEBOUNCE_INTERVAL	(3 * ESR_9753_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition esr_9753_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0a0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x2b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 static struct gpio_led esr_9753_leds_gpio[] __initdata = {
 	{
 		.name		= "esr-9753:orange:power",
@@ -96,8 +62,6 @@ static void __init esr_9753_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(esr_9753_partitions);
-	rt305x_flash0_data.parts = esr_9753_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(esr_9753_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c
index 6bcca6024b..073fc75a6e 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <linux/rtl8366.h>
 
@@ -74,31 +71,6 @@ static struct gpio_led f5d8235v2_leds_gpio[] __initdata = {
 	}
 };
 
-static struct mtd_partition f5d8235v2_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x050000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel and rootfs",
-		.offset	= 0x050000,
-		.size	= 0x790000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x1D0000,
-		.size	= 0x610000,
-	}, {
-		.name	= "nvram",
-		.offset	= 0x7E0000,
-		.size	= 0x010000,
-	}, {
-		.name	= "factory",
-		.offset	= 0x7F0000,
-		.size	= 0x010000,
-	}
-};
-
 static struct rtl8366_platform_data f5d8235v2_switch_data = {
 	.gpio_sda	= RT305X_GPIO_I2C_SD,
 	.gpio_sck	= RT305X_GPIO_I2C_SCLK,
@@ -120,8 +92,6 @@ static void __init f5d8235v2_init(void)
 					RT305X_GPIO_MODE_SPI |
 					RT305X_GPIO_MODE_MDIO);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(f5d8235v2_partitions);
-	rt305x_flash0_data.parts = f5d8235v2_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235v2_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c
index f68f4640ef..a433e40e91 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c
@@ -11,9 +11,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -32,37 +29,6 @@
 #define FONERA20N_KEYS_POLL_INTERVAL	20
 #define FONERA20N_KEYS_DEBOUNCE_INTERVAL (3 * FONERA20N_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition fonera20n_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0a0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x6b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7b0000,
-	}
-};
-
 static struct gpio_led fonera20n_leds_gpio[] __initdata = {
 	{
 		.name		= "fonera20n:orange:wifi",
@@ -101,8 +67,6 @@ static void __init fonera20n_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(fonera20n_partitions);
-	rt305x_flash0_data.parts = fonera20n_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(fonera20n_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c
index ce328988ea..4ebcefd523 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -34,37 +31,6 @@
 #define HW550_3G_KEYS_POLL_INTERVAL	20
 #define HW550_3G_KEYS_DEBOUNCE_INTERVAL	(3 * HW550_3G_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition hw550_3g_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x6e0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7b0000,
-	}
-};
-
 static struct gpio_led hw550_3g_leds_gpio[] __initdata = {
 	{
 		.name		= "hw550-3g:green:usb",
@@ -118,8 +84,6 @@ static void __init hw550_3g_init(void)
 {
 	rt305x_gpio_init(HW550_3G_GPIO_MODE);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(hw550_3g_partitions);
-	rt305x_flash0_data.parts = hw550_3g_partitions;
 	rt305x_register_flash(0);
 
        rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c
index 62faf554fb..38d217a4ff 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -34,37 +31,6 @@
 #define MOFI3500_3GN_KEYS_POLL_INTERVAL		20
 #define MOFI3500_3GN_KEYS_DEBOUNCE_INTERVAL	(3 * MOFI3500_3GN_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition mofi3500_3gn_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x6e0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7b0000,
-	}
-};
-
 static struct gpio_led mofi3500_3gn_leds_gpio[] __initdata = {
 	{
 		.name		= "mofi3500-3gn:green:usb",
@@ -118,8 +84,6 @@ static void __init mofi3500_3gn_init(void)
 {
 	rt305x_gpio_init(MOFI3500_3GN_GPIO_MODE);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(mofi3500_3gn_partitions);
-	rt305x_flash0_data.parts = mofi3500_3gn_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c
index 4410b032c4..856520368f 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -31,29 +28,6 @@
 #define NBG_419N_KEYS_POLL_INTERVAL	20
 #define NBG_419N_KEYS_DEBOUNCE_INTERVAL	(3 * NBG_419N_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition nbg_419n_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 static struct gpio_led nbg_419n_leds_gpio[] __initdata = {
 	{
 		.name		= "nbg-419n:green:power",
@@ -88,8 +62,6 @@ static void __init nbg_419n_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(nbg_419n_partitions);
-	rt305x_flash0_data.parts = nbg_419n_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c
index a287bc63ff..ff367f9c48 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-nw718.c
@@ -9,11 +9,7 @@
  */
 
 #include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/flash.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -35,42 +31,6 @@
 #define NW718_KEYS_POLL_INTERVAL	20
 #define NW718_KEYS_DEBOUNCE_INTERVAL	(3 * NW718_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition nw718_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x020000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x050000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x060000,
-		.size	= 0x090000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x2b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x060000,
-		.size	= 0x3a0000,
-	}
-};
-
-static struct flash_platform_data nw718_flash_data = {
-	.nr_parts	= ARRAY_SIZE(nw718_partitions),
-	.parts		= nw718_partitions,
-};
-
 static struct gpio_led nw718_leds_gpio[] __initdata = {
 	{
 		.name		= "nw718:amber:cpu",
@@ -111,7 +71,6 @@ static struct spi_board_info nw718_spi_info[] = {
 		.chip_select	= 0,
 		.max_speed_hz	= 25000000,
 		.modalias	= "m25p80",
-		.platform_data	= &nw718_flash_data,
 		.controller_data = (void *) NW718_GPIO_SPI_CS0,
 	}
 };
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c
index 50cc0bcb28..930ac3028f 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 #include <linux/gpio.h>
 
 #include <asm/mach-ralink/machine.h>
@@ -31,36 +28,6 @@
 #define OMNI_EMB_GPIO_LED_STATUS	9
 #define OMNI_EMB_GPIO_LED_WLAN		14
 
-static struct mtd_partition emb_partitions[] = {
-	{
-		.name	= "uboot",
-		.offset	= 0,
-		.size	= 0x030000,
-	}, {
-		.name	= "uboot-config",
-		.offset	= 0x030000,
-		.size	= 0x040000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x050000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "linux",
-		.offset	= 0x050000,
-		.size	= 0x100000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x6B0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7B0000,
-	}
-};
-
 static struct gpio_led omni_emb_leds_gpio[] __initdata = {
 	{
 		.name           = "emb:green:status",
@@ -96,10 +63,7 @@ static void __init omni_emb_init(void)
 				ARRAY_SIZE(omni_emb_gpio_buttons),
 				omni_emb_gpio_buttons);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(emb_partitions);
-	rt305x_flash0_data.parts = emb_partitions;
 	rt305x_register_flash(0);
-
 	rt305x_register_ethernet();
 	rt305x_register_wifi();
 	rt305x_register_wdt();
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c
index e544fe6967..5baf32a49a 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -28,33 +25,6 @@
 #define PWH2004_KEYS_POLL_INTERVAL	20
 #define PWH2004_KEYS_DEBOUNCE_INTERVAL	(3 * PWH2004_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition pwh2004_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x7b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7b0000,
-	}
-};
-
 static struct gpio_led pwh2004_leds_gpio[] __initdata = {
 	{
 		.name		= "pwh2004:red:wifi",
@@ -82,8 +52,6 @@ static void __init pwh2004_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(pwh2004_partitions);
-	rt305x_flash0_data.parts = pwh2004_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(pwh2004_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c
index 2359f2a40d..2f0f710874 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-rt-g32-revb.c
@@ -12,8 +12,6 @@
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -28,41 +26,8 @@
 #define RT_G32B_KEYS_POLL_INTERVAL	20
 #define RT_G32B_KEYS_DEBOUNCE_INTERVAL	(3 * RT_G32B_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition rt_g32b_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "devdata",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "devconf",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x2e0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 const struct flash_platform_data rt_g32b_flash = {
 	.type		= "mx25l3205d",
-	.parts		= rt_g32b_partitions,
-	.nr_parts	= ARRAY_SIZE(rt_g32b_partitions),
 };
 
 struct spi_board_info __initdata rt_g32b_spi_slave_info[] = {
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c
index 9bb429f86c..31f002c9aa 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-sl-r7205.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -30,37 +27,6 @@
 #define SL_R7205_KEYS_POLL_INTERVAL	20
 #define SL_R7205_KEYS_DEBOUNCE_INTERVAL	(3 * SL_R7205_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition sl_r7205_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0a0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x2b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 static struct gpio_led sl_r7205_leds_gpio[] __initdata = {
 	{
 		.name		= "sl-r7205:green:wifi",
@@ -91,8 +57,6 @@ static void __init sl_r7205_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(sl_r7205_partitions);
-	rt305x_flash0_data.parts = sl_r7205_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c
index cbbf73001a..7f43dabdc4 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -30,37 +27,6 @@
 #define V22RW_2X2_KEYS_POLL_INTERVAL	20
 #define V22RW_2X2_KEYS_DEBOUNCE_INTERVAL (3 * V22RW_2X2_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition v22rw_2x2_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0a0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x2b0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 static struct gpio_led v22rw_2x2_leds_gpio[] __initdata = {
 	{
 		.name		= "v22rw-2x2:green:security",
@@ -95,8 +61,6 @@ static void __init v22rw_2x2_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(v22rw_2x2_partitions);
-	rt305x_flash0_data.parts = v22rw_2x2_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c
index 4e9dd18219..6633ca0288 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-w502u.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -31,42 +28,6 @@
 #define W502U_KEYS_POLL_INTERVAL	20
 #define W502U_KEYS_DEBOUNCE_INTERVAL	(3 * W502U_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition w502u_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x6d0000,
-	}, {
-		.name	= "data3g",
-		.offset	= 0x7f0000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x7a0000,
-	}
-};
-
 static struct gpio_led w502u_leds_gpio[] __initdata = {
 	{
 		.name		= "alfa:blue:usb",
@@ -104,8 +65,6 @@ static void __init w502u_init(void)
 	rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
 			  RT305X_GPIO_MODE_UART0_SHIFT));
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(w502u_partitions);
-	rt305x_flash0_data.parts = w502u_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c
index 1c0667b065..dec1a7bb5b 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -61,43 +58,10 @@ static struct gpio_keys_button wcr150gn_gpio_buttons[] __initdata = {
 	}
 };
 
-static struct mtd_partition wcr150gn_partitions[] = {
-	{
-		.name	= "bootloader",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "config",
-		.offset	= 0x030000,
-		.size	= 0x040000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x050000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size   = 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size   = 0x2e0000,
-	}, {
-		.name   = "firmware",
-		.offset = 0x050000,
-		.size   = 0x3b0000,
-	}
-};
-
 static void __init wcr150gn_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(wcr150gn_partitions);
-	rt305x_flash0_data.parts = wcr150gn_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(wcr150gn_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c
index fdcd6b3204..e5adb1909f 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -34,41 +31,6 @@
 #define WHR_G300N_KEYS_POLL_INTERVAL		20
 #define WHR_G300N_KEYS_DEBOUNCE_INTERVAL	(3 * WHR_G300N_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition whr_g300n_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x090000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x140000,
-		.size	= 0x2B0000,
-	}, {
-		.name	= "user",
-		.offset	= 0x3f0000,
-		.size	= 0x010000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3a0000,
-	}
-};
-
 static struct gpio_led whr_g300n_leds_gpio[] __initdata = {
 	{
 		.name		= "whr-g300n:red:diag",
@@ -121,8 +83,6 @@ static void __init whr_g300n_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(whr_g300n_partitions);
-	rt305x_flash0_data.parts = whr_g300n_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c
index 34d9cfe5c4..2cd1d5e47a 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c
@@ -10,9 +10,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -36,45 +33,6 @@
 #define WL341V3_KEYS_POLL_INTERVAL	20
 #define WL341V3_KEYS_DEBOUNCE_INTERVAL	(3 * WL341V3_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition wl341v3_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x020000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "board-nvram",
-		.offset	= 0x020000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x040000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x110000,
-		.size	= 0x2e0000,
-	}, {
-		.name	= "signature-eRcOmM",
-		.offset	= 0x3f0000,
-		.size	= 0x010000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x040000,
-		.size	= 0x3b0000,
-	}, {
-		.name	= "fullflash",
-		.offset	= 0x000000,
-		.size	= 0x400000,
-	}
-};
-
 static struct gpio_led wl341v3_leds_gpio[] __initdata = {
 	{
 		.name		= "wl341v3:amber:first",
@@ -129,8 +87,6 @@ static void __init wl341v3_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(wl341v3_partitions);
-	rt305x_flash0_data.parts = wl341v3_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c
index 8d37f8f87d..8551f2541c 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wl351.c
@@ -69,41 +69,6 @@ static struct gpio_keys_button wl351_gpio_buttons[] __initdata = {
 	}
 };
 
-static struct mtd_partition wl351_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "u-boot-env",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x110000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x160000,
-		.size	= 0x230000,
-	}, {
-		.name	= "user (jffs2)",
-		.offset	= 0x3F0000,
-		.size	= 0x010000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3a0000,
-	}
-};
-
 static struct rtl8366_platform_data wl351_switch_data = {
 	.gpio_sda	= RT305X_GPIO_I2C_SD,
 	.gpio_sck	= RT305X_GPIO_I2C_SCLK,
@@ -125,8 +90,6 @@ static void __init wl351_init(void)
 				RT305X_GPIO_MODE_SPI |
 				RT305X_GPIO_MODE_MDIO);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(wl351_partitions);
-	rt305x_flash0_data.parts = wl351_partitions;
 	rt305x_register_flash(0);
 
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(wl351_leds_gpio),
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c
index b1c51bb093..eed752353d 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c
@@ -18,9 +18,6 @@
 
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
 
 #include <asm/mach-ralink/machine.h>
 #include <asm/mach-ralink/dev-gpio-buttons.h>
@@ -45,37 +42,6 @@
 #define WR512_3GN_KEYS_POLL_INTERVAL	20
 #define WR512_3GN_KEYS_DEBOUNCE_INTERVAL (3 * WR512_3GN_KEYS_POLL_INTERVAL)
 
-static struct mtd_partition wr512_3gn_partitions[] = {
-	{
-		.name	= "u-boot",
-		.offset	= 0,
-		.size	= 0x030000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "devdata",
-		.offset	= 0x030000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "devconf",
-		.offset	= 0x040000,
-		.size	= 0x010000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "kernel",
-		.offset	= 0x050000,
-		.size	= 0x0d0000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x120000,
-		.size	= 0x2e0000,
-	}, {
-		.name	= "firmware",
-		.offset	= 0x050000,
-		.size	= 0x3b0000,
-	}
-};
-
 static struct gpio_led wr512_3gn_leds_gpio[] __initdata = {
 	{
 		.name		= "wr512:green:3g",
@@ -126,8 +92,6 @@ static void __init wr512_3gn_init(void)
 {
 	rt305x_gpio_init(WR512_3GN_GPIO_MODE);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(wr512_3gn_partitions);
-	rt305x_flash0_data.parts = wr512_3gn_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c
index 09940cc02f..591d9ceb59 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c
@@ -10,9 +10,6 @@
 
 #include<linux/init.h>
 #include<linux/platform_device.h>
-#include<linux/mtd/mtd.h>
-#include<linux/mtd/partitions.h>
-#include<linux/mtd/physmap.h>
 #include<linux/gpio.h>
 
 #include<asm/mach-ralink/machine.h>
@@ -34,32 +31,6 @@
 #define WR6202_GPIO_LED_3G	     13
 #define WR6202_GPIO_LED_WPS	     14
 
-static struct mtd_partition wr6202_partitions[] = {
-	{
-		.name	= "uboot",
-		.offset	= 0,
-		.size	= 0x030000,
-	}, {
-		.name	= "uboot-config",
-		.offset	= 0x030000,
-		.size	= 0x040000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "factory",
-		.offset	= 0x040000,
-		.size	= 0x050000,
-		.mask_flags = MTD_WRITEABLE,
-	}, {
-		.name	= "linux",
-		.offset	= 0x050000,
-		.size	= 0x100000,
-	}, {
-		.name	= "rootfs",
-		.offset	= 0x150000,
-		.size	= 0x6B0000,
-	}
-};
-
 static struct gpio_led wr6202_leds_gpio[] __initdata = {
 	{
 		.name           = "wr6202:blue:wps",
@@ -107,8 +78,6 @@ static void __init wr6202_init(void)
 	gpio_direction_output(WR6202_GPIO_USB_POWER, 0);
 	gpio_free(WR6202_GPIO_USB_POWER);
 
-	rt305x_flash0_data.nr_parts = ARRAY_SIZE(wr6202_partitions);
-	rt305x_flash0_data.parts = wr6202_partitions;
 	rt305x_register_flash(0);
 
 	rt305x_register_ethernet();
-- 
2.30.2