iPXE
lan78xx.h
Go to the documentation of this file.
1#ifndef _LAN78XX_H
2#define _LAN78XX_H
3
4/** @file
5 *
6 * Microchip LAN78xx USB Ethernet driver
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include "smscusb.h"
14#include "smsc75xx.h"
15
16/** Hardware configuration register */
17#define LAN78XX_HW_CFG 0x0010
18#define LAN78XX_HW_CFG_LED1_EN 0x00200000UL /**< LED1 enable */
19#define LAN78XX_HW_CFG_LED0_EN 0x00100000UL /**< LED1 enable */
20#define LAN78XX_HW_CFG_LRST 0x00000002UL /**< Soft lite reset */
21
22/** Interrupt endpoint control register */
23#define LAN78XX_INT_EP_CTL 0x0098
24#define LAN78XX_INT_EP_CTL_RDFO_EN 0x00400000UL /**< RX FIFO overflow */
25#define LAN78XX_INT_EP_CTL_PHY_EN 0x00020000UL /**< PHY interrupt */
26
27/** Bulk IN delay register */
28#define LAN78XX_BULK_IN_DLY 0x0094
29#define LAN78XX_BULK_IN_DLY_SET(ticks) ( (ticks) << 0 ) /**< Delay / 16.7ns */
30
31/** EEPROM register base */
32#define LAN78XX_E2P_BASE 0x0040
33
34/** USB configuration register 0 */
35#define LAN78XX_USB_CFG0 0x0080
36#define LAN78XX_USB_CFG0_BIR 0x00000040UL /**< Bulk IN use NAK */
37
38/** Receive filtering engine control register */
39#define LAN78XX_RFE_CTL 0x00b0
40#define LAN78XX_RFE_CTL_AB 0x00000400UL /**< Accept broadcast */
41#define LAN78XX_RFE_CTL_AM 0x00000200UL /**< Accept multicast */
42#define LAN78XX_RFE_CTL_AU 0x00000100UL /**< Accept unicast */
43
44/** FIFO controller RX FIFO control register */
45#define LAN78XX_FCT_RX_CTL 0x00c0
46#define LAN78XX_FCT_RX_CTL_EN 0x80000000UL /**< FCT RX enable */
47#define LAN78XX_FCT_RX_CTL_BAD 0x02000000UL /**< Store bad frames */
48
49/** FIFO controller TX FIFO control register */
50#define LAN78XX_FCT_TX_CTL 0x00c4
51#define LAN78XX_FCT_TX_CTL_EN 0x80000000UL /**< FCT TX enable */
52
53/** MAC control register */
54#define LAN78XX_MAC_CR 0x0100
55#define LAN78XX_MAC_CR_ADP 0x00002000UL /**< Duplex polarity */
56#define LAN78XX_MAC_CR_ADD 0x00001000UL /**< Auto duplex */
57#define LAN78XX_MAC_CR_ASD 0x00000800UL /**< Auto speed */
58
59/** MAC receive register */
60#define LAN78XX_MAC_RX 0x0104
61#define LAN78XX_MAC_RX_MAX_SIZE(mtu) ( (mtu) << 16 ) /**< Max frame size */
62#define LAN78XX_MAC_RX_MAX_SIZE_DEFAULT \
63 LAN78XX_MAC_RX_MAX_SIZE ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
64#define LAN78XX_MAC_RX_FCS 0x00000010UL /**< FCS stripping */
65#define LAN78XX_MAC_RX_EN 0x00000001UL /**< RX enable */
66
67/** MAC transmit register */
68#define LAN78XX_MAC_TX 0x0108
69#define LAN78XX_MAC_TX_EN 0x00000001UL /**< TX enable */
70
71/** MAC receive address register base */
72#define LAN78XX_RX_ADDR_BASE 0x0118
73
74/** MII register base */
75#define LAN78XX_MII_BASE 0x0120
76
77/** PHY interrupt mask MII register */
78#define LAN78XX_MII_PHY_INTR_MASK 25
79
80/** PHY interrupt source MII register */
81#define LAN78XX_MII_PHY_INTR_SOURCE 26
82
83/** PHY interrupt: global enable */
84#define LAN78XX_PHY_INTR_ENABLE 0x8000
85
86/** PHY interrupt: link state change */
87#define LAN78XX_PHY_INTR_LINK 0x2000
88
89/** PHY interrupt: auto-negotiation failure */
90#define LAN78XX_PHY_INTR_ANEG_ERR 0x0800
91
92/** PHY interrupt: auto-negotiation complete */
93#define LAN78XX_PHY_INTR_ANEG_DONE 0x0400
94
95/** MAC address perfect filter register base */
96#define LAN78XX_ADDR_FILT_BASE 0x0400
97
98/** OTP register base */
99#define LAN78XX_OTP_BASE 0x1000
100
101/** Maximum time to wait for reset (in milliseconds) */
102#define LAN78XX_RESET_MAX_WAIT_MS 100
103
104#endif /* _LAN78XX_H */
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
SMSC LAN75xx USB Ethernet driver.
SMSC USB Ethernet drivers.