kernel: bump 5.4 to 5.4.142
[openwrt/openwrt.git] / target / linux / mediatek / patches-5.4 / 0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch
index 8434c61b505391fc0024029e8009c72a357ed4f8..2d20bbc37c762c2120cbc0000ee8c697c73ea692 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
 
 --- a/drivers/net/dsa/mt7530.c
 +++ b/drivers/net/dsa/mt7530.c
-@@ -234,6 +234,12 @@ mt7530_write(struct mt7530_priv *priv, u
+@@ -235,6 +235,12 @@ mt7530_write(struct mt7530_priv *priv, u
  }
  
  static u32
@@ -41,7 +41,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  _mt7530_read(struct mt7530_dummy_poll *p)
  {
        struct mii_bus          *bus = p->priv->bus;
-@@ -481,6 +487,108 @@ mt7530_pad_clk_setup(struct dsa_switch *
+@@ -482,6 +488,108 @@ mt7530_pad_clk_setup(struct dsa_switch *
        return 0;
  }
  
@@ -150,7 +150,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static void
  mt7530_mib_reset(struct dsa_switch *ds)
  {
-@@ -505,6 +613,217 @@ static int mt7530_phy_write(struct dsa_s
+@@ -506,6 +614,217 @@ static int mt7530_phy_write(struct dsa_s
        return mdiobus_write_nested(priv->bus, port, regnum, val);
  }
  
@@ -368,7 +368,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static void
  mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset,
                   uint8_t *data)
-@@ -621,9 +940,14 @@ unlock_exit:
+@@ -622,9 +941,14 @@ unlock_exit:
  }
  
  static int
@@ -385,7 +385,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        /* Enable Mediatek header mode on the cpu port */
        mt7530_write(priv, MT7530_PVC_P(port),
                     PORT_SPEC_TAG);
-@@ -636,7 +960,7 @@ mt7530_cpu_port_enable(struct mt7530_pri
+@@ -637,7 +961,7 @@ mt7530_cpu_port_enable(struct mt7530_pri
                mt7530_rmw(priv, MT7530_MFC, CPU_MASK, CPU_EN | CPU_PORT(port));
  
        /* CPU port gets connected to all user ports of
@@ -394,7 +394,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
         */
        mt7530_write(priv, MT7530_PCR_P(port),
                     PCR_MATRIX(dsa_user_ports(priv->ds)));
-@@ -1122,27 +1446,42 @@ mt7530_port_vlan_del(struct dsa_switch *
+@@ -1123,27 +1447,42 @@ mt7530_port_vlan_del(struct dsa_switch *
        return 0;
  }
  
@@ -444,7 +444,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  
        val = mt7530_read(priv, MT7530_PCR_P(port));
        if (ingress) {
-@@ -1157,7 +1496,7 @@ static int mt7530_port_mirror_add(struct
+@@ -1158,7 +1497,7 @@ static int mt7530_port_mirror_add(struct
        return 0;
  }
  
@@ -453,7 +453,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                                   struct dsa_mall_mirror_tc_entry *mirror)
  {
        struct mt7530_priv *priv = ds->priv;
-@@ -1174,9 +1513,9 @@ static void mt7530_port_mirror_del(struc
+@@ -1175,9 +1514,9 @@ static void mt7530_port_mirror_del(struc
        mt7530_write(priv, MT7530_PCR_P(port), val);
  
        if (!priv->mirror_rx && !priv->mirror_tx) {
@@ -466,7 +466,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        }
  }
  
-@@ -1282,7 +1621,7 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1283,7 +1622,7 @@ mt7530_setup(struct dsa_switch *ds)
                           PCR_MATRIX_CLR);
  
                if (dsa_is_cpu_port(ds, i))
@@ -475,7 +475,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                else
                        mt7530_port_disable(ds, i);
  
-@@ -1336,6 +1675,118 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1337,6 +1676,118 @@ mt7530_setup(struct dsa_switch *ds)
        return 0;
  }
  
@@ -594,7 +594,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static bool
  mt7530_phy_mode_supported(struct dsa_switch *ds, int port,
                          const struct phylink_link_state *state)
-@@ -1374,6 +1825,47 @@ unsupported:
+@@ -1375,6 +1826,47 @@ unsupported:
        return false;
  }
  
@@ -642,7 +642,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static bool
  mt753x_phy_mode_supported(struct dsa_switch *ds, int port,
                          const struct phylink_link_state *state)
-@@ -1406,6 +1898,227 @@ mt7530_mac_config(struct dsa_switch *ds,
+@@ -1407,6 +1899,227 @@ mt7530_mac_config(struct dsa_switch *ds,
        return 0;
  }
  
@@ -870,7 +870,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static int
  mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
                  const struct phylink_link_state *state)
-@@ -1441,6 +2154,8 @@ mt753x_phylink_mac_config(struct dsa_swi
+@@ -1442,6 +2155,8 @@ mt753x_phylink_mac_config(struct dsa_swi
                if (mt753x_mac_config(ds, port, mode, state) < 0)
                        goto unsupported;
  
@@ -879,7 +879,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                break;
        case 6: /* 1st cpu port */
                if (priv->p6_interface == state->interface)
-@@ -1460,7 +2175,8 @@ unsupported:
+@@ -1461,7 +2176,8 @@ unsupported:
                return;
        }
  
@@ -889,7 +889,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                dev_err(ds->dev, "%s: in-band negotiation unsupported\n",
                        __func__);
                return;
-@@ -1470,7 +2186,7 @@ unsupported:
+@@ -1471,7 +2187,7 @@ unsupported:
        mcr_new = mcr_cur;
        mcr_new &= ~PMCR_LINK_SETTINGS_MASK;
        mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN |
@@ -898,7 +898,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  
        /* Are we connected to external phy */
        if (port == 5 && dsa_is_user_port(ds, 5))
-@@ -1480,7 +2196,18 @@ unsupported:
+@@ -1481,7 +2197,18 @@ unsupported:
                mt7530_write(priv, MT7530_PMCR_P(port), mcr_new);
  }
  
@@ -918,7 +918,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                                         unsigned int mode,
                                         phy_interface_t interface)
  {
-@@ -1489,7 +2216,19 @@ static void mt7530_phylink_mac_link_down
+@@ -1490,7 +2217,19 @@ static void mt7530_phylink_mac_link_down
        mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK);
  }
  
@@ -939,7 +939,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                                       unsigned int mode,
                                       phy_interface_t interface,
                                       struct phy_device *phydev,
-@@ -1499,18 +2238,29 @@ static void mt7530_phylink_mac_link_up(s
+@@ -1500,18 +2239,29 @@ static void mt7530_phylink_mac_link_up(s
        struct mt7530_priv *priv = ds->priv;
        u32 mcr;
  
@@ -971,7 +971,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                break;
        }
        if (duplex == DUPLEX_FULL) {
-@@ -1524,6 +2274,45 @@ static void mt7530_phylink_mac_link_up(s
+@@ -1525,6 +2275,45 @@ static void mt7530_phylink_mac_link_up(s
        mt7530_set(priv, MT7530_PMCR_P(port), mcr);
  }
  
@@ -1017,7 +1017,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static void
  mt7530_mac_port_validate(struct dsa_switch *ds, int port,
                         unsigned long *supported)
-@@ -1532,6 +2321,14 @@ mt7530_mac_port_validate(struct dsa_swit
+@@ -1533,6 +2322,14 @@ mt7530_mac_port_validate(struct dsa_swit
                phylink_set(supported, 1000baseX_Full);
  }
  
@@ -1032,7 +1032,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static void
  mt753x_phylink_validate(struct dsa_switch *ds, int port,
                        unsigned long *supported,
-@@ -1548,7 +2345,8 @@ mt753x_phylink_validate(struct dsa_switc
+@@ -1549,7 +2346,8 @@ mt753x_phylink_validate(struct dsa_switc
  
        phylink_set_port_modes(mask);
  
@@ -1042,7 +1042,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
                phylink_set(mask, 10baseT_Half);
                phylink_set(mask, 10baseT_Full);
                phylink_set(mask, 100baseT_Half);
-@@ -1567,6 +2365,11 @@ mt753x_phylink_validate(struct dsa_switc
+@@ -1568,6 +2366,11 @@ mt753x_phylink_validate(struct dsa_switc
  
        linkmode_and(supported, supported, mask);
        linkmode_and(state->advertising, state->advertising, mask);
@@ -1054,7 +1054,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  }
  
  static int
-@@ -1657,6 +2460,63 @@ static int mt7530_set_mac_eee(struct dsa
+@@ -1658,6 +2461,63 @@ static int mt7530_set_mac_eee(struct dsa
        return 0;
  }
  
@@ -1118,7 +1118,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
  static int
  mt753x_phylink_mac_link_state(struct dsa_switch *ds, int port,
                              struct phylink_link_state *state)
-@@ -1710,13 +2570,14 @@ static const struct dsa_switch_ops mt753
+@@ -1711,13 +2571,14 @@ static const struct dsa_switch_ops mt753
        .port_vlan_prepare      = mt7530_port_vlan_prepare,
        .port_vlan_add          = mt7530_port_vlan_add,
        .port_vlan_del          = mt7530_port_vlan_del,
@@ -1137,7 +1137,7 @@ Signed-off-by: Sean Wang <sean.wang@mediatek.com>
        .get_mac_eee            = mt7530_get_mac_eee,
        .set_mac_eee            = mt7530_set_mac_eee,
  };
-@@ -1744,11 +2605,26 @@ static const struct mt753x_info mt753x_t
+@@ -1745,11 +2606,26 @@ static const struct mt753x_info mt753x_t
                .mac_port_get_state = mt7530_phylink_mac_link_state,
                .mac_port_config = mt7530_mac_config,
        },