* [PATCH net-next 1/1] net: phy: dp83867: add TI PHY loopback
@ 2022-11-08 10:15 Michael Sit Wei Hong
2022-11-08 15:44 ` Andrew Lunn
2022-11-10 3:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Michael Sit Wei Hong @ 2022-11-08 10:15 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
Tan Tee Min
Cc: Looi Hong Aun, Voon Weifeng, Zulkifli Muhammad Husaini,
Gan Yi Fang
From: Tan Tee Min <tee.min.tan@linux.intel.com>
The existing genphy_loopback() is not working for TI DP83867 PHY as it
will disable autoneg support while another side is still enabling autoneg.
This is causing the link is not established and results in timeout error
in genphy_loopback() function.
Thus, based on TI PHY datasheet, introduce a TI PHY loopback function by
just configuring BMCR_LOOPBACK(Bit-9) in MII_BMCR register (0x0).
Tested working on TI DP83867 PHY for all speeds (10/100/1000Mbps).
Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
---
drivers/net/phy/dp83867.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 6939563d3b7c..350217a23b34 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -925,6 +925,12 @@ static void dp83867_link_change_notify(struct phy_device *phydev)
}
}
+static int dp83867_loopback(struct phy_device *phydev, bool enable)
+{
+ return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
+ enable ? BMCR_LOOPBACK : 0);
+}
+
static struct phy_driver dp83867_driver[] = {
{
.phy_id = DP83867_PHY_ID,
@@ -951,6 +957,7 @@ static struct phy_driver dp83867_driver[] = {
.resume = genphy_resume,
.link_change_notify = dp83867_link_change_notify,
+ .set_loopback = dp83867_loopback,
},
};
module_phy_driver(dp83867_driver);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/1] net: phy: dp83867: add TI PHY loopback
2022-11-08 10:15 [PATCH net-next 1/1] net: phy: dp83867: add TI PHY loopback Michael Sit Wei Hong
@ 2022-11-08 15:44 ` Andrew Lunn
2022-11-10 3:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-11-08 15:44 UTC (permalink / raw)
To: Michael Sit Wei Hong
Cc: Heiner Kallweit, Russell King, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, Tan Tee Min,
Looi Hong Aun, Voon Weifeng, Zulkifli Muhammad Husaini,
Gan Yi Fang
On Tue, Nov 08, 2022 at 06:15:27PM +0800, Michael Sit Wei Hong wrote:
> From: Tan Tee Min <tee.min.tan@linux.intel.com>
>
> The existing genphy_loopback() is not working for TI DP83867 PHY as it
> will disable autoneg support while another side is still enabling autoneg.
> This is causing the link is not established and results in timeout error
> in genphy_loopback() function.
>
> Thus, based on TI PHY datasheet, introduce a TI PHY loopback function by
> just configuring BMCR_LOOPBACK(Bit-9) in MII_BMCR register (0x0).
>
> Tested working on TI DP83867 PHY for all speeds (10/100/1000Mbps).
>
> Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/1] net: phy: dp83867: add TI PHY loopback
2022-11-08 10:15 [PATCH net-next 1/1] net: phy: dp83867: add TI PHY loopback Michael Sit Wei Hong
2022-11-08 15:44 ` Andrew Lunn
@ 2022-11-10 3:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-10 3:30 UTC (permalink / raw)
To: Michael Sit Wei Hong
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni, netdev,
linux-kernel, tee.min.tan, hong.aun.looi, weifeng.voon,
muhammad.husaini.zulkifli, yi.fang.gan
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 8 Nov 2022 18:15:27 +0800 you wrote:
> From: Tan Tee Min <tee.min.tan@linux.intel.com>
>
> The existing genphy_loopback() is not working for TI DP83867 PHY as it
> will disable autoneg support while another side is still enabling autoneg.
> This is causing the link is not established and results in timeout error
> in genphy_loopback() function.
>
> [...]
Here is the summary with links:
- [net-next,1/1] net: phy: dp83867: add TI PHY loopback
https://git.kernel.org/netdev/net-next/c/13bd85580b85
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:[~2022-11-10 3:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 10:15 [PATCH net-next 1/1] net: phy: dp83867: add TI PHY loopback Michael Sit Wei Hong
2022-11-08 15:44 ` Andrew Lunn
2022-11-10 3:30 ` 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