*** trunk/target/linux/generic/files/drivers/net/phy/ar8216.c.orig 2012-04-29 15:06:34.000000000 +0900 --- trunk/target/linux/generic/files/drivers/net/phy/ar8216.c 2012-04-30 09:04:53.000000000 +0900 *************** *** 1099,1104 **** --- 1099,1111 ---- else egress = AR8216_OUT_STRIP_VLAN; ingress = AR8216_IN_SECURE; + } + if (priv->vlan) { + if (priv->vlan_tagged & (1 << i)) { + ingress = AR8216_IN_PORT_FALLBACK; + } else { + ingress = AR8216_IN_SECURE; + } } else { pvid = i; egress = AR8216_OUT_KEEP; *************** *** 1135,1142 **** return ar8216_sw_hw_apply(dev); } static struct switch_attr ar8216_globals[] = { ! { .type = SWITCH_TYPE_INT, .name = "enable_vlan", .description = "Enable VLAN mode", --- 1142,1200 ---- return ar8216_sw_hw_apply(dev); } + static int + ar8216_set_learning_enable(struct switch_dev *dev, const struct switch_attr *attr, + struct switch_val *val) + { + struct ar8216_priv *priv = to_ar8216(dev); + int i; + u32 v; + + for (i = 0; i < AR8216_NUM_PORTS; i++) { + v = priv->read(priv, AR8216_REG_PORT_CTRL(i)); + v &= ~AR8216_PORT_CTRL_LEARN; + + if (val->value.i){ + /* Enable port learning for ALL */ + v |= AR8216_PORT_CTRL_LEARN; + } + + priv->write(priv, AR8216_REG_PORT_CTRL(i), v); + } + + return 0; + } + + static int + ar8216_get_learning_enable(struct switch_dev *dev, const struct switch_attr *attr, + struct switch_val *val) + { + struct ar8216_priv *priv = to_ar8216(dev); + u32 v; + + v = priv->read(priv, AR8216_REG_PORT_CTRL(0)); + + v &= AR8216_PORT_CTRL_LEARN; + + if (v == AR8216_PORT_CTRL_LEARN){ + val->value.i = 1; + } + else { + val->value.i = 0; + } + + return 0; + } + static struct switch_attr ar8216_globals[] = { ! { ! .type = SWITCH_TYPE_INT, ! .name = "enable_learning", ! .description = "Enable learning", ! .set = ar8216_set_learning_enable, ! .get = ar8216_get_learning_enable, ! .max = 1 ! }, { .type = SWITCH_TYPE_INT, .name = "enable_vlan", .description = "Enable VLAN mode",