[Feature]Add ethernet sleep and wake through LPSD mode in GSW
Change-Id: Icc69861b54f4cad6eda2aa4e7bbe8bbfac0109bd
diff --git a/src/bsp/lk/platform/mt2735/drivers/gpio/mt_gpio.c b/src/bsp/lk/platform/mt2735/drivers/gpio/mt_gpio.c
index 9d10b89..b9c6773 100644
--- a/src/bsp/lk/platform/mt2735/drivers/gpio/mt_gpio.c
+++ b/src/bsp/lk/platform/mt2735/drivers/gpio/mt_gpio.c
@@ -896,6 +896,16 @@
//you.chen2022/4/8 modify for wifi gpio start
mt_set_gpio_out(GPIO202, GPIO_OUT_ONE);
//you.chen2022/4/8 modify for wifi gpio end
+ //xf.li2022/8/19 modify for phy gpio start
+ /* GPIO26 */
+ mt_set_gpio_mode(GPIO26, 0);
+ mt_set_gpio_dir(GPIO26, GPIO_DIR_OUT);
+ mt_set_gpio_out(GPIO26, GPIO_OUT_ONE);
+ /* GPIO07 */
+ mt_set_gpio_mode(GPIO7, 0);
+ mt_set_gpio_dir(GPIO7, GPIO_DIR_OUT);
+ mt_set_gpio_out(GPIO7, GPIO_OUT_ZERO);
+ //xf.li2022/8/19 modify for phy gpio end
}
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 54336d3..c847653 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
@@ -5,6 +5,10 @@
#include <linux/module.h>
#include <linux/phy.h>
#include <linux/of.h>
+//xf.li 2022/9/9 modify for LPSD mode start
+#include <linux/of_gpio.h>
+#include <linux/gpio/consumer.h>
+//xf.li 2022/9/9 modify for LPSD mode end
#include <linux/delay.h>
@@ -212,11 +216,29 @@
int q2220_suspend(struct phy_device *phydev)
{
- return phy_write(phydev, MII_ADDR_C45 | 0x038022, 0x1);
+ //xf.li 2022/9/9 modify for LPSD mode
+ printk("phy sleep start\n");
+ 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);
+
+ return 0;
+ //xf.li 2022/9/9 modify for LPSD mode
}
int q2220_resume(struct phy_device *phydev)
{
- return phy_write(phydev, MII_ADDR_C45 | 0x038022, 0x10);
+ //xf.li 2022/9/9 modify for LPSD mode
+ printk("phy awake start\n");
+ gpio_direction_output(7 + 268, 1);
+ udelay(1100);
+ gpio_direction_output(26 + 268, 1);
+ gpio_direction_output(7 + 268, 0);
+ q2110_config_init(phydev);
+ return 0;
+ //xf.li 2022/9/9 modify for LPSD mode
}