aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-06-08 20:18:30 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-06-08 20:18:30 +0000
commite04dd645f2214f98e70e519bff19f02310f3ea23 (patch)
treefb3eba72f7d434217dee0cd87378d4b3af18c1b3 /target/linux/generic-2.6
parent3c213b14ed2fb778e616da3d2f27d40ff8124db5 (diff)
downloadupstream-e04dd645f2214f98e70e519bff19f02310f3ea23.tar.gz
upstream-e04dd645f2214f98e70e519bff19f02310f3ea23.tar.bz2
upstream-e04dd645f2214f98e70e519bff19f02310f3ea23.zip
ip17xx: Initialize VLAN state upon reset
Let VLAN state variables be initialized not only when the enable VLAN bit is toggled, but also upon reset. At this point, this should be a no-op, since the driver reads the current hardware state before doing any modifications anyway, but I plan to keep some state locally in the subsequent patches. Signed-off-by: Martin Mares <mj@ucw.cz> Signed-off-by: Patrick Horn <patrick.horn@gmail.com> SVN-Revision: 21716
Diffstat (limited to 'target/linux/generic-2.6')
-rw-r--r--target/linux/generic-2.6/files/drivers/net/phy/ip175c.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c b/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c
index 03fab74c89..572659117a 100644
--- a/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c
+++ b/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c
@@ -738,12 +738,23 @@ static int ip175c_get_enable_vlan(struct switch_dev *dev, const struct switch_at
return 0;
}
+static void ip175c_reset_vlan_config(struct ip175c_state *state)
+{
+ int i;
+
+ state->remove_tag = 0x0000;
+ state->add_tag = 0x0000;
+ for (i = 0; i < MAX_VLANS; i++)
+ state->vlans[i].ports = 0x0000;
+ for (i = 0; i < MAX_PORTS; i++)
+ state->ports[i].pvid = 0;
+}
+
static int ip175c_set_enable_vlan(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val)
{
struct ip175c_state *state = dev->priv;
int err;
int enable;
- int i;
err = state->regs->get_state(state);
if (err < 0)
@@ -757,10 +768,7 @@ static int ip175c_set_enable_vlan(struct switch_dev *dev, const struct switch_at
state->vlan_enabled = enable;
// Otherwise, if we are switching state, set fields to a known default.
- state->remove_tag = 0x0000;
- state->add_tag = 0x0000;
- for (i = 0; i < MAX_VLANS; i++)
- state->vlans[i].ports = 0x0000;
+ ip175c_reset_vlan_config(state);
return state->regs->set_vlan_mode(state);
}
@@ -875,6 +883,8 @@ static int ip175c_reset(struct switch_dev *dev)
return err;
}
+ ip175c_reset_vlan_config(state);
+
return state->regs->reset(state);
}