Re: [PATCH 2/2] stmmac: intel: Honor phy LED set by system firmware on a Dell hardware

From: Kai-Heng Feng
Date: Fri Jan 14 2022 - 10:23:11 EST


On Fri, Jan 14, 2022 at 9:09 PM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> On Fri, Jan 14, 2022 at 12:07:54PM +0800, Kai-Heng Feng wrote:
> > BIOS on Dell Edge Gateway 3200 already makes its own phy LED setting, so
> > instead of setting another value, keep it untouched and restore the saved
> > value on system resume.
> >
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
> > ---
> > .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 16 +++++
> > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +
> > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++
> > drivers/net/phy/marvell.c | 58 ++++++++++++-------
> > include/linux/marvell_phy.h | 1 +
> > 5 files changed, 61 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
> > index 8e8778cfbbadd..f8a2879e0264a 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
> > @@ -857,6 +857,16 @@ static const struct dmi_system_id quark_pci_dmi[] = {
> > {}
> > };
> >
> > +static const struct dmi_system_id use_preset_led[] = {
> > + {
> > + .matches = {
> > + DMI_MATCH(DMI_SYS_VENDOR, "Dell EMC"),
> > + DMI_MATCH(DMI_PRODUCT_NAME, "Edge Gateway 3200"),
> > + },
> > + },
> > + {}
> > +};
>
> This is a PHY property. Why is the MAC involved?

This is inspired by commit a93f7fe13454 ("net: phy: marvell: add new
default led configure for m88e151x") which passes the flag from MAC to
PHY.

>
> Please also think about how to make this generic, so any ACPI based
> system can use it, with any PHY.

ACPI property won't work because it ties to ACPI platform device or
PCI device, so the property still needs to be passed from MAC to PHY.

So the only approach I can think of is to use DMI match directly in PHY driver.

Kai-Heng

>
> Andrew