[Feature][T8TSK-154]add the ethernet patch for GSW
Change-Id: I9d3a07fd4059583ee407194694c5e469ff6d57b0
diff --git a/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c b/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c
index 5155af3..0f36430 100755
--- a/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c
+++ b/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c
@@ -41,6 +41,16 @@
/* Add delay on RX_CLK */
#define Q2110_RGMII_RX_TIMING_CTRL BIT(14)
+/* NAD_WAKEUP_PHY1 : GPIO7 */
+#define NAD_WAKEUP_PHY1 275
+/* NAD_RESET_PHY1 : GPIO26 */
+#define NAD_RESET_PHY1 294
+
+#define Q2220_LPSD_CTRL_1 (MII_ADDR_C45 | 0x038021)
+#define Q2220_LPSD_DISABLE_REMOTE_WAKE_UP BIT(15) | BIT(11)
+#define Q2220_LPSD_STATUS (MII_ADDR_C45 | 0x038020)
+#define Q2220_LPSD_POWER_DOWN BIT(0)
+
int if_suspend = 0;
/* Set and/or override some configuration registers based on the
@@ -220,14 +230,17 @@
{
//xf.li 2022/11/9 modify for API-647
printk("phy sleep start\n");
- gpio_direction_output(7 + 268, 0);
- mdelay(1);
- phy_write(phydev, MII_ADDR_C45 | 0x038022, 0x1);
- mdelay(10);
- printk("reg 038022 = %x\n", phy_read(phydev, (MII_ADDR_C45 | 0x038022)));
- phy_write(phydev, (MII_ADDR_C45 | 0x038020), 0x1);
- printk("reg 038020 = %x\n", phy_read(phydev, (MII_ADDR_C45 | 0x038020)));
- gpio_direction_output(26 + 268, 0);
+ gpio_direction_output(NAD_WAKEUP_PHY1, 0);
+ mdelay(1);//ensure do not wake up
+ //phy_write(phydev, MII_ADDR_C45 | 0x038022, 0x1);
+ phy_write(phydev, Q2220_LPSD_CTRL_1, Q2220_LPSD_DISABLE_REMOTE_WAKE_UP);
+ mdelay(10);//for enter T1 port sleep, need link parter respond
+ printk("reg 038021 = %x\n", phy_read(phydev, Q2220_LPSD_CTRL_1));
+ phy_write(phydev, Q2220_LPSD_STATUS, Q2220_LPSD_POWER_DOWN);// enter LPSD sleep mode
+ printk("reg 038020 = %x\n", phy_read(phydev, Q2220_LPSD_STATUS));
+ mdelay(50);
+ printk("reg 038020 = %x\n", phy_read(phydev, Q2220_LPSD_STATUS));
+ gpio_direction_output(NAD_RESET_PHY1, 0);
if_suspend = 1;
return 0;
//xf.li 2022/11/9 modify for API-647
@@ -238,10 +251,13 @@
if(if_suspend == 1)
{
printk("phy awake start\n");
- gpio_direction_output(7 + 268, 1);
+ gpio_direction_output(NAD_WAKEUP_PHY1, 1);
udelay(1100);
- gpio_direction_output(7 + 268, 0);
- gpio_direction_output(26 + 268, 1);
+ gpio_direction_output(NAD_WAKEUP_PHY1, 0);
+ mdelay(1);
+ gpio_direction_output(NAD_RESET_PHY1, 1);
+ mdelay(10);//at lest 4ms for reset phy
+ q2110_config_init(phydev);
if_suspend = 0;
}
else