aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-12-08 10:15:28 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-12-08 10:15:28 +0000
commitc1bae026dc836ef75f1c212b9819b576a2b952a7 (patch)
tree5770d40f631d6c2226570172f4f929551ead7d8c /target
parentdc512ca5aa85a8f7208653990d9e238dd419e23c (diff)
downloadupstream-c1bae026dc836ef75f1c212b9819b576a2b952a7.tar.gz
upstream-c1bae026dc836ef75f1c212b9819b576a2b952a7.tar.bz2
upstream-c1bae026dc836ef75f1c212b9819b576a2b952a7.zip
ramips: ramips_esw: add helper function to set pvid
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24339 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/ramips/files/drivers/net/ramips_esw.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/target/linux/ramips/files/drivers/net/ramips_esw.c b/target/linux/ramips/files/drivers/net/ramips_esw.c
index c4220324a0..7aa5fd1517 100644
--- a/target/linux/ramips/files/drivers/net/ramips_esw.c
+++ b/target/linux/ramips/files/drivers/net/ramips_esw.c
@@ -28,6 +28,9 @@
#define RT305X_ESW_PHY_TIMEOUT (5 * HZ)
+#define RT305X_ESW_PVIDC_PVID_M 0xfff
+#define RT305X_ESW_PVIDC_PVID_S 12
+
#define RT305X_ESW_VLANI_VID_M 0xfff
#define RT305X_ESW_VLANI_VID_S 12
@@ -135,6 +138,18 @@ rt305x_esw_set_vlan_id(struct rt305x_esw *esw, unsigned vlan, unsigned vid)
}
static void
+rt305x_esw_set_pvid(struct rt305x_esw *esw, unsigned port, unsigned pvid)
+{
+ unsigned s;
+
+ s = RT305X_ESW_PVIDC_PVID_S * (port % 2);
+ rt305x_esw_rmw(esw,
+ RT305X_ESW_REG_PVIDC(port / 2),
+ RT305X_ESW_PVIDC_PVID_S << s,
+ (pvid & RT305X_ESW_PVIDC_PVID_M) << s);
+}
+
+static void
rt305x_esw_set_vmsc(struct rt305x_esw *esw, unsigned vlan, unsigned msc)
{
unsigned s;
@@ -160,7 +175,8 @@ rt305x_esw_hw_init(struct rt305x_esw *esw)
rt305x_esw_wr(esw, 0x00d6500c, RT305X_ESW_REG_FCT2);
rt305x_esw_wr(esw, 0x0008a301, RT305X_ESW_REG_SGC);
rt305x_esw_wr(esw, 0x02404040, RT305X_ESW_REG_SOCPC);
- rt305x_esw_wr(esw, 0x00001002, RT305X_ESW_REG_PVIDC(2));
+ rt305x_esw_set_pvid(esw, RT305X_ESW_PORT4, 2);
+ rt305x_esw_set_pvid(esw, RT305X_ESW_PORT5, 1);
rt305x_esw_wr(esw, 0x3f502b28, RT305X_ESW_REG_FPA2);
rt305x_esw_wr(esw, 0x00000000, RT305X_ESW_REG_FPA);