diff options
Diffstat (limited to 'target/linux/mediatek/patches-4.9/0031-net-dsa-dsa-api-compat.patch')
-rw-r--r-- | target/linux/mediatek/patches-4.9/0031-net-dsa-dsa-api-compat.patch | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/mediatek/patches-4.9/0031-net-dsa-dsa-api-compat.patch b/target/linux/mediatek/patches-4.9/0031-net-dsa-dsa-api-compat.patch new file mode 100644 index 0000000..9e52be8 --- /dev/null +++ b/target/linux/mediatek/patches-4.9/0031-net-dsa-dsa-api-compat.patch @@ -0,0 +1,106 @@ +From a319687ac18dcc557a88054282508e061ad8495f Mon Sep 17 00:00:00 2001 +From: John Crispin <john@phrozen.org> +Date: Thu, 10 Aug 2017 14:42:19 +0200 +Subject: [PATCH 31/57] net: dsa: dsa api compat + +make the latest driver work on the old API + +Signed-off-by: John Crispin <john@phrozen.org> +--- + drivers/net/dsa/mt7530.c | 14 ++++++++------ + drivers/net/dsa/mt7530.h | 2 ++ + net/dsa/tag_mtk.c | 2 +- + 3 files changed, 11 insertions(+), 7 deletions(-) + +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -834,6 +834,7 @@ mt7530_port_bridge_join(struct dsa_switc + int i; + + mutex_lock(&priv->reg_mutex); ++ priv->bridge_dev[port] = bridge; + + for (i = 0; i < MT7530_NUM_PORTS; i++) { + /* Add this port to the port matrix of the other ports in the +@@ -841,7 +842,7 @@ mt7530_port_bridge_join(struct dsa_switc + * and not being setup until the port becomes enabled. + */ + if (ds->enabled_port_mask & BIT(i) && i != port) { +- if (ds->ports[i].bridge_dev != bridge) ++ if (priv->bridge_dev[i] != bridge) + continue; + if (priv->ports[i].enable) + mt7530_set(priv, MT7530_PCR_P(i), +@@ -864,8 +865,7 @@ mt7530_port_bridge_join(struct dsa_switc + } + + static void +-mt7530_port_bridge_leave(struct dsa_switch *ds, int port, +- struct net_device *bridge) ++mt7530_port_bridge_leave(struct dsa_switch *ds, int port) + { + struct mt7530_priv *priv = ds->priv; + int i; +@@ -878,7 +878,7 @@ mt7530_port_bridge_leave(struct dsa_swit + * is kept and not being setup until the port becomes enabled. + */ + if (ds->enabled_port_mask & BIT(i) && i != port) { +- if (ds->ports[i].bridge_dev != bridge) ++ if (priv->bridge_dev[i] != priv->bridge_dev[port]) + continue; + if (priv->ports[i].enable) + mt7530_clear(priv, MT7530_PCR_P(i), +@@ -890,6 +890,7 @@ mt7530_port_bridge_leave(struct dsa_swit + /* Set the cpu port to be the only one in the port matrix of + * this port. + */ ++ priv->bridge_dev[port] = NULL; + if (priv->ports[port].enable) + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, + PCR_MATRIX(BIT(MT7530_CPU_PORT))); +@@ -1033,7 +1034,7 @@ mt7530_probe(struct mdio_device *mdiodev + if (!priv) + return -ENOMEM; + +- priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS); ++ priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL); + if (!priv->ds) + return -ENOMEM; + +@@ -1076,12 +1077,13 @@ mt7530_probe(struct mdio_device *mdiodev + priv->bus = mdiodev->bus; + priv->dev = &mdiodev->dev; + priv->ds->priv = priv; ++ priv->ds->dev = &mdiodev->dev; + priv->ds->ops = &mt7530_switch_ops; + mutex_init(&priv->reg_mutex); + lpriv = priv; + dev_set_drvdata(&mdiodev->dev, priv); + +- return dsa_register_switch(priv->ds, &mdiodev->dev); ++ return dsa_register_switch(priv->ds, priv->ds->dev->of_node); + } + + static void +--- a/drivers/net/dsa/mt7530.h ++++ b/drivers/net/dsa/mt7530.h +@@ -379,6 +379,8 @@ struct mt7530_priv { + struct mt7530_port ports[MT7530_NUM_PORTS]; + /* protect among processes for registers access*/ + struct mutex reg_mutex; ++ ++ struct net_device *bridge_dev[MT7530_NUM_PORTS]; + }; + + struct mt7530_hw_stats { +--- a/net/dsa/tag_mtk.c ++++ b/net/dsa/tag_mtk.c +@@ -35,7 +35,7 @@ static struct sk_buff *mtk_tag_xmit(stru + /* Build the tag after the MAC Source Address */ + mtk_tag = skb->data + 2 * ETH_ALEN; + mtk_tag[0] = 0; +- mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK; ++ mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK; + mtk_tag[2] = 0; + mtk_tag[3] = 0; + |