[PATCH 2/4] net: stmmac: dwmac-mediatek: Handle non-inverted mediatek,mac-wol

Nícolas F. R. A. Prado nfraprado at collabora.com
Fri Nov 1 08:20:24 PDT 2024


Parse the newly introduced mediatek,mac-wol-noninverted DT property and
use it to determine how the mediatek,mac-wol property should be
interpreted for enabling the MAC WOL or the PHY WOL.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
index f8ca81675407ade786f2b9a38c63511a0b7fb705..f3255b84195389d73c6f6542f51f962b87a5cb4e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
@@ -85,6 +85,7 @@ struct mediatek_dwmac_plat_data {
 	bool rmii_clk_from_mac;
 	bool rmii_rxc;
 	bool mac_wol;
+	bool mac_wol_noninverted;
 };
 
 struct mediatek_dwmac_variant {
@@ -493,6 +494,7 @@ static int mediatek_dwmac_config_dt(struct mediatek_dwmac_plat_data *plat)
 	plat->rmii_rxc = of_property_read_bool(plat->np, "mediatek,rmii-rxc");
 	plat->rmii_clk_from_mac = of_property_read_bool(plat->np, "mediatek,rmii-clk-from-mac");
 	plat->mac_wol = of_property_read_bool(plat->np, "mediatek,mac-wol");
+	plat->mac_wol_noninverted = of_property_read_bool(plat->np, "mediatek,mac-wol-noninverted");
 
 	return 0;
 }
@@ -588,10 +590,11 @@ static int mediatek_dwmac_common_data(struct platform_device *pdev,
 	int i;
 
 	plat->mac_interface = priv_plat->phy_mode;
-	if (priv_plat->mac_wol)
-		plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
-	else
+	if ((priv_plat->mac_wol_noninverted && priv_plat->mac_wol) ||
+	    (!priv_plat->mac_wol_noninverted && !priv_plat->mac_wol))
 		plat->flags &= ~STMMAC_FLAG_USE_PHY_WOL;
+	else
+		plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
 	plat->riwt_off = 1;
 	plat->maxmtu = ETH_DATA_LEN;
 	plat->host_dma_width = priv_plat->variant->dma_bit_mask;

-- 
2.47.0




More information about the Linux-mediatek mailing list