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 <contact@paulk.fr> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
committed by
Andre Przywara
parent
8513f7e78a
commit
48293ab19a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user