From 48d4c1988513010133c5316aca23ed87dbae6eb7 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 12 Feb 2012 12:52:10 +0000
Subject: ramips: rt305x: remove per-board physmap_flash_data instances

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30473 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 .../linux/ramips/files/arch/mips/ralink/rt305x/devices.c   | 14 +++++++++++---
 .../linux/ramips/files/arch/mips/ralink/rt305x/devices.h   |  5 ++++-
 .../files/arch/mips/ralink/rt305x/mach-argus-atp52b.c      | 11 +++++------
 .../linux/ramips/files/arch/mips/ralink/rt305x/mach-bc2.c  |  9 +++------
 .../files/arch/mips/ralink/rt305x/mach-dir-300-revb.c      | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-esr-9753.c   |  9 +++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-f5d8235-v2.c | 12 +++++-------
 .../ramips/files/arch/mips/ralink/rt305x/mach-fonera20n.c  |  9 +++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-hw550-3g.c   | 10 ++++------
 .../files/arch/mips/ralink/rt305x/mach-mofi3500-3gn.c      | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-nbg-419n.c   | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-omni-emb.c   | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-pwh2004.c    | 11 +++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-v22rw-2x2.c  | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-w502u.c      | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-wcr150gn.c   | 11 +++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-whr-g300n.c  | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-wl341v3.c    | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-wl351.c      | 12 +++++-------
 .../ramips/files/arch/mips/ralink/rt305x/mach-wr512-3gn.c  | 10 ++++------
 .../ramips/files/arch/mips/ralink/rt305x/mach-wr6202.c     | 10 ++++------
 21 files changed, 93 insertions(+), 120 deletions(-)

(limited to 'target/linux/ramips/files')

diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c
index 615f32dacc..a162515c05 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c
@@ -35,10 +35,14 @@ static struct resource rt305x_flash0_resources[] = {
 	},
 };
 
+struct physmap_flash_data rt305x_flash0_data;
 static struct platform_device rt305x_flash0_device = {
 	.name		= "physmap-flash",
 	.resource	= rt305x_flash0_resources,
 	.num_resources	= ARRAY_SIZE(rt305x_flash0_resources),
+	.dev = {
+		.platform_data = &rt305x_flash0_data,
+	},
 };
 
 static struct resource rt305x_flash1_resources[] = {
@@ -50,17 +54,21 @@ static struct resource rt305x_flash1_resources[] = {
 	},
 };
 
+struct physmap_flash_data rt305x_flash1_data;
 static struct platform_device rt305x_flash1_device = {
 	.name		= "physmap-flash",
 	.resource	= rt305x_flash1_resources,
 	.num_resources	= ARRAY_SIZE(rt305x_flash1_resources),
+	.dev = {
+		.platform_data = &rt305x_flash1_data,
+	},
 };
 
 static int rt305x_flash_instance __initdata;
