mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: marvell: Add mdix status reporting
@ 2024-10-17  1:50 Paul Davey
  2024-10-18 17:14 ` Andrew Lunn
  2024-10-22 11:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Davey @ 2024-10-17  1:50 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, linux-kernel, Paul Davey

Report MDI-X resolved state after link up.

Tested on Linkstreet 88E6193X internal PHYs.

Signed-off-by: Paul Davey <paul.davey@alliedtelesis.co.nz>
---
 drivers/net/phy/marvell.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 9964bf3dea2f..28aec37acd2c 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -176,6 +176,7 @@
 #define MII_M1011_PHY_STATUS_FULLDUPLEX	0x2000
 #define MII_M1011_PHY_STATUS_RESOLVED	0x0800
 #define MII_M1011_PHY_STATUS_LINK	0x0400
+#define MII_M1011_PHY_STATUS_MDIX	BIT(6)
 
 #define MII_88E3016_PHY_SPEC_CTRL	0x10
 #define MII_88E3016_DISABLE_SCRAMBLER	0x0200
@@ -1722,6 +1723,19 @@ static int marvell_read_status_page(struct phy_device *phydev, int page)
 	phydev->duplex = DUPLEX_UNKNOWN;
 	phydev->port = fiber ? PORT_FIBRE : PORT_TP;
 
+	if (fiber) {
+		phydev->mdix = ETH_TP_MDI_INVALID;
+	} else {
+		/* The MDI-X state is set regardless of Autoneg being enabled
+		 * and reflects forced MDI-X state as well as auto resolution
+		 */
+		if (status & MII_M1011_PHY_STATUS_RESOLVED)
+			phydev->mdix = status & MII_M1011_PHY_STATUS_MDIX ?
+				ETH_TP_MDI_X : ETH_TP_MDI;
+		else
+			phydev->mdix = ETH_TP_MDI_INVALID;
+	}
+
 	if (phydev->autoneg == AUTONEG_ENABLE)
 		err = marvell_read_status_page_an(phydev, fiber, status);
 	else
-- 
2.47.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: marvell: Add mdix status reporting
  2024-10-17  1:50 [PATCH net-next] net: phy: marvell: Add mdix status reporting Paul Davey
@ 2024-10-18 17:14 ` Andrew Lunn
  2024-10-22 11:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2024-10-18 17:14 UTC (permalink / raw)
  To: Paul Davey; +Cc: netdev, linux-kernel

On Thu, Oct 17, 2024 at 02:50:25PM +1300, Paul Davey wrote:
> Report MDI-X resolved state after link up.
> 
> Tested on Linkstreet 88E6193X internal PHYs.
> 
> Signed-off-by: Paul Davey <paul.davey@alliedtelesis.co.nz>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: marvell: Add mdix status reporting
  2024-10-17  1:50 [PATCH net-next] net: phy: marvell: Add mdix status reporting Paul Davey
  2024-10-18 17:14 ` Andrew Lunn
@ 2024-10-22 11:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-22 11:10 UTC (permalink / raw)
  To: Paul Davey; +Cc: andrew, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Thu, 17 Oct 2024 14:50:25 +1300 you wrote:
> Report MDI-X resolved state after link up.
> 
> Tested on Linkstreet 88E6193X internal PHYs.
> 
> Signed-off-by: Paul Davey <paul.davey@alliedtelesis.co.nz>
> ---
>  drivers/net/phy/marvell.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)

Here is the summary with links:
  - [net-next] net: phy: marvell: Add mdix status reporting
    https://git.kernel.org/netdev/net-next/c/c797cb9c0988

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-22 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-17  1:50 [PATCH net-next] net: phy: marvell: Add mdix status reporting Paul Davey
2024-10-18 17:14 ` Andrew Lunn
2024-10-22 11:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®