From a5e3f9b1977f4bfe24df52c2522549f911642d27 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 1 Aug 2007 16:54:51 +0000 Subject: [adm5120] add support for board specific vlan matrix, should fix #2132 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8309 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../adm5120-2.6/files/arch/mips/adm5120/board.c | 9 ++++-- .../files/arch/mips/adm5120/boards/cellvision.c | 12 ++++---- .../files/arch/mips/adm5120/boards/compex.c | 36 +++++++++++++++++----- .../files/arch/mips/adm5120/boards/edimax.c | 7 ++++- .../files/arch/mips/adm5120/boards/generic.c | 2 +- .../files/arch/mips/adm5120/boards/infineon.c | 8 ++--- .../files/arch/mips/adm5120/boards/mikrotik.c | 35 ++++++++++++++++++--- .../files/arch/mips/adm5120/boards/zyxel.c | 20 +++++++++++- .../adm5120-2.6/files/arch/mips/adm5120/platform.c | 10 ++++-- 9 files changed, 110 insertions(+), 29 deletions(-) (limited to 'target/linux/adm5120-2.6/files/arch') diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c index 17b88c001..f10600952 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/board.c @@ -82,8 +82,13 @@ static int __init adm5120_board_setup(void) memcpy(&adm5120_board_name, board->name, ADM5120_BOARD_NAMELEN); adm5120_board_reset = board->board_reset; - if (board->num_eth_ports > 0) - adm5120_eth_num_ports = board->num_eth_ports; + if (board->eth_num_ports > 0) + adm5120_eth_num_ports = board->eth_num_ports; + + if (board->eth_vlans) + memcpy(adm5120_eth_vlans, board->eth_vlans, + sizeof(adm5120_eth_vlans)); + if (board->board_setup) board->board_setup(); diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/cellvision.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/cellvision.c index fa82b93a1..40e2acfbc 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/cellvision.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/cellvision.c @@ -128,7 +128,7 @@ static struct adm5120_board cas630_board __initdata = { .mach_type = MACH_ADM5120_CAS630, .name = "Cellvision CAS-630/630W", .board_setup = cas6xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, .num_devices = ARRAY_SIZE(cas6xx_devices), .devices = cas6xx_devices, }; @@ -137,7 +137,7 @@ static struct adm5120_board cas670_board __initdata = { .mach_type = MACH_ADM5120_CAS670, .name = "Cellvision CAS-670/670W", .board_setup = cas6xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, .num_devices = ARRAY_SIZE(cas6xx_devices), .devices = cas6xx_devices, }; @@ -146,7 +146,7 @@ static struct adm5120_board cas700_board __initdata = { .mach_type = MACH_ADM5120_CAS700, .name = "Cellvision CAS-700/700W", .board_setup = cas7xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, .num_devices = ARRAY_SIZE(cas7xx_devices), .devices = cas7xx_devices, }; @@ -155,7 +155,7 @@ static struct adm5120_board cas771_board __initdata = { .mach_type = MACH_ADM5120_CAS771, .name = "Cellvision CAS-771/771W", .board_setup = cas7xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, .num_devices = ARRAY_SIZE(cas7xx_devices), .devices = cas7xx_devices, }; @@ -164,7 +164,7 @@ static struct adm5120_board cas790_board __initdata = { .mach_type = MACH_ADM5120_CAS790, .name = "Cellvision CAS-790", .board_setup = cas7xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, .num_devices = ARRAY_SIZE(cas7xx_devices), .devices = cas7xx_devices, }; @@ -173,7 +173,7 @@ static struct adm5120_board cas861_board __initdata = { .mach_type = MACH_ADM5120_CAS861, .name = "Cellvision CAS-861/861W", .board_setup = cas7xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, .num_devices = ARRAY_SIZE(cas7xx_devices), .devices = cas7xx_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/compex.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/compex.c index 7a48cb04c..a59e08f43 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/compex.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/compex.c @@ -117,11 +117,27 @@ 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 = { + /* FIXME: untested */ + 0x41, 0x42, 0x44, 0x48, 0x00, 0x00 +}; + +unsigned char wp54_vlans[6] __initdata = { + /* FIXME: untested */ + 0x41, 0x42, 0x00, 0x00, 0x00, 0x00 +}; + static struct adm5120_board np27g_board __initdata = { .mach_type = MACH_ADM5120_NP27G, .name = "Compex NetPassage 27G", .board_setup = np2xg_setup, - .num_eth_ports = 4, + .eth_num_ports = 5, + .eth_vlans = np27g_vlans, .num_devices = ARRAY_SIZE(np2xg_devices), .devices = np2xg_devices, }; @@ -130,7 +146,8 @@ static struct adm5120_board np28g_board __initdata = { .mach_type = MACH_ADM5120_NP28G, .name = "Compex NetPassage 28G", .board_setup = np2xg_setup, - .num_eth_ports = 3, + .eth_num_ports = 4, + .eth_vlans = np28g_vlans, .num_devices = ARRAY_SIZE(np2xg_devices), .devices = np2xg_devices, }; @@ -140,7 +157,8 @@ static struct adm5120_board wp54ag_board __initdata = { .name = "Compex WP54AG", .board_setup = wp54_setup, .board_reset = wp54_reset, - .num_eth_ports = 2, + .eth_num_ports = 2, + .eth_vlans = wp54_vlans, .num_devices = ARRAY_SIZE(wp54_devices), .devices = wp54_devices, }; @@ -150,7 +168,8 @@ static struct adm5120_board wp54g_board __initdata = { .name = "Compex WP54G", .board_setup = wp54_setup, .board_reset = wp54_reset, - .num_eth_ports = 2, + .eth_num_ports = 2, + .eth_vlans = wp54_vlans, .num_devices = ARRAY_SIZE(wp54_devices), .devices = wp54_devices, }; @@ -160,7 +179,8 @@ static struct adm5120_board wp54g_wrt_board __initdata = { .name = "Compex WP54G-WRT", .board_setup = wp54_wrt_setup, .board_reset = wp54_reset, - .num_eth_ports = 2, + .eth_num_ports = 2, + .eth_vlans = wp54_vlans, .num_devices = ARRAY_SIZE(wp54_devices), .devices = wp54_devices, }; @@ -170,7 +190,8 @@ static struct adm5120_board wpp54ag_board __initdata = { .name = "Compex WPP54AG", .board_setup = wp54_setup, .board_reset = wp54_reset, - .num_eth_ports = 2, + .eth_num_ports = 2, + .eth_vlans = wp54_vlans, .num_devices = ARRAY_SIZE(wp54_devices), .devices = wp54_devices, }; @@ -180,7 +201,8 @@ static struct adm5120_board wpp54g_board __initdata = { .name = "Compex WPP54G", .board_setup = wp54_setup, .board_reset = wp54_reset, - .num_eth_ports = 2, + .eth_num_ports = 2, + .eth_vlans = wp54_vlans, .num_devices = ARRAY_SIZE(wp54_devices), .devices = wp54_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/edimax.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/edimax.c index f39d5c763..30efdf553 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/edimax.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/edimax.c @@ -61,11 +61,16 @@ static void __init br6104k_setup(void) { /* TODO: setup mac addresses, if possible */ } +unsigned char br6104k_vlans[6] = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + static struct adm5120_board br6104k_board __initdata = { .mach_type = MACH_ADM5120_BR6104K, .name = "Edimax BR-6104K", .board_setup = br6104k_setup, - .num_eth_ports = 5, + .eth_num_ports = 5, + .eth_vlans = br6104k_vlans, .num_devices = ARRAY_SIZE(br6104k_devices), .devices = br6104k_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/generic.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/generic.c index 8d795a881..78a8f557b 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/generic.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/generic.c @@ -39,7 +39,7 @@ static struct platform_device *generic_devices[] __initdata = { static struct adm5120_board generic_board __initdata = { .mach_type = MACH_ADM5120_GENERIC, .name = "Generic ADM5120 board", - .num_eth_ports = 6, + .eth_num_ports = 6, .num_devices = ARRAY_SIZE(generic_devices), .devices = generic_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/infineon.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/infineon.c index e1426cca9..6873ac0b4 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/infineon.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/infineon.c @@ -123,7 +123,7 @@ static struct adm5120_board easy5120pata_board __initdata = { .mach_type = MACH_ADM5120_EASY5120PATA, .name = "Infineon EASY 5120P-ATA Reference Board", .board_setup = easy_setup_pqfp, - .num_eth_ports = 6, + .eth_num_ports = 6, .num_devices = ARRAY_SIZE(easy5120pata_devices), .devices = easy5120pata_devices, }; @@ -132,7 +132,7 @@ static struct adm5120_board easy5120rt_board __initdata = { .mach_type = MACH_ADM5120_EASY5120RT, .name = "Infineon EASY 5120-RT Reference Board", .board_setup = easy_setup_bga, - .num_eth_ports = 5, + .eth_num_ports = 5, .num_devices = ARRAY_SIZE(easy5120rt_devices), .devices = easy5120rt_devices, }; @@ -141,7 +141,7 @@ static struct adm5120_board easy5120wvoip_board __initdata = { .mach_type = MACH_ADM5120_EASY5120WVOIP, .name = "Infineon EASY 5120-WVoIP Reference Board", .board_setup = easy_setup_bga, - .num_eth_ports = 6, + .eth_num_ports = 6, .num_devices = ARRAY_SIZE(easy5120wvoip_devices), .devices = easy5120wvoip_devices, }; @@ -150,7 +150,7 @@ static struct adm5120_board easy83000_board __initdata = { .mach_type = MACH_ADM5120_EASY83000, .name = "Infineon EASY 83000 Reference Board", .board_setup = easy_setup_pqfp, - .num_eth_ports = 6, + .eth_num_ports = 6, .num_devices = ARRAY_SIZE(easy83000_devices), .devices = easy83000_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/mikrotik.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/mikrotik.c index fccb284d6..c1b203f7c 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/mikrotik.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/mikrotik.c @@ -59,11 +59,32 @@ static void __init rb1xx_setup(void) /* TODO: setup mac address */ } +static unsigned char rb11x_vlans[6] __initdata = { + /* FIXME: untested */ + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static unsigned char rb133_vlans[6] __initdata = { + /* FIXME: untested */ + 0x41, 0x42, 0x44, 0x00, 0x00, 0x00 +}; + +static unsigned char rb133c_vlans[6] __initdata = { + /* FIXME: untested */ + 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static unsigned char rb153_vlans[6] __initdata = { + /* FIXME: untested */ + 0x41, 0x42, 0x44, 0x48, 0x50, 0x00 +}; + static struct adm5120_board rb111_board __initdata = { .mach_type = MACH_ADM5120_RB_111, .name = "Mikrotik RouterBOARD 111", .board_setup = rb1xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, + .eth_vlans = rb11x_vlans, .num_devices = ARRAY_SIZE(rb1xx_devices), .devices = rb1xx_devices, }; @@ -72,7 +93,8 @@ static struct adm5120_board rb112_board __initdata = { .mach_type = MACH_ADM5120_RB_112, .name = "Mikrotik RouterBOARD 112", .board_setup = rb1xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, + .eth_vlans = rb11x_vlans, .num_devices = ARRAY_SIZE(rb1xx_devices), .devices = rb1xx_devices, }; @@ -81,7 +103,8 @@ static struct adm5120_board rb133_board __initdata = { .mach_type = MACH_ADM5120_RB_133, .name = "Mikrotik RouterBOARD 133", .board_setup = rb1xx_setup, - .num_eth_ports = 3, + .eth_num_ports = 3, + .eth_vlans = rb133_vlans, .num_devices = ARRAY_SIZE(rb1xx_devices), .devices = rb1xx_devices, }; @@ -90,7 +113,8 @@ static struct adm5120_board rb133c_board __initdata = { .mach_type = MACH_ADM5120_RB_133C, .name = "Mikrotik RouterBOARD 133C", .board_setup = rb1xx_setup, - .num_eth_ports = 1, + .eth_num_ports = 1, + .eth_vlans = rb133c_vlans, .num_devices = ARRAY_SIZE(rb1xx_devices), .devices = rb1xx_devices, }; @@ -99,7 +123,8 @@ static struct adm5120_board rb153_board __initdata = { .mach_type = MACH_ADM5120_RB_153, .name = "Mikrotik RouterBOARD 153", .board_setup = rb1xx_setup, - .num_eth_ports = 5, + .eth_num_ports = 5, + .eth_vlans = rb153_vlans, .num_devices = ARRAY_SIZE(rb1xx_devices), .devices = rb1xx_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/zyxel.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/zyxel.c index f6cdc8af4..25e5a319b 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/zyxel.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/boards/zyxel.c @@ -55,9 +55,18 @@ static struct mtd_partition p33x_partitions[] = { .offset = MTDPART_OFS_APPEND, .size = 16*1024, } , { - .name = "firmware", + .name = "bootext", + .offset = MTDPART_OFS_APPEND, + .size = 96*1024, + .mask_flags = MTD_WRITEABLE, + } , { + .name = "trx", .offset = MTDPART_OFS_APPEND, .size = MTDPART_SIZ_FULL, + } , { + .name = "firmware", + .offset = 32*1024, + .size = MTDPART_SIZ_FULL, } }; @@ -83,10 +92,17 @@ static void __init p33x_setup(void) /* TODO: setup mac address */ } +unsigned char p33x_vlans[6] __initdata = { + /* FIXME: untested */ + 0x50, 0x48, 0x44, 0x42, 0x41, 0x00 +}; + static struct adm5120_board p334wt_board __initdata = { .mach_type = MACH_ADM5120_P334WT, .name = "ZyXEL Prestige 334WT", .board_setup = p33x_setup, + .eth_num_ports = 5, + .eth_vlans = p33x_vlans, .num_devices = ARRAY_SIZE(p334_devices), .devices = p334_devices, }; @@ -95,6 +111,8 @@ static struct adm5120_board p335_board __initdata = { .mach_type = MACH_ADM5120_P335, .name = "ZyXEL Prestige 335/335WT", .board_setup = p33x_setup, + .eth_num_ports = 5, + .eth_vlans = p33x_vlans, .num_devices = ARRAY_SIZE(p335_devices), .devices = p335_devices, }; diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c index 723f27fe7..e3d051360 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/platform.c @@ -47,6 +47,8 @@ static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base, * converted into a real platform driver */ unsigned int adm5120_eth_num_ports = 6; +EXPORT_SYMBOL_GPL(adm5120_eth_num_ports); + unsigned char adm5120_eth_macs[6][6] = { {'\00', 'A', 'D', 'M', '\x51', '\x20' }, {'\00', 'A', 'D', 'M', '\x51', '\x21' }, @@ -55,9 +57,13 @@ unsigned char adm5120_eth_macs[6][6] = { {'\00', 'A', 'D', 'M', '\x51', '\x24' }, {'\00', 'A', 'D', 'M', '\x51', '\x25' } }; - -EXPORT_SYMBOL_GPL(adm5120_eth_num_ports); EXPORT_SYMBOL_GPL(adm5120_eth_macs); + +unsigned char adm5120_eth_vlans[6] = { + 0x41, 0x42, 0x44, 0x48, 0x50, 0x60 +}; +EXPORT_SYMBOL_GPL(adm5120_eth_vlans); + #else /* Built-in ethernet switch */ struct adm5120_switch_platform_data adm5120_switch_data; -- cgit v1.2.3