Signed-off-by: Cristian Morales Vega <crist...@samknows.com> --- ...diatek-add-swconfig-driver-for-gsw_mt762x.patch | 54 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)
diff --git a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch index bbad8cc..d056551 100644 --- a/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch +++ b/target/linux/ramips/patches-4.4/0513-net-mediatek-add-swconfig-driver-for-gsw_mt762x.patch @@ -28,7 +28,7 @@ Signed-off-by: John Crispin <blo...@openwrt.org> obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk-eth-soc.o --- /dev/null +++ b/drivers/net/ethernet/mediatek/mt7530.c -@@ -0,0 +1,804 @@ +@@ -0,0 +1,856 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License @@ -709,6 +709,50 @@ Signed-off-by: John Crispin <blo...@openwrt.org> + return 0; +} + ++static int mt7621_sw_get_port_fc(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ u32 reg; ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ ++ if (val->port_vlan >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ reg = mdiobus_read(priv->bus, val->port_vlan, 4); ++ reg &= BIT(10); ++ ++ val->value.i = reg ? 1 : 0; ++ ++ return 0; ++} ++ ++static int mt7621_sw_set_port_fc(struct switch_dev *dev, ++ const struct switch_attr *attr, ++ struct switch_val *val) ++{ ++ u32 reg; ++ struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev); ++ ++ if (val->port_vlan >= MT7530_NUM_PORTS) ++ return -EINVAL; ++ ++ reg = mdiobus_read(priv->bus, val->port_vlan, 4); ++ if(val->value.i) { ++ reg |= BIT(10); ++ } else { ++ reg &= ~BIT(10); ++ } ++ mdiobus_write(priv->bus, val->port_vlan, 4, reg); ++ ++ /* Restart auto-negotiation */ ++ reg = mdiobus_read(priv->bus, val->port_vlan, 0); ++ reg |= BIT(9); ++ mdiobus_write(priv->bus, val->port_vlan, 0, reg); ++ ++ return 0; ++} ++ +static const struct switch_attr mt7621_port[] = { + { + .type = SWITCH_TYPE_STRING, @@ -717,6 +761,14 @@ Signed-off-by: John Crispin <blo...@openwrt.org> + .get = mt7621_sw_get_port_mib, + .set = NULL, + }, ++ { ++ .type = SWITCH_TYPE_INT, ++ .name = "flow_ctl", ++ .description = "Flow Control", ++ .get = mt7621_sw_get_port_fc, ++ .set = mt7621_sw_set_port_fc, ++ .max = 1, ++ }, +}; + +static const struct switch_attr mt7530_port[] = { -- 2.6.3 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel