This is an automatically generated commit which aids following Kernel patch history, as git will see the move and copy as a rename thus defeating the purpose. For the original discussion see: https://lists.openwrt.org/pipermail/openwrt-devel/2023-October/041673.html Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de> Link: https://github.com/openwrt/openwrt/pull/24031 Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
56 lines
2.5 KiB
Diff
56 lines
2.5 KiB
Diff
From ca732e990fc8222a2d6782ae750304719e212fe8 Mon Sep 17 00:00:00 2001
|
|
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
|
Date: Thu, 1 May 2025 12:45:11 +0100
|
|
Subject: [PATCH] net: stmmac: add get_interfaces() platform method
|
|
|
|
Add a get_interfaces() platform method to allow platforms to indicate
|
|
to phylink which interface modes they support - which then allows
|
|
phylink to validate on initialisation that the configured PHY interface
|
|
mode is actually supported.
|
|
|
|
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
|
Link: https://patch.msgid.link/E1uASLn-0021Qd-Mi@rmk-PC.armlinux.org.uk
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 +++++++++++++---
|
|
include/linux/stmmac.h | 2 ++
|
|
2 files changed, 15 insertions(+), 3 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
@@ -1250,10 +1250,21 @@ static int stmmac_phy_setup(struct stmma
|
|
priv->phylink_config.default_an_inband =
|
|
mdio_bus_data->default_an_inband;
|
|
|
|
- /* Set the platform/firmware specified interface mode. Note, phylink
|
|
- * deals with the PHY interface mode, not the MAC interface mode.
|
|
+ /* Get the PHY interface modes (at the PHY end of the link) that
|
|
+ * are supported by the platform.
|
|
*/
|
|
- __set_bit(mode, priv->phylink_config.supported_interfaces);
|
|
+ if (priv->plat->get_interfaces)
|
|
+ priv->plat->get_interfaces(priv, priv->plat->bsp_priv,
|
|
+ priv->phylink_config.supported_interfaces);
|
|
+
|
|
+ /* Set the platform/firmware specified interface mode if the
|
|
+ * supported interfaces have not already been provided using
|
|
+ * phy_interface as a last resort.
|
|
+ */
|
|
+ if (phy_interface_empty(priv->phylink_config.supported_interfaces))
|
|
+ __set_bit(priv->plat->phy_interface,
|
|
+ priv->phylink_config.supported_interfaces);
|
|
+
|
|
|
|
/* If we have an xpcs, it defines which PHY interfaces are supported. */
|
|
if (priv->hw->xpcs)
|
|
--- a/include/linux/stmmac.h
|
|
+++ b/include/linux/stmmac.h
|
|
@@ -229,6 +229,8 @@ struct plat_stmmacenet_data {
|
|
u8 tx_sched_algorithm;
|
|
struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
|
|
struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES];
|
|
+ void (*get_interfaces)(struct stmmac_priv *priv, void *bsp_priv,
|
|
+ unsigned long *interfaces);
|
|
void (*fix_mac_speed)(void *priv, unsigned int speed, unsigned int mode);
|
|
int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
|
|
int (*serdes_powerup)(struct net_device *ndev, void *priv);
|