-void __init rt305x_register_flash(unsigned int id,
-				  struct physmap_flash_data *pdata)
+void __init rt305x_register_flash(unsigned int id)
 {
 	struct platform_device *pdev;
+	struct physmap_flash_data *pdata;
 	u32 t;
 	int reg;
 
@@ -80,6 +88,7 @@ void __init rt305x_register_flash(unsigned int id,
 	t = rt305x_memc_rr(reg);
 	t = (t >> FLASH_CFG_WIDTH_SHIFT) & FLASH_CFG_WIDTH_MASK;
 
+	pdata = pdev->dev.platform_data;
 	switch (t) {
 	case FLASH_CFG_WIDTH_8BIT:
 		pdata->width = 1;
@@ -95,7 +104,6 @@ void __init rt305x_register_flash(unsigned int id,
 		return;
 	}
 
-	pdev->dev.platform_data = pdata;
 	pdev->id = rt305x_flash_instance;
 
 	platform_device_register(pdev);
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h
index 22dc5ea12d..22c9ce4232 100644
--- a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h
+++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h
@@ -16,9 +16,12 @@
 struct physmap_flash_data;
 struct spi_board_info;
 
+extern struct physmap_flash_data rt305x_flash0_data;
+extern struct physmap_flash_data rt305x_flash1_data;
+
 extern struct rt305x_esw_platform_data rt305x_esw_data;
 
-void rt305x_register_flash(unsigned int id, struct physmap_flash_data *pdata);
+void rt305x_register_flash(unsigned int id);
 void rt305x_register_ethernet(void);
 void rt305x_register_wifi(void);
 void rt305x_register_wdt(void);
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 00832f13bb..14e4e98fb9 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
@@ -89,15 +89,14 @@ static struct mtd_partition argus_atp52b_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data argus_atp52b_flash_data = {
-	.nr_parts	= ARRAY_SIZE(argus_atp52b_partitions),
-	.parts		= argus_atp52b_partitions,
-};
-
 static void __init argus_atp52b_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
-	rt305x_register_flash(0, &argus_atp52b_flash_data);
+
+	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),
 					argus_atp52b_leds_gpio);
 	ramips_register_gpio_buttons(-1, ARGUS_ATP52B_KEYS_POLL_INTERVAL,
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 4b03b776c7..25a8714b5d 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
@@ -59,11 +59,6 @@ static struct mtd_partition bc2_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data bc2_flash_data = {
-	.nr_parts	= ARRAY_SIZE(bc2_partitions),
-	.parts		= bc2_partitions,
-};
-
 static struct gpio_led bc2_leds_gpio[] __initdata = {
 	{
 		.name		= "bc2:blue:usb",
@@ -89,7 +84,9 @@ static void __init bc2_init(void)
 			  RT305X_GPIO_MODE_UART0_SHIFT) |
 			  RT305X_GPIO_MODE_JTAG);
 
-	rt305x_register_flash(0, &bc2_flash_data);
+	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),
 				  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 b84d9ed9f4..f660272bc5 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
@@ -63,11 +63,6 @@ static struct mtd_partition dir_300b_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data dir_300b_flash_data = {
-	.nr_parts	= ARRAY_SIZE(dir_300b_partitions),
-	.parts		= dir_300b_partitions,
-};
-
 static struct gpio_led dir_300b_leds_gpio[] __initdata = {
 	{
 		.name		= "d-link:amber:status",
@@ -106,7 +101,10 @@ static void __init dir_300b_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &dir_300b_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_300b_leds_gpio),
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 371487a217..6e0799b994 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
@@ -62,11 +62,6 @@ static struct mtd_partition esr_9753_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data esr_9753_flash_data = {
-	.nr_parts	= ARRAY_SIZE(esr_9753_partitions),
-	.parts		= esr_9753_partitions,
-};
-
 static struct gpio_led esr_9753_leds_gpio[] __initdata = {
 	{
 		.name		= "esr-9753:orange:power",
@@ -101,7 +96,9 @@ static void __init esr_9753_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &esr_9753_flash_data);
+	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),
 				  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 6b25c8c3e9..6bcca6024b 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
@@ -99,12 +99,6 @@ static struct mtd_partition f5d8235v2_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data f5d8235v2_flash_data = {
-	.nr_parts	= ARRAY_SIZE(f5d8235v2_partitions),
-	.parts		= f5d8235v2_partitions,
-};
-
-
 static struct rtl8366_platform_data f5d8235v2_switch_data = {
 	.gpio_sda	= RT305X_GPIO_I2C_SD,
 	.gpio_sck	= RT305X_GPIO_I2C_SCLK,
@@ -125,7 +119,11 @@ static void __init f5d8235v2_init(void)
 					RT305X_GPIO_MODE_I2C |
 					RT305X_GPIO_MODE_SPI |
 					RT305X_GPIO_MODE_MDIO);
-	rt305x_register_flash(0, &f5d8235v2_flash_data);
+
+	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),
 						f5d8235v2_leds_gpio);
 	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE;
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 5955f63918..f68f4640ef 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
@@ -63,11 +63,6 @@ static struct mtd_partition fonera20n_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data fonera20n_flash_data = {
-	.nr_parts	= ARRAY_SIZE(fonera20n_partitions),
-	.parts		= fonera20n_partitions,
-};
-
 static struct gpio_led fonera20n_leds_gpio[] __initdata = {
 	{
 		.name		= "fonera20n:orange:wifi",
@@ -106,7 +101,9 @@ static void __init fonera20n_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &fonera20n_flash_data);
+	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),
 				  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 08ee40a914..ce328988ea 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
