ramips: rt305x: remove per-board physmap_flash_data instances

SVN-Revision: 30473
This commit is contained in:
Gabor Juhos 2012-02-12 12:52:10 +00:00
parent 143e861708
commit 3502e2b93f
21 changed files with 93 additions and 120 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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);

View File

@ -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),

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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();

View File

@ -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,

View File

@ -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),

View File

@ -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),

View File

@ -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,

View File

@ -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),

View File

@ -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),

View File

@ -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,

View File

@ -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),

View File

@ -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();