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();
.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,
};
.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,
};
.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,
};
.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,
};
.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,
};
.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,
};
/* 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,
};
.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,
};
.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,
};
.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,
};
.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,
};
.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,
};
.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,
};
/* 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,
};
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,
};
.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,
};
.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,
};
.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,
};
.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,
};
/* 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,
};
.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,
};
.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,
};
.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,
};
.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,
};
.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,
}
};
/* 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,
};
.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,
};
* 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' },
{'\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;
MODULE_DESCRIPTION("ADM5120 ethernet switch driver");
MODULE_LICENSE("GPL");
-/*
- * The ADM5120 uses an internal matrix to determine which ports
- * belong to which VLAN.
- * The default generates a VLAN (and device) for each port
- * (including MII port) and the CPU port is part of all of them.
- *
- * Another example, one big switch and everything mapped to eth0:
- * 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00
- */
-static unsigned char vlan_matrix[SW_DEVS] = {
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x60
-};
-
/* default settings - unlimited TX and RX on all ports, default shaper mode */
static unsigned char bw_matrix[SW_DEVS] = {
0, 0, 0, 0, 0, 0
val = adm5120_get_reg(ADM5120_PORT_CONF0);
for (i=0; i<SW_DEVS; i++) {
if (dev == adm5120_devs[i])
- val &= ~vlan_matrix[i];
+ val &= ~adm5120_eth_vlans[i];
}
adm5120_set_reg(ADM5120_PORT_CONF0, val);
return 0;
val = adm5120_get_reg(ADM5120_PORT_CONF0) | ADM5120_PORTDISALL;
for (i=0; i<SW_DEVS; i++) {
if ((dev != adm5120_devs[i]) && netif_running(adm5120_devs[i]))
- val &= ~vlan_matrix[i];
+ val &= ~adm5120_eth_vlans[i];
}
adm5120_set_reg(ADM5120_PORT_CONF0, val);
netif_stop_queue(dev);
int portmask;
unsigned long adm5120_cpup_conf_reg;
- portmask = vlan_matrix[priv->port] & 0x3f;
+ portmask = adm5120_eth_vlans[priv->port] & 0x3f;
adm5120_cpup_conf_reg = adm5120_get_reg(ADM5120_CPUP_CONF);
struct adm5120_sw *priv = netdev_priv(dev);
int portmask;
- portmask = vlan_matrix[priv->port] & 0x3f;
+ portmask = adm5120_eth_vlans[priv->port] & 0x3f;
if (dev->flags & IFF_PROMISC)
adm5120_set_reg(ADM5120_CPUP_CONF,
case SIOCSMATRIX:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- err = copy_from_user(vlan_matrix, rq->ifr_data,
- sizeof(vlan_matrix));
+ err = copy_from_user(adm5120_eth_vlans, rq->ifr_data,
+ sizeof(adm5120_eth_vlans));
if (err)
return -EFAULT;
- adm5120_set_vlan(vlan_matrix);
+ adm5120_set_vlan(adm5120_eth_vlans);
break;
case SIOCGMATRIX:
- err = copy_to_user(rq->ifr_data, vlan_matrix,
- sizeof(vlan_matrix));
+ err = copy_to_user(rq->ifr_data, adm5120_eth_vlans,
+ sizeof(adm5120_eth_vlans));
if (err)
return -EFAULT;
break;
printk(KERN_INFO "%s: ADM5120 switch port%d\n", dev->name, i);
}
/* setup vlan/port mapping after devs are filled up */
- adm5120_set_vlan(vlan_matrix);
+ adm5120_set_vlan(adm5120_eth_vlans);
adm5120_set_reg(ADM5120_CPUP_CONF,
ADM5120_CRC_PADDING | ADM5120_DISUNALL | ADM5120_DISMCALL);
void (*board_setup)(void);
void (*board_reset)(void);
- unsigned int num_eth_ports;
+ unsigned int eth_num_ports;
+ unsigned char *eth_vlans;
unsigned int num_devices;
struct platform_device **devices;
*/
extern unsigned int adm5120_eth_num_ports;
extern unsigned char adm5120_eth_macs[6][6];
+extern unsigned char adm5120_eth_vlans[6];
extern void adm5120_soc_init(void) __init;
extern void adm5120_mem_init(void) __init;