[BugFix][T106BUG-327][ETH]Troubleshooting NIC setup loopback after phy hot-plug keeps appearing
Only Configure:No
Affected branch:master
Affected module:ETH
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update:No
Change-Id: I5cbcc64c16728bb8d2d71764ef8c241d06d70641
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c
index dedebc3..223c6d3 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jl3xxx.c
@@ -15,7 +15,7 @@
#include <linux/phy.h>
#include <linux/module.h>
#include <linux/gmac/gmac.h>
-#include "jl.h"
+#include "jlsemi/jl.h"
#define DBG(fmt, ...) printk("xxx: "fmt, ##__VA_ARGS__)
@@ -285,13 +285,12 @@
phydev->asym_pause = 0;
if ((i % 5 == 0) && debug_on) {
- printk("[%s] link:%d\n", __func__, phydev->link);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x3);
- mdiobus_write(phydev->mdio.bus, 7, 0x0e, 0x8000);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x4000 | 0x3);
- printk("[%s] rmii config:0x%x\n", __func__, mdiobus_read(phydev->mdio.bus, 7, 0x0e));
-
- }
+ printk("[%s] link:%d\n", __func__, phydev->link);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x3);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, 0x8000);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x4000 | 0x3);
+ printk("[%s] cy rmii config:0x%x\n", __func__, mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, 0x0e));
+ }
i++;
return 0;
@@ -300,17 +299,17 @@
static int jl3_config_init(struct phy_device *phydev)
{
DBG("%s(), an:= %d, if:= %d\n", __func__, phydev->autoneg, phydev->interface);
- printk("[%s] addr:%d\n", __func__, phydev->mdio.addr);
+ printk("[%s] cy-addr:%d\n", __func__, phydev->mdio.addr);
// jl3113_config_init(phydev, ROLE, SPEED_1000);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x3);
- mdiobus_write(phydev->mdio.bus, 7, 0x0e, 0x8000);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x4000 | 0x3);
- mdiobus_write(phydev->mdio.bus, 7, 0x0e, 0x46);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x3);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, 0x8000);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x4000 | 0x3);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, 0x46);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x1);
- mdiobus_write(phydev->mdio.bus, 7, 0x0e, 0x0000);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x4000 | 0x1);
- mdiobus_write(phydev->mdio.bus, 7, 0x0e, 0xA000);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x1);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, 0x0000);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x4000 | 0x1);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, 0xA000);
return 0;
}
@@ -334,15 +333,11 @@
if(islink == 1)
new_phy_status = 1;
- if((org_phy_status == 0)&&(new_phy_status == 1)) {
- wt(phydev, 0x3, 0x8000, 0x46);
- wt(phydev, 0x1, 0x0000, 0xA000);
- gmac_event_notify(GMAC_ETH_PHY_PLUGIN, NULL);
- }
-
+ if((org_phy_status == 0)&&(new_phy_status == 1))
+ gmac_event_notify(GMAC_ETH_PHY_PLUGIN, NULL);
if((org_phy_status == 1)&&(new_phy_status == 0))
- gmac_event_notify(GMAC_ETH_PHY_PLUGOUT, NULL);
+ gmac_event_notify(GMAC_ETH_PHY_PLUGOUT, NULL);
return err;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jlsemi/jlapi.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jlsemi/jlapi.c
index 9fcd250..1da6846 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jlsemi/jlapi.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/jlsemi/jlsemi/jlapi.c
@@ -152,12 +152,11 @@
{
int tmp = 0;
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x1);
- mdiobus_write(phydev->mdio.bus, 7, 0x0e, 1);
- mdiobus_write(phydev->mdio.bus, 7, 0x0d, 0x4000 | 0x1);
- tmp = mdiobus_read(phydev->mdio.bus, 7, 0x0e);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x1);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, 1);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x4000 | 0x1);
+ tmp = mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, 0x0e);
return !!(tmp & BIT2 );
-
}
void jl3113_config_init(struct phy_device *phydev, jl_role role, int speed/*SPEED_100*/)