1 --- a/drivers/net/dsa/mt7530.c
2 +++ b/drivers/net/dsa/mt7530.c
3 @@ -834,6 +834,7 @@ mt7530_port_bridge_join(struct dsa_switc
6 mutex_lock(&priv->reg_mutex);
7 + priv->bridge_dev[port] = bridge;
9 for (i = 0; i < MT7530_NUM_PORTS; i++) {
10 /* Add this port to the port matrix of the other ports in the
11 @@ -841,7 +842,7 @@ mt7530_port_bridge_join(struct dsa_switc
12 * and not being setup until the port becomes enabled.
14 if (ds->enabled_port_mask & BIT(i) && i != port) {
15 - if (ds->ports[i].bridge_dev != bridge)
16 + if (priv->bridge_dev[i] != bridge)
18 if (priv->ports[i].enable)
19 mt7530_set(priv, MT7530_PCR_P(i),
20 @@ -864,8 +865,7 @@ mt7530_port_bridge_join(struct dsa_switc
24 -mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
25 - struct net_device *bridge)
26 +mt7530_port_bridge_leave(struct dsa_switch *ds, int port)
28 struct mt7530_priv *priv = ds->priv;
30 @@ -878,7 +878,7 @@ mt7530_port_bridge_leave(struct dsa_swit
31 * is kept and not being setup until the port becomes enabled.
33 if (ds->enabled_port_mask & BIT(i) && i != port) {
34 - if (ds->ports[i].bridge_dev != bridge)
35 + if (priv->bridge_dev[i] != priv->bridge_dev[port])
37 if (priv->ports[i].enable)
38 mt7530_clear(priv, MT7530_PCR_P(i),
39 @@ -890,6 +890,7 @@ mt7530_port_bridge_leave(struct dsa_swit
40 /* Set the cpu port to be the only one in the port matrix of
43 + priv->bridge_dev[port] = NULL;
44 if (priv->ports[port].enable)
45 mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
46 PCR_MATRIX(BIT(MT7530_CPU_PORT)));
47 @@ -1033,7 +1034,7 @@ mt7530_probe(struct mdio_device *mdiodev
51 - priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
52 + priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL);
56 @@ -1076,12 +1077,13 @@ mt7530_probe(struct mdio_device *mdiodev
57 priv->bus = mdiodev->bus;
58 priv->dev = &mdiodev->dev;
59 priv->ds->priv = priv;
60 + priv->ds->dev = &mdiodev->dev;
61 priv->ds->ops = &mt7530_switch_ops;
62 mutex_init(&priv->reg_mutex);
64 dev_set_drvdata(&mdiodev->dev, priv);
66 - return dsa_register_switch(priv->ds, &mdiodev->dev);
67 + return dsa_register_switch(priv->ds, priv->ds->dev->of_node);
71 --- a/drivers/net/dsa/mt7530.h
72 +++ b/drivers/net/dsa/mt7530.h
73 @@ -379,6 +379,8 @@ struct mt7530_priv {
74 struct mt7530_port ports[MT7530_NUM_PORTS];
75 /* protect among processes for registers access*/
76 struct mutex reg_mutex;
78 + struct net_device *bridge_dev[MT7530_NUM_PORTS];
81 struct mt7530_hw_stats {
82 --- a/net/dsa/tag_mtk.c
83 +++ b/net/dsa/tag_mtk.c
84 @@ -35,7 +35,7 @@ static struct sk_buff *mtk_tag_xmit(stru
85 /* Build the tag after the MAC Source Address */
86 mtk_tag = skb->data + 2 * ETH_ALEN;
88 - mtk_tag[1] = (1 << p->dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
89 + mtk_tag[1] = (1 << p->port) & MTK_HDR_XMIT_DP_BIT_MASK;