On 10/16/2023 7:12 AM, Oleksij Rempel wrote:
Add WoL support for KSZ9477 family of switches. This code was tested on KSZ8563 chip. KSZ9477 family of switches supports multiple PHY events: - wake on Link Up - wake on Energy Detect. Since current UAPI can't differentiate between this PHY events, map all of them to WAKE_PHY. Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> ---
[snip]
+void ksz9477_get_wol(struct ksz_device *dev, int port, + struct ethtool_wolinfo *wol) +{ + u8 pme_ctrl, pme_conf; + int ret; + + ret = ksz_read8(dev, REG_SW_PME_CTRL, &pme_conf); + if (ret) + return; + + if (!(pme_conf & PME_ENABLE)) + return;
I suppose this works beause you have separate enable bits for WOL_LINKUP, WOL_ENERGY and WOL_MAGICPKT, you could have also left the setting of the PME_ENABLE bit to the set_wol() routine provided that wol->wolopts is non-zero.
Reviewed-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx> -- Florian