1 From ec6fe1f3510a68ea742758b1cd806a5a08fed7ae Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 17 Oct 2017 15:04:29 +0100
4 Subject: [PATCH] lan78xx: Enable LEDs and auto-negotiation
6 For applications of the LAN78xx that don't have valid programmed
7 EEPROMs or OTPs, enabling both LEDs and auto-negotiation by default
10 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
12 drivers/net/usb/lan78xx.c | 12 ++++++++++++
13 1 file changed, 12 insertions(+)
15 --- a/drivers/net/usb/lan78xx.c
16 +++ b/drivers/net/usb/lan78xx.c
17 @@ -2716,6 +2716,11 @@ static int lan78xx_reset(struct lan78xx_
24 + has_eeprom = !lan78xx_read_eeprom(dev, 0, 0, NULL);
25 + has_otp = !lan78xx_read_otp(dev, 0, 0, NULL);
27 ret = lan78xx_read_reg(dev, HW_CFG, &buf);
29 @@ -2797,6 +2802,10 @@ static int lan78xx_reset(struct lan78xx_
33 + /* If no valid EEPROM and no valid OTP, enable the LEDs by default */
34 + if (!has_eeprom && !has_otp)
35 + buf |= HW_CFG_LED0_EN_ | HW_CFG_LED1_EN_;
37 ret = lan78xx_write_reg(dev, HW_CFG, buf);
40 @@ -2895,6 +2904,9 @@ static int lan78xx_reset(struct lan78xx_
41 buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
44 + /* If no valid EEPROM and no valid OTP, enable AUTO negotiation */
45 + if (!has_eeprom && !has_otp)
46 + buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
47 ret = lan78xx_write_reg(dev, MAC_CR, buf);