[PATCH] net: phy: marvell10g: Fix PHY mode bitmap handling
Marek Vasut
marek.vasut+renesas at mailbox.org
Thu Jan 1 17:51:44 CET 2026
Replace PHY interface mode bitmap handling with comparison test to match
U-Boot PHY subsystem behavior. U-Boot currently implements only single PHY
interface mode for each PHY. Linux currently uses bitmap of PHY interface
modes for each PHY.
The reason why in Linux uses bitmap of supported interface modes is so
that Linux can select the best serdes mode switching behavior for the PHY.
For example if the host only supports 10gbase-r serdes mode, then the PHY
must always talk to the host in 10gbase-r mode, even if the RJ-45 copper
speed was autonegotiated to lower speed (i.e. 1Gbps).
If the host supports both 10gbase-r and sgmii serdes modes, we want the
PHY to switch to sgmii if the RJ-45 speed is 1000/100/10, and to switch
to 10gbase-r if the RJ-45 speed is 10000.
U-Boot does not implement this functionality yet, therefore remove modes
which cannot be currently supported and switch mv_test_bit() to plain
mode comparison.
Fixes: b6fcab0728cb ("net: phy: marvell10g: Adapt Marvell 10G PHY driver from Linux")
Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
This is a follow up to this discussion thread:
https://lore.kernel.org/u-boot/bxuuwcj7jm33go7yj4jnafoowrttu2qvbxej7nvdn3pm5az4sj@6xpf3ym2s2ek/
Large chunk of the commit message is also adapted from the
aforementioned thread and explanation from Marek Behun, which
is excellent.
---
Cc: Jerome Forissier <jerome.forissier at linaro.org>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Marek Behun <kabel at kernel.org>
Cc: Ramon Fried <rfried.dev at gmail.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
drivers/net/phy/marvell10g.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 8c95bcbb9ad..d6115eea025 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -342,8 +342,7 @@ static int mv2110_select_mactype(struct phy_device *phydev)
{
if (phydev->interface == PHY_INTERFACE_MODE_USXGMII)
return MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII;
- else if (phydev->interface == PHY_INTERFACE_MODE_SGMII &&
- !(phydev->interface == PHY_INTERFACE_MODE_10GBASER))
+ else if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
return MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER;
else if (phydev->interface == PHY_INTERFACE_MODE_10GBASER)
return MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH;
@@ -381,15 +380,6 @@ static int mv3310_select_mactype(struct phy_device *phydev)
{
if (phydev->interface == PHY_INTERFACE_MODE_USXGMII)
return MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII;
- else if (phydev->interface == PHY_INTERFACE_MODE_SGMII &&
- phydev->interface == PHY_INTERFACE_MODE_10GBASER)
- return MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER;
- else if (phydev->interface == PHY_INTERFACE_MODE_SGMII &&
- phydev->interface == PHY_INTERFACE_MODE_RXAUI)
- return MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI;
- else if (phydev->interface == PHY_INTERFACE_MODE_SGMII &&
- phydev->interface == PHY_INTERFACE_MODE_XAUI)
- return MV_V2_3310_PORT_CTRL_MACTYPE_XAUI;
else if (phydev->interface == PHY_INTERFACE_MODE_10GBASER)
return MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH;
else if (phydev->interface == PHY_INTERFACE_MODE_RXAUI)
@@ -542,7 +532,7 @@ static bool mv3310_has_downshift(struct phy_device *phydev)
}
#define mv_test_bit(iface, phydev) \
- ({ if ((phydev)->interface & (iface)) return 0; })
+ ({ if ((phydev)->interface == (iface)) return 0; })
static int mv3310_mv3340_test_supported_interfaces(struct phy_device *phydev)
{
--
2.51.0
More information about the U-Boot
mailing list