aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2007-10-24 08:19:16 +0000
committerGabor Juhos <juhosg@openwrt.org>2007-10-24 08:19:16 +0000
commit5f122462c001559c00b42238055957738545f3ad (patch)
treef980fe2cc51ce3a028fd80f2da371a9eb99283e4 /target/linux/adm5120
parent479cf96993cb70f8c69ba590238e27a56dc7091d (diff)
downloadupstream-5f122462c001559c00b42238055957738545f3ad.tar.gz
upstream-5f122462c001559c00b42238055957738545f3ad.tar.bz2
upstream-5f122462c001559c00b42238055957738545f3ad.zip
minor cleanups
SVN-Revision: 9423
Diffstat (limited to 'target/linux/adm5120')
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/board.c12
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/compex.c118
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/edimax.c23
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/generic.c16
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/infineon.c37
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c119
-rw-r--r--target/linux/adm5120/files/arch/mips/adm5120/boards/zyxel.c21
-rw-r--r--target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_board.h17
8 files changed, 135 insertions, 228 deletions
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/board.c b/target/linux/adm5120/files/arch/mips/adm5120/board.c
index 5f809a16e6..c5ee4e3e72 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/board.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/board.c
@@ -117,16 +117,6 @@ arch_initcall(adm5120_board_setup);
void __init adm5120_board_register(struct adm5120_board *board)
{
- list_add(&board->list, &adm5120_boards);
+ list_add_tail(&board->list, &adm5120_boards);
printk(KERN_INFO PFX "registered board '%s'\n", board->name);
}
-
-void __init adm5120_register_boards(struct adm5120_board **boards,
- int num)
-{
- int i;
-
- for (i = 0; i < num; i++)
- adm5120_board_register(boards[i]);
-}
-
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/compex.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/compex.c
index d1e2edd024..a58bec3d43 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/compex.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/compex.c
@@ -33,23 +33,6 @@
#include <adm5120_platform.h>
#include <adm5120_irq.h>
-static void switch_bank_gpio5(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(ADM5120_GPIO_PIN5, 0);
- break;
- case 1:
- gpio_set_value(ADM5120_GPIO_PIN5, 1);
- break;
- }
-}
-
-static void wp54_reset(void)
-{
- gpio_set_value(ADM5120_GPIO_PIN3, 0);
-}
-
static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
};
@@ -87,6 +70,38 @@ static struct platform_device *wp54_devices[] __initdata = {
&adm5120_flash0_device,
};
+unsigned char np27g_vlans[6] __initdata = {
+ /* FIXME: untested */
+ 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
+};
+
+unsigned char np28g_vlans[6] __initdata = {
+ 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
+};
+
+unsigned char wp54_vlans[6] __initdata = {
+ 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
+};
+
+/*--------------------------------------------------------------------------*/
+
+static void switch_bank_gpio5(unsigned bank)
+{
+ switch (bank) {
+ case 0:
+ gpio_set_value(ADM5120_GPIO_PIN5, 0);
+ break;
+ case 1:
+ gpio_set_value(ADM5120_GPIO_PIN5, 1);
+ break;
+ }
+}
+
+static void wp54_reset(void)
+{
+ gpio_set_value(ADM5120_GPIO_PIN3, 0);
+}
+
static void __init np2xg_setup(void)
{
gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
@@ -129,32 +144,17 @@ static void __init wp54_wrt_setup(void)
/* TODO: setup mac address */
}
-unsigned char np27g_vlans[6] __initdata = {
- /* FIXME: untested */
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
-};
+/*--------------------------------------------------------------------------*/
-unsigned char np28g_vlans[6] __initdata = {
- 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
-};
-
-unsigned char wp54_vlans[6] __initdata = {
- 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
-};
-
-static struct adm5120_board np27g_board __initdata = {
- .mach_type = MACH_ADM5120_NP27G,
- .name = "Compex NetPassage 27G",
+ADM5120_BOARD_START(NP27G, "Compex NetPassage 27G")
.board_setup = np2xg_setup,
.eth_num_ports = 5,
.eth_vlans = np27g_vlans,
.num_devices = ARRAY_SIZE(np2xg_devices),
.devices = np2xg_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board np28g_board __initdata = {
- .mach_type = MACH_ADM5120_NP28G,
- .name = "Compex NetPassage 28G",
+ADM5120_BOARD_START(NP28G, "Compex NetPassage 28G")
.board_setup = np2xg_setup,
.eth_num_ports = 4,
.eth_vlans = np28g_vlans,
@@ -162,11 +162,9 @@ static struct adm5120_board np28g_board __initdata = {
.devices = np2xg_devices,
.pci_nr_irqs = ARRAY_SIZE(np28g_pci_irqs),
.pci_irq_map = np28g_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board wp54ag_board __initdata = {
- .mach_type = MACH_ADM5120_WP54AG,
- .name = "Compex WP54AG",
+ADM5120_BOARD_START(WP54AG, "Compex WP54AG")
.board_setup = wp54_setup,
.board_reset = wp54_reset,
.eth_num_ports = 2,
@@ -175,11 +173,9 @@ static struct adm5120_board wp54ag_board __initdata = {
.devices = wp54_devices,
.pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
.pci_irq_map = wp54_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board wp54g_board __initdata = {
- .mach_type = MACH_ADM5120_WP54G,
- .name = "Compex WP54G",
+ADM5120_BOARD_START(WP54G, "Compex WP54G")
.board_setup = wp54_setup,
.board_reset = wp54_reset,
.eth_num_ports = 2,
@@ -188,11 +184,9 @@ static struct adm5120_board wp54g_board __initdata = {
.devices = wp54_devices,
.pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
.pci_irq_map = wp54_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board wp54g_wrt_board __initdata = {
- .mach_type = MACH_ADM5120_WP54G_WRT,
- .name = "Compex WP54G-WRT",
+ADM5120_BOARD_START(WP54G_WRT, "Compex WP54G-WRT")
.board_setup = wp54_wrt_setup,
.board_reset = wp54_reset,
.eth_num_ports = 2,
@@ -201,11 +195,9 @@ static struct adm5120_board wp54g_wrt_board __initdata = {
.devices = wp54_devices,
.pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
.pci_irq_map = wp54_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board wpp54ag_board __initdata = {
- .mach_type = MACH_ADM5120_WPP54AG,
- .name = "Compex WPP54AG",
+ADM5120_BOARD_START(WPP54AG, "Compex WPP54AG")
.board_setup = wp54_setup,
.board_reset = wp54_reset,
.eth_num_ports = 2,
@@ -214,11 +206,9 @@ static struct adm5120_board wpp54ag_board __initdata = {
.devices = wp54_devices,
.pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
.pci_irq_map = wp54_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board wpp54g_board __initdata = {
- .mach_type = MACH_ADM5120_WPP54G,
- .name = "Compex WPP54G",
+ADM5120_BOARD_START(WPP54G, "Compex WPP54G")
.board_setup = wp54_setup,
.board_reset = wp54_reset,
.eth_num_ports = 2,
@@ -227,18 +217,4 @@ static struct adm5120_board wpp54g_board __initdata = {
.devices = wp54_devices,
.pci_nr_irqs = ARRAY_SIZE(wp54_pci_irqs),
.pci_irq_map = wp54_pci_irqs,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&np27g_board);
- adm5120_board_register(&np28g_board);
- adm5120_board_register(&wp54ag_board);
- adm5120_board_register(&wp54g_board);
- adm5120_board_register(&wp54g_wrt_board);
- adm5120_board_register(&wpp54ag_board);
- adm5120_board_register(&wpp54g_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/edimax.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/edimax.c
index e53e836137..589ed3c527 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/edimax.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/edimax.c
@@ -75,19 +75,17 @@ unsigned char br61xx_vlans[6] = {
0x41, 0x42, 0x44, 0x48, 0x50, 0x00
};
-static struct adm5120_board br6104k_board __initdata = {
- .mach_type = MACH_ADM5120_BR6104K,
- .name = "Edimax BR-6104K/6104KP",
+/*--------------------------------------------------------------------------*/
+
+ADM5120_BOARD_START(BR6104K, "Edimax BR-6104K/6104KP")
.board_setup = br61xx_setup,
.eth_num_ports = 5,
.eth_vlans = br61xx_vlans,
.num_devices = ARRAY_SIZE(br6104k_devices),
.devices = br6104k_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board br61x4wg_board __initdata = {
- .mach_type = MACH_ADM5120_BR61x4WG,
- .name = "Edimax BR-6104WG/6114WG",
+ADM5120_BOARD_START(BR61x4WG, "Edimax BR-6104WG/6114WG")
.board_setup = br61xx_setup,
.eth_num_ports = 5,
.eth_vlans = br61xx_vlans,
@@ -95,13 +93,4 @@ static struct adm5120_board br61x4wg_board __initdata = {
.devices = br61x4wg_devices,
.pci_nr_irqs = ARRAY_SIZE(br61xx_pci_irqs),
.pci_irq_map = br61xx_pci_irqs,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&br6104k_board);
- adm5120_board_register(&br61x4wg_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/generic.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/generic.c
index 735dda34a5..e74e875539 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/generic.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/generic.c
@@ -37,18 +37,10 @@ static struct platform_device *generic_devices[] __initdata = {
&adm5120_hcd_device,
};
-static struct adm5120_board generic_board __initdata = {
- .mach_type = MACH_ADM5120_GENERIC,
- .name = "Generic ADM5120 board",
+/*--------------------------------------------------------------------------*/
+
+ADM5120_BOARD_START(GENERIC, "Generic ADM5120 board")
.eth_num_ports = 6,
.num_devices = ARRAY_SIZE(generic_devices),
.devices = generic_devices,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&generic_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/infineon.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/infineon.c
index c927f00307..0469f7b110 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/infineon.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/infineon.c
@@ -118,49 +118,32 @@ static void __init easy_setup_bga(void)
/* TODO: setup mac addresses */
}
-static struct adm5120_board easy5120pata_board __initdata = {
- .mach_type = MACH_ADM5120_EASY5120PATA,
- .name = "Infineon EASY 5120P-ATA Reference Board",
+/*--------------------------------------------------------------------------*/
+
+ADM5120_BOARD_START(EASY5120PATA, "Infineon EASY 5120P-ATA Reference Board")
.board_setup = easy_setup_pqfp,
.eth_num_ports = 6,
.num_devices = ARRAY_SIZE(easy5120pata_devices),
.devices = easy5120pata_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board easy5120rt_board __initdata = {
- .mach_type = MACH_ADM5120_EASY5120RT,
- .name = "Infineon EASY 5120-RT Reference Board",
+ADM5120_BOARD_START(EASY5120RT, "Infineon EASY 5120-RT Reference Board")
.board_setup = easy_setup_bga,
.eth_num_ports = 5,
.num_devices = ARRAY_SIZE(easy5120rt_devices),
.devices = easy5120rt_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board easy5120wvoip_board __initdata = {
- .mach_type = MACH_ADM5120_EASY5120WVOIP,
- .name = "Infineon EASY 5120-WVoIP Reference Board",
+ADM5120_BOARD_START(EASY5120WVOIP, "Infineon EASY 5120-WVoIP Reference Board")
.board_setup = easy_setup_bga,
.eth_num_ports = 6,
.num_devices = ARRAY_SIZE(easy5120wvoip_devices),
.devices = easy5120wvoip_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board easy83000_board __initdata = {
- .mach_type = MACH_ADM5120_EASY83000,
- .name = "Infineon EASY 83000 Reference Board",
+ADM5120_BOARD_START(EASY83000, "Infineon EASY 83000 Reference Board")
.board_setup = easy_setup_pqfp,
.eth_num_ports = 6,
.num_devices = ARRAY_SIZE(easy83000_devices),
.devices = easy83000_devices,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&easy5120pata_board);
- adm5120_board_register(&easy5120rt_board);
- adm5120_board_register(&easy5120wvoip_board);
- adm5120_board_register(&easy83000_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
index 855ec3afb1..41004964bd 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
@@ -117,6 +117,38 @@ static struct resource rb150_nand_resource[] = {
},
};
+static struct resource rb153_cf_resources[] = {
+ {
+ .name = "cf_membase",
+ .start = ADM5120_EXTIO0_BASE,
+ .end = ADM5120_EXTIO0_BASE + ADM5120_MPMC_SIZE-1 ,
+ .flags = IORESOURCE_MEM
+ }, {
+ .name = "cf_irq",
+ .start = ADM5120_IRQ_GPIO4,
+ .end = ADM5120_IRQ_GPIO4,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+static struct cf_device rb153_cf_data = {
+ .gpio_pin = ADM5120_GPIO_PIN4
+};
+
+static struct platform_device rb153_cf_device = {
+ .name = "rb153-cf",
+ .id = -1,
+ .resource = rb153_cf_resources,
+ .num_resources = ARRAY_SIZE(rb153_cf_resources),
+ .dev.platform_data = &rb153_cf_data,
+};
+
+static struct platform_device *rb153_devices[] __initdata = {
+ &adm5120_flash0_device,
+ &adm5120_nand_device,
+ &rb153_cf_device,
+};
+
#if 0
/*
* RB1xx boards have bad network performance with the default VLAN matrixes.
@@ -180,37 +212,6 @@ static void rb150_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
}
/*--------------------------------------------------------------------------*/
-static struct resource cf_slot0_res[] = {
- {
- .name = "cf_membase",
- .start = ADM5120_EXTIO0_BASE,
- .end = ADM5120_EXTIO0_BASE + ADM5120_MPMC_SIZE-1 ,
- .flags = IORESOURCE_MEM
- }, {
- .name = "cf_irq",
- .start = ADM5120_IRQ_GPIO4, /* 5 */
- .end = ADM5120_IRQ_GPIO4,
- .flags = IORESOURCE_IRQ
- }
-};
-
-static struct cf_device cf_slot0_data = {
- .gpio_pin = 4
-};
-
-static struct platform_device cf_slot0 = {
- .id = 0,
- .name = "rb153-cf",
- .dev.platform_data = &cf_slot0_data,
- .resource = cf_slot0_res,
- .num_resources = ARRAY_SIZE(cf_slot0_res),
-};
-
-static struct platform_device *rb153_devices[] __initdata = {
- &adm5120_flash0_device,
- &adm5120_nand_device,
- &cf_slot0,
-};
static void __init rb1xx_mac_setup(void)
{
@@ -270,9 +271,7 @@ static void __init rb150_setup(void)
/*--------------------------------------------------------------------------*/
-static struct adm5120_board rb111_board __initdata = {
- .mach_type = MACH_ADM5120_RB_111,
- .name = "Mikrotik RouterBOARD 111",
+ADM5120_BOARD_START(RB_111, "Mikrotik RouterBOARD 111")
.board_setup = rb1xx_setup,
.eth_num_ports = 1,
.eth_vlans = rb11x_vlans,
@@ -280,11 +279,9 @@ static struct adm5120_board rb111_board __initdata = {
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb112_board __initdata = {
- .mach_type = MACH_ADM5120_RB_112,
- .name = "Mikrotik RouterBOARD 112",
+ADM5120_BOARD_START(RB_112, "Mikrotik RouterBOARD 112")
.board_setup = rb1xx_setup,
.eth_num_ports = 1,
.eth_vlans = rb11x_vlans,
@@ -292,11 +289,9 @@ static struct adm5120_board rb112_board __initdata = {
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb133_board __initdata = {
- .mach_type = MACH_ADM5120_RB_133,
- .name = "Mikrotik RouterBOARD 133",
+ADM5120_BOARD_START(RB_133, "Mikrotik RouterBOARD 133")
.board_setup = rb1xx_setup,
.eth_num_ports = 3,
.eth_vlans = rb133_vlans,
@@ -304,11 +299,9 @@ static struct adm5120_board rb133_board __initdata = {
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb133c_board __initdata = {
- .mach_type = MACH_ADM5120_RB_133C,
- .name = "Mikrotik RouterBOARD 133C",
+ADM5120_BOARD_START(RB_133C, "Mikrotik RouterBOARD 133C")
.board_setup = rb1xx_setup,
.eth_num_ports = 1,
.eth_vlans = rb133c_vlans,
@@ -316,21 +309,17 @@ static struct adm5120_board rb133c_board __initdata = {
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb150_board __initdata = {
- .mach_type = MACH_ADM5120_RB_150,
- .name = "Mikrotik RouterBOARD 150",
+ADM5120_BOARD_START(RB_150, "Mikrotik RouterBOARD 150")
.board_setup = rb150_setup,
.eth_num_ports = 5,
.eth_vlans = rb15x_vlans,
.num_devices = ARRAY_SIZE(rb1xx_devices),
.devices = rb1xx_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb153_board __initdata = {
- .mach_type = MACH_ADM5120_RB_153,
- .name = "Mikrotik RouterBOARD 153",
+ADM5120_BOARD_START(RB_153, "Mikrotik RouterBOARD 153")
.board_setup = rb1xx_setup,
.eth_num_ports = 5,
.eth_vlans = rb15x_vlans,
@@ -338,11 +327,9 @@ static struct adm5120_board rb153_board __initdata = {
.devices = rb153_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb192_board __initdata = {
- .mach_type = MACH_ADM5120_RB_192,
- .name = "Mikrotik RouterBOARD 192",
+ADM5120_BOARD_START(RB_192, "Mikrotik RouterBOARD 192")
.board_setup = rb1xx_setup,
.eth_num_ports = 5,
.eth_vlans = rb192_vlans,
@@ -350,18 +337,4 @@ static struct adm5120_board rb192_board __initdata = {
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&rb111_board);
- adm5120_board_register(&rb112_board);
- adm5120_board_register(&rb133_board);
- adm5120_board_register(&rb133c_board);
- adm5120_board_register(&rb150_board);
- adm5120_board_register(&rb153_board);
- adm5120_board_register(&rb192_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/boards/zyxel.c b/target/linux/adm5120/files/arch/mips/adm5120/boards/zyxel.c
index 0e766a8568..ed67d163e1 100644
--- a/target/linux/adm5120/files/arch/mips/adm5120/boards/zyxel.c
+++ b/target/linux/adm5120/files/arch/mips/adm5120/boards/zyxel.c
@@ -102,9 +102,7 @@ unsigned char p33x_vlans[6] __initdata = {
0x50, 0x48, 0x44, 0x42, 0x41, 0x00
};
-static struct adm5120_board p334wt_board __initdata = {
- .mach_type = MACH_ADM5120_P334WT,
- .name = "ZyXEL Prestige 334WT",
+ADM5120_BOARD_START(P334WT, "ZyXEL Prestige 334WT")
.board_setup = p33x_setup,
.eth_num_ports = 5,
.eth_vlans = p33x_vlans,
@@ -112,11 +110,9 @@ static struct adm5120_board p334wt_board __initdata = {
.devices = p334_devices,
.pci_nr_irqs = ARRAY_SIZE(p33x_pci_irqs),
.pci_irq_map = p33x_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board p335_board __initdata = {
- .mach_type = MACH_ADM5120_P335,
- .name = "ZyXEL Prestige 335/335WT",
+ADM5120_BOARD_START(P335, "ZyXEL Prestige 335/335WT")
.board_setup = p33x_setup,
.eth_num_ports = 5,
.eth_vlans = p33x_vlans,
@@ -124,13 +120,4 @@ static struct adm5120_board p335_board __initdata = {
.devices = p335_devices,
.pci_nr_irqs = ARRAY_SIZE(p33x_pci_irqs),
.pci_irq_map = p33x_pci_irqs,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&p334wt_board);
- adm5120_board_register(&p335_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END
diff --git a/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_board.h b/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_board.h
index d6ac096037..9f67bf353d 100644
--- a/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_board.h
+++ b/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_board.h
@@ -49,4 +49,21 @@ struct adm5120_board {
extern void adm5120_board_register(struct adm5120_board *) __init;
+#define ADM5120_BOARD_START(_type, _name) \
+static struct adm5120_board adm5120_board_##_type __initdata; \
+ \
+static __init int adm5120_board_##_type##_register(void) \
+{ \
+ adm5120_board_register(&adm5120_board_##_type); \
+ return 0; \
+} \
+pure_initcall(adm5120_board_##_type##_register); \
+ \
+static struct adm5120_board adm5120_board_##_type __initdata = { \
+ .mach_type = MACH_ADM5120_##_type, \
+ .name = _name,
+
+#define ADM5120_BOARD_END \
+};
+
#endif /* _ADM5120_BOARD_H_ */