@@ -65,11 +65,6 @@ static struct mtd_partition hw550_3g_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data hw550_3g_flash_data = {
-	.nr_parts	= ARRAY_SIZE(hw550_3g_partitions),
-	.parts		= hw550_3g_partitions,
-};
-
 static struct gpio_led hw550_3g_leds_gpio[] __initdata = {
 	{
 		.name		= "hw550-3g:green:usb",
@@ -123,7 +118,10 @@ static void __init hw550_3g_init(void)
 {
 	rt305x_gpio_init(HW550_3G_GPIO_MODE);
 
-	rt305x_register_flash(0, &hw550_3g_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(hw550_3g_leds_gpio),
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 fa046df9fe..62faf554fb 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
@@ -65,11 +65,6 @@ static struct mtd_partition mofi3500_3gn_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data mofi3500_3gn_flash_data = {
-	.nr_parts	= ARRAY_SIZE(mofi3500_3gn_partitions),
-	.parts		= mofi3500_3gn_partitions,
-};
-
 static struct gpio_led mofi3500_3gn_leds_gpio[] __initdata = {
 	{
 		.name		= "mofi3500-3gn:green:usb",
@@ -123,7 +118,10 @@ static void __init mofi3500_3gn_init(void)
 {
 	rt305x_gpio_init(MOFI3500_3GN_GPIO_MODE);
 
-	rt305x_register_flash(0, &mofi3500_3gn_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(mofi3500_3gn_leds_gpio),
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 afe51d71e8..4410b032c4 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
@@ -54,11 +54,6 @@ static struct mtd_partition nbg_419n_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data nbg_419n_flash_data = {
-	.nr_parts	= ARRAY_SIZE(nbg_419n_partitions),
-	.parts		= nbg_419n_partitions,
-};
-
 static struct gpio_led nbg_419n_leds_gpio[] __initdata = {
 	{
 		.name		= "nbg-419n:green:power",
@@ -93,7 +88,10 @@ static void __init nbg_419n_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &nbg_419n_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(nbg_419n_leds_gpio),
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 149609956a..50cc0bcb28 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
@@ -61,11 +61,6 @@ static struct mtd_partition emb_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data omni_emb_flash_data = {
-	.nr_parts	= ARRAY_SIZE(emb_partitions),
-	.parts		= emb_partitions,
-};
-
 static struct gpio_led omni_emb_leds_gpio[] __initdata = {
 	{
 		.name           = "emb:green:status",
@@ -101,7 +96,10 @@ static void __init omni_emb_init(void)
 				ARRAY_SIZE(omni_emb_gpio_buttons),
 				omni_emb_gpio_buttons);
 
-	rt305x_register_flash(0, &omni_emb_flash_data);
+	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 dc02f49638..e544fe6967 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
@@ -55,11 +55,6 @@ static struct mtd_partition pwh2004_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data pwh2004_flash_data = {
-	.nr_parts	= ARRAY_SIZE(pwh2004_partitions),
-	.parts		= pwh2004_partitions,
-};
-
 static struct gpio_led pwh2004_leds_gpio[] __initdata = {
 	{
 		.name		= "pwh2004:red:wifi",
@@ -86,7 +81,11 @@ static struct gpio_keys_button pwh2004_gpio_buttons[] __initdata = {
 static void __init pwh2004_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
-	rt305x_register_flash(0, &pwh2004_flash_data);
+
+	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),
 				  pwh2004_leds_gpio);
 	ramips_register_gpio_buttons(-1, PWH2004_KEYS_POLL_INTERVAL,
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 acef978071..cbbf73001a 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
@@ -61,11 +61,6 @@ static struct mtd_partition v22rw_2x2_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data v22rw_2x2_flash_data = {
-	.nr_parts	= ARRAY_SIZE(v22rw_2x2_partitions),
-	.parts		= v22rw_2x2_partitions,
-};
-
 static struct gpio_led v22rw_2x2_leds_gpio[] __initdata = {
 	{
 		.name		= "v22rw-2x2:green:security",
@@ -100,7 +95,10 @@ static void __init v22rw_2x2_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &v22rw_2x2_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(v22rw_2x2_leds_gpio),
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 390388b1ce..4e9dd18219 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
@@ -67,11 +67,6 @@ static struct mtd_partition w502u_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data w502u_flash_data = {
-	.nr_parts	= ARRAY_SIZE(w502u_partitions),
-	.parts		= w502u_partitions,
-};
-
 static struct gpio_led w502u_leds_gpio[] __initdata = {
 	{
 		.name		= "alfa:blue:usb",
@@ -109,7 +104,10 @@ static void __init w502u_init(void)
 	rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
 			  RT305X_GPIO_MODE_UART0_SHIFT));
 
-	rt305x_register_flash(0, &w502u_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(w502u_leds_gpio),
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 07ae825cb1..1c0667b065 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
@@ -92,15 +92,14 @@ static struct mtd_partition wcr150gn_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data wcr150gn_flash_data = {
-	.nr_parts	= ARRAY_SIZE(wcr150gn_partitions),
-	.parts		= wcr150gn_partitions,
-};
-
 static void __init wcr150gn_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
-	rt305x_register_flash(0, &wcr150gn_flash_data);
+
+	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),
 				  wcr150gn_leds_gpio);
 	ramips_register_gpio_buttons(-1, WCR150GN_KEYS_POLL_INTERVAL,
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 6d6dc7f60f..fdcd6b3204 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
@@ -69,11 +69,6 @@ static struct mtd_partition whr_g300n_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data whr_g300n_flash_data = {
-	.nr_parts	= ARRAY_SIZE(whr_g300n_partitions),
-	.parts		= whr_g300n_partitions,
-};
-
 static struct gpio_led whr_g300n_leds_gpio[] __initdata = {
 	{
 		.name		= "whr-g300n:red:diag",
@@ -126,7 +121,10 @@ static void __init whr_g300n_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &whr_g300n_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(whr_g300n_leds_gpio),
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 f737fe523d..34d9cfe5c4 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
@@ -75,11 +75,6 @@ static struct mtd_partition wl341v3_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data wl341v3_flash_data = {
-	.nr_parts	= ARRAY_SIZE(wl341v3_partitions),
-	.parts		= wl341v3_partitions,
-};
-
 static struct gpio_led wl341v3_leds_gpio[] __initdata = {
 	{
 		.name		= "wl341v3:amber:first",
@@ -134,7 +129,10 @@ static void __init wl341v3_init(void)
 {
 	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
 
-	rt305x_register_flash(0, &wl341v3_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio),
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 9d227b66b8..8d37f8f87d 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
@@ -104,12 +104,6 @@ static struct mtd_partition wl351_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data wl351_flash_data = {
-	.nr_parts	= ARRAY_SIZE(wl351_partitions),
-	.parts		= wl351_partitions,
-};
-
-
 static struct rtl8366_platform_data wl351_switch_data = {
 	.gpio_sda	= RT305X_GPIO_I2C_SD,
 	.gpio_sck	= RT305X_GPIO_I2C_SCLK,
@@ -130,7 +124,11 @@ static void __init wl351_init(void)
 				RT305X_GPIO_MODE_I2C |
 				RT305X_GPIO_MODE_SPI |
 				RT305X_GPIO_MODE_MDIO);
-	rt305x_register_flash(0, &wl351_flash_data);
+
+	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),
 						wl351_leds_gpio);
 	ramips_register_gpio_buttons(-1, WL351_KEYS_POLL_INTERVAL,
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 201823c49c..b1c51bb093 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
@@ -76,11 +76,6 @@ static struct mtd_partition wr512_3gn_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data wr512_3gn_flash_data = {
-	.nr_parts	= ARRAY_SIZE(wr512_3gn_partitions),
-	.parts		= wr512_3gn_partitions,
-};
-
 static struct gpio_led wr512_3gn_leds_gpio[] __initdata = {
 	{
 		.name		= "wr512:green:3g",
@@ -131,7 +126,10 @@ static void __init wr512_3gn_init(void)
 {
 	rt305x_gpio_init(WR512_3GN_GPIO_MODE);
 
-	rt305x_register_flash(0, &wr512_3gn_flash_data);
+	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;
 	rt305x_register_ethernet();
 	ramips_register_gpio_leds(-1, ARRAY_SIZE(wr512_3gn_leds_gpio),
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 c63adb96dd..09940cc02f 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
@@ -60,11 +60,6 @@ static struct mtd_partition wr6202_partitions[] = {
 	}
 };
 
-static struct physmap_flash_data wr6202_flash_data = {
-	.nr_parts	= ARRAY_SIZE(wr6202_partitions),
-	.parts		= wr6202_partitions,
-};
-
 static struct gpio_led wr6202_leds_gpio[] __initdata = {
 	{
 		.name           = "wr6202:blue:wps",
@@ -112,7 +107,10 @@ static void __init wr6202_init(void)
 	gpio_direction_output(WR6202_GPIO_USB_POWER, 0);
 	gpio_free(WR6202_GPIO_USB_POWER);
 
-	rt305x_register_flash(0, &wr6202_flash_data);
+	rt305x_flash0_data.nr_parts = ARRAY_SIZE(wr6202_partitions);
+	rt305x_flash0_data.parts = wr6202_partitions;
+	rt305x_register_flash(0);
+
 	rt305x_register_ethernet();
 	rt305x_register_wifi();
 	rt305x_register_wdt();
-- 
cgit v1.2.3