mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 10:35:53 +02:00
kernel: add patches for SFP support on NXP Layerscape/DPAA2 (arm64)
These two patches are needed to support SFP's on NXP DPAA2 platforms (e.g Traverse Ten64). The deadlock issue patch was submitted upstream a while ago and rejected, however I am not aware of any better solutions at present. The 10G mode additions are part of mainline since 5.16. These two .patches were sourced from our patchset over here: https://gitlab.com/traversetech/traverse-kernel-patches/-/tree/lts-5-15/patches Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Peter Müller
parent
8399123461
commit
e77ef36395
@@ -153,6 +153,9 @@ endif
|
||||
ifeq "$(BUILD_ARCH)" "aarch64"
|
||||
# Apply Arm-multiarch kernel patches.
|
||||
cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
|
||||
# Apply NXP DPAA2 specific patches
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.15-arm64-dpaa2-fix-lock-issue.patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5-15-arm64-dpaa2-add-support-for-10g-modes.patch
|
||||
endif
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From c314138bd045e050432158ab021160de3ba51c5e Mon Sep 17 00:00:00 2001
|
||||
From: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
Date: Thu, 30 Jan 2020 22:42:38 +0000
|
||||
Subject: [PATCH 2/4] net: dpaa2-mac: add support for more 10G modes
|
||||
|
||||
Phylink documentation says:
|
||||
* Note that the PHY may be able to transform from one connection
|
||||
* technology to another, so, eg, don't clear 1000BaseX just
|
||||
* because the MAC is unable to BaseX mode. This is more about
|
||||
* clearing unsupported speeds and duplex settings. The port modes
|
||||
* should not be cleared; phylink_set_port_modes() will help with this.
|
||||
|
||||
So add the missing 10G modes.
|
||||
|
||||
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
index 8fe32ed4f6dc..3be849cee47b 100644
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
@@ -140,6 +140,12 @@ static void dpaa2_mac_validate(struct phylink_config *config,
|
||||
case PHY_INTERFACE_MODE_10GBASER:
|
||||
case PHY_INTERFACE_MODE_USXGMII:
|
||||
phylink_set(mask, 10000baseT_Full);
|
||||
+ phylink_set(mask, 10000baseKR_Full);
|
||||
+ phylink_set(mask, 10000baseCR_Full);
|
||||
+ phylink_set(mask, 10000baseSR_Full);
|
||||
+ phylink_set(mask, 10000baseLR_Full);
|
||||
+ phylink_set(mask, 10000baseLRM_Full);
|
||||
+ phylink_set(mask, 10000baseER_Full);
|
||||
if (state->interface == PHY_INTERFACE_MODE_10GBASER)
|
||||
break;
|
||||
phylink_set(mask, 5000baseT_Full);
|
||||
--
|
||||
2.30.1
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
From 3a39dbe0c0c41f8dba5246ce6e2c5c4bcd6ba661 Mon Sep 17 00:00:00 2001
|
||||
From: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Date: Thu, 21 Nov 2019 21:15:25 +0200
|
||||
Subject: [PATCH 1/4] dpaa2-eth: do not hold rtnl_lock on phylink_create() or
|
||||
_destroy()
|
||||
|
||||
The rtnl_lock should not be held when calling phylink_create() or
|
||||
phylink_destroy() since it leads to the deadlock listed below:
|
||||
|
||||
[ 18.656576] rtnl_lock+0x18/0x20
|
||||
[ 18.659798] sfp_bus_add_upstream+0x28/0x90
|
||||
[ 18.663974] phylink_create+0x2cc/0x828
|
||||
[ 18.667803] dpaa2_mac_connect+0x14c/0x2a8
|
||||
[ 18.671890] dpaa2_eth_connect_mac+0x94/0xd8
|
||||
|
||||
Fix this by moving the _lock() and _unlock() calls just outside of
|
||||
phylink_of_phy_connect() and phylink_disconnect_phy().
|
||||
|
||||
Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
|
||||
Reported-by: Russell King <linux@armlinux.org.uk>
|
||||
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ----
|
||||
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 4 ++++
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
index 8b7a29e1e221..20e65053f036 100644
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
||||
@@ -4214,12 +4214,10 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg)
|
||||
dpaa2_eth_set_mac_addr(netdev_priv(net_dev));
|
||||
dpaa2_eth_update_tx_fqids(priv);
|
||||
|
||||
- rtnl_lock();
|
||||
if (dpaa2_eth_has_mac(priv))
|
||||
dpaa2_eth_disconnect_mac(priv);
|
||||
else
|
||||
dpaa2_eth_connect_mac(priv);
|
||||
- rtnl_unlock();
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
@@ -4513,9 +4511,7 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
|
||||
#endif
|
||||
|
||||
unregister_netdev(net_dev);
|
||||
- rtnl_lock();
|
||||
dpaa2_eth_disconnect_mac(priv);
|
||||
- rtnl_unlock();
|
||||
|
||||
dpaa2_eth_dl_port_del(priv);
|
||||
dpaa2_eth_dl_traps_unregister(priv);
|
||||
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
index ae6d382d8735..8fe32ed4f6dc 100644
|
||||
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
||||
@@ -351,7 +351,9 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
|
||||
if (mac->pcs)
|
||||
phylink_set_pcs(mac->phylink, &mac->pcs->pcs);
|
||||
|
||||
+ rtnl_lock();
|
||||
err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0);
|
||||
+ rtnl_unlock();
|
||||
if (err) {
|
||||
netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err);
|
||||
goto err_phylink_destroy;
|
||||
@@ -372,7 +374,9 @@ void dpaa2_mac_disconnect(struct dpaa2_mac *mac)
|
||||
if (!mac->phylink)
|
||||
return;
|
||||
|
||||
+ rtnl_lock();
|
||||
phylink_disconnect_phy(mac->phylink);
|
||||
+ rtnl_unlock();
|
||||
phylink_destroy(mac->phylink);
|
||||
dpaa2_pcs_destroy(mac);
|
||||
}
|
||||
--
|
||||
2.30.1
|
||||
|
||||
Reference in New Issue
Block a user