ramips: rt288x: remove per-board physmap_flash_data instances
authorGabor Juhos <juhosg@openwrt.org>
Sun, 12 Feb 2012 12:52:12 +0000 (12:52 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sun, 12 Feb 2012 12:52:12 +0000 (12:52 +0000)
SVN-Revision: 30474

target/linux/ramips/files/arch/mips/ralink/rt288x/devices.c
target/linux/ramips/files/arch/mips/ralink/rt288x/devices.h
target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c
target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c
target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c
target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c

index e9e98d745c1aa86103956b4575fec713b5e3cef3..7f4d45019bf8f78bcca01aa4b9ee3074cf250f1e 100644 (file)
@@ -35,10 +35,14 @@ static struct resource rt288x_flash0_resources[] = {
        },
 };
 
+struct physmap_flash_data rt288x_flash0_data;
 static struct platform_device rt288x_flash0_device = {
        .name           = "physmap-flash",
        .resource       = rt288x_flash0_resources,
        .num_resources  = ARRAY_SIZE(rt288x_flash0_resources),
+       .dev = {
+               .platform_data = &rt288x_flash0_data,
+       },
 };
 
 static struct resource rt288x_flash1_resources[] = {
@@ -50,17 +54,21 @@ static struct resource rt288x_flash1_resources[] = {
        },
 };
 
+struct physmap_flash_data rt288x_flash1_data;
 static struct platform_device rt288x_flash1_device = {
        .name           = "physmap-flash",
        .resource       = rt288x_flash1_resources,
        .num_resources  = ARRAY_SIZE(rt288x_flash1_resources),
+       .dev = {
+               .platform_data = &rt288x_flash1_data,
+       },
 };
 
 static int rt288x_flash_instance __initdata;
-void __init rt288x_register_flash(unsigned int id,
-                                 struct physmap_flash_data *pdata)
+void __init rt288x_register_flash(unsigned int id)
 {
        struct platform_device *pdev;
+       struct physmap_flash_data *pdata;
        u32 t;
        int reg;
 
@@ -80,6 +88,7 @@ void __init rt288x_register_flash(unsigned int id,
        t = rt288x_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 rt288x_register_flash(unsigned int id,
                return;
        }
 
-       pdev->dev.platform_data = pdata;
        pdev->id = rt288x_flash_instance;
 
        platform_device_register(pdev);
index 0df17368a6b9626d50a0f55ebbf1ac0df64eea1e..d097e5d90e1f8f9be4157796013e00cb498aa850 100644 (file)
 
 struct physmap_flash_data;
 
-void rt288x_register_flash(unsigned int id, struct physmap_flash_data *pdata);
+extern struct physmap_flash_data rt288x_flash0_data;
+extern struct physmap_flash_data rt288x_flash1_data;
+void rt288x_register_flash(unsigned int id);
+
 void rt288x_register_wifi(void);
 
 extern struct ramips_eth_platform_data rt288x_eth_data;
index 850dc4bd7dd6bbc1c1dd9b8b49783d589027cd26..76b10530ec1ac61d57bbcbffcad206b828c53e4d 100644 (file)
@@ -63,11 +63,6 @@ static struct mtd_partition f5d8235_partitions[] = {
        }
 };
 
-static struct physmap_flash_data f5d8235_flash_data = {
-       .nr_parts       = ARRAY_SIZE(f5d8235_partitions),
-       .parts          = f5d8235_partitions,
-};
-
 static struct rtl8366_platform_data f5d8235_rtl8366s_data = {
        .gpio_sda       = F5D8235_GPIO_RTL8366_SDA,
        .gpio_sck       = F5D8235_GPIO_RTL8366_SCK,
@@ -115,7 +110,10 @@ static void __init f5d8235_init(void)
 {
        rt288x_gpio_init(RT2880_GPIO_MODE_UART0 | RT2880_GPIO_MODE_I2C);
 
-       rt288x_register_flash(0, &f5d8235_flash_data);
+       rt288x_flash0_data.nr_parts = ARRAY_SIZE(f5d8235_partitions);
+       rt288x_flash0_data.parts = f5d8235_partitions;
+       rt288x_register_flash(0);
+
        rt288x_register_wifi();
        rt288x_register_wdt();
 
index dcffec0006cf3cf9d613cc60eea58ab06ded8bc9..4315328da8e1ad53196d6f1c81bbdb762bb75ff9 100644 (file)
@@ -66,11 +66,6 @@ static struct mtd_partition rt_n15_partitions[] = {
        }
 };
 
-static struct physmap_flash_data rt_n15_flash_data = {
-       .nr_parts       = ARRAY_SIZE(rt_n15_partitions),
-       .parts          = rt_n15_partitions,
-};
-
 static struct gpio_led rt_n15_leds_gpio[] __initdata = {
        {
                .name           = "rt-n15:blue:power",
@@ -114,7 +109,9 @@ static void __init rt_n15_init(void)
 {
        rt288x_gpio_init(RT2880_GPIO_MODE_UART0 | RT2880_GPIO_MODE_I2C);
 
-       rt288x_register_flash(0, &rt_n15_flash_data);
+       rt288x_flash0_data.nr_parts = ARRAY_SIZE(rt_n15_partitions);
+       rt288x_flash0_data.parts = rt_n15_partitions;
+       rt288x_register_flash(0);
 
        ramips_register_gpio_leds(-1, ARRAY_SIZE(rt_n15_leds_gpio),
                                  rt_n15_leds_gpio);
index a9f0de4d86f26d7cf100483f6205e9b4dfd79b44..9b310d05882ec7a8f5a899c3ac145bbecfcf20d1 100644 (file)
@@ -76,11 +76,6 @@ static struct mtd_partition wli_tx4_ag300n_partitions[] = {
        },
 };
 
-static struct physmap_flash_data wli_tx4_ag300n_flash_data = {
-       .nr_parts       = ARRAY_SIZE(wli_tx4_ag300n_partitions),
-       .parts          = wli_tx4_ag300n_partitions,
-};
-
 static struct gpio_led wli_tx4_ag300n_leds_gpio[] __initdata = {
        {
                .name           = "buffalo:blue:power",
@@ -136,7 +131,10 @@ static void __init wli_tx4_ag300n_init(void)
                                     ARRAY_SIZE(wli_tx4_ag300n_gpio_buttons),
                                     wli_tx4_ag300n_gpio_buttons);
 
-       rt288x_register_flash(0, &wli_tx4_ag300n_flash_data);
+       rt288x_flash0_data.nr_parts = ARRAY_SIZE(wli_tx4_ag300n_partitions);
+       rt288x_flash0_data.parts = wli_tx4_ag300n_partitions;
+       rt288x_register_flash(0);
+
        rt288x_register_wifi();
        rt288x_register_wdt();
 
index 3e59fbe13c861d5afaef2a4f5fb95a2519830e3f..6bd7a45423b9dd959346dfa78bf5fd49448e86f0 100644 (file)
@@ -61,16 +61,14 @@ static struct mtd_partition wzr_agl300nh_partitions[] = {
        }
 };
 
-static struct physmap_flash_data wzr_agl300nh_flash_data = {
-       .nr_parts       = ARRAY_SIZE(wzr_agl300nh_partitions),
-       .parts          = wzr_agl300nh_partitions,
-};
-
 static void __init wzr_agl300nh_init(void)
 {
        rt288x_gpio_init(RT2880_GPIO_MODE_UART0);
 
-       rt288x_register_flash(0, &wzr_agl300nh_flash_data);
+       rt288x_flash0_data.nr_parts = ARRAY_SIZE(wzr_agl300nh_partitions);
+       rt288x_flash0_data.parts = wzr_agl300nh_partitions;
+       rt288x_register_flash(0);
+
        rt288x_register_wifi();
        rt288x_register_wdt();
 }