aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files/drivers
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-08-29 10:37:40 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-08-29 10:37:40 +0000
commitf1b9d77912787339a2273c94ddece2cb5d0aceb3 (patch)
tree5ca17d9b54fb795d48331f60af8ae3602feb1c1d /target/linux/ramips/files/drivers
parent1f3400d3b4cd3cf817cf63585d3843d1dd1e76d0 (diff)
downloadupstream-f1b9d77912787339a2273c94ddece2cb5d0aceb3.tar.gz
upstream-f1b9d77912787339a2273c94ddece2cb5d0aceb3.tar.bz2
upstream-f1b9d77912787339a2273c94ddece2cb5d0aceb3.zip
ramips: Minor ramips_esw.c cleanup
Stop handling VLAN setup in the kernel. Removes the obsolete RT305X_ESW_VLAN_CONFIG_BYPASS option I added for WL-351 and add some extra comments. Also removes the en_vlan per-port flag that isn't very useful really, it now is only controlled by the global enable_vlan flag. Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de> SVN-Revision: 33301
Diffstat (limited to 'target/linux/ramips/files/drivers')
-rw-r--r--target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c62
1 files changed, 3 insertions, 59 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c b/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c
index 8a70795e7e..19fc3b4b2d 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c
@@ -147,7 +147,6 @@ enum {
/* Port attributes. */
RT305X_ESW_ATTR_PORT_DISABLE,
RT305X_ESW_ATTR_PORT_DOUBLETAG,
- RT305X_ESW_ATTR_PORT_EN_VLAN,
RT305X_ESW_ATTR_PORT_UNTAG,
RT305X_ESW_ATTR_PORT_LED,
RT305X_ESW_ATTR_PORT_LAN,
@@ -159,7 +158,6 @@ struct rt305x_esw_port {
bool disable;
bool doubletag;
bool untag;
- bool en_vlan;
u8 led;
u16 pvid;
};
@@ -335,7 +333,7 @@ static void
rt305x_esw_hw_init(struct rt305x_esw *esw)
{
int i;
- u8 port_map = 0;
+ u8 port_map = RT305X_ESW_PMAP_LLLLLL;
/* vodoo from original driver */
rt305x_esw_wr(esw, 0xC8A07850, RT305X_ESW_REG_FCT0);
@@ -412,55 +410,16 @@ rt305x_esw_hw_init(struct rt305x_esw *esw)
/* select local register */
rt305x_mii_write(esw, 0, 31, 0x8000);
- /* Set up logical config and apply. */
- for (i = 0; i < RT305X_ESW_NUM_VLANS; i++) {
- esw->vlans[i].vid = RT305X_ESW_VLAN_NONE;
- esw->vlans[i].ports = RT305X_ESW_PORTS_NONE;
- }
-
- for (i = 0; i < RT305X_ESW_NUM_PORTS; i++) {
- esw->ports[i].pvid = 1;
- esw->ports[i].en_vlan = 1;
- esw->ports[i].untag = i != RT305X_ESW_PORT6;
- }
-
switch (esw->pdata->vlan_config) {
- case RT305X_ESW_VLAN_CONFIG_BYPASS:
case RT305X_ESW_VLAN_CONFIG_NONE:
port_map = RT305X_ESW_PMAP_LLLLLL;
- esw->global_vlan_enable = 0;
break;
-
case RT305X_ESW_VLAN_CONFIG_LLLLW:
port_map = RT305X_ESW_PMAP_LLLLWL;
- esw->global_vlan_enable = 1;
- esw->vlans[0].vid = 1;
- esw->vlans[1].vid = 2;
- esw->ports[4].pvid = 2;
- esw->ports[5].disable = 1;
- esw->vlans[0].ports =
- BIT(RT305X_ESW_PORT0) | BIT(RT305X_ESW_PORT1) |
- BIT(RT305X_ESW_PORT2) | BIT(RT305X_ESW_PORT3) |
- BIT(RT305X_ESW_PORT6);
- esw->vlans[1].ports =
- BIT(RT305X_ESW_PORT4) | BIT(RT305X_ESW_PORT6);
break;
-
case RT305X_ESW_VLAN_CONFIG_WLLLL:
port_map = RT305X_ESW_PMAP_WLLLLL;
- esw->global_vlan_enable = 1;
- esw->vlans[0].vid = 1;
- esw->vlans[1].vid = 2;
- esw->ports[0].pvid = 2;
- esw->ports[5].disable = 1;
- esw->vlans[0].ports =
- BIT(RT305X_ESW_PORT1) | BIT(RT305X_ESW_PORT2) |
- BIT(RT305X_ESW_PORT3) | BIT(RT305X_ESW_PORT4) |
- BIT(RT305X_ESW_PORT6);
- esw->vlans[1].ports =
- BIT(RT305X_ESW_PORT0) | BIT(RT305X_ESW_PORT6);
break;
-
default:
BUG();
}
@@ -475,6 +434,7 @@ rt305x_esw_hw_init(struct rt305x_esw *esw)
RT305X_ESW_SGC2_LAN_PMAP_M << RT305X_ESW_SGC2_LAN_PMAP_S,
port_map << RT305X_ESW_SGC2_LAN_PMAP_S);
+ /* Apply the empty config. */
rt305x_esw_apply_config(&esw->swdev);
}
@@ -506,7 +466,7 @@ rt305x_esw_apply_config(struct switch_dev *dev)
disable |= esw->ports[i].disable << i;
if (esw->global_vlan_enable) {
doubletag |= esw->ports[i].doubletag << i;
- en_vlan |= esw->ports[i].en_vlan << i;
+ en_vlan |= 1 << i;
untag |= esw->ports[i].untag << i;
pvid = esw->ports[i].pvid;
} else {
@@ -671,10 +631,6 @@ rt305x_esw_get_port_bool(struct switch_dev *dev,
reg = RT305X_ESW_REG_SGC2;
shift = RT305X_ESW_SGC2_DOUBLE_TAG_S;
break;
- case RT305X_ESW_ATTR_PORT_EN_VLAN:
- reg = RT305X_ESW_REG_PFC1;
- shift = RT305X_ESW_PFC1_EN_VLAN_S;
- break;
case RT305X_ESW_ATTR_PORT_UNTAG:
reg = RT305X_ESW_REG_POC3;
shift = RT305X_ESW_POC3_UNTAG_EN_S;
@@ -714,9 +670,6 @@ rt305x_esw_set_port_bool(struct switch_dev *dev,
case RT305X_ESW_ATTR_PORT_DOUBLETAG:
esw->ports[idx].doubletag = val->value.i;
break;
- case RT305X_ESW_ATTR_PORT_EN_VLAN:
- esw->ports[idx].en_vlan = val->value.i;
- break;
case RT305X_ESW_ATTR_PORT_UNTAG:
esw->ports[idx].untag = val->value.i;
break;
@@ -945,15 +898,6 @@ static const struct switch_attr rt305x_esw_port[] = {
},
{
.type = SWITCH_TYPE_INT,
- .name = "en_vlan",
- .description = "VLAN enabled (1:enabled)",
- .max = 1,
- .id = RT305X_ESW_ATTR_PORT_EN_VLAN,
- .get = rt305x_esw_get_port_bool,
- .set = rt305x_esw_set_port_bool,
- },
- {
- .type = SWITCH_TYPE_INT,
.name = "untag",
.description = "Untag (1:strip outgoing vlan tag)",
.max = 1,