Browse Source

[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>
tags/v1.20.1
Michael Brown 4 years ago
parent
commit
3fe683ebab
2 changed files with 14 additions and 0 deletions
  1. 8
    0
      src/drivers/net/lan78xx.c
  2. 6
    0
      src/drivers/net/lan78xx.h

+ 8
- 0
src/drivers/net/lan78xx.c View File

@@ -198,6 +198,13 @@ static int lan78xx_open ( struct net_device *netdev ) {
198 198
 				     LAN78XX_BULK_IN_DLY_SET ( 0 ) ) ) != 0 )
199 199
 		goto err_bulk_in_dly;
200 200
 
201
+	/* Enable automatic speed and duplex detection */
202
+	if ( ( rc = smscusb_writel ( smscusb, LAN78XX_MAC_CR,
203
+				     ( LAN78XX_MAC_CR_ADP |
204
+				       LAN78XX_MAC_CR_ADD |
205
+				       LAN78XX_MAC_CR_ASD ) ) ) != 0 )
206
+		goto err_mac_cr;
207
+
201 208
 	/* Configure receive filters */
202 209
 	if ( ( rc = smscusb_writel ( smscusb, LAN78XX_RFE_CTL,
203 210
 				     ( LAN78XX_RFE_CTL_AB |
@@ -256,6 +263,7 @@ static int lan78xx_open ( struct net_device *netdev ) {
256 263
  err_fct_tx_ctl:
257 264
  err_fct_rx_ctl:
258 265
  err_rfe_ctl:
266
+ err_mac_cr:
259 267
  err_bulk_in_dly:
260 268
  err_int_ep_ctl:
261 269
 	usbnet_close ( &smscusb->usbnet );

+ 6
- 0
src/drivers/net/lan78xx.h View File

@@ -49,6 +49,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
49 49
 #define LAN78XX_FCT_TX_CTL 0x00c4
50 50
 #define LAN78XX_FCT_TX_CTL_EN		0x80000000UL	/**< FCT TX enable */
51 51
 
52
+/** MAC control register */
53
+#define LAN78XX_MAC_CR 0x0100
54
+#define LAN78XX_MAC_CR_ADP		0x00002000UL	/**< Duplex polarity */
55
+#define LAN78XX_MAC_CR_ADD		0x00001000UL	/**< Auto duplex */
56
+#define LAN78XX_MAC_CR_ASD		0x00000800UL	/**< Auto speed */
57
+
52 58
 /** MAC receive register */
53 59
 #define LAN78XX_MAC_RX 0x0104
54 60
 #define LAN78XX_MAC_RX_MAX_SIZE(mtu)	( (mtu) << 16 )	/**< Max frame size */

Loading…
Cancel
Save