From: Paul Kocialkowski Date: Tue, 5 Aug 2025 17:48:27 +0000 (+0200) Subject: net: sun8i-emac: Add support for active-low leds with internal PHY X-Git-Tag: v2026.01-rc1~2^2~4 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48293ab19ab225bd1074eea7d40987ced37460b8;p=pandora-u-boot.git net: sun8i-emac: Add support for active-low leds with internal PHY A device-tree property is already defined to indicate that the internal PHY should be used with active-low leds, which corresponds to a specific bit in the dedicated syscon register. Add support for setting this bit when the property is present. Signed-off-by: Paul Kocialkowski Reviewed-by: Andre Przywara --- diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c index 6e95392b379..41c52f56d7a 100644 --- a/drivers/net/sun8i_emac.c +++ b/drivers/net/sun8i_emac.c @@ -175,6 +175,7 @@ struct sun8i_eth_pdata { u32 reset_delays[3]; int tx_delay_ps; int rx_delay_ps; + bool leds_active_low; }; static int sun8i_mdio_read(struct mii_dev *bus, int addr, int devad, int reg) @@ -298,6 +299,9 @@ static int sun8i_emac_set_syscon(struct sun8i_eth_pdata *pdata, reg |= priv->phyaddr << H3_EPHY_ADDR_SHIFT; reg |= H3_EPHY_CLK_SEL; reg |= H3_EPHY_SELECT; + + if (pdata->leds_active_low) + reg |= H3_EPHY_LED_POL; } else { reg |= H3_EPHY_SHUTDOWN; } @@ -845,6 +849,10 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev) printf("%s: Invalid RX delay value %d\n", __func__, sun8i_pdata->rx_delay_ps); + sun8i_pdata->leds_active_low = + fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), + "allwinner,leds-active-low"); + if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), "snps,reset-active-low")) reset_flags |= GPIOD_ACTIVE_LOW;