From 05549e8905dd5bfcdbb9b38ecf97392aa4932399 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 17 Oct 2017 15:04:29 +0100 Subject: [PATCH] lan78xx: Enable LEDs if no valid EEPROM or OTP For applications of the LAN78xx that don't have valid programmed EEPROMs or OTPs, enabling both LEDs by default seems reasonable. Signed-off-by: Phil Elwell --- drivers/net/usb/lan78xx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 0798b260c38d..13238cb527ca 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2216,6 +2216,12 @@ static int lan78xx_reset(struct lan78xx_net *dev) ret = lan78xx_read_reg(dev, HW_CFG, &buf); buf |= HW_CFG_MEF_; + + /* If no valid EEPROM and no valid OTP, enable the LEDs by default */ + if (lan78xx_read_eeprom(dev, 0, 0, NULL) && + lan78xx_read_otp(dev, 0, 0, NULL)) + buf |= HW_CFG_LED0_EN_ | HW_CFG_LED1_EN_; + ret = lan78xx_write_reg(dev, HW_CFG, buf); ret = lan78xx_read_reg(dev, USB_CFG0, &buf); -- 2.30.2