summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2019-09-29 21:59:22 +0200
committerMichael Brown2019-09-29 21:59:22 +0200
commit3fe683ebab29afacf224e6b0921f6329bebcdca7 (patch)
tree58348eabd52a32d0019c45e873e0b187137f0d6f
parent[efi] Do not attempt EFI_USB_IO_PROTOCOL transfers during shutdown (diff)
downloadipxe-3fe683ebab29afacf224e6b0921f6329bebcdca7.tar.gz
ipxe-3fe683ebab29afacf224e6b0921f6329bebcdca7.tar.xz
ipxe-3fe683ebab29afacf224e6b0921f6329bebcdca7.zip
[lan78xx] Always enable automatic speed and duplex detection
On devices with no EEPROM or OTP, the MAC_CR register defaults to not using automatic link speed detection, with the result that no packets are successfully sent or received. Fix by always enabling automatic speed and duplex detection, since iPXE provides no mechanism for manual configuration of either link speed or duplex. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/net/lan78xx.c8
-rw-r--r--src/drivers/net/lan78xx.h6
2 files changed, 14 insertions, 0 deletions
diff --git a/src/drivers/net/lan78xx.c b/src/drivers/net/lan78xx.c
index a8cf5740..3f4f21b6 100644
--- a/src/drivers/net/lan78xx.c
+++ b/src/drivers/net/lan78xx.c
@@ -198,6 +198,13 @@ static int lan78xx_open ( struct net_device *netdev ) {
LAN78XX_BULK_IN_DLY_SET ( 0 ) ) ) != 0 )
goto err_bulk_in_dly;
+ /* Enable automatic speed and duplex detection */
+ if ( ( rc = smscusb_writel ( smscusb, LAN78XX_MAC_CR,
+ ( LAN78XX_MAC_CR_ADP |
+ LAN78XX_MAC_CR_ADD |
+ LAN78XX_MAC_CR_ASD ) ) ) != 0 )
+ goto err_mac_cr;
+
/* Configure receive filters */
if ( ( rc = smscusb_writel ( smscusb, LAN78XX_RFE_CTL,
( LAN78XX_RFE_CTL_AB |
@@ -256,6 +263,7 @@ static int lan78xx_open ( struct net_device *netdev ) {
err_fct_tx_ctl:
err_fct_rx_ctl:
err_rfe_ctl:
+ err_mac_cr:
err_bulk_in_dly:
err_int_ep_ctl:
usbnet_close ( &smscusb->usbnet );
diff --git a/src/drivers/net/lan78xx.h b/src/drivers/net/lan78xx.h
index 6ae17238..39422aec 100644
--- a/src/drivers/net/lan78xx.h
+++ b/src/drivers/net/lan78xx.h
@@ -49,6 +49,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define LAN78XX_FCT_TX_CTL 0x00c4
#define LAN78XX_FCT_TX_CTL_EN 0x80000000UL /**< FCT TX enable */
+/** MAC control register */
+#define LAN78XX_MAC_CR 0x0100
+#define LAN78XX_MAC_CR_ADP 0x00002000UL /**< Duplex polarity */
+#define LAN78XX_MAC_CR_ADD 0x00001000UL /**< Auto duplex */
+#define LAN78XX_MAC_CR_ASD 0x00000800UL /**< Auto speed */
+
/** MAC receive register */
#define LAN78XX_MAC_RX 0x0104
#define LAN78XX_MAC_RX_MAX_SIZE(mtu) ( (mtu) << 16 ) /**< Max frame size */