|
|
@@ -214,20 +214,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
#include <linux/jhash.h>
|
|
|
#include <linux/bitfield.h>
|
|
|
#include <net/dsa.h>
|
|
|
-@@ -270,12 +272,8 @@ static const char * const mtk_clks_sourc
|
|
|
- "ethwarp_wocpu2",
|
|
|
- "ethwarp_wocpu1",
|
|
|
- "ethwarp_wocpu0",
|
|
|
-- "top_usxgmii0_sel",
|
|
|
-- "top_usxgmii1_sel",
|
|
|
- "top_sgm0_sel",
|
|
|
- "top_sgm1_sel",
|
|
|
-- "top_xfi_phy0_xtal_sel",
|
|
|
-- "top_xfi_phy1_xtal_sel",
|
|
|
- "top_eth_gmii_sel",
|
|
|
- "top_eth_refck_50m_sel",
|
|
|
- "top_eth_sys_200m_sel",
|
|
|
-@@ -518,6 +516,30 @@ static void mtk_setup_bridge_switch(stru
|
|
|
+@@ -514,6 +516,30 @@ static void mtk_setup_bridge_switch(stru
|
|
|
MTK_GSW_CFG);
|
|
|
}
|
|
|
|
|
|
@@ -258,7 +245,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
static struct phylink_pcs *mtk_mac_select_pcs(struct phylink_config *config,
|
|
|
phy_interface_t interface)
|
|
|
{
|
|
|
-@@ -526,6 +548,21 @@ static struct phylink_pcs *mtk_mac_selec
|
|
|
+@@ -522,6 +548,21 @@ static struct phylink_pcs *mtk_mac_selec
|
|
|
struct mtk_eth *eth = mac->hw;
|
|
|
unsigned int sid;
|
|
|
|
|
|
@@ -280,7 +267,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
if (interface == PHY_INTERFACE_MODE_SGMII ||
|
|
|
phy_interface_mode_is_8023z(interface)) {
|
|
|
sid = (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_SGMII)) ?
|
|
|
-@@ -577,7 +614,22 @@ static void mtk_mac_config(struct phylin
|
|
|
+@@ -573,7 +614,22 @@ static void mtk_mac_config(struct phylin
|
|
|
goto init_err;
|
|
|
}
|
|
|
break;
|
|
|
@@ -303,7 +290,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
break;
|
|
|
default:
|
|
|
goto err_phy;
|
|
|
-@@ -624,8 +676,6 @@ static void mtk_mac_config(struct phylin
|
|
|
+@@ -620,8 +676,6 @@ static void mtk_mac_config(struct phylin
|
|
|
val &= ~SYSCFG0_GE_MODE(SYSCFG0_GE_MASK, mac->id);
|
|
|
val |= SYSCFG0_GE_MODE(ge_mode, mac->id);
|
|
|
regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
|
|
|
@@ -312,7 +299,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
}
|
|
|
|
|
|
/* SGMII */
|
|
|
-@@ -642,21 +692,40 @@ static void mtk_mac_config(struct phylin
|
|
|
+@@ -638,21 +692,40 @@ static void mtk_mac_config(struct phylin
|
|
|
|
|
|
/* Save the syscfg0 value for mac_finish */
|
|
|
mac->syscfg0 = val;
|
|
|
@@ -360,7 +347,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
return;
|
|
|
|
|
|
err_phy:
|
|
|
-@@ -669,6 +738,18 @@ init_err:
|
|
|
+@@ -665,6 +738,18 @@ init_err:
|
|
|
mac->id, phy_modes(state->interface), err);
|
|
|
}
|
|
|
|
|
|
@@ -379,7 +366,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
static int mtk_mac_finish(struct phylink_config *config, unsigned int mode,
|
|
|
phy_interface_t interface)
|
|
|
{
|
|
|
-@@ -677,6 +758,10 @@ static int mtk_mac_finish(struct phylink
|
|
|
+@@ -673,6 +758,10 @@ static int mtk_mac_finish(struct phylink
|
|
|
struct mtk_eth *eth = mac->hw;
|
|
|
u32 mcr_cur, mcr_new;
|
|
|
|
|
|
@@ -390,7 +377,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
/* Enable SGMII */
|
|
|
if (interface == PHY_INTERFACE_MODE_SGMII ||
|
|
|
phy_interface_mode_is_8023z(interface))
|
|
|
-@@ -701,10 +786,14 @@ static void mtk_mac_link_down(struct phy
|
|
|
+@@ -697,10 +786,14 @@ static void mtk_mac_link_down(struct phy
|
|
|
{
|
|
|
struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
|
|
phylink_config);
|
|
|
@@ -408,7 +395,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
}
|
|
|
|
|
|
static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx,
|
|
|
-@@ -776,13 +865,11 @@ static void mtk_set_queue_speed(struct m
|
|
|
+@@ -772,13 +865,11 @@ static void mtk_set_queue_speed(struct m
|
|
|
mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs);
|
|
|
}
|
|
|
|
|
|
@@ -426,7 +413,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
u32 mcr;
|
|
|
|
|
|
mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
|
|
-@@ -826,9 +913,63 @@ static void mtk_mac_link_up(struct phyli
|
|
|
+@@ -822,9 +913,63 @@ static void mtk_mac_link_up(struct phyli
|
|
|
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
|
|
}
|
|
|
|
|
|
@@ -490,7 +477,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
.mac_finish = mtk_mac_finish,
|
|
|
.mac_link_down = mtk_mac_link_down,
|
|
|
.mac_link_up = mtk_mac_link_up,
|
|
|
-@@ -3432,6 +3573,9 @@ static int mtk_open(struct net_device *d
|
|
|
+@@ -3432,6 +3577,9 @@ static int mtk_open(struct net_device *d
|
|
|
|
|
|
ppe_num = eth->soc->ppe_num;
|
|
|
|
|
|
@@ -500,7 +487,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
|
|
|
if (err) {
|
|
|
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
|
|
|
-@@ -3582,6 +3726,9 @@ static int mtk_stop(struct net_device *d
|
|
|
+@@ -3582,6 +3730,9 @@ static int mtk_stop(struct net_device *d
|
|
|
for (i = 0; i < ARRAY_SIZE(eth->ppe); i++)
|
|
|
mtk_ppe_stop(eth->ppe[i]);
|
|
|
|
|
|
@@ -510,7 +497,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-@@ -4672,6 +4819,7 @@ static const struct net_device_ops mtk_n
|
|
|
+@@ -4672,6 +4823,7 @@ static const struct net_device_ops mtk_n
|
|
|
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
|
|
{
|
|
|
const __be32 *_id = of_get_property(np, "reg", NULL);
|
|
|
@@ -518,7 +505,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
phy_interface_t phy_mode;
|
|
|
struct phylink *phylink;
|
|
|
struct mtk_mac *mac;
|
|
|
-@@ -4710,16 +4858,41 @@ static int mtk_add_mac(struct mtk_eth *e
|
|
|
+@@ -4710,16 +4862,41 @@ static int mtk_add_mac(struct mtk_eth *e
|
|
|
mac->id = id;
|
|
|
mac->hw = eth;
|
|
|
mac->of_node = np;
|
|
|
@@ -568,7 +555,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
}
|
|
|
|
|
|
memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip));
|
|
|
-@@ -4802,8 +4975,21 @@ static int mtk_add_mac(struct mtk_eth *e
|
|
|
+@@ -4802,8 +4979,21 @@ static int mtk_add_mac(struct mtk_eth *e
|
|
|
phy_interface_zero(mac->phylink_config.supported_interfaces);
|
|
|
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
|
|
|
mac->phylink_config.supported_interfaces);
|
|
|
@@ -590,7 +577,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
phylink = phylink_create(&mac->phylink_config,
|
|
|
of_fwnode_handle(mac->of_node),
|
|
|
phy_mode, &mtk_phylink_ops);
|
|
|
-@@ -4854,6 +5040,26 @@ free_netdev:
|
|
|
+@@ -4854,6 +5044,26 @@ free_netdev:
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
@@ -617,7 +604,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
|
|
|
{
|
|
|
struct net_device *dev, *tmp;
|
|
|
-@@ -5000,7 +5206,8 @@ static int mtk_probe(struct platform_dev
|
|
|
+@@ -5000,7 +5210,8 @@ static int mtk_probe(struct platform_dev
|
|
|
regmap_write(cci, 0, 3);
|
|
|
}
|
|
|
|
|
|
@@ -627,7 +614,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
err = mtk_sgmii_init(eth);
|
|
|
|
|
|
if (err)
|
|
|
-@@ -5111,6 +5318,24 @@ static int mtk_probe(struct platform_dev
|
|
|
+@@ -5111,6 +5322,24 @@ static int mtk_probe(struct platform_dev
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -652,7 +639,7 @@ Signed-off-by: Daniel Golle <[email protected]>
|
|
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) {
|
|
|
err = devm_request_irq(eth->dev, eth->irq[0],
|
|
|
mtk_handle_irq, 0,
|
|
|
-@@ -5221,6 +5446,11 @@ static void mtk_remove(struct platform_d
|
|
|
+@@ -5221,6 +5450,11 @@ static void mtk_remove(struct platform_d
|
|
|
mtk_stop(eth->netdev[i]);
|
|
|
mac = netdev_priv(eth->netdev[i]);
|
|
|
phylink_disconnect_phy(mac->phylink);
|