summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kocialkowski <[email protected]>2025-08-05 19:48:27 +0200
committerAndre Przywara <[email protected]>2025-10-27 11:12:56 +0000
commit48293ab19ab225bd1074eea7d40987ced37460b8 (patch)
tree04befcf3ff96ee1232d5a4df52cdfba4f57cadcd
parent8513f7e78a9630c09c3d631055f319e890a319ad (diff)
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 <[email protected]> Reviewed-by: Andre Przywara <[email protected]>
-rw-r--r--drivers/net/sun8i_emac.c8
1 files changed, 8 insertions, 0 deletions
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;