lan78xx: Enable LEDs if no valid EEPROM or OTP
authorPhil Elwell <phil@raspberrypi.org>
Tue, 17 Oct 2017 14:04:29 +0000 (15:04 +0100)
committerRaspbian kernel package updater <root@raspbian.org>
Sat, 31 Mar 2018 14:57:26 +0000 (15:57 +0100)
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 <phil@raspberrypi.org>
drivers/net/usb/lan78xx.c

index 0798b260c38d2ce12ac73dac2ee5a16498c9fc1c..13238cb527ca490336b310c2f521710b741a6fed 100644 (file)
@@ -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);