[Feature][T108] [task-view-1620] modify the mac address, optimize the phy initialization process.
Only Configure: No
Affected branch: GSW_V1453
Affected module: mac phy
Self-test: yes
Doc Update: no
Change-Id: I28aa0a0eba15f7db42de6847405bb5dbccafd37b
diff --git a/marvell/linux/drivers/net/phy/realtek.c b/marvell/linux/drivers/net/phy/realtek.c
index d1de801..339bb78 100755
--- a/marvell/linux/drivers/net/phy/realtek.c
+++ b/marvell/linux/drivers/net/phy/realtek.c
@@ -989,7 +989,51 @@
return 0;
}
+//#LYNQ_MODFIY modify for task-1618 2025/7/7 start
+static void RTL9000Bx_xMII_driving_strength(struct phy_device *phydev)
+{
+ // Typical_xMII_1V8
+ phy_write(phydev, 0x1B, 0xD414);
+ phy_write(phydev, 0x1C, 0x0201);
+
+ phy_write(phydev, 0x1B, 0xD416);
+ phy_write(phydev, 0x1C, 0x0101);
+
+ phy_write(phydev, 0x1B, 0xD418);
+ phy_write(phydev, 0x1C, 0x0200);
+
+ phy_write(phydev, 0x1B, 0xD41A);
+ phy_write(phydev, 0x1C, 0x0100);
+
+ phy_write(phydev, 0x1B, 0xD42E);
+ phy_write(phydev, 0x1C, 0xC8C8);
+
+}
+
+static s16 RTL9000Bx_Soft_Reset(struct phy_device *phydev)
+{
+ u16 reg_data = 0;
+ u32 timer = 2000; // set a 2ms timer
+
+ phy_write(phydev, 0, 0x8000); // PHY soft-reset
+
+ do
+ { // Check soft-reset complete
+
+ reg_data = phy_read(phydev, 0);
+ if (reg_data == 0xFFFF)
+ return -1;
+ timer--;
+ if (timer == 0)
+ {
+ return -1;
+ }
+ } while (reg_data != 0x2100);
+
+ return 0;
+}
+//#LYNQ_MODFIY modify for task-1618 2025/7/7 end
//#LYNQ_MODFIY modify for task-1618 2025/6/19 satrt
static int rtl9000Bf_power_set(int gpio, int power_en)
{
@@ -1102,6 +1146,8 @@
ret = -1;
goto err;
}
+ //#LYNQ_MODFIY modify for task-1618 2025/7/7 start
+ RTL9000Bx_xMII_driving_strength(phydev);
/* I/O Power Sllection */
//change page to default value
@@ -1112,6 +1158,12 @@
phy_write(phydev, 0x12, mdio_data);
printk(KERN_INFO "phy_info: set rgmii driving strengths is 1.8v \n");
+ ret = RTL9000Bx_Soft_Reset(phydev);
+ if(0 != ret) {
+ goto err;
+ }
+ printk(KERN_INFO "phy_info: phy soft-reset over \n");
+ //#LYNQ_MODFIY modify for task-1618 2025/7/7 end
phydev->autoneg = AUTONEG_DISABLE;
phydev->duplex = DUPLEX_FULL;