From: Gabor Juhos Date: Sun, 12 Feb 2012 12:52:12 +0000 (+0000) Subject: ramips: rt288x: remove per-board physmap_flash_data instances X-Git-Tag: reboot~14894 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=commitdiff_plain;h=faae4235c427e762fecf3d6899088dd3e73cb6e1 ramips: rt288x: remove per-board physmap_flash_data instances SVN-Revision: 30474 --- diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.c index e9e98d745c..7f4d45019b 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.c @@ -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); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.h b/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.h index 0df17368a6..d097e5d90e 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.h +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/devices.h @@ -14,7 +14,10 @@ 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; diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c index 850dc4bd7d..76b10530ec 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-f5d8235-v1.c @@ -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(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c index dcffec0006..4315328da8 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-rt-n15.c @@ -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); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c index a9f0de4d86..9b310d0588 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wli-tx4-ag300n.c @@ -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(); diff --git a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c index 3e59fbe13c..6bd7a45423 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt288x/mach-wzr-agl300nh.c @@ -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(); }