* [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue
@ 2024-07-25 7:11 Raju Lakkaraju
2024-07-30 15:56 ` Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Raju Lakkaraju @ 2024-07-25 7:11 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, andrew, hkallweit1, linux, edumazet, pabeni,
horatiu.vultur, linux-kernel, stable, UNGLinuxDriver
The MDIX status is not accurately reflecting the current state after the link
partner has manually altered its MDIX configuration while operating in forced
mode.
Access information about Auto mdix completion and pair selection from the
KSZ9131's Auto/MDI/MDI-X status register
Fixes: b64e6a8794d9 ("net: phy: micrel: Add PHY Auto/MDI/MDI-X set driver for KSZ9131")
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
---
drivers/net/phy/micrel.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index dd519805deee..65b0a3115e14 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1389,6 +1389,8 @@ static int ksz9131_config_init(struct phy_device *phydev)
const struct device *dev_walker;
int ret;
+ phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
+
dev_walker = &phydev->mdio.dev;
do {
of_node = dev_walker->of_node;
@@ -1438,28 +1440,30 @@ static int ksz9131_config_init(struct phy_device *phydev)
#define MII_KSZ9131_AUTO_MDIX 0x1C
#define MII_KSZ9131_AUTO_MDI_SET BIT(7)
#define MII_KSZ9131_AUTO_MDIX_SWAP_OFF BIT(6)
+#define MII_KSZ9131_DIG_AXAN_STS 0x14
+#define MII_KSZ9131_DIG_AXAN_STS_LINK_DET BIT(14)
+#define MII_KSZ9131_DIG_AXAN_STS_A_SELECT BIT(12)
static int ksz9131_mdix_update(struct phy_device *phydev)
{
int ret;
- ret = phy_read(phydev, MII_KSZ9131_AUTO_MDIX);
- if (ret < 0)
- return ret;
-
- if (ret & MII_KSZ9131_AUTO_MDIX_SWAP_OFF) {
- if (ret & MII_KSZ9131_AUTO_MDI_SET)
- phydev->mdix_ctrl = ETH_TP_MDI;
- else
- phydev->mdix_ctrl = ETH_TP_MDI_X;
+ if (phydev->mdix_ctrl != ETH_TP_MDI_AUTO) {
+ phydev->mdix = phydev->mdix_ctrl;
} else {
- phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
- }
+ ret = phy_read(phydev, MII_KSZ9131_DIG_AXAN_STS);
+ if (ret < 0)
+ return ret;
- if (ret & MII_KSZ9131_AUTO_MDI_SET)
- phydev->mdix = ETH_TP_MDI;
- else
- phydev->mdix = ETH_TP_MDI_X;
+ if (ret & MII_KSZ9131_DIG_AXAN_STS_LINK_DET) {
+ if (ret & MII_KSZ9131_DIG_AXAN_STS_A_SELECT)
+ phydev->mdix = ETH_TP_MDI;
+ else
+ phydev->mdix = ETH_TP_MDI_X;
+ } else {
+ phydev->mdix = ETH_TP_MDI_INVALID;
+ }
+ }
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue
2024-07-25 7:11 [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue Raju Lakkaraju
@ 2024-07-30 15:56 ` Jakub Kicinski
2024-07-30 20:06 ` Andrew Lunn
2024-07-30 22:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2024-07-30 15:56 UTC (permalink / raw)
To: andrew, hkallweit1, linux
Cc: Raju Lakkaraju, netdev, davem, edumazet, pabeni, horatiu.vultur,
linux-kernel, stable, UNGLinuxDriver
On Thu, 25 Jul 2024 12:41:25 +0530 Raju Lakkaraju wrote:
> The MDIX status is not accurately reflecting the current state after the link
> partner has manually altered its MDIX configuration while operating in forced
> mode.
>
> Access information about Auto mdix completion and pair selection from the
> KSZ9131's Auto/MDI/MDI-X status register
>
> Fixes: b64e6a8794d9 ("net: phy: micrel: Add PHY Auto/MDI/MDI-X set driver for KSZ9131")
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
LGTM, can we get an ack from PHY maintainers?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue
2024-07-25 7:11 [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue Raju Lakkaraju
2024-07-30 15:56 ` Jakub Kicinski
@ 2024-07-30 20:06 ` Andrew Lunn
2024-07-30 22:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2024-07-30 20:06 UTC (permalink / raw)
To: Raju Lakkaraju
Cc: netdev, davem, kuba, hkallweit1, linux, edumazet, pabeni,
horatiu.vultur, linux-kernel, stable, UNGLinuxDriver
On Thu, Jul 25, 2024 at 12:41:25PM +0530, Raju Lakkaraju wrote:
> The MDIX status is not accurately reflecting the current state after the link
> partner has manually altered its MDIX configuration while operating in forced
> mode.
>
> Access information about Auto mdix completion and pair selection from the
> KSZ9131's Auto/MDI/MDI-X status register
>
> Fixes: b64e6a8794d9 ("net: phy: micrel: Add PHY Auto/MDI/MDI-X set driver for KSZ9131")
> Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue
2024-07-25 7:11 [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue Raju Lakkaraju
2024-07-30 15:56 ` Jakub Kicinski
2024-07-30 20:06 ` Andrew Lunn
@ 2024-07-30 22:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-30 22:20 UTC (permalink / raw)
To: Raju Lakkaraju
Cc: netdev, davem, kuba, andrew, hkallweit1, linux, edumazet, pabeni,
horatiu.vultur, linux-kernel, stable, UNGLinuxDriver
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 25 Jul 2024 12:41:25 +0530 you wrote:
> The MDIX status is not accurately reflecting the current state after the link
> partner has manually altered its MDIX configuration while operating in forced
> mode.
>
> Access information about Auto mdix completion and pair selection from the
> KSZ9131's Auto/MDI/MDI-X status register
>
> [...]
Here is the summary with links:
- [net,V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue
https://git.kernel.org/netdev/net/c/84383b5ef4cd
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] 4+ messages in thread
end of thread, other threads:[~2024-07-30 22:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 7:11 [PATCH net V1] net: phy: micrel: Fix the KSZ9131 MDI-X status issue Raju Lakkaraju
2024-07-30 15:56 ` Jakub Kicinski
2024-07-30 20:06 ` Andrew Lunn
2024-07-30 22:20 ` 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;
as well as URLs for NNTP newsgroup(s).