generic: 6.6: fix copy & refresh
A new patch was added meanwhile which will go as fix via netdev tree. Copy & refresh it for Linux 6.6 as well. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
d84128658b
commit
c0e1e7542c
@ -0,0 +1,50 @@
|
|||||||
|
From ef5976ae4e117fae9a61bb3c0f8319a917a425ea Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
Date: Mon, 11 Mar 2024 17:43:28 +0000
|
||||||
|
Subject: [PATCH] net: mediatek: mtk_eth_soc: release MAC_MCR_FORCE_LINK only when MAC is up
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Clearing bit MAC_MCR_FORCE_LINK which forces the link down too early
|
||||||
|
can result in MAC ending up in a broken/blocked state.
|
||||||
|
|
||||||
|
Fix this by handling this bit in the .mac_link_up and .mac_link_down
|
||||||
|
calls instead of in .mac_finish.
|
||||||
|
|
||||||
|
Fixes: b8fc9f30821ec ("net: ethernet: mediatek: Add basic PHYLINK support")
|
||||||
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +++----
|
||||||
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
@@ -678,8 +678,7 @@ static int mtk_mac_finish(struct phylink
|
||||||
|
mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||||
|
mcr_new = mcr_cur;
|
||||||
|
mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE |
|
||||||
|
- MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK |
|
||||||
|
- MAC_MCR_RX_FIFO_CLR_DIS;
|
||||||
|
+ MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_RX_FIFO_CLR_DIS;
|
||||||
|
|
||||||
|
/* Only update control register when needed! */
|
||||||
|
if (mcr_new != mcr_cur)
|
||||||
|
@@ -695,7 +694,7 @@ static void mtk_mac_link_down(struct phy
|
||||||
|
phylink_config);
|
||||||
|
u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||||
|
|
||||||
|
- mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN);
|
||||||
|
+ mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK);
|
||||||
|
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -804,7 +803,7 @@ static void mtk_mac_link_up(struct phyli
|
||||||
|
if (rx_pause)
|
||||||
|
mcr |= MAC_MCR_FORCE_RX_FC;
|
||||||
|
|
||||||
|
- mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN;
|
||||||
|
+ mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK;
|
||||||
|
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
From 91bda2f441f9e37273922028ffc48ce8e91bf5bd Mon Sep 17 00:00:00 2001
|
From d5e337e7aecc2e1cc9e96768062610adb95f8f72 Mon Sep 17 00:00:00 2001
|
||||||
From: Daniel Golle <daniel@makrotopia.org>
|
From: Daniel Golle <daniel@makrotopia.org>
|
||||||
Date: Tue, 12 Dec 2023 03:51:14 +0000
|
Date: Tue, 12 Dec 2023 03:51:14 +0000
|
||||||
Subject: [PATCH] net: ethernet: mtk_eth_soc: add paths and SerDes modes for
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: add paths and SerDes modes for
|
||||||
@ -19,9 +19,9 @@ modes.
|
|||||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
---
|
---
|
||||||
drivers/net/ethernet/mediatek/mtk_eth_path.c | 122 +++++++-
|
drivers/net/ethernet/mediatek/mtk_eth_path.c | 122 +++++++-
|
||||||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 291 +++++++++++++++++--
|
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 292 +++++++++++++++++--
|
||||||
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 107 ++++++-
|
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 107 ++++++-
|
||||||
3 files changed, 469 insertions(+), 51 deletions(-)
|
3 files changed, 470 insertions(+), 51 deletions(-)
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_path.c
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_path.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_path.c
|
||||||
@ -390,24 +390,25 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
/* Enable SGMII */
|
/* Enable SGMII */
|
||||||
if (interface == PHY_INTERFACE_MODE_SGMII ||
|
if (interface == PHY_INTERFACE_MODE_SGMII ||
|
||||||
phy_interface_mode_is_8023z(interface))
|
phy_interface_mode_is_8023z(interface))
|
||||||
@@ -693,10 +778,13 @@ static void mtk_mac_link_down(struct phy
|
@@ -692,10 +777,14 @@ static void mtk_mac_link_down(struct phy
|
||||||
{
|
{
|
||||||
struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
||||||
phylink_config);
|
phylink_config);
|
||||||
- u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
- u32 mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||||
|
|
||||||
- mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN);
|
- mcr &= ~(MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK);
|
||||||
- mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
- mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
||||||
+ if (!mtk_interface_mode_is_xgmii(interface)) {
|
+ if (!mtk_interface_mode_is_xgmii(interface)) {
|
||||||
+ mtk_m32(mac->hw, MAC_MCR_TX_EN | MAC_MCR_RX_EN, 0, MTK_MAC_MCR(mac->id));
|
+ mtk_m32(mac->hw, MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK, 0, MTK_MAC_MCR(mac->id));
|
||||||
|
+ if (mtk_is_netsys_v3_or_greater(mac->hw))
|
||||||
+ mtk_m32(mac->hw, MTK_XGMAC_FORCE_LINK(mac->id), 0, MTK_XGMAC_STS(mac->id));
|
+ mtk_m32(mac->hw, MTK_XGMAC_FORCE_LINK(mac->id), 0, MTK_XGMAC_STS(mac->id));
|
||||||
+ } else if (mac->id != MTK_GMAC1_ID) {
|
+ } else if (mtk_is_netsys_v3_or_greater(mac->hw) && mac->id != MTK_GMAC1_ID) {
|
||||||
+ mtk_m32(mac->hw, XMAC_MCR_TRX_DISABLE, XMAC_MCR_TRX_DISABLE, MTK_XMAC_MCR(mac->id));
|
+ mtk_m32(mac->hw, XMAC_MCR_TRX_DISABLE, XMAC_MCR_TRX_DISABLE, MTK_XMAC_MCR(mac->id));
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx,
|
static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx,
|
||||||
@@ -768,13 +856,11 @@ static void mtk_set_queue_speed(struct m
|
@@ -767,13 +856,11 @@ static void mtk_set_queue_speed(struct m
|
||||||
mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs);
|
mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +426,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
u32 mcr;
|
u32 mcr;
|
||||||
|
|
||||||
mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
|
||||||
@@ -808,9 +894,63 @@ static void mtk_mac_link_up(struct phyli
|
@@ -807,9 +894,63 @@ static void mtk_mac_link_up(struct phyli
|
||||||
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +471,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
+ struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
+ struct mtk_mac *mac = container_of(config, struct mtk_mac,
|
||||||
+ phylink_config);
|
+ phylink_config);
|
||||||
+
|
+
|
||||||
+ if (mtk_interface_mode_is_xgmii(interface))
|
+ if (mtk_is_netsys_v3_or_greater(mac->hw) && mtk_interface_mode_is_xgmii(interface))
|
||||||
+ mtk_xgdm_mac_link_up(mac, phy, mode, interface, speed, duplex,
|
+ mtk_xgdm_mac_link_up(mac, phy, mode, interface, speed, duplex,
|
||||||
+ tx_pause, rx_pause);
|
+ tx_pause, rx_pause);
|
||||||
+ else
|
+ else
|
||||||
@ -489,7 +490,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
.mac_finish = mtk_mac_finish,
|
.mac_finish = mtk_mac_finish,
|
||||||
.mac_link_down = mtk_mac_link_down,
|
.mac_link_down = mtk_mac_link_down,
|
||||||
.mac_link_up = mtk_mac_link_up,
|
.mac_link_up = mtk_mac_link_up,
|
||||||
@@ -3391,6 +3531,9 @@ static int mtk_open(struct net_device *d
|
@@ -3390,6 +3531,9 @@ static int mtk_open(struct net_device *d
|
||||||
struct mtk_eth *eth = mac->hw;
|
struct mtk_eth *eth = mac->hw;
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
@ -499,7 +500,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
|
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
|
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
|
||||||
@@ -3520,6 +3663,9 @@ static int mtk_stop(struct net_device *d
|
@@ -3519,6 +3663,9 @@ static int mtk_stop(struct net_device *d
|
||||||
for (i = 0; i < ARRAY_SIZE(eth->ppe); i++)
|
for (i = 0; i < ARRAY_SIZE(eth->ppe); i++)
|
||||||
mtk_ppe_stop(eth->ppe[i]);
|
mtk_ppe_stop(eth->ppe[i]);
|
||||||
|
|
||||||
@ -509,7 +510,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4517,6 +4663,7 @@ static const struct net_device_ops mtk_n
|
@@ -4516,6 +4663,7 @@ static const struct net_device_ops mtk_n
|
||||||
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
||||||
{
|
{
|
||||||
const __be32 *_id = of_get_property(np, "reg", NULL);
|
const __be32 *_id = of_get_property(np, "reg", NULL);
|
||||||
@ -517,7 +518,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
phy_interface_t phy_mode;
|
phy_interface_t phy_mode;
|
||||||
struct phylink *phylink;
|
struct phylink *phylink;
|
||||||
struct mtk_mac *mac;
|
struct mtk_mac *mac;
|
||||||
@@ -4553,16 +4700,41 @@ static int mtk_add_mac(struct mtk_eth *e
|
@@ -4552,16 +4700,41 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||||
mac->id = id;
|
mac->id = id;
|
||||||
mac->hw = eth;
|
mac->hw = eth;
|
||||||
mac->of_node = np;
|
mac->of_node = np;
|
||||||
@ -567,7 +568,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip));
|
memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip));
|
||||||
@@ -4645,8 +4817,21 @@ static int mtk_add_mac(struct mtk_eth *e
|
@@ -4644,8 +4817,21 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||||
phy_interface_zero(mac->phylink_config.supported_interfaces);
|
phy_interface_zero(mac->phylink_config.supported_interfaces);
|
||||||
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
|
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
|
||||||
mac->phylink_config.supported_interfaces);
|
mac->phylink_config.supported_interfaces);
|
||||||
@ -589,7 +590,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
phylink = phylink_create(&mac->phylink_config,
|
phylink = phylink_create(&mac->phylink_config,
|
||||||
of_fwnode_handle(mac->of_node),
|
of_fwnode_handle(mac->of_node),
|
||||||
phy_mode, &mtk_phylink_ops);
|
phy_mode, &mtk_phylink_ops);
|
||||||
@@ -4697,6 +4882,26 @@ free_netdev:
|
@@ -4696,6 +4882,26 @@ free_netdev:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,7 +617,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
|
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
|
||||||
{
|
{
|
||||||
struct net_device *dev, *tmp;
|
struct net_device *dev, *tmp;
|
||||||
@@ -4843,7 +5048,8 @@ static int mtk_probe(struct platform_dev
|
@@ -4842,7 +5048,8 @@ static int mtk_probe(struct platform_dev
|
||||||
regmap_write(cci, 0, 3);
|
regmap_write(cci, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +627,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
err = mtk_sgmii_init(eth);
|
err = mtk_sgmii_init(eth);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
@@ -4954,6 +5160,24 @@ static int mtk_probe(struct platform_dev
|
@@ -4953,6 +5160,24 @@ static int mtk_probe(struct platform_dev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +652,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|||||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) {
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) {
|
||||||
err = devm_request_irq(eth->dev, eth->irq[0],
|
err = devm_request_irq(eth->dev, eth->irq[0],
|
||||||
mtk_handle_irq, 0,
|
mtk_handle_irq, 0,
|
||||||
@@ -5056,6 +5280,11 @@ static int mtk_remove(struct platform_de
|
@@ -5055,6 +5280,11 @@ static int mtk_remove(struct platform_de
|
||||||
mtk_stop(eth->netdev[i]);
|
mtk_stop(eth->netdev[i]);
|
||||||
mac = netdev_priv(eth->netdev[i]);
|
mac = netdev_priv(eth->netdev[i]);
|
||||||
phylink_disconnect_phy(mac->phylink);
|
phylink_disconnect_phy(mac->phylink);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user