mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 17:01:14 +00:00
c2c741ccce
Initial backport of at803x PHY driver cleanup. This is in preparation for split and addition of new PHY Family based on at803x needed for ipq807x and other IPQ Series SoC. Other affected patch are automatically refreshed with make target/linux/refresh Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
93 lines
2.9 KiB
Diff
93 lines
2.9 KiB
Diff
From 27b89c9dc1b0393090d68d651b82f30ad2696baa Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Fri, 8 Dec 2023 15:51:55 +0100
|
|
Subject: [PATCH 08/13] net: phy: at803x: move specific at8031 WOL bits to
|
|
dedicated function
|
|
|
|
Move specific at8031 WOL enable/disable to dedicated function to make
|
|
at803x_set_wol more generic.
|
|
|
|
This is needed in preparation for PHY driver split as qca8081 share the
|
|
same function to toggle WOL settings.
|
|
|
|
In this new implementation WOL module in at8031 is enabled after the
|
|
generic interrupt is setup. This should not cause any problem as the
|
|
WOL_INT has a separate implementation and only relay on MAC bits.
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
drivers/net/phy/at803x.c | 42 ++++++++++++++++++++++++----------------
|
|
1 file changed, 25 insertions(+), 17 deletions(-)
|
|
|
|
--- a/drivers/net/phy/at803x.c
|
|
+++ b/drivers/net/phy/at803x.c
|
|
@@ -466,27 +466,11 @@ static int at803x_set_wol(struct phy_dev
|
|
phy_write_mmd(phydev, MDIO_MMD_PCS, offsets[i],
|
|
mac[(i * 2) + 1] | (mac[(i * 2)] << 8));
|
|
|
|
- /* Enable WOL function for 1588 */
|
|
- if (phydev->drv->phy_id == ATH8031_PHY_ID) {
|
|
- ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
|
|
- AT803X_PHY_MMD3_WOL_CTRL,
|
|
- 0, AT803X_WOL_EN);
|
|
- if (ret)
|
|
- return ret;
|
|
- }
|
|
/* Enable WOL interrupt */
|
|
ret = phy_modify(phydev, AT803X_INTR_ENABLE, 0, AT803X_INTR_ENABLE_WOL);
|
|
if (ret)
|
|
return ret;
|
|
} else {
|
|
- /* Disable WoL function for 1588 */
|
|
- if (phydev->drv->phy_id == ATH8031_PHY_ID) {
|
|
- ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
|
|
- AT803X_PHY_MMD3_WOL_CTRL,
|
|
- AT803X_WOL_EN, 0);
|
|
- if (ret)
|
|
- return ret;
|
|
- }
|
|
/* Disable WOL interrupt */
|
|
ret = phy_modify(phydev, AT803X_INTR_ENABLE, AT803X_INTR_ENABLE_WOL, 0);
|
|
if (ret)
|
|
@@ -1609,6 +1593,30 @@ static int at8031_config_init(struct phy
|
|
return at803x_config_init(phydev);
|
|
}
|
|
|
|
+static int at8031_set_wol(struct phy_device *phydev,
|
|
+ struct ethtool_wolinfo *wol)
|
|
+{
|
|
+ int ret;
|
|
+
|
|
+ /* First setup MAC address and enable WOL interrupt */
|
|
+ ret = at803x_set_wol(phydev, wol);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ if (wol->wolopts & WAKE_MAGIC)
|
|
+ /* Enable WOL function for 1588 */
|
|
+ ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
|
|
+ AT803X_PHY_MMD3_WOL_CTRL,
|
|
+ 0, AT803X_WOL_EN);
|
|
+ else
|
|
+ /* Disable WoL function for 1588 */
|
|
+ ret = phy_modify_mmd(phydev, MDIO_MMD_PCS,
|
|
+ AT803X_PHY_MMD3_WOL_CTRL,
|
|
+ AT803X_WOL_EN, 0);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
static int qca83xx_config_init(struct phy_device *phydev)
|
|
{
|
|
u8 switch_revision;
|
|
@@ -2121,7 +2129,7 @@ static struct phy_driver at803x_driver[]
|
|
.config_init = at8031_config_init,
|
|
.config_aneg = at803x_config_aneg,
|
|
.soft_reset = genphy_soft_reset,
|
|
- .set_wol = at803x_set_wol,
|
|
+ .set_wol = at8031_set_wol,
|
|
.get_wol = at803x_get_wol,
|
|
.suspend = at803x_suspend,
|
|
.resume = at803x_resume,
|