提交 f8026d21 编写于 作者: P Phil Elwell 提交者: Zheng Zengkai

lan78xx: Enable LEDs and auto-negotiation

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

For applications of the LAN78xx that don't have valid programmed
EEPROMs or OTPs, enabling both LEDs and auto-negotiation by default
seems reasonable.
Signed-off-by: NPhil Elwell <phil@raspberrypi.org>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 897d6ff2
......@@ -2453,6 +2453,11 @@ static int lan78xx_reset(struct lan78xx_net *dev)
int ret = 0;
unsigned long timeout;
u8 sig;
bool has_eeprom;
bool has_otp;
has_eeprom = !lan78xx_read_eeprom(dev, 0, 0, NULL);
has_otp = !lan78xx_read_otp(dev, 0, 0, NULL);
ret = lan78xx_read_reg(dev, HW_CFG, &buf);
buf |= HW_CFG_LRST_;
......@@ -2506,6 +2511,9 @@ 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 (!has_eeprom && !has_otp)
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);
......@@ -2561,6 +2569,9 @@ static int lan78xx_reset(struct lan78xx_net *dev)
buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
}
}
/* If no valid EEPROM and no valid OTP, enable AUTO negotiation */
if (!has_eeprom && !has_otp)
buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
ret = lan78xx_write_reg(dev, MAC_CR, buf);
ret = lan78xx_read_reg(dev, MAC_TX, &buